@llm-dev-ops/agentics-cli 1.4.6 → 1.4.8

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 (160) hide show
  1. package/dist/adapters/base-adapter.d.ts +117 -0
  2. package/dist/adapters/base-adapter.d.ts.map +1 -1
  3. package/dist/adapters/base-adapter.js +143 -0
  4. package/dist/adapters/base-adapter.js.map +1 -1
  5. package/dist/auth/identity-resolver.d.ts +21 -0
  6. package/dist/auth/identity-resolver.d.ts.map +1 -0
  7. package/dist/auth/identity-resolver.js +68 -0
  8. package/dist/auth/identity-resolver.js.map +1 -0
  9. package/dist/auth/index.d.ts +2 -0
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/index.js +2 -0
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/auth/role-permissions.d.ts +12 -0
  14. package/dist/auth/role-permissions.d.ts.map +1 -0
  15. package/dist/auth/role-permissions.js +43 -0
  16. package/dist/auth/role-permissions.js.map +1 -0
  17. package/dist/cli/index.js +139 -134
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/commands/erp.d.ts.map +1 -1
  20. package/dist/commands/erp.js +62 -0
  21. package/dist/commands/erp.js.map +1 -1
  22. package/dist/commands/login.d.ts.map +1 -1
  23. package/dist/commands/login.js +25 -0
  24. package/dist/commands/login.js.map +1 -1
  25. package/dist/commands/logout.d.ts.map +1 -1
  26. package/dist/commands/logout.js +4 -1
  27. package/dist/commands/logout.js.map +1 -1
  28. package/dist/commands/plan.d.ts.map +1 -1
  29. package/dist/commands/plan.js +6 -5
  30. package/dist/commands/plan.js.map +1 -1
  31. package/dist/commands/simulate.d.ts.map +1 -1
  32. package/dist/commands/simulate.js +57 -1
  33. package/dist/commands/simulate.js.map +1 -1
  34. package/dist/commands/whoami.d.ts +4 -0
  35. package/dist/commands/whoami.d.ts.map +1 -1
  36. package/dist/commands/whoami.js +22 -5
  37. package/dist/commands/whoami.js.map +1 -1
  38. package/dist/contracts/adr-002-operational-enforcement.d.ts +684 -0
  39. package/dist/contracts/adr-002-operational-enforcement.d.ts.map +1 -0
  40. package/dist/contracts/adr-002-operational-enforcement.js +671 -0
  41. package/dist/contracts/adr-002-operational-enforcement.js.map +1 -0
  42. package/dist/contracts/adr-003-governance-architecture.d.ts +766 -0
  43. package/dist/contracts/adr-003-governance-architecture.d.ts.map +1 -0
  44. package/dist/contracts/adr-003-governance-architecture.js +773 -0
  45. package/dist/contracts/adr-003-governance-architecture.js.map +1 -0
  46. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts +1150 -0
  47. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts.map +1 -0
  48. package/dist/contracts/adr-004-enterprise-integration-memory.js +1158 -0
  49. package/dist/contracts/adr-004-enterprise-integration-memory.js.map +1 -0
  50. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts +1393 -0
  51. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts.map +1 -0
  52. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js +1371 -0
  53. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js.map +1 -0
  54. package/dist/contracts/adr-006-claude-code-synthesis-runner.d.ts +196 -0
  55. package/dist/contracts/adr-006-claude-code-synthesis-runner.d.ts.map +1 -0
  56. package/dist/contracts/adr-006-claude-code-synthesis-runner.js +177 -0
  57. package/dist/contracts/adr-006-claude-code-synthesis-runner.js.map +1 -0
  58. package/dist/contracts/adr-007-subcommand-synthesis-router.d.ts +273 -0
  59. package/dist/contracts/adr-007-subcommand-synthesis-router.d.ts.map +1 -0
  60. package/dist/contracts/adr-007-subcommand-synthesis-router.js +226 -0
  61. package/dist/contracts/adr-007-subcommand-synthesis-router.js.map +1 -0
  62. package/dist/contracts/adr-008-synthesis-artifact-persistence.d.ts +323 -0
  63. package/dist/contracts/adr-008-synthesis-artifact-persistence.d.ts.map +1 -0
  64. package/dist/contracts/adr-008-synthesis-artifact-persistence.js +184 -0
  65. package/dist/contracts/adr-008-synthesis-artifact-persistence.js.map +1 -0
  66. package/dist/contracts/adr-command-semantics.d.ts +150 -0
  67. package/dist/contracts/adr-command-semantics.d.ts.map +1 -0
  68. package/dist/contracts/adr-command-semantics.js +984 -0
  69. package/dist/contracts/adr-command-semantics.js.map +1 -0
  70. package/dist/contracts/index.d.ts +5 -0
  71. package/dist/contracts/index.d.ts.map +1 -1
  72. package/dist/contracts/index.js +16 -0
  73. package/dist/contracts/index.js.map +1 -1
  74. package/dist/enterprise/index.d.ts +16 -0
  75. package/dist/enterprise/index.d.ts.map +1 -0
  76. package/dist/enterprise/index.js +17 -0
  77. package/dist/enterprise/index.js.map +1 -0
  78. package/dist/enterprise/integration-registry.d.ts +73 -0
  79. package/dist/enterprise/integration-registry.d.ts.map +1 -0
  80. package/dist/enterprise/integration-registry.js +252 -0
  81. package/dist/enterprise/integration-registry.js.map +1 -0
  82. package/dist/enterprise/lineage.d.ts +73 -0
  83. package/dist/enterprise/lineage.d.ts.map +1 -0
  84. package/dist/enterprise/lineage.js +218 -0
  85. package/dist/enterprise/lineage.js.map +1 -0
  86. package/dist/gates/argument-guard.d.ts +39 -0
  87. package/dist/gates/argument-guard.d.ts.map +1 -0
  88. package/dist/gates/argument-guard.js +180 -0
  89. package/dist/gates/argument-guard.js.map +1 -0
  90. package/dist/gates/index.d.ts +5 -0
  91. package/dist/gates/index.d.ts.map +1 -1
  92. package/dist/gates/index.js +7 -0
  93. package/dist/gates/index.js.map +1 -1
  94. package/dist/gates/lineage-gate.d.ts +55 -0
  95. package/dist/gates/lineage-gate.d.ts.map +1 -0
  96. package/dist/gates/lineage-gate.js +127 -0
  97. package/dist/gates/lineage-gate.js.map +1 -0
  98. package/dist/mcp/mcp-server.d.ts +35 -0
  99. package/dist/mcp/mcp-server.d.ts.map +1 -0
  100. package/dist/mcp/mcp-server.js +692 -0
  101. package/dist/mcp/mcp-server.js.map +1 -0
  102. package/dist/modules/help-renderer.d.ts +25 -0
  103. package/dist/modules/help-renderer.d.ts.map +1 -0
  104. package/dist/modules/help-renderer.js +163 -0
  105. package/dist/modules/help-renderer.js.map +1 -0
  106. package/dist/modules/index.d.ts +1 -0
  107. package/dist/modules/index.d.ts.map +1 -1
  108. package/dist/modules/index.js +1 -0
  109. package/dist/modules/index.js.map +1 -1
  110. package/dist/runtime/claude-code-runner.d.ts +93 -0
  111. package/dist/runtime/claude-code-runner.d.ts.map +1 -0
  112. package/dist/runtime/claude-code-runner.js +588 -0
  113. package/dist/runtime/claude-code-runner.js.map +1 -0
  114. package/dist/runtime/index.d.ts +5 -0
  115. package/dist/runtime/index.d.ts.map +1 -0
  116. package/dist/runtime/index.js +5 -0
  117. package/dist/runtime/index.js.map +1 -0
  118. package/dist/server/index.d.ts +2 -0
  119. package/dist/server/index.d.ts.map +1 -1
  120. package/dist/server/index.js +16 -1
  121. package/dist/server/index.js.map +1 -1
  122. package/dist/server/routes/identity.d.ts +9 -0
  123. package/dist/server/routes/identity.d.ts.map +1 -0
  124. package/dist/server/routes/identity.js +100 -0
  125. package/dist/server/routes/identity.js.map +1 -0
  126. package/dist/server/routes/index.d.ts +2 -0
  127. package/dist/server/routes/index.d.ts.map +1 -1
  128. package/dist/server/routes/index.js +2 -0
  129. package/dist/server/routes/index.js.map +1 -1
  130. package/dist/server/routes/lineage.d.ts +15 -0
  131. package/dist/server/routes/lineage.d.ts.map +1 -0
  132. package/dist/server/routes/lineage.js +128 -0
  133. package/dist/server/routes/lineage.js.map +1 -0
  134. package/dist/synthesis/artifact-writer.d.ts +62 -0
  135. package/dist/synthesis/artifact-writer.d.ts.map +1 -0
  136. package/dist/synthesis/artifact-writer.js +603 -0
  137. package/dist/synthesis/artifact-writer.js.map +1 -0
  138. package/dist/synthesis/index.d.ts +7 -0
  139. package/dist/synthesis/index.d.ts.map +1 -0
  140. package/dist/synthesis/index.js +7 -0
  141. package/dist/synthesis/index.js.map +1 -0
  142. package/dist/synthesis/prompts/index.d.ts +50 -0
  143. package/dist/synthesis/prompts/index.d.ts.map +1 -0
  144. package/dist/synthesis/prompts/index.js +502 -0
  145. package/dist/synthesis/prompts/index.js.map +1 -0
  146. package/dist/synthesis/router.d.ts +70 -0
  147. package/dist/synthesis/router.d.ts.map +1 -0
  148. package/dist/synthesis/router.js +346 -0
  149. package/dist/synthesis/router.js.map +1 -0
  150. package/dist/types/index.d.ts +132 -0
  151. package/dist/types/index.d.ts.map +1 -1
  152. package/dist/utils/identity-store.d.ts +31 -0
  153. package/dist/utils/identity-store.d.ts.map +1 -0
  154. package/dist/utils/identity-store.js +97 -0
  155. package/dist/utils/identity-store.js.map +1 -0
  156. package/dist/utils/index.d.ts +2 -0
  157. package/dist/utils/index.d.ts.map +1 -1
  158. package/dist/utils/index.js +1 -0
  159. package/dist/utils/index.js.map +1 -1
  160. package/package.json +1 -1
