@llm-dev-ops/agentics-cli 1.4.4 → 1.4.7

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 (167) 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/agents/cli-ux-agent.d.ts.map +1 -1
  6. package/dist/agents/cli-ux-agent.js +2 -1
  7. package/dist/agents/cli-ux-agent.js.map +1 -1
  8. package/dist/auth/identity-resolver.d.ts +21 -0
  9. package/dist/auth/identity-resolver.d.ts.map +1 -0
  10. package/dist/auth/identity-resolver.js +68 -0
  11. package/dist/auth/identity-resolver.js.map +1 -0
  12. package/dist/auth/index.d.ts +2 -0
  13. package/dist/auth/index.d.ts.map +1 -1
  14. package/dist/auth/index.js +2 -0
  15. package/dist/auth/index.js.map +1 -1
  16. package/dist/auth/role-permissions.d.ts +12 -0
  17. package/dist/auth/role-permissions.d.ts.map +1 -0
  18. package/dist/auth/role-permissions.js +43 -0
  19. package/dist/auth/role-permissions.js.map +1 -0
  20. package/dist/cli/index.js +162 -157
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/commands/deploy.d.ts +4 -4
  23. package/dist/commands/deploy.d.ts.map +1 -1
  24. package/dist/commands/deploy.js +83 -21
  25. package/dist/commands/deploy.js.map +1 -1
  26. package/dist/commands/erp.d.ts +1 -1
  27. package/dist/commands/erp.d.ts.map +1 -1
  28. package/dist/commands/erp.js +65 -5
  29. package/dist/commands/erp.js.map +1 -1
  30. package/dist/commands/export.d.ts +5 -5
  31. package/dist/commands/export.js +5 -5
  32. package/dist/commands/inspect.d.ts +28 -0
  33. package/dist/commands/inspect.d.ts.map +1 -1
  34. package/dist/commands/inspect.js +113 -0
  35. package/dist/commands/inspect.js.map +1 -1
  36. package/dist/commands/login.d.ts +8 -6
  37. package/dist/commands/login.d.ts.map +1 -1
  38. package/dist/commands/login.js +171 -89
  39. package/dist/commands/login.js.map +1 -1
  40. package/dist/commands/logout.d.ts.map +1 -1
  41. package/dist/commands/logout.js +4 -1
  42. package/dist/commands/logout.js.map +1 -1
  43. package/dist/commands/plan.d.ts +8 -5
  44. package/dist/commands/plan.d.ts.map +1 -1
  45. package/dist/commands/plan.js +88 -63
  46. package/dist/commands/plan.js.map +1 -1
  47. package/dist/commands/policy.d.ts +53 -0
  48. package/dist/commands/policy.d.ts.map +1 -1
  49. package/dist/commands/policy.js +201 -5
  50. package/dist/commands/policy.js.map +1 -1
  51. package/dist/commands/quantify.d.ts +1 -1
  52. package/dist/commands/quantify.d.ts.map +1 -1
  53. package/dist/commands/quantify.js +2 -4
  54. package/dist/commands/quantify.js.map +1 -1
  55. package/dist/commands/simulate.d.ts +3 -2
  56. package/dist/commands/simulate.d.ts.map +1 -1
  57. package/dist/commands/simulate.js +154 -37
  58. package/dist/commands/simulate.js.map +1 -1
  59. package/dist/commands/usage.d.ts +3 -3
  60. package/dist/commands/usage.js +7 -7
  61. package/dist/commands/usage.js.map +1 -1
  62. package/dist/commands/whoami.d.ts +6 -0
  63. package/dist/commands/whoami.d.ts.map +1 -1
  64. package/dist/commands/whoami.js +44 -7
  65. package/dist/commands/whoami.js.map +1 -1
  66. package/dist/contracts/adr-002-operational-enforcement.d.ts +684 -0
  67. package/dist/contracts/adr-002-operational-enforcement.d.ts.map +1 -0
  68. package/dist/contracts/adr-002-operational-enforcement.js +671 -0
  69. package/dist/contracts/adr-002-operational-enforcement.js.map +1 -0
  70. package/dist/contracts/adr-003-governance-architecture.d.ts +766 -0
  71. package/dist/contracts/adr-003-governance-architecture.d.ts.map +1 -0
  72. package/dist/contracts/adr-003-governance-architecture.js +773 -0
  73. package/dist/contracts/adr-003-governance-architecture.js.map +1 -0
  74. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts +1150 -0
  75. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts.map +1 -0
  76. package/dist/contracts/adr-004-enterprise-integration-memory.js +1158 -0
  77. package/dist/contracts/adr-004-enterprise-integration-memory.js.map +1 -0
  78. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts +1393 -0
  79. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts.map +1 -0
  80. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js +1371 -0
  81. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js.map +1 -0
  82. package/dist/contracts/adr-command-semantics.d.ts +150 -0
  83. package/dist/contracts/adr-command-semantics.d.ts.map +1 -0
  84. package/dist/contracts/adr-command-semantics.js +984 -0
  85. package/dist/contracts/adr-command-semantics.js.map +1 -0
  86. package/dist/contracts/index.d.ts +5 -0
  87. package/dist/contracts/index.d.ts.map +1 -1
  88. package/dist/contracts/index.js +16 -0
  89. package/dist/contracts/index.js.map +1 -1
  90. package/dist/enterprise/index.d.ts +16 -0
  91. package/dist/enterprise/index.d.ts.map +1 -0
  92. package/dist/enterprise/index.js +17 -0
  93. package/dist/enterprise/index.js.map +1 -0
  94. package/dist/enterprise/integration-registry.d.ts +73 -0
  95. package/dist/enterprise/integration-registry.d.ts.map +1 -0
  96. package/dist/enterprise/integration-registry.js +252 -0
  97. package/dist/enterprise/integration-registry.js.map +1 -0
  98. package/dist/enterprise/lineage.d.ts +73 -0
  99. package/dist/enterprise/lineage.d.ts.map +1 -0
  100. package/dist/enterprise/lineage.js +218 -0
  101. package/dist/enterprise/lineage.js.map +1 -0
  102. package/dist/gates/argument-guard.d.ts +39 -0
  103. package/dist/gates/argument-guard.d.ts.map +1 -0
  104. package/dist/gates/argument-guard.js +180 -0
  105. package/dist/gates/argument-guard.js.map +1 -0
  106. package/dist/gates/auth-session-gate.d.ts +47 -0
  107. package/dist/gates/auth-session-gate.d.ts.map +1 -0
  108. package/dist/gates/auth-session-gate.js +151 -0
  109. package/dist/gates/auth-session-gate.js.map +1 -0
  110. package/dist/gates/execution-gate.d.ts +12 -17
  111. package/dist/gates/execution-gate.d.ts.map +1 -1
  112. package/dist/gates/execution-gate.js +74 -46
  113. package/dist/gates/execution-gate.js.map +1 -1
  114. package/dist/gates/index.d.ts +25 -2
  115. package/dist/gates/index.d.ts.map +1 -1
  116. package/dist/gates/index.js +31 -2
  117. package/dist/gates/index.js.map +1 -1
  118. package/dist/gates/lineage-gate.d.ts +55 -0
  119. package/dist/gates/lineage-gate.d.ts.map +1 -0
  120. package/dist/gates/lineage-gate.js +127 -0
  121. package/dist/gates/lineage-gate.js.map +1 -0
  122. package/dist/gates/output-format-gate.d.ts +54 -0
  123. package/dist/gates/output-format-gate.d.ts.map +1 -0
  124. package/dist/gates/output-format-gate.js +136 -0
  125. package/dist/gates/output-format-gate.js.map +1 -0
  126. package/dist/gates/service-health-gate.d.ts +56 -0
  127. package/dist/gates/service-health-gate.d.ts.map +1 -0
  128. package/dist/gates/service-health-gate.js +179 -0
  129. package/dist/gates/service-health-gate.js.map +1 -0
  130. package/dist/modules/help-renderer.d.ts +25 -0
  131. package/dist/modules/help-renderer.d.ts.map +1 -0
  132. package/dist/modules/help-renderer.js +163 -0
  133. package/dist/modules/help-renderer.js.map +1 -0
  134. package/dist/modules/index.d.ts +1 -0
  135. package/dist/modules/index.d.ts.map +1 -1
  136. package/dist/modules/index.js +1 -0
  137. package/dist/modules/index.js.map +1 -1
  138. package/dist/server/index.d.ts +2 -0
  139. package/dist/server/index.d.ts.map +1 -1
  140. package/dist/server/index.js +16 -1
  141. package/dist/server/index.js.map +1 -1
  142. package/dist/server/routes/auth.d.ts.map +1 -1
  143. package/dist/server/routes/auth.js +45 -8
  144. package/dist/server/routes/auth.js.map +1 -1
  145. package/dist/server/routes/identity.d.ts +9 -0
  146. package/dist/server/routes/identity.d.ts.map +1 -0
  147. package/dist/server/routes/identity.js +100 -0
  148. package/dist/server/routes/identity.js.map +1 -0
  149. package/dist/server/routes/index.d.ts +2 -0
  150. package/dist/server/routes/index.d.ts.map +1 -1
  151. package/dist/server/routes/index.js +2 -0
  152. package/dist/server/routes/index.js.map +1 -1
  153. package/dist/server/routes/lineage.d.ts +15 -0
  154. package/dist/server/routes/lineage.d.ts.map +1 -0
  155. package/dist/server/routes/lineage.js +128 -0
  156. package/dist/server/routes/lineage.js.map +1 -0
  157. package/dist/types/index.d.ts +134 -0
  158. package/dist/types/index.d.ts.map +1 -1
  159. package/dist/utils/identity-store.d.ts +31 -0
  160. package/dist/utils/identity-store.d.ts.map +1 -0
  161. package/dist/utils/identity-store.js +97 -0
  162. package/dist/utils/identity-store.js.map +1 -0
  163. package/dist/utils/index.d.ts +2 -0
  164. package/dist/utils/index.d.ts.map +1 -1
  165. package/dist/utils/index.js +1 -0
  166. package/dist/utils/index.js.map +1 -1
  167. package/package.json +4 -4
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Role Permissions
3
+ *
4
+ * Lookup table for role-based access control.
5
+ * Three roles: owner, admin, member.
6
+ * Permissions enforced server-side.
7
+ */
8
+ const ROLE_PERMISSIONS = {
9
+ owner: new Set([
10
+ 'plan:read', 'plan:create', 'plan:delete', 'plan:approve',
11
+ 'simulate:read', 'simulate:create', 'simulate:run', 'simulate:delete',
12
+ 'deploy:read', 'deploy:create', 'deploy:run', 'deploy:rollback',
13
+ 'export:read', 'export:create',
14
+ 'policy:read', 'policy:create', 'policy:edit', 'policy:delete',
15
+ 'org:read', 'org:manage',
16
+ 'usage:read', 'usage:reset',
17
+ ]),
18
+ admin: new Set([
19
+ 'plan:read', 'plan:create', 'plan:delete', 'plan:approve',
20
+ 'simulate:read', 'simulate:create', 'simulate:run', 'simulate:delete',
21
+ 'deploy:read', 'deploy:create', 'deploy:run', 'deploy:rollback',
22
+ 'export:read', 'export:create',
23
+ 'policy:read', 'policy:create', 'policy:edit', 'policy:delete',
24
+ 'org:read',
25
+ 'usage:read',
26
+ ]),
27
+ member: new Set([
28
+ 'plan:read', 'plan:create',
29
+ 'simulate:read', 'simulate:create', 'simulate:run',
30
+ 'deploy:read',
31
+ 'export:read', 'export:create',
32
+ 'policy:read',
33
+ 'org:read',
34
+ 'usage:read',
35
+ ]),
36
+ };
37
+ export function hasPermission(role, permission) {
38
+ return ROLE_PERMISSIONS[role]?.has(permission) ?? false;
39
+ }
40
+ export function getPermissions(role) {
41
+ return ROLE_PERMISSIONS[role] ?? new Set();
42
+ }
43
+ //# sourceMappingURL=role-permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-permissions.js","sourceRoot":"","sources":["../../src/auth/role-permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,gBAAgB,GAA6C;IACjE,KAAK,EAAE,IAAI,GAAG,CAAa;QACzB,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;QACzD,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB;QACrE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB;QAC/D,aAAa,EAAE,eAAe;QAC9B,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe;QAC9D,UAAU,EAAE,YAAY;QACxB,YAAY,EAAE,aAAa;KAC5B,CAAC;IACF,KAAK,EAAE,IAAI,GAAG,CAAa;QACzB,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;QACzD,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB;QACrE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB;QAC/D,aAAa,EAAE,eAAe;QAC9B,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe;QAC9D,UAAU;QACV,YAAY;KACb,CAAC;IACF,MAAM,EAAE,IAAI,GAAG,CAAa;QAC1B,WAAW,EAAE,aAAa;QAC1B,eAAe,EAAE,iBAAiB,EAAE,cAAc;QAClD,aAAa;QACb,aAAa,EAAE,eAAe;QAC9B,aAAa;QACb,UAAU;QACV,YAAY;KACb,CAAC;CACH,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,UAAsB;IACjE,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;AAC7C,CAAC"}
package/dist/cli/index.js CHANGED
@@ -64,20 +64,43 @@ import { executeWhoamiCommand, formatWhoamiForDisplay } from '../commands/whoami
64
64
  import { executeLogoutCommand, formatLogoutForDisplay } from '../commands/logout.js';
