DEV Community

Ramu Narasinga
Ramu Narasinga

Posted on

attw script in CopilotKit codebase.

In this article, we review attw script in CopilotKit codebase. You will learn:

  1. What is attw?

  2. attw script in CopilotKit

What is attw?

attw is a CLI for arethetypeswrong.github.io..This project attempts to analyze npm package contents for issues with their TypeScript types, particularly ESM-related module resolution issues. The following kinds of problems can be detected in the node10, node16, and bundler module resolution modes:

πŸ’€ Resolution failed.

❌ No types.

🎭 Masquerading as CJS.

πŸ‘Ί Masquerading as ESM.

⚠️ ESM (dynamic import only).

πŸ› Used fallback condition.

🀨 CJS default export.

❗️ Incorrect default export.

❓ Missing export =.

🚭 Unexpected module syntax.

πŸ₯΄ Internal resolution error.

πŸ•΅οΈβ€β™‚οΈ Named exports.

Below is a check I ran on my npm package, thinkthroo and these were the issues found

attw script in CopilotKit

Since now that we understand what attw does, let’s review how CopilotKit uses this in the package.json script.

I the CopilotKit/packages/agentcore-runner/package.json,. you will find the below code nsippet:

"scripts": {
    ...
    "attw": "attw --pack . --profile node16"
  },
Enter fullscreen mode Exit fullscreen mode

This has two arguments/options/flags passed.

  • pack

Specify a directory to run npm pack in (instead of specifying a tarball filename), analyze the resulting tarball, and delete it afterwards.

attw --pack .
Enter fullscreen mode Exit fullscreen mode
  • profile

Profiles select a set of resolution modes to require/ignore. All are evaluated but failures outside of those required are ignored.

The available profiles are:

  • strict - requires all resolutions

  • node16 - ignores node10 resolution failures

  • esm-only - ignores CJS resolution failures

In the CLI: --profile

The script in CopilotKit ignores the node10 resolution failures.

About me:

Hey, my name is ramunarasinga. Email: ramunarasinga@gmail.com

Tired of AI slop?

I spent 3+ years studying OSS codebases and wrote 350+ articles on what makes them production-grade. I built

Get started for free β€” thinkthroo.com

References:

  1. package/@arethetypeswrong/cli.

  2. CopilotKit/packages/agentcore-runner/package.json#L27.

  3. arethetypeswrong.github.io.

Top comments (0)