@tasszz2k/agentlens 0.3.0

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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +402 -0
  3. package/dist/ai.d.ts +5 -0
  4. package/dist/ai.d.ts.map +1 -0
  5. package/dist/ai.js +56 -0
  6. package/dist/ai.js.map +1 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +313 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/config.d.ts +29 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +193 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/cost.d.ts +5 -0
  16. package/dist/cost.d.ts.map +1 -0
  17. package/dist/cost.js +362 -0
  18. package/dist/cost.js.map +1 -0
  19. package/dist/parse.d.ts +26 -0
  20. package/dist/parse.d.ts.map +1 -0
  21. package/dist/parse.js +391 -0
  22. package/dist/parse.js.map +1 -0
  23. package/dist/render.d.ts +8 -0
  24. package/dist/render.d.ts.map +1 -0
  25. package/dist/render.js +346 -0
  26. package/dist/render.js.map +1 -0
  27. package/dist/scan.d.ts +23 -0
  28. package/dist/scan.d.ts.map +1 -0
  29. package/dist/scan.js +457 -0
  30. package/dist/scan.js.map +1 -0
  31. package/dist/symlink.d.ts +5 -0
  32. package/dist/symlink.d.ts.map +1 -0
  33. package/dist/symlink.js +56 -0
  34. package/dist/symlink.js.map +1 -0
  35. package/dist/troubleshoot.d.ts +4 -0
  36. package/dist/troubleshoot.d.ts.map +1 -0
  37. package/dist/troubleshoot.js +193 -0
  38. package/dist/troubleshoot.js.map +1 -0
  39. package/dist/types.d.ts +103 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +2 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/ui/App.d.ts +16 -0
  44. package/dist/ui/App.d.ts.map +1 -0
  45. package/dist/ui/App.js +452 -0
  46. package/dist/ui/App.js.map +1 -0
  47. package/dist/ui/CommandBar.d.ts +8 -0
  48. package/dist/ui/CommandBar.d.ts.map +1 -0
  49. package/dist/ui/CommandBar.js +77 -0
  50. package/dist/ui/CommandBar.js.map +1 -0
  51. package/dist/ui/CostView.d.ts +14 -0
  52. package/dist/ui/CostView.d.ts.map +1 -0
  53. package/dist/ui/CostView.js +200 -0
  54. package/dist/ui/CostView.js.map +1 -0
  55. package/dist/ui/DetailPanel.d.ts +12 -0
  56. package/dist/ui/DetailPanel.d.ts.map +1 -0
  57. package/dist/ui/DetailPanel.js +224 -0
  58. package/dist/ui/DetailPanel.js.map +1 -0
  59. package/dist/ui/HelpBar.d.ts +7 -0
  60. package/dist/ui/HelpBar.d.ts.map +1 -0
  61. package/dist/ui/HelpBar.js +51 -0
  62. package/dist/ui/HelpBar.js.map +1 -0
  63. package/dist/ui/SearchBar.d.ts +9 -0
  64. package/dist/ui/SearchBar.d.ts.map +1 -0
  65. package/dist/ui/SearchBar.js +46 -0
  66. package/dist/ui/SearchBar.js.map +1 -0
  67. package/dist/ui/SettingsView.d.ts +16 -0
  68. package/dist/ui/SettingsView.d.ts.map +1 -0
  69. package/dist/ui/SettingsView.js +155 -0
  70. package/dist/ui/SettingsView.js.map +1 -0
  71. package/dist/ui/TreeView.d.ts +26 -0
  72. package/dist/ui/TreeView.d.ts.map +1 -0
  73. package/dist/ui/TreeView.js +240 -0
  74. package/dist/ui/TreeView.js.map +1 -0
  75. package/dist/ui/theme.d.ts +30 -0
  76. package/dist/ui/theme.d.ts.map +1 -0
  77. package/dist/ui/theme.js +31 -0
  78. package/dist/ui/theme.js.map +1 -0
  79. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tass Dinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,402 @@