65
65
  import { executePlanCommand, executePlanListCommand, executePlanCreateCommand, executePlanInspectCommand, executePlanDeleteCommand, executePlanApproveCommand, formatPlansListForDisplay, formatPlanForDisplay, } from '../commands/plan.js';
66
66
  import { executeSimulateCommand, executeSimulateListCommand, executeSimulateCreateCommand, executeSimulateInspectCommand, executeSimulateDeleteCommand, executeSimulateRunCommand, formatSimulationsListForDisplay, formatSimulationForDisplay, } from '../commands/simulate.js';
67
- import { executeInspectCommand, executeInspectLatestCommand, executeInspectRunCommand, formatResultsForDisplay, } from '../commands/inspect.js';
67
+ import { executeInspectCommand, executeInspectLatestCommand, executeInspectRunCommand, executeInspectArtifactsCommand, formatResultsForDisplay, formatArtifactsForDisplay, } from '../commands/inspect.js';
68
68
  import { executeQuantifyCommand, executeQuantifyCreateCommand, executeQuantifyListCommand, executeQuantifyInspectCommand, executeQuantifyDeleteCommand, executeQuantifyCompareCommand, formatQuantifyForDisplay, formatQuantifyListForDisplay, formatCompareForDisplay, } from '../commands/quantify.js';
