@a-company/paradigm 1.5.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 (114) hide show
  1. package/README.md +142 -0
  2. package/dist/accept-orchestration-CWZNCGZX.js +188 -0
  3. package/dist/agents-suggest-35LIQKDH.js +83 -0
  4. package/dist/aggregate-W7Q6VIM2.js +88 -0
  5. package/dist/auto-IU7VN55K.js +470 -0
  6. package/dist/beacon-B47XSTL7.js +251 -0
  7. package/dist/chunk-2M6OSOIG.js +1302 -0
  8. package/dist/chunk-4NCFWYGG.js +110 -0
  9. package/dist/chunk-5C4SGQKH.js +705 -0
  10. package/dist/chunk-5GOA7WYD.js +1095 -0
  11. package/dist/chunk-5JGJACDU.js +37 -0
  12. package/dist/chunk-6QC3YGB6.js +114 -0
  13. package/dist/chunk-753RICFF.js +325 -0
  14. package/dist/chunk-AD2LSCHB.js +1595 -0
  15. package/dist/chunk-CHSHON3O.js +669 -0
  16. package/dist/chunk-ELLR7WP6.js +3175 -0
  17. package/dist/chunk-ILOWBJRC.js +12 -0
  18. package/dist/chunk-IRKUEJVW.js +405 -0
  19. package/dist/chunk-MC7XC7XQ.js +533 -0
  20. package/dist/chunk-MO4EEYFW.js +38 -0
  21. package/dist/chunk-MQWH7PFI.js +13366 -0
  22. package/dist/chunk-N6PJAPDE.js +364 -0
  23. package/dist/chunk-PBHIFAL4.js +259 -0
  24. package/dist/chunk-PMXRGPRQ.js +305 -0
  25. package/dist/chunk-PW2EXJQT.js +689 -0
  26. package/dist/chunk-TAP5N3HH.js +245 -0
  27. package/dist/chunk-THFVK5AE.js +148 -0
  28. package/dist/chunk-UM54F7G5.js +1533 -0
  29. package/dist/chunk-UUZ2DMG5.js +185 -0
  30. package/dist/chunk-WS5KM7OL.js +780 -0
  31. package/dist/chunk-YDNKXH4Z.js +2316 -0
  32. package/dist/chunk-YO6DVTL7.js +99 -0
  33. package/dist/claude-SUYNN72C.js +362 -0
  34. package/dist/claude-cli-OF43XAO3.js +276 -0
  35. package/dist/claude-code-PW6SKD2M.js +126 -0
  36. package/dist/claude-code-teams-JLZ5IXB6.js +199 -0
  37. package/dist/constellation-K3CIQCHI.js +225 -0
  38. package/dist/cost-AEK6R7HK.js +174 -0
  39. package/dist/cost-KYXIQ62X.js +93 -0
  40. package/dist/cursor-cli-IHJMPRCW.js +269 -0
  41. package/dist/cursorrules-KI5QWHIX.js +84 -0
  42. package/dist/diff-AJJ5H6HV.js +125 -0
  43. package/dist/dist-7MPIRMTZ-IOQOREMZ.js +10866 -0
  44. package/dist/dist-NHJQVVUW.js +68 -0
  45. package/dist/dist-ZEMSQV74.js +20 -0
  46. package/dist/doctor-6Y6L6HEB.js +11 -0
  47. package/dist/echo-VYZW3OTT.js +248 -0
  48. package/dist/export-R4FJ5NOH.js +38 -0
  49. package/dist/history-EVO3L6SC.js +277 -0
  50. package/dist/hooks-MBWE4ILT.js +12 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +568 -0
  53. package/dist/lint-HXKTWRNO.js +316 -0
  54. package/dist/manual-Y3QOXWYA.js +204 -0
  55. package/dist/mcp.js +14745 -0
  56. package/dist/orchestrate-4ZH5GUQH.js +323 -0
  57. package/dist/probe-OYCP4JYG.js +151 -0
  58. package/dist/promote-Z52ZJTJU.js +181 -0
  59. package/dist/providers-4PGPZEWP.js +104 -0
  60. package/dist/remember-6VZ74B7E.js +77 -0
  61. package/dist/ripple-SBQOSTZD.js +215 -0
  62. package/dist/sentinel-LCFD56OJ.js +43 -0
  63. package/dist/server-F5ITNK6T.js +9846 -0
  64. package/dist/server-T6WIFYRQ.js +16076 -0
  65. package/dist/setup-DF4F3ICN.js +25 -0
  66. package/dist/setup-JHBPZAG7.js +296 -0
  67. package/dist/shift-HKIAP4ZN.js +226 -0
  68. package/dist/snapshot-GTVPRYZG.js +62 -0
  69. package/dist/spawn-BJRQA2NR.js +196 -0
  70. package/dist/summary-H6J6N6PJ.js +140 -0
  71. package/dist/switch-6EANJ7O6.js +232 -0
  72. package/dist/sync-BEOCW7TZ.js +11 -0
  73. package/dist/team-NWP2KJAB.js +32 -0
  74. package/dist/test-MA5TWJQV.js +934 -0
  75. package/dist/thread-JCJVRUQR.js +258 -0
  76. package/dist/triage-ETVXXFMV.js +1880 -0
  77. package/dist/tutorial-L5Q3ZDHK.js +666 -0
  78. package/dist/university-R2WDQLSI.js +40 -0
  79. package/dist/upgrade-5B3YGGC6.js +550 -0
  80. package/dist/validate-F3YHBCRZ.js +39 -0
  81. package/dist/validate-QEEY6KFS.js +64 -0
  82. package/dist/watch-4LT4O6K7.js +123 -0
  83. package/dist/watch-6IIWPWDN.js +111 -0
  84. package/dist/wisdom-LRM4FFCH.js +319 -0
  85. package/package.json +68 -0
  86. package/templates/paradigm/config.yaml +175 -0
  87. package/templates/paradigm/docs/commands.md +727 -0
  88. package/templates/paradigm/docs/decisions/000-template.md +47 -0
  89. package/templates/paradigm/docs/decisions/README.md +26 -0
  90. package/templates/paradigm/docs/error-patterns.md +215 -0
  91. package/templates/paradigm/docs/patterns.md +358 -0
  92. package/templates/paradigm/docs/queries.md +200 -0
  93. package/templates/paradigm/docs/troubleshooting.md +477 -0
  94. package/templates/paradigm/echoes.yaml +25 -0
  95. package/templates/paradigm/prompts/add-feature.md +152 -0
  96. package/templates/paradigm/prompts/add-gate.md +117 -0
  97. package/templates/paradigm/prompts/debug-auth.md +174 -0
  98. package/templates/paradigm/prompts/implement-ftux.md +722 -0
  99. package/templates/paradigm/prompts/implement-sandbox.md +651 -0
  100. package/templates/paradigm/prompts/read-docs.md +84 -0
  101. package/templates/paradigm/prompts/refactor.md +106 -0
  102. package/templates/paradigm/prompts/run-e2e-tests.md +340 -0
  103. package/templates/paradigm/prompts/trace-flow.md +202 -0
  104. package/templates/paradigm/prompts/validate-portals.md +279 -0
  105. package/templates/paradigm/specs/context-tracking.md +200 -0
  106. package/templates/paradigm/specs/context.md +461 -0
  107. package/templates/paradigm/specs/disciplines.md +413 -0
  108. package/templates/paradigm/specs/history.md +339 -0
  109. package/templates/paradigm/specs/logger.md +303 -0
  110. package/templates/paradigm/specs/navigator.md +236 -0
  111. package/templates/paradigm/specs/purpose.md +265 -0
  112. package/templates/paradigm/specs/scan.md +177 -0
  113. package/templates/paradigm/specs/symbols.md +451 -0
  114. package/templates/paradigm/specs/wisdom.md +294 -0
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # @a-company/paradigm
2
+
3
+ > Universal Agentic Development Protocol - Language & Discipline Agnostic
4
+
5
+ Paradigm is the **blueprint for AI-assisted development** that works across any tech stack, language, or discipline. Whether you're building a web app, training an ML model, writing firmware, or deploying infrastructure - Paradigm provides the same consistent context protocol.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g @a-company/paradigm
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Initialize Paradigm in your project
17
+ paradigm init
18
+
19
+ # Full setup: init + team + scan + sync all IDEs
20
+ paradigm shift
21
+
22
+ # Check project status
23
+ paradigm status
24
+
25
+ # Health check
26
+ paradigm doctor
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ | Command | Description |
32
+ |---------|-------------|
33
+ | `paradigm init` | Initialize Paradigm in current project |
34
+ | `paradigm shift` | Full setup: init + team + scan + sync all IDEs |
35
+ | `paradigm sync` | Regenerate IDE instruction files |
36
+ | `paradigm scan` | Rebuild scan index |
37
+ | `paradigm status` | Show project overview |
38
+ | `paradigm doctor` | Health check and diagnostics |
39
+ | `paradigm team init` | Initialize multi-agent configuration |
40
+ | `paradigm team agents suggest` | Suggest agents for a task |
41
+ | `paradigm team orchestrate` | Run multi-agent orchestration |
42
+
43
+ ### IDE Sync
44
+
45
+ Sync to specific IDEs:
46
+
47
+ ```bash
48
+ paradigm sync cursor # Generate .cursor/rules/*.mdc
49
+ paradigm sync copilot # Generate .github/copilot-instructions.md
50
+ paradigm sync windsurf # Generate .windsurfrules
51
+ paradigm sync claude # Generate CLAUDE.md
52
+ paradigm sync --all # Generate all IDE files
53
+ ```
54
+
55
+ ### Purpose Commands
56
+
57
+ ```bash
58
+ paradigm purpose validate # Validate .purpose files
59
+ paradigm purpose remember # Show context for a path
60
+ ```
61
+
62
+ ### Portal Commands
63
+
64
+ ```bash
65
+ paradigm portal validate # Validate portal.yaml
66
+ paradigm portal test # Run gate tests
67
+ ```
68
+
69
+ ### Premise Commands
70
+
71
+ ```bash
72
+ paradigm premise aggregate # Aggregate all symbols
73
+ paradigm premise snapshot # Save current state
74
+ ```
75
+
76
+ ## Symbol System (v2)
77
+
78
+ 5 operational symbols for code structure + a tag bank for classification:
79
+
80
+ | Symbol | Name | Description |
81
+ |--------|------|-------------|
82
+ | `#` | Component | Any documented code unit (features, services, UI, utils) |
83
+ | `$` | Flow | Multi-step processes or user journeys |
84
+ | `^` | Gate | Access control points and authorization rules |
85
+ | `!` | Signal | Events, errors, and side effects |
86
+ | `~` | Aspect | Cross-cutting rules with required code anchors |
87
+
88
+ ### Tag Bank
89
+
90
+ Instead of dedicated symbol prefixes, classify with tags:
91
+
92
+ | Tag | Purpose | Example |
93
+ |-----|---------|---------|
94
+ | `[feature]` | User-facing capability | `#checkout` with `tags: [feature]` |
95
+ | `[integration]` | External service | `#stripe-service` with `tags: [integration, stripe]` |
96
+ | `[state]` | State management | `#user-store` with `tags: [state]` |
97
+ | `[idea]` | Future possibility | Any symbol with `tags: [idea]` |
98
+ | `[deprecated]` | Marked for removal | Any symbol with `tags: [deprecated]` |
99
+
100
+ ## Supported Disciplines
101
+
102
+ Paradigm's symbol system is universal. The same symbols work across:
103
+
104
+ | Discipline | Component `#` | Gate `^` | Signal `!` |
105
+ |------------|---------------|----------|------------|
106
+ | Web | `#checkout` | `^authenticated` | `!payment-completed` |
107
+ | Backend | `#user-service` | `^admin` | `!user-created` |
108
+ | ML | `#classifier-v2` | `^model-validated` | `!training-complete` |
109
+ | Mobile | `#home-screen` | `^biometric-auth` | `!push-received` |
110
+ | Game | `#attack-system` | `^level-unlocked` | `!enemy-defeated` |
111
+ | Embedded | `#spi-driver` | `^calibrated` | `!sensor-read` |
112
+ | DevOps | `#vpc-module` | `^deploy-approved` | `!deploy-complete` |
113
+
114
+ See `specs/disciplines.md` for complete mappings.
115
+
116
+ ## Project Structure
117
+
118
+ When initialized, Paradigm creates:
119
+
120
+ ```
121
+ .paradigm/
122
+ ├── config.yaml # Main configuration + discipline setting
123
+ ├── tags.yaml # Tag bank definitions
124
+ ├── specs/
125
+ │ ├── symbols-v2.md # Symbol system reference
126
+ │ ├── disciplines.md # Discipline-specific mappings
127
+ │ ├── logger.md # Logging specification
128
+ │ └── scan.md # Visual discovery protocol
129
+ ├── docs/
130
+ │ ├── commands.md # CLI reference
131
+ │ ├── patterns.md # Coding patterns
132
+ │ └── troubleshooting.md
133
+ └── agents.yaml # Multi-agent configuration
134
+ ```
135
+
136
+ ## Documentation
137
+
138
+ See the [main repository](https://github.com/ascend42/a-paradigm) for full documentation.
139
+
140
+ ## License
141
+
142
+ MIT
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ BackgroundOrchestrator
4
+ } from "./chunk-AD2LSCHB.js";
5
+ import "./chunk-6QC3YGB6.js";
6
+ import "./chunk-WS5KM7OL.js";
7
+ import "./chunk-PBHIFAL4.js";
8
+ import "./chunk-TAP5N3HH.js";
9
+ import "./chunk-PMXRGPRQ.js";
10
+ import "./chunk-5C4SGQKH.js";
11
+ import "./chunk-PW2EXJQT.js";
12
+ import "./chunk-IRKUEJVW.js";
13
+ import "./chunk-5JGJACDU.js";
14
+ import "./chunk-MO4EEYFW.js";
15
+
16
+ // src/commands/team/accept-orchestration.ts
17
+ import * as path from "path";
18
+ import chalk from "chalk";
19
+ async function teamAcceptOrchestrationCommand(orchestrationId, targetPath, options) {
20
+ const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
21
+ if (!orchestrationId) {
22
+ if (options.json) {
23
+ console.log(JSON.stringify({ error: "Orchestration ID required" }));
24
+ } else {
25
+ console.log(chalk.red("\nOrchestration ID required."));
26
+ console.log(chalk.gray("Usage: paradigm team accept <orchestration-id>\n"));
27
+ }
28
+ return;
29
+ }
30
+ const bgOrchestrator = new BackgroundOrchestrator(rootDir);
31
+ const orch = bgOrchestrator.getOrchestration(orchestrationId);
32
+ if (!orch) {
33
+ if (options.json) {
34
+ console.log(JSON.stringify({ error: "Orchestration not found", id: orchestrationId }));
35
+ } else {
36
+ console.log(chalk.red(`
37
+ Orchestration not found: ${orchestrationId}
38
+ `));
39
+ }
40
+ return;
41
+ }
42
+ if (orch.status !== "completed") {
43
+ if (options.json) {
44
+ console.log(JSON.stringify({
45
+ error: "Cannot accept orchestration",
46
+ reason: `Status is '${orch.status}', expected 'completed'`
47
+ }));
48
+ } else {
49
+ console.log(chalk.red(`
50
+ Cannot accept orchestration in '${orch.status}' status.`));
51
+ console.log(chalk.gray("Only completed orchestrations can be accepted.\n"));
52
+ }
53
+ return;
54
+ }
55
+ try {
56
+ await bgOrchestrator.accept(orchestrationId, { note: options.note });
57
+ if (options.json) {
58
+ console.log(JSON.stringify({
59
+ success: true,
60
+ id: orchestrationId,
61
+ status: "accepted",
62
+ artifacts: orch.artifacts.length
63
+ }));
64
+ return;
65
+ }
66
+ console.log();
67
+ console.log(chalk.green("\u2501".repeat(60)));
68
+ console.log(chalk.green(` \u2713 Orchestration Accepted`));
69
+ console.log(chalk.green("\u2501".repeat(60)));
70
+ console.log();
71
+ console.log(chalk.white(` ID: ${orchestrationId}`));
72
+ console.log(chalk.gray(` Task: ${orch.task.slice(0, 50)}${orch.task.length > 50 ? "..." : ""}`));
73
+ if (options.note) {
74
+ console.log(chalk.gray(` Note: ${options.note}`));
75
+ }
76
+ console.log();
77
+ if (orch.artifacts.length > 0) {
78
+ console.log(chalk.cyan(" Artifacts accepted:"));
79
+ for (const artifact of orch.artifacts) {
80
+ const icon = artifact.action === "created" ? chalk.green("+") : artifact.action === "modified" ? chalk.yellow("~") : chalk.red("-");
81
+ console.log(` ${icon} ${artifact.path}`);
82
+ }
83
+ console.log();
84
+ }
85
+ if (orch.parallelBuilderStats) {
86
+ console.log(chalk.cyan(" Parallel builder stats:"));
87
+ console.log(chalk.gray(` Sub-phases: ${orch.parallelBuilderStats.totalSubPhases}`));
88
+ console.log(chalk.gray(` Parallel builders: ${orch.parallelBuilderStats.totalParallelBuilders}`));
89
+ console.log(chalk.gray(` Files created: ${orch.parallelBuilderStats.filesCreated}`));
90
+ console.log();
91
+ }
92
+ } catch (error) {
93
+ if (options.json) {
94
+ console.log(JSON.stringify({
95
+ error: error instanceof Error ? error.message : String(error)
96
+ }));
97
+ } else {
98
+ console.log(chalk.red(`
99
+ Error: ${error instanceof Error ? error.message : error}
100
+ `));
101
+ }
102
+ }
103
+ }
104
+ async function teamRejectOrchestrationCommand(orchestrationId, targetPath, options) {
105
+ const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
106
+ if (!orchestrationId) {
107
+ if (options.json) {
108
+ console.log(JSON.stringify({ error: "Orchestration ID required" }));
109
+ } else {
110
+ console.log(chalk.red("\nOrchestration ID required."));
111
+ console.log(chalk.gray("Usage: paradigm team reject <orchestration-id>\n"));
112
+ }
113
+ return;
114
+ }
115
+ const bgOrchestrator = new BackgroundOrchestrator(rootDir);
116
+ const orch = bgOrchestrator.getOrchestration(orchestrationId);
117
+ if (!orch) {
118
+ if (options.json) {
119
+ console.log(JSON.stringify({ error: "Orchestration not found", id: orchestrationId }));
120
+ } else {
121
+ console.log(chalk.red(`
122
+ Orchestration not found: ${orchestrationId}
123
+ `));
124
+ }
125
+ return;
126
+ }
127
+ if (orch.status !== "completed") {
128
+ if (options.json) {
129
+ console.log(JSON.stringify({
130
+ error: "Cannot reject orchestration",
131
+ reason: `Status is '${orch.status}', expected 'completed'`
132
+ }));
133
+ } else {
134
+ console.log(chalk.red(`
135
+ Cannot reject orchestration in '${orch.status}' status.`));
136
+ console.log(chalk.gray("Only completed orchestrations can be rejected.\n"));
137
+ }
138
+ return;
139
+ }
140
+ try {
141
+ await bgOrchestrator.reject(orchestrationId, {
142
+ reason: options.reason,
143
+ cleanup: options.cleanup
144
+ });
145
+ if (options.json) {
146
+ console.log(JSON.stringify({
147
+ success: true,
148
+ id: orchestrationId,
149
+ status: "rejected",
150
+ cleanup: options.cleanup || false
151
+ }));
152
+ return;
153
+ }
154
+ console.log();
155
+ console.log(chalk.red("\u2501".repeat(60)));
156
+ console.log(chalk.red(` \u2717 Orchestration Rejected`));
157
+ console.log(chalk.red("\u2501".repeat(60)));
158
+ console.log();
159
+ console.log(chalk.white(` ID: ${orchestrationId}`));
160
+ console.log(chalk.gray(` Task: ${orch.task.slice(0, 50)}${orch.task.length > 50 ? "..." : ""}`));
161
+ if (options.reason) {
162
+ console.log(chalk.gray(` Reason: ${options.reason}`));
163
+ }
164
+ console.log();
165
+ if (options.cleanup && orch.artifacts.length > 0) {
166
+ console.log(chalk.yellow(" Files cleaned up:"));
167
+ const created = orch.artifacts.filter((a) => a.action === "created");
168
+ for (const artifact of created) {
169
+ console.log(chalk.gray(` - ${artifact.path}`));
170
+ }
171
+ console.log();
172
+ }
173
+ } catch (error) {
174
+ if (options.json) {
175
+ console.log(JSON.stringify({
176
+ error: error instanceof Error ? error.message : String(error)
177
+ }));
178
+ } else {
179
+ console.log(chalk.red(`
180
+ Error: ${error instanceof Error ? error.message : error}
181
+ `));
182
+ }
183
+ }
184
+ }
185
+ export {
186
+ teamAcceptOrchestrationCommand,
187
+ teamRejectOrchestrationCommand
188
+ };
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ suggestAgentsForTask
4
+ } from "./chunk-6QC3YGB6.js";
5
+ import {
6
+ loadAgentsManifest
7
+ } from "./chunk-PMXRGPRQ.js";
8
+ import "./chunk-MO4EEYFW.js";
9
+
10
+ // src/commands/team/agents-suggest.ts
11
+ import chalk from "chalk";
12
+ async function agentsSuggestCommand(task, options) {
13
+ const rootDir = process.cwd();
14
+ const manifest = loadAgentsManifest(rootDir);
15
+ if (!manifest) {
16
+ if (options.json) {
17
+ console.log(JSON.stringify({ error: "No agents.yaml found" }));
18
+ } else {
19
+ console.log(
20
+ chalk.red("\nNo agents.yaml found. Run `paradigm team init` first.\n")
21
+ );
22
+ }
23
+ process.exit(1);
24
+ }
25
+ const suggestions = suggestAgentsForTask(task, manifest.agents);
26
+ if (options.json) {
27
+ console.log(JSON.stringify({ task, suggestions }, null, 2));
28
+ return;
29
+ }
30
+ console.log(chalk.cyan("\nSuggested agents for this task:\n"));
31
+ console.log(chalk.gray(` Task: "${task}"
32
+ `));
33
+ if (suggestions.length === 0) {
34
+ console.log(
35
+ chalk.yellow(" No agents matched. Consider using architect \u2192 builder flow.\n")
36
+ );
37
+ console.log(chalk.gray(" Tip: Add keyword or symbol triggers to agents.yaml\n"));
38
+ return;
39
+ }
40
+ for (const suggestion of suggestions) {
41
+ const icon = suggestion.confidence === "high" ? chalk.green("\u2605") : suggestion.confidence === "medium" ? chalk.yellow("\u25C6") : chalk.gray("\u25CB");
42
+ console.log(
43
+ ` ${icon} ${chalk.white.bold(suggestion.name)} ${chalk.gray(`(${suggestion.confidence})`)}`
44
+ );
45
+ console.log(chalk.gray(` ${suggestion.reason}`));
46
+ console.log(
47
+ chalk.gray(` Matched: ${suggestion.triggers_matched.join(", ")}
48
+ `)
49
+ );
50
+ }
51
+ if (suggestions.length > 0) {
52
+ console.log(chalk.cyan(" Suggested workflow:"));
53
+ const agents = suggestions.map((s) => s.name);
54
+ const orderedAgents = reorderToStandardFlow(agents);
55
+ console.log(chalk.gray(` ${orderedAgents.join(" \u2192 ")}
56
+ `));
57
+ console.log(chalk.gray(" Or use MCP orchestration:"));
58
+ console.log(
59
+ chalk.gray(
60
+ ` paradigm_orchestrate_inline({ task: "${task.slice(0, 30)}${task.length > 30 ? "..." : ""}", mode: "plan" })
61
+ `
62
+ )
63
+ );
64
+ }
65
+ }
66
+ function reorderToStandardFlow(agents) {
67
+ const order = ["architect", "security", "builder", "reviewer", "tester"];
68
+ const result = [];
69
+ const remaining = new Set(agents);
70
+ for (const agent of order) {
71
+ if (remaining.has(agent)) {
72
+ result.push(agent);
73
+ remaining.delete(agent);
74
+ }
75
+ }
76
+ for (const agent of remaining) {
77
+ result.push(agent);
78
+ }
79
+ return result;
80
+ }
81
+ export {
82
+ agentsSuggestCommand
83
+ };
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ aggregateFromDirectory,
4
+ aggregateFromPremise,
5
+ buildSymbolIndex,
6
+ getSymbolCounts,
7
+ parsePremiseFile
8
+ } from "./chunk-5C4SGQKH.js";
9
+ import "./chunk-PW2EXJQT.js";
10
+ import "./chunk-IRKUEJVW.js";
11
+ import "./chunk-MO4EEYFW.js";
12
+
13
+ // src/commands/premise/aggregate.ts
14
+ import * as fs from "fs";
15
+ import * as path from "path";
16
+ import chalk from "chalk";
17
+ import ora from "ora";
18
+ async function premiseAggregateCommand(targetPath) {
19
+ const cwd = process.cwd();
20
+ const absolutePath = path.resolve(cwd, targetPath);
21
+ console.log(chalk.blue("\n\u{1F52E} Aggregating Premise...\n"));
22
+ const spinner = ora("Loading sources...").start();
23
+ try {
24
+ let result;
25
+ const premisePath = path.join(absolutePath, ".premise");
26
+ if (fs.existsSync(premisePath)) {
27
+ const { data, errors } = parsePremiseFile(premisePath);
28
+ if (errors.length > 0) {
29
+ spinner.warn("Warnings parsing .premise file");
30
+ for (const error of errors) {
31
+ console.log(chalk.yellow(` \u26A0 ${error}`));
32
+ }
33
+ console.log(chalk.gray(" Falling back to directory aggregation...\n"));
34
+ }
35
+ if (data && !errors.some((e) => e.includes("Required"))) {
36
+ try {
37
+ result = await aggregateFromPremise(data, absolutePath);
38
+ } catch (error) {
39
+ console.log(chalk.yellow(` \u26A0 Error using .premise file: ${error.message}`));
40
+ console.log(chalk.gray(" Falling back to directory aggregation...\n"));
41
+ }
42
+ }
43
+ }
44
+ if (!result) {
45
+ result = await aggregateFromDirectory(absolutePath);
46
+ }
47
+ spinner.succeed("Aggregated all sources");
48
+ const index = buildSymbolIndex(result);
49
+ const counts = getSymbolCounts(index);
50
+ console.log(chalk.white("\nSources"));
51
+ console.log(chalk.gray("\u2500".repeat(40)));
52
+ console.log(` Purpose files: ${chalk.cyan(result.purposeFiles.length.toString())}`);
53
+ console.log(` Gate files: ${chalk.cyan(result.portalFiles.length.toString())}`);
54
+ console.log(chalk.white("\nSymbol Index"));
55
+ console.log(chalk.gray("\u2500".repeat(40)));
56
+ const symbolLines = [
57
+ { prefix: "#", name: "Components", count: counts.component, color: chalk.green },
58
+ { prefix: "$", name: "Flows", count: counts.flow, color: chalk.yellow },
59
+ { prefix: "^", name: "Gates", count: counts.gate, color: chalk.red },
60
+ { prefix: "!", name: "Signals", count: counts.signal, color: chalk.cyan },
61
+ { prefix: "~", name: "Aspects", count: counts.aspect, color: chalk.magenta }
62
+ ];
63
+ for (const { prefix, name, count, color } of symbolLines) {
64
+ if (count > 0) {
65
+ console.log(` ${color(prefix)} ${name.padEnd(12)} ${chalk.cyan(count.toString())}`);
66
+ }
67
+ }
68
+ const total = Object.values(counts).reduce((a, b) => a + b, 0);
69
+ console.log(chalk.gray("\u2500".repeat(40)));
70
+ console.log(` Total: ${chalk.cyan(total.toString())}`);
71
+ if (result.errors.length > 0) {
72
+ console.log(chalk.yellow("\nErrors"));
73
+ console.log(chalk.gray("\u2500".repeat(40)));
74
+ for (const error of result.errors) {
75
+ console.log(chalk.red(` \u2717 [${error.source}] ${error.filePath}: ${error.message}`));
76
+ }
77
+ }
78
+ console.log("");
79
+ } catch (error) {
80
+ spinner.fail("Aggregation failed");
81
+ console.log(chalk.red(`Error: ${error.message}
82
+ `));
83
+ process.exit(1);
84
+ }
85
+ }
86
+ export {
87
+ premiseAggregateCommand
88
+ };