agentsys 5.5.0 → 5.7.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 (40) hide show
  1. package/.claude-plugin/marketplace.json +6 -17
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.kiro/agents/exploration-agent.json +1 -1
  4. package/.kiro/agents/implementation-agent.json +1 -1
  5. package/.kiro/agents/map-validator.json +2 -2
  6. package/.kiro/agents/perf-orchestrator.json +1 -1
  7. package/.kiro/agents/planning-agent.json +1 -1
  8. package/.kiro/skills/perf-code-paths/SKILL.md +1 -1
  9. package/.kiro/skills/perf-theory-gatherer/SKILL.md +1 -1
  10. package/.kiro/skills/repo-intel/SKILL.md +63 -0
  11. package/AGENTS.md +3 -3
  12. package/CHANGELOG.md +31 -0
  13. package/README.md +95 -68
  14. package/lib/binary/version.js +1 -1
  15. package/lib/repo-map/converter.js +130 -0
  16. package/lib/repo-map/index.js +117 -74
  17. package/lib/repo-map/installer.js +38 -172
  18. package/lib/repo-map/updater.js +16 -474
  19. package/meta/skills/maintain-cross-platform/SKILL.md +5 -5
  20. package/package.json +3 -3
  21. package/scripts/fix-graduated-repos.js +2 -2
  22. package/scripts/generate-docs.js +39 -20
  23. package/scripts/graduate-plugin.js +1 -1
  24. package/scripts/preflight.js +4 -4
  25. package/scripts/validate-counts.js +1 -1
  26. package/scripts/validate-cross-platform-docs.js +2 -2
  27. package/site/content.json +76 -58
  28. package/site/index.html +44 -12
  29. package/site/ux-spec.md +1 -1
  30. package/.kiro/skills/repo-mapping/SKILL.md +0 -83
  31. package/lib/repo-map/concurrency.js +0 -29
  32. package/lib/repo-map/queries/go.js +0 -27
  33. package/lib/repo-map/queries/index.js +0 -100
  34. package/lib/repo-map/queries/java.js +0 -38
  35. package/lib/repo-map/queries/javascript.js +0 -55
  36. package/lib/repo-map/queries/python.js +0 -24
  37. package/lib/repo-map/queries/rust.js +0 -73
  38. package/lib/repo-map/queries/typescript.js +0 -38
  39. package/lib/repo-map/runner.js +0 -1364
  40. package/lib/repo-map/usage-analyzer.js +0 -407
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <b>18 plugins · 38 agents · 36 skills (across all repos) · 30k lines of lib code · 3,575 tests · 5 platforms</b><br>
22
+ <b>19 plugins · 47 agents · 39 skills (across all repos) · 30k lines of lib code · 3,583 tests · 5 platforms</b><br>
23
23
  <em>Plugins distributed as standalone repos under <a href="https://github.com/agent-sh">agent-sh</a> org — agentsys is the marketplace &amp; installer</em>
24
24
  </p>
25
25
 
@@ -45,7 +45,7 @@ AI models can write code. That's not the hard part anymore. The hard part is eve
45
45
 
46
46
  ## What This Is
47
47
 