69
69
  import { executeDeployCommand, executeDeployPreviewCommand, executeDeployRunCommand, executeDeployStatusCommand, executeDeployRollbackCommand, executeDeployListCommand, formatDeployForDisplay, formatDeployListForDisplay, } from '../commands/deploy.js';
70
70
  import { executeExportCommand, executeExportTerraformCommand, executeExportKubernetesCommand, executeExportErpCommand, formatExportForDisplay, } from '../commands/export.js';
71
71
  import { executeDiligenceCommand } from '../commands/diligence.js';
72
72
  import { executeUsageCommand, executeUsageHistoryCommand, executeUsageLimitsCommand, executeUsageResetCommand, formatUsageForDisplay, formatHistoryForDisplay, formatLimitsForDisplay, } from '../commands/usage.js';
73
- import { executePolicyListCommand, executePolicyInspectCommand, executePolicyCreateCommand, executePolicyEditCommand, executePolicyDeleteCommand, executePolicyEnableCommand, executePolicyDisableCommand, formatPolicyForDisplay, formatPoliciesListForDisplay, } from '../commands/policy.js';
73
+ import { executePolicyListCommand, executePolicyInspectCommand, executePolicyCreateCommand, executePolicyEditCommand, executePolicyDeleteCommand, executePolicyEnableCommand, executePolicyDisableCommand, executePolicyDryRunCommand, executePolicyScopeCommand, formatPolicyForDisplay, formatPoliciesListForDisplay, formatDryRunForDisplay, formatScopeForDisplay, } from '../commands/policy.js';
74
74
  import { executeErpListCommand, executeErpInspectCommand, executeErpSurfaceCommand, executeErpMapCommand, executeErpExportCommand, formatErpListForDisplay, formatErpInspectForDisplay, formatErpSurfaceForDisplay, formatErpMapForDisplay, formatErpExportForDisplay, } from '../commands/erp.js';