1
+ # AgentLens
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@tasszz2k/agentlens)](https://www.npmjs.com/package/@tasszz2k/agentlens)
4
+ [![license](https://img.shields.io/npm/l/@tasszz2k/agentlens)](LICENSE)
5
+
6
+
7
+ CLI tool to scan agent configuration, track usage costs, and inspects agent configuration across AI coding tools.
8
+
9
+ AgentLens discovers skills, rules, commands, context files, hooks, and MCP server configs for **Cursor**, **Claude Code**, **Codex**, **GitHub Copilot**, and multi-agent setups (`AGENTS.md`). It scans both global (`~/.cursor`, `~/.claude`, etc.) and project-level locations, then displays an interactive tree or static text map. With configured workspace roots, it also discovers and scans all projects across your workspace.
10
+
11
+ It also provides a **cost dashboard** showing usage and costs for Claude Code (from local JSONL logs) and Cursor (from the Cursor API).
12
+
13
+ ## Screenshots
14
+
15
+ ### Scan -- agent configuration tree
16
+
17
+ ![AgentLens Scan view](docs/screenshot-scan.png)
18
+
19
+ ### Skill detail panel
20
+
21
+ ![AgentLens skill detail](docs/screenshot-skill.png)
22
+
23
+ ### Cost -- usage and cost dashboard
24
+
25
+ ![AgentLens Cost view](docs/screenshot-cost.png)
26
+
27
+ ### Settings -- settings and configuration
28
+
29
+ ![AgentLens Settings](docs/screenshot-settings.png)
30
+
31
+ ## Sample Output
32
+
33
+ ```
34
+ AGENTLENS -- Agent Configuration Map
35
+ =====================================
36
+
37
+ GLOBAL
38
+
39
+ Canonical Store ~/.agents/skills/
40
+ ├── find-skills/SKILL.md "Helps users discover and install agent skills w..."
41
+ ├── git-commit/SKILL.md "Execute git commit with conventional commit mes..."
42
+ └── requirements-clarity/SKILL.md "Clarify ambiguous requirements through focused ..."
43
+ Claude Code
44
+ ├── Skills ~/.claude/skills/
45
+ │ ├── find-skills/SKILL.md --> ../../.agents/skills/find-skills "Helps users discover and install..."
46
+ │ └── git-commit/SKILL.md --> ../../.agents/skills/git-commit "Execute git commit with conventi..."
47
+ ├── Commands ~/.claude/commands/
48
+ │ └── (not found)
49
+ ├── Context ~/.claude
50
+ │ └── (empty)
51
+ ├── Hooks ~/.claude/settings.json/
52
+ │ ├── Notification command: notify.sh
53
+ │ └── SessionStart command: notify.sh
54
+ └── MCP Servers ~/.claude.json/
55
+ └── jira (http) https://jira.example.com/mcp
56
+ Cursor
57
+ ├── Skills (user) ~/.cursor/skills/
58
+ │ └── git-commit/SKILL.md --> ../../.agents/skills/git-commit "Execute git commit with conventi..."
59
+ ├── Rules ~/.cursor/rules/
60
+ │ └── (not found)
61
+ ├── Context (user rules) ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb
62
+ │ └── (empty)
63
+ ├── MCP Servers ~/.cursor/mcp.json/
64
+ │ ├── github-cloud (http) https://api.githubcopilot.com/mcp/ [auth]
65
+ │ └── glean (http) https://example.glean.com/mcp/cortex
66
+ └── Skills (plugin: cursor-public/glean) ~/.cursor/plugins/cache/.../skills/
67
+ ├── enterprise-search/SKILL.md "Search company documents, wikis, policies..."
68
+ └── find-expert/SKILL.md "Find subject matter experts for a topic..."
69
+ Codex
70
+ ├── Skills ~/.codex/skills/
71
+ │ └── playwright/SKILL.md "Use when the task requires automating a real br..."
72
+ ├── Rules ~/.codex/rules/
73
+ │ └── default.rules
74
+ └── MCP Servers ~/.codex/config.toml/
75
+ └── (empty)
76
+
77
+ PROJECT ~/Code/myapp
78
+
79
+ Cursor
80
+ └── Rules ~/Code/myapp/.cursor/rules/
81
+ └── project-context.mdc "Project context and conventions"
82
+
83
+ OTHER PROJECTS (5 discovered)
84
+
85
+ ~/Code/backend-api
86
+ Claude Code
87
+ ├── Skills .claude/skills/
88
+ │ ├── api-patterns/SKILL.md "REST API design patterns and conventions..."
89
+ │ └── testing-guide/SKILL.md "Testing guidance for behavior changes..."
90
+ └── Context
91
+ └── CLAUDE.md
92
+ Cursor
93
+ ├── Rules .cursor/rules/
94
+ │ ├── agent-behavior.md
95
+ │ ├── git-conventions.md
96
+ │ └── go-conventions.md
97
+ └── Skills .cursor/skills/
98
+ └── (empty)
99
+
100
+ ~/Code/web-dashboard
101
+ Canonical Store .agents/skills/
102
+ ├── frontend-design/SKILL.md "Create distinctive, production-grade frontend..."
103
+ └── tailwind-design-system/SKILL.md "Build scalable design systems with Tailwind..."
104
+ Cursor
105
+ └── Rules .cursor/rules/
106
+ ├── coding-standards.mdc "Coding standards and conventions"
107
+ └── project-context.mdc "Project overview and architecture..."
108
+ ```
109
+
110
+ ## Install
111
+
112
+ ```bash
113
+ # From npm (recommended)
114
+ npm install -g @tasszz2k/agentlens
115
+
116
+ # Or run directly with npx
117
+ npx @tasszz2k/agentlens
118
+
119
+ # Or from source
120
+ git clone https://github.com/tasszz2k/agent-lens.git
121
+ cd agent-lens
122
+ npm install && npm run build
123
+ npm link
124
+ ```
125
+
126
+ ## Quick Start
127
+
128
+ ### 1. Configure workspace roots
129
+
130
+ Tell AgentLens where your projects live so it can discover and scan them all:
131
+
132
+ ```bash
133
+ # Add one or more root directories containing your projects
134
+ agentlens config --add-root ~/Code
135
+ agentlens config --add-root ~/Documents/Workspace
136
+
137
+ # Verify configured roots
138
+ agentlens config --list-roots
139
+ ```
140
+
141
+ AgentLens will recursively discover projects with agent markers (`.cursor/`, `.claude/`, `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`) up to 3 levels deep.
142
+
143
+ ### 2. Run AgentLens
144
+
145
+ ```bash
146
+ # From any project directory -- scans global + current project + all discovered projects
147
+ agentlens
148
+ ```
149
+
150
+ That's it. AgentLens launches an interactive TUI showing your full agent configuration map across all tools and projects.
151
+
152
+ ### 3. Explore the tree
153
+
154
+ - Navigate with `j`/`k` (or arrow keys), expand/collapse with `l`/`h`
155
+ - Press `Enter` to view entry details (path, symlinks, frontmatter, linked installations)
156
+ - Press `/` to search/filter, `ESC` to clear
157
+ - Press `:` to open the command bar and switch pages (Scan, Cost)
158
+ - Press `?` to toggle the help bar
159
+
160
+ ### 4. View usage costs
161
+
162
+ ```bash
163
+ # Open the cost dashboard directly
164
+ agentlens cost
165
+
166
+ # Or switch to the Cost page from the TUI with `:cost`
167
+ ```
168
+
169
+ See [Cost Dashboard](#cost-dashboard) for setup details.
170
+
171
+ ## Usage
172
+
173
+ ```
174
+ agentlens [scan] [options] Scan and display agent config tree (default)
175
+ agentlens cost [options] Show agent usage and cost dashboard
176
+ agentlens where [name] Trace where canonical skills are installed
177
+ agentlens troubleshoot Run health checks with optional AI analysis
178
+ agentlens config Manage workspace roots, tokens, and tool filters
179
+ agentlens config tools Manage tool/category visibility filters
180
+ ```
181
+
182
+ ### Options
183
+
184
+ **scan** (default command)
185
+
186
+ | Flag | Description |
187
+ |---|---|
188
+ | `-p, --project <path>` | Project directory to scan (default: cwd) |
189
+ | `--no-global` | Skip global config scanning |
190
+ | `--no-ai` | Skip AI analysis |
191
+ | `--json` | Output JSON instead of tree |
192
+
193
+ **cost**
194
+
195
+ | Flag | Description |
196
+ |---|---|
197
+ | `--json` | Output JSON instead of formatted text |
198
+ | `--no-cursor` | Skip Cursor API (only show Claude Code costs) |
199
+
200
+ **config**
201
+
202
+ | Flag | Description |
203
+ |---|---|
204
+ | `--add-root <path>` | Add a workspace root directory |
205
+ | `--remove-root <path>` | Remove a workspace root directory |
206
+ | `--list-roots` | List configured root directories |
207
+ | `--set-cursor-token <token>` | Set Cursor session token for cost tracking |
208
+ | `--clear-cursor-token` | Remove stored Cursor session token |
209
+
210
+ ### Examples
211
+
212
+ ```bash
213
+ # Scan current project + global config (interactive TUI in TTY)
214
+ agentlens
215
+
216
+ # Scan a specific project, JSON output
217
+ agentlens scan -p ~/projects/myapp --json
218
+
219
+ # View cost dashboard
220
+ agentlens cost
221
+
222
+ # View Claude Code costs only (skip Cursor)
223
+ agentlens cost --no-cursor
224
+
225
+ # Find where a canonical skill is installed
226
+ agentlens where git-commit
227
+
228
+ # Run health checks
229
+ agentlens troubleshoot
230
+
231
+ # Filter tools -- hide Codex from results
232
+ agentlens config tools --disable "Codex"
233
+
234
+ # Filter categories -- hide plugin skills
235
+ agentlens config tools --disable "plugin"
236
+
237
+ # Show current filter state
238
+ agentlens config tools
239
+ ```
240
+
241
+ ## Cost Dashboard
242
+
243
+ AgentLens aggregates usage and cost data from multiple AI coding tools into a single view.
244
+
245
+ ### Claude Code
246
+
247
+ Costs are calculated from local usage logs (`~/.claude/projects/*/` JSONL files). Token counts (input, output, cache read, cache write) are aggregated per model and multiplied by model-specific pricing to produce estimated costs for the current month.
248
+
249
+ No setup required -- AgentLens reads the logs directly from disk.
250
+
251
+ ### Cursor
252
+
253
+ Usage data (premium request counts and token totals) is fetched from the Cursor API. This requires a session token:
254
+
255
+ 1. Open [cursor.com](https://cursor.com) in your browser and sign in
256
+ 2. Open DevTools (`F12`) > **Application** > **Cookies** > `cursor.com`
257
+ 3. Copy the value of the `WorkosCursorSessionToken` cookie
258
+ 4. Set it in AgentLens:
259
+
260
+ ```bash
261
+ agentlens config --set-cursor-token <paste-token-here>
262
+ ```
263
+
264
+ The token is stored in `~/.config/agentlens/config.json`. To remove it:
265
+
266
+ ```bash
267
+ agentlens config --clear-cursor-token
268
+ ```
269
+
270
+ The Cursor dashboard shows premium request usage against your plan limit (e.g., 450/500), plan type, and per-model token/request breakdown. Dollar cost is not available from the Cursor API.
271
+
272
+ ## What Gets Scanned
273
+
274
+ ### Global (~)
275
+
276
+ | Tool | Category | Location |
277
+ |---|---|---|
278
+ | Canonical | Skills | `~/.agents/skills/` |
279
+ | Claude Code | Skills | `~/.claude/skills/` |
280
+ | Claude Code | Commands | `~/.claude/commands/` |
281
+ | Claude Code | Context | `~/.claude/CLAUDE.md` |
282
+ | Claude Code | Hooks | `~/.claude/settings.json` |
283
+ | Cursor | Skills | `~/.cursor/skills/`, `~/.cursor/skills-cursor/`, plugins |
284
+ | Cursor | Rules | `~/.cursor/rules/**/*.{mdc,md}` |
285
+ | Cursor | Context | User rules from Cursor settings DB |
286
+ | Codex | Skills | `~/.codex/skills/` |
287
+ | Codex | Rules | `~/.codex/rules/` |
288
+ | Cursor | MCP | `~/.cursor/mcp.json` |
289
+ | Claude Code | MCP | `~/.claude.json` |
290
+ | Codex | MCP | `~/.codex/config.toml` |
291
+
292
+ ### Project
293
+
294
+ | Tool | Category | Location |
295
+ |---|---|---|
296
+ | Canonical | Skills | `.agents/skills/` |
297
+ | Claude Code | Skills | `.claude/skills/` |
298
+ | Claude Code | Commands | `.claude/commands/` |
299
+ | Claude Code | Context | `CLAUDE.md`, `.claude/CLAUDE.md` |
300
+ | Claude Code | Hooks | `.claude/settings.json`, `.claude/settings.local.json` |
301
+ | Cursor | Rules | `.cursorrules`, `.cursor/rules/**/*.{mdc,md}` (recursive) |
302
+ | Cursor | Skills | `.cursor/skills/` |
303
+ | Multi-agent | Context | `AGENTS.md` |
304
+ | Copilot | Context | `.github/copilot-instructions.md` |
305
+ | Claude Code | MCP | `.mcp.json` |
306
+ | Cursor | MCP | `.cursor/mcp.json` |
307
+ | Copilot | MCP | `.vscode/mcp.json` |
308
+
309
+ ## Interactive TUI
310
+
311
+ When run in a TTY, AgentLens displays an interactive tree with vim-style navigation:
312
+
313
+ | Key | Action |
314
+ |---|---|
315
+ | `j` / `k` | Move down / up |
316
+ | `h` | Collapse node or jump to parent |
317
+ | `l` | Expand node |
318
+ | `Enter` | Open detail panel |
319
+ | `/` | Search / filter |
320
+ | `:` | Open command bar (switch pages) |
321
+ | `ESC` | Clear filter / close detail |
322
+ | `c` | Jump to CURRENT scope |
323
+ | `s` | Open settings (tool/category filter) |
324
+ | `gg` | Jump to top |
325
+ | `G` | Jump to bottom |
326
+ | `Ctrl+d` / `Ctrl+u` | Half page down / up |
327
+ | `?` | Toggle help bar |
328
+ | `q` | Quit |
329
+
330
+ ### Pages
331
+
332
+ The TUI has two top-level pages, switchable via the `:` command bar (type or use up/down arrows to select):
333
+
334
+ - **Scan** -- agent configuration tree (default)
335
+ - **Cost** -- usage and cost dashboard
336
+
337
+ ### Scopes
338
+
339
+ The Scan page tree is organized into three scopes:
340
+
341
+ - **CURRENT** (green) -- merged view of all active configs (global + project) for the current repo, grouped by category (Skills, Rules, MCP, etc.) then by tool. Collapsed by default; press `l` to expand.
342
+ - **GLOBAL** (blue) -- all global/user-level configurations organized by tool.
343
+ - **PROJECT** (white) -- project-level configurations for the current directory.
344
+
345
+ ### Detail Panel
346
+
347
+ The detail panel shows entry metadata, symlink chains, frontmatter, and full descriptions. Linked entries (symlinks to the same file) and cross-references (same name, different file) are displayed separately and are navigable -- press `Enter` on a linked entry to jump directly to it.
348
+
349
+ ### Settings
350
+
351
+ Press `s` to open the settings view where you can toggle visibility of individual tools (Canonical, Claude Code, Cursor, Codex, Copilot, Multi-agent) and categories (built-in skills, system skills, plugin skills, user rules). Changes are persisted to `~/.config/agentlens/config.json` and take effect immediately.
352
+
353
+ ## Health Checks
354
+
355
+ The `troubleshoot` command detects:
356
+
357
+ - Broken symlinks in skill directories
358
+ - Skill installation gaps across tools
359
+ - Stale config files (>180 days untouched)
360
+ - Deprecated `.cursorrules` alongside `.cursor/rules/`
361
+ - Conflicting context files (`CLAUDE.md` + `AGENTS.md`)
362
+ - Permission issues
363
+
364
+ When Claude Code CLI is available, issues are forwarded for AI-powered analysis.
365
+
366
+ ## Development
367
+
368
+ ```bash
369
+ npm run dev # Run via tsx (no build step)
370
+ npm run build # Compile TypeScript to dist/
371
+ npm start # Run compiled output
372
+ ```
373
+
374
+ ## Architecture
375
+
376
+ ```
377
+ src/
378
+ cli.ts CLI entry, Commander setup (scan, cost, where, troubleshoot, config)
379
+ scan.ts Core scanning (global + project, multi-project discovery)
380
+ parse.ts Frontmatter, MDC, TOML, MCP JSON, hooks, SQLite parsing
381
+ config.ts Config, workspace roots, tool/category filters, Cursor token, project discovery
382
+ cost.ts Cost aggregation (Claude Code JSONL logs, Cursor API)
383
+ render.ts Static text output (CURRENT, GLOBAL, PROJECT with filtering, cost report)
384
+ troubleshoot.ts Health checks and diagnostics
385
+ ai.ts Claude Code CLI integration
386
+ symlink.ts Symlink detection and resolution
387
+ types.ts Shared type definitions
388
+ ui/
389
+ App.tsx Interactive terminal UI (Ink/React), page navigation, CURRENT scope, filtering
390
+ TreeView.tsx Keyboard-navigable tree (vim keys, scroll persistence)
391
+ SearchBar.tsx '/' search filter
392
+ CommandBar.tsx ':' command palette for page switching
393
+ DetailPanel.tsx Entry detail view with linked entry navigation
394
+ CostView.tsx Usage and cost dashboard view
395
+ SettingsView.tsx Tool/category filter settings panel
396
+ HelpBar.tsx Toggleable k9s-style keymap header
397
+ theme.ts Chalk theme (scope-colored headers)
398
+ ```
399
+
400
+ ## License
401
+
402
+ [MIT](LICENSE)
package/dist/ai.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { Diagnostic } from './types.js';
2
+ export declare function isClaudeAvailable(): Promise<boolean>;
3
+ export declare function askClaude(prompt: string): Promise<void>;
4
+ export declare function analyzeWithClaude(diagnostics: Diagnostic[], context?: string): Promise<void>;
5
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ1D;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBvD;AASD,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAiBf"}
package/dist/ai.js ADDED
@@ -0,0 +1,56 @@
1
+ import { spawn, execSync } from 'node:child_process';
2
+ import { platform } from 'node:os';
3
+ export async function isClaudeAvailable() {
4
+ try {
5
+ const cmd = platform() === 'win32' ? 'where' : 'which';
6
+ execSync(`${cmd} claude`, { encoding: 'utf8' });
7
+ return true;
8
+ }
9
+ catch {
10
+ return false;
11
+ }
12
+ }
13
+ export function askClaude(prompt) {
14
+ return new Promise((resolve) => {
15
+ const child = spawn('claude', ['--print'], {
16
+ stdio: ['pipe', 'inherit', 'inherit'],
17
+ });
18
+ child.stdin.write(prompt);
19
+ child.stdin.end();
20
+ child.on('close', (code) => {
21
+ if (code !== 0) {
22
+ console.warn(`claude exited with code ${code}`);
23
+ }
24
+ resolve();
25
+ });
26
+ child.on('error', (err) => {
27
+ if (err.code !== 'ENOENT') {
28
+ console.warn(err.message);
29
+ }
30
+ resolve();
31
+ });
32
+ });
33
+ }
34
+ function formatDiagnostic(d) {
35
+ let out = `[${d.severity.toUpperCase()}] (${d.code}) ${d.message}`;
36
+ if (d.path)
37
+ out += `\n Path: ${d.path}`;
38
+ if (d.details)
39
+ out += `\n Details: ${d.details}`;
40
+ return out;
41
+ }
42
+ export async function analyzeWithClaude(diagnostics, context) {
43
+ if (!(await isClaudeAvailable()))
44
+ return;
45
+ const parts = [
46
+ 'You are an AI coding tool configuration expert. Analyze these issues found in the user\'s agent configuration and provide actionable fixes.',
47
+ '',
48
+ diagnostics.map(formatDiagnostic).join('\n\n'),
49
+ ];
50
+ if (context) {
51
+ parts.push('', 'Additional context:', context);
52
+ }
53
+ parts.push('', 'Provide concise, actionable recommendations. Reference specific file paths.');
54
+ await askClaude(parts.join('\n'));
55
+ }
56
+ //# sourceMappingURL=ai.js.map
package/dist/ai.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACvD,QAAQ,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;YACzC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;SACtC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAClB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAa;IACrC,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACnE,IAAI,CAAC,CAAC,IAAI;QAAE,GAAG,IAAI,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,IAAI,CAAC,CAAC,OAAO;QAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAC;IAClD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,WAAyB,EACzB,OAAgB;IAEhB,IAAI,CAAC,CAAC,MAAM,iBAAiB,EAAE,CAAC;QAAE,OAAO;IAEzC,MAAM,KAAK,GAAa;QACtB,6IAA6I;QAC7I,EAAE;QACF,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;KAC/C,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,KAAK,CAAC,IAAI,CACR,EAAE,EACF,6EAA6E,CAC9E,CAAC;IAEF,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}