48
- An agent orchestration system — 18 plugins, 38 agents, and 36 skills that compose into structured pipelines for software development. Each plugin lives in its own standalone repo under the [agent-sh](https://github.com/agent-sh) org. agentsys is the marketplace and installer that ties them together.
48
+ An agent orchestration system — 19 plugins, 47 agents, and 39 skills that compose into structured pipelines for software development. Each plugin lives in its own standalone repo under the [agent-sh](https://github.com/agent-sh) org. agentsys is the marketplace and installer that ties them together.
49
49
 
50
50
  Each agent has a single responsibility, a specific model assignment, and defined inputs/outputs. Pipelines enforce phase gates so agents can't skip steps. State persists across sessions so work survives interruptions.
51
51
 
@@ -73,9 +73,46 @@ This came from testing on 1,000+ repositories.
73
73
 
74
74
  ---
75
75
 
76
+ ## Benchmarks
77
+
78
+ Structured prompts and enriched context do more for output quality than model tier. Benchmarked March 2026 on real tasks (`/can-i-help` and `/onboard` against [glide-mq](https://github.com/avifenesh/glide-mq)), measured with `claude -p --output-format json`. Models: Claude Opus 4 and Claude Sonnet 4.
79
+
80
+ ### Sonnet + AgentSys vs raw Opus
81
+
82
+ Same task, same repo, same prompt ("I want to improve docs"):
83
+
84
+ | Configuration | Cost | Output tokens | Result quality |
85
+ |---------------|------|---------------|----------------|
86
+ | Opus, no agentsys | $1.10 | 2,841 | Generic recommendations, no project-specific context |
87
+ | Opus + agentsys | $1.95 | 5,879 | Specific recommendations with effort estimates, convention awareness, breaking change detection |
88
+ | **Sonnet + agentsys** | **$0.66** | **6,084** | **Comparable to Opus + agentsys: specific, actionable, project-aware** |
89
+
90
+ Sonnet + agentsys produced more output with higher specificity than raw Opus - at 40% lower cost.
91
+
92
+ ### With agentsys, model tier matters less
93
+
94
+ Once the pipeline provides structured prompts, enriched repo-intel data, and phase-gated workflows, the model does less heavy lifting. The gap between Sonnet and Opus narrows:
95
+
96
+ | Plugin | Opus | Sonnet | Savings |
97
+ |--------|------|--------|---------|
98
+ | /onboard | $1.10 | $0.30 | 73% |
99
+ | /can-i-help | $1.34 | $0.23 | 83% |
100
+
101
+ Both models reached the same outcome quality - Sonnet just costs less to get there. The structured pipeline captures most of the gains that would otherwise require a more expensive model.
102
+
103
+ ### What this means
104
+
105
+ | Scenario | Model cost | Quality |
106
+ |----------|-----------|---------|
107
+ | Without agentsys | Need Opus for good results | Depends on model capability |
108
+ | **With agentsys** | **Sonnet is sufficient** | **Pipeline handles the structure, model handles judgment** |
109
+
110
+ The investment shifts from model spend to pipeline design. Better prompts, richer context, enforced phases - these compound in ways that model upgrades alone don't.
111
+
112
+ ---
113
+
76
114
  ## Commands
77
115
 
78
- <!-- GEN:START:readme-commands -->
79
116
  | Command | What it does |
80
117
  |---------|--------------|
81
118
  | [`/next-task`](#next-task) | Task workflow: discovery, implementation, PR, merge |
@@ -86,7 +123,7 @@ This came from testing on 1,000+ repositories.
86
123
  | [`/drift-detect`](#drift-detect) | Compare plan vs implementation |
87
124
  | [`/audit-project`](#audit-project) | Multi-agent iterative code review |
88
125
  | [`/enhance`](#enhance) | Plugin, agent, and prompt analyzers |
89
- | [`/repo-map`](#repo-map) | AST-based repository map |
126
+ | [`/repo-intel`](#repo-intel) | Unified static analysis - git history, AST symbols, project metadata |
90
127
  | [`/sync-docs`](#sync-docs) | Sync documentation with code changes |
91
128
  | [`/learn`](#learn) | Research topics, create learning guides |
92
129
  | [`/consult`](#consult) | Cross-tool AI consultation |
@@ -94,10 +131,8 @@ This came from testing on 1,000+ repositories.
94
131
  | [`/web-ctl`](#web-ctl) | Browser automation for AI agents |
95
132
  | [`/release`](#release) | Versioned release with ecosystem detection |
96
133
  | [`/skillers`](#skillers) | Workflow pattern learning and automation |
97
- | [`/git-map`](#git-map) | Git history analysis: hotspots, coupling, ownership, bus factor |
98
134
  | [`/onboard`](#onboard) | Codebase orientation for newcomers |
99
135
  | [`/can-i-help`](#can-i-help) | Match contributor skills to project needs |
100
- <!-- GEN:END:readme-commands -->
101
136
 
102
137
  Each command works standalone. Together, they compose into end-to-end pipelines.
103
138
 
@@ -105,12 +140,12 @@ Each command works standalone. Together, they compose into end-to-end pipelines.
105
140
 
106
141
  ## Skills
107
142
 
108
- <!-- GEN:START:readme-skills -->
109
- 36 skills included across the plugins:
143
+ 38 skills included across the plugins:
110
144
 
111
145
  | Category | Skills |
112
146
  |----------|--------|
113
147
  | **Workflow** | `discover-tasks`, `orchestrate-review`, `validate-delivery` |
148
+ | **Message Queues** | `glide-mq-migrate-bee`, `glide-mq-migrate-bullmq`, `glide-mq` |
114
149
  | **Enhancement** | `enhance-agent-prompts`, `enhance-claude-memory`, `enhance-cross-file`, `enhance-docs`, `enhance-hooks`, `enhance-orchestrator`, `enhance-plugins`, `enhance-prompts`, `enhance-skills` |
115
150
  | **Performance** | `baseline`, `benchmark`, `code-paths`, `investigation-logger`, `perf-analyzer`, `profile`, `theory-gatherer`, `theory-tester` |
116
151
  | **Cleanup** | `deslop`, `sync-docs` |
@@ -119,8 +154,13 @@ Each command works standalone. Together, they compose into end-to-end pipelines.
119
154
  | **Onboarding** | `can-i-help`, `onboard` |
120
155
  | **Web** | `web-auth`, `web-browse` |
121
156
  | **Release** | `release` |
122
- | **Analysis** | `drift-analysis`, `git-mapping`, `repo-mapping` |
123
- <!-- GEN:END:readme-skills -->
157
+ | **Analysis** | `drift-analysis`, `repo-intel` |
158
+
159
+ **External skill plugins** (standalone repos, installed separately):
160
+
161
+ | Category | Skills | Plugin |
162
+ |----------|--------|--------|
163
+ | **Message Queues** | `glide-mq`, `glide-mq-migrate-bullmq`, `glide-mq-migrate-bee` | [agent-sh/glidemq](https://github.com/agent-sh/glidemq) |
124
164
 
125
165
  Skills are the reusable implementation units. Agents invoke skills; commands orchestrate agents. When you install a plugin, its skills become available to all agents in that session.
126
166
 
@@ -131,8 +171,10 @@ Skills are the reusable implementation units. Agents invoke skills; commands orc
131
171
  | Section | What's there |
132
172
  |---------|--------------|
133
173
  | [The Approach](#the-approach) | Why it's built this way |
174
+ | [Benchmarks](#benchmarks) | Sonnet + agentsys vs raw Opus |
134
175
  | [Commands](#commands) | All 19 commands overview |
135
- | [Skills](#skills) | 36 skills across plugins |
176
+ | [Skills](#skills) | 39 skills across plugins |
177
+ | [Skill-Only Plugins](#skill-only-plugins) | glide-mq and other non-command plugins |
136
178
  | [Command Details](#command-details) | Deep dive into each command |
137
179
  | [How Commands Work Together](#how-commands-work-together) | Standalone vs integrated |
138
180
  | [Design Philosophy](#design-philosophy) | The thinking behind the architecture |
@@ -142,6 +184,26 @@ Skills are the reusable implementation units. Agents invoke skills; commands orc
142
184
 
143
185
  ---
144
186
 
187
+ ## Skill-Only Plugins
188
+
189
+ Plugins that provide skills without a `/` command. Installed alongside agentsys; skills become available to all agents.
190
+
191
+ ### glide-mq
192
+
193
+ Build message queues, background jobs, and workflow orchestration with [glide-mq](https://github.com/avifenesh/glide-mq) - high-performance Node.js queue on Valkey/Redis.
194
+
195
+ | Skill | What it does |
196
+ |-------|--------------|
197
+ | `glide-mq` | Greenfield queue development - queues, workers, ordering, rate limiting, flows, broadcast, step jobs |
198
+ | `glide-mq-migrate-bullmq` | Migrate from BullMQ to glide-mq - API mapping, breaking changes, feature comparison |
199
+ | `glide-mq-migrate-bee` | Migrate from Bee-Queue to glide-mq - API mapping, pattern conversion |
200
+
201
+ Key features: per-key ordering, group concurrency, runtime group rate limiting (`job.rateLimitGroup()`), token bucket, DAG workflows, broadcast pub/sub, step jobs, deduplication, serverless producers.
202
+
203
+ [Skill plugin →](https://github.com/agent-sh/glidemq) | [glide-mq docs →](https://avifenesh.github.io/glide-mq.dev/) | [npm →](https://www.npmjs.com/package/glide-mq)
204
+
205
+ ---
206
+
145
207
  ## Command Details
146
208
 
147
209
  ### /next-task
@@ -392,7 +454,7 @@ Three phases run in sequence:
392
454
  3. **Breaking Point** - Binary search to find failure threshold
393
455
  4. **Constraints** - CPU/memory limits, measure delta vs baseline
394
456
  5. **Hypotheses** - Generate up to 5 hypotheses with evidence and confidence
395
- 6. **Code Paths** - Use repo-map to identify entrypoints and hot files
457
+ 6. **Code Paths** - Use repo-intel to identify entrypoints and hot files
396
458
  7. **Profiling** - Language-specific tools (--cpu-prof, JFR, cProfile, pprof)
397
459
  8. **Optimization** - One change per experiment, 2+ validation passes
398
460
  9. **Decision** - Continue or stop based on measurable improvement
@@ -539,30 +601,33 @@ Findings are collected and categorized by severity (critical/high/medium/low). A
539
601
 
540
602
  ---
541
603
 
542
- ### /repo-map
604
+ ### /repo-intel
543
605
 
544
- **Purpose:** Builds an AST-based map of symbols and imports for fast repo analysis.
606
+ **Purpose:** Unified static analysis - git history, AST symbols, and project metadata in one plugin.
545
607
 
546
- **What it generates:**
608
+ **What it provides:**
547
609
 
548
- - Cached file→symbols map (exports, functions, classes)
549
- - Import graph for dependency hints
610
+ - Git history intelligence: hotspots, coupling, ownership, bus factor, bugspots, AI detection
611
+ - AST symbol mapping: exports, functions, classes, imports
612
+ - Project metadata and health metrics
550
613
 
551
- Output is cached at `{state-dir}/repo-map.json` and exposed via the MCP `repo_map` tool.
614
+ Output is cached at `{state-dir}/repo-intel.json` and `{state-dir}/repo-map.json`.
552
615
 
553
616
  **Why it matters:**
554
617
 
555
- Tools like `/drift-detect` and planners can use the map instead of re-scanning the repo every time.
618
+ Tools like `/drift-detect`, `/onboard`, `/can-i-help`, and planners consume this data instead of re-scanning the repo every time. 9 plugins use repo-intel data automatically.
556
619
 
557
620
  **Usage:**
558
621
 
559
622
  ```bash
560
- /repo-map init # First-time map generation
561
- /repo-map update # Incremental update
562
- /repo-map status # Check freshness
623
+ /repo-intel init # First-time scan
624
+ /repo-intel update # Incremental update
625
+ /repo-intel query hotspots # Most active files
626
+ /repo-intel query ownership src/ # Who owns a path
627
+ /repo-intel query bus-factor # Knowledge risk
563
628
  ```
564
629
 
565
- **Required:** ast-grep (`sg`) must be installed.
630
+ Backed by [agent-analyzer](https://github.com/agent-sh/agent-analyzer) Rust binary.
566
631
 
567
632
  ---
568
633
 
@@ -841,51 +906,13 @@ No per-turn overhead - it reads transcripts that Claude Code already saves.
841
906
 
842
907
  ---
843
908
 
844
- ### /git-map
845
-
846
- **Purpose:** Analyze git history to surface hotspots, coupling, ownership, bus factor, bugspots, area health, and AI attribution.
847
-
848
- **How it works:**
849
-
850
- The plugin wraps the [agent-analyzer](https://github.com/agent-sh/agent-analyzer) Rust binary. Run `init` once to scan git history and cache the result as `repo-intel.json`. Then run queries instantly.
851
-
852
- **21 query types:**
853
-
854
- | Category | Queries |
855
- |----------|---------|
856
- | Activity | `hotspots`, `coldspots`, `file-history` |
857
- | Quality | `bugspots`, `test-gaps`, `diff-risk` |
858
- | People | `ownership`, `contributors`, `bus-factor` |
859
- | Coupling | `coupling` |
860
- | Standards | `norms`, `conventions` |
861
- | Health | `areas`, `health`, `release-info` |
862
- | AI | `ai-ratio`, `recent-ai` |
863
- | Guidance | `onboard`, `can-i-help` |
864
- | Docs | `doc-drift` |
865
-
866
- **9 plugins consume git-map data automatically** - deslop, sync-docs, drift-detect, audit-project, next-task, enhance, ship, onboard, can-i-help.
867
-
868
- **Usage:**
869
-
870
- ```bash
871
- /git-map init # First-time scan
872
- /git-map update # Add new commits
873
- /git-map query hotspots # Most active files
874
- /git-map query ownership src/ # Who owns a path
875
- /git-map query bus-factor # Knowledge risk
876
- ```
877
-
878
- [Full query reference ->](https://github.com/agent-sh/git-map)
879
-
880
- ---
881
-
882
909
  ### /onboard
883
910
 
884
911
  **Purpose:** Get oriented in any codebase in under 3 minutes.
885
912
 
886
913
  **What happens when you run it:**
887
914
 
888
- 1. **Collect** (68ms median) - Pure JavaScript scans manifest, structure, README, CLAUDE.md/AGENTS.md, CI, git, repo-intel (no LLM tokens)
915
+ 1. **Collect** (68ms median) - Pure JavaScript scans manifest, structure, README, CI, git info. Normal depth adds CLAUDE.md/AGENTS.md and repo-intel. No LLM tokens.
889
916
  2. **Synthesize** - Opus agent produces a structured overview: tech stack, key files, active areas, conventions
890
917
  3. **Guide** - Interactive Q&A: ask about specific files, areas, or patterns
891
918
 
@@ -897,7 +924,7 @@ The plugin wraps the [agent-analyzer](https://github.com/agent-sh/agent-analyzer
897
924
  |-------|------|------|
898
925
  | quick | ~2s | Manifest + README + structure |
899
926
  | normal | ~5s | + CLAUDE.md/AGENTS.md + CI + repo-intel |
900
- | deep | ~15s | + repo-map AST symbols |
927
+ | deep | ~15s | + repo-intel AST symbols |
901
928
 
902
929
  **Supported manifests:** package.json, Cargo.toml, go.mod, pyproject.toml, deno.json, CMakeLists.txt, meson.build, setup.py, pom.xml, build.gradle. Detects monorepos (npm/pnpm/lerna/Cargo workspaces, Python libs/, Deno workspaces).
903
930
 
@@ -911,7 +938,7 @@ The plugin wraps the [agent-analyzer](https://github.com/agent-sh/agent-analyzer
911
938
 
912
939
  **Agent:** onboard-agent (opus model)
913
940
 
914
- [Full documentation ->](https://github.com/agent-sh/onboard)
941
+ [Full documentation ](https://github.com/agent-sh/onboard)
915
942
 
916
943
  ---
917
944
 
@@ -945,7 +972,7 @@ The plugin wraps the [agent-analyzer](https://github.com/agent-sh/agent-analyzer
945
972
 
946
973
  **Agent:** can-i-help-agent (opus model)
947
974
 
948
- [Full documentation ->](https://github.com/agent-sh/can-i-help)
975
+ [Full documentation ](https://github.com/agent-sh/can-i-help)
949
976
 
950
977
  ---
951
978
 
@@ -1125,8 +1152,8 @@ agentsys --development # Dev mode (bypasses marketplace)
1125
1152
  **For GitLab workflows:**
1126
1153
  - GitLab CLI (`glab`) authenticated
1127
1154
 
1128
- **For /repo-map:**
1129
- - ast-grep (`sg`) installed
1155
+ **For /repo-intel:**
1156
+ - agent-analyzer (installed automatically via npm)
1130
1157
 
1131
1158
  **For /agnix:**
1132
1159
  - [agnix CLI](https://github.com/agent-sh/agnix) installed (`npm install -g agnix`, `cargo install agnix-cli`, or `brew install agnix`)
@@ -1152,7 +1179,7 @@ The system is built on research, not guesswork.
1152
1179
  - Instruction following reliability
1153
1180
 
1154
1181
  **Testing:**
1155
- - 3,575 tests passing
1182
+ - 3,583 tests passing
1156
1183
  - Drift-detect validated on 1,000+ repositories
1157
1184
  - E2E workflow testing across all commands
1158
1185
  - Cross-platform validation (Claude Code, OpenCode, Codex CLI, Cursor, Kiro)
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // Minimum binary version required by this version of agent-core
4
- const ANALYZER_MIN_VERSION = '0.1.0';
4
+ const ANALYZER_MIN_VERSION = '0.3.0';
5
5
 
6
6
  // Binary name
7
7
  const BINARY_NAME = 'agent-analyzer';
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Convert agent-analyzer repo-intel.json format to repo-map.json format.
5
+ *
6
+ * agent-analyzer outputs: { symbols: { [filePath]: { exports, imports, definitions } } }
7
+ * repo-map expects: { files: { [filePath]: { language, symbols, imports } } }
8
+ *
9
+ * @module lib/repo-map/converter
10
+ */
11
+
12
+ const path = require('path');
13
+
14
+ const LANGUAGE_BY_EXTENSION = {
15
+ '.js': 'javascript', '.jsx': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript',
16
+ '.ts': 'typescript', '.tsx': 'typescript', '.mts': 'typescript', '.cts': 'typescript',
17
+ '.py': 'python', '.pyw': 'python',
18
+ '.rs': 'rust',
19
+ '.go': 'go',
20
+ '.java': 'java'
21
+ };
22
+
23
+ // SymbolKind values from agent-analyzer (kebab-case serialized)
24
+ const CLASS_KINDS = new Set(['class', 'struct', 'interface', 'enum', 'impl']);
25
+ const TYPE_KINDS = new Set(['trait', 'type-alias']);
26
+ const FUNCTION_LIKE_KINDS = new Set(['method', 'arrow', 'closure']);
27
+ const CONSTANT_KINDS = new Set(['constant', 'variable', 'const', 'field', 'property']);
28
+
29
+ function detectLanguage(filePath) {
30
+ return LANGUAGE_BY_EXTENSION[path.extname(filePath).toLowerCase()] || 'unknown';
31
+ }
32
+
33
+ function detectLanguagesFromFiles(filePaths) {
34
+ const langs = new Set();
35
+ for (const fp of filePaths) {
36
+ const lang = detectLanguage(fp);
37
+ if (lang !== 'unknown') langs.add(lang);
38
+ }
39
+ return Array.from(langs);
40
+ }
41
+
42
+ /**
43
+ * Convert a single file's symbols from repo-intel format to repo-map format.
44
+ * @param {string} filePath
45
+ * @param {Object} fileSym - { exports, imports, definitions }
46
+ * @returns {Object} repo-map file entry
47
+ */
48
+ function convertFile(filePath, fileSym) {
49
+ const exportNames = new Set((fileSym.exports || []).map(e => e.name));
50
+
51
+ const exports = (fileSym.exports || []).map(e => ({
52
+ name: e.name,
53
+ kind: e.kind,
54
+ line: e.line
55
+ }));
56
+
57
+ const functions = [];
58
+ const classes = [];
59
+ const types = [];
60
+ const constants = [];
61
+
62
+ for (const def of fileSym.definitions || []) {
63
+ const entry = {
64
+ name: def.name,
65
+ kind: def.kind,
66
+ line: def.line,
67
+ exported: exportNames.has(def.name)
68
+ };
69
+ if (def.kind === 'function' || FUNCTION_LIKE_KINDS.has(def.kind)) {
70
+ functions.push(entry);
71
+ } else if (CLASS_KINDS.has(def.kind)) {
72
+ classes.push(entry);
73
+ } else if (TYPE_KINDS.has(def.kind)) {
74
+ types.push(entry);
75
+ } else if (CONSTANT_KINDS.has(def.kind)) {
76
+ constants.push(entry);
77
+ } else {
78
+ // Unknown kind - default to constants for backward compat
79
+ constants.push(entry);
80
+ }
81
+ }
82
+
83
+ // agent-analyzer imports: [{ from, names }] → repo-map imports: [{ source, kind, names }]
84
+ const imports = (fileSym.imports || []).map(imp => ({
85
+ source: imp.from,
86
+ kind: 'import',
87
+ names: imp.names || []
88
+ }));
89
+
90
+ return {
91
+ language: detectLanguage(filePath),
92
+ symbols: { exports, functions, classes, types, constants },
93
+ imports
94
+ };
95
+ }
96
+
97
+ /**
98
+ * Convert a full repo-intel data object to repo-map format.
99
+ * @param {Object} intel - RepoIntelData from agent-analyzer
100
+ * @returns {Object} repo-map.json compatible object
101
+ */
102
+ function convertIntelToRepoMap(intel) {
103
+ const files = {};
104
+ let totalSymbols = 0;
105
+ let totalImports = 0;
106
+
107
+ for (const [filePath, fileSym] of Object.entries(intel.symbols || {})) {
108
+ files[filePath] = convertFile(filePath, fileSym);
109
+ const s = files[filePath].symbols;
110
+ totalSymbols += s.functions.length + s.classes.length +
111
+ s.types.length + s.constants.length;
112
+ totalImports += files[filePath].imports.length;
113
+ }
114
+
115
+ return {
116
+ version: '2.0',
117
+ generated: intel.generated || new Date().toISOString(),
118
+ git: intel.git ? { commit: intel.git.analyzedUpTo } : undefined,
119
+ project: { languages: detectLanguagesFromFiles(Object.keys(files)) },
120
+ stats: {
121
+ totalFiles: Object.keys(files).length,
122
+ totalSymbols,
123
+ totalImports,
124
+ errors: []
125
+ },
126
+ files
127
+ };
128
+ }
129
+
130
+ module.exports = { convertIntelToRepoMap, convertFile, detectLanguage };