75
+ // ============================================================================
76
+ // CONTROL PLANE HARDENING GATES
77
+ // ============================================================================
78
+ // Gates are enforced in this order:
79
+ // 1. Auth Session Gate - Requires authenticated session
80
+ // 2. Service Health Gate - Validates Ruvector-backed service availability
81
+ // 3. Output Format Gate - Enforces strict JSON output
82
+ // 4. Execution Gate - Entitlement/kill-switch (existing)
83
+ //
84
+ // CRITICAL: CLI MUST fail loudly if any gate fails. No fallback behavior.
85
+ // ============================================================================
75
86
  // Execution Gate - HARD KILL-SWITCH
76
87
  import { enforceExecutionGate } from '../gates/execution-gate.js';
88
+ // Auth Session Gate - Requires authenticated session
89
+ import { enforceAuthSessionGate, requiresAuthentication } from '../gates/auth-session-gate.js';
90
+ // Service Health Gate - Validates Ruvector-backed services
91
+ import { enforceServiceHealthGate, requiresHealthCheck } from '../gates/service-health-gate.js';
92
+ // Output Format Gate - Enforces strict JSON output
93
+ import { enforceOutputFormatGate, requiresStructuredOutput, getDefaultFormat } from '../gates/output-format-gate.js';
94
+ // Argument Guard Gate - Validates argument types per ADR-001
95
+ import { enforceArgumentGuard, requiresArgumentValidation } from '../gates/argument-guard.js';
96
+ // Lineage Gate - Enforces simulation traceability per ADR-004
97
+ import { enforceLineageGate, requiresLineageValidation } from '../gates/lineage-gate.js';
98
+ // Help Renderer - Schema-driven help from COMMAND_REGISTRY (ADR-002 Decision 1)
99
+ import { renderHelp } from '../modules/help-renderer.js';
77
100
  // ============================================================================
78
101
  // CLI Version
79
102
  // ============================================================================
80
- const VERSION = '1.4.4';
103
+ const VERSION = '1.4.5';
81
104
  // ============================================================================
