autotel-cli 0.18.2 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ autotel
2
+ Copyright 2026 Jag Reehal
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
5
+ See the LICENSE file for the full license text.
6
+
7
+ "autotel" is a trademark of Jag Reehal. The Apache License, Version 2.0
8
+ does not grant rights to use the "autotel" name. See TRADEMARKS.md for
9
+ the trademark policy.
package/README.md CHANGED
@@ -13,7 +13,7 @@ For agents: see [`SKILL.md`](./SKILL.md) for the one-command bootstrap.
13
13
  ```bash
14
14
  npm install -g autotel-cli
15
15
  # or
16
- npx autotel <command>
16
+ npx autotel-cli <command>
17
17
  ```
18
18
 
19
19
  ## Commands
@@ -24,16 +24,16 @@ Interactive setup wizard to initialize autotel in your project.
24
24
 
25
25
  ```bash
26
26
  # Interactive mode
27
- npx autotel init
27
+ npx autotel-cli init
28
28
 
29
29
  # Use defaults (local backend, all auto-instrumentations)
30
- npx autotel init --yes
30
+ npx autotel-cli init --yes
31
31
 
32
32
  # Use a quick preset
33
- npx autotel init --preset node-datadog-pino
33
+ npx autotel-cli init --preset node-datadog-pino
34
34
 
35
35
  # Dry run - see what would be created
36
- npx autotel init --dry-run
36
+ npx autotel-cli init --dry-run
37
37
  ```
38
38
 
