@cleocode/cleo 2026.4.9 → 2026.4.11
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.
- package/dist/cli/commander-shim.d.ts +112 -0
- package/dist/cli/commander-shim.d.ts.map +1 -0
- package/dist/cli/commander-shim.js +233 -0
- package/dist/cli/commander-shim.js.map +1 -0
- package/dist/cli/commands/add.d.ts +12 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +98 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/admin.d.ts +12 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +59 -0
- package/dist/cli/commands/admin.js.map +1 -0
- package/dist/cli/commands/adr.d.ts +27 -0
- package/dist/cli/commands/adr.d.ts.map +1 -0
- package/dist/cli/commands/adr.js +79 -0
- package/dist/cli/commands/adr.js.map +1 -0
- package/dist/cli/commands/agent-profile-status.d.ts +98 -0
- package/dist/cli/commands/agent-profile-status.d.ts.map +1 -0
- package/dist/cli/commands/agent-profile-status.js +71 -0
- package/dist/cli/commands/agent-profile-status.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +38 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +1125 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +17 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/agents.js +20 -0
- package/dist/cli/commands/agents.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +12 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +20 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/archive-stats.d.ts +18 -0
- package/dist/cli/commands/archive-stats.d.ts.map +1 -0
- package/dist/cli/commands/archive-stats.js +49 -0
- package/dist/cli/commands/archive-stats.js.map +1 -0
- package/dist/cli/commands/archive.d.ts +12 -0
- package/dist/cli/commands/archive.d.ts.map +1 -0
- package/dist/cli/commands/archive.js +32 -0
- package/dist/cli/commands/archive.js.map +1 -0
- package/dist/cli/commands/backfill.d.ts +38 -0
- package/dist/cli/commands/backfill.d.ts.map +1 -0
- package/dist/cli/commands/backfill.js +147 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/backup.d.ts +8 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +35 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/blockers.d.ts +7 -0
- package/dist/cli/commands/blockers.d.ts.map +1 -0
- package/dist/cli/commands/blockers.js +16 -0
- package/dist/cli/commands/blockers.js.map +1 -0
- package/dist/cli/commands/brain.d.ts +29 -0
- package/dist/cli/commands/brain.d.ts.map +1 -0
- package/dist/cli/commands/brain.js +107 -0
- package/dist/cli/commands/brain.js.map +1 -0
- package/dist/cli/commands/briefing.d.ts +22 -0
- package/dist/cli/commands/briefing.d.ts.map +1 -0
- package/dist/cli/commands/briefing.js +45 -0
- package/dist/cli/commands/briefing.js.map +1 -0
- package/dist/cli/commands/bug.d.ts +12 -0
- package/dist/cli/commands/bug.d.ts.map +1 -0
- package/dist/cli/commands/bug.js +81 -0
- package/dist/cli/commands/bug.js.map +1 -0
- package/dist/cli/commands/cant.d.ts +32 -0
- package/dist/cli/commands/cant.d.ts.map +1 -0
- package/dist/cli/commands/cant.js +281 -0
- package/dist/cli/commands/cant.js.map +1 -0
- package/dist/cli/commands/check.d.ts +22 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +164 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/checkpoint.d.ts +15 -0
- package/dist/cli/commands/checkpoint.d.ts.map +1 -0
- package/dist/cli/commands/checkpoint.js +91 -0
- package/dist/cli/commands/checkpoint.js.map +1 -0
- package/dist/cli/commands/code.d.ts +11 -0
- package/dist/cli/commands/code.d.ts.map +1 -0
- package/dist/cli/commands/code.js +114 -0
- package/dist/cli/commands/code.js.map +1 -0
- package/dist/cli/commands/commands.d.ts +13 -0
- package/dist/cli/commands/commands.d.ts.map +1 -0
- package/dist/cli/commands/commands.js +29 -0
- package/dist/cli/commands/commands.js.map +1 -0
- package/dist/cli/commands/complete.d.ts +12 -0
- package/dist/cli/commands/complete.d.ts.map +1 -0
- package/dist/cli/commands/complete.js +43 -0
- package/dist/cli/commands/complete.js.map +1 -0
- package/dist/cli/commands/compliance.d.ts +8 -0
- package/dist/cli/commands/compliance.d.ts.map +1 -0
- package/dist/cli/commands/compliance.js +85 -0
- package/dist/cli/commands/compliance.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +69 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/consensus.d.ts +13 -0
- package/dist/cli/commands/consensus.d.ts.map +1 -0
- package/dist/cli/commands/consensus.js +45 -0
- package/dist/cli/commands/consensus.js.map +1 -0
- package/dist/cli/commands/context.d.ts +8 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +40 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/contribution.d.ts +13 -0
- package/dist/cli/commands/contribution.d.ts.map +1 -0
- package/dist/cli/commands/contribution.js +41 -0
- package/dist/cli/commands/contribution.js.map +1 -0
- package/dist/cli/commands/current.d.ts +13 -0
- package/dist/cli/commands/current.d.ts.map +1 -0
- package/dist/cli/commands/current.js +20 -0
- package/dist/cli/commands/current.js.map +1 -0
- package/dist/cli/commands/dash.d.ts +12 -0
- package/dist/cli/commands/dash.d.ts.map +1 -0
- package/dist/cli/commands/dash.js +24 -0
- package/dist/cli/commands/dash.js.map +1 -0
- package/dist/cli/commands/decomposition.d.ts +13 -0
- package/dist/cli/commands/decomposition.d.ts.map +1 -0
- package/dist/cli/commands/decomposition.js +45 -0
- package/dist/cli/commands/decomposition.js.map +1 -0
- package/dist/cli/commands/delete.d.ts +12 -0
- package/dist/cli/commands/delete.d.ts.map +1 -0
- package/dist/cli/commands/delete.js +37 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +24 -0
- package/dist/cli/commands/deps.d.ts.map +1 -0
- package/dist/cli/commands/deps.js +98 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/detect-drift.d.ts +15 -0
- package/dist/cli/commands/detect-drift.d.ts.map +1 -0
- package/dist/cli/commands/detect-drift.js +424 -0
- package/dist/cli/commands/detect-drift.js.map +1 -0
- package/dist/cli/commands/detect.d.ts +10 -0
- package/dist/cli/commands/detect.d.ts.map +1 -0
- package/dist/cli/commands/detect.js +24 -0
- package/dist/cli/commands/detect.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +13 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +169 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +15 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +133 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/dynamic.d.ts +24 -0
- package/dist/cli/commands/dynamic.d.ts.map +1 -0
- package/dist/cli/commands/dynamic.js +27 -0
- package/dist/cli/commands/dynamic.js.map +1 -0
- package/dist/cli/commands/env.d.ts +12 -0
- package/dist/cli/commands/env.d.ts.map +1 -0
- package/dist/cli/commands/env.js +44 -0
- package/dist/cli/commands/env.js.map +1 -0
- package/dist/cli/commands/exists.d.ts +22 -0
- package/dist/cli/commands/exists.d.ts.map +1 -0
- package/dist/cli/commands/exists.js +51 -0
- package/dist/cli/commands/exists.js.map +1 -0
- package/dist/cli/commands/export-tasks.d.ts +10 -0
- package/dist/cli/commands/export-tasks.d.ts.map +1 -0
- package/dist/cli/commands/export-tasks.js +47 -0
- package/dist/cli/commands/export-tasks.js.map +1 -0
- package/dist/cli/commands/export.d.ts +9 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +46 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/find.d.ts +14 -0
- package/dist/cli/commands/find.d.ts.map +1 -0
- package/dist/cli/commands/find.js +70 -0
- package/dist/cli/commands/find.js.map +1 -0
- package/dist/cli/commands/generate-changelog.d.ts +14 -0
- package/dist/cli/commands/generate-changelog.d.ts.map +1 -0
- package/dist/cli/commands/generate-changelog.js +252 -0
- package/dist/cli/commands/generate-changelog.js.map +1 -0
- package/dist/cli/commands/grade.d.ts +13 -0
- package/dist/cli/commands/grade.d.ts.map +1 -0
- package/dist/cli/commands/grade.js +26 -0
- package/dist/cli/commands/grade.js.map +1 -0
- package/dist/cli/commands/history.d.ts +9 -0
- package/dist/cli/commands/history.d.ts.map +1 -0
- package/dist/cli/commands/history.js +30 -0
- package/dist/cli/commands/history.js.map +1 -0
- package/dist/cli/commands/implementation.d.ts +13 -0
- package/dist/cli/commands/implementation.d.ts.map +1 -0
- package/dist/cli/commands/implementation.js +41 -0
- package/dist/cli/commands/implementation.js.map +1 -0
- package/dist/cli/commands/import-tasks.d.ts +10 -0
- package/dist/cli/commands/import-tasks.d.ts.map +1 -0
- package/dist/cli/commands/import-tasks.js +38 -0
- package/dist/cli/commands/import-tasks.js.map +1 -0
- package/dist/cli/commands/import.d.ts +9 -0
- package/dist/cli/commands/import.d.ts.map +1 -0
- package/dist/cli/commands/import.js +28 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/init.d.ts +34 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +96 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/inject.d.ts +8 -0
- package/dist/cli/commands/inject.d.ts.map +1 -0
- package/dist/cli/commands/inject.js +28 -0
- package/dist/cli/commands/inject.js.map +1 -0
- package/dist/cli/commands/issue.d.ts +17 -0
- package/dist/cli/commands/issue.d.ts.map +1 -0
- package/dist/cli/commands/issue.js +107 -0
- package/dist/cli/commands/issue.js.map +1 -0
- package/dist/cli/commands/labels.d.ts +13 -0
- package/dist/cli/commands/labels.d.ts.map +1 -0
- package/dist/cli/commands/labels.js +44 -0
- package/dist/cli/commands/labels.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts +8 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/lifecycle.js +84 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/list.d.ts +14 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +71 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/log.d.ts +12 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +30 -0
- package/dist/cli/commands/log.js.map +1 -0
- package/dist/cli/commands/map.d.ts +10 -0
- package/dist/cli/commands/map.d.ts.map +1 -0
- package/dist/cli/commands/map.js +23 -0
- package/dist/cli/commands/map.js.map +1 -0
- package/dist/cli/commands/memory-brain.d.ts +14 -0
- package/dist/cli/commands/memory-brain.d.ts.map +1 -0
- package/dist/cli/commands/memory-brain.js +157 -0
- package/dist/cli/commands/memory-brain.js.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts +18 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.js +60 -0
- package/dist/cli/commands/migrate-claude-mem.js.map +1 -0
- package/dist/cli/commands/next.d.ts +9 -0
- package/dist/cli/commands/next.d.ts.map +1 -0
- package/dist/cli/commands/next.js +20 -0
- package/dist/cli/commands/next.js.map +1 -0
- package/dist/cli/commands/nexus.d.ts +16 -0
- package/dist/cli/commands/nexus.d.ts.map +1 -0
- package/dist/cli/commands/nexus.js +155 -0
- package/dist/cli/commands/nexus.js.map +1 -0
- package/dist/cli/commands/observe.d.ts +9 -0
- package/dist/cli/commands/observe.d.ts.map +1 -0
- package/dist/cli/commands/observe.js +39 -0
- package/dist/cli/commands/observe.js.map +1 -0
- package/dist/cli/commands/ops.d.ts +10 -0
- package/dist/cli/commands/ops.d.ts.map +1 -0
- package/dist/cli/commands/ops.js +19 -0
- package/dist/cli/commands/ops.js.map +1 -0
- package/dist/cli/commands/orchestrate.d.ts +8 -0
- package/dist/cli/commands/orchestrate.d.ts.map +1 -0
- package/dist/cli/commands/orchestrate.js +58 -0
- package/dist/cli/commands/orchestrate.js.map +1 -0
- package/dist/cli/commands/otel.d.ts +12 -0
- package/dist/cli/commands/otel.d.ts.map +1 -0
- package/dist/cli/commands/otel.js +128 -0
- package/dist/cli/commands/otel.js.map +1 -0
- package/dist/cli/commands/phase.d.ts +12 -0
- package/dist/cli/commands/phase.d.ts.map +1 -0
- package/dist/cli/commands/phase.js +91 -0
- package/dist/cli/commands/phase.js.map +1 -0
- package/dist/cli/commands/phases.d.ts +12 -0
- package/dist/cli/commands/phases.d.ts.map +1 -0
- package/dist/cli/commands/phases.js +37 -0
- package/dist/cli/commands/phases.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +8 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +15 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/promote.d.ts +7 -0
- package/dist/cli/commands/promote.d.ts.map +1 -0
- package/dist/cli/commands/promote.js +15 -0
- package/dist/cli/commands/promote.js.map +1 -0
- package/dist/cli/commands/reason.d.ts +35 -0
- package/dist/cli/commands/reason.d.ts.map +1 -0
- package/dist/cli/commands/reason.js +104 -0
- package/dist/cli/commands/reason.js.map +1 -0
- package/dist/cli/commands/refresh-memory.d.ts +9 -0
- package/dist/cli/commands/refresh-memory.d.ts.map +1 -0
- package/dist/cli/commands/refresh-memory.js +24 -0
- package/dist/cli/commands/refresh-memory.js.map +1 -0
- package/dist/cli/commands/relates.d.ts +12 -0
- package/dist/cli/commands/relates.d.ts.map +1 -0
- package/dist/cli/commands/relates.js +53 -0
- package/dist/cli/commands/relates.js.map +1 -0
- package/dist/cli/commands/release.d.ts +8 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +72 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/remote.d.ts +12 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +207 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/commands/reorder.d.ts +7 -0
- package/dist/cli/commands/reorder.d.ts.map +1 -0
- package/dist/cli/commands/reorder.js +20 -0
- package/dist/cli/commands/reorder.js.map +1 -0
- package/dist/cli/commands/reparent.d.ts +10 -0
- package/dist/cli/commands/reparent.d.ts.map +1 -0
- package/dist/cli/commands/reparent.js +19 -0
- package/dist/cli/commands/reparent.js.map +1 -0
- package/dist/cli/commands/research.d.ts +8 -0
- package/dist/cli/commands/research.d.ts.map +1 -0
- package/dist/cli/commands/research.js +129 -0
- package/dist/cli/commands/research.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +11 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +224 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/roadmap.d.ts +8 -0
- package/dist/cli/commands/roadmap.d.ts.map +1 -0
- package/dist/cli/commands/roadmap.js +21 -0
- package/dist/cli/commands/roadmap.js.map +1 -0
- package/dist/cli/commands/safestop.d.ts +14 -0
- package/dist/cli/commands/safestop.d.ts.map +1 -0
- package/dist/cli/commands/safestop.js +32 -0
- package/dist/cli/commands/safestop.js.map +1 -0
- package/dist/cli/commands/self-update.d.ts +15 -0
- package/dist/cli/commands/self-update.d.ts.map +1 -0
- package/dist/cli/commands/self-update.js +329 -0
- package/dist/cli/commands/self-update.js.map +1 -0
- package/dist/cli/commands/sequence.d.ts +8 -0
- package/dist/cli/commands/sequence.d.ts.map +1 -0
- package/dist/cli/commands/sequence.js +30 -0
- package/dist/cli/commands/sequence.js.map +1 -0
- package/dist/cli/commands/session.d.ts +12 -0
- package/dist/cli/commands/session.d.ts.map +1 -0
- package/dist/cli/commands/session.js +175 -0
- package/dist/cli/commands/session.js.map +1 -0
- package/dist/cli/commands/show.d.ts +13 -0
- package/dist/cli/commands/show.d.ts.map +1 -0
- package/dist/cli/commands/show.js +20 -0
- package/dist/cli/commands/show.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +13 -0
- package/dist/cli/commands/skills.d.ts.map +1 -0
- package/dist/cli/commands/skills.js +131 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +9 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +50 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/commands/specification.d.ts +13 -0
- package/dist/cli/commands/specification.d.ts.map +1 -0
- package/dist/cli/commands/specification.js +45 -0
- package/dist/cli/commands/specification.js.map +1 -0
- package/dist/cli/commands/start.d.ts +13 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +20 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +12 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +35 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/sticky.d.ts +16 -0
- package/dist/cli/commands/sticky.d.ts.map +1 -0
- package/dist/cli/commands/sticky.js +211 -0
- package/dist/cli/commands/sticky.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +13 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +20 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/testing.d.ts +13 -0
- package/dist/cli/commands/testing.d.ts.map +1 -0
- package/dist/cli/commands/testing.js +64 -0
- package/dist/cli/commands/testing.js.map +1 -0
- package/dist/cli/commands/token.d.ts +10 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/token.js +135 -0
- package/dist/cli/commands/token.js.map +1 -0
- package/dist/cli/commands/update.d.ts +12 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +83 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/upgrade.d.ts +18 -0
- package/dist/cli/commands/upgrade.d.ts.map +1 -0
- package/dist/cli/commands/upgrade.js +103 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +23 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +8 -0
- package/dist/cli/commands/verify.d.ts.map +1 -0
- package/dist/cli/commands/verify.js +28 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/commands/web.d.ts +13 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +277 -0
- package/dist/cli/commands/web.js.map +1 -0
- package/dist/cli/field-context.d.ts +32 -0
- package/dist/cli/field-context.d.ts.map +1 -0
- package/dist/cli/field-context.js +47 -0
- package/dist/cli/field-context.js.map +1 -0
- package/dist/cli/format-context.d.ts +32 -0
- package/dist/cli/format-context.d.ts.map +1 -0
- package/dist/cli/format-context.js +50 -0
- package/dist/cli/format-context.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3931 -3401
- package/dist/cli/index.js.map +4 -4
- package/dist/cli/logger-bootstrap.d.ts +6 -0
- package/dist/cli/logger-bootstrap.d.ts.map +1 -0
- package/dist/cli/logger-bootstrap.js +10 -0
- package/dist/cli/logger-bootstrap.js.map +1 -0
- package/dist/cli/middleware/output-format.d.ts +30 -0
- package/dist/cli/middleware/output-format.d.ts.map +1 -0
- package/dist/cli/middleware/output-format.js +35 -0
- package/dist/cli/middleware/output-format.js.map +1 -0
- package/dist/cli/progress.d.ts +84 -0
- package/dist/cli/progress.d.ts.map +1 -0
- package/dist/cli/progress.js +169 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/cli/renderers/colors.d.ts +32 -0
- package/dist/cli/renderers/colors.d.ts.map +1 -0
- package/dist/cli/renderers/colors.js +141 -0
- package/dist/cli/renderers/colors.js.map +1 -0
- package/dist/cli/renderers/error.d.ts +13 -0
- package/dist/cli/renderers/error.d.ts.map +1 -0
- package/dist/cli/renderers/error.js +42 -0
- package/dist/cli/renderers/error.js.map +1 -0
- package/dist/cli/renderers/index.d.ts +59 -0
- package/dist/cli/renderers/index.d.ts.map +1 -0
- package/dist/cli/renderers/index.js +208 -0
- package/dist/cli/renderers/index.js.map +1 -0
- package/dist/cli/renderers/lafs-validator.d.ts +97 -0
- package/dist/cli/renderers/lafs-validator.d.ts.map +1 -0
- package/dist/cli/renderers/lafs-validator.js +229 -0
- package/dist/cli/renderers/lafs-validator.js.map +1 -0
- package/dist/cli/renderers/normalizer.d.ts +21 -0
- package/dist/cli/renderers/normalizer.d.ts.map +1 -0
- package/dist/cli/renderers/normalizer.js +106 -0
- package/dist/cli/renderers/normalizer.js.map +1 -0
- package/dist/cli/renderers/system.d.ts +25 -0
- package/dist/cli/renderers/system.d.ts.map +1 -0
- package/dist/cli/renderers/system.js +416 -0
- package/dist/cli/renderers/system.js.map +1 -0
- package/dist/cli/renderers/tasks.d.ts +28 -0
- package/dist/cli/renderers/tasks.d.ts.map +1 -0
- package/dist/cli/renderers/tasks.js +306 -0
- package/dist/cli/renderers/tasks.js.map +1 -0
- package/dist/dispatch/adapters/cli.d.ts +67 -0
- package/dist/dispatch/adapters/cli.d.ts.map +1 -0
- package/dist/dispatch/adapters/cli.js +262 -0
- package/dist/dispatch/adapters/cli.js.map +1 -0
- package/dist/dispatch/context/session-context.d.ts +54 -0
- package/dist/dispatch/context/session-context.d.ts.map +1 -0
- package/dist/dispatch/context/session-context.js +61 -0
- package/dist/dispatch/context/session-context.js.map +1 -0
- package/dist/dispatch/dispatcher.d.ts +23 -0
- package/dist/dispatch/dispatcher.d.ts.map +1 -0
- package/dist/dispatch/dispatcher.js +84 -0
- package/dist/dispatch/dispatcher.js.map +1 -0
- package/dist/dispatch/domains/_base.d.ts +59 -0
- package/dist/dispatch/domains/_base.d.ts.map +1 -0
- package/dist/dispatch/domains/_base.js +77 -0
- package/dist/dispatch/domains/_base.js.map +1 -0
- package/dist/dispatch/domains/_meta.d.ts +23 -0
- package/dist/dispatch/domains/_meta.d.ts.map +1 -0
- package/dist/dispatch/domains/_meta.js +25 -0
- package/dist/dispatch/domains/_meta.js.map +1 -0
- package/dist/dispatch/domains/_routing.d.ts +8 -0
- package/dist/dispatch/domains/_routing.d.ts.map +1 -0
- package/dist/dispatch/domains/_routing.js +20 -0
- package/dist/dispatch/domains/_routing.js.map +1 -0
- package/dist/dispatch/domains/admin.d.ts +25 -0
- package/dist/dispatch/domains/admin.d.ts.map +1 -0
- package/dist/dispatch/domains/admin.js +719 -0
- package/dist/dispatch/domains/admin.js.map +1 -0
- package/dist/dispatch/domains/check.d.ts +22 -0
- package/dist/dispatch/domains/check.d.ts.map +1 -0
- package/dist/dispatch/domains/check.js +360 -0
- package/dist/dispatch/domains/check.js.map +1 -0
- package/dist/dispatch/domains/conduit.d.ts +38 -0
- package/dist/dispatch/domains/conduit.d.ts.map +1 -0
- package/dist/dispatch/domains/conduit.js +247 -0
- package/dist/dispatch/domains/conduit.js.map +1 -0
- package/dist/dispatch/domains/index.d.ts +27 -0
- package/dist/dispatch/domains/index.d.ts.map +1 -0
- package/dist/dispatch/domains/index.js +40 -0
- package/dist/dispatch/domains/index.js.map +1 -0
- package/dist/dispatch/domains/memory.d.ts +22 -0
- package/dist/dispatch/domains/memory.d.ts.map +1 -0
- package/dist/dispatch/domains/memory.js +303 -0
- package/dist/dispatch/domains/memory.js.map +1 -0
- package/dist/dispatch/domains/nexus.d.ts +22 -0
- package/dist/dispatch/domains/nexus.d.ts.map +1 -0
- package/dist/dispatch/domains/nexus.js +286 -0
- package/dist/dispatch/domains/nexus.js.map +1 -0
- package/dist/dispatch/domains/orchestrate.d.ts +19 -0
- package/dist/dispatch/domains/orchestrate.d.ts.map +1 -0
- package/dist/dispatch/domains/orchestrate.js +259 -0
- package/dist/dispatch/domains/orchestrate.js.map +1 -0
- package/dist/dispatch/domains/pipeline.d.ts +35 -0
- package/dist/dispatch/domains/pipeline.d.ts.map +1 -0
- package/dist/dispatch/domains/pipeline.js +593 -0
- package/dist/dispatch/domains/pipeline.js.map +1 -0
- package/dist/dispatch/domains/session.d.ts +22 -0
- package/dist/dispatch/domains/session.d.ts.map +1 -0
- package/dist/dispatch/domains/session.js +257 -0
- package/dist/dispatch/domains/session.js.map +1 -0
- package/dist/dispatch/domains/sticky.d.ts +20 -0
- package/dist/dispatch/domains/sticky.d.ts.map +1 -0
- package/dist/dispatch/domains/sticky.js +164 -0
- package/dist/dispatch/domains/sticky.js.map +1 -0
- package/dist/dispatch/domains/tasks.d.ts +25 -0
- package/dist/dispatch/domains/tasks.d.ts.map +1 -0
- package/dist/dispatch/domains/tasks.js +361 -0
- package/dist/dispatch/domains/tasks.js.map +1 -0
- package/dist/dispatch/domains/tools.d.ts +37 -0
- package/dist/dispatch/domains/tools.d.ts.map +1 -0
- package/dist/dispatch/domains/tools.js +481 -0
- package/dist/dispatch/domains/tools.js.map +1 -0
- package/dist/dispatch/engines/_error.d.ts +85 -0
- package/dist/dispatch/engines/_error.d.ts.map +1 -0
- package/dist/dispatch/engines/_error.js +244 -0
- package/dist/dispatch/engines/_error.js.map +1 -0
- package/dist/dispatch/engines/code-engine.d.ts +18 -0
- package/dist/dispatch/engines/code-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/code-engine.js +71 -0
- package/dist/dispatch/engines/code-engine.js.map +1 -0
- package/dist/dispatch/engines/codebase-map-engine.d.ts +31 -0
- package/dist/dispatch/engines/codebase-map-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/codebase-map-engine.js +43 -0
- package/dist/dispatch/engines/codebase-map-engine.js.map +1 -0
- package/dist/dispatch/engines/config-engine.d.ts +32 -0
- package/dist/dispatch/engines/config-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/config-engine.js +70 -0
- package/dist/dispatch/engines/config-engine.js.map +1 -0
- package/dist/dispatch/engines/hooks-engine.d.ts +96 -0
- package/dist/dispatch/engines/hooks-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/hooks-engine.js +144 -0
- package/dist/dispatch/engines/hooks-engine.js.map +1 -0
- package/dist/dispatch/engines/init-engine.d.ts +56 -0
- package/dist/dispatch/engines/init-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/init-engine.js +78 -0
- package/dist/dispatch/engines/init-engine.js.map +1 -0
- package/dist/dispatch/engines/lifecycle-engine.d.ts +66 -0
- package/dist/dispatch/engines/lifecycle-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/lifecycle-engine.js +224 -0
- package/dist/dispatch/engines/lifecycle-engine.js.map +1 -0
- package/dist/dispatch/engines/memory-engine.d.ts +10 -0
- package/dist/dispatch/engines/memory-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/memory-engine.js +10 -0
- package/dist/dispatch/engines/memory-engine.js.map +1 -0
- package/dist/dispatch/engines/nexus-engine.d.ts +167 -0
- package/dist/dispatch/engines/nexus-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/nexus-engine.js +356 -0
- package/dist/dispatch/engines/nexus-engine.js.map +1 -0
- package/dist/dispatch/engines/orchestrate-engine.d.ts +133 -0
- package/dist/dispatch/engines/orchestrate-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/orchestrate-engine.js +769 -0
- package/dist/dispatch/engines/orchestrate-engine.js.map +1 -0
- package/dist/dispatch/engines/pipeline-engine.d.ts +51 -0
- package/dist/dispatch/engines/pipeline-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/pipeline-engine.js +191 -0
- package/dist/dispatch/engines/pipeline-engine.js.map +1 -0
- package/dist/dispatch/engines/release-engine.d.ts +94 -0
- package/dist/dispatch/engines/release-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/release-engine.js +763 -0
- package/dist/dispatch/engines/release-engine.js.map +1 -0
- package/dist/dispatch/engines/session-engine.d.ts +383 -0
- package/dist/dispatch/engines/session-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/session-engine.js +960 -0
- package/dist/dispatch/engines/session-engine.js.map +1 -0
- package/dist/dispatch/engines/sticky-engine.d.ts +100 -0
- package/dist/dispatch/engines/sticky-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/sticky-engine.js +181 -0
- package/dist/dispatch/engines/sticky-engine.js.map +1 -0
- package/dist/dispatch/engines/system-engine.d.ts +539 -0
- package/dist/dispatch/engines/system-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/system-engine.js +1266 -0
- package/dist/dispatch/engines/system-engine.js.map +1 -0
- package/dist/dispatch/engines/task-engine.d.ts +1055 -0
- package/dist/dispatch/engines/task-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/task-engine.js +1387 -0
- package/dist/dispatch/engines/task-engine.js.map +1 -0
- package/dist/dispatch/engines/template-parser.d.ts +85 -0
- package/dist/dispatch/engines/template-parser.d.ts.map +1 -0
- package/dist/dispatch/engines/template-parser.js +108 -0
- package/dist/dispatch/engines/template-parser.js.map +1 -0
- package/dist/dispatch/engines/tools-engine.d.ts +270 -0
- package/dist/dispatch/engines/tools-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/tools-engine.js +636 -0
- package/dist/dispatch/engines/tools-engine.js.map +1 -0
- package/dist/dispatch/engines/validate-engine.d.ts +218 -0
- package/dist/dispatch/engines/validate-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/validate-engine.js +737 -0
- package/dist/dispatch/engines/validate-engine.js.map +1 -0
- package/dist/dispatch/index.d.ts +20 -0
- package/dist/dispatch/index.d.ts.map +1 -0
- package/dist/dispatch/index.js +19 -0
- package/dist/dispatch/index.js.map +1 -0
- package/dist/dispatch/lib/background-jobs.d.ts +86 -0
- package/dist/dispatch/lib/background-jobs.d.ts.map +1 -0
- package/dist/dispatch/lib/background-jobs.js +183 -0
- package/dist/dispatch/lib/background-jobs.js.map +1 -0
- package/dist/dispatch/lib/budget.d.ts +35 -0
- package/dist/dispatch/lib/budget.d.ts.map +1 -0
- package/dist/dispatch/lib/budget.js +102 -0
- package/dist/dispatch/lib/budget.js.map +1 -0
- package/dist/dispatch/lib/capability-matrix.d.ts +11 -0
- package/dist/dispatch/lib/capability-matrix.d.ts.map +1 -0
- package/dist/dispatch/lib/capability-matrix.js +10 -0
- package/dist/dispatch/lib/capability-matrix.js.map +1 -0
- package/dist/dispatch/lib/config-loader.d.ts +42 -0
- package/dist/dispatch/lib/config-loader.d.ts.map +1 -0
- package/dist/dispatch/lib/config-loader.js +217 -0
- package/dist/dispatch/lib/config-loader.js.map +1 -0
- package/dist/dispatch/lib/config.d.ts +11 -0
- package/dist/dispatch/lib/config.d.ts.map +1 -0
- package/dist/dispatch/lib/config.js +10 -0
- package/dist/dispatch/lib/config.js.map +1 -0
- package/dist/dispatch/lib/defaults.d.ts +117 -0
- package/dist/dispatch/lib/defaults.d.ts.map +1 -0
- package/dist/dispatch/lib/defaults.js +58 -0
- package/dist/dispatch/lib/defaults.js.map +1 -0
- package/dist/dispatch/lib/engine.d.ts +26 -0
- package/dist/dispatch/lib/engine.d.ts.map +1 -0
- package/dist/dispatch/lib/engine.js +46 -0
- package/dist/dispatch/lib/engine.js.map +1 -0
- package/dist/dispatch/lib/gateway-meta.d.ts +37 -0
- package/dist/dispatch/lib/gateway-meta.d.ts.map +1 -0
- package/dist/dispatch/lib/gateway-meta.js +50 -0
- package/dist/dispatch/lib/gateway-meta.js.map +1 -0
- package/dist/dispatch/lib/job-manager-accessor.d.ts +9 -0
- package/dist/dispatch/lib/job-manager-accessor.d.ts.map +1 -0
- package/dist/dispatch/lib/job-manager-accessor.js +13 -0
- package/dist/dispatch/lib/job-manager-accessor.js.map +1 -0
- package/dist/dispatch/lib/meta.d.ts +26 -0
- package/dist/dispatch/lib/meta.d.ts.map +1 -0
- package/dist/dispatch/lib/meta.js +37 -0
- package/dist/dispatch/lib/meta.js.map +1 -0
- package/dist/dispatch/lib/param-utils.d.ts +11 -0
- package/dist/dispatch/lib/param-utils.d.ts.map +1 -0
- package/dist/dispatch/lib/param-utils.js +10 -0
- package/dist/dispatch/lib/param-utils.js.map +1 -0
- package/dist/dispatch/lib/projections.d.ts +56 -0
- package/dist/dispatch/lib/projections.d.ts.map +1 -0
- package/dist/dispatch/lib/projections.js +65 -0
- package/dist/dispatch/lib/projections.js.map +1 -0
- package/dist/dispatch/lib/schema-utils.d.ts +39 -0
- package/dist/dispatch/lib/schema-utils.d.ts.map +1 -0
- package/dist/dispatch/lib/schema-utils.js +88 -0
- package/dist/dispatch/lib/schema-utils.js.map +1 -0
- package/dist/dispatch/lib/security.d.ts +11 -0
- package/dist/dispatch/lib/security.d.ts.map +1 -0
- package/dist/dispatch/lib/security.js +10 -0
- package/dist/dispatch/lib/security.js.map +1 -0
- package/dist/dispatch/middleware/audit.d.ts +23 -0
- package/dist/dispatch/middleware/audit.d.ts.map +1 -0
- package/dist/dispatch/middleware/audit.js +169 -0
- package/dist/dispatch/middleware/audit.js.map +1 -0
- package/dist/dispatch/middleware/field-filter.d.ts +24 -0
- package/dist/dispatch/middleware/field-filter.d.ts.map +1 -0
- package/dist/dispatch/middleware/field-filter.js +65 -0
- package/dist/dispatch/middleware/field-filter.js.map +1 -0
- package/dist/dispatch/middleware/pipeline.d.ts +33 -0
- package/dist/dispatch/middleware/pipeline.d.ts.map +1 -0
- package/dist/dispatch/middleware/pipeline.js +60 -0
- package/dist/dispatch/middleware/pipeline.js.map +1 -0
- package/dist/dispatch/middleware/projection.d.ts +35 -0
- package/dist/dispatch/middleware/projection.d.ts.map +1 -0
- package/dist/dispatch/middleware/projection.js +146 -0
- package/dist/dispatch/middleware/projection.js.map +1 -0
- package/dist/dispatch/middleware/protocol-enforcement.d.ts +27 -0
- package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +1 -0
- package/dist/dispatch/middleware/protocol-enforcement.js +45 -0
- package/dist/dispatch/middleware/protocol-enforcement.js.map +1 -0
- package/dist/dispatch/middleware/rate-limiter.d.ts +72 -0
- package/dist/dispatch/middleware/rate-limiter.d.ts.map +1 -0
- package/dist/dispatch/middleware/rate-limiter.js +127 -0
- package/dist/dispatch/middleware/rate-limiter.js.map +1 -0
- package/dist/dispatch/middleware/sanitizer.d.ts +24 -0
- package/dist/dispatch/middleware/sanitizer.d.ts.map +1 -0
- package/dist/dispatch/middleware/sanitizer.js +56 -0
- package/dist/dispatch/middleware/sanitizer.js.map +1 -0
- package/dist/dispatch/middleware/session-resolver.d.ts +26 -0
- package/dist/dispatch/middleware/session-resolver.d.ts.map +1 -0
- package/dist/dispatch/middleware/session-resolver.js +65 -0
- package/dist/dispatch/middleware/session-resolver.js.map +1 -0
- package/dist/dispatch/middleware/verification-gates.d.ts +22 -0
- package/dist/dispatch/middleware/verification-gates.d.ts.map +1 -0
- package/dist/dispatch/middleware/verification-gates.js +59 -0
- package/dist/dispatch/middleware/verification-gates.js.map +1 -0
- package/dist/dispatch/registry.d.ts +91 -0
- package/dist/dispatch/registry.d.ts.map +1 -0
- package/dist/dispatch/registry.js +3133 -0
- package/dist/dispatch/registry.js.map +1 -0
- package/dist/dispatch/types.d.ts +202 -0
- package/dist/dispatch/types.d.ts.map +1 -0
- package/dist/dispatch/types.js +26 -0
- package/dist/dispatch/types.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central output dispatch for V2 CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides cliOutput() which replaces `console.log(formatSuccess(data))`.
|
|
5
|
+
* Checks the resolved format (JSON/human/quiet) and dispatches to either
|
|
6
|
+
* the LAFS JSON envelope (formatSuccess) or a human-readable renderer.
|
|
7
|
+
*
|
|
8
|
+
* Commands call:
|
|
9
|
+
* cliOutput(data, { command: 'show', message, operation, page })
|
|
10
|
+
*
|
|
11
|
+
* @task T4665
|
|
12
|
+
* @task T4666
|
|
13
|
+
* @task T4813
|
|
14
|
+
* @epic T4663
|
|
15
|
+
*/
|
|
16
|
+
import { type FormatOptions } from '@cleocode/core';
|
|
17
|
+
export interface CliOutputOptions {
|
|
18
|
+
/** Command name (used to pick the correct human renderer). */
|
|
19
|
+
command: string;
|
|
20
|
+
/** Optional success message for JSON envelope. */
|
|
21
|
+
message?: string;
|
|
22
|
+
/** Operation name for LAFS _meta. */
|
|
23
|
+
operation?: string;
|
|
24
|
+
/** Pagination for LAFS envelope. */
|
|
25
|
+
page?: FormatOptions['page'];
|
|
26
|
+
/** Extra LAFS extensions. */
|
|
27
|
+
extensions?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Output data to stdout in the resolved format (JSON or human-readable).
|
|
31
|
+
*
|
|
32
|
+
* Replaces `console.log(formatSuccess(data))` in all V2 commands.
|
|
33
|
+
* When format is 'human', normalizes the data shape then dispatches to
|
|
34
|
+
* the appropriate renderer.
|
|
35
|
+
* When format is 'json', delegates to existing formatSuccess().
|
|
36
|
+
*
|
|
37
|
+
* @task T4665
|
|
38
|
+
* @task T4666
|
|
39
|
+
* @task T4813
|
|
40
|
+
*/
|
|
41
|
+
export declare function cliOutput(data: unknown, opts: CliOutputOptions): void;
|
|
42
|
+
/**
|
|
43
|
+
* Error details for structured error output.
|
|
44
|
+
*/
|
|
45
|
+
export interface CliErrorDetails {
|
|
46
|
+
name?: string;
|
|
47
|
+
details?: unknown;
|
|
48
|
+
fix?: unknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Output an error in the resolved format.
|
|
52
|
+
* For JSON: delegates to formatError (already handled in command catch blocks).
|
|
53
|
+
* For human: prints a plain error message to stderr.
|
|
54
|
+
*
|
|
55
|
+
* @task T4666
|
|
56
|
+
* @task T4813
|
|
57
|
+
*/
|
|
58
|
+
export declare function cliError(message: string, code?: number | string, _details?: CliErrorDetails): void;
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AA+EnE,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CA2HrE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,CAAC,EAAE,eAAe,GACzB,IAAI,CAeN"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central output dispatch for V2 CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides cliOutput() which replaces `console.log(formatSuccess(data))`.
|
|
5
|
+
* Checks the resolved format (JSON/human/quiet) and dispatches to either
|
|
6
|
+
* the LAFS JSON envelope (formatSuccess) or a human-readable renderer.
|
|
7
|
+
*
|
|
8
|
+
* Commands call:
|
|
9
|
+
* cliOutput(data, { command: 'show', message, operation, page })
|
|
10
|
+
*
|
|
11
|
+
* @task T4665
|
|
12
|
+
* @task T4666
|
|
13
|
+
* @task T4813
|
|
14
|
+
* @epic T4663
|
|
15
|
+
*/
|
|
16
|
+
import { formatSuccess } from '@cleocode/core';
|
|
17
|
+
import { applyFieldFilter, extractFieldFromResult } from '@cleocode/lafs';
|
|
18
|
+
import { getFieldContext } from '../field-context.js';
|
|
19
|
+
import { getFormatContext } from '../format-context.js';
|
|
20
|
+
import { emitLafsViolation, LafsViolationError, validateLafsShape } from './lafs-validator.js';
|
|
21
|
+
import { normalizeForHuman } from './normalizer.js';
|
|
22
|
+
// System renderers
|
|
23
|
+
import { renderBlockers, renderCurrent, renderDoctor, renderGeneric, renderNext, renderPlan, renderSession, renderStart, renderStats, renderStop, renderTree, renderVersion, } from './system.js';
|
|
24
|
+
// Task renderers
|
|
25
|
+
import { renderAdd, renderArchive, renderComplete, renderDelete, renderFind, renderList, renderRestore, renderShow, renderUpdate, } from './tasks.js';
|
|
26
|
+
const renderers = {
|
|
27
|
+
// Task CRUD
|
|
28
|
+
show: renderShow,
|
|
29
|
+
list: renderList,
|
|
30
|
+
ls: renderList,
|
|
31
|
+
find: renderFind,
|
|
32
|
+
search: renderFind,
|
|
33
|
+
add: renderAdd,
|
|
34
|
+
update: renderUpdate,
|
|
35
|
+
complete: renderComplete,
|
|
36
|
+
done: renderComplete,
|
|
37
|
+
delete: renderDelete,
|
|
38
|
+
rm: renderDelete,
|
|
39
|
+
archive: renderArchive,
|
|
40
|
+
restore: renderRestore,
|
|
41
|
+
// Task work
|
|
42
|
+
start: renderStart,
|
|
43
|
+
stop: renderStop,
|
|
44
|
+
current: renderCurrent,
|
|
45
|
+
// System
|
|
46
|
+
doctor: renderDoctor,
|
|
47
|
+
stats: renderStats,
|
|
48
|
+
next: renderNext,
|
|
49
|
+
plan: renderPlan,
|
|
50
|
+
blockers: renderBlockers,
|
|
51
|
+
tree: renderTree,
|
|
52
|
+
depends: renderTree,
|
|
53
|
+
deps: renderTree,
|
|
54
|
+
session: renderSession,
|
|
55
|
+
version: renderVersion,
|
|
56
|
+
};
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Main output function
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Output data to stdout in the resolved format (JSON or human-readable).
|
|
62
|
+
*
|
|
63
|
+
* Replaces `console.log(formatSuccess(data))` in all V2 commands.
|
|
64
|
+
* When format is 'human', normalizes the data shape then dispatches to
|
|
65
|
+
* the appropriate renderer.
|
|
66
|
+
* When format is 'json', delegates to existing formatSuccess().
|
|
67
|
+
*
|
|
68
|
+
* @task T4665
|
|
69
|
+
* @task T4666
|
|
70
|
+
* @task T4813
|
|
71
|
+
*/
|
|
72
|
+
export function cliOutput(data, opts) {
|
|
73
|
+
const ctx = getFormatContext();
|
|
74
|
+
const fieldCtx = getFieldContext();
|
|
75
|
+
if (ctx.format === 'human') {
|
|
76
|
+
let dataToRender = data;
|
|
77
|
+
// §5.4.1 filter-then-render: apply --field extraction BEFORE human rendering
|
|
78
|
+
let fieldExtracted = false;
|
|
79
|
+
if (fieldCtx.field) {
|
|
80
|
+
const extracted = extractFieldFromResult(data, fieldCtx.field);
|
|
81
|
+
if (extracted === undefined) {
|
|
82
|
+
cliError(`Field "${fieldCtx.field}" not found`, 4, { name: 'E_NOT_FOUND' });
|
|
83
|
+
process.exit(4);
|
|
84
|
+
}
|
|
85
|
+
// If extracted is a primitive, render directly
|
|
86
|
+
if (typeof extracted !== 'object' || extracted === null) {
|
|
87
|
+
console.log(String(extracted));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// If extracted is an array, wrap it for renderGeneric
|
|
91
|
+
if (Array.isArray(extracted)) {
|
|
92
|
+
dataToRender = { [fieldCtx.field]: extracted };
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
dataToRender = extracted;
|
|
96
|
+
}
|
|
97
|
+
fieldExtracted = true;
|
|
98
|
+
}
|
|
99
|
+
const normalized = normalizeForHuman(opts.command, dataToRender);
|
|
100
|
+
// After field extraction, use renderGeneric — command-specific renderers
|
|
101
|
+
// expect the full data structure, not a filtered subset (§5.4.1)
|
|
102
|
+
const renderer = fieldExtracted ? renderGeneric : (renderers[opts.command] ?? renderGeneric);
|
|
103
|
+
const text = renderer(normalized, ctx.quiet);
|
|
104
|
+
if (text) {
|
|
105
|
+
console.log(text);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// --field: single-field plain text extraction (scripting / agent use).
|
|
110
|
+
// Centralised here so ALL commands (dispatchFromCli and dispatchRaw) honour the flag.
|
|
111
|
+
if (fieldCtx.field) {
|
|
112
|
+
const value = extractFieldFromResult(data, fieldCtx.field);
|
|
113
|
+
if (value === undefined) {
|
|
114
|
+
cliError(`Field "${fieldCtx.field}" not found`, 4, { name: 'E_NOT_FOUND' });
|
|
115
|
+
process.exit(4);
|
|
116
|
+
}
|
|
117
|
+
const out = value !== null && typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
118
|
+
process.stdout.write(out + '\n');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// JSON format (default): apply --fields filter, then emit LAFS envelope.
|
|
122
|
+
// Centralised here so ALL commands honour the flag without per-command wiring.
|
|
123
|
+
// applyFieldFilter can throw on unusual mixed-type arrays (e.g. changes: ['status']).
|
|
124
|
+
// In that case we fall back to unfiltered output rather than crashing.
|
|
125
|
+
let filteredData = data;
|
|
126
|
+
if (fieldCtx.fields?.length && data !== undefined && data !== null) {
|
|
127
|
+
try {
|
|
128
|
+
const stub = {
|
|
129
|
+
$schema: 'https://lafs.dev/schemas/v1/envelope.schema.json',
|
|
130
|
+
_meta: {
|
|
131
|
+
specVersion: '',
|
|
132
|
+
schemaVersion: '',
|
|
133
|
+
timestamp: '',
|
|
134
|
+
operation: '',
|
|
135
|
+
requestId: '',
|
|
136
|
+
transport: 'cli',
|
|
137
|
+
strict: false,
|
|
138
|
+
mvi: 'standard',
|
|
139
|
+
contextVersion: 0,
|
|
140
|
+
},
|
|
141
|
+
success: true,
|
|
142
|
+
result: data,
|
|
143
|
+
};
|
|
144
|
+
const filtered = applyFieldFilter(stub, fieldCtx.fields);
|
|
145
|
+
filteredData = filtered.result;
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// applyFieldFilter limitation: mixed-type arrays (strings inside arrays) are not
|
|
149
|
+
// supported. Fall through to emit the full unfiltered result.
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Per LAFS §9.1 (v1.5.0 clarification): _meta MUST always be present.
|
|
153
|
+
// --mvi minimal governs result contents only; mvi level is reflected in _meta.mvi.
|
|
154
|
+
const formatOpts = {};
|
|
155
|
+
if (opts.operation)
|
|
156
|
+
formatOpts.operation = opts.operation;
|
|
157
|
+
if (opts.page)
|
|
158
|
+
formatOpts.page = opts.page;
|
|
159
|
+
if (opts.extensions)
|
|
160
|
+
formatOpts.extensions = opts.extensions;
|
|
161
|
+
if (fieldCtx.mvi)
|
|
162
|
+
formatOpts.mvi = fieldCtx.mvi;
|
|
163
|
+
// Phase 6 — LAFS envelope validation middleware.
|
|
164
|
+
// Every CLI output flows through `formatSuccess()` → string. We parse the
|
|
165
|
+
// string, assert the shape invariants, and only emit if validation passes.
|
|
166
|
+
// A shape violation is a CLEO developer bug, so we:
|
|
167
|
+
// 1. Emit a valid LAFS error envelope to stderr describing the violation
|
|
168
|
+
// 2. Set process.exitCode to ExitCode.LAFS_VIOLATION (104)
|
|
169
|
+
// 3. Still emit the (invalid) original to stdout so operators can inspect
|
|
170
|
+
// This is a safety net — it never SILENTLY swallows output.
|
|
171
|
+
const envelopeString = formatSuccess(filteredData, opts.message, Object.keys(formatOpts).length > 0 ? formatOpts : opts.operation);
|
|
172
|
+
if (process.env['CLEO_LAFS_VALIDATE'] !== 'off') {
|
|
173
|
+
try {
|
|
174
|
+
const report = validateLafsShape(envelopeString);
|
|
175
|
+
if (report.reasons.length > 0) {
|
|
176
|
+
emitLafsViolation(new LafsViolationError(`cliOutput: envelope failed LAFS shape validation`, report));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
if (err instanceof LafsViolationError) {
|
|
181
|
+
emitLafsViolation(err);
|
|
182
|
+
}
|
|
183
|
+
// Non-validator errors — re-raise so tests can see them
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
console.log(envelopeString);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Output an error in the resolved format.
|
|
190
|
+
* For JSON: delegates to formatError (already handled in command catch blocks).
|
|
191
|
+
* For human: prints a plain error message to stderr.
|
|
192
|
+
*
|
|
193
|
+
* @task T4666
|
|
194
|
+
* @task T4813
|
|
195
|
+
*/
|
|
196
|
+
export function cliError(message, code, _details) {
|
|
197
|
+
const ctx = getFormatContext();
|
|
198
|
+
if (ctx.format === 'human') {
|
|
199
|
+
console.error(`Error: ${message}${code ? ` (${code})` : ''}`);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// JSON envelope always goes to stdout for consistent machine-readable output
|
|
203
|
+
console.log(JSON.stringify({
|
|
204
|
+
success: false,
|
|
205
|
+
error: { code: code ?? 1, message },
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAsB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,eAAe,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|
|
4
|
+
* Every CLI envelope emitted by `cliOutput()` flows through this module
|
|
5
|
+
* before hitting stdout. The middleware delegates to the canonical LAFS
|
|
6
|
+
* validators where they exist and adds a thin shape check for the agent-
|
|
7
|
+
* optimized **minimal envelope** format that the canonical schema does
|
|
8
|
+
* not cover.
|
|
9
|
+
*
|
|
10
|
+
* **SSoT alignment** (post-review):
|
|
11
|
+
* - Full envelopes (`{$schema, _meta, success, result}`) are validated
|
|
12
|
+
* by `validateEnvelope()` from `@cleocode/lafs`, which uses the
|
|
13
|
+
* `lafs-napi` Rust binding (with AJV fallback) and the canonical
|
|
14
|
+
* schema at `packages/lafs/schemas/v1/envelope.schema.json`.
|
|
15
|
+
* - Minimal envelopes (`{ok, r, _m}`) are agent-optimized and not part
|
|
16
|
+
* of the public LAFS schema. We validate their shape locally with
|
|
17
|
+
* the lightweight invariant check below.
|
|
18
|
+
*
|
|
19
|
+
* Validation invariants enforced HERE (minimal envelopes only):
|
|
20
|
+
* - Envelope MUST be a JSON object (parseable from a string)
|
|
21
|
+
* - Envelope MUST have exactly one of {`ok`, `success`}
|
|
22
|
+
* - The success indicator MUST be a boolean
|
|
23
|
+
* - On success, `r` / `result` MUST exist (may be null)
|
|
24
|
+
* - On failure, `error` MUST exist with at least `code` and `message`
|
|
25
|
+
* - `_m` / `_meta` MUST be present in some form
|
|
26
|
+
*
|
|
27
|
+
* When a violation is detected, the validator:
|
|
28
|
+
* 1. Wraps the malformed output in a valid error envelope
|
|
29
|
+
* 2. Sets the process exit code to `ExitCode.LAFS_VIOLATION` (104)
|
|
30
|
+
* 3. Emits the wrapped envelope to stderr for diagnostic tooling
|
|
31
|
+
*
|
|
32
|
+
* @task Phase 6 — LAFS formalization + schema consolidation
|
|
33
|
+
* @see packages/lafs/src/validateEnvelope.ts — canonical full-envelope validator
|
|
34
|
+
* @see packages/lafs/schemas/v1/envelope.schema.json — canonical full-envelope schema
|
|
35
|
+
* @see crates/lafs-core — Rust embed of the canonical schema
|
|
36
|
+
*/
|
|
37
|
+
import { ExitCode } from '@cleocode/contracts';
|
|
38
|
+
/**
|
|
39
|
+
* The minimum shape invariants for a LAFS envelope, compatible with both
|
|
40
|
+
* minimal (`{ok, r, _m}`) and full (`{success, result, _meta}`) formats.
|
|
41
|
+
*/
|
|
42
|
+
export interface LafsShapeViolation {
|
|
43
|
+
/** True iff the input is a well-formed JSON object. */
|
|
44
|
+
isObject: boolean;
|
|
45
|
+
/** True iff the envelope has exactly one success-indicator field. */
|
|
46
|
+
hasSuccessField: boolean;
|
|
47
|
+
/** True iff the success-indicator is a boolean. */
|
|
48
|
+
successIsBoolean: boolean;
|
|
49
|
+
/** True iff a metadata field (`_m` or `_meta`) is present. */
|
|
50
|
+
hasMeta: boolean;
|
|
51
|
+
/** True iff the result/error invariants hold for the indicated success value. */
|
|
52
|
+
resultOrErrorValid: boolean;
|
|
53
|
+
/** Human-readable reasons the envelope failed validation (empty = valid). */
|
|
54
|
+
reasons: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Validate a LAFS envelope shape and report violations.
|
|
58
|
+
*
|
|
59
|
+
* Full envelopes are delegated to `@cleocode/lafs.validateEnvelope()` (which
|
|
60
|
+
* uses the canonical schema via lafs-napi/AJV). Minimal envelopes are
|
|
61
|
+
* checked against the lightweight invariants in this module.
|
|
62
|
+
*
|
|
63
|
+
* @param envelope - The candidate envelope (serialized string or object)
|
|
64
|
+
* @returns A `LafsShapeViolation` report. `.reasons.length === 0` when valid.
|
|
65
|
+
*/
|
|
66
|
+
export declare function validateLafsShape(envelope: unknown): LafsShapeViolation;
|
|
67
|
+
/**
|
|
68
|
+
* Assert that a LAFS envelope conforms to the shape contract, throwing
|
|
69
|
+
* an error with a LAFS-shaped diagnostic if it does not.
|
|
70
|
+
*
|
|
71
|
+
* Used by the renderer middleware to fail LOUDLY when CLEO itself emits
|
|
72
|
+
* a malformed envelope — this is a developer bug, not an operator issue.
|
|
73
|
+
*
|
|
74
|
+
* @param envelope - The candidate envelope
|
|
75
|
+
* @throws `LafsViolationError` if the envelope fails any shape invariant
|
|
76
|
+
*/
|
|
77
|
+
export declare function assertLafsShape(envelope: unknown): void;
|
|
78
|
+
/**
|
|
79
|
+
* Error thrown by `assertLafsShape` when an envelope fails validation.
|
|
80
|
+
*
|
|
81
|
+
* Carries the full `LafsShapeViolation` report so diagnostic tooling can
|
|
82
|
+
* report which specific invariants were violated.
|
|
83
|
+
*/
|
|
84
|
+
export declare class LafsViolationError extends Error {
|
|
85
|
+
readonly code = ExitCode.LAFS_VIOLATION;
|
|
86
|
+
readonly report: LafsShapeViolation;
|
|
87
|
+
constructor(message: string, report: LafsShapeViolation);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Emit a LAFS-shaped error envelope describing a validation failure and
|
|
91
|
+
* set `process.exitCode` to `ExitCode.LAFS_VIOLATION`.
|
|
92
|
+
*
|
|
93
|
+
* Called by the renderer middleware as a recovery path when a previously-
|
|
94
|
+
* emitted envelope turns out to be malformed.
|
|
95
|
+
*/
|
|
96
|
+
export declare function emitLafsViolation(err: LafsViolationError): void;
|
|
97
|
+
//# sourceMappingURL=lafs-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lafs-validator.d.ts","sourceRoot":"","sources":["../../../src/cli/renderers/lafs-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,eAAe,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAoBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,CAwHvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAQvD;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB;CAKxD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAmB/D"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAFS envelope validator middleware (Phase 6).
|
|
3
|
+
*
|
|
4
|
+
* Every CLI envelope emitted by `cliOutput()` flows through this module
|
|
5
|
+
* before hitting stdout. The middleware delegates to the canonical LAFS
|
|
6
|
+
* validators where they exist and adds a thin shape check for the agent-
|
|
7
|
+
* optimized **minimal envelope** format that the canonical schema does
|
|
8
|
+
* not cover.
|
|
9
|
+
*
|
|
10
|
+
* **SSoT alignment** (post-review):
|
|
11
|
+
* - Full envelopes (`{$schema, _meta, success, result}`) are validated
|
|
12
|
+
* by `validateEnvelope()` from `@cleocode/lafs`, which uses the
|
|
13
|
+
* `lafs-napi` Rust binding (with AJV fallback) and the canonical
|
|
14
|
+
* schema at `packages/lafs/schemas/v1/envelope.schema.json`.
|
|
15
|
+
* - Minimal envelopes (`{ok, r, _m}`) are agent-optimized and not part
|
|
16
|
+
* of the public LAFS schema. We validate their shape locally with
|
|
17
|
+
* the lightweight invariant check below.
|
|
18
|
+
*
|
|
19
|
+
* Validation invariants enforced HERE (minimal envelopes only):
|
|
20
|
+
* - Envelope MUST be a JSON object (parseable from a string)
|
|
21
|
+
* - Envelope MUST have exactly one of {`ok`, `success`}
|
|
22
|
+
* - The success indicator MUST be a boolean
|
|
23
|
+
* - On success, `r` / `result` MUST exist (may be null)
|
|
24
|
+
* - On failure, `error` MUST exist with at least `code` and `message`
|
|
25
|
+
* - `_m` / `_meta` MUST be present in some form
|
|
26
|
+
*
|
|
27
|
+
* When a violation is detected, the validator:
|
|
28
|
+
* 1. Wraps the malformed output in a valid error envelope
|
|
29
|
+
* 2. Sets the process exit code to `ExitCode.LAFS_VIOLATION` (104)
|
|
30
|
+
* 3. Emits the wrapped envelope to stderr for diagnostic tooling
|
|
31
|
+
*
|
|
32
|
+
* @task Phase 6 — LAFS formalization + schema consolidation
|
|
33
|
+
* @see packages/lafs/src/validateEnvelope.ts — canonical full-envelope validator
|
|
34
|
+
* @see packages/lafs/schemas/v1/envelope.schema.json — canonical full-envelope schema
|
|
35
|
+
* @see crates/lafs-core — Rust embed of the canonical schema
|
|
36
|
+
*/
|
|
37
|
+
import { ExitCode } from '@cleocode/contracts';
|
|
38
|
+
const ENVELOPE_OK_KEY_MINIMAL = 'ok';
|
|
39
|
+
const ENVELOPE_OK_KEY_FULL = 'success';
|
|
40
|
+
const ENVELOPE_RESULT_KEY_MINIMAL = 'r';
|
|
41
|
+
const ENVELOPE_RESULT_KEY_FULL = 'result';
|
|
42
|
+
const ENVELOPE_META_KEYS = ['_m', '_meta'];
|
|
43
|
+
/**
|
|
44
|
+
* Detect whether a parsed envelope is a "full" or "minimal" LAFS shape.
|
|
45
|
+
*
|
|
46
|
+
* Full shape uses {`success`, `result`, `_meta`}; minimal shape uses
|
|
47
|
+
* {`ok`, `r`, `_m`}. Returns 'unknown' when neither indicator is present.
|
|
48
|
+
*/
|
|
49
|
+
function detectEnvelopeFlavor(obj) {
|
|
50
|
+
if ('success' in obj || '_meta' in obj || '$schema' in obj)
|
|
51
|
+
return 'full';
|
|
52
|
+
if ('ok' in obj || '_m' in obj)
|
|
53
|
+
return 'minimal';
|
|
54
|
+
return 'unknown';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Validate a LAFS envelope shape and report violations.
|
|
58
|
+
*
|
|
59
|
+
* Full envelopes are delegated to `@cleocode/lafs.validateEnvelope()` (which
|
|
60
|
+
* uses the canonical schema via lafs-napi/AJV). Minimal envelopes are
|
|
61
|
+
* checked against the lightweight invariants in this module.
|
|
62
|
+
*
|
|
63
|
+
* @param envelope - The candidate envelope (serialized string or object)
|
|
64
|
+
* @returns A `LafsShapeViolation` report. `.reasons.length === 0` when valid.
|
|
65
|
+
*/
|
|
66
|
+
export function validateLafsShape(envelope) {
|
|
67
|
+
const report = {
|
|
68
|
+
isObject: false,
|
|
69
|
+
hasSuccessField: false,
|
|
70
|
+
successIsBoolean: false,
|
|
71
|
+
hasMeta: false,
|
|
72
|
+
resultOrErrorValid: false,
|
|
73
|
+
reasons: [],
|
|
74
|
+
};
|
|
75
|
+
// Allow callers to pass either a serialized envelope or a parsed one
|
|
76
|
+
let parsed = envelope;
|
|
77
|
+
if (typeof envelope === 'string') {
|
|
78
|
+
try {
|
|
79
|
+
parsed = JSON.parse(envelope);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
report.reasons.push('Envelope is not valid JSON');
|
|
83
|
+
return report;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
87
|
+
report.reasons.push('Envelope is not a JSON object');
|
|
88
|
+
return report;
|
|
89
|
+
}
|
|
90
|
+
report.isObject = true;
|
|
91
|
+
const obj = parsed;
|
|
92
|
+
// SSoT delegation: full envelopes go through @cleocode/lafs.validateEnvelope
|
|
93
|
+
// which validates against the canonical packages/lafs/schemas/v1/envelope.schema.json
|
|
94
|
+
// (via the lafs-napi Rust binding when available, AJV fallback otherwise).
|
|
95
|
+
// We only inspect minimal envelopes locally because they're an internal
|
|
96
|
+
// agent-optimized format that the canonical schema does not cover.
|
|
97
|
+
const flavor = detectEnvelopeFlavor(obj);
|
|
98
|
+
if (flavor === 'full') {
|
|
99
|
+
try {
|
|
100
|
+
// Lazy require to avoid pulling lafs into the cli bundle's hot path.
|
|
101
|
+
// The package exports validateEnvelope() at the package root.
|
|
102
|
+
// biome-ignore lint/suspicious/noExplicitAny: dynamic import shape
|
|
103
|
+
const lafs = require('@cleocode/lafs');
|
|
104
|
+
const result = lafs.validateEnvelope(obj);
|
|
105
|
+
report.hasSuccessField = true;
|
|
106
|
+
report.successIsBoolean = true;
|
|
107
|
+
report.hasMeta = true;
|
|
108
|
+
report.resultOrErrorValid = result.valid;
|
|
109
|
+
if (!result.valid) {
|
|
110
|
+
for (const err of result.errors) {
|
|
111
|
+
report.reasons.push(`canonical validator: ${err}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return report;
|
|
115
|
+
}
|
|
116
|
+
catch (loadErr) {
|
|
117
|
+
// Fall through to the local minimal-shape check if @cleocode/lafs
|
|
118
|
+
// can't be loaded for any reason — better than failing closed.
|
|
119
|
+
report.reasons.push(`Could not load canonical LAFS validator (${loadErr instanceof Error ? loadErr.message : String(loadErr)}); falling back to local shape check`);
|
|
120
|
+
// continue to the minimal-shape path below
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Success-indicator field presence
|
|
124
|
+
const hasMinimal = ENVELOPE_OK_KEY_MINIMAL in obj;
|
|
125
|
+
const hasFull = ENVELOPE_OK_KEY_FULL in obj;
|
|
126
|
+
if (!hasMinimal && !hasFull) {
|
|
127
|
+
report.reasons.push(`Envelope missing success indicator — expected one of: ${ENVELOPE_OK_KEY_MINIMAL}, ${ENVELOPE_OK_KEY_FULL}`);
|
|
128
|
+
return report;
|
|
129
|
+
}
|
|
130
|
+
report.hasSuccessField = true;
|
|
131
|
+
const successValue = hasMinimal ? obj[ENVELOPE_OK_KEY_MINIMAL] : obj[ENVELOPE_OK_KEY_FULL];
|
|
132
|
+
if (typeof successValue !== 'boolean') {
|
|
133
|
+
report.reasons.push(`Envelope success field must be boolean, got ${typeof successValue}`);
|
|
134
|
+
return report;
|
|
135
|
+
}
|
|
136
|
+
report.successIsBoolean = true;
|
|
137
|
+
// Metadata presence
|
|
138
|
+
report.hasMeta = ENVELOPE_META_KEYS.some((key) => key in obj);
|
|
139
|
+
if (!report.hasMeta) {
|
|
140
|
+
report.reasons.push(`Envelope missing metadata — expected one of: ${ENVELOPE_META_KEYS.join(', ')}`);
|
|
141
|
+
}
|
|
142
|
+
// Success / error invariants
|
|
143
|
+
if (successValue === true) {
|
|
144
|
+
const hasResult = ENVELOPE_RESULT_KEY_MINIMAL in obj || ENVELOPE_RESULT_KEY_FULL in obj;
|
|
145
|
+
if (!hasResult) {
|
|
146
|
+
report.reasons.push(`Successful envelope missing result field (${ENVELOPE_RESULT_KEY_MINIMAL} | ${ENVELOPE_RESULT_KEY_FULL})`);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
report.resultOrErrorValid = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
const errorField = obj['error'];
|
|
154
|
+
if (typeof errorField !== 'object' || errorField === null) {
|
|
155
|
+
report.reasons.push('Failed envelope missing error object');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const err = errorField;
|
|
159
|
+
const hasCode = 'code' in err;
|
|
160
|
+
const hasMessage = 'message' in err && typeof err['message'] === 'string';
|
|
161
|
+
if (!hasCode || !hasMessage) {
|
|
162
|
+
report.reasons.push('Failed envelope error object must contain code and message (string)');
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
report.resultOrErrorValid = true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return report;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Assert that a LAFS envelope conforms to the shape contract, throwing
|
|
173
|
+
* an error with a LAFS-shaped diagnostic if it does not.
|
|
174
|
+
*
|
|
175
|
+
* Used by the renderer middleware to fail LOUDLY when CLEO itself emits
|
|
176
|
+
* a malformed envelope — this is a developer bug, not an operator issue.
|
|
177
|
+
*
|
|
178
|
+
* @param envelope - The candidate envelope
|
|
179
|
+
* @throws `LafsViolationError` if the envelope fails any shape invariant
|
|
180
|
+
*/
|
|
181
|
+
export function assertLafsShape(envelope) {
|
|
182
|
+
const report = validateLafsShape(envelope);
|
|
183
|
+
if (report.reasons.length > 0) {
|
|
184
|
+
throw new LafsViolationError(`LAFS envelope shape violation: ${report.reasons.join('; ')}`, report);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Error thrown by `assertLafsShape` when an envelope fails validation.
|
|
189
|
+
*
|
|
190
|
+
* Carries the full `LafsShapeViolation` report so diagnostic tooling can
|
|
191
|
+
* report which specific invariants were violated.
|
|
192
|
+
*/
|
|
193
|
+
export class LafsViolationError extends Error {
|
|
194
|
+
code = ExitCode.LAFS_VIOLATION;
|
|
195
|
+
report;
|
|
196
|
+
constructor(message, report) {
|
|
197
|
+
super(message);
|
|
198
|
+
this.name = 'LafsViolationError';
|
|
199
|
+
this.report = report;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Emit a LAFS-shaped error envelope describing a validation failure and
|
|
204
|
+
* set `process.exitCode` to `ExitCode.LAFS_VIOLATION`.
|
|
205
|
+
*
|
|
206
|
+
* Called by the renderer middleware as a recovery path when a previously-
|
|
207
|
+
* emitted envelope turns out to be malformed.
|
|
208
|
+
*/
|
|
209
|
+
export function emitLafsViolation(err) {
|
|
210
|
+
const envelope = {
|
|
211
|
+
ok: false,
|
|
212
|
+
error: {
|
|
213
|
+
code: 'E_LAFS_VIOLATION',
|
|
214
|
+
message: err.message,
|
|
215
|
+
category: 'internal',
|
|
216
|
+
details: {
|
|
217
|
+
exitCode: ExitCode.LAFS_VIOLATION,
|
|
218
|
+
report: err.report,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
_m: {
|
|
222
|
+
op: 'cli.lafs-validator',
|
|
223
|
+
rid: 'lafs-validator-emit',
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
process.stderr.write(`${JSON.stringify(envelope)}\n`);
|
|
227
|
+
process.exitCode = ExitCode.LAFS_VIOLATION;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=lafs-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lafs-validator.js","sourceRoot":"","sources":["../../../src/cli/renderers/lafs-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAqB/C,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;AAEpD;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,GAA4B;IACxD,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG;QAAE,OAAO,MAAM,CAAC;IAC1E,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG;QAAE,OAAO,SAAS,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,MAAM,MAAM,GAAuB;QACjC,QAAQ,EAAE,KAAK;QACf,eAAe,EAAE,KAAK;QACtB,gBAAgB,EAAE,KAAK;QACvB,OAAO,EAAE,KAAK;QACd,kBAAkB,EAAE,KAAK;QACzB,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,qEAAqE;IACrE,IAAI,MAAM,GAAY,QAAQ,CAAC;IAC/B,IAAI,OAAO,QAAQ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Q,CAAC,CAAC;IAC3C,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,kBAAkB,CAC1B,kCAAkC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC7D,MAAM,CACP,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAqB;IAEpC,YAAY,OAAe,EAAE,MAA0B;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAuB;IACvD,MAAM,QAAQ,GAAG;QACf,EAAE,EAAE,KAAK;QACT,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,QAAQ,EAAE,UAAU;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,QAAQ,CAAC,cAAc;gBACjC,MAAM,EAAE,GAAG,CAAC,MAAM;aACnB;SACF;QACD,EAAE,EAAE;YACF,EAAE,EAAE,oBAAoB;YACxB,GAAG,EAAE,qBAAqB;SAC3B;KACF,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Rendering Normalizer — safety net for human-readable output.
|
|
3
|
+
*
|
|
4
|
+
* Ensures data passed to human renderers has the expected shape,
|
|
5
|
+
* regardless of whether the engine layer has been fully fixed.
|
|
6
|
+
* Only called for human format — JSON output is untouched.
|
|
7
|
+
*
|
|
8
|
+
* Detection is idempotent: if data already has the expected key,
|
|
9
|
+
* it passes through unchanged.
|
|
10
|
+
*
|
|
11
|
+
* @task T4813
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Normalize data shape for human renderers.
|
|
15
|
+
*
|
|
16
|
+
* Each command expects data with specific named keys (e.g., `data.task`
|
|
17
|
+
* for 'show', `data.tasks` for 'list'). This function detects and
|
|
18
|
+
* corrects flat/array data from the engine layer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeForHuman(command: string, data: Record<string, unknown>): Record<string, unknown>;
|
|
21
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../src/cli/renderers/normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiCzB"}
|