82
105
  // Main CLI Function
83
106
  // ============================================================================
@@ -118,13 +141,77 @@ async function main() {
118
141
  process.exit(EXIT_CODES.SUCCESS);
119
142
  }
120
143
  // ============================================================================
121
- // HARD EXECUTION GATE - Enforced before ANY command dispatch
144
+ // CONTROL PLANE HARDENING - Multi-Gate Enforcement
145
+ // ============================================================================
146
+ // Gates are enforced in strict order. Each gate MUST pass before proceeding.
147
+ // Failure at any gate results in immediate process exit with clear error.
148
+ //
149
+ // Gate 1: Execution Gate (kill-switch)
150
+ // Gate 2: Authentication Gate (session required)
151
+ // Gate 3: Service Health Gate (Ruvector availability)
152
+ // Gate 4: Output Format Gate (strict JSON enforcement)
153
+ // Gate 5: Argument Guard Gate (ADR-001 argument type validation)
154
+ // Gate 6: Lineage Gate (ADR-004 simulation traceability)
155
+ // ============================================================================
156
+ // ============================================================================
157
+ // GATE 1: HARD EXECUTION GATE - Enforced before ANY command dispatch
122
158
  // ============================================================================
123
159
  // This is a global kill-switch that blocks all operational commands unless
124
160
  // execution is explicitly enabled. Only identity/help commands are allowed
125
161
  // when execution is disabled. This gate does NOT check entitlements, usage,
126
162
  // or billing - it is a binary on/off switch.
127
163
  enforceExecutionGate(parsed.command);
164
+ // ============================================================================
165
+ // GATE 2: AUTHENTICATION SESSION GATE - Requires valid credentials
166
+ // ============================================================================
167
+ // CLI requires authenticated session for ALL operational commands.
168
+ // Checks platform credentials first, then falls back to GCP credentials.
169
+ // CRITICAL: No anonymous operations are permitted.
170
+ if (requiresAuthentication(parsed.command)) {
171
+ await enforceAuthSessionGate();
172
+ }
173
+ // ============================================================================
174
+ // GATE 3: SERVICE HEALTH GATE - Validates Ruvector-backed services
175
+ // ============================================================================
176
+ // CLI MUST validate that Ruvector service is healthy before any operation.
177
+ // This ensures all operations are properly persisted and verifiable.
178
+ // CRITICAL: Abort immediately if service health check fails.
179
+ if (requiresHealthCheck(parsed.command)) {
180
+ await enforceServiceHealthGate();
181
+ }
182
+ // ============================================================================
183
+ // GATE 4: OUTPUT FORMAT GATE - Enforces strict JSON output
184
+ // ============================================================================
185
+ // CLI enforces strict JSON output for operational commands.
186
+ // Narrative output formats (text, table, csv) are blocked.
187
+ // CRITICAL: Only json and yaml formats are permitted.
188
+ if (requiresStructuredOutput(parsed.command)) {
189
+ const validatedFormat = enforceOutputFormatGate(options.format, parsed.command);
190
+ options.format = validatedFormat;
191
+ }
192
+ else {
193
+ // For non-operational commands, use default format
194
+ options.format = options.format ?? getDefaultFormat(parsed.command);
195
+ }
196
+ // ============================================================================
197
+ // GATE 5: ARGUMENT GUARD - Validates argument types per ADR-001
198
+ // ============================================================================
199
+ // Enforces ID vs natural language rules, blocks forbidden synthesis,
200
+ // and validates required arguments before any command dispatch.
201
+ // Derived from the ADR command registry (adr-command-semantics.ts).
202
+ if (requiresArgumentValidation(parsed.command)) {
203
+ enforceArgumentGuard(parsed);
204
+ }
205
+ // ============================================================================
206
+ // GATE 6: LINEAGE GATE - Enforces simulation traceability (ADR-004)
207
+ // ============================================================================
208
+ // Enterprise artifact-producing commands (erp surface, erp map, erp export)
209
+ // must reference a governed simulation. This ensures every integration
210
+ // proposal and ERP mapping traces back to a simulation run.
211
+ // CRITICAL: No enterprise artifact without simulation lineage.
212
+ if (requiresLineageValidation(parsed.command, parsed.subcommand)) {
213
+ enforceLineageGate(parsed);
214
+ }
128
215
  // Dispatch to command handlers
129
216
  try {
130
217
  let result = null;
@@ -267,13 +354,10 @@ async function main() {
267
354
  }, null, parsed.flags['pretty'] ? 2 : 0));
268
355
  }