39
39
  By default `autotel init` **scans your package.json** (and the workspace root
@@ -116,16 +116,16 @@ Run diagnostics on your autotel setup.
116
116
 
117
117
  ```bash
118
118
  # Run all checks
119
- npx autotel doctor
119
+ npx autotel-cli doctor
120
120
 
121
121
  # Output as JSON
122
- npx autotel doctor --json
122
+ npx autotel-cli doctor --json
123
123
 
124
124
  # Auto-fix resolvable issues
125
- npx autotel doctor --fix
125
+ npx autotel-cli doctor --fix
126
126
 
127
127
  # List available checks
128
- npx autotel doctor --list-checks
128
+ npx autotel-cli doctor --list-checks
129
129
  ```
130
130
 
131
131
  **Options:**
@@ -147,22 +147,22 @@ Add a backend, subscriber, plugin, or platform incrementally.
147
147
 
148
148
  ```bash
149
149
  # Add Datadog backend
150
- npx autotel add backend datadog
150
+ npx autotel-cli add backend datadog
151
151
 
152
152
  # Add PostHog event subscriber
153
- npx autotel add subscriber posthog
153
+ npx autotel-cli add subscriber posthog
154
154
 
155
155
  # Add Mongoose plugin
156
- npx autotel add plugin mongoose
156
+ npx autotel-cli add plugin mongoose
157
157
 
158
158
  # List all available presets
159
- npx autotel add --list
159
+ npx autotel-cli add --list
160
160
 
161
161
  # List backends only
162
- npx autotel add backend --list
162
+ npx autotel-cli add backend --list
163
163
 
164
164
  # Show help for a specific preset
165
- npx autotel add backend datadog --help
165
+ npx autotel-cli add backend datadog --help
166
166
  ```
167
167
 
168
168
  **Types:**
@@ -184,23 +184,23 @@ Reads your source, finds every entry point, and scores what context you would ha
184
184
 
185
185
  ```bash
186
186
  # Score the project and write autotel.map.json
187
- npx autotel map
187
+ npx autotel-cli map
188
188
 
189
189
  # Every entry point as a check matrix
190
- npx autotel map --all
190
+ npx autotel-cli map --all
191
191
 
192
192
  # Explain one entry point and how to fix it
193
- npx autotel map app/api/checkout/route.ts
194
- npx autotel map /api/checkout
193
+ npx autotel-cli map app/api/checkout/route.ts
194
+ npx autotel-cli map /api/checkout
195
195
 
196
196
  # Machine-readable, for agents and CI
197
- npx autotel map --json
197
+ npx autotel-cli map --json
198
198
 
199
199
  # Fail CI below a threshold
200
- npx autotel map --min-score 70
200
+ npx autotel-cli map --min-score 70
201
201
 
202
202
  # Fail CI when a check that used to pass now fails
203
- npx autotel map --baseline git:origin/main
203
+ npx autotel-cli map --baseline git:origin/main
204
204
  ```
205
205
 
206
206
  **Detected frameworks:** `next`, `nitro` (Nuxt), `tanstack-start`, `sveltekit`, `hono`, `express`, `fastify`, `elysia`, `cloudflare`. Override with `--framework <name>`.
@@ -252,26 +252,26 @@ Wrap functions in `trace()` with a span name derived from the function/variable/
252
252
 
253
253
  ```bash
254
254
  # Single file (TypeScript or JavaScript)
255
- npx autotel codemod trace src/index.ts
256
- npx autotel codemod trace src/utils.js
255
+ npx autotel-cli codemod trace src/index.ts
256
+ npx autotel-cli codemod trace src/utils.js
257
257
 
258
258
  # Glob pattern - TypeScript only
259
- npx autotel codemod trace "src/**/*.ts"
259
+ npx autotel-cli codemod trace "src/**/*.ts"
260
260
 
261
261
  # Glob pattern - all supported files
262
- npx autotel codemod trace "src/**/*.{ts,tsx,js,jsx}"
262
+ npx autotel-cli codemod trace "src/**/*.{ts,tsx,js,jsx}"
263
263
 
264
264
  # Dry run - print what would change without writing
265
- npx autotel codemod trace "src/**/*.ts" --dry-run
265
+ npx autotel-cli codemod trace "src/**/*.ts" --dry-run
266
266
 
267
267
  # Custom span name template: {name}, {file} (basename), {path} (relative)
268
- npx autotel codemod trace "src/**/*.ts" --name-pattern "{file}.{name}"
268
+ npx autotel-cli codemod trace "src/**/*.ts" --name-pattern "{file}.{name}"
269
269
 
270
270
  # Skip functions whose name matches a regex (repeatable)
271
- npx autotel codemod trace "src/**/*.ts" --skip "^_" --skip "test|mock"
271
+ npx autotel-cli codemod trace "src/**/*.ts" --skip "^_" --skip "test|mock"
272
272
 
273
273
  # Print per-file summary (wrapped count, skipped)
274
- npx autotel codemod trace "src/**/*.ts" --print-files
274
+ npx autotel-cli codemod trace "src/**/*.ts" --print-files
275
275
  ```
276
276
 
277
277
  **Options:**
@@ -310,10 +310,10 @@ The CLI detects workspace roots and handles installation correctly:
310
310
 
311
311
  ```bash
312
312
  # Install at package root (default)
313
- npx autotel init --cwd ./packages/my-app
313
+ npx autotel-cli init --cwd ./packages/my-app
314
314
 
315
315
  # Install at workspace root
316
- npx autotel init --cwd ./packages/my-app --workspace-root
316
+ npx autotel-cli init --cwd ./packages/my-app --workspace-root
317
317
  ```
318
318
 
319
319
  ## Generated Files
package/dist/index.js CHANGED
@@ -4196,6 +4196,62 @@ function networkCallHandled(call) {
4196
4196
  return false;
4197
4197
  }
4198
4198
  /**
4199
+ * Every name a file binds from a module, from `import` declarations and from
4200
+ * top-level `const x = require('m')` / `const { a, b: c } = require('m')`.
4201
+ */
4202
+ function moduleBindings(source) {
4203
+ const bindings = [];
4204
+ const bind = (local, imported, specifier) => {
4205
+ bindings.push({
4206
+ local,
4207
+ imported,
4208
+ specifier
4209
+ });
4210
+ };
4211
+ for (const declaration of source.getImportDeclarations()) {
4212
+ const specifier = declaration.getModuleSpecifierValue();
4213
+ const defaultImport = declaration.getDefaultImport();
4214
+ if (defaultImport) bind(defaultImport.getText(), defaultImport.getText(), specifier);
4215
+ for (const named of declaration.getNamedImports()) bind(named.getAliasNode()?.getText() ?? named.getName(), named.getName(), specifier);
4216
+ const namespaceImport = declaration.getNamespaceImport();
4217
+ if (namespaceImport) bind(namespaceImport.getText(), "*", specifier);
4218
+ }
4219
+ for (const statement of source.getVariableStatements()) for (const declaration of statement.getDeclarations()) {
4220
+ const initializer = declaration.getInitializer();
4221
+ if (!initializer?.isKind(SyntaxKind.CallExpression)) continue;
4222
+ if (initializer.getExpression().getText() !== "require") continue;
4223
+ const [argument] = initializer.getArguments();
4224
+ if (!argument?.isKind(SyntaxKind.StringLiteral)) continue;
4225
+ const specifier = argument.getLiteralValue();
4226
+ const name = declaration.getNameNode();
4227
+ if (name.isKind(SyntaxKind.Identifier)) {
4228
+ bind(name.getText(), "*", specifier);
4229
+ continue;
4230
+ }
4231
+ if (!name.isKind(SyntaxKind.ObjectBindingPattern)) continue;
4232
+ for (const element of name.getElements()) {
4233
+ const local = element.getNameNode().getText();
4234
+ bind(local, element.getPropertyNameNode()?.getText() ?? local, specifier);
4235
+ }
4236
+ }
4237
+ return bindings;
4238
+ }
4239
+ /**
4240
+ * Every module a file loads, whether or not the load binds a name. A
4241
+ * side-effect `import 'passport'` or bare `require('passport')` binds nothing
4242
+ * and still decides that the file handles auth.
4243
+ */
4244
+ function moduleSpecifiers(source) {
4245
+ const modules = /* @__PURE__ */ new Set();
4246
+ for (const declaration of source.getImportDeclarations()) modules.add(declaration.getModuleSpecifierValue());
4247
+ for (const call of source.getDescendantsOfKind(SyntaxKind.CallExpression)) {
4248
+ if (call.getExpression().getText() !== "require") continue;
4249
+ const [argument] = call.getArguments();
4250
+ if (argument?.isKind(SyntaxKind.StringLiteral)) modules.add(argument.getLiteralValue());
4251
+ }
4252
+ return modules;
4253
+ }
4254
+ /**
4199
4255
  * Reduce a parsed file to {@link FileFacts} in a single walk.
4200
4256
  *
4201
4257
  * @param scope Narrows the walk to one subtree — the handler function, for a
@@ -4205,19 +4261,10 @@ function networkCallHandled(call) {
4205
4261
  function buildFileFacts(source, scope) {
4206
4262
  const imports = /* @__PURE__ */ new Map();
4207
4263
  const importedNames = /* @__PURE__ */ new Map();
4208
- const modules = /* @__PURE__ */ new Set();
4209
- for (const declaration of source.getImportDeclarations()) {
4210
- const specifier = declaration.getModuleSpecifierValue();
4211
- modules.add(specifier);
4212
- const bind = (name, importedName = name) => {
4213
- imports.set(name, specifier);
4214
- importedNames.set(name, importedName);
4215
- };
4216
- const defaultImport = declaration.getDefaultImport();
4217
- if (defaultImport) bind(defaultImport.getText());
4218
- for (const named of declaration.getNamedImports()) bind(named.getAliasNode()?.getText() ?? named.getName(), named.getName());
4219
- const namespaceImport = declaration.getNamespaceImport();
4220
- if (namespaceImport) bind(namespaceImport.getText(), "*");
4264
+ const modules = moduleSpecifiers(source);
4265
+ for (const { local, imported, specifier } of moduleBindings(source)) {
4266
+ imports.set(local, specifier);
4267
+ importedNames.set(local, imported);
4221
4268
  }
4222
4269
  const calls = [];
4223
4270
  const throws = [];
@@ -4383,14 +4430,10 @@ function importedCalls(source, modulePrefix, canonicalNames) {
4383
4430
  const names = new Set(canonicalNames);
4384
4431
  const locals = /* @__PURE__ */ new Map();
4385
4432
  const namespaces = /* @__PURE__ */ new Set();
4386
- for (const declaration of source.getImportDeclarations()) {
4387
- if (!declaration.getModuleSpecifierValue().startsWith(modulePrefix)) continue;
4388
- for (const named of declaration.getNamedImports()) {
4389
- if (!names.has(named.getName())) continue;
4390
- locals.set(named.getAliasNode()?.getText() ?? named.getName(), named.getName());
4391
- }
4392
- const namespace = declaration.getNamespaceImport()?.getText();
4393
- if (namespace) namespaces.add(namespace);
4433
+ for (const { local, imported, specifier } of moduleBindings(source)) {
4434
+ if (!specifier.startsWith(modulePrefix)) continue;
4435
+ if (imported === "*") namespaces.add(local);
4436
+ else if (names.has(imported)) locals.set(local, imported);
4394
4437
  }
4395
4438
  const found = /* @__PURE__ */ new Map();
4396
4439
  for (const call of source.getDescendantsOfKind(SyntaxKind.CallExpression)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-cli",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
4
4
  "description": "CLI for autotel - setup wizard, diagnostics, and incremental features",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,12 +13,14 @@
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "LICENSE",
18
+ "NOTICE"
17
19
  ],
18
20
  "dependencies": {
19
21
  "@inquirer/prompts": "^8.5.2",
20
22
  "@opentelemetry/otlp-transformer": "^0.222.0",
21
- "autotel-mcp": "0.8.0",
23
+ "autotel-mcp": "0.9.0",
22
24
  "chalk": "^5.6.2",
23
25
  "commander": "^15.0.0",
24
26
  "glob": "^13.0.6",