@@ -0,0 +1,984 @@
1
+ /**
2
+ * ADR-001: Command Argument Semantics & Synthesis Governance
3
+ *
4
+ * STATUS: Accepted
5
+ * DATE: 2026-01-28
6
+ * AUTHORS: Platform Engineering
7
+ *
8
+ * ============================================================================
9
+ * CONTEXT
10
+ * ============================================================================
11
+ *
12
+ * The Agentics CLI is an enterprise orchestration tool, not a chat interface.
13
+ * Natural language seeds synthesis; IDs resolve persisted manifests.
14
+ * These are categorically different argument types with non-overlapping semantics.
15
+ *
16
+ * Without formal governance:
17
+ * - Users accidentally pass descriptions where IDs are required
18
+ * - Synthesis triggers on read-only or irreversible commands
19
+ * - Help output is ambiguous about what each command expects
20
+ * - Tests cannot be mechanically derived from command specifications
21
+ *
22
+ * ============================================================================
23
+ * DECISION
24
+ * ============================================================================
25
+ *
26
+ * 1. All CLI arguments are formally classified into three types:
27
+ * ID, NATURAL_LANGUAGE, and SELECTOR.
28
+ *
29
+ * 2. Each command+subcommand declares its exact argument contract.
30
+ *
31
+ * 3. A synthesis governance matrix classifies every command as:
32
+ * SYNTHESIS_REQUIRED, SYNTHESIS_FORBIDDEN, or COMMITMENT_GRADE.
33
+ *
34
+ * 4. Runtime validation middleware enforces these contracts before dispatch.
35
+ *
36
+ * 5. Help output, tests, and error messages are all derived from this ADR.
37
+ *
38
+ * ============================================================================
39
+ * ALTERNATIVES CONSIDERED
40
+ * ============================================================================
41
+ *
42
+ * A. Loose validation with runtime inference:
43
+ * Rejected — violates determinism and enterprise-grade predictability.
44
+ *
45
+ * B. Per-command ad-hoc validation:
46
+ * Rejected — leads to inconsistency, untestable, help drift.
47
+ *
48
+ * C. External YAML/JSON config:
49
+ * Rejected — TypeScript provides compile-time safety and co-location
50
+ * with the code it governs.
51
+ *
52
+ * ============================================================================
53
+ * CONSEQUENCES
54
+ * ============================================================================
55
+ *
56
+ * - Every command has one unambiguous semantic meaning
57
+ * - Users cannot accidentally misuse IDs vs natural language
58
+ * - Synthesis is impossible where unsafe
59
+ * - Validation, tests, and help all derive from this file
60
+ * - New commands must register here before they compile
61
+ *
62
+ * ============================================================================
63
+ * CLAUDE-CODE PARITY STATEMENT
64
+ * ============================================================================
65
+ *
66
+ * The Agentics CLI mirrors claude-flow + claude-code behavior:
67
+ * - Deterministic: same inputs always produce same dispatch path
68
+ * - Explicit: no inference, no guessing, no auto-correction
69
+ * - Enterprise-grade: fail fast with instructional errors
70
+ * - Composable: commands are pipeline stages, not chat turns
71
+ */
72
+ // ============================================================================
73
+ // Command Registry — THE SINGLE SOURCE OF TRUTH
74
+ // ============================================================================
75
+ export const COMMAND_REGISTRY = [
76
+ // ==========================================================================
77
+ // IDENTITY & ACCESS — SYNTHESIS FORBIDDEN
78
+ // ==========================================================================
79
+ {
80
+ command: 'login',
81
+ primary: 'login',
82
+ description: 'Authenticate the CLI via browser-based auth with API key',
83
+ synthesis: 'SYNTHESIS_FORBIDDEN',
84
+ args: [],
85
+ irreversible: false,
86
+ requiresConfirmation: false,
87
+ },
88
+ {
89
+ command: 'logout',
90
+ primary: 'logout',
91
+ description: 'Clear local authentication state',
92
+ synthesis: 'SYNTHESIS_FORBIDDEN',
93
+ args: [],
94
+ irreversible: false,
95
+ requiresConfirmation: false,
96
+ },
97
+ {
98
+ command: 'whoami',
99
+ primary: 'whoami',
100
+ description: 'Show current identity, org, and role',
101
+ synthesis: 'SYNTHESIS_FORBIDDEN',
102
+ args: [],
103
+ irreversible: false,
104
+ requiresConfirmation: false,
105
+ },
106
+ // ==========================================================================
107
+ // SIMULATION — SYNTHESIS REQUIRED / COMMITMENT GRADE
108
+ // ==========================================================================
109
+ {
110
+ command: 'simulate create',
111
+ primary: 'simulate',
112
+ subcommand: 'create',
113
+ description: 'Create a new simulation from a natural language description',
114
+ synthesis: 'SYNTHESIS_REQUIRED',
115
+ args: [
116
+ {
117
+ name: 'description',
118
+ type: 'NATURAL_LANGUAGE',
119
+ required: true,
120
+ description: 'Quoted natural language description of the simulation',
121
+ example: '"Simulate enterprise migration to cloud"',
122
+ },
123
+ ],
124
+ irreversible: false,
125
+ requiresConfirmation: false,
126
+ },
127
+ {
128
+ command: 'simulate run',
129
+ primary: 'simulate',
130
+ subcommand: 'run',
131
+ description: 'Execute a simulation by ID',
132
+ synthesis: 'COMMITMENT_GRADE',
133
+ args: [
134
+ {
135
+ name: 'simulation-id',
136
+ type: 'ID',
137
+ required: true,
138
+ description: 'ID of the simulation to run',
139
+ example: 'enterprise-cloud-migration',
140
+ },
141
+ ],
142
+ irreversible: true,
143
+ requiresConfirmation: true,
144
+ },
145
+ {
146
+ command: 'simulate list',
147
+ primary: 'simulate',
148
+ subcommand: 'list',
149
+ description: 'List all simulations',
150
+ synthesis: 'SYNTHESIS_FORBIDDEN',
151
+ args: [],
152
+ irreversible: false,
153
+ requiresConfirmation: false,
154
+ },
155
+ {
156
+ command: 'simulate inspect',
157
+ primary: 'simulate',
158
+ subcommand: 'inspect',
159
+ description: 'Inspect a simulation by ID',
160
+ synthesis: 'SYNTHESIS_FORBIDDEN',
161
+ args: [
162
+ {
163
+ name: 'simulation-id',
164
+ type: 'ID',
165
+ required: true,
166
+ description: 'ID of the simulation to inspect',
167
+ example: 'enterprise-cloud-migration',
168
+ },
169
+ ],
170
+ irreversible: false,
171
+ requiresConfirmation: false,
172
+ },
173
+ {
174
+ command: 'simulate delete',
175
+ primary: 'simulate',
176
+ subcommand: 'delete',
177
+ description: 'Delete a simulation by ID',
178
+ synthesis: 'SYNTHESIS_FORBIDDEN',
179
+ args: [
180
+ {
181
+ name: 'simulation-id',
182
+ type: 'ID',
183
+ required: true,
184
+ description: 'ID of the simulation to delete',
185
+ example: 'enterprise-cloud-migration',
186
+ },
187
+ ],
188
+ irreversible: true,
189
+ requiresConfirmation: true,
190
+ },
191
+ // ==========================================================================
192
+ // PLANNING — SYNTHESIS REQUIRED / COMMITMENT GRADE
193
+ // ==========================================================================
194
+ {
195
+ command: 'plan create',
196
+ primary: 'plan',
197
+ subcommand: 'create',
198
+ description: 'Create a new plan from a natural language description',
199
+ synthesis: 'SYNTHESIS_REQUIRED',
200
+ args: [
201
+ {
202
+ name: 'description',
203
+ type: 'NATURAL_LANGUAGE',
204
+ required: true,
205
+ description: 'Quoted natural language description of the plan',
206
+ example: '"Migrate authentication to OAuth2"',
207
+ },
208
+ ],
209
+ irreversible: false,
210
+ requiresConfirmation: false,
211
+ },
212
+ {
213
+ command: 'plan approve',
214
+ primary: 'plan',
215
+ subcommand: 'approve',
216
+ description: 'Approve a plan by ID (irreversible)',
217
+ synthesis: 'COMMITMENT_GRADE',
218
+ args: [
219
+ {
220
+ name: 'plan-id',
221
+ type: 'ID',
222
+ required: true,
223
+ description: 'UUID of the plan to approve',
224
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
225
+ },
226
+ ],
227
+ irreversible: true,
228
+ requiresConfirmation: true,
229
+ },
230
+ {
231
+ command: 'plan list',
232
+ primary: 'plan',
233
+ subcommand: 'list',
234
+ description: 'List all plans',
235
+ synthesis: 'SYNTHESIS_FORBIDDEN',
236
+ args: [],
237
+ irreversible: false,
238
+ requiresConfirmation: false,
239
+ },
240
+ {
241
+ command: 'plan inspect',
242
+ primary: 'plan',
243
+ subcommand: 'inspect',
244
+ description: 'Inspect a plan by ID',
245
+ synthesis: 'SYNTHESIS_FORBIDDEN',
246
+ args: [
247
+ {
248
+ name: 'plan-id',
249
+ type: 'ID',
250
+ required: true,
251
+ description: 'UUID of the plan to inspect',
252
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
253
+ },
254
+ ],
255
+ irreversible: false,
256
+ requiresConfirmation: false,
257
+ },
258
+ {
259
+ command: 'plan delete',
260
+ primary: 'plan',
261
+ subcommand: 'delete',
262
+ description: 'Delete a plan by ID',
263
+ synthesis: 'SYNTHESIS_FORBIDDEN',
264
+ args: [
265
+ {
266
+ name: 'plan-id',
267
+ type: 'ID',
268
+ required: true,
269
+ description: 'UUID of the plan to delete',
270
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
271
+ },
272
+ ],
273
+ irreversible: true,
274
+ requiresConfirmation: true,
275
+ },
276
+ // ==========================================================================
277
+ // DEPLOYMENT — SYNTHESIS REQUIRED / COMMITMENT GRADE
278
+ // ==========================================================================
279
+ {
280
+ command: 'deploy preview',
281
+ primary: 'deploy',
282
+ subcommand: 'preview',
283
+ description: 'Preview a deployment for a simulation',
284
+ synthesis: 'SYNTHESIS_REQUIRED',
285
+ args: [
286
+ {
287
+ name: 'simulation-id',
288
+ type: 'ID',
289
+ required: true,
290
+ description: 'ID of the simulation to preview deployment for',
291
+ example: 'enterprise-cloud-migration',
292
+ },
293
+ ],
294
+ irreversible: false,
295
+ requiresConfirmation: false,
296
+ },
297
+ {
298
+ command: 'deploy run',
299
+ primary: 'deploy',
300
+ subcommand: 'run',
301
+ description: 'Execute a deployment (irreversible)',
302
+ synthesis: 'COMMITMENT_GRADE',
303
+ args: [
304
+ {
305
+ name: 'deployment-id',
306
+ type: 'ID',
307
+ required: true,
308
+ description: 'ID of the deployment to execute',
309
+ example: 'deploy-prod-2026-01',
310
+ },
311
+ ],
312
+ irreversible: true,
313
+ requiresConfirmation: true,
314
+ },
315
+ {
316
+ command: 'deploy rollback',
317
+ primary: 'deploy',
318
+ subcommand: 'rollback',
319
+ description: 'Rollback a deployment (irreversible)',
320
+ synthesis: 'COMMITMENT_GRADE',
321
+ args: [
322
+ {
323
+ name: 'deployment-id',
324
+ type: 'ID',
325
+ required: true,
326
+ description: 'ID of the deployment to rollback',
327
+ example: 'deploy-prod-2026-01',
328
+ },
329
+ ],
330
+ irreversible: true,
331
+ requiresConfirmation: true,
332
+ },
333
+ {
334
+ command: 'deploy list',
335
+ primary: 'deploy',
336
+ subcommand: 'list',
337
+ description: 'List all deployments',
338
+ synthesis: 'SYNTHESIS_FORBIDDEN',
339
+ args: [],
340
+ irreversible: false,
341
+ requiresConfirmation: false,
342
+ },
343
+ {
344
+ command: 'deploy status',
345
+ primary: 'deploy',
346
+ subcommand: 'status',
347
+ description: 'Check deployment status by ID',
348
+ synthesis: 'SYNTHESIS_FORBIDDEN',
349
+ args: [
350
+ {
351
+ name: 'deployment-id',
352
+ type: 'ID',
353
+ required: true,
354
+ description: 'ID of the deployment to check',
355
+ example: 'deploy-prod-2026-01',
356
+ },
357
+ ],
358
+ irreversible: false,
359
+ requiresConfirmation: false,
360
+ },
361
+ // ==========================================================================
362
+ // EXPORT — SYNTHESIS REQUIRED
363
+ // ==========================================================================
364
+ {
365
+ command: 'export terraform',
366
+ primary: 'export',
367
+ subcommand: 'terraform',
368
+ description: 'Export deployment artifacts as Terraform',
369
+ synthesis: 'SYNTHESIS_REQUIRED',
370
+ args: [
371
+ {
372
+ name: 'intent-id',
373
+ type: 'ID',
374
+ required: true,
375
+ description: 'ID of the deployment intent to export',
376
+ example: 'intent-cloud-migration',
377
+ },
378
+ ],
379
+ irreversible: false,
380
+ requiresConfirmation: false,
381
+ },
382
+ {
383
+ command: 'export kubernetes',
384
+ primary: 'export',
385
+ subcommand: 'kubernetes',
386
+ description: 'Export deployment artifacts as Kubernetes manifests',
387
+ synthesis: 'SYNTHESIS_REQUIRED',
388
+ args: [
389
+ {
390
+ name: 'intent-id',
391
+ type: 'ID',
392
+ required: true,
393
+ description: 'ID of the deployment intent to export',
394
+ example: 'intent-cloud-migration',
395
+ },
396
+ ],
397
+ irreversible: false,
398
+ requiresConfirmation: false,
399
+ },
400
+ {
401
+ command: 'export erp',
402
+ primary: 'export',
403
+ subcommand: 'erp',
404
+ description: 'Export deployment artifacts as ERP integration',
405
+ synthesis: 'SYNTHESIS_REQUIRED',
406
+ args: [
407
+ {
408
+ name: 'intent-id',
409
+ type: 'ID',
410
+ required: true,
411
+ description: 'ID of the deployment intent to export',
412
+ example: 'intent-cloud-migration',
413
+ },
414
+ ],
415
+ irreversible: false,
416
+ requiresConfirmation: false,
417
+ },
418
+ // ==========================================================================
419
+ // POLICY — SYNTHESIS REQUIRED / COMMITMENT GRADE
420
+ // ==========================================================================
421
+ {
422
+ command: 'policy create',
423
+ primary: 'policy',
424
+ subcommand: 'create',
425
+ description: 'Create a new policy from a natural language description',
426
+ synthesis: 'SYNTHESIS_REQUIRED',
427
+ args: [
428
+ {
429
+ name: 'description',
430
+ type: 'NATURAL_LANGUAGE',
431
+ required: true,
432
+ description: 'Quoted natural language description of the policy',
433
+ example: '"Enforce SOC2 compliance on all deployments"',
434
+ },
435
+ ],
436
+ irreversible: false,
437
+ requiresConfirmation: false,
438
+ },
439
+ {
440
+ command: 'policy edit',
441
+ primary: 'policy',
442
+ subcommand: 'edit',
443
+ description: 'Edit a policy by ID',
444
+ synthesis: 'SYNTHESIS_REQUIRED',
445
+ args: [
446
+ {
447
+ name: 'policy-id',
448
+ type: 'ID',
449
+ required: true,
450
+ description: 'ID of the policy to edit',
451
+ example: 'soc2-compliance',
452
+ },
453
+ ],
454
+ irreversible: false,
455
+ requiresConfirmation: false,
456
+ },
457
+ {
458
+ command: 'policy enable',
459
+ primary: 'policy',
460
+ subcommand: 'enable',
461
+ description: 'Enable a policy by ID (commitment-grade)',
462
+ synthesis: 'COMMITMENT_GRADE',
463
+ args: [
464
+ {
465
+ name: 'policy-id',
466
+ type: 'ID',
467
+ required: true,
468
+ description: 'ID of the policy to enable',
469
+ example: 'soc2-compliance',
470
+ },
471
+ ],
472
+ irreversible: true,
473
+ requiresConfirmation: true,
474
+ },
475
+ {
476
+ command: 'policy disable',
477
+ primary: 'policy',
478
+ subcommand: 'disable',
479
+ description: 'Disable a policy by ID',
480
+ synthesis: 'SYNTHESIS_REQUIRED',
481
+ args: [
482
+ {
483
+ name: 'policy-id',
484
+ type: 'ID',
485
+ required: true,
486
+ description: 'ID of the policy to disable',
487
+ example: 'soc2-compliance',
488
+ },
489
+ ],
490
+ irreversible: false,
491
+ requiresConfirmation: true,
492
+ },
493
+ {
494
+ command: 'policy dry-run',
495
+ primary: 'policy',
496
+ subcommand: 'dry-run',
497
+ description: 'Dry-run a policy against a target',
498
+ synthesis: 'SYNTHESIS_REQUIRED',
499
+ args: [
500
+ {
501
+ name: 'policy-id',
502
+ type: 'ID',
503
+ required: true,
504
+ description: 'ID of the policy to dry-run',
505
+ example: 'soc2-compliance',
506
+ },
507
+ ],
508
+ irreversible: false,
509
+ requiresConfirmation: false,
510
+ },
511
+ {
512
+ command: 'policy list',
513
+ primary: 'policy',
514
+ subcommand: 'list',
515
+ description: 'List all policies',
516
+ synthesis: 'SYNTHESIS_FORBIDDEN',
517
+ args: [],
518
+ irreversible: false,
519
+ requiresConfirmation: false,
520
+ },
521
+ {
522
+ command: 'policy inspect',
523
+ primary: 'policy',
524
+ subcommand: 'inspect',
525
+ description: 'Inspect a policy by ID',
526
+ synthesis: 'SYNTHESIS_FORBIDDEN',
527
+ args: [
528
+ {
529
+ name: 'policy-id',
530
+ type: 'ID',
531
+ required: true,
532
+ description: 'ID of the policy to inspect',
533
+ example: 'soc2-compliance',
534
+ },
535
+ ],
536
+ irreversible: false,
537
+ requiresConfirmation: false,
538
+ },
539
+ {
540
+ command: 'policy delete',
541
+ primary: 'policy',
542
+ subcommand: 'delete',
543
+ description: 'Delete a policy by ID',
544
+ synthesis: 'SYNTHESIS_FORBIDDEN',
545
+ args: [
546
+ {
547
+ name: 'policy-id',
548
+ type: 'ID',
549
+ required: true,
550
+ description: 'ID of the policy to delete',
551
+ example: 'soc2-compliance',
552
+ },
553
+ ],
554
+ irreversible: true,
555
+ requiresConfirmation: true,
556
+ },
557
+ // ==========================================================================
558
+ // QUANTIFY — SYNTHESIS REQUIRED / COMMITMENT GRADE
559
+ // ==========================================================================
560
+ {
561
+ command: 'quantify create',
562
+ primary: 'quantify',
563
+ subcommand: 'create',
564
+ description: 'Create a new ROI report from a natural language description',
565
+ synthesis: 'SYNTHESIS_REQUIRED',
566
+ args: [
567
+ {
568
+ name: 'description',
569
+ type: 'NATURAL_LANGUAGE',
570
+ required: true,
571
+ description: 'Quoted natural language description of the ROI analysis',
572
+ example: '"Compare cloud costs for 3-year migration"',
573
+ },
574
+ ],
575
+ irreversible: false,
576
+ requiresConfirmation: false,
577
+ },
578
+ {
579
+ command: 'quantify compare',
580
+ primary: 'quantify',
581
+ subcommand: 'compare',
582
+ description: 'Compare two ROI reports by ID (commitment-grade)',
583
+ synthesis: 'COMMITMENT_GRADE',
584
+ args: [
585
+ {
586
+ name: 'report-id-1',
587
+ type: 'ID',
588
+ required: true,
589
+ description: 'ID of the first ROI report',
590
+ example: 'roi-cloud-3yr',
591
+ },
592
+ {
593
+ name: 'report-id-2',
594
+ type: 'ID',
595
+ required: true,
596
+ description: 'ID of the second ROI report',
597
+ example: 'roi-onprem-3yr',
598
+ },
599
+ ],
600
+ irreversible: false,
601
+ requiresConfirmation: true,
602
+ },
603
+ {
604
+ command: 'quantify list',
605
+ primary: 'quantify',
606
+ subcommand: 'list',
607
+ description: 'List all ROI reports',
608
+ synthesis: 'SYNTHESIS_FORBIDDEN',
609
+ args: [],
610
+ irreversible: false,
611
+ requiresConfirmation: false,
612
+ },
613
+ {
614
+ command: 'quantify inspect',
615
+ primary: 'quantify',
616
+ subcommand: 'inspect',
617
+ description: 'Inspect a ROI report by ID',
618
+ synthesis: 'SYNTHESIS_FORBIDDEN',
619
+ args: [
620
+ {
621
+ name: 'report-id',
622
+ type: 'ID',
623
+ required: true,
624
+ description: 'ID of the ROI report to inspect',
625
+ example: 'roi-cloud-3yr',
626
+ },
627
+ ],
628
+ irreversible: false,
629
+ requiresConfirmation: false,
630
+ },
631
+ {
632
+ command: 'quantify delete',
633
+ primary: 'quantify',
634
+ subcommand: 'delete',
635
+ description: 'Delete a ROI report by ID',
636
+ synthesis: 'SYNTHESIS_FORBIDDEN',
637
+ args: [
638
+ {
639
+ name: 'report-id',
640
+ type: 'ID',
641
+ required: true,
642
+ description: 'ID of the ROI report to delete',
643
+ example: 'roi-cloud-3yr',
644
+ },
645
+ ],
646
+ irreversible: true,
647
+ requiresConfirmation: true,
648
+ },
649
+ // ==========================================================================
650
+ // ERP SURFACE — SYNTHESIS REQUIRED
651
+ // ==========================================================================
652
+ {
653
+ command: 'erp surface',
654
+ primary: 'erp',
655
+ subcommand: 'surface',
656
+ description: 'Surface ERP integration points for a plan',
657
+ synthesis: 'SYNTHESIS_REQUIRED',
658
+ args: [
659
+ {
660
+ name: 'plan-id',
661
+ type: 'ID',
662
+ required: true,
663
+ description: 'ID of the plan to analyze for ERP integration',
664
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
665
+ },
666
+ ],
667
+ irreversible: false,
668
+ requiresConfirmation: false,
669
+ },
670
+ {
671
+ command: 'erp map',
672
+ primary: 'erp',
673
+ subcommand: 'map',
674
+ description: 'Map ERP entities for a plan',
675
+ synthesis: 'SYNTHESIS_REQUIRED',
676
+ args: [
677
+ {
678
+ name: 'plan-id',
679
+ type: 'ID',
680
+ required: true,
681
+ description: 'ID of the plan to map ERP entities for',
682
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
683
+ },
684
+ ],
685
+ irreversible: false,
686
+ requiresConfirmation: false,
687
+ },
688
+ {
689
+ command: 'erp export',
690
+ primary: 'erp',
691
+ subcommand: 'export',
692
+ description: 'Export ERP integration artifacts for a plan',
693
+ synthesis: 'SYNTHESIS_REQUIRED',
694
+ args: [
695
+ {
696
+ name: 'plan-id',
697
+ type: 'ID',
698
+ required: true,
699
+ description: 'ID of the plan to export ERP artifacts for',
700
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
701
+ },
702
+ ],
703
+ irreversible: false,
704
+ requiresConfirmation: false,
705
+ },
706
+ {
707
+ command: 'erp list',
708
+ primary: 'erp',
709
+ subcommand: 'list',
710
+ description: 'List supported ERP systems',
711
+ synthesis: 'SYNTHESIS_FORBIDDEN',
712
+ args: [],
713
+ irreversible: false,
714
+ requiresConfirmation: false,
715
+ },
716
+ {
717
+ command: 'erp inspect',
718
+ primary: 'erp',
719
+ subcommand: 'inspect',
720
+ description: 'Inspect an ERP system configuration',
721
+ synthesis: 'SYNTHESIS_FORBIDDEN',
722
+ args: [
723
+ {
724
+ name: 'system-name',
725
+ type: 'ID',
726
+ required: true,
727
+ description: 'Name of the ERP system to inspect',
728
+ example: 'sap',
729
+ },
730
+ ],
731
+ irreversible: false,
732
+ requiresConfirmation: false,
733
+ },
734
+ // ==========================================================================
735
+ // INSPECT — SYNTHESIS FORBIDDEN (READ-ONLY)
736
+ // ==========================================================================
737
+ {
738
+ command: 'inspect',
739
+ primary: 'inspect',
740
+ description: 'Inspect a resource by reference (read-only)',
741
+ synthesis: 'SYNTHESIS_FORBIDDEN',
742
+ args: [
743
+ {
744
+ name: 'reference',
745
+ type: 'ID',
746
+ required: false,
747
+ description: 'ID or JSON reference of the resource to inspect',
748
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
749
+ },
750
+ ],
751
+ irreversible: false,
752
+ requiresConfirmation: false,
753
+ },
754
+ {
755
+ command: 'inspect latest',
756
+ primary: 'inspect',
757
+ subcommand: 'latest',
758
+ description: 'Inspect the latest run',
759
+ synthesis: 'SYNTHESIS_FORBIDDEN',
760
+ args: [],
761
+ irreversible: false,
762
+ requiresConfirmation: false,
763
+ },
764
+ {
765
+ command: 'inspect run',
766
+ primary: 'inspect',
767
+ subcommand: 'run',
768
+ description: 'Inspect a specific run by ID',
769
+ synthesis: 'SYNTHESIS_FORBIDDEN',
770
+ args: [
771
+ {
772
+ name: 'run-id',
773
+ type: 'ID',
774
+ required: true,
775
+ description: 'ID of the run to inspect',
776
+ example: 'run-2026-01-28-001',
777
+ },
778
+ ],
779
+ irreversible: false,
780
+ requiresConfirmation: false,
781
+ },
782
+ {
783
+ command: 'inspect artifacts',
784
+ primary: 'inspect',
785
+ subcommand: 'artifacts',
786
+ description: 'Inspect artifacts for a run by ID',
787
+ synthesis: 'SYNTHESIS_FORBIDDEN',
788
+ args: [
789
+ {
790
+ name: 'run-id',
791
+ type: 'ID',
792
+ required: true,
793
+ description: 'ID of the run to inspect artifacts for',
794
+ example: 'run-2026-01-28-001',
795
+ },
796
+ ],
797
+ irreversible: false,
798
+ requiresConfirmation: false,
799
+ },
800
+ // ==========================================================================
801
+ // USAGE & BILLING — SYNTHESIS FORBIDDEN
802
+ // ==========================================================================
803
+ {
804
+ command: 'usage',
805
+ primary: 'usage',
806
+ description: 'Show current usage summary',
807
+ synthesis: 'SYNTHESIS_FORBIDDEN',
808
+ args: [],
809
+ irreversible: false,
810
+ requiresConfirmation: false,
811
+ },
812
+ {
813
+ command: 'usage history',
814
+ primary: 'usage',
815
+ subcommand: 'history',
816
+ description: 'Show usage history',
817
+ synthesis: 'SYNTHESIS_FORBIDDEN',
818
+ args: [],
819
+ irreversible: false,
820
+ requiresConfirmation: false,
821
+ },
822
+ {
823
+ command: 'usage limits',
824
+ primary: 'usage',
825
+ subcommand: 'limits',
826
+ description: 'Show usage limits',
827
+ synthesis: 'SYNTHESIS_FORBIDDEN',
828
+ args: [],
829
+ irreversible: false,
830
+ requiresConfirmation: false,
831
+ },
832
+ {
833
+ command: 'usage reset',
834
+ primary: 'usage',
835
+ subcommand: 'reset',
836
+ description: 'Reset usage counters (requires --force)',
837
+ synthesis: 'SYNTHESIS_FORBIDDEN',
838
+ args: [],
839
+ irreversible: true,
840
+ requiresConfirmation: true,
841
+ },
842
+ // ==========================================================================
843
+ // DILIGENCE — SYNTHESIS REQUIRED
844
+ // ==========================================================================
845
+ {
846
+ command: 'diligence',
847
+ primary: 'diligence',
848
+ description: 'Run due diligence analysis on references',
849
+ synthesis: 'SYNTHESIS_REQUIRED',
850
+ args: [
851
+ {
852
+ name: 'description',
853
+ type: 'NATURAL_LANGUAGE',
854
+ required: true,
855
+ description: 'Quoted natural language description or JSON references',
856
+ example: '"Analyze compliance for SOC2 and HIPAA"',
857
+ },
858
+ ],
859
+ irreversible: false,
860
+ requiresConfirmation: false,
861
+ },
862
+ // ==========================================================================
863
+ // BUILT-IN — SYNTHESIS FORBIDDEN
864
+ // ==========================================================================
865
+ {
866
+ command: 'help',
867
+ primary: 'help',
868
+ description: 'Show help information',
869
+ synthesis: 'SYNTHESIS_FORBIDDEN',
870
+ args: [],
871
+ irreversible: false,
872
+ requiresConfirmation: false,
873
+ },
874
+ {
875
+ command: 'version',
876
+ primary: 'version',
877
+ description: 'Show CLI version',
878
+ synthesis: 'SYNTHESIS_FORBIDDEN',
879
+ args: [],
880
+ irreversible: false,
881
+ requiresConfirmation: false,
882
+ },
883
+ ];
884
+ // ============================================================================
885
+ // Schema Version (ADR-002 Decision 1)
886
+ // ============================================================================
887
+ /**
888
+ * ADR schema version. Must be bumped when:
889
+ * - MAJOR: argument contracts change in a breaking way
890
+ * - MINOR: new commands are added
891
+ * - PATCH: help text, examples, or descriptions are corrected
892
+ */
893
+ export const ADR_SCHEMA_VERSION = '1.0.0';
894
+ // ============================================================================
895
+ // Registry Lookup Functions
896
+ // ============================================================================
897
+ /**
898
+ * Look up a command specification by primary + subcommand.
899
+ * Returns undefined if not registered (which is itself an error).
900
+ */
901
+ export function lookupCommand(primary, subcommand) {
902
+ if (subcommand) {
903
+ return COMMAND_REGISTRY.find(c => c.primary === primary && c.subcommand === subcommand);
904
+ }
905
+ // Match primary-only (no subcommand)
906
+ return COMMAND_REGISTRY.find(c => c.primary === primary && !c.subcommand);
907
+ }
908
+ /**
909
+ * Get all commands for a primary command.
910
+ */
911
+ export function getSubcommands(primary) {
912
+ return COMMAND_REGISTRY.filter(c => c.primary === primary);
913
+ }
914
+ /**
915
+ * Check if a command allows synthesis.
916
+ */
917
+ export function isSynthesisAllowed(primary, subcommand) {
918
+ const spec = lookupCommand(primary, subcommand);
919
+ if (!spec)
920
+ return false;
921
+ return spec.synthesis === 'SYNTHESIS_REQUIRED' || spec.synthesis === 'COMMITMENT_GRADE';
922
+ }
923
+ /**
924
+ * Check if a command is commitment-grade (irreversible + requires confirmation).
925
+ */
926
+ export function isCommitmentGrade(primary, subcommand) {
927
+ const spec = lookupCommand(primary, subcommand);
928
+ if (!spec)
929
+ return false;
930
+ return spec.synthesis === 'COMMITMENT_GRADE';
931
+ }
932
+ // ============================================================================
933
+ // Argument Classification Helpers
934
+ // ============================================================================
935
+ /** ID pattern: lowercase alphanumeric, hyphens, dots, or UUID format */
936
+ const ID_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
937
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
938
+ /**
939
+ * Classify a raw string argument into its detected type.
940
+ */
941
+ export function classifyArgument(value) {
942
+ const trimmed = value.trim();
943
+ // Empty string is not valid for any type
944
+ if (!trimmed)
945
+ return 'NATURAL_LANGUAGE';
946
+ // Selectors: special keywords
947
+ if (trimmed === 'latest')
948
+ return 'SELECTOR';
949
+ // UUIDs are IDs
950
+ if (UUID_PATTERN.test(trimmed))
951
+ return 'ID';
952
+ // Quoted strings are natural language
953
+ if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
954
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
955
+ return 'NATURAL_LANGUAGE';
956
+ }
957
+ // Strings with spaces are natural language
958
+ if (trimmed.includes(' '))
959
+ return 'NATURAL_LANGUAGE';
960
+ // Lowercase hyphenated identifiers are IDs
961
+ if (ID_PATTERN.test(trimmed))
962
+ return 'ID';
963
+ // Everything else is natural language
964
+ return 'NATURAL_LANGUAGE';
965
+ }
966
+ /**
967
+ * Validate that a given argument matches its expected type.
968
+ * Returns null if valid, or an error message if invalid.
969
+ */
970
+ export function validateArgument(value, expected) {
971
+ const detected = classifyArgument(value);
972
+ if (expected.type === 'ID' && detected === 'NATURAL_LANGUAGE') {
973
+ return `This command requires an ID, not a description. Got: "${value}"\n` +
974
+ `Expected: ${expected.description}\n` +
975
+ `Example: agentics ... ${expected.example}`;
976
+ }
977
+ if (expected.type === 'NATURAL_LANGUAGE' && detected === 'ID') {
978
+ return `This command requires a quoted natural language description, not an ID. Got: "${value}"\n` +
979
+ `Expected: ${expected.description}\n` +
980
+ `Example: agentics ... ${expected.example}`;
981
+ }
982
+ return null;
983
+ }
984
+ //# sourceMappingURL=adr-command-semantics.js.map