269
356
  else {
270
- console.log(`Plan approved (advisory): ${planApproveResult.plan.id}`);
357
+ console.log(`Plan approved: ${planApproveResult.plan.id}`);
271
358
  console.log(` Previous status: ${planApproveResult.previous_status}`);
272
359
  console.log(` New status: ${planApproveResult.plan.status}`);
273
360
  console.log(` Approved by: ${planApproveResult.plan.approved_by ?? 'cli-user'}`);
274
- if (planApproveResult.advisory) {
275
- console.log(' Note: This was an advisory approval (no real execution performed)');
276
- }
277
361
  }
278
362
  if (options.verbose) {
279
363
  console.error(`Approved in ${planApproveResult.timing}ms`);
@@ -389,17 +473,17 @@ async function main() {
389
473
  }, null, parsed.flags['pretty'] ? 2 : 0));
390
474
  }
391
475
  else {
392
- console.log(`Simulation run completed (advisory): ${simRunResult.simulation.id}`);
393
- console.log(` Previous status: ${simRunResult.previous_status}`);
394
- console.log(` New status: ${simRunResult.simulation.status}`);
395
- if (simRunResult.advisory) {
396
- console.log(' Note: This was an advisory execution (no real execution performed)');
476
+ console.log(`Simulation: ${simRunResult.simulation.id}`);
477
+ console.log(` Name: ${simRunResult.simulation.name}`);
478
+ console.log(` Status: ${simRunResult.simulation.status}`);
479
+ if (simRunResult.simulation.result?.summary) {
480
+ console.log(` Result: ${simRunResult.simulation.result.summary}`);
397
481
  }
398
482
  }
399
483
  if (options.verbose) {
400
484
  console.error(`Run completed in ${simRunResult.timing}ms`);
401
485
  }
402
- process.exit(EXIT_CODES.SUCCESS);
486
+ process.exit(simRunResult.simulation.status === 'failed' ? EXIT_CODES.GENERAL_ERROR : EXIT_CODES.SUCCESS);
403
487
  }
404
488
  // Default simulate behavior (execute simulation via orchestration)
405
489
  const simInput = parsed.subcommand ?? parsed.positionalArgs[0] ?? '';
@@ -442,6 +526,26 @@ async function main() {
442
526
  }
443
527
  process.exit(EXIT_CODES.SUCCESS);
444
528
  }
529
+ if (parsed.subcommand === 'artifacts') {
530
+ const artifactRunId = parsed.positionalArgs[0] ?? '';
531
+ const artifactsResult = await executeInspectArtifactsCommand({ id: artifactRunId }, options);
532
+ if (options.format === 'json') {
533
+ console.log(JSON.stringify({
534
+ artifacts: artifactsResult.artifacts,
535
+ run_id: artifactsResult.run_id,
536
+ count: artifactsResult.count,
537
+ found: artifactsResult.found,
538
+ timing: artifactsResult.timing,
539
+ }, null, parsed.flags['pretty'] ? 2 : 0));
540
+ }
541
+ else {
542
+ console.log(formatArtifactsForDisplay(artifactsResult.artifacts, artifactsResult.run_id));
543
+ }
544
+ if (options.verbose) {
545
+ console.error(`Query completed in ${artifactsResult.timing}ms`);
546
+ }
547
+ process.exit(EXIT_CODES.SUCCESS);
548
+ }
445
549
  if (parsed.subcommand === 'run') {
446
550
  const runId = parsed.positionalArgs[0] ?? '';
447
551
  const runResult = await executeInspectRunCommand({ id: runId }, options);
@@ -664,11 +768,8 @@ async function main() {
664
768
  }, null, parsed.flags['pretty'] ? 2 : 0));
665
769
  }
666
770
  else {
667
- console.log(`Deployment run completed (advisory): ${deployRunResult.result.id}`);
771
+ console.log(`Deployment run completed: ${deployRunResult.result.id}`);
668
772
  console.log(formatDeployForDisplay(deployRunResult.result));
669
- if (deployRunResult.advisory) {
670
- console.log('Note: This was an advisory execution (no real changes made)');
671
- }
672
773
  }
673
774
  if (options.verbose) {
674
775
  console.error(`Run completed in ${deployRunResult.timing}ms`);
@@ -709,11 +810,8 @@ async function main() {
709
810
  }, null, parsed.flags['pretty'] ? 2 : 0));
710
811
  }
711
812
  else {
712
- console.log(`Deployment rolled back (advisory): ${deployRollbackResult.result.id}`);
813
+ console.log(`Deployment rolled back: ${deployRollbackResult.result.id}`);
713
814
  console.log(formatDeployForDisplay(deployRollbackResult.result));
714
- if (deployRollbackResult.advisory) {
715
- console.log('Note: This was an advisory rollback (no real changes made)');
716
- }
717
815
  }
