@cleocode/cleo 2026.3.37 → 2026.3.39
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/LICENSE +21 -0
- package/README.md +565 -0
- package/bin/postinstall.js +0 -0
- package/completions/bash-completion.sh +0 -0
- package/completions/zsh-completion.zsh +0 -0
- package/dist/cli/index.js +3507 -3631
- package/dist/cli/index.js.map +4 -4
- package/dist/mcp/index.js +3311 -3215
- package/dist/mcp/index.js.map +4 -4
- package/migrations/drizzle-brain/20260318205549_initial/migration.sql +0 -0
- package/migrations/drizzle-brain/20260318205549_initial/snapshot.json +0 -0
- package/migrations/drizzle-nexus/20260318205558_initial/migration.sql +0 -0
- package/migrations/drizzle-nexus/20260318205558_initial/snapshot.json +0 -0
- package/migrations/drizzle-tasks/20260318205539_initial/migration.sql +0 -0
- package/migrations/drizzle-tasks/20260318205539_initial/snapshot.json +0 -0
- package/package.json +17 -12
- package/dist/cli/commander-shim.d.ts +0 -108
- package/dist/cli/commander-shim.d.ts.map +0 -1
- package/dist/cli/commander-shim.js +0 -229
- package/dist/cli/commander-shim.js.map +0 -1
- package/dist/cli/commands/add.d.ts +0 -12
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -91
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/adr.d.ts +0 -27
- package/dist/cli/commands/adr.d.ts.map +0 -1
- package/dist/cli/commands/adr.js +0 -79
- package/dist/cli/commands/adr.js.map +0 -1
- package/dist/cli/commands/analyze.d.ts +0 -12
- package/dist/cli/commands/analyze.d.ts.map +0 -1
- package/dist/cli/commands/analyze.js +0 -20
- package/dist/cli/commands/analyze.js.map +0 -1
- package/dist/cli/commands/archive-stats.d.ts +0 -18
- package/dist/cli/commands/archive-stats.d.ts.map +0 -1
- package/dist/cli/commands/archive-stats.js +0 -49
- package/dist/cli/commands/archive-stats.js.map +0 -1
- package/dist/cli/commands/archive.d.ts +0 -12
- package/dist/cli/commands/archive.d.ts.map +0 -1
- package/dist/cli/commands/archive.js +0 -32
- package/dist/cli/commands/archive.js.map +0 -1
- package/dist/cli/commands/backup.d.ts +0 -8
- package/dist/cli/commands/backup.d.ts.map +0 -1
- package/dist/cli/commands/backup.js +0 -35
- package/dist/cli/commands/backup.js.map +0 -1
- package/dist/cli/commands/blockers.d.ts +0 -7
- package/dist/cli/commands/blockers.d.ts.map +0 -1
- package/dist/cli/commands/blockers.js +0 -16
- package/dist/cli/commands/blockers.js.map +0 -1
- package/dist/cli/commands/briefing.d.ts +0 -22
- package/dist/cli/commands/briefing.d.ts.map +0 -1
- package/dist/cli/commands/briefing.js +0 -45
- package/dist/cli/commands/briefing.js.map +0 -1
- package/dist/cli/commands/bug.d.ts +0 -12
- package/dist/cli/commands/bug.d.ts.map +0 -1
- package/dist/cli/commands/bug.js +0 -81
- package/dist/cli/commands/bug.js.map +0 -1
- package/dist/cli/commands/checkpoint.d.ts +0 -15
- package/dist/cli/commands/checkpoint.d.ts.map +0 -1
- package/dist/cli/commands/checkpoint.js +0 -92
- package/dist/cli/commands/checkpoint.js.map +0 -1
- package/dist/cli/commands/commands.d.ts +0 -13
- package/dist/cli/commands/commands.d.ts.map +0 -1
- package/dist/cli/commands/commands.js +0 -30
- package/dist/cli/commands/commands.js.map +0 -1
- package/dist/cli/commands/complete.d.ts +0 -12
- package/dist/cli/commands/complete.d.ts.map +0 -1
- package/dist/cli/commands/complete.js +0 -43
- package/dist/cli/commands/complete.js.map +0 -1
- package/dist/cli/commands/compliance.d.ts +0 -8
- package/dist/cli/commands/compliance.d.ts.map +0 -1
- package/dist/cli/commands/compliance.js +0 -85
- package/dist/cli/commands/compliance.js.map +0 -1
- package/dist/cli/commands/config.d.ts +0 -9
- package/dist/cli/commands/config.d.ts.map +0 -1
- package/dist/cli/commands/config.js +0 -43
- package/dist/cli/commands/config.js.map +0 -1
- package/dist/cli/commands/consensus.d.ts +0 -13
- package/dist/cli/commands/consensus.d.ts.map +0 -1
- package/dist/cli/commands/consensus.js +0 -45
- package/dist/cli/commands/consensus.js.map +0 -1
- package/dist/cli/commands/context.d.ts +0 -8
- package/dist/cli/commands/context.d.ts.map +0 -1
- package/dist/cli/commands/context.js +0 -40
- package/dist/cli/commands/context.js.map +0 -1
- package/dist/cli/commands/contribution.d.ts +0 -13
- package/dist/cli/commands/contribution.d.ts.map +0 -1
- package/dist/cli/commands/contribution.js +0 -41
- package/dist/cli/commands/contribution.js.map +0 -1
- package/dist/cli/commands/current.d.ts +0 -13
- package/dist/cli/commands/current.d.ts.map +0 -1
- package/dist/cli/commands/current.js +0 -20
- package/dist/cli/commands/current.js.map +0 -1
- package/dist/cli/commands/dash.d.ts +0 -12
- package/dist/cli/commands/dash.d.ts.map +0 -1
- package/dist/cli/commands/dash.js +0 -24
- package/dist/cli/commands/dash.js.map +0 -1
- package/dist/cli/commands/decomposition.d.ts +0 -13
- package/dist/cli/commands/decomposition.d.ts.map +0 -1
- package/dist/cli/commands/decomposition.js +0 -45
- package/dist/cli/commands/decomposition.js.map +0 -1
- package/dist/cli/commands/delete.d.ts +0 -12
- package/dist/cli/commands/delete.d.ts.map +0 -1
- package/dist/cli/commands/delete.js +0 -37
- package/dist/cli/commands/delete.js.map +0 -1
- package/dist/cli/commands/deps.d.ts +0 -9
- package/dist/cli/commands/deps.d.ts.map +0 -1
- package/dist/cli/commands/deps.js +0 -73
- package/dist/cli/commands/deps.js.map +0 -1
- package/dist/cli/commands/detect-drift.d.ts +0 -15
- package/dist/cli/commands/detect-drift.d.ts.map +0 -1
- package/dist/cli/commands/detect-drift.js +0 -385
- package/dist/cli/commands/detect-drift.js.map +0 -1
- package/dist/cli/commands/docs.d.ts +0 -13
- package/dist/cli/commands/docs.d.ts.map +0 -1
- package/dist/cli/commands/docs.js +0 -170
- package/dist/cli/commands/docs.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -11
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/doctor.js +0 -54
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/dynamic.d.ts +0 -24
- package/dist/cli/commands/dynamic.d.ts.map +0 -1
- package/dist/cli/commands/dynamic.js +0 -27
- package/dist/cli/commands/dynamic.js.map +0 -1
- package/dist/cli/commands/env.d.ts +0 -12
- package/dist/cli/commands/env.d.ts.map +0 -1
- package/dist/cli/commands/env.js +0 -44
- package/dist/cli/commands/env.js.map +0 -1
- package/dist/cli/commands/exists.d.ts +0 -7
- package/dist/cli/commands/exists.d.ts.map +0 -1
- package/dist/cli/commands/exists.js +0 -33
- package/dist/cli/commands/exists.js.map +0 -1
- package/dist/cli/commands/export-tasks.d.ts +0 -10
- package/dist/cli/commands/export-tasks.d.ts.map +0 -1
- package/dist/cli/commands/export-tasks.js +0 -47
- package/dist/cli/commands/export-tasks.js.map +0 -1
- package/dist/cli/commands/export.d.ts +0 -9
- package/dist/cli/commands/export.d.ts.map +0 -1
- package/dist/cli/commands/export.js +0 -46
- package/dist/cli/commands/export.js.map +0 -1
- package/dist/cli/commands/extract.d.ts +0 -16
- package/dist/cli/commands/extract.d.ts.map +0 -1
- package/dist/cli/commands/extract.js +0 -43
- package/dist/cli/commands/extract.js.map +0 -1
- package/dist/cli/commands/find.d.ts +0 -14
- package/dist/cli/commands/find.d.ts.map +0 -1
- package/dist/cli/commands/find.js +0 -70
- package/dist/cli/commands/find.js.map +0 -1
- package/dist/cli/commands/generate-changelog.d.ts +0 -14
- package/dist/cli/commands/generate-changelog.d.ts.map +0 -1
- package/dist/cli/commands/generate-changelog.js +0 -252
- package/dist/cli/commands/generate-changelog.js.map +0 -1
- package/dist/cli/commands/grade.d.ts +0 -13
- package/dist/cli/commands/grade.d.ts.map +0 -1
- package/dist/cli/commands/grade.js +0 -16
- package/dist/cli/commands/grade.js.map +0 -1
- package/dist/cli/commands/history.d.ts +0 -9
- package/dist/cli/commands/history.d.ts.map +0 -1
- package/dist/cli/commands/history.js +0 -30
- package/dist/cli/commands/history.js.map +0 -1
- package/dist/cli/commands/implementation.d.ts +0 -13
- package/dist/cli/commands/implementation.d.ts.map +0 -1
- package/dist/cli/commands/implementation.js +0 -41
- package/dist/cli/commands/implementation.js.map +0 -1
- package/dist/cli/commands/import-tasks.d.ts +0 -10
- package/dist/cli/commands/import-tasks.d.ts.map +0 -1
- package/dist/cli/commands/import-tasks.js +0 -38
- package/dist/cli/commands/import-tasks.js.map +0 -1
- package/dist/cli/commands/import.d.ts +0 -9
- package/dist/cli/commands/import.d.ts.map +0 -1
- package/dist/cli/commands/import.js +0 -28
- package/dist/cli/commands/import.js.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -34
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -94
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/inject.d.ts +0 -8
- package/dist/cli/commands/inject.d.ts.map +0 -1
- package/dist/cli/commands/inject.js +0 -28
- package/dist/cli/commands/inject.js.map +0 -1
- package/dist/cli/commands/install-global.d.ts +0 -19
- package/dist/cli/commands/install-global.d.ts.map +0 -1
- package/dist/cli/commands/install-global.js +0 -54
- package/dist/cli/commands/install-global.js.map +0 -1
- package/dist/cli/commands/issue.d.ts +0 -14
- package/dist/cli/commands/issue.d.ts.map +0 -1
- package/dist/cli/commands/issue.js +0 -105
- package/dist/cli/commands/issue.js.map +0 -1
- package/dist/cli/commands/labels.d.ts +0 -13
- package/dist/cli/commands/labels.d.ts.map +0 -1
- package/dist/cli/commands/labels.js +0 -44
- package/dist/cli/commands/labels.js.map +0 -1
- package/dist/cli/commands/lifecycle.d.ts +0 -8
- package/dist/cli/commands/lifecycle.d.ts.map +0 -1
- package/dist/cli/commands/lifecycle.js +0 -72
- package/dist/cli/commands/lifecycle.js.map +0 -1
- package/dist/cli/commands/list.d.ts +0 -14
- package/dist/cli/commands/list.d.ts.map +0 -1
- package/dist/cli/commands/list.js +0 -71
- package/dist/cli/commands/list.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -12
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -30
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/map.d.ts +0 -10
- package/dist/cli/commands/map.d.ts.map +0 -1
- package/dist/cli/commands/map.js +0 -23
- package/dist/cli/commands/map.js.map +0 -1
- package/dist/cli/commands/mcp-install.d.ts +0 -17
- package/dist/cli/commands/mcp-install.d.ts.map +0 -1
- package/dist/cli/commands/mcp-install.js +0 -128
- package/dist/cli/commands/mcp-install.js.map +0 -1
- package/dist/cli/commands/memory-brain.d.ts +0 -14
- package/dist/cli/commands/memory-brain.d.ts.map +0 -1
- package/dist/cli/commands/memory-brain.js +0 -151
- package/dist/cli/commands/memory-brain.js.map +0 -1
- package/dist/cli/commands/migrate-claude-mem.d.ts +0 -18
- package/dist/cli/commands/migrate-claude-mem.d.ts.map +0 -1
- package/dist/cli/commands/migrate-claude-mem.js +0 -60
- package/dist/cli/commands/migrate-claude-mem.js.map +0 -1
- package/dist/cli/commands/next.d.ts +0 -9
- package/dist/cli/commands/next.d.ts.map +0 -1
- package/dist/cli/commands/next.js +0 -20
- package/dist/cli/commands/next.js.map +0 -1
- package/dist/cli/commands/nexus.d.ts +0 -16
- package/dist/cli/commands/nexus.d.ts.map +0 -1
- package/dist/cli/commands/nexus.js +0 -155
- package/dist/cli/commands/nexus.js.map +0 -1
- package/dist/cli/commands/observe.d.ts +0 -9
- package/dist/cli/commands/observe.d.ts.map +0 -1
- package/dist/cli/commands/observe.js +0 -39
- package/dist/cli/commands/observe.js.map +0 -1
- package/dist/cli/commands/ops.d.ts +0 -10
- package/dist/cli/commands/ops.d.ts.map +0 -1
- package/dist/cli/commands/ops.js +0 -19
- package/dist/cli/commands/ops.js.map +0 -1
- package/dist/cli/commands/orchestrate.d.ts +0 -8
- package/dist/cli/commands/orchestrate.d.ts.map +0 -1
- package/dist/cli/commands/orchestrate.js +0 -58
- package/dist/cli/commands/orchestrate.js.map +0 -1
- package/dist/cli/commands/otel.d.ts +0 -12
- package/dist/cli/commands/otel.d.ts.map +0 -1
- package/dist/cli/commands/otel.js +0 -128
- package/dist/cli/commands/otel.js.map +0 -1
- package/dist/cli/commands/phase.d.ts +0 -12
- package/dist/cli/commands/phase.d.ts.map +0 -1
- package/dist/cli/commands/phase.js +0 -88
- package/dist/cli/commands/phase.js.map +0 -1
- package/dist/cli/commands/phases.d.ts +0 -12
- package/dist/cli/commands/phases.d.ts.map +0 -1
- package/dist/cli/commands/phases.js +0 -37
- package/dist/cli/commands/phases.js.map +0 -1
- package/dist/cli/commands/plan.d.ts +0 -8
- package/dist/cli/commands/plan.d.ts.map +0 -1
- package/dist/cli/commands/plan.js +0 -15
- package/dist/cli/commands/plan.js.map +0 -1
- package/dist/cli/commands/promote.d.ts +0 -7
- package/dist/cli/commands/promote.d.ts.map +0 -1
- package/dist/cli/commands/promote.js +0 -15
- package/dist/cli/commands/promote.js.map +0 -1
- package/dist/cli/commands/refresh-memory.d.ts +0 -9
- package/dist/cli/commands/refresh-memory.d.ts.map +0 -1
- package/dist/cli/commands/refresh-memory.js +0 -24
- package/dist/cli/commands/refresh-memory.js.map +0 -1
- package/dist/cli/commands/relates.d.ts +0 -12
- package/dist/cli/commands/relates.d.ts.map +0 -1
- package/dist/cli/commands/relates.js +0 -53
- package/dist/cli/commands/relates.js.map +0 -1
- package/dist/cli/commands/release.d.ts +0 -8
- package/dist/cli/commands/release.d.ts.map +0 -1
- package/dist/cli/commands/release.js +0 -72
- package/dist/cli/commands/release.js.map +0 -1
- package/dist/cli/commands/remote.d.ts +0 -12
- package/dist/cli/commands/remote.d.ts.map +0 -1
- package/dist/cli/commands/remote.js +0 -207
- package/dist/cli/commands/remote.js.map +0 -1
- package/dist/cli/commands/reorder.d.ts +0 -7
- package/dist/cli/commands/reorder.d.ts.map +0 -1
- package/dist/cli/commands/reorder.js +0 -20
- package/dist/cli/commands/reorder.js.map +0 -1
- package/dist/cli/commands/reparent.d.ts +0 -10
- package/dist/cli/commands/reparent.d.ts.map +0 -1
- package/dist/cli/commands/reparent.js +0 -19
- package/dist/cli/commands/reparent.js.map +0 -1
- package/dist/cli/commands/research.d.ts +0 -8
- package/dist/cli/commands/research.d.ts.map +0 -1
- package/dist/cli/commands/research.js +0 -129
- package/dist/cli/commands/research.js.map +0 -1
- package/dist/cli/commands/restore.d.ts +0 -11
- package/dist/cli/commands/restore.d.ts.map +0 -1
- package/dist/cli/commands/restore.js +0 -225
- package/dist/cli/commands/restore.js.map +0 -1
- package/dist/cli/commands/roadmap.d.ts +0 -8
- package/dist/cli/commands/roadmap.d.ts.map +0 -1
- package/dist/cli/commands/roadmap.js +0 -21
- package/dist/cli/commands/roadmap.js.map +0 -1
- package/dist/cli/commands/safestop.d.ts +0 -14
- package/dist/cli/commands/safestop.d.ts.map +0 -1
- package/dist/cli/commands/safestop.js +0 -32
- package/dist/cli/commands/safestop.js.map +0 -1
- package/dist/cli/commands/self-update.d.ts +0 -15
- package/dist/cli/commands/self-update.d.ts.map +0 -1
- package/dist/cli/commands/self-update.js +0 -332
- package/dist/cli/commands/self-update.js.map +0 -1
- package/dist/cli/commands/sequence.d.ts +0 -8
- package/dist/cli/commands/sequence.d.ts.map +0 -1
- package/dist/cli/commands/sequence.js +0 -30
- package/dist/cli/commands/sequence.js.map +0 -1
- package/dist/cli/commands/session.d.ts +0 -12
- package/dist/cli/commands/session.d.ts.map +0 -1
- package/dist/cli/commands/session.js +0 -160
- package/dist/cli/commands/session.js.map +0 -1
- package/dist/cli/commands/show.d.ts +0 -13
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js +0 -20
- package/dist/cli/commands/show.js.map +0 -1
- package/dist/cli/commands/skills.d.ts +0 -13
- package/dist/cli/commands/skills.d.ts.map +0 -1
- package/dist/cli/commands/skills.js +0 -131
- package/dist/cli/commands/skills.js.map +0 -1
- package/dist/cli/commands/snapshot.d.ts +0 -9
- package/dist/cli/commands/snapshot.d.ts.map +0 -1
- package/dist/cli/commands/snapshot.js +0 -50
- package/dist/cli/commands/snapshot.js.map +0 -1
- package/dist/cli/commands/specification.d.ts +0 -13
- package/dist/cli/commands/specification.d.ts.map +0 -1
- package/dist/cli/commands/specification.js +0 -45
- package/dist/cli/commands/specification.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -13
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -20
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/stats.d.ts +0 -12
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -23
- package/dist/cli/commands/stats.js.map +0 -1
- package/dist/cli/commands/sticky.d.ts +0 -16
- package/dist/cli/commands/sticky.d.ts.map +0 -1
- package/dist/cli/commands/sticky.js +0 -211
- package/dist/cli/commands/sticky.js.map +0 -1
- package/dist/cli/commands/stop.d.ts +0 -13
- package/dist/cli/commands/stop.d.ts.map +0 -1
- package/dist/cli/commands/stop.js +0 -20
- package/dist/cli/commands/stop.js.map +0 -1
- package/dist/cli/commands/sync.d.ts +0 -13
- package/dist/cli/commands/sync.d.ts.map +0 -1
- package/dist/cli/commands/sync.js +0 -48
- package/dist/cli/commands/sync.js.map +0 -1
- package/dist/cli/commands/testing.d.ts +0 -13
- package/dist/cli/commands/testing.d.ts.map +0 -1
- package/dist/cli/commands/testing.js +0 -64
- package/dist/cli/commands/testing.js.map +0 -1
- package/dist/cli/commands/token.d.ts +0 -10
- package/dist/cli/commands/token.d.ts.map +0 -1
- package/dist/cli/commands/token.js +0 -135
- package/dist/cli/commands/token.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -12
- package/dist/cli/commands/update.d.ts.map +0 -1
- package/dist/cli/commands/update.js +0 -77
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/commands/upgrade.d.ts +0 -16
- package/dist/cli/commands/upgrade.d.ts.map +0 -1
- package/dist/cli/commands/upgrade.js +0 -74
- package/dist/cli/commands/upgrade.js.map +0 -1
- package/dist/cli/commands/validate.d.ts +0 -12
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -23
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/commands/verify.d.ts +0 -8
- package/dist/cli/commands/verify.d.ts.map +0 -1
- package/dist/cli/commands/verify.js +0 -28
- package/dist/cli/commands/verify.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -13
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -264
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/field-context.d.ts +0 -32
- package/dist/cli/field-context.d.ts.map +0 -1
- package/dist/cli/field-context.js +0 -47
- package/dist/cli/field-context.js.map +0 -1
- package/dist/cli/format-context.d.ts +0 -32
- package/dist/cli/format-context.d.ts.map +0 -1
- package/dist/cli/format-context.js +0 -50
- package/dist/cli/format-context.js.map +0 -1
- package/dist/cli/index.d.ts +0 -12
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/logger-bootstrap.d.ts +0 -6
- package/dist/cli/logger-bootstrap.d.ts.map +0 -1
- package/dist/cli/logger-bootstrap.js +0 -10
- package/dist/cli/logger-bootstrap.js.map +0 -1
- package/dist/cli/middleware/output-format.d.ts +0 -30
- package/dist/cli/middleware/output-format.d.ts.map +0 -1
- package/dist/cli/middleware/output-format.js +0 -35
- package/dist/cli/middleware/output-format.js.map +0 -1
- package/dist/cli/progress.d.ts +0 -84
- package/dist/cli/progress.d.ts.map +0 -1
- package/dist/cli/progress.js +0 -169
- package/dist/cli/progress.js.map +0 -1
- package/dist/cli/renderers/colors.d.ts +0 -32
- package/dist/cli/renderers/colors.d.ts.map +0 -1
- package/dist/cli/renderers/colors.js +0 -141
- package/dist/cli/renderers/colors.js.map +0 -1
- package/dist/cli/renderers/error.d.ts +0 -13
- package/dist/cli/renderers/error.d.ts.map +0 -1
- package/dist/cli/renderers/error.js +0 -42
- package/dist/cli/renderers/error.js.map +0 -1
- package/dist/cli/renderers/index.d.ts +0 -59
- package/dist/cli/renderers/index.d.ts.map +0 -1
- package/dist/cli/renderers/index.js +0 -184
- package/dist/cli/renderers/index.js.map +0 -1
- package/dist/cli/renderers/normalizer.d.ts +0 -21
- package/dist/cli/renderers/normalizer.d.ts.map +0 -1
- package/dist/cli/renderers/normalizer.js +0 -106
- package/dist/cli/renderers/normalizer.js.map +0 -1
- package/dist/cli/renderers/system.d.ts +0 -25
- package/dist/cli/renderers/system.d.ts.map +0 -1
- package/dist/cli/renderers/system.js +0 -416
- package/dist/cli/renderers/system.js.map +0 -1
- package/dist/cli/renderers/tasks.d.ts +0 -28
- package/dist/cli/renderers/tasks.d.ts.map +0 -1
- package/dist/cli/renderers/tasks.js +0 -308
- package/dist/cli/renderers/tasks.js.map +0 -1
- package/dist/dispatch/adapters/cli.d.ts +0 -67
- package/dist/dispatch/adapters/cli.d.ts.map +0 -1
- package/dist/dispatch/adapters/cli.js +0 -205
- package/dist/dispatch/adapters/cli.js.map +0 -1
- package/dist/dispatch/adapters/mcp.d.ts +0 -37
- package/dist/dispatch/adapters/mcp.d.ts.map +0 -1
- package/dist/dispatch/adapters/mcp.js +0 -122
- package/dist/dispatch/adapters/mcp.js.map +0 -1
- package/dist/dispatch/context/session-context.d.ts +0 -54
- package/dist/dispatch/context/session-context.d.ts.map +0 -1
- package/dist/dispatch/context/session-context.js +0 -61
- package/dist/dispatch/context/session-context.js.map +0 -1
- package/dist/dispatch/dispatcher.d.ts +0 -23
- package/dist/dispatch/dispatcher.d.ts.map +0 -1
- package/dist/dispatch/dispatcher.js +0 -84
- package/dist/dispatch/dispatcher.js.map +0 -1
- package/dist/dispatch/domains/_base.d.ts +0 -59
- package/dist/dispatch/domains/_base.d.ts.map +0 -1
- package/dist/dispatch/domains/_base.js +0 -77
- package/dist/dispatch/domains/_base.js.map +0 -1
- package/dist/dispatch/domains/_meta.d.ts +0 -23
- package/dist/dispatch/domains/_meta.d.ts.map +0 -1
- package/dist/dispatch/domains/_meta.js +0 -25
- package/dist/dispatch/domains/_meta.js.map +0 -1
- package/dist/dispatch/domains/_routing.d.ts +0 -8
- package/dist/dispatch/domains/_routing.d.ts.map +0 -1
- package/dist/dispatch/domains/_routing.js +0 -20
- package/dist/dispatch/domains/_routing.js.map +0 -1
- package/dist/dispatch/domains/admin.d.ts +0 -27
- package/dist/dispatch/domains/admin.d.ts.map +0 -1
- package/dist/dispatch/domains/admin.js +0 -672
- package/dist/dispatch/domains/admin.js.map +0 -1
- package/dist/dispatch/domains/check.d.ts +0 -24
- package/dist/dispatch/domains/check.d.ts.map +0 -1
- package/dist/dispatch/domains/check.js +0 -281
- package/dist/dispatch/domains/check.js.map +0 -1
- package/dist/dispatch/domains/index.d.ts +0 -26
- package/dist/dispatch/domains/index.d.ts.map +0 -1
- package/dist/dispatch/domains/index.js +0 -38
- package/dist/dispatch/domains/index.js.map +0 -1
- package/dist/dispatch/domains/memory.d.ts +0 -24
- package/dist/dispatch/domains/memory.d.ts.map +0 -1
- package/dist/dispatch/domains/memory.js +0 -305
- package/dist/dispatch/domains/memory.js.map +0 -1
- package/dist/dispatch/domains/nexus.d.ts +0 -24
- package/dist/dispatch/domains/nexus.d.ts.map +0 -1
- package/dist/dispatch/domains/nexus.js +0 -252
- package/dist/dispatch/domains/nexus.js.map +0 -1
- package/dist/dispatch/domains/orchestrate.d.ts +0 -21
- package/dist/dispatch/domains/orchestrate.d.ts.map +0 -1
- package/dist/dispatch/domains/orchestrate.js +0 -261
- package/dist/dispatch/domains/orchestrate.js.map +0 -1
- package/dist/dispatch/domains/pipeline.d.ts +0 -36
- package/dist/dispatch/domains/pipeline.d.ts.map +0 -1
- package/dist/dispatch/domains/pipeline.js +0 -554
- package/dist/dispatch/domains/pipeline.js.map +0 -1
- package/dist/dispatch/domains/session.d.ts +0 -24
- package/dist/dispatch/domains/session.d.ts.map +0 -1
- package/dist/dispatch/domains/session.js +0 -257
- package/dist/dispatch/domains/session.js.map +0 -1
- package/dist/dispatch/domains/sticky.d.ts +0 -22
- package/dist/dispatch/domains/sticky.d.ts.map +0 -1
- package/dist/dispatch/domains/sticky.js +0 -166
- package/dist/dispatch/domains/sticky.js.map +0 -1
- package/dist/dispatch/domains/tasks.d.ts +0 -26
- package/dist/dispatch/domains/tasks.d.ts.map +0 -1
- package/dist/dispatch/domains/tasks.js +0 -352
- package/dist/dispatch/domains/tasks.js.map +0 -1
- package/dist/dispatch/domains/tools.d.ts +0 -40
- package/dist/dispatch/domains/tools.d.ts.map +0 -1
- package/dist/dispatch/domains/tools.js +0 -497
- package/dist/dispatch/domains/tools.js.map +0 -1
- package/dist/dispatch/engines/_error.d.ts +0 -42
- package/dist/dispatch/engines/_error.d.ts.map +0 -1
- package/dist/dispatch/engines/_error.js +0 -201
- package/dist/dispatch/engines/_error.js.map +0 -1
- package/dist/dispatch/engines/codebase-map-engine.d.ts +0 -17
- package/dist/dispatch/engines/codebase-map-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/codebase-map-engine.js +0 -29
- package/dist/dispatch/engines/codebase-map-engine.js.map +0 -1
- package/dist/dispatch/engines/config-engine.d.ts +0 -21
- package/dist/dispatch/engines/config-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/config-engine.js +0 -45
- package/dist/dispatch/engines/config-engine.js.map +0 -1
- package/dist/dispatch/engines/hooks-engine.d.ts +0 -47
- package/dist/dispatch/engines/hooks-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/hooks-engine.js +0 -57
- package/dist/dispatch/engines/hooks-engine.js.map +0 -1
- package/dist/dispatch/engines/init-engine.d.ts +0 -43
- package/dist/dispatch/engines/init-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/init-engine.js +0 -73
- package/dist/dispatch/engines/init-engine.js.map +0 -1
- package/dist/dispatch/engines/lifecycle-engine.d.ts +0 -66
- package/dist/dispatch/engines/lifecycle-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/lifecycle-engine.js +0 -213
- package/dist/dispatch/engines/lifecycle-engine.js.map +0 -1
- package/dist/dispatch/engines/memory-engine.d.ts +0 -10
- package/dist/dispatch/engines/memory-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/memory-engine.js +0 -10
- package/dist/dispatch/engines/memory-engine.js.map +0 -1
- package/dist/dispatch/engines/nexus-engine.d.ts +0 -159
- package/dist/dispatch/engines/nexus-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/nexus-engine.js +0 -329
- package/dist/dispatch/engines/nexus-engine.js.map +0 -1
- package/dist/dispatch/engines/orchestrate-engine.d.ts +0 -133
- package/dist/dispatch/engines/orchestrate-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/orchestrate-engine.js +0 -770
- package/dist/dispatch/engines/orchestrate-engine.js.map +0 -1
- package/dist/dispatch/engines/pipeline-engine.d.ts +0 -51
- package/dist/dispatch/engines/pipeline-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/pipeline-engine.js +0 -192
- package/dist/dispatch/engines/pipeline-engine.js.map +0 -1
- package/dist/dispatch/engines/release-engine.d.ts +0 -94
- package/dist/dispatch/engines/release-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/release-engine.js +0 -670
- package/dist/dispatch/engines/release-engine.js.map +0 -1
- package/dist/dispatch/engines/session-engine.d.ts +0 -326
- package/dist/dispatch/engines/session-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/session-engine.js +0 -869
- package/dist/dispatch/engines/session-engine.js.map +0 -1
- package/dist/dispatch/engines/sticky-engine.d.ts +0 -100
- package/dist/dispatch/engines/sticky-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/sticky-engine.js +0 -181
- package/dist/dispatch/engines/sticky-engine.js.map +0 -1
- package/dist/dispatch/engines/system-engine.d.ts +0 -377
- package/dist/dispatch/engines/system-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/system-engine.js +0 -980
- package/dist/dispatch/engines/system-engine.js.map +0 -1
- package/dist/dispatch/engines/task-engine.d.ts +0 -584
- package/dist/dispatch/engines/task-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/task-engine.js +0 -881
- package/dist/dispatch/engines/task-engine.js.map +0 -1
- package/dist/dispatch/engines/template-parser.d.ts +0 -34
- package/dist/dispatch/engines/template-parser.d.ts.map +0 -1
- package/dist/dispatch/engines/template-parser.js +0 -57
- package/dist/dispatch/engines/template-parser.js.map +0 -1
- package/dist/dispatch/engines/tools-engine.d.ts +0 -285
- package/dist/dispatch/engines/tools-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/tools-engine.js +0 -676
- package/dist/dispatch/engines/tools-engine.js.map +0 -1
- package/dist/dispatch/engines/validate-engine.d.ts +0 -154
- package/dist/dispatch/engines/validate-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/validate-engine.js +0 -527
- package/dist/dispatch/engines/validate-engine.js.map +0 -1
- package/dist/dispatch/index.d.ts +0 -20
- package/dist/dispatch/index.d.ts.map +0 -1
- package/dist/dispatch/index.js +0 -19
- package/dist/dispatch/index.js.map +0 -1
- package/dist/dispatch/lib/capability-matrix.d.ts +0 -11
- package/dist/dispatch/lib/capability-matrix.d.ts.map +0 -1
- package/dist/dispatch/lib/capability-matrix.js +0 -10
- package/dist/dispatch/lib/capability-matrix.js.map +0 -1
- package/dist/dispatch/lib/config.d.ts +0 -16
- package/dist/dispatch/lib/config.d.ts.map +0 -1
- package/dist/dispatch/lib/config.js +0 -15
- package/dist/dispatch/lib/config.js.map +0 -1
- package/dist/dispatch/lib/engine.d.ts +0 -25
- package/dist/dispatch/lib/engine.d.ts.map +0 -1
- package/dist/dispatch/lib/engine.js +0 -44
- package/dist/dispatch/lib/engine.js.map +0 -1
- package/dist/dispatch/lib/meta.d.ts +0 -26
- package/dist/dispatch/lib/meta.d.ts.map +0 -1
- package/dist/dispatch/lib/meta.js +0 -37
- package/dist/dispatch/lib/meta.js.map +0 -1
- package/dist/dispatch/lib/param-utils.d.ts +0 -11
- package/dist/dispatch/lib/param-utils.d.ts.map +0 -1
- package/dist/dispatch/lib/param-utils.js +0 -10
- package/dist/dispatch/lib/param-utils.js.map +0 -1
- package/dist/dispatch/lib/projections.d.ts +0 -23
- package/dist/dispatch/lib/projections.d.ts.map +0 -1
- package/dist/dispatch/lib/projections.js +0 -48
- package/dist/dispatch/lib/projections.js.map +0 -1
- package/dist/dispatch/lib/schema-utils.d.ts +0 -42
- package/dist/dispatch/lib/schema-utils.d.ts.map +0 -1
- package/dist/dispatch/lib/schema-utils.js +0 -93
- package/dist/dispatch/lib/schema-utils.js.map +0 -1
- package/dist/dispatch/lib/security.d.ts +0 -12
- package/dist/dispatch/lib/security.d.ts.map +0 -1
- package/dist/dispatch/lib/security.js +0 -10
- package/dist/dispatch/lib/security.js.map +0 -1
- package/dist/dispatch/middleware/audit.d.ts +0 -23
- package/dist/dispatch/middleware/audit.d.ts.map +0 -1
- package/dist/dispatch/middleware/audit.js +0 -169
- package/dist/dispatch/middleware/audit.js.map +0 -1
- package/dist/dispatch/middleware/field-filter.d.ts +0 -24
- package/dist/dispatch/middleware/field-filter.d.ts.map +0 -1
- package/dist/dispatch/middleware/field-filter.js +0 -65
- package/dist/dispatch/middleware/field-filter.js.map +0 -1
- package/dist/dispatch/middleware/pipeline.d.ts +0 -20
- package/dist/dispatch/middleware/pipeline.d.ts.map +0 -1
- package/dist/dispatch/middleware/pipeline.js +0 -47
- package/dist/dispatch/middleware/pipeline.js.map +0 -1
- package/dist/dispatch/middleware/projection.d.ts +0 -35
- package/dist/dispatch/middleware/projection.d.ts.map +0 -1
- package/dist/dispatch/middleware/projection.js +0 -145
- package/dist/dispatch/middleware/projection.js.map +0 -1
- package/dist/dispatch/middleware/protocol-enforcement.d.ts +0 -12
- package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +0 -1
- package/dist/dispatch/middleware/protocol-enforcement.js +0 -30
- package/dist/dispatch/middleware/protocol-enforcement.js.map +0 -1
- package/dist/dispatch/middleware/rate-limiter.d.ts +0 -30
- package/dist/dispatch/middleware/rate-limiter.d.ts.map +0 -1
- package/dist/dispatch/middleware/rate-limiter.js +0 -101
- package/dist/dispatch/middleware/rate-limiter.js.map +0 -1
- package/dist/dispatch/middleware/sanitizer.d.ts +0 -10
- package/dist/dispatch/middleware/sanitizer.d.ts.map +0 -1
- package/dist/dispatch/middleware/sanitizer.js +0 -42
- package/dist/dispatch/middleware/sanitizer.js.map +0 -1
- package/dist/dispatch/middleware/session-resolver.d.ts +0 -26
- package/dist/dispatch/middleware/session-resolver.d.ts.map +0 -1
- package/dist/dispatch/middleware/session-resolver.js +0 -65
- package/dist/dispatch/middleware/session-resolver.js.map +0 -1
- package/dist/dispatch/middleware/verification-gates.d.ts +0 -3
- package/dist/dispatch/middleware/verification-gates.d.ts.map +0 -1
- package/dist/dispatch/middleware/verification-gates.js +0 -40
- package/dist/dispatch/middleware/verification-gates.js.map +0 -1
- package/dist/dispatch/registry.d.ts +0 -91
- package/dist/dispatch/registry.d.ts.map +0 -1
- package/dist/dispatch/registry.js +0 -2693
- package/dist/dispatch/registry.js.map +0 -1
- package/dist/dispatch/types.d.ts +0 -218
- package/dist/dispatch/types.d.ts.map +0 -1
- package/dist/dispatch/types.js +0 -25
- package/dist/dispatch/types.js.map +0 -1
- package/dist/mcp/gateways/mutate.d.ts +0 -146
- package/dist/mcp/gateways/mutate.d.ts.map +0 -1
- package/dist/mcp/gateways/mutate.js +0 -1016
- package/dist/mcp/gateways/mutate.js.map +0 -1
- package/dist/mcp/gateways/query.d.ts +0 -138
- package/dist/mcp/gateways/query.d.ts.map +0 -1
- package/dist/mcp/gateways/query.js +0 -186
- package/dist/mcp/gateways/query.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -16
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/lib/background-jobs.d.ts +0 -86
- package/dist/mcp/lib/background-jobs.d.ts.map +0 -1
- package/dist/mcp/lib/background-jobs.js +0 -183
- package/dist/mcp/lib/background-jobs.js.map +0 -1
- package/dist/mcp/lib/budget.d.ts +0 -35
- package/dist/mcp/lib/budget.d.ts.map +0 -1
- package/dist/mcp/lib/budget.js +0 -102
- package/dist/mcp/lib/budget.js.map +0 -1
- package/dist/mcp/lib/cache.d.ts +0 -78
- package/dist/mcp/lib/cache.d.ts.map +0 -1
- package/dist/mcp/lib/cache.js +0 -207
- package/dist/mcp/lib/cache.js.map +0 -1
- package/dist/mcp/lib/config.d.ts +0 -42
- package/dist/mcp/lib/config.d.ts.map +0 -1
- package/dist/mcp/lib/config.js +0 -241
- package/dist/mcp/lib/config.js.map +0 -1
- package/dist/mcp/lib/defaults.d.ts +0 -115
- package/dist/mcp/lib/defaults.d.ts.map +0 -1
- package/dist/mcp/lib/defaults.js +0 -61
- package/dist/mcp/lib/defaults.js.map +0 -1
- package/dist/mcp/lib/exit-codes.d.ts +0 -197
- package/dist/mcp/lib/exit-codes.d.ts.map +0 -1
- package/dist/mcp/lib/exit-codes.js +0 -1016
- package/dist/mcp/lib/exit-codes.js.map +0 -1
- package/dist/mcp/lib/gate-validators.d.ts +0 -13
- package/dist/mcp/lib/gate-validators.d.ts.map +0 -1
- package/dist/mcp/lib/gate-validators.js +0 -13
- package/dist/mcp/lib/gate-validators.js.map +0 -1
- package/dist/mcp/lib/gateway-meta.d.ts +0 -37
- package/dist/mcp/lib/gateway-meta.d.ts.map +0 -1
- package/dist/mcp/lib/gateway-meta.js +0 -50
- package/dist/mcp/lib/gateway-meta.js.map +0 -1
- package/dist/mcp/lib/job-manager-accessor.d.ts +0 -10
- package/dist/mcp/lib/job-manager-accessor.d.ts.map +0 -1
- package/dist/mcp/lib/job-manager-accessor.js +0 -14
- package/dist/mcp/lib/job-manager-accessor.js.map +0 -1
- package/dist/mcp/lib/protocol-enforcement.d.ts +0 -12
- package/dist/mcp/lib/protocol-enforcement.d.ts.map +0 -1
- package/dist/mcp/lib/protocol-enforcement.js +0 -12
- package/dist/mcp/lib/protocol-enforcement.js.map +0 -1
- package/dist/mcp/lib/protocol-rules.d.ts +0 -12
- package/dist/mcp/lib/protocol-rules.d.ts.map +0 -1
- package/dist/mcp/lib/protocol-rules.js +0 -12
- package/dist/mcp/lib/protocol-rules.js.map +0 -1
- package/dist/mcp/lib/rate-limiter.d.ts +0 -110
- package/dist/mcp/lib/rate-limiter.d.ts.map +0 -1
- package/dist/mcp/lib/rate-limiter.js +0 -208
- package/dist/mcp/lib/rate-limiter.js.map +0 -1
- package/dist/mcp/lib/router.d.ts +0 -58
- package/dist/mcp/lib/router.d.ts.map +0 -1
- package/dist/mcp/lib/router.js +0 -12
- package/dist/mcp/lib/router.js.map +0 -1
- package/dist/mcp/lib/security.d.ts +0 -161
- package/dist/mcp/lib/security.d.ts.map +0 -1
- package/dist/mcp/lib/security.js +0 -361
- package/dist/mcp/lib/security.js.map +0 -1
- package/dist/mcp/lib/verification-gates.d.ts +0 -13
- package/dist/mcp/lib/verification-gates.d.ts.map +0 -1
- package/dist/mcp/lib/verification-gates.js +0 -12
- package/dist/mcp/lib/verification-gates.js.map +0 -1
- package/dist/mcp/resources/budget.d.ts +0 -22
- package/dist/mcp/resources/budget.d.ts.map +0 -1
- package/dist/mcp/resources/budget.js +0 -46
- package/dist/mcp/resources/budget.js.map +0 -1
- package/dist/mcp/resources/index.d.ts +0 -53
- package/dist/mcp/resources/index.d.ts.map +0 -1
- package/dist/mcp/resources/index.js +0 -278
- package/dist/mcp/resources/index.js.map +0 -1
|
@@ -1,672 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admin Domain Handler (Dispatch Layer)
|
|
3
|
-
*
|
|
4
|
-
* Consolidates MCP system domain operations into the canonical "admin"
|
|
5
|
-
* domain. Handles version, health, config, stats, context, job management,
|
|
6
|
-
* dashboard, log, sequence, init, backup, restore, migrate, cleanup,
|
|
7
|
-
* safestop, inject.generate, token, adr, export, import, install.global,
|
|
8
|
-
* and context.inject.
|
|
9
|
-
*
|
|
10
|
-
* All operations delegate to native engine functions from system-engine,
|
|
11
|
-
* config-engine, and init-engine.
|
|
12
|
-
*
|
|
13
|
-
* @epic T4820
|
|
14
|
-
* @task T5671
|
|
15
|
-
*/
|
|
16
|
-
import { clearTokenUsage, computeHelp, deleteTokenUsage, exportSnapshot, exportTasks, exportTasksPackage, findAdrs, getDefaultSnapshotPath, getLogger, getProjectRoot, importSnapshot, importTasks, importTasksPackage, listAdrs, listTokenUsage, paginate, readSnapshot, recordTokenExchange, showAdr, showTokenUsage, summarizeTokenUsage, syncAdrsToDb, validateAllAdrs, writeSnapshot, } from '@cleocode/core/internal';
|
|
17
|
-
import { backupRestore, configGet, configSet, getVersion, initProject, sessionContextInject, systemBackup, systemCleanup, systemContext, systemDash, systemDoctor, systemFix, systemHealth, systemInjectGenerate, systemLog, systemMigrate, systemRestore, systemRuntime, systemSafestop, systemSequence, systemStats, } from '../lib/engine.js';
|
|
18
|
-
import { OPERATIONS } from '../registry.js';
|
|
19
|
-
import { errorResult, getListParams, handleErrorResult, unsupportedOp, wrapResult, } from './_base.js';
|
|
20
|
-
import { dispatchMeta } from './_meta.js';
|
|
21
|
-
import { routeByParam } from './_routing.js';
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// AdminHandler
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
export class AdminHandler {
|
|
26
|
-
projectRoot;
|
|
27
|
-
constructor() {
|
|
28
|
-
this.projectRoot = getProjectRoot();
|
|
29
|
-
}
|
|
30
|
-
// -----------------------------------------------------------------------
|
|
31
|
-
// Query
|
|
32
|
-
// -----------------------------------------------------------------------
|
|
33
|
-
async query(operation, params) {
|
|
34
|
-
const startTime = Date.now();
|
|
35
|
-
try {
|
|
36
|
-
switch (operation) {
|
|
37
|
-
case 'version': {
|
|
38
|
-
const result = await getVersion(this.projectRoot);
|
|
39
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
40
|
-
}
|
|
41
|
-
case 'health': {
|
|
42
|
-
const mode = params?.mode;
|
|
43
|
-
if (mode === 'diagnose') {
|
|
44
|
-
const result = await systemDoctor(this.projectRoot);
|
|
45
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
46
|
-
}
|
|
47
|
-
const result = systemHealth(this.projectRoot, params);
|
|
48
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
49
|
-
}
|
|
50
|
-
case 'config.show': {
|
|
51
|
-
const result = await configGet(this.projectRoot, params?.key);
|
|
52
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
53
|
-
}
|
|
54
|
-
case 'stats': {
|
|
55
|
-
const result = await systemStats(this.projectRoot, params);
|
|
56
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
57
|
-
}
|
|
58
|
-
case 'context': {
|
|
59
|
-
const result = systemContext(this.projectRoot, params);
|
|
60
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
61
|
-
}
|
|
62
|
-
case 'runtime': {
|
|
63
|
-
const result = await systemRuntime(this.projectRoot, params);
|
|
64
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
65
|
-
}
|
|
66
|
-
// Merged: job.status + job.list → job via action param (T5615)
|
|
67
|
-
case 'job': {
|
|
68
|
-
return routeByParam(params, 'action', {
|
|
69
|
-
status: async () => {
|
|
70
|
-
const { getJobManager } = await import('../../mcp/lib/job-manager-accessor.js');
|
|
71
|
-
const manager = getJobManager();
|
|
72
|
-
if (!manager) {
|
|
73
|
-
return errorResult('query', 'admin', operation, 'E_NOT_AVAILABLE', 'Job manager not initialized', startTime);
|
|
74
|
-
}
|
|
75
|
-
const jobId = params?.jobId;
|
|
76
|
-
if (!jobId) {
|
|
77
|
-
return errorResult('query', 'admin', operation, 'E_INVALID_INPUT', 'jobId is required', startTime);
|
|
78
|
-
}
|
|
79
|
-
const job = manager.getJob(jobId);
|
|
80
|
-
if (!job) {
|
|
81
|
-
return errorResult('query', 'admin', operation, 'E_NOT_FOUND', `Job ${jobId} not found`, startTime);
|
|
82
|
-
}
|
|
83
|
-
return wrapResult({ success: true, data: job }, 'query', 'admin', operation, startTime);
|
|
84
|
-
},
|
|
85
|
-
list: async () => {
|
|
86
|
-
const { getJobManager } = await import('../../mcp/lib/job-manager-accessor.js');
|
|
87
|
-
const mgr = getJobManager();
|
|
88
|
-
if (!mgr) {
|
|
89
|
-
return errorResult('query', 'admin', operation, 'E_NOT_AVAILABLE', 'Job manager not initialized', startTime);
|
|
90
|
-
}
|
|
91
|
-
const statusFilter = params?.status;
|
|
92
|
-
const { limit, offset } = getListParams(params);
|
|
93
|
-
const allJobs = mgr.listJobs();
|
|
94
|
-
const filteredJobs = statusFilter ? mgr.listJobs(statusFilter) : allJobs;
|
|
95
|
-
const page = paginate(filteredJobs, limit, offset);
|
|
96
|
-
return wrapResult({
|
|
97
|
-
success: true,
|
|
98
|
-
data: {
|
|
99
|
-
jobs: page.items,
|
|
100
|
-
count: filteredJobs.length,
|
|
101
|
-
total: allJobs.length,
|
|
102
|
-
filtered: filteredJobs.length,
|
|
103
|
-
},
|
|
104
|
-
page: page.page,
|
|
105
|
-
}, 'query', 'admin', operation, startTime);
|
|
106
|
-
},
|
|
107
|
-
}, 'status');
|
|
108
|
-
}
|
|
109
|
-
case 'dash': {
|
|
110
|
-
const blockedTasksLimit = typeof params?.blockedTasksLimit === 'number' ? params.blockedTasksLimit : undefined;
|
|
111
|
-
const result = await systemDash(this.projectRoot, { blockedTasksLimit });
|
|
112
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
113
|
-
}
|
|
114
|
-
case 'log': {
|
|
115
|
-
const result = await systemLog(this.projectRoot, params);
|
|
116
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
117
|
-
}
|
|
118
|
-
case 'sequence': {
|
|
119
|
-
const action = params?.action;
|
|
120
|
-
if (action && action !== 'show' && action !== 'check') {
|
|
121
|
-
return errorResult('query', 'admin', operation, 'E_INVALID_INPUT', 'action must be show or check', startTime);
|
|
122
|
-
}
|
|
123
|
-
const result = await systemSequence(this.projectRoot, {
|
|
124
|
-
action: action,
|
|
125
|
-
});
|
|
126
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
127
|
-
}
|
|
128
|
-
case 'help': {
|
|
129
|
-
const tier = typeof params?.tier === 'number' ? params.tier : 0;
|
|
130
|
-
const verbose = params?.verbose === true;
|
|
131
|
-
const helpResult = computeHelp(OPERATIONS, tier, verbose);
|
|
132
|
-
return {
|
|
133
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
134
|
-
success: true,
|
|
135
|
-
data: helpResult,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
case 'adr.find': {
|
|
139
|
-
const query = params?.query;
|
|
140
|
-
if (query) {
|
|
141
|
-
const result = await findAdrs(this.projectRoot, query, {
|
|
142
|
-
topics: params?.topics,
|
|
143
|
-
keywords: params?.keywords,
|
|
144
|
-
status: params?.status,
|
|
145
|
-
});
|
|
146
|
-
return {
|
|
147
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
148
|
-
success: true,
|
|
149
|
-
data: result,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
// No query — list all ADRs
|
|
153
|
-
const { limit, offset } = getListParams(params);
|
|
154
|
-
const result = await listAdrs(this.projectRoot, {
|
|
155
|
-
status: params?.status,
|
|
156
|
-
since: params?.since,
|
|
157
|
-
limit,
|
|
158
|
-
offset,
|
|
159
|
-
});
|
|
160
|
-
return {
|
|
161
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
162
|
-
success: true,
|
|
163
|
-
data: result,
|
|
164
|
-
page: paginate(Array.from({ length: result.filtered }), limit, offset).page,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
case 'adr.show': {
|
|
168
|
-
const adrId = params?.adrId;
|
|
169
|
-
if (!adrId) {
|
|
170
|
-
return errorResult('query', 'admin', operation, 'E_INVALID_INPUT', 'adrId is required', startTime);
|
|
171
|
-
}
|
|
172
|
-
const adr = await showAdr(this.projectRoot, adrId);
|
|
173
|
-
if (!adr) {
|
|
174
|
-
return errorResult('query', 'admin', operation, 'E_NOT_FOUND', `ADR not found: ${adrId}`, startTime);
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
178
|
-
success: true,
|
|
179
|
-
data: adr,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
// Merged: token.summary + token.list + token.show → token via action param (T5615)
|
|
183
|
-
case 'token': {
|
|
184
|
-
return routeByParam(params, 'action', {
|
|
185
|
-
summary: async () => {
|
|
186
|
-
const result = await summarizeTokenUsage({
|
|
187
|
-
provider: params?.provider,
|
|
188
|
-
transport: params?.transport,
|
|
189
|
-
gateway: params?.gateway,
|
|
190
|
-
domain: params?.domain,
|
|
191
|
-
operation: params?.operationName,
|
|
192
|
-
sessionId: params?.sessionId,
|
|
193
|
-
taskId: params?.taskId,
|
|
194
|
-
method: params?.method,
|
|
195
|
-
confidence: params?.confidence,
|
|
196
|
-
requestId: params?.requestId,
|
|
197
|
-
since: params?.since,
|
|
198
|
-
until: params?.until,
|
|
199
|
-
}, this.projectRoot);
|
|
200
|
-
return {
|
|
201
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
202
|
-
success: true,
|
|
203
|
-
data: result,
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
list: async () => {
|
|
207
|
-
const { limit, offset } = getListParams(params);
|
|
208
|
-
const result = await listTokenUsage({
|
|
209
|
-
provider: params?.provider,
|
|
210
|
-
transport: params?.transport,
|
|
211
|
-
gateway: params?.gateway,
|
|
212
|
-
domain: params?.domain,
|
|
213
|
-
operation: params?.operationName,
|
|
214
|
-
sessionId: params?.sessionId,
|
|
215
|
-
taskId: params?.taskId,
|
|
216
|
-
method: params?.method,
|
|
217
|
-
confidence: params?.confidence,
|
|
218
|
-
requestId: params?.requestId,
|
|
219
|
-
since: params?.since,
|
|
220
|
-
until: params?.until,
|
|
221
|
-
limit,
|
|
222
|
-
offset,
|
|
223
|
-
}, this.projectRoot);
|
|
224
|
-
return {
|
|
225
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
226
|
-
success: true,
|
|
227
|
-
data: {
|
|
228
|
-
records: result.records,
|
|
229
|
-
total: result.total,
|
|
230
|
-
filtered: result.filtered,
|
|
231
|
-
},
|
|
232
|
-
page: paginate(Array.from({ length: result.filtered }), limit, offset).page,
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
show: async () => {
|
|
236
|
-
const tokenId = params?.tokenId;
|
|
237
|
-
if (!tokenId) {
|
|
238
|
-
return errorResult('query', 'admin', operation, 'E_INVALID_INPUT', 'tokenId is required', startTime);
|
|
239
|
-
}
|
|
240
|
-
const result = await showTokenUsage(tokenId, this.projectRoot);
|
|
241
|
-
if (!result) {
|
|
242
|
-
return errorResult('query', 'admin', operation, 'E_NOT_FOUND', `Token usage record not found: ${tokenId}`, startTime);
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
246
|
-
success: true,
|
|
247
|
-
data: result,
|
|
248
|
-
};
|
|
249
|
-
},
|
|
250
|
-
}, 'summary');
|
|
251
|
-
}
|
|
252
|
-
// Merged: export + snapshot.export + export.tasks → export via scope param (T5615)
|
|
253
|
-
case 'export': {
|
|
254
|
-
const scope = params?.scope;
|
|
255
|
-
if (scope === 'snapshot') {
|
|
256
|
-
const snapshot = await exportSnapshot(this.projectRoot);
|
|
257
|
-
const outputPath = params?.output ?? getDefaultSnapshotPath(this.projectRoot);
|
|
258
|
-
await writeSnapshot(snapshot, outputPath);
|
|
259
|
-
return {
|
|
260
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
261
|
-
success: true,
|
|
262
|
-
data: {
|
|
263
|
-
exported: true,
|
|
264
|
-
taskCount: snapshot._meta.taskCount,
|
|
265
|
-
outputPath,
|
|
266
|
-
checksum: snapshot._meta.checksum,
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
if (scope === 'tasks') {
|
|
271
|
-
const result = await exportTasksPackage({
|
|
272
|
-
taskIds: params?.taskIds,
|
|
273
|
-
output: params?.output,
|
|
274
|
-
subtree: params?.subtree,
|
|
275
|
-
filter: params?.filter,
|
|
276
|
-
includeDeps: params?.includeDeps,
|
|
277
|
-
dryRun: params?.dryRun,
|
|
278
|
-
cwd: this.projectRoot,
|
|
279
|
-
});
|
|
280
|
-
return {
|
|
281
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
282
|
-
success: true,
|
|
283
|
-
data: result,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
// Default: standard export
|
|
287
|
-
const result = await exportTasks({
|
|
288
|
-
format: params?.format,
|
|
289
|
-
output: params?.output,
|
|
290
|
-
status: params?.status,
|
|
291
|
-
parent: params?.parent,
|
|
292
|
-
phase: params?.phase,
|
|
293
|
-
cwd: this.projectRoot,
|
|
294
|
-
});
|
|
295
|
-
return {
|
|
296
|
-
_meta: dispatchMeta('query', 'admin', operation, startTime),
|
|
297
|
-
success: true,
|
|
298
|
-
data: result,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
case 'map': {
|
|
302
|
-
const { mapCodebase } = await import('../engines/codebase-map-engine.js');
|
|
303
|
-
const result = await mapCodebase(this.projectRoot, {
|
|
304
|
-
focus: params?.focus,
|
|
305
|
-
storeToBrain: false,
|
|
306
|
-
});
|
|
307
|
-
return wrapResult(result, 'query', 'admin', operation, startTime);
|
|
308
|
-
}
|
|
309
|
-
default:
|
|
310
|
-
return unsupportedOp('query', 'admin', operation, startTime);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
catch (error) {
|
|
314
|
-
getLogger('domain:admin').error({ gateway: 'query', domain: 'admin', operation, err: error }, error instanceof Error ? error.message : String(error));
|
|
315
|
-
return handleErrorResult('query', 'admin', operation, error, startTime);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
// -----------------------------------------------------------------------
|
|
319
|
-
// Mutate
|
|
320
|
-
// -----------------------------------------------------------------------
|
|
321
|
-
async mutate(operation, params) {
|
|
322
|
-
const startTime = Date.now();
|
|
323
|
-
try {
|
|
324
|
-
switch (operation) {
|
|
325
|
-
case 'init': {
|
|
326
|
-
const result = await initProject(this.projectRoot, params);
|
|
327
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
328
|
-
}
|
|
329
|
-
// Merged: health (mutate) absorbs fix and doctor via mode param (T5615)
|
|
330
|
-
case 'health': {
|
|
331
|
-
const mode = params?.mode;
|
|
332
|
-
if (mode === 'diagnose') {
|
|
333
|
-
const result = await systemDoctor(this.projectRoot);
|
|
334
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
335
|
-
}
|
|
336
|
-
// Default: repair mode
|
|
337
|
-
const result = await systemFix(this.projectRoot);
|
|
338
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
339
|
-
}
|
|
340
|
-
case 'config.set': {
|
|
341
|
-
const key = params?.key;
|
|
342
|
-
if (!key) {
|
|
343
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'key is required', startTime);
|
|
344
|
-
}
|
|
345
|
-
const result = await configSet(this.projectRoot, key, params?.value);
|
|
346
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
347
|
-
}
|
|
348
|
-
// Merged: backup absorbs restore and backup.restore via action param (T5615)
|
|
349
|
-
case 'backup': {
|
|
350
|
-
const action = params?.action;
|
|
351
|
-
if (action === 'restore') {
|
|
352
|
-
const backupId = params?.backupId;
|
|
353
|
-
if (!backupId) {
|
|
354
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'backupId is required', startTime);
|
|
355
|
-
}
|
|
356
|
-
const result = systemRestore(this.projectRoot, {
|
|
357
|
-
backupId,
|
|
358
|
-
force: params?.force,
|
|
359
|
-
});
|
|
360
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
361
|
-
}
|
|
362
|
-
if (action === 'restore.file') {
|
|
363
|
-
const file = params?.file;
|
|
364
|
-
if (!file) {
|
|
365
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'file is required', startTime);
|
|
366
|
-
}
|
|
367
|
-
const result = await backupRestore(this.projectRoot, file, {
|
|
368
|
-
dryRun: params?.dryRun,
|
|
369
|
-
});
|
|
370
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
371
|
-
}
|
|
372
|
-
// Default: create backup
|
|
373
|
-
const result = systemBackup(this.projectRoot, params);
|
|
374
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
375
|
-
}
|
|
376
|
-
case 'migrate': {
|
|
377
|
-
const result = await systemMigrate(this.projectRoot, params);
|
|
378
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
379
|
-
}
|
|
380
|
-
case 'cleanup': {
|
|
381
|
-
const target = params?.target;
|
|
382
|
-
if (!target) {
|
|
383
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'target is required', startTime);
|
|
384
|
-
}
|
|
385
|
-
const result = await systemCleanup(this.projectRoot, {
|
|
386
|
-
target,
|
|
387
|
-
olderThan: params?.olderThan,
|
|
388
|
-
dryRun: params?.dryRun,
|
|
389
|
-
});
|
|
390
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
391
|
-
}
|
|
392
|
-
case 'job.cancel': {
|
|
393
|
-
const { getJobManager } = await import('../../mcp/lib/job-manager-accessor.js');
|
|
394
|
-
const mgr = getJobManager();
|
|
395
|
-
if (!mgr) {
|
|
396
|
-
return errorResult('mutate', 'admin', operation, 'E_NOT_AVAILABLE', 'Job manager not initialized', startTime);
|
|
397
|
-
}
|
|
398
|
-
const jobId = params?.jobId;
|
|
399
|
-
if (!jobId) {
|
|
400
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'jobId is required', startTime);
|
|
401
|
-
}
|
|
402
|
-
const cancelled = mgr.cancelJob(jobId);
|
|
403
|
-
if (!cancelled) {
|
|
404
|
-
return errorResult('mutate', 'admin', operation, 'E_NOT_FOUND', `Job ${jobId} not found or not running`, startTime);
|
|
405
|
-
}
|
|
406
|
-
return wrapResult({ success: true, data: { jobId, cancelled: true } }, 'mutate', 'admin', operation, startTime);
|
|
407
|
-
}
|
|
408
|
-
case 'safestop': {
|
|
409
|
-
const result = systemSafestop(this.projectRoot, params);
|
|
410
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
411
|
-
}
|
|
412
|
-
case 'inject.generate': {
|
|
413
|
-
const result = await systemInjectGenerate(this.projectRoot);
|
|
414
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
415
|
-
}
|
|
416
|
-
// adr.sync absorbs adr.validate via validate flag (T5615)
|
|
417
|
-
case 'adr.sync': {
|
|
418
|
-
const validate = params?.validate;
|
|
419
|
-
if (validate) {
|
|
420
|
-
const result = await validateAllAdrs(this.projectRoot);
|
|
421
|
-
return {
|
|
422
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
423
|
-
success: result.valid,
|
|
424
|
-
data: result,
|
|
425
|
-
...(result.valid
|
|
426
|
-
? {}
|
|
427
|
-
: {
|
|
428
|
-
error: {
|
|
429
|
-
code: 'E_ADR_VALIDATION',
|
|
430
|
-
message: `${result.errors.length} ADR validation error(s) found`,
|
|
431
|
-
},
|
|
432
|
-
}),
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
const result = await syncAdrsToDb(this.projectRoot);
|
|
436
|
-
return {
|
|
437
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
438
|
-
success: true,
|
|
439
|
-
data: result,
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
// Merged: import + snapshot.import + import.tasks → import via scope param (T5615)
|
|
443
|
-
case 'import': {
|
|
444
|
-
const scope = params?.scope;
|
|
445
|
-
if (scope === 'snapshot') {
|
|
446
|
-
const file = params?.file;
|
|
447
|
-
if (!file) {
|
|
448
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'file is required', startTime);
|
|
449
|
-
}
|
|
450
|
-
const snapshot = await readSnapshot(file);
|
|
451
|
-
if (params?.dryRun) {
|
|
452
|
-
return {
|
|
453
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
454
|
-
success: true,
|
|
455
|
-
data: {
|
|
456
|
-
dryRun: true,
|
|
457
|
-
source: snapshot._meta.source,
|
|
458
|
-
taskCount: snapshot._meta.taskCount,
|
|
459
|
-
createdAt: snapshot._meta.createdAt,
|
|
460
|
-
},
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
const result = await importSnapshot(snapshot, this.projectRoot);
|
|
464
|
-
return {
|
|
465
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
466
|
-
success: true,
|
|
467
|
-
data: {
|
|
468
|
-
imported: true,
|
|
469
|
-
added: result.added,
|
|
470
|
-
updated: result.updated,
|
|
471
|
-
skipped: result.skipped,
|
|
472
|
-
conflicts: result.conflicts.length > 0 ? result.conflicts : undefined,
|
|
473
|
-
},
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
if (scope === 'tasks') {
|
|
477
|
-
const file = params?.file;
|
|
478
|
-
if (!file) {
|
|
479
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'file is required', startTime);
|
|
480
|
-
}
|
|
481
|
-
const result = await importTasksPackage({
|
|
482
|
-
file,
|
|
483
|
-
dryRun: params?.dryRun,
|
|
484
|
-
parent: params?.parent,
|
|
485
|
-
phase: params?.phase,
|
|
486
|
-
addLabel: params?.addLabel,
|
|
487
|
-
provenance: params?.provenance,
|
|
488
|
-
resetStatus: params?.resetStatus,
|
|
489
|
-
onConflict: params?.onConflict,
|
|
490
|
-
onMissingDep: params?.onMissingDep,
|
|
491
|
-
force: params?.force,
|
|
492
|
-
cwd: this.projectRoot,
|
|
493
|
-
});
|
|
494
|
-
return {
|
|
495
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
496
|
-
success: true,
|
|
497
|
-
data: result,
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
// Default: standard import
|
|
501
|
-
const file = params?.file;
|
|
502
|
-
if (!file) {
|
|
503
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'file is required', startTime);
|
|
504
|
-
}
|
|
505
|
-
const result = await importTasks({
|
|
506
|
-
file,
|
|
507
|
-
parent: params?.parent,
|
|
508
|
-
phase: params?.phase,
|
|
509
|
-
onDuplicate: params?.onDuplicate,
|
|
510
|
-
addLabel: params?.addLabel,
|
|
511
|
-
dryRun: params?.dryRun,
|
|
512
|
-
cwd: this.projectRoot,
|
|
513
|
-
});
|
|
514
|
-
return {
|
|
515
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
516
|
-
success: true,
|
|
517
|
-
data: result,
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
case 'detect': {
|
|
521
|
-
const { ensureProjectContext, ensureContributorMcp } = await import('@cleocode/core/internal');
|
|
522
|
-
const contextResult = await ensureProjectContext(this.projectRoot, { force: true });
|
|
523
|
-
const mcpResult = await ensureContributorMcp(this.projectRoot);
|
|
524
|
-
return wrapResult({
|
|
525
|
-
success: true,
|
|
526
|
-
data: { context: contextResult, mcp: mcpResult },
|
|
527
|
-
}, 'mutate', 'admin', operation, startTime);
|
|
528
|
-
}
|
|
529
|
-
// Merged: token.record + token.delete + token.clear → token via action param (T5615)
|
|
530
|
-
case 'token': {
|
|
531
|
-
return routeByParam(params, 'action', {
|
|
532
|
-
record: async () => {
|
|
533
|
-
const result = await recordTokenExchange({
|
|
534
|
-
provider: params?.provider,
|
|
535
|
-
model: params?.model,
|
|
536
|
-
transport: params?.transport,
|
|
537
|
-
gateway: params?.gateway,
|
|
538
|
-
domain: params?.domain,
|
|
539
|
-
operation: params?.operationName,
|
|
540
|
-
sessionId: params?.sessionId,
|
|
541
|
-
taskId: params?.taskId,
|
|
542
|
-
requestId: params?.requestId,
|
|
543
|
-
requestPayload: params?.requestPayload,
|
|
544
|
-
responsePayload: params?.responsePayload,
|
|
545
|
-
metadata: params?.metadata,
|
|
546
|
-
cwd: this.projectRoot,
|
|
547
|
-
});
|
|
548
|
-
return {
|
|
549
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
550
|
-
success: true,
|
|
551
|
-
data: result,
|
|
552
|
-
};
|
|
553
|
-
},
|
|
554
|
-
delete: async () => {
|
|
555
|
-
const tokenId = params?.tokenId;
|
|
556
|
-
if (!tokenId) {
|
|
557
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'tokenId is required', startTime);
|
|
558
|
-
}
|
|
559
|
-
const result = await deleteTokenUsage(tokenId, this.projectRoot);
|
|
560
|
-
return {
|
|
561
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
562
|
-
success: true,
|
|
563
|
-
data: result,
|
|
564
|
-
};
|
|
565
|
-
},
|
|
566
|
-
clear: async () => {
|
|
567
|
-
const result = await clearTokenUsage({
|
|
568
|
-
provider: params?.provider,
|
|
569
|
-
transport: params?.transport,
|
|
570
|
-
gateway: params?.gateway,
|
|
571
|
-
domain: params?.domain,
|
|
572
|
-
operation: params?.operationName,
|
|
573
|
-
sessionId: params?.sessionId,
|
|
574
|
-
taskId: params?.taskId,
|
|
575
|
-
method: params?.method,
|
|
576
|
-
confidence: params?.confidence,
|
|
577
|
-
requestId: params?.requestId,
|
|
578
|
-
since: params?.since,
|
|
579
|
-
until: params?.until,
|
|
580
|
-
}, this.projectRoot);
|
|
581
|
-
return {
|
|
582
|
-
_meta: dispatchMeta('mutate', 'admin', operation, startTime),
|
|
583
|
-
success: true,
|
|
584
|
-
data: result,
|
|
585
|
-
};
|
|
586
|
-
},
|
|
587
|
-
}, 'record');
|
|
588
|
-
}
|
|
589
|
-
// admin.context.inject — moved from session domain (T5615)
|
|
590
|
-
case 'context.inject': {
|
|
591
|
-
const protocolType = params?.protocolType;
|
|
592
|
-
if (!protocolType) {
|
|
593
|
-
return errorResult('mutate', 'admin', operation, 'E_INVALID_INPUT', 'protocolType is required', startTime);
|
|
594
|
-
}
|
|
595
|
-
const result = sessionContextInject(protocolType, {
|
|
596
|
-
taskId: params?.taskId,
|
|
597
|
-
variant: params?.variant,
|
|
598
|
-
}, this.projectRoot);
|
|
599
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
600
|
-
}
|
|
601
|
-
case 'map': {
|
|
602
|
-
const { mapCodebase } = await import('../engines/codebase-map-engine.js');
|
|
603
|
-
const result = await mapCodebase(this.projectRoot, {
|
|
604
|
-
focus: params?.focus,
|
|
605
|
-
storeToBrain: true,
|
|
606
|
-
});
|
|
607
|
-
return wrapResult(result, 'mutate', 'admin', operation, startTime);
|
|
608
|
-
}
|
|
609
|
-
// admin.install.global — refresh global CLEO setup (T4916)
|
|
610
|
-
case 'install.global': {
|
|
611
|
-
const { ensureGlobalScaffold, ensureGlobalTemplates } = await import('@cleocode/core/internal');
|
|
612
|
-
const scaffoldResult = await ensureGlobalScaffold();
|
|
613
|
-
const templateResult = await ensureGlobalTemplates();
|
|
614
|
-
return wrapResult({
|
|
615
|
-
success: true,
|
|
616
|
-
data: { scaffold: scaffoldResult, templates: templateResult },
|
|
617
|
-
}, 'mutate', 'admin', operation, startTime);
|
|
618
|
-
}
|
|
619
|
-
default:
|
|
620
|
-
return unsupportedOp('mutate', 'admin', operation, startTime);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
catch (error) {
|
|
624
|
-
getLogger('domain:admin').error({ gateway: 'mutate', domain: 'admin', operation, err: error }, error instanceof Error ? error.message : String(error));
|
|
625
|
-
return handleErrorResult('mutate', 'admin', operation, error, startTime);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
// -----------------------------------------------------------------------
|
|
629
|
-
// Supported operations
|
|
630
|
-
// -----------------------------------------------------------------------
|
|
631
|
-
getSupportedOperations() {
|
|
632
|
-
return {
|
|
633
|
-
query: [
|
|
634
|
-
'version',
|
|
635
|
-
'health',
|
|
636
|
-
'config.show',
|
|
637
|
-
'stats',
|
|
638
|
-
'context',
|
|
639
|
-
'runtime',
|
|
640
|
-
'job',
|
|
641
|
-
'dash',
|
|
642
|
-
'log',
|
|
643
|
-
'sequence',
|
|
644
|
-
'help',
|
|
645
|
-
'token',
|
|
646
|
-
'adr.show',
|
|
647
|
-
'adr.find',
|
|
648
|
-
'export',
|
|
649
|
-
'map',
|
|
650
|
-
],
|
|
651
|
-
mutate: [
|
|
652
|
-
'init',
|
|
653
|
-
'config.set',
|
|
654
|
-
'backup',
|
|
655
|
-
'migrate',
|
|
656
|
-
'cleanup',
|
|
657
|
-
'job.cancel',
|
|
658
|
-
'safestop',
|
|
659
|
-
'inject.generate',
|
|
660
|
-
'install.global',
|
|
661
|
-
'token',
|
|
662
|
-
'adr.sync',
|
|
663
|
-
'health',
|
|
664
|
-
'context.inject',
|
|
665
|
-
'import',
|
|
666
|
-
'detect',
|
|
667
|
-
'map',
|
|
668
|
-
],
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
//# sourceMappingURL=admin.js.map
|