718
816
  if (options.verbose) {
719
817
  console.error(`Rollback completed in ${deployRollbackResult.timing}ms`);
@@ -1193,9 +1291,47 @@ async function main() {
1193
1291
  }
1194
1292
  process.exit(EXIT_CODES.SUCCESS);
1195
1293
  }
1294
+ if (parsed.subcommand === 'dry-run') {
1295
+ const policyId = parsed.positionalArgs[0] ?? '';
1296
+ const contextStr = parsed.options['context'];
1297
+ const context = contextStr ? JSON.parse(contextStr) : undefined;
1298
+ const policyDryRunResult = await executePolicyDryRunCommand({ id: policyId, context }, options);
1299
+ if (options.format === 'json') {
1300
+ console.log(JSON.stringify({
1301
+ policy: policyDryRunResult.policy,
1302
+ evaluation: policyDryRunResult.evaluation,
1303
+ timing: policyDryRunResult.timing,
1304
+ }, null, parsed.flags['pretty'] ? 2 : 0));
1305
+ }
1306
+ else {
1307
+ console.log(formatDryRunForDisplay(policyDryRunResult));
1308
+ }
1309
+ if (options.verbose) {
1310
+ console.error(`Dry-run completed in ${policyDryRunResult.timing}ms`);
1311
+ }
1312
+ process.exit(EXIT_CODES.SUCCESS);
1313
+ }
1314
+ if (parsed.subcommand === 'scope') {
1315
+ const policyId = parsed.positionalArgs[0] ?? '';
1316
+ const policyScopeResult = await executePolicyScopeCommand({ id: policyId }, options);
1317
+ if (options.format === 'json') {
1318
+ console.log(JSON.stringify({
1319
+ policy: policyScopeResult.policy,
1320
+ scope: policyScopeResult.scope,
1321
+ timing: policyScopeResult.timing,
1322
+ }, null, parsed.flags['pretty'] ? 2 : 0));
1323
+ }
1324
+ else {
1325
+ console.log(formatScopeForDisplay(policyScopeResult));
1326
+ }
1327
+ if (options.verbose) {
1328
+ console.error(`Scope query completed in ${policyScopeResult.timing}ms`);
1329
+ }
1330
+ process.exit(EXIT_CODES.SUCCESS);
1331
+ }
1196
1332
  // Unknown subcommand
1197
1333
  console.error(`Unknown policy subcommand: ${parsed.subcommand}`);
1198
- console.error('Supported subcommands: list, inspect, create, edit, delete, enable, disable');
1334
+ console.error('Supported subcommands: list, inspect, create, edit, delete, enable, disable, dry-run, scope');
1199
1335
  process.exit(EXIT_CODES.USAGE_ERROR);
1200
1336
  }
1201
1337
  default:
@@ -1247,140 +1383,9 @@ async function main() {
1247
1383
  // Help Output
1248
1384
  // ============================================================================
1249
1385
  function printHelp() {
1250
- console.log(`
1251
- agentics - CLI for the Agentics Platform
1252
-
1253
- USAGE:
1254
- agentics <command> [options] [arguments]
1255
-
1256
- WORKFLOW:
1257
- The recommended end-to-end workflow follows these steps:
1258
-
1259
- plan → simulate → inspect → quantify → deploy → export
1260
-
1261
- 1. plan - Create a simulation plan from org manifest
1262
- 2. simulate - Execute simulation via agentics-simulation-runner
1263
- 3. inspect - Retrieve deterministic outputs from simulation-engine
1264
- 4. quantify - Generate CFO-grade ROI analysis (optional)
1265
- 5. deploy - Resolve deployment intent from simulation
1266
- 6. export - Generate deployment artifacts (terraform, k8s, etc.)
1267
-
1268
- COMMANDS:
1269
- login Authenticate with the Agentics platform
1270
- Opens browser for authorization, stores API key locally
1271
- logout Clear local authentication state
1272
- Removes credentials, requires re-login for protected commands
1273
- whoami Show current identity and authentication status
1274
- Reflects actual env/config state, no network calls
1275
- plan Create a simulation plan from manifest
1276
- Uses: agentics-simulation-planner
1277
- simulate Execute a simulation from a plan
1278
- Uses: agentics-simulation-runner → agentics-simulation-engine
1279
- inspect Query simulation results (read-only)
1280
- Uses: agentics-results-index
1281
- quantify Generate ROI/financial impact analysis
1282
- Uses: enterprise-roi-engine
1283
- deploy Resolve deployment intent from simulation
1284
- Uses: agentics-deployment-intent
1285
- export Generate deployment artifacts
1286
- Uses: agentics-deployment-exporters
1287
- diligence Package compliance artifacts
1288
- Uses: diligence-artifacts
1289
- usage Check usage balance and connectivity
1290
- Uses: agentics-usage-ledger
1291
- version Show version information
1292
- help Show this help message
1293
-
1294
- GLOBAL OPTIONS:
1295
- --timeout <ms> Request timeout in milliseconds
1296
- --trace-id <id> Correlation ID for tracing
1297
- --format <fmt> Output format: json, yaml, table, text, csv
1298
- --verbose, -v Enable verbose output
1299
- --pretty Pretty-print output
1300
- --help, -h Show help
1301
-
1302
- COMMAND OPTIONS:
1303
- login:
1304
- --no-browser Skip opening browser automatically
1305
-
1306
- plan:
1307
- --params <json> Parameters for plan creation
1308
-
1309
- simulate:
1310
- --config <json> Runtime configuration
1311
- --iterations <n> Number of iterations (default: 1)
1312
-
1313
- inspect:
1314
- --depth <type> Output depth: summary, detailed, full (default: summary)
1315
- --include-metrics Include metrics in output
1316
- --include-traces Include trace data in output
1317
-
1318
- quantify:
1319
- --report-type <type> Report type: executive-summary, detailed-analysis,
1320
- cfo-grade, custom (default: cfo-grade)
1321
- --params <json> Additional parameters for ROI calculation
1322
-
1323
- deploy:
1324
- --spec <json> Intent specification
1325
- --environment <env> Target environment
1326
-
1327
- export:
1328
- --export-format <fmt> Format: terraform, kubernetes, cloudformation,
1329
- pulumi, ansible, custom (default: terraform)
1330
- --output <path> Output path for artifacts
1331
-
1332
- diligence:
1333
- --frameworks <list> Comma-separated: SOC2, HIPAA, GDPR, PCI-DSS, custom
1334
- --requirements <json> Custom requirements
1335
-
1336
- EXAMPLES:
1337
- # Authenticate with the platform
1338
- agentics login
1339
- agentics login --no-browser
1340
-
1341
- # Complete workflow example (with JSON references)
1342
- agentics plan "production-deployment"
1343
- agentics simulate '{"id":"plan-123",...}' --iterations 10
1344
- agentics inspect '{"id":"sim-456",...}' --output-type metrics
1345
- agentics quantify '{"id":"sim-456",...}' --report-type cfo-grade
1346
- agentics deploy '{"id":"sim-456",...}' --environment staging
1347
- agentics export '{"id":"intent-789",...}' --export-format terraform
1348
- agentics diligence '[{"id":"ref-1"},...]' --frameworks SOC2,HIPAA
1349
-
1350
- # Natural language input (Claude-style invocation)
1351
- agentics simulate "run an enterprise ERP cost optimization simulation"
1352
- agentics inspect "show me the results from the last production test"
1353
- agentics quantify "calculate ROI for the Q4 infrastructure upgrade"
1354
- agentics deploy "deploy the microservices update to staging"
1355
- agentics export "generate terraform for the new kubernetes cluster"
1356
- agentics diligence "package compliance docs for the SOC2 audit"
1357
-
1358
- ENVIRONMENT VARIABLES:
1359
- AGENTICS_LOCAL_DEV Set to 'true' to enable local development mode
1360
- (required to use localhost endpoints)
1361
- AGENTICS_PLATFORM_URL Override platform URL for authentication
1362
- AGENTICS_MANIFESTS_URL Override manifests service URL
1363
- AGENTICS_PLANNER_URL Override planner service URL
1364
- AGENTICS_RUNNER_URL Override runner service URL
1365
- AGENTICS_SIMULATION_ENGINE_URL Override simulation engine URL
1366
- AGENTICS_RESULTS_INDEX_URL Override results index URL
1367
- ENTERPRISE_ROI_ENGINE_URL Override ROI engine URL
1368
- AGENTICS_INTENT_URL Override intent service URL
1369
- AGENTICS_EXPORTERS_URL Override exporters service URL
1370
- DILIGENCE_URL Override diligence service URL
1371
- AGENTICS_USAGE_LEDGER_URL Override usage ledger service URL
1372
-
1373
- LOCALHOST SAFEGUARD:
1374
- By default, the CLI targets production Cloud Run endpoints.
1375
- Localhost endpoints are blocked unless AGENTICS_LOCAL_DEV=true is set.
1376
- This prevents accidental local execution in production environments.
1377
-
1378
- PLATFORM UI:
1379
- For API key management and interactive workflows, visit:
1380
- https://platform.agentics.dev
1381
-
1382
- For more information, visit: https://docs.agentics.dev/cli
1383
- `);
1386
+ // ADR-002 Decision 1: Help output generated from COMMAND_REGISTRY.
1387
+ // See src/modules/help-renderer.ts all content derives from the schema.
1388
+ console.log(renderHelp());
1384
1389
  }
1385
1390
  // ============================================================================
1386
1391
  // Entry Point