@cleocode/core 2026.4.0 → 2026.4.3
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/audit.d.ts +1 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +2 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/caamp/adapter.d.ts +6 -49
- package/dist/caamp/adapter.d.ts.map +1 -1
- package/dist/caamp/index.d.ts +2 -2
- package/dist/caamp/index.d.ts.map +1 -1
- package/dist/code/parser.d.ts +2 -0
- package/dist/code/parser.d.ts.map +1 -1
- package/dist/compliance/protocol-enforcement.d.ts +1 -1
- package/dist/compliance/protocol-rules.d.ts +1 -1
- package/dist/compliance/protocol-types.d.ts +2 -3
- package/dist/compliance/protocol-types.d.ts.map +1 -1
- package/dist/conduit/conduit-client.d.ts +5 -0
- package/dist/conduit/conduit-client.d.ts.map +1 -1
- package/dist/conduit/factory.d.ts +9 -1
- package/dist/conduit/factory.d.ts.map +1 -1
- package/dist/conduit/http-transport.d.ts +1 -1
- package/dist/conduit/http-transport.d.ts.map +1 -1
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/error-catalog.d.ts +3 -3
- package/dist/error-catalog.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/hooks/handlers/index.d.ts +2 -2
- package/dist/hooks/handlers/index.d.ts.map +1 -1
- package/dist/hooks/handlers/notification-hooks.d.ts +31 -0
- package/dist/hooks/handlers/notification-hooks.d.ts.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +863 -1044
- package/dist/index.js.map +4 -4
- package/dist/init.d.ts +6 -6
- package/dist/init.d.ts.map +1 -1
- package/dist/injection.d.ts.map +1 -1
- package/dist/internal.d.ts +5 -5
- package/dist/internal.d.ts.map +1 -1
- package/dist/logger.d.ts +3 -3
- package/dist/memory/brain-retrieval.d.ts +1 -1
- package/dist/memory/engine-compat.d.ts +392 -25
- package/dist/memory/engine-compat.d.ts.map +1 -1
- package/dist/memory/index.d.ts +416 -3
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/metrics/token-service.d.ts +3 -3
- package/dist/metrics/token-service.d.ts.map +1 -1
- package/dist/paths.d.ts +335 -2
- package/dist/paths.d.ts.map +1 -1
- package/dist/routing/capability-matrix.d.ts +3 -3
- package/dist/routing/capability-matrix.d.ts.map +1 -1
- package/dist/scaffold.d.ts +422 -11
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/security/input-sanitization.d.ts +2 -2
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/skills/dynamic-skill-generator.d.ts +3 -2
- package/dist/skills/dynamic-skill-generator.d.ts.map +1 -1
- package/dist/skills/routing-table.d.ts +4 -4
- package/dist/skills/routing-table.d.ts.map +1 -1
- package/dist/store/provider.d.ts +1 -1
- package/dist/store/sqlite.d.ts +1 -1
- package/dist/store/tasks-schema.d.ts +4 -4
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/validation-schemas.d.ts +4 -5
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/system/archive-analytics.d.ts +1 -1
- package/dist/system/health.d.ts +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/runtime.d.ts +2 -1
- package/dist/system/runtime.d.ts.map +1 -1
- package/dist/tasks/list.d.ts +1 -1
- package/dist/tasks/list.d.ts.map +1 -1
- package/dist/tasks/task-ops.d.ts +415 -3
- package/dist/tasks/task-ops.d.ts.map +1 -1
- package/dist/tasks/update.d.ts.map +1 -1
- package/dist/templates/parser.d.ts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/upgrade.d.ts +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/validation/operation-gate-validators.d.ts +1 -1
- package/dist/validation/operation-verification-gates.d.ts +3 -3
- package/dist/validation/param-utils.d.ts +6 -5
- package/dist/validation/param-utils.d.ts.map +1 -1
- package/dist/validation/validate-ops.d.ts +1 -1
- package/dist/validation/validate-ops.d.ts.map +1 -1
- package/package.json +13 -11
- package/src/__tests__/caamp-skill-install.test.js +0 -15
- package/src/__tests__/caamp-skill-install.test.js.map +1 -1
- package/src/__tests__/caamp-skill-install.test.ts +0 -16
- package/src/__tests__/injection-mvi-tiers.test.js +7 -7
- package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
- package/src/__tests__/injection-mvi-tiers.test.ts +55 -103
- package/src/audit.ts +2 -2
- package/src/bootstrap.ts +5 -39
- package/src/caamp/adapter.ts +3 -219
- package/src/caamp/index.ts +1 -13
- package/src/cant/__tests__/cant-agent-parse.test.d.ts.map +1 -0
- package/src/cant/__tests__/cant-agent-parse.test.js +77 -0
- package/src/cant/__tests__/cant-agent-parse.test.js.map +1 -0
- package/src/code/parser.ts +35 -3
- package/src/codebase-map/analyzers/architecture.ts +2 -2
- package/src/compliance/protocol-enforcement.ts +1 -1
- package/src/compliance/protocol-rules.ts +1 -1
- package/src/compliance/protocol-types.ts +2 -3
- package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +1 -0
- package/src/conduit/__tests__/dual-api-e2e.test.js +178 -0
- package/src/conduit/__tests__/dual-api-e2e.test.js.map +1 -0
- package/src/conduit/__tests__/local-credential-flow.test.d.ts.map +1 -0
- package/src/conduit/__tests__/local-credential-flow.test.js +185 -0
- package/src/conduit/__tests__/local-credential-flow.test.js.map +1 -0
- package/src/conduit/__tests__/local-transport.test.d.ts.map +1 -0
- package/src/conduit/__tests__/local-transport.test.js +404 -0
- package/src/conduit/__tests__/local-transport.test.js.map +1 -0
- package/src/conduit/__tests__/local-transport.test.ts +189 -0
- package/src/conduit/__tests__/sse-transport.test.d.ts.map +1 -0
- package/src/conduit/__tests__/sse-transport.test.js +291 -0
- package/src/conduit/__tests__/sse-transport.test.js.map +1 -0
- package/src/conduit/__tests__/sse-transport.test.ts +1 -1
- package/src/conduit/conduit-client.ts +5 -0
- package/src/conduit/factory.ts +25 -8
- package/src/conduit/http-transport.ts +3 -2
- package/src/crypto/credentials.ts +59 -13
- package/src/error-catalog.ts +3 -3
- package/src/errors.ts +1 -1
- package/src/hooks/__tests__/provider-hooks.test.js +4 -4
- package/src/hooks/__tests__/provider-hooks.test.js.map +1 -1
- package/src/hooks/__tests__/provider-hooks.test.ts +4 -4
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +2 -2
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +1 -1
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.ts +6 -4
- package/src/hooks/handlers/index.ts +2 -6
- package/src/hooks/handlers/notification-hooks.ts +65 -0
- package/src/index.ts +1 -1
- package/src/init.ts +14 -54
- package/src/injection.ts +4 -3
- package/src/internal.ts +7 -9
- package/src/logger.ts +5 -5
- package/src/memory/__tests__/brain-links.test.js +13 -0
- package/src/memory/__tests__/brain-links.test.js.map +1 -1
- package/src/memory/__tests__/brain-retrieval.test.js +9 -0
- package/src/memory/__tests__/brain-retrieval.test.js.map +1 -1
- package/src/memory/__tests__/session-memory.test.js +16 -0
- package/src/memory/__tests__/session-memory.test.js.map +1 -1
- package/src/memory/brain-retrieval.ts +1 -1
- package/src/memory/engine-compat.ts +392 -25
- package/src/memory/index.ts +417 -4
- package/src/metrics/token-service.ts +4 -4
- package/src/migration/index.ts +1 -1
- package/src/paths.ts +340 -5
- package/src/routing/capability-matrix.ts +49 -49
- package/src/scaffold.ts +428 -70
- package/src/security/input-sanitization.ts +4 -4
- package/src/sessions/__tests__/session-grade.integration.test.js +9 -9
- package/src/sessions/__tests__/session-grade.integration.test.ts +9 -9
- package/src/sessions/__tests__/session-grade.test.js +10 -10
- package/src/sessions/__tests__/session-grade.test.js.map +1 -1
- package/src/sessions/__tests__/session-grade.test.ts +10 -10
- package/src/sessions/index.ts +12 -7
- package/src/sessions/session-grade.ts +4 -4
- package/src/skills/__tests__/dynamic-skill-generator.test.js +24 -26
- package/src/skills/__tests__/dynamic-skill-generator.test.js.map +1 -1
- package/src/skills/__tests__/dynamic-skill-generator.test.ts +24 -26
- package/src/skills/__tests__/routing-table.test.js +22 -22
- package/src/skills/__tests__/routing-table.test.js.map +1 -1
- package/src/skills/__tests__/routing-table.test.ts +23 -23
- package/src/skills/dynamic-skill-generator.ts +13 -24
- package/src/skills/routing-table.ts +4 -4
- package/src/store/__tests__/data-safety-central.test.js +8 -0
- package/src/store/__tests__/data-safety-central.test.js.map +1 -1
- package/src/store/__tests__/data-safety-central.test.ts +8 -0
- package/src/store/__tests__/safety-accessor.test.js +8 -0
- package/src/store/__tests__/safety-accessor.test.js.map +1 -1
- package/src/store/__tests__/safety-accessor.test.ts +8 -0
- package/src/store/provider.ts +2 -2
- package/src/store/sqlite.ts +2 -2
- package/src/store/tasks-schema.ts +2 -2
- package/src/system/__tests__/health.test.js +2 -2
- package/src/system/__tests__/health.test.js.map +1 -1
- package/src/system/archive-analytics.ts +1 -1
- package/src/system/health.ts +11 -6
- package/src/system/inject-generate.ts +20 -20
- package/src/system/runtime.ts +5 -4
- package/src/tasks/atomicity.ts +1 -1
- package/src/tasks/list.ts +1 -1
- package/src/tasks/task-ops.ts +415 -3
- package/src/tasks/update.ts +8 -0
- package/src/templates/parser.ts +1 -1
- package/src/ui/index.ts +4 -4
- package/src/upgrade.ts +3 -14
- package/src/validation/operation-gate-validators.ts +1 -1
- package/src/validation/operation-verification-gates.ts +3 -3
- package/src/validation/param-utils.ts +11 -10
- package/src/validation/validate-ops.ts +6 -6
- package/templates/CLEO-INJECTION.md +38 -110
- package/dist/adapters/adapter-registry.js +0 -64
- package/dist/adapters/adapter-registry.js.map +0 -1
- package/dist/adapters/discovery.js +0 -83
- package/dist/adapters/discovery.js.map +0 -1
- package/dist/adapters/index.js +0 -9
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/manager.js +0 -260
- package/dist/adapters/manager.js.map +0 -1
- package/dist/admin/export-tasks.js +0 -171
- package/dist/admin/export-tasks.js.map +0 -1
- package/dist/admin/export.js +0 -103
- package/dist/admin/export.js.map +0 -1
- package/dist/admin/help.js +0 -106
- package/dist/admin/help.js.map +0 -1
- package/dist/admin/import-tasks.js +0 -182
- package/dist/admin/import-tasks.js.map +0 -1
- package/dist/admin/import.js +0 -129
- package/dist/admin/import.js.map +0 -1
- package/dist/admin/index.js +0 -13
- package/dist/admin/index.js.map +0 -1
- package/dist/adrs/find.js +0 -134
- package/dist/adrs/find.js.map +0 -1
- package/dist/adrs/index.js +0 -15
- package/dist/adrs/index.js.map +0 -1
- package/dist/adrs/link-pipeline.js +0 -160
- package/dist/adrs/link-pipeline.js.map +0 -1
- package/dist/adrs/list.js +0 -43
- package/dist/adrs/list.js.map +0 -1
- package/dist/adrs/parse.js +0 -51
- package/dist/adrs/parse.js.map +0 -1
- package/dist/adrs/show.js +0 -22
- package/dist/adrs/show.js.map +0 -1
- package/dist/adrs/sync.js +0 -188
- package/dist/adrs/sync.js.map +0 -1
- package/dist/adrs/types.js +0 -9
- package/dist/adrs/types.js.map +0 -1
- package/dist/adrs/validate.js +0 -57
- package/dist/adrs/validate.js.map +0 -1
- package/dist/agents/agent-registry.js +0 -288
- package/dist/agents/agent-registry.js.map +0 -1
- package/dist/agents/agent-schema.js +0 -85
- package/dist/agents/agent-schema.js.map +0 -1
- package/dist/agents/capacity.js +0 -116
- package/dist/agents/capacity.js.map +0 -1
- package/dist/agents/execution-learning.js +0 -474
- package/dist/agents/execution-learning.js.map +0 -1
- package/dist/agents/health-monitor.js +0 -217
- package/dist/agents/health-monitor.js.map +0 -1
- package/dist/agents/index.js +0 -29
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/registry.js +0 -314
- package/dist/agents/registry.js.map +0 -1
- package/dist/agents/retry.js +0 -215
- package/dist/agents/retry.js.map +0 -1
- package/dist/audit-prune.js +0 -94
- package/dist/audit-prune.js.map +0 -1
- package/dist/audit.js +0 -68
- package/dist/audit.js.map +0 -1
- package/dist/backfill/index.js +0 -229
- package/dist/backfill/index.js.map +0 -1
- package/dist/bootstrap.js +0 -367
- package/dist/bootstrap.js.map +0 -1
- package/dist/caamp/adapter.js +0 -434
- package/dist/caamp/adapter.js.map +0 -1
- package/dist/caamp/capability-check.js +0 -38
- package/dist/caamp/capability-check.js.map +0 -1
- package/dist/caamp/index.js +0 -23
- package/dist/caamp/index.js.map +0 -1
- package/dist/caamp-init.js +0 -16
- package/dist/caamp-init.js.map +0 -1
- package/dist/cant/approval.js +0 -185
- package/dist/cant/approval.js.map +0 -1
- package/dist/cant/context-builder.js +0 -117
- package/dist/cant/context-builder.js.map +0 -1
- package/dist/cant/discretion.js +0 -116
- package/dist/cant/discretion.js.map +0 -1
- package/dist/cant/index.js +0 -23
- package/dist/cant/index.js.map +0 -1
- package/dist/cant/parallel-runner.js +0 -173
- package/dist/cant/parallel-runner.js.map +0 -1
- package/dist/cant/types.js +0 -11
- package/dist/cant/types.js.map +0 -1
- package/dist/cant/workflow-executor.js +0 -440
- package/dist/cant/workflow-executor.js.map +0 -1
- package/dist/cleo.js +0 -322
- package/dist/cleo.js.map +0 -1
- package/dist/codebase-map/analyzers/architecture.js +0 -130
- package/dist/codebase-map/analyzers/architecture.js.map +0 -1
- package/dist/codebase-map/analyzers/concerns.js +0 -122
- package/dist/codebase-map/analyzers/concerns.js.map +0 -1
- package/dist/codebase-map/analyzers/conventions.js +0 -149
- package/dist/codebase-map/analyzers/conventions.js.map +0 -1
- package/dist/codebase-map/analyzers/integrations.js +0 -108
- package/dist/codebase-map/analyzers/integrations.js.map +0 -1
- package/dist/codebase-map/analyzers/stack.js +0 -117
- package/dist/codebase-map/analyzers/stack.js.map +0 -1
- package/dist/codebase-map/analyzers/structure.js +0 -137
- package/dist/codebase-map/analyzers/structure.js.map +0 -1
- package/dist/codebase-map/analyzers/testing.js +0 -118
- package/dist/codebase-map/analyzers/testing.js.map +0 -1
- package/dist/codebase-map/index.js +0 -57
- package/dist/codebase-map/index.js.map +0 -1
- package/dist/codebase-map/store.js +0 -122
- package/dist/codebase-map/store.js.map +0 -1
- package/dist/codebase-map/summary.js +0 -152
- package/dist/codebase-map/summary.js.map +0 -1
- package/dist/compliance/index.js +0 -288
- package/dist/compliance/index.js.map +0 -1
- package/dist/compliance/protocol-enforcement.js +0 -332
- package/dist/compliance/protocol-enforcement.js.map +0 -1
- package/dist/compliance/protocol-rules.js +0 -786
- package/dist/compliance/protocol-rules.js.map +0 -1
- package/dist/compliance/protocol-types.js +0 -80
- package/dist/compliance/protocol-types.js.map +0 -1
- package/dist/compliance/store.js +0 -53
- package/dist/compliance/store.js.map +0 -1
- package/dist/conduit/conduit-client.js +0 -94
- package/dist/conduit/conduit-client.js.map +0 -1
- package/dist/conduit/factory.js +0 -35
- package/dist/conduit/factory.js.map +0 -1
- package/dist/conduit/http-transport.js +0 -165
- package/dist/conduit/http-transport.js.map +0 -1
- package/dist/conduit/index.js +0 -12
- package/dist/conduit/index.js.map +0 -1
- package/dist/config/build-config.js +0 -29
- package/dist/config/build-config.js.map +0 -1
- package/dist/config.js +0 -401
- package/dist/config.js.map +0 -1
- package/dist/constants.js +0 -18
- package/dist/constants.js.map +0 -1
- package/dist/context/index.js +0 -137
- package/dist/context/index.js.map +0 -1
- package/dist/crypto/credentials.js +0 -144
- package/dist/crypto/credentials.js.map +0 -1
- package/dist/engine-result.js +0 -12
- package/dist/engine-result.js.map +0 -1
- package/dist/error-catalog.js +0 -404
- package/dist/error-catalog.js.map +0 -1
- package/dist/error-registry.js +0 -393
- package/dist/error-registry.js.map +0 -1
- package/dist/errors.js +0 -167
- package/dist/errors.js.map +0 -1
- package/dist/hooks/handlers/agent-hooks.js +0 -106
- package/dist/hooks/handlers/agent-hooks.js.map +0 -1
- package/dist/hooks/handlers/context-hooks.js +0 -111
- package/dist/hooks/handlers/context-hooks.js.map +0 -1
- package/dist/hooks/handlers/error-hooks.js +0 -52
- package/dist/hooks/handlers/error-hooks.js.map +0 -1
- package/dist/hooks/handlers/file-hooks.js +0 -104
- package/dist/hooks/handlers/file-hooks.js.map +0 -1
- package/dist/hooks/handlers/handler-helpers.js +0 -61
- package/dist/hooks/handlers/handler-helpers.js.map +0 -1
- package/dist/hooks/handlers/index.js +0 -28
- package/dist/hooks/handlers/index.js.map +0 -1
- package/dist/hooks/handlers/mcp-hooks.d.ts +0 -48
- package/dist/hooks/handlers/mcp-hooks.d.ts.map +0 -1
- package/dist/hooks/handlers/mcp-hooks.js +0 -147
- package/dist/hooks/handlers/mcp-hooks.js.map +0 -1
- package/dist/hooks/handlers/memory-bridge-refresh.js +0 -42
- package/dist/hooks/handlers/memory-bridge-refresh.js.map +0 -1
- package/dist/hooks/handlers/session-hooks.js +0 -104
- package/dist/hooks/handlers/session-hooks.js.map +0 -1
- package/dist/hooks/handlers/task-hooks.js +0 -65
- package/dist/hooks/handlers/task-hooks.js.map +0 -1
- package/dist/hooks/handlers/work-capture-hooks.js +0 -165
- package/dist/hooks/handlers/work-capture-hooks.js.map +0 -1
- package/dist/hooks/index.js +0 -13
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/payload-schemas.js +0 -220
- package/dist/hooks/payload-schemas.js.map +0 -1
- package/dist/hooks/provider-hooks.js +0 -66
- package/dist/hooks/provider-hooks.js.map +0 -1
- package/dist/hooks/registry.js +0 -229
- package/dist/hooks/registry.js.map +0 -1
- package/dist/hooks/types.js +0 -66
- package/dist/hooks/types.js.map +0 -1
- package/dist/hooks.js +0 -136
- package/dist/hooks.js.map +0 -1
- package/dist/init.js +0 -723
- package/dist/init.js.map +0 -1
- package/dist/inject/index.js +0 -82
- package/dist/inject/index.js.map +0 -1
- package/dist/injection.js +0 -343
- package/dist/injection.js.map +0 -1
- package/dist/intelligence/adaptive-validation.js +0 -497
- package/dist/intelligence/adaptive-validation.js.map +0 -1
- package/dist/intelligence/impact.js +0 -675
- package/dist/intelligence/impact.js.map +0 -1
- package/dist/intelligence/index.js +0 -22
- package/dist/intelligence/index.js.map +0 -1
- package/dist/intelligence/patterns.js +0 -492
- package/dist/intelligence/patterns.js.map +0 -1
- package/dist/intelligence/prediction.js +0 -499
- package/dist/intelligence/prediction.js.map +0 -1
- package/dist/intelligence/types.js +0 -13
- package/dist/intelligence/types.js.map +0 -1
- package/dist/internal.js +0 -286
- package/dist/internal.js.map +0 -1
- package/dist/issue/create.js +0 -121
- package/dist/issue/create.js.map +0 -1
- package/dist/issue/diagnostics.js +0 -59
- package/dist/issue/diagnostics.js.map +0 -1
- package/dist/issue/index.js +0 -10
- package/dist/issue/index.js.map +0 -1
- package/dist/issue/template-parser.js +0 -267
- package/dist/issue/template-parser.js.map +0 -1
- package/dist/json-schema-validator.js +0 -76
- package/dist/json-schema-validator.js.map +0 -1
- package/dist/lib/index.js +0 -10
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/retry.js +0 -152
- package/dist/lib/retry.js.map +0 -1
- package/dist/lifecycle/chain-composition.js +0 -152
- package/dist/lifecycle/chain-composition.js.map +0 -1
- package/dist/lifecycle/chain-store.js +0 -246
- package/dist/lifecycle/chain-store.js.map +0 -1
- package/dist/lifecycle/consolidate-rcasd.js +0 -352
- package/dist/lifecycle/consolidate-rcasd.js.map +0 -1
- package/dist/lifecycle/default-chain.js +0 -167
- package/dist/lifecycle/default-chain.js.map +0 -1
- package/dist/lifecycle/evidence.js +0 -180
- package/dist/lifecycle/evidence.js.map +0 -1
- package/dist/lifecycle/frontmatter.js +0 -363
- package/dist/lifecycle/frontmatter.js.map +0 -1
- package/dist/lifecycle/index.js +0 -753
- package/dist/lifecycle/index.js.map +0 -1
- package/dist/lifecycle/pipeline.js +0 -656
- package/dist/lifecycle/pipeline.js.map +0 -1
- package/dist/lifecycle/rcasd-index.js +0 -326
- package/dist/lifecycle/rcasd-index.js.map +0 -1
- package/dist/lifecycle/rcasd-paths.js +0 -220
- package/dist/lifecycle/rcasd-paths.js.map +0 -1
- package/dist/lifecycle/resume.js +0 -864
- package/dist/lifecycle/resume.js.map +0 -1
- package/dist/lifecycle/stage-artifacts.js +0 -94
- package/dist/lifecycle/stage-artifacts.js.map +0 -1
- package/dist/lifecycle/stages.js +0 -534
- package/dist/lifecycle/stages.js.map +0 -1
- package/dist/lifecycle/state-machine.js +0 -516
- package/dist/lifecycle/state-machine.js.map +0 -1
- package/dist/lifecycle/tessera-engine.js +0 -249
- package/dist/lifecycle/tessera-engine.js.map +0 -1
- package/dist/logger.js +0 -140
- package/dist/logger.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -42
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -146
- package/dist/mcp/index.js.map +0 -1
- package/dist/memory/auto-extract.js +0 -177
- package/dist/memory/auto-extract.js.map +0 -1
- package/dist/memory/brain-embedding.js +0 -66
- package/dist/memory/brain-embedding.js.map +0 -1
- package/dist/memory/brain-lifecycle.js +0 -298
- package/dist/memory/brain-lifecycle.js.map +0 -1
- package/dist/memory/brain-links.js +0 -148
- package/dist/memory/brain-links.js.map +0 -1
- package/dist/memory/brain-maintenance.js +0 -98
- package/dist/memory/brain-maintenance.js.map +0 -1
- package/dist/memory/brain-migration.js +0 -149
- package/dist/memory/brain-migration.js.map +0 -1
- package/dist/memory/brain-reasoning.js +0 -215
- package/dist/memory/brain-reasoning.js.map +0 -1
- package/dist/memory/brain-retrieval.js +0 -526
- package/dist/memory/brain-retrieval.js.map +0 -1
- package/dist/memory/brain-row-types.js +0 -10
- package/dist/memory/brain-row-types.js.map +0 -1
- package/dist/memory/brain-search.js +0 -519
- package/dist/memory/brain-search.js.map +0 -1
- package/dist/memory/brain-similarity.js +0 -145
- package/dist/memory/brain-similarity.js.map +0 -1
- package/dist/memory/claude-mem-migration.js +0 -277
- package/dist/memory/claude-mem-migration.js.map +0 -1
- package/dist/memory/decisions.js +0 -148
- package/dist/memory/decisions.js.map +0 -1
- package/dist/memory/embedding-local.js +0 -97
- package/dist/memory/embedding-local.js.map +0 -1
- package/dist/memory/embedding-queue.js +0 -271
- package/dist/memory/embedding-queue.js.map +0 -1
- package/dist/memory/embedding-worker.js +0 -58
- package/dist/memory/embedding-worker.js.map +0 -1
- package/dist/memory/engine-compat.js +0 -1030
- package/dist/memory/engine-compat.js.map +0 -1
- package/dist/memory/index.js +0 -773
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/learnings.js +0 -121
- package/dist/memory/learnings.js.map +0 -1
- package/dist/memory/memory-bridge.js +0 -370
- package/dist/memory/memory-bridge.js.map +0 -1
- package/dist/memory/patterns.js +0 -122
- package/dist/memory/patterns.js.map +0 -1
- package/dist/memory/pipeline-manifest-sqlite.js +0 -975
- package/dist/memory/pipeline-manifest-sqlite.js.map +0 -1
- package/dist/memory/session-memory.js +0 -331
- package/dist/memory/session-memory.js.map +0 -1
- package/dist/metrics/ab-test.js +0 -260
- package/dist/metrics/ab-test.js.map +0 -1
- package/dist/metrics/aggregation.js +0 -363
- package/dist/metrics/aggregation.js.map +0 -1
- package/dist/metrics/common.js +0 -64
- package/dist/metrics/common.js.map +0 -1
- package/dist/metrics/enums.js +0 -78
- package/dist/metrics/enums.js.map +0 -1
- package/dist/metrics/index.js +0 -19
- package/dist/metrics/index.js.map +0 -1
- package/dist/metrics/model-provider-registry.js +0 -88
- package/dist/metrics/model-provider-registry.js.map +0 -1
- package/dist/metrics/otel-integration.js +0 -263
- package/dist/metrics/otel-integration.js.map +0 -1
- package/dist/metrics/provider-detection.js +0 -103
- package/dist/metrics/provider-detection.js.map +0 -1
- package/dist/metrics/token-estimation.js +0 -253
- package/dist/metrics/token-estimation.js.map +0 -1
- package/dist/metrics/token-service.js +0 -450
- package/dist/metrics/token-service.js.map +0 -1
- package/dist/migration/agent-outputs.js +0 -316
- package/dist/migration/agent-outputs.js.map +0 -1
- package/dist/migration/checksum.js +0 -92
- package/dist/migration/checksum.js.map +0 -1
- package/dist/migration/index.js +0 -282
- package/dist/migration/index.js.map +0 -1
- package/dist/migration/logger.js +0 -360
- package/dist/migration/logger.js.map +0 -1
- package/dist/migration/preflight.js +0 -9
- package/dist/migration/preflight.js.map +0 -1
- package/dist/migration/state.js +0 -421
- package/dist/migration/state.js.map +0 -1
- package/dist/migration/validate.js +0 -241
- package/dist/migration/validate.js.map +0 -1
- package/dist/mvi-helpers.js +0 -74
- package/dist/mvi-helpers.js.map +0 -1
- package/dist/nexus/deps.js +0 -375
- package/dist/nexus/deps.js.map +0 -1
- package/dist/nexus/discover.js +0 -288
- package/dist/nexus/discover.js.map +0 -1
- package/dist/nexus/hash.js +0 -10
- package/dist/nexus/hash.js.map +0 -1
- package/dist/nexus/index.js +0 -40
- package/dist/nexus/index.js.map +0 -1
- package/dist/nexus/migrate-json-to-sqlite.js +0 -115
- package/dist/nexus/migrate-json-to-sqlite.js.map +0 -1
- package/dist/nexus/permissions.js +0 -105
- package/dist/nexus/permissions.js.map +0 -1
- package/dist/nexus/query.js +0 -175
- package/dist/nexus/query.js.map +0 -1
- package/dist/nexus/registry.js +0 -584
- package/dist/nexus/registry.js.map +0 -1
- package/dist/nexus/sharing/index.js +0 -288
- package/dist/nexus/sharing/index.js.map +0 -1
- package/dist/nexus/transfer-types.js +0 -8
- package/dist/nexus/transfer-types.js.map +0 -1
- package/dist/nexus/transfer.js +0 -263
- package/dist/nexus/transfer.js.map +0 -1
- package/dist/nexus/workspace.js +0 -355
- package/dist/nexus/workspace.js.map +0 -1
- package/dist/observability/index.js +0 -103
- package/dist/observability/index.js.map +0 -1
- package/dist/observability/log-filter.js +0 -63
- package/dist/observability/log-filter.js.map +0 -1
- package/dist/observability/log-parser.js +0 -99
- package/dist/observability/log-parser.js.map +0 -1
- package/dist/observability/log-reader.js +0 -139
- package/dist/observability/log-reader.js.map +0 -1
- package/dist/observability/types.js +0 -19
- package/dist/observability/types.js.map +0 -1
- package/dist/orchestration/analyze.js +0 -107
- package/dist/orchestration/analyze.js.map +0 -1
- package/dist/orchestration/bootstrap.js +0 -132
- package/dist/orchestration/bootstrap.js.map +0 -1
- package/dist/orchestration/context.js +0 -56
- package/dist/orchestration/context.js.map +0 -1
- package/dist/orchestration/critical-path.js +0 -100
- package/dist/orchestration/critical-path.js.map +0 -1
- package/dist/orchestration/index.js +0 -286
- package/dist/orchestration/index.js.map +0 -1
- package/dist/orchestration/parallel.js +0 -89
- package/dist/orchestration/parallel.js.map +0 -1
- package/dist/orchestration/protocol-validators.js +0 -524
- package/dist/orchestration/protocol-validators.js.map +0 -1
- package/dist/orchestration/skill-ops.js +0 -98
- package/dist/orchestration/skill-ops.js.map +0 -1
- package/dist/orchestration/status.js +0 -107
- package/dist/orchestration/status.js.map +0 -1
- package/dist/orchestration/unblock.js +0 -103
- package/dist/orchestration/unblock.js.map +0 -1
- package/dist/orchestration/validate-spawn.js +0 -67
- package/dist/orchestration/validate-spawn.js.map +0 -1
- package/dist/orchestration/waves.js +0 -86
- package/dist/orchestration/waves.js.map +0 -1
- package/dist/otel/index.js +0 -163
- package/dist/otel/index.js.map +0 -1
- package/dist/output.js +0 -164
- package/dist/output.js.map +0 -1
- package/dist/pagination.js +0 -64
- package/dist/pagination.js.map +0 -1
- package/dist/paths.js +0 -337
- package/dist/paths.js.map +0 -1
- package/dist/phases/deps.js +0 -372
- package/dist/phases/deps.js.map +0 -1
- package/dist/phases/index.js +0 -349
- package/dist/phases/index.js.map +0 -1
- package/dist/pipeline/index.js +0 -10
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/phase.js +0 -45
- package/dist/pipeline/phase.js.map +0 -1
- package/dist/platform.js +0 -211
- package/dist/platform.js.map +0 -1
- package/dist/project-info.js +0 -84
- package/dist/project-info.js.map +0 -1
- package/dist/reconciliation/index.js +0 -10
- package/dist/reconciliation/index.js.map +0 -1
- package/dist/reconciliation/link-store.js +0 -129
- package/dist/reconciliation/link-store.js.map +0 -1
- package/dist/reconciliation/reconciliation-engine.js +0 -298
- package/dist/reconciliation/reconciliation-engine.js.map +0 -1
- package/dist/release/artifacts.js +0 -427
- package/dist/release/artifacts.js.map +0 -1
- package/dist/release/changelog-writer.js +0 -151
- package/dist/release/changelog-writer.js.map +0 -1
- package/dist/release/channel.js +0 -144
- package/dist/release/channel.js.map +0 -1
- package/dist/release/ci.js +0 -166
- package/dist/release/ci.js.map +0 -1
- package/dist/release/github-pr.js +0 -225
- package/dist/release/github-pr.js.map +0 -1
- package/dist/release/guards.js +0 -116
- package/dist/release/guards.js.map +0 -1
- package/dist/release/index.js +0 -22
- package/dist/release/index.js.map +0 -1
- package/dist/release/release-config.js +0 -158
- package/dist/release/release-config.js.map +0 -1
- package/dist/release/release-manifest.js +0 -1019
- package/dist/release/release-manifest.js.map +0 -1
- package/dist/release/version-bump.js +0 -255
- package/dist/release/version-bump.js.map +0 -1
- package/dist/remote/index.js +0 -257
- package/dist/remote/index.js.map +0 -1
- package/dist/repair.js +0 -130
- package/dist/repair.js.map +0 -1
- package/dist/research/index.js +0 -2
- package/dist/research/index.js.map +0 -1
- package/dist/roadmap/index.js +0 -59
- package/dist/roadmap/index.js.map +0 -1
- package/dist/routing/capability-matrix.js +0 -1557
- package/dist/routing/capability-matrix.js.map +0 -1
- package/dist/routing/index.js +0 -9
- package/dist/routing/index.js.map +0 -1
- package/dist/scaffold.js +0 -1178
- package/dist/scaffold.js.map +0 -1
- package/dist/schema-management.js +0 -295
- package/dist/schema-management.js.map +0 -1
- package/dist/security/index.js +0 -9
- package/dist/security/index.js.map +0 -1
- package/dist/security/input-sanitization.js +0 -321
- package/dist/security/input-sanitization.js.map +0 -1
- package/dist/sequence/index.js +0 -295
- package/dist/sequence/index.js.map +0 -1
- package/dist/sessions/assumptions.js +0 -54
- package/dist/sessions/assumptions.js.map +0 -1
- package/dist/sessions/briefing.js +0 -377
- package/dist/sessions/briefing.js.map +0 -1
- package/dist/sessions/context-alert.js +0 -222
- package/dist/sessions/context-alert.js.map +0 -1
- package/dist/sessions/context-inject.js +0 -61
- package/dist/sessions/context-inject.js.map +0 -1
- package/dist/sessions/context-monitor.js +0 -98
- package/dist/sessions/context-monitor.js.map +0 -1
- package/dist/sessions/decisions.js +0 -65
- package/dist/sessions/decisions.js.map +0 -1
- package/dist/sessions/find.js +0 -65
- package/dist/sessions/find.js.map +0 -1
- package/dist/sessions/handoff.js +0 -328
- package/dist/sessions/handoff.js.map +0 -1
- package/dist/sessions/hitl-warnings.js +0 -254
- package/dist/sessions/hitl-warnings.js.map +0 -1
- package/dist/sessions/index.js +0 -321
- package/dist/sessions/index.js.map +0 -1
- package/dist/sessions/session-archive.js +0 -40
- package/dist/sessions/session-archive.js.map +0 -1
- package/dist/sessions/session-cleanup.js +0 -59
- package/dist/sessions/session-cleanup.js.map +0 -1
- package/dist/sessions/session-drift.js +0 -134
- package/dist/sessions/session-drift.js.map +0 -1
- package/dist/sessions/session-enforcement.js +0 -144
- package/dist/sessions/session-enforcement.js.map +0 -1
- package/dist/sessions/session-grade.js +0 -253
- package/dist/sessions/session-grade.js.map +0 -1
- package/dist/sessions/session-history.js +0 -42
- package/dist/sessions/session-history.js.map +0 -1
- package/dist/sessions/session-id.js +0 -81
- package/dist/sessions/session-id.js.map +0 -1
- package/dist/sessions/session-memory-bridge.js +0 -52
- package/dist/sessions/session-memory-bridge.js.map +0 -1
- package/dist/sessions/session-show.js +0 -24
- package/dist/sessions/session-show.js.map +0 -1
- package/dist/sessions/session-stats.js +0 -69
- package/dist/sessions/session-stats.js.map +0 -1
- package/dist/sessions/session-suspend.js +0 -39
- package/dist/sessions/session-suspend.js.map +0 -1
- package/dist/sessions/session-switch.js +0 -51
- package/dist/sessions/session-switch.js.map +0 -1
- package/dist/sessions/session-view.js +0 -76
- package/dist/sessions/session-view.js.map +0 -1
- package/dist/sessions/snapshot.js +0 -213
- package/dist/sessions/snapshot.js.map +0 -1
- package/dist/sessions/statusline-setup.js +0 -85
- package/dist/sessions/statusline-setup.js.map +0 -1
- package/dist/sessions/types.js +0 -8
- package/dist/sessions/types.js.map +0 -1
- package/dist/signaldock/claude-code-transport.d.ts +0 -34
- package/dist/signaldock/claude-code-transport.d.ts.map +0 -1
- package/dist/signaldock/claude-code-transport.js +0 -107
- package/dist/signaldock/claude-code-transport.js.map +0 -1
- package/dist/signaldock/factory.d.ts +0 -22
- package/dist/signaldock/factory.d.ts.map +0 -1
- package/dist/signaldock/factory.js +0 -25
- package/dist/signaldock/factory.js.map +0 -1
- package/dist/signaldock/index.d.ts +0 -13
- package/dist/signaldock/index.d.ts.map +0 -1
- package/dist/signaldock/index.js +0 -9
- package/dist/signaldock/index.js.map +0 -1
- package/dist/signaldock/signaldock-transport.d.ts +0 -45
- package/dist/signaldock/signaldock-transport.d.ts.map +0 -1
- package/dist/signaldock/signaldock-transport.js +0 -122
- package/dist/signaldock/signaldock-transport.js.map +0 -1
- package/dist/signaldock/transport.d.ts +0 -49
- package/dist/signaldock/transport.d.ts.map +0 -1
- package/dist/signaldock/transport.js +0 -11
- package/dist/signaldock/transport.js.map +0 -1
- package/dist/signaldock/types.d.ts +0 -88
- package/dist/signaldock/types.d.ts.map +0 -1
- package/dist/signaldock/types.js +0 -11
- package/dist/signaldock/types.js.map +0 -1
- package/dist/skills/agents/config.js +0 -94
- package/dist/skills/agents/config.js.map +0 -1
- package/dist/skills/agents/install.js +0 -116
- package/dist/skills/agents/install.js.map +0 -1
- package/dist/skills/agents/registry.js +0 -161
- package/dist/skills/agents/registry.js.map +0 -1
- package/dist/skills/discovery.js +0 -333
- package/dist/skills/discovery.js.map +0 -1
- package/dist/skills/dispatch.js +0 -347
- package/dist/skills/dispatch.js.map +0 -1
- package/dist/skills/dynamic-skill-generator.js +0 -100
- package/dist/skills/dynamic-skill-generator.js.map +0 -1
- package/dist/skills/index.js +0 -44
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/injection/subagent.js +0 -195
- package/dist/skills/injection/subagent.js.map +0 -1
- package/dist/skills/injection/token.js +0 -260
- package/dist/skills/injection/token.js.map +0 -1
- package/dist/skills/install.js +0 -40
- package/dist/skills/install.js.map +0 -1
- package/dist/skills/manifests/contribution.js +0 -175
- package/dist/skills/manifests/contribution.js.map +0 -1
- package/dist/skills/manifests/research.js +0 -281
- package/dist/skills/manifests/research.js.map +0 -1
- package/dist/skills/manifests/resolver.js +0 -146
- package/dist/skills/manifests/resolver.js.map +0 -1
- package/dist/skills/marketplace.js +0 -90
- package/dist/skills/marketplace.js.map +0 -1
- package/dist/skills/orchestrator/spawn.js +0 -178
- package/dist/skills/orchestrator/spawn.js.map +0 -1
- package/dist/skills/orchestrator/startup.js +0 -451
- package/dist/skills/orchestrator/startup.js.map +0 -1
- package/dist/skills/orchestrator/validator.js +0 -301
- package/dist/skills/orchestrator/validator.js.map +0 -1
- package/dist/skills/precedence-integration.js +0 -73
- package/dist/skills/precedence-integration.js.map +0 -1
- package/dist/skills/precedence-types.js +0 -16
- package/dist/skills/precedence-types.js.map +0 -1
- package/dist/skills/routing-table.js +0 -63
- package/dist/skills/routing-table.js.map +0 -1
- package/dist/skills/skill-paths.js +0 -220
- package/dist/skills/skill-paths.js.map +0 -1
- package/dist/skills/test-utility.js +0 -55
- package/dist/skills/test-utility.js.map +0 -1
- package/dist/skills/types.js +0 -118
- package/dist/skills/types.js.map +0 -1
- package/dist/skills/validation.js +0 -183
- package/dist/skills/validation.js.map +0 -1
- package/dist/skills/version.js +0 -57
- package/dist/skills/version.js.map +0 -1
- package/dist/snapshot/index.js +0 -188
- package/dist/snapshot/index.js.map +0 -1
- package/dist/spawn/adapter-registry.js +0 -246
- package/dist/spawn/adapter-registry.js.map +0 -1
- package/dist/spawn/index.js +0 -10
- package/dist/spawn/index.js.map +0 -1
- package/dist/stats/index.js +0 -343
- package/dist/stats/index.js.map +0 -1
- package/dist/stats/workflow-telemetry.js +0 -400
- package/dist/stats/workflow-telemetry.js.map +0 -1
- package/dist/sticky/archive.js +0 -47
- package/dist/sticky/archive.js.map +0 -1
- package/dist/sticky/convert.js +0 -235
- package/dist/sticky/convert.js.map +0 -1
- package/dist/sticky/create.js +0 -48
- package/dist/sticky/create.js.map +0 -1
- package/dist/sticky/id.js +0 -35
- package/dist/sticky/id.js.map +0 -1
- package/dist/sticky/index.js +0 -16
- package/dist/sticky/index.js.map +0 -1
- package/dist/sticky/list.js +0 -44
- package/dist/sticky/list.js.map +0 -1
- package/dist/sticky/purge.js +0 -45
- package/dist/sticky/purge.js.map +0 -1
- package/dist/sticky/show.js +0 -42
- package/dist/sticky/show.js.map +0 -1
- package/dist/sticky/types.js +0 -10
- package/dist/sticky/types.js.map +0 -1
- package/dist/store/agent-registry-accessor.js +0 -169
- package/dist/store/agent-registry-accessor.js.map +0 -1
- package/dist/store/atomic.js +0 -167
- package/dist/store/atomic.js.map +0 -1
- package/dist/store/backup.js +0 -94
- package/dist/store/backup.js.map +0 -1
- package/dist/store/brain-accessor.js +0 -397
- package/dist/store/brain-accessor.js.map +0 -1
- package/dist/store/brain-schema.js +0 -215
- package/dist/store/brain-schema.js.map +0 -1
- package/dist/store/brain-sqlite.js +0 -222
- package/dist/store/brain-sqlite.js.map +0 -1
- package/dist/store/cache.js +0 -168
- package/dist/store/cache.js.map +0 -1
- package/dist/store/chain-schema.js +0 -51
- package/dist/store/chain-schema.js.map +0 -1
- package/dist/store/converters.js +0 -124
- package/dist/store/converters.js.map +0 -1
- package/dist/store/cross-db-cleanup.js +0 -169
- package/dist/store/cross-db-cleanup.js.map +0 -1
- package/dist/store/data-accessor.js +0 -26
- package/dist/store/data-accessor.js.map +0 -1
- package/dist/store/data-safety-central.js +0 -269
- package/dist/store/data-safety-central.js.map +0 -1
- package/dist/store/data-safety.js +0 -274
- package/dist/store/data-safety.js.map +0 -1
- package/dist/store/db-helpers.js +0 -224
- package/dist/store/db-helpers.js.map +0 -1
- package/dist/store/export.js +0 -155
- package/dist/store/export.js.map +0 -1
- package/dist/store/file-utils.js +0 -270
- package/dist/store/file-utils.js.map +0 -1
- package/dist/store/git-checkpoint.js +0 -365
- package/dist/store/git-checkpoint.js.map +0 -1
- package/dist/store/import-logging.js +0 -139
- package/dist/store/import-logging.js.map +0 -1
- package/dist/store/import-remap.js +0 -145
- package/dist/store/import-remap.js.map +0 -1
- package/dist/store/import-sort.js +0 -121
- package/dist/store/import-sort.js.map +0 -1
- package/dist/store/index.js +0 -28
- package/dist/store/index.js.map +0 -1
- package/dist/store/json.js +0 -208
- package/dist/store/json.js.map +0 -1
- package/dist/store/lifecycle-store.js +0 -249
- package/dist/store/lifecycle-store.js.map +0 -1
- package/dist/store/lock.js +0 -70
- package/dist/store/lock.js.map +0 -1
- package/dist/store/migration-manager.js +0 -151
- package/dist/store/migration-manager.js.map +0 -1
- package/dist/store/migration-sqlite.js +0 -676
- package/dist/store/migration-sqlite.js.map +0 -1
- package/dist/store/nexus-schema.js +0 -62
- package/dist/store/nexus-schema.js.map +0 -1
- package/dist/store/nexus-sqlite.js +0 -217
- package/dist/store/nexus-sqlite.js.map +0 -1
- package/dist/store/nexus-validation-schemas.js +0 -40
- package/dist/store/nexus-validation-schemas.js.map +0 -1
- package/dist/store/parsers.js +0 -37
- package/dist/store/parsers.js.map +0 -1
- package/dist/store/project-detect.js +0 -457
- package/dist/store/project-detect.js.map +0 -1
- package/dist/store/provider.js +0 -101
- package/dist/store/provider.js.map +0 -1
- package/dist/store/safety-data-accessor.js +0 -257
- package/dist/store/safety-data-accessor.js.map +0 -1
- package/dist/store/schema.js +0 -7
- package/dist/store/schema.js.map +0 -1
- package/dist/store/session-store.js +0 -219
- package/dist/store/session-store.js.map +0 -1
- package/dist/store/signaldock-sqlite.js +0 -178
- package/dist/store/signaldock-sqlite.js.map +0 -1
- package/dist/store/sqlite-backup.js +0 -105
- package/dist/store/sqlite-backup.js.map +0 -1
- package/dist/store/sqlite-data-accessor.js +0 -784
- package/dist/store/sqlite-data-accessor.js.map +0 -1
- package/dist/store/sqlite.js +0 -465
- package/dist/store/sqlite.js.map +0 -1
- package/dist/store/status-registry.js +0 -8
- package/dist/store/status-registry.js.map +0 -1
- package/dist/store/task-store.js +0 -350
- package/dist/store/task-store.js.map +0 -1
- package/dist/store/tasks-schema.js +0 -637
- package/dist/store/tasks-schema.js.map +0 -1
- package/dist/store/typed-query.js +0 -15
- package/dist/store/typed-query.js.map +0 -1
- package/dist/store/validation-schemas.js +0 -278
- package/dist/store/validation-schemas.js.map +0 -1
- package/dist/system/archive-analytics.js +0 -277
- package/dist/system/archive-analytics.js.map +0 -1
- package/dist/system/archive-stats.js +0 -64
- package/dist/system/archive-stats.js.map +0 -1
- package/dist/system/audit.js +0 -145
- package/dist/system/audit.js.map +0 -1
- package/dist/system/backup.js +0 -141
- package/dist/system/backup.js.map +0 -1
- package/dist/system/cleanup.js +0 -134
- package/dist/system/cleanup.js.map +0 -1
- package/dist/system/health.js +0 -1089
- package/dist/system/health.js.map +0 -1
- package/dist/system/index.js +0 -18
- package/dist/system/index.js.map +0 -1
- package/dist/system/inject-generate.js +0 -122
- package/dist/system/inject-generate.js.map +0 -1
- package/dist/system/labels.js +0 -38
- package/dist/system/labels.js.map +0 -1
- package/dist/system/metrics.js +0 -61
- package/dist/system/metrics.js.map +0 -1
- package/dist/system/migrate.js +0 -43
- package/dist/system/migrate.js.map +0 -1
- package/dist/system/platform-paths.js +0 -80
- package/dist/system/platform-paths.js.map +0 -1
- package/dist/system/runtime.js +0 -161
- package/dist/system/runtime.js.map +0 -1
- package/dist/system/safestop.js +0 -99
- package/dist/system/safestop.js.map +0 -1
- package/dist/system/storage-preflight.js +0 -123
- package/dist/system/storage-preflight.js.map +0 -1
- package/dist/task-work/index.js +0 -159
- package/dist/task-work/index.js.map +0 -1
- package/dist/tasks/add.js +0 -661
- package/dist/tasks/add.js.map +0 -1
- package/dist/tasks/analyze.js +0 -85
- package/dist/tasks/analyze.js.map +0 -1
- package/dist/tasks/archive.js +0 -90
- package/dist/tasks/archive.js.map +0 -1
- package/dist/tasks/atomicity.js +0 -83
- package/dist/tasks/atomicity.js.map +0 -1
- package/dist/tasks/cancel-ops.js +0 -83
- package/dist/tasks/cancel-ops.js.map +0 -1
- package/dist/tasks/complete.js +0 -211
- package/dist/tasks/complete.js.map +0 -1
- package/dist/tasks/crossref-extract.js +0 -73
- package/dist/tasks/crossref-extract.js.map +0 -1
- package/dist/tasks/delete-preview.js +0 -192
- package/dist/tasks/delete-preview.js.map +0 -1
- package/dist/tasks/delete.js +0 -120
- package/dist/tasks/delete.js.map +0 -1
- package/dist/tasks/deletion-strategy.js +0 -200
- package/dist/tasks/deletion-strategy.js.map +0 -1
- package/dist/tasks/dependency-check.js +0 -278
- package/dist/tasks/dependency-check.js.map +0 -1
- package/dist/tasks/deps-ready.js +0 -32
- package/dist/tasks/deps-ready.js.map +0 -1
- package/dist/tasks/enforcement.js +0 -86
- package/dist/tasks/enforcement.js.map +0 -1
- package/dist/tasks/epic-enforcement.js +0 -294
- package/dist/tasks/epic-enforcement.js.map +0 -1
- package/dist/tasks/find.js +0 -154
- package/dist/tasks/find.js.map +0 -1
- package/dist/tasks/graph-cache.js +0 -127
- package/dist/tasks/graph-cache.js.map +0 -1
- package/dist/tasks/graph-ops.js +0 -171
- package/dist/tasks/graph-ops.js.map +0 -1
- package/dist/tasks/graph-rag.js +0 -328
- package/dist/tasks/graph-rag.js.map +0 -1
- package/dist/tasks/hierarchy-policy.js +0 -149
- package/dist/tasks/hierarchy-policy.js.map +0 -1
- package/dist/tasks/hierarchy.js +0 -185
- package/dist/tasks/hierarchy.js.map +0 -1
- package/dist/tasks/id-generator.js +0 -65
- package/dist/tasks/id-generator.js.map +0 -1
- package/dist/tasks/index.js +0 -14
- package/dist/tasks/index.js.map +0 -1
- package/dist/tasks/labels.js +0 -52
- package/dist/tasks/labels.js.map +0 -1
- package/dist/tasks/list.js +0 -75
- package/dist/tasks/list.js.map +0 -1
- package/dist/tasks/phase-tracking.js +0 -133
- package/dist/tasks/phase-tracking.js.map +0 -1
- package/dist/tasks/pipeline-stage.js +0 -248
- package/dist/tasks/pipeline-stage.js.map +0 -1
- package/dist/tasks/plan.js +0 -268
- package/dist/tasks/plan.js.map +0 -1
- package/dist/tasks/relates.js +0 -89
- package/dist/tasks/relates.js.map +0 -1
- package/dist/tasks/show.js +0 -80
- package/dist/tasks/show.js.map +0 -1
- package/dist/tasks/size-weighting.js +0 -86
- package/dist/tasks/size-weighting.js.map +0 -1
- package/dist/tasks/staleness.js +0 -86
- package/dist/tasks/staleness.js.map +0 -1
- package/dist/tasks/task-ops.js +0 -1340
- package/dist/tasks/task-ops.js.map +0 -1
- package/dist/tasks/update.js +0 -271
- package/dist/tasks/update.js.map +0 -1
- package/dist/templates/index.js +0 -10
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/parser.js +0 -254
- package/dist/templates/parser.js.map +0 -1
- package/dist/ui/aliases.js +0 -153
- package/dist/ui/aliases.js.map +0 -1
- package/dist/ui/changelog.js +0 -184
- package/dist/ui/changelog.js.map +0 -1
- package/dist/ui/command-registry.js +0 -168
- package/dist/ui/command-registry.js.map +0 -1
- package/dist/ui/flags.js +0 -94
- package/dist/ui/flags.js.map +0 -1
- package/dist/ui/index.js +0 -24
- package/dist/ui/index.js.map +0 -1
- package/dist/upgrade.js +0 -1159
- package/dist/upgrade.js.map +0 -1
- package/dist/validation/chain-validation.js +0 -146
- package/dist/validation/chain-validation.js.map +0 -1
- package/dist/validation/compliance.js +0 -155
- package/dist/validation/compliance.js.map +0 -1
- package/dist/validation/docs-sync.js +0 -212
- package/dist/validation/docs-sync.js.map +0 -1
- package/dist/validation/doctor/checks.js +0 -1069
- package/dist/validation/doctor/checks.js.map +0 -1
- package/dist/validation/doctor/index.js +0 -9
- package/dist/validation/doctor/index.js.map +0 -1
- package/dist/validation/doctor/project-cache.js +0 -160
- package/dist/validation/doctor/project-cache.js.map +0 -1
- package/dist/validation/doctor/utils.js +0 -155
- package/dist/validation/doctor/utils.js.map +0 -1
- package/dist/validation/engine.js +0 -902
- package/dist/validation/engine.js.map +0 -1
- package/dist/validation/gap-check.js +0 -175
- package/dist/validation/gap-check.js.map +0 -1
- package/dist/validation/index.js +0 -40
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/manifest.js +0 -237
- package/dist/validation/manifest.js.map +0 -1
- package/dist/validation/operation-gate-validators.js +0 -724
- package/dist/validation/operation-gate-validators.js.map +0 -1
- package/dist/validation/operation-verification-gates.js +0 -532
- package/dist/validation/operation-verification-gates.js.map +0 -1
- package/dist/validation/param-utils.js +0 -139
- package/dist/validation/param-utils.js.map +0 -1
- package/dist/validation/protocol-common.js +0 -300
- package/dist/validation/protocol-common.js.map +0 -1
- package/dist/validation/protocols/consensus.js +0 -71
- package/dist/validation/protocols/consensus.js.map +0 -1
- package/dist/validation/protocols/contribution.js +0 -59
- package/dist/validation/protocols/contribution.js.map +0 -1
- package/dist/validation/protocols/decomposition.js +0 -59
- package/dist/validation/protocols/decomposition.js.map +0 -1
- package/dist/validation/protocols/implementation.js +0 -59
- package/dist/validation/protocols/implementation.js.map +0 -1
- package/dist/validation/protocols/release-protocol.js +0 -60
- package/dist/validation/protocols/release-protocol.js.map +0 -1
- package/dist/validation/protocols/research.js +0 -77
- package/dist/validation/protocols/research.js.map +0 -1
- package/dist/validation/protocols/specification.js +0 -84
- package/dist/validation/protocols/specification.js.map +0 -1
- package/dist/validation/protocols/testing-protocol.js +0 -70
- package/dist/validation/protocols/testing-protocol.js.map +0 -1
- package/dist/validation/protocols/validation-protocol.js +0 -70
- package/dist/validation/protocols/validation-protocol.js.map +0 -1
- package/dist/validation/schema-integrity.js +0 -170
- package/dist/validation/schema-integrity.js.map +0 -1
- package/dist/validation/schema-validator.js +0 -176
- package/dist/validation/schema-validator.js.map +0 -1
- package/dist/validation/validate-ops.js +0 -937
- package/dist/validation/validate-ops.js.map +0 -1
- package/dist/validation/validation-rules.js +0 -226
- package/dist/validation/validation-rules.js.map +0 -1
- package/dist/validation/verification.js +0 -321
- package/dist/validation/verification.js.map +0 -1
- package/src/__tests__/audit-prune.test.d.ts +0 -2
- package/src/__tests__/caamp-skill-install.test.d.ts +0 -14
- package/src/__tests__/cli-mcp-parity.integration.test.d.ts +0 -34
- package/src/__tests__/cli-mcp-parity.integration.test.d.ts.map +0 -1
- package/src/__tests__/cli-mcp-parity.integration.test.js +0 -898
- package/src/__tests__/cli-mcp-parity.integration.test.js.map +0 -1
- package/src/__tests__/cli-parity.test.d.ts +0 -9
- package/src/__tests__/config.test.d.ts +0 -7
- package/src/__tests__/core-parity.test.d.ts +0 -17
- package/src/__tests__/error-catalog.test.d.ts +0 -2
- package/src/__tests__/golden-parity.test.d.ts +0 -12
- package/src/__tests__/hooks.test.d.ts +0 -5
- package/src/__tests__/human-output.test.d.ts +0 -12
- package/src/__tests__/index-api-compat.test.d.ts +0 -2
- package/src/__tests__/init-e2e.test.d.ts +0 -12
- package/src/__tests__/injection-chain.test.d.ts +0 -18
- package/src/__tests__/injection-mvi-tiers.test.d.ts +0 -14
- package/src/__tests__/injection-shared.test.d.ts +0 -10
- package/src/__tests__/lafs-conformance.test.d.ts +0 -18
- package/src/__tests__/logger.test.d.ts +0 -2
- package/src/__tests__/mcp-install-verify.test.d.ts +0 -13
- package/src/__tests__/mcp-install-verify.test.d.ts.map +0 -1
- package/src/__tests__/mcp-install-verify.test.js +0 -177
- package/src/__tests__/mcp-install-verify.test.js.map +0 -1
- package/src/__tests__/mcp-install-verify.test.ts +0 -217
- package/src/__tests__/paths.test.d.ts +0 -7
- package/src/__tests__/project-info.test.d.ts +0 -2
- package/src/__tests__/rcsd-pipeline-e2e.test.d.ts +0 -14
- package/src/__tests__/remote.test.d.ts +0 -6
- package/src/__tests__/scaffold.test.d.ts +0 -6
- package/src/__tests__/schema-management.test.d.ts +0 -5
- package/src/__tests__/schema.test.d.ts +0 -2
- package/src/__tests__/sharing.test.d.ts +0 -6
- package/src/__tests__/snapshot.test.d.ts +0 -6
- package/src/__tests__/upgrade.test.d.ts +0 -7
- package/src/adapters/__tests__/discovery.test.d.ts +0 -6
- package/src/adapters/__tests__/manager.test.d.ts +0 -6
- package/src/agents/__tests__/agent-registry.test.d.ts +0 -12
- package/src/agents/__tests__/capacity.test.d.ts +0 -7
- package/src/agents/__tests__/execution-learning.test.d.ts +0 -14
- package/src/agents/__tests__/health-monitor.test.d.ts +0 -10
- package/src/agents/__tests__/registry.test.d.ts +0 -8
- package/src/agents/__tests__/retry.test.d.ts +0 -7
- package/src/compliance/__tests__/sync.test.d.ts +0 -5
- package/src/hooks/__tests__/provider-hooks.test.d.ts +0 -2
- package/src/hooks/__tests__/registry.test.d.ts +0 -2
- package/src/hooks/handlers/__tests__/error-hooks.test.d.ts +0 -2
- package/src/hooks/handlers/__tests__/file-hooks.test.d.ts +0 -2
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.d.ts +0 -13
- package/src/hooks/handlers/__tests__/mcp-hooks.test.d.ts +0 -2
- package/src/hooks/handlers/__tests__/mcp-hooks.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/mcp-hooks.test.js +0 -119
- package/src/hooks/handlers/__tests__/mcp-hooks.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/mcp-hooks.test.ts +0 -150
- package/src/hooks/handlers/__tests__/session-hooks.test.d.ts +0 -2
- package/src/hooks/handlers/__tests__/task-hooks.test.d.ts +0 -2
- package/src/hooks/handlers/mcp-hooks.ts +0 -162
- package/src/intelligence/__tests__/adaptive-validation.test.d.ts +0 -11
- package/src/intelligence/__tests__/impact.test.d.ts +0 -16
- package/src/intelligence/__tests__/patterns.test.d.ts +0 -8
- package/src/intelligence/__tests__/prediction.test.d.ts +0 -8
- package/src/lib/__tests__/retry.test.d.ts +0 -7
- package/src/lifecycle/__tests__/chain-store.test.d.ts +0 -10
- package/src/lifecycle/__tests__/consolidate-rcasd.test.d.ts +0 -7
- package/src/lifecycle/__tests__/default-chain.test.d.ts +0 -7
- package/src/lifecycle/__tests__/frontmatter.test.d.ts +0 -7
- package/src/lifecycle/__tests__/lifecycle.test.d.ts +0 -7
- package/src/lifecycle/__tests__/pipeline.integration.test.d.ts +0 -19
- package/src/lifecycle/__tests__/rcasd-paths.test.d.ts +0 -7
- package/src/lifecycle/__tests__/resume-schema-contract.test.d.ts +0 -16
- package/src/lifecycle/__tests__/stage-record-provenance.integration.test.d.ts +0 -7
- package/src/lifecycle/__tests__/tessera-engine.test.d.ts +0 -10
- package/src/mcp/index.ts +0 -163
- package/src/memory/__tests__/auto-extract.test.d.ts +0 -7
- package/src/memory/__tests__/brain-automation.test.d.ts +0 -11
- package/src/memory/__tests__/brain-embedding.test.d.ts +0 -2
- package/src/memory/__tests__/brain-links.test.d.ts +0 -8
- package/src/memory/__tests__/brain-migration.test.d.ts +0 -8
- package/src/memory/__tests__/brain-retrieval.test.d.ts +0 -10
- package/src/memory/__tests__/brain-search.test.d.ts +0 -8
- package/src/memory/__tests__/claude-mem-migration.test.d.ts +0 -12
- package/src/memory/__tests__/decisions.test.d.ts +0 -8
- package/src/memory/__tests__/engine-compat.test.d.ts +0 -12
- package/src/memory/__tests__/memory-bridge.test.d.ts +0 -10
- package/src/memory/__tests__/pipeline-manifest-sqlite.test.d.ts +0 -13
- package/src/memory/__tests__/session-memory.test.d.ts +0 -9
- package/src/metrics/__tests__/model-provider-registry.test.d.ts +0 -2
- package/src/metrics/__tests__/provider-detection.test.d.ts +0 -2
- package/src/migration/__tests__/checksum.test.d.ts +0 -8
- package/src/migration/__tests__/logger.test.d.ts +0 -5
- package/src/migration/__tests__/migration-failure.integration.test.d.ts +0 -15
- package/src/migration/__tests__/migration.test.d.ts +0 -13
- package/src/migration/__tests__/state.test.d.ts +0 -8
- package/src/migration/__tests__/validate.test.d.ts +0 -8
- package/src/nexus/__tests__/deps.test.d.ts +0 -7
- package/src/nexus/__tests__/nexus-e2e.test.d.ts +0 -12
- package/src/nexus/__tests__/permissions.test.d.ts +0 -7
- package/src/nexus/__tests__/query.test.d.ts +0 -7
- package/src/nexus/__tests__/reconcile.test.d.ts +0 -7
- package/src/nexus/__tests__/registry.test.d.ts +0 -7
- package/src/nexus/__tests__/transfer.test.d.ts +0 -8
- package/src/observability/__tests__/index.test.d.ts +0 -7
- package/src/observability/__tests__/log-filter.test.d.ts +0 -7
- package/src/observability/__tests__/log-parser.test.d.ts +0 -7
- package/src/observability/__tests__/log-reader.test.d.ts +0 -7
- package/src/orchestration/__tests__/autonomous-spec.test.d.ts +0 -9
- package/src/orchestration/__tests__/orchestration.test.d.ts +0 -7
- package/src/orchestration/__tests__/protocol-validators.test.d.ts +0 -9
- package/src/phases/__tests__/deps.test.d.ts +0 -7
- package/src/phases/__tests__/phases.test.d.ts +0 -7
- package/src/release/__tests__/artifacts.test.d.ts +0 -7
- package/src/release/__tests__/cancel-release.test.d.ts +0 -10
- package/src/release/__tests__/changelog-writer.test.d.ts +0 -6
- package/src/release/__tests__/push-policy.test.d.ts +0 -14
- package/src/release/__tests__/release.test.d.ts +0 -11
- package/src/sequence/__tests__/allocate.test.d.ts +0 -6
- package/src/sessions/__tests__/briefing-blocked.test.d.ts +0 -6
- package/src/sessions/__tests__/briefing.test.d.ts +0 -11
- package/src/sessions/__tests__/handoff-integration.test.d.ts +0 -8
- package/src/sessions/__tests__/handoff.test.d.ts +0 -11
- package/src/sessions/__tests__/index.test.d.ts +0 -2
- package/src/sessions/__tests__/session-cleanup.test.d.ts +0 -7
- package/src/sessions/__tests__/session-edge-cases.test.d.ts +0 -9
- package/src/sessions/__tests__/session-find.test.d.ts +0 -9
- package/src/sessions/__tests__/session-grade.integration.test.d.ts +0 -11
- package/src/sessions/__tests__/session-grade.test.d.ts +0 -6
- package/src/sessions/__tests__/session-memory-bridge.test.d.ts +0 -2
- package/src/sessions/__tests__/sessions.test.d.ts +0 -7
- package/src/skills/__tests__/discovery.test.d.ts +0 -6
- package/src/skills/__tests__/dispatch.test.d.ts +0 -6
- package/src/skills/__tests__/dynamic-skill-generator.test.d.ts +0 -2
- package/src/skills/__tests__/manifests.test.d.ts +0 -6
- package/src/skills/__tests__/precedence.test.d.ts +0 -6
- package/src/skills/__tests__/routing-table.test.d.ts +0 -2
- package/src/skills/__tests__/skill-paths.test.d.ts +0 -7
- package/src/skills/__tests__/test-utility.test.d.ts +0 -7
- package/src/skills/__tests__/token.test.d.ts +0 -6
- package/src/skills/__tests__/validation.test.d.ts +0 -6
- package/src/skills/__tests__/version.test.d.ts +0 -5
- package/src/skills/injection/__tests__/subagent.test.d.ts +0 -2
- package/src/skills/orchestrator/__tests__/spawn-tier.test.d.ts +0 -2
- package/src/spawn/__tests__/adapter-registry.test.d.ts +0 -2
- package/src/stats/__tests__/stats.test.d.ts +0 -7
- package/src/sticky/__tests__/purge.test.d.ts +0 -9
- package/src/store/__tests__/atomic.test.d.ts +0 -7
- package/src/store/__tests__/backup.test.d.ts +0 -7
- package/src/store/__tests__/brain-accessor-pageindex.test.d.ts +0 -12
- package/src/store/__tests__/brain-accessor.test.d.ts +0 -10
- package/src/store/__tests__/brain-pageindex.test.d.ts +0 -11
- package/src/store/__tests__/brain-schema.test.d.ts +0 -11
- package/src/store/__tests__/brain-vec.test.d.ts +0 -11
- package/src/store/__tests__/collision-detection.test.d.ts +0 -11
- package/src/store/__tests__/data-safety-central.test.d.ts +0 -20
- package/src/store/__tests__/db-helpers.test.d.ts +0 -7
- package/src/store/__tests__/e2e-safety-integration.test.d.ts +0 -13
- package/src/store/__tests__/git-checkpoint.test.d.ts +0 -7
- package/src/store/__tests__/idempotent-migration.test.d.ts +0 -5
- package/src/store/__tests__/import-logging.test.d.ts +0 -7
- package/src/store/__tests__/import-sort.test.d.ts +0 -7
- package/src/store/__tests__/json.test.d.ts +0 -7
- package/src/store/__tests__/lifecycle-schema-parity.test.d.ts +0 -2
- package/src/store/__tests__/migration-integration.test.d.ts +0 -15
- package/src/store/__tests__/migration-retry.test.d.ts +0 -10
- package/src/store/__tests__/migration-safety.test.d.ts +0 -21
- package/src/store/__tests__/migration-sqlite.test.d.ts +0 -11
- package/src/store/__tests__/performance-safety.test.d.ts +0 -17
- package/src/store/__tests__/project-detect.test.d.ts +0 -6
- package/src/store/__tests__/project-registry.test.d.ts +0 -7
- package/src/store/__tests__/provider.test.d.ts +0 -9
- package/src/store/__tests__/relations.test.d.ts +0 -9
- package/src/store/__tests__/safety-accessor.test.d.ts +0 -18
- package/src/store/__tests__/sequence-validation.test.d.ts +0 -11
- package/src/store/__tests__/session-store.test.d.ts +0 -11
- package/src/store/__tests__/sqlite-backup.test.d.ts +0 -14
- package/src/store/__tests__/sqlite.test.d.ts +0 -11
- package/src/store/__tests__/task-store.test.d.ts +0 -11
- package/src/store/__tests__/test-db-helper.d.ts +0 -61
- package/src/store/__tests__/write-verification.test.d.ts +0 -11
- package/src/system/__tests__/cleanup.test.d.ts +0 -2
- package/src/system/__tests__/health.test.d.ts +0 -2
- package/src/task-work/__tests__/start-deps.test.d.ts +0 -6
- package/src/tasks/__tests__/add.test.d.ts +0 -7
- package/src/tasks/__tests__/archive.test.d.ts +0 -7
- package/src/tasks/__tests__/assignee.test.d.ts +0 -14
- package/src/tasks/__tests__/atomicity.test.d.ts +0 -6
- package/src/tasks/__tests__/cancel-ops.test.d.ts +0 -7
- package/src/tasks/__tests__/complete-unblocks.test.d.ts +0 -6
- package/src/tasks/__tests__/complete.test.d.ts +0 -7
- package/src/tasks/__tests__/delete.test.d.ts +0 -7
- package/src/tasks/__tests__/dependency-check.test.d.ts +0 -7
- package/src/tasks/__tests__/deps-ready.test.d.ts +0 -6
- package/src/tasks/__tests__/epic-enforcement.test.d.ts +0 -15
- package/src/tasks/__tests__/find.test.d.ts +0 -7
- package/src/tasks/__tests__/graph-ops.test.d.ts +0 -7
- package/src/tasks/__tests__/hierarchy-policy.test.d.ts +0 -6
- package/src/tasks/__tests__/hierarchy.test.d.ts +0 -7
- package/src/tasks/__tests__/id-generator.test.d.ts +0 -2
- package/src/tasks/__tests__/labels.test.d.ts +0 -7
- package/src/tasks/__tests__/list.test.d.ts +0 -7
- package/src/tasks/__tests__/minimal-test.test.d.ts +0 -2
- package/src/tasks/__tests__/phase-tracking.test.d.ts +0 -7
- package/src/tasks/__tests__/pipeline-stage.test.d.ts +0 -14
- package/src/tasks/__tests__/plan-priority.test.d.ts +0 -10
- package/src/tasks/__tests__/priority-normalization.test.d.ts +0 -7
- package/src/tasks/__tests__/relates.test.d.ts +0 -9
- package/src/tasks/__tests__/show-deps.test.d.ts +0 -6
- package/src/tasks/__tests__/show.test.d.ts +0 -7
- package/src/tasks/__tests__/staleness.test.d.ts +0 -7
- package/src/tasks/__tests__/task-ops-depends.test.d.ts +0 -6
- package/src/tasks/__tests__/update.test.d.ts +0 -7
- package/src/validation/__tests__/chain-validation.test.d.ts +0 -7
- package/src/validation/__tests__/compliance.test.d.ts +0 -7
- package/src/validation/__tests__/docs-sync.test.d.ts +0 -7
- package/src/validation/__tests__/doctor-gitignore.test.d.ts +0 -7
- package/src/validation/__tests__/doctor-injection.test.d.ts +0 -11
- package/src/validation/__tests__/doctor.test.d.ts +0 -7
- package/src/validation/__tests__/engine.test.d.ts +0 -7
- package/src/validation/__tests__/manifest.test.d.ts +0 -7
- package/src/validation/__tests__/protocol-common.test.d.ts +0 -7
- package/src/validation/__tests__/verification.test.d.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -3101,7 +3101,7 @@ var init_sql = __esm({
|
|
|
3101
3101
|
return new SQL([new StringChunk(str)]);
|
|
3102
3102
|
}
|
|
3103
3103
|
_sql.raw = raw;
|
|
3104
|
-
function
|
|
3104
|
+
function join107(chunks, separator) {
|
|
3105
3105
|
const result = [];
|
|
3106
3106
|
for (const [i, chunk] of chunks.entries()) {
|
|
3107
3107
|
if (i > 0 && separator !== void 0) result.push(separator);
|
|
@@ -3109,7 +3109,7 @@ var init_sql = __esm({
|
|
|
3109
3109
|
}
|
|
3110
3110
|
return new SQL(result);
|
|
3111
3111
|
}
|
|
3112
|
-
_sql.join =
|
|
3112
|
+
_sql.join = join107;
|
|
3113
3113
|
function identifier(value) {
|
|
3114
3114
|
return new Name(value);
|
|
3115
3115
|
}
|
|
@@ -7883,7 +7883,7 @@ var init_select2 = __esm({
|
|
|
7883
7883
|
const baseTableName = this.tableName;
|
|
7884
7884
|
const tableName = getTableLikeName(table);
|
|
7885
7885
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
7886
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
7886
|
+
if (typeof tableName === "string" && this.config.joins?.some((join107) => join107.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
7887
7887
|
if (!this.isPartialSelect) {
|
|
7888
7888
|
if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
|
|
7889
7889
|
if (typeof tableName === "string" && !is(table, SQL)) {
|
|
@@ -9168,7 +9168,7 @@ var init_dialect = __esm({
|
|
|
9168
9168
|
if (!joins2) return;
|
|
9169
9169
|
const withEntries = Object.entries(joins2).filter(([_, v]) => v);
|
|
9170
9170
|
if (!withEntries.length) return;
|
|
9171
|
-
return sql.join(withEntries.map(([k,
|
|
9171
|
+
return sql.join(withEntries.map(([k, join107]) => {
|
|
9172
9172
|
const relation = tableConfig.relations[k];
|
|
9173
9173
|
const isSingle2 = is(relation, One3);
|
|
9174
9174
|
const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
|
|
@@ -9179,7 +9179,7 @@ var init_dialect = __esm({
|
|
|
9179
9179
|
table: targetTable,
|
|
9180
9180
|
mode: isSingle2 ? "first" : "many",
|
|
9181
9181
|
schema,
|
|
9182
|
-
queryConfig:
|
|
9182
|
+
queryConfig: join107,
|
|
9183
9183
|
tableConfig: schema[relation.targetTableName],
|
|
9184
9184
|
relationWhere: filter,
|
|
9185
9185
|
isNested: true,
|
|
@@ -9193,7 +9193,7 @@ var init_dialect = __esm({
|
|
|
9193
9193
|
key: k,
|
|
9194
9194
|
selection: innerQuery.selection,
|
|
9195
9195
|
isArray: !isSingle2,
|
|
9196
|
-
isOptional: (relation.optional ?? false) ||
|
|
9196
|
+
isOptional: (relation.optional ?? false) || join107 !== true && !!join107.where
|
|
9197
9197
|
});
|
|
9198
9198
|
const jsonColumns = sql.join(innerQuery.selection.map((s) => {
|
|
9199
9199
|
return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
|
|
@@ -9592,7 +9592,7 @@ var init_update = __esm({
|
|
|
9592
9592
|
createJoin(joinType) {
|
|
9593
9593
|
return ((table, on) => {
|
|
9594
9594
|
const tableName = getTableLikeName(table);
|
|
9595
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
9595
|
+
if (typeof tableName === "string" && this.config.joins.some((join107) => join107.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
9596
9596
|
if (typeof on === "function") {
|
|
9597
9597
|
const from = this.config.from ? is(table, SQLiteTable) ? table[Table.Symbol.Columns] : is(table, Subquery) ? table._.selectedFields : is(table, SQLiteViewBase) ? table[ViewBaseConfig].selectedFields : void 0 : void 0;
|
|
9598
9598
|
on = on(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
|
|
@@ -10794,7 +10794,7 @@ function resolveProjectPath(relativePath, cwd) {
|
|
|
10794
10794
|
if (isAbsolutePath(relativePath)) {
|
|
10795
10795
|
return relativePath;
|
|
10796
10796
|
}
|
|
10797
|
-
if (relativePath.startsWith("~/") || relativePath === "~") {
|
|
10797
|
+
if (relativePath.startsWith("~/") || relativePath.startsWith("~\\") || relativePath === "~") {
|
|
10798
10798
|
return resolve2(homedir(), relativePath.slice(2));
|
|
10799
10799
|
}
|
|
10800
10800
|
return resolve2(getProjectRoot(cwd), relativePath);
|
|
@@ -10873,7 +10873,8 @@ function getCleoTemplatesTildePath() {
|
|
|
10873
10873
|
const absPath = getCleoTemplatesDir();
|
|
10874
10874
|
const home = homedir();
|
|
10875
10875
|
if (absPath.startsWith(home)) {
|
|
10876
|
-
|
|
10876
|
+
const relative11 = absPath.slice(home.length).replace(/\\/g, "/");
|
|
10877
|
+
return `~${relative11}`;
|
|
10877
10878
|
}
|
|
10878
10879
|
return absPath;
|
|
10879
10880
|
}
|
|
@@ -11322,7 +11323,7 @@ var init_tasks_schema = __esm({
|
|
|
11322
11323
|
LIFECYCLE_EVIDENCE_TYPES = ["file", "url", "manifest"];
|
|
11323
11324
|
TOKEN_USAGE_METHODS = ["otel", "provider_api", "tokenizer", "heuristic"];
|
|
11324
11325
|
TOKEN_USAGE_CONFIDENCE = ["real", "high", "estimated", "coarse"];
|
|
11325
|
-
TOKEN_USAGE_TRANSPORTS = ["cli", "
|
|
11326
|
+
TOKEN_USAGE_TRANSPORTS = ["cli", "api", "agent", "unknown"];
|
|
11326
11327
|
TASK_RELATION_TYPES = [
|
|
11327
11328
|
"related",
|
|
11328
11329
|
"blocks",
|
|
@@ -12142,7 +12143,7 @@ function openNativeDatabase(path2, options) {
|
|
|
12142
12143
|
if (finalMode !== "wal") {
|
|
12143
12144
|
db.close();
|
|
12144
12145
|
throw new Error(
|
|
12145
|
-
`CRITICAL: Failed to set WAL journal mode after ${MAX_WAL_RETRIES} attempts. Database is in '${finalMode}' mode. Another process likely holds an EXCLUSIVE lock on ${path2}. Refusing to open \u2014 concurrent writes in DELETE mode cause data loss. Kill other cleo
|
|
12146
|
+
`CRITICAL: Failed to set WAL journal mode after ${MAX_WAL_RETRIES} attempts. Database is in '${finalMode}' mode. Another process likely holds an EXCLUSIVE lock on ${path2}. Refusing to open \u2014 concurrent writes in DELETE mode cause data loss. Kill other cleo processes and retry. (T5173)`
|
|
12146
12147
|
);
|
|
12147
12148
|
}
|
|
12148
12149
|
}
|
|
@@ -16786,7 +16787,7 @@ var init_architecture = __esm({
|
|
|
16786
16787
|
hooks: "React hooks",
|
|
16787
16788
|
composables: "Vue composables",
|
|
16788
16789
|
cli: "CLI interface",
|
|
16789
|
-
mcp: "
|
|
16790
|
+
mcp: "Protocol server layer (legacy)",
|
|
16790
16791
|
dispatch: "Dispatch / routing layer",
|
|
16791
16792
|
types: "Type definitions",
|
|
16792
16793
|
schemas: "Schema definitions",
|
|
@@ -16819,7 +16820,7 @@ var init_architecture = __esm({
|
|
|
16819
16820
|
mvc: ["models", "views", "controllers"],
|
|
16820
16821
|
modular: ["modules"],
|
|
16821
16822
|
"clean-architecture": ["domain", "application", "infrastructure"],
|
|
16822
|
-
"dispatch-first": ["dispatch", "core", "
|
|
16823
|
+
"dispatch-first": ["dispatch", "core", "cli"],
|
|
16823
16824
|
"component-based": ["components", "pages"]
|
|
16824
16825
|
};
|
|
16825
16826
|
}
|
|
@@ -19244,7 +19245,7 @@ async function queryAudit(options) {
|
|
|
19244
19245
|
},
|
|
19245
19246
|
metadata: {
|
|
19246
19247
|
taskId: row.taskId !== "system" && row.taskId !== "unknown" ? row.taskId : void 0,
|
|
19247
|
-
source: row.source ?? "
|
|
19248
|
+
source: row.source ?? "cli",
|
|
19248
19249
|
gateway: row.gateway
|
|
19249
19250
|
},
|
|
19250
19251
|
error: row.errorMessage ?? void 0
|
|
@@ -19410,7 +19411,7 @@ async function gradeSession(sessionId, cwd) {
|
|
|
19410
19411
|
const helpCalls = sessionEntries.filter(
|
|
19411
19412
|
(e) => e.domain === "admin" && e.operation === "help" || e.domain === "tools" && (e.operation === "skill.show" || e.operation === "skill.list") || e.domain === "skills" && (e.operation === "list" || e.operation === "show")
|
|
19412
19413
|
);
|
|
19413
|
-
const
|
|
19414
|
+
const queryCalls = sessionEntries.filter((e) => e.metadata?.gateway === "query");
|
|
19414
19415
|
let disclosureScore = 0;
|
|
19415
19416
|
if (helpCalls.length > 0) {
|
|
19416
19417
|
disclosureScore += 10;
|
|
@@ -19420,11 +19421,11 @@ async function gradeSession(sessionId, cwd) {
|
|
|
19420
19421
|
} else {
|
|
19421
19422
|
result.flags.push("No admin.help or skill lookup calls (load ct-cleo for guidance)");
|
|
19422
19423
|
}
|
|
19423
|
-
if (
|
|
19424
|
+
if (queryCalls.length > 0) {
|
|
19424
19425
|
disclosureScore += 10;
|
|
19425
|
-
result.dimensions.disclosureUse.evidence.push(`query
|
|
19426
|
+
result.dimensions.disclosureUse.evidence.push(`query gateway used ${queryCalls.length}x`);
|
|
19426
19427
|
} else {
|
|
19427
|
-
result.flags.push("No
|
|
19428
|
+
result.flags.push("No query gateway calls (use query operations for programmatic access)");
|
|
19428
19429
|
}
|
|
19429
19430
|
result.dimensions.disclosureUse.score = disclosureScore;
|
|
19430
19431
|
result.totalScore = Object.values(result.dimensions).reduce((sum, d) => sum + d.score, 0);
|
|
@@ -19988,48 +19989,7 @@ var init_file_hooks = __esm({
|
|
|
19988
19989
|
}
|
|
19989
19990
|
});
|
|
19990
19991
|
|
|
19991
|
-
// packages/core/src/hooks/handlers/
|
|
19992
|
-
async function isBrainCaptureEnabled(projectRoot) {
|
|
19993
|
-
const envOverride = process.env["CLEO_BRAIN_CAPTURE_MCP"];
|
|
19994
|
-
if (envOverride !== void 0) {
|
|
19995
|
-
return envOverride === "true";
|
|
19996
|
-
}
|
|
19997
|
-
try {
|
|
19998
|
-
const { loadConfig: loadConfig3 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
19999
|
-
const config2 = await loadConfig3(projectRoot);
|
|
20000
|
-
return config2.brain?.captureMcp ?? false;
|
|
20001
|
-
} catch {
|
|
20002
|
-
return false;
|
|
20003
|
-
}
|
|
20004
|
-
}
|
|
20005
|
-
async function handlePromptSubmit(projectRoot, payload) {
|
|
20006
|
-
if (!await isBrainCaptureEnabled(projectRoot)) return;
|
|
20007
|
-
const { observeBrain: observeBrain2 } = await Promise.resolve().then(() => (init_brain_retrieval(), brain_retrieval_exports));
|
|
20008
|
-
try {
|
|
20009
|
-
await observeBrain2(projectRoot, {
|
|
20010
|
-
text: `Prompt submitted: ${payload.gateway}:${payload.domain}.${payload.operation}${payload.source ? ` from ${payload.source}` : ""}`,
|
|
20011
|
-
title: `Prompt: ${payload.domain}.${payload.operation}`,
|
|
20012
|
-
type: "discovery",
|
|
20013
|
-
sourceType: "agent"
|
|
20014
|
-
});
|
|
20015
|
-
} catch (err) {
|
|
20016
|
-
if (!isMissingBrainSchemaError(err)) throw err;
|
|
20017
|
-
}
|
|
20018
|
-
}
|
|
20019
|
-
async function handleResponseComplete(projectRoot, payload) {
|
|
20020
|
-
if (!await isBrainCaptureEnabled(projectRoot)) return;
|
|
20021
|
-
const { observeBrain: observeBrain2 } = await Promise.resolve().then(() => (init_brain_retrieval(), brain_retrieval_exports));
|
|
20022
|
-
try {
|
|
20023
|
-
await observeBrain2(projectRoot, {
|
|
20024
|
-
text: `Response ${payload.success ? "success" : "failed"}: ${payload.gateway}:${payload.domain}.${payload.operation}${payload.durationMs != null ? ` (${payload.durationMs}ms)` : ""}${payload.errorCode ? ` error: ${payload.errorCode}` : ""}`,
|
|
20025
|
-
title: `Response: ${payload.domain}.${payload.operation}`,
|
|
20026
|
-
type: payload.success ? "discovery" : "change",
|
|
20027
|
-
sourceType: "agent"
|
|
20028
|
-
});
|
|
20029
|
-
} catch (err) {
|
|
20030
|
-
if (!isMissingBrainSchemaError(err)) throw err;
|
|
20031
|
-
}
|
|
20032
|
-
}
|
|
19992
|
+
// packages/core/src/hooks/handlers/notification-hooks.ts
|
|
20033
19993
|
async function handleSystemNotification(projectRoot, payload) {
|
|
20034
19994
|
if (payload.filePath || payload.changeType) return;
|
|
20035
19995
|
if (!payload.message) return;
|
|
@@ -20047,23 +20007,11 @@ async function handleSystemNotification(projectRoot, payload) {
|
|
|
20047
20007
|
if (!isMissingBrainSchemaError(err)) throw err;
|
|
20048
20008
|
}
|
|
20049
20009
|
}
|
|
20050
|
-
var
|
|
20051
|
-
"packages/core/src/hooks/handlers/
|
|
20010
|
+
var init_notification_hooks = __esm({
|
|
20011
|
+
"packages/core/src/hooks/handlers/notification-hooks.ts"() {
|
|
20052
20012
|
"use strict";
|
|
20053
20013
|
init_registry();
|
|
20054
20014
|
init_handler_helpers();
|
|
20055
|
-
hooks.register({
|
|
20056
|
-
id: "brain-prompt-submit",
|
|
20057
|
-
event: "PromptSubmit",
|
|
20058
|
-
handler: handlePromptSubmit,
|
|
20059
|
-
priority: 100
|
|
20060
|
-
});
|
|
20061
|
-
hooks.register({
|
|
20062
|
-
id: "brain-response-complete",
|
|
20063
|
-
event: "ResponseComplete",
|
|
20064
|
-
handler: handleResponseComplete,
|
|
20065
|
-
priority: 100
|
|
20066
|
-
});
|
|
20067
20015
|
hooks.register({
|
|
20068
20016
|
id: "brain-system-notification",
|
|
20069
20017
|
event: "Notification",
|
|
@@ -20276,7 +20224,7 @@ var init_handlers = __esm({
|
|
|
20276
20224
|
init_task_hooks();
|
|
20277
20225
|
init_error_hooks();
|
|
20278
20226
|
init_file_hooks();
|
|
20279
|
-
|
|
20227
|
+
init_notification_hooks();
|
|
20280
20228
|
init_work_capture_hooks();
|
|
20281
20229
|
init_agent_hooks();
|
|
20282
20230
|
init_context_hooks();
|
|
@@ -20284,7 +20232,7 @@ var init_handlers = __esm({
|
|
|
20284
20232
|
init_context_hooks();
|
|
20285
20233
|
init_error_hooks();
|
|
20286
20234
|
init_file_hooks();
|
|
20287
|
-
|
|
20235
|
+
init_notification_hooks();
|
|
20288
20236
|
init_session_hooks();
|
|
20289
20237
|
init_task_hooks();
|
|
20290
20238
|
init_work_capture_hooks();
|
|
@@ -22186,7 +22134,7 @@ async function endSession(options = {}, cwd, accessor) {
|
|
|
22186
22134
|
session.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
22187
22135
|
const duration3 = Math.floor((Date.now() - new Date(session.startedAt).getTime()) / 1e3);
|
|
22188
22136
|
const { hooks: hooks2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
|
|
22189
|
-
hooks2.dispatch("SessionEnd", cwd ?? process.cwd(), {
|
|
22137
|
+
await hooks2.dispatch("SessionEnd", cwd ?? process.cwd(), {
|
|
22190
22138
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22191
22139
|
sessionId: session.id,
|
|
22192
22140
|
duration: duration3,
|
|
@@ -22195,7 +22143,7 @@ async function endSession(options = {}, cwd, accessor) {
|
|
|
22195
22143
|
}).catch(() => {
|
|
22196
22144
|
});
|
|
22197
22145
|
const { bridgeSessionToMemory: bridgeSessionToMemory2 } = await Promise.resolve().then(() => (init_session_memory_bridge(), session_memory_bridge_exports));
|
|
22198
|
-
bridgeSessionToMemory2(cwd ?? process.cwd(), {
|
|
22146
|
+
await bridgeSessionToMemory2(cwd ?? process.cwd(), {
|
|
22199
22147
|
sessionId: session.id,
|
|
22200
22148
|
scope: options.sessionId ? session.scope.type : session.scope.epicId ? `epic:${session.scope.epicId}` : session.scope.type,
|
|
22201
22149
|
tasksCompleted: session.tasksCompleted || [],
|
|
@@ -22208,6 +22156,11 @@ async function endSession(options = {}, cwd, accessor) {
|
|
|
22208
22156
|
}
|
|
22209
22157
|
const acc = accessor ?? await getAccessor(cwd);
|
|
22210
22158
|
await acc.upsertSingleSession(session);
|
|
22159
|
+
try {
|
|
22160
|
+
const { refreshMemoryBridge: refreshMemoryBridge2 } = await Promise.resolve().then(() => (init_memory_bridge(), memory_bridge_exports));
|
|
22161
|
+
await refreshMemoryBridge2(cwd ?? process.cwd());
|
|
22162
|
+
} catch {
|
|
22163
|
+
}
|
|
22211
22164
|
return session;
|
|
22212
22165
|
}
|
|
22213
22166
|
async function sessionStatus(cwd, accessor) {
|
|
@@ -23854,7 +23807,7 @@ function checkInjection2(projectRoot) {
|
|
|
23854
23807
|
const missing = [];
|
|
23855
23808
|
for (const ref of refs) {
|
|
23856
23809
|
const rawPath = ref.slice(1).trim();
|
|
23857
|
-
const resolvedPath = rawPath.startsWith("~/") ? join40(homedir2(), rawPath.slice(2)) : join40(projectRoot, rawPath);
|
|
23810
|
+
const resolvedPath = rawPath.startsWith("~/") || rawPath.startsWith("~\\") ? join40(homedir2(), rawPath.slice(2)) : join40(projectRoot, rawPath);
|
|
23858
23811
|
if (!existsSync37(resolvedPath)) {
|
|
23859
23812
|
missing.push(rawPath);
|
|
23860
23813
|
}
|
|
@@ -24021,7 +23974,7 @@ function getCleoVersion() {
|
|
|
24021
23974
|
}
|
|
24022
23975
|
function isCleoContributorProject(projectRoot) {
|
|
24023
23976
|
const exists2 = (p) => existsSync38(join41(projectRoot, p));
|
|
24024
|
-
if (!exists2("src/
|
|
23977
|
+
if (!exists2("src/dispatch") || !exists2("src/core")) return false;
|
|
24025
23978
|
try {
|
|
24026
23979
|
const pkg = JSON.parse(readFileSync24(join41(projectRoot, "package.json"), "utf-8"));
|
|
24027
23980
|
return pkg.name === "@cleocode/cleo";
|
|
@@ -24183,46 +24136,10 @@ async function ensureProjectInfo(projectRoot, opts) {
|
|
|
24183
24136
|
return { action: "created", path: projectInfoPath };
|
|
24184
24137
|
}
|
|
24185
24138
|
async function ensureContributorMcp(projectRoot) {
|
|
24186
|
-
if (!isCleoContributorProject(projectRoot)) {
|
|
24187
|
-
return {
|
|
24188
|
-
action: "skipped",
|
|
24189
|
-
path: join41(projectRoot, ".mcp.json"),
|
|
24190
|
-
details: "Not a contributor project"
|
|
24191
|
-
};
|
|
24192
|
-
}
|
|
24193
|
-
const mcpJsonPath = join41(projectRoot, ".mcp.json");
|
|
24194
|
-
const mcpEntry = {
|
|
24195
|
-
command: "node",
|
|
24196
|
-
args: ["--disable-warning=ExperimentalWarning", join41(projectRoot, "dist", "mcp", "index.js")],
|
|
24197
|
-
env: {}
|
|
24198
|
-
};
|
|
24199
|
-
let config2 = { mcpServers: {} };
|
|
24200
|
-
if (existsSync38(mcpJsonPath)) {
|
|
24201
|
-
try {
|
|
24202
|
-
config2 = JSON.parse(readFileSync24(mcpJsonPath, "utf-8"));
|
|
24203
|
-
} catch {
|
|
24204
|
-
}
|
|
24205
|
-
}
|
|
24206
|
-
const servers = config2["mcpServers"] ?? {};
|
|
24207
|
-
const existing = servers["cleo-dev"];
|
|
24208
|
-
const existingArgs = existing?.["args"];
|
|
24209
|
-
const targetArg = join41(projectRoot, "dist", "mcp", "index.js");
|
|
24210
|
-
if (existing && existingArgs?.includes(targetArg)) {
|
|
24211
|
-
return { action: "skipped", path: mcpJsonPath, details: "cleo-dev MCP entry already current" };
|
|
24212
|
-
}
|
|
24213
|
-
servers["cleo-dev"] = mcpEntry;
|
|
24214
|
-
const removedProduction = "cleo" in servers;
|
|
24215
|
-
delete servers["cleo"];
|
|
24216
|
-
config2["mcpServers"] = servers;
|
|
24217
|
-
await writeFile6(mcpJsonPath, JSON.stringify(config2, null, 2));
|
|
24218
|
-
const details = [
|
|
24219
|
-
`cleo-dev \u2192 node ${targetArg}`,
|
|
24220
|
-
...removedProduction ? ["removed production cleo entry (global-only per ADR-029)"] : []
|
|
24221
|
-
].join("; ");
|
|
24222
24139
|
return {
|
|
24223
|
-
action:
|
|
24224
|
-
path:
|
|
24225
|
-
details
|
|
24140
|
+
action: "skipped",
|
|
24141
|
+
path: projectRoot,
|
|
24142
|
+
details: "Removed (Phase 2 production readiness)"
|
|
24226
24143
|
};
|
|
24227
24144
|
}
|
|
24228
24145
|
async function ensureProjectContext(projectRoot, opts) {
|
|
@@ -24736,7 +24653,7 @@ function checkGlobalHome() {
|
|
|
24736
24653
|
status: "failed",
|
|
24737
24654
|
message: "Global ~/.cleo/ directory not found",
|
|
24738
24655
|
details: { path: cleoHome, exists: false },
|
|
24739
|
-
fix: "cleo init
|
|
24656
|
+
fix: "cleo init"
|
|
24740
24657
|
};
|
|
24741
24658
|
}
|
|
24742
24659
|
const missingDirs = REQUIRED_GLOBAL_SUBDIRS.filter((dir) => !existsSync38(join41(cleoHome, dir)));
|
|
@@ -24769,7 +24686,7 @@ function checkGlobalTemplates() {
|
|
|
24769
24686
|
status: "failed",
|
|
24770
24687
|
message: "CLEO-INJECTION.md template not found in global templates",
|
|
24771
24688
|
details: { path: injectionPath, exists: false },
|
|
24772
|
-
fix: "cleo init
|
|
24689
|
+
fix: "cleo init"
|
|
24773
24690
|
};
|
|
24774
24691
|
}
|
|
24775
24692
|
const xdgContent = readFileSync24(injectionPath, "utf-8");
|
|
@@ -24897,119 +24814,14 @@ backups/
|
|
|
24897
24814
|
}
|
|
24898
24815
|
});
|
|
24899
24816
|
|
|
24900
|
-
// packages/core/src/mcp/index.ts
|
|
24901
|
-
var mcp_exports = {};
|
|
24902
|
-
__export(mcp_exports, {
|
|
24903
|
-
detectEnvMode: () => detectEnvMode,
|
|
24904
|
-
generateMcpServerEntry: () => generateMcpServerEntry,
|
|
24905
|
-
getMcpServerName: () => getMcpServerName
|
|
24906
|
-
});
|
|
24907
|
-
import { readFileSync as readFileSync26, realpathSync } from "node:fs";
|
|
24908
|
-
import { join as join46 } from "node:path";
|
|
24909
|
-
function getMcpServerName(env) {
|
|
24910
|
-
if (env.channel === "dev") return "cleo-dev";
|
|
24911
|
-
if (env.channel === "beta") return "cleo-beta";
|
|
24912
|
-
return "cleo";
|
|
24913
|
-
}
|
|
24914
|
-
function detectEnvMode() {
|
|
24915
|
-
const rawScriptPath = process.argv[1] ?? "";
|
|
24916
|
-
let scriptPath;
|
|
24917
|
-
try {
|
|
24918
|
-
scriptPath = realpathSync(rawScriptPath).replace(/\\/g, "/");
|
|
24919
|
-
} catch {
|
|
24920
|
-
scriptPath = rawScriptPath.replace(/\\/g, "/");
|
|
24921
|
-
}
|
|
24922
|
-
const marker = "/node_modules/@cleocode/cleo/";
|
|
24923
|
-
const markerIdx = scriptPath.indexOf(marker);
|
|
24924
|
-
if (markerIdx >= 0) {
|
|
24925
|
-
const pkgRoot = scriptPath.slice(0, markerIdx + marker.length);
|
|
24926
|
-
let channel2 = "stable";
|
|
24927
|
-
try {
|
|
24928
|
-
const pkg = JSON.parse(readFileSync26(join46(pkgRoot, "package.json"), "utf-8"));
|
|
24929
|
-
channel2 = (pkg.version ?? "").includes("-beta") ? "beta" : "stable";
|
|
24930
|
-
} catch {
|
|
24931
|
-
channel2 = "stable";
|
|
24932
|
-
}
|
|
24933
|
-
return { mode: "prod-npm", source: "npm", channel: channel2 };
|
|
24934
|
-
}
|
|
24935
|
-
const devVersionPath = join46(process.env["HOME"] ?? "", ".cleo-dev", "VERSION");
|
|
24936
|
-
try {
|
|
24937
|
-
const devContent = readFileSync26(devVersionPath, "utf-8");
|
|
24938
|
-
const devKv = {};
|
|
24939
|
-
const devLines = devContent.trim().split("\n");
|
|
24940
|
-
for (let i = 1; i < devLines.length; i++) {
|
|
24941
|
-
const eq13 = devLines[i].indexOf("=");
|
|
24942
|
-
if (eq13 > 0) devKv[devLines[i].slice(0, eq13).trim()] = devLines[i].slice(eq13 + 1).trim();
|
|
24943
|
-
}
|
|
24944
|
-
if (devKv["mode"] === "dev-ts" && devKv["source"]) {
|
|
24945
|
-
const devSource = devKv["source"].replace(/\\/g, "/");
|
|
24946
|
-
if (scriptPath.startsWith(devSource) || scriptPath.includes(devSource)) {
|
|
24947
|
-
return { mode: "dev-ts", source: devKv["source"], channel: "dev" };
|
|
24948
|
-
}
|
|
24949
|
-
}
|
|
24950
|
-
} catch {
|
|
24951
|
-
}
|
|
24952
|
-
const versionPath = join46(getCleoHome(), "VERSION");
|
|
24953
|
-
let content;
|
|
24954
|
-
try {
|
|
24955
|
-
content = readFileSync26(versionPath, "utf-8");
|
|
24956
|
-
} catch {
|
|
24957
|
-
return { mode: "unknown", source: null, channel: "unknown" };
|
|
24958
|
-
}
|
|
24959
|
-
const kvPairs = {};
|
|
24960
|
-
const lines = content.trim().split("\n");
|
|
24961
|
-
const installedVersion = lines[0]?.trim() ?? "";
|
|
24962
|
-
for (let i = 1; i < lines.length; i++) {
|
|
24963
|
-
const eqIdx = lines[i].indexOf("=");
|
|
24964
|
-
if (eqIdx > 0) {
|
|
24965
|
-
kvPairs[lines[i].slice(0, eqIdx).trim()] = lines[i].slice(eqIdx + 1).trim();
|
|
24966
|
-
}
|
|
24967
|
-
}
|
|
24968
|
-
const rawMode = kvPairs["mode"] ?? "unknown";
|
|
24969
|
-
const mode = rawMode === "dev-ts" ? "dev-ts" : rawMode === "prod-npm" ? "prod-npm" : "unknown";
|
|
24970
|
-
const channel = mode === "dev-ts" ? "dev" : installedVersion.includes("-beta") ? "beta" : mode === "prod-npm" ? "stable" : "unknown";
|
|
24971
|
-
return {
|
|
24972
|
-
mode,
|
|
24973
|
-
source: mode === "dev-ts" ? kvPairs["source"] ?? null : null,
|
|
24974
|
-
channel
|
|
24975
|
-
};
|
|
24976
|
-
}
|
|
24977
|
-
function generateMcpServerEntry(env) {
|
|
24978
|
-
if (env.mode === "dev-ts" && env.source) {
|
|
24979
|
-
return {
|
|
24980
|
-
command: "node",
|
|
24981
|
-
args: [join46(env.source, "dist", "mcp", "index.js")],
|
|
24982
|
-
env: {}
|
|
24983
|
-
};
|
|
24984
|
-
}
|
|
24985
|
-
if (env.channel === "beta") {
|
|
24986
|
-
return {
|
|
24987
|
-
command: "npx",
|
|
24988
|
-
args: ["-y", "@cleocode/cleo@beta", "mcp"],
|
|
24989
|
-
env: {}
|
|
24990
|
-
};
|
|
24991
|
-
}
|
|
24992
|
-
return {
|
|
24993
|
-
command: "npx",
|
|
24994
|
-
args: ["-y", "@cleocode/cleo@latest", "mcp"],
|
|
24995
|
-
env: {}
|
|
24996
|
-
};
|
|
24997
|
-
}
|
|
24998
|
-
var init_mcp = __esm({
|
|
24999
|
-
"packages/core/src/mcp/index.ts"() {
|
|
25000
|
-
"use strict";
|
|
25001
|
-
init_paths();
|
|
25002
|
-
}
|
|
25003
|
-
});
|
|
25004
|
-
|
|
25005
24817
|
// packages/core/src/sessions/session-enforcement.ts
|
|
25006
|
-
import { existsSync as existsSync42, readFileSync as
|
|
25007
|
-
import { join as
|
|
24818
|
+
import { existsSync as existsSync42, readFileSync as readFileSync26 } from "node:fs";
|
|
24819
|
+
import { join as join46 } from "node:path";
|
|
25008
24820
|
function readConfigValueSync(path2, defaultValue, cwd) {
|
|
25009
24821
|
try {
|
|
25010
|
-
const configPath =
|
|
24822
|
+
const configPath = join46(getCleoDir(cwd), "config.json");
|
|
25011
24823
|
if (!existsSync42(configPath)) return defaultValue;
|
|
25012
|
-
const config2 = JSON.parse(
|
|
24824
|
+
const config2 = JSON.parse(readFileSync26(configPath, "utf-8"));
|
|
25013
24825
|
const keys = path2.split(".");
|
|
25014
24826
|
let value = config2;
|
|
25015
24827
|
for (const key of keys) {
|
|
@@ -25974,16 +25786,16 @@ import {
|
|
|
25974
25786
|
existsSync as existsSync50,
|
|
25975
25787
|
mkdirSync as mkdirSync12,
|
|
25976
25788
|
readdirSync as readdirSync21,
|
|
25977
|
-
readFileSync as
|
|
25789
|
+
readFileSync as readFileSync32,
|
|
25978
25790
|
rmSync as rmSync2,
|
|
25979
25791
|
statSync as statSync11,
|
|
25980
25792
|
writeFileSync as writeFileSync5
|
|
25981
25793
|
} from "node:fs";
|
|
25982
|
-
import { join as
|
|
25794
|
+
import { join as join54 } from "node:path";
|
|
25983
25795
|
function detectLegacyAgentOutputs(projectRoot, cleoDir) {
|
|
25984
|
-
const hasResearchOutputs = existsSync50(
|
|
25985
|
-
const hasLegacyAgentOutputs = existsSync50(
|
|
25986
|
-
const hasCanonical = existsSync50(
|
|
25796
|
+
const hasResearchOutputs = existsSync50(join54(projectRoot, "claudedocs", "research-outputs"));
|
|
25797
|
+
const hasLegacyAgentOutputs = existsSync50(join54(projectRoot, "claudedocs", "agent-outputs"));
|
|
25798
|
+
const hasCanonical = existsSync50(join54(cleoDir, "agent-outputs"));
|
|
25987
25799
|
const legacyPaths = [];
|
|
25988
25800
|
if (hasResearchOutputs) legacyPaths.push("claudedocs/research-outputs/");
|
|
25989
25801
|
if (hasLegacyAgentOutputs) legacyPaths.push("claudedocs/agent-outputs/");
|
|
@@ -26006,7 +25818,7 @@ function migrateAgentOutputs(projectRoot, cleoDir) {
|
|
|
26006
25818
|
summary: "No legacy output directories found"
|
|
26007
25819
|
};
|
|
26008
25820
|
}
|
|
26009
|
-
const newDir =
|
|
25821
|
+
const newDir = join54(cleoDir, "agent-outputs");
|
|
26010
25822
|
const hadCanonical = detection.hasCanonical;
|
|
26011
25823
|
mkdirSync12(newDir, { recursive: true });
|
|
26012
25824
|
let totalCopied = 0;
|
|
@@ -26014,11 +25826,11 @@ function migrateAgentOutputs(projectRoot, cleoDir) {
|
|
|
26014
25826
|
const copiedFiles = /* @__PURE__ */ new Set();
|
|
26015
25827
|
const legacySources = [
|
|
26016
25828
|
{
|
|
26017
|
-
path:
|
|
25829
|
+
path: join54(projectRoot, "claudedocs", "research-outputs"),
|
|
26018
25830
|
exists: detection.hasResearchOutputs
|
|
26019
25831
|
},
|
|
26020
25832
|
{
|
|
26021
|
-
path:
|
|
25833
|
+
path: join54(projectRoot, "claudedocs", "agent-outputs"),
|
|
26022
25834
|
exists: detection.hasLegacyAgentOutputs
|
|
26023
25835
|
}
|
|
26024
25836
|
];
|
|
@@ -26045,11 +25857,11 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26045
25857
|
const entries = readdirSync21(srcDir);
|
|
26046
25858
|
for (const entry of entries) {
|
|
26047
25859
|
if (entry === "MANIFEST.jsonl") {
|
|
26048
|
-
collectManifestLines(
|
|
25860
|
+
collectManifestLines(join54(srcDir, entry), manifestLines);
|
|
26049
25861
|
continue;
|
|
26050
25862
|
}
|
|
26051
|
-
const srcPath =
|
|
26052
|
-
const dstPath =
|
|
25863
|
+
const srcPath = join54(srcDir, entry);
|
|
25864
|
+
const dstPath = join54(dstDir, entry);
|
|
26053
25865
|
try {
|
|
26054
25866
|
const st = statSync11(srcPath);
|
|
26055
25867
|
if (st.isDirectory()) {
|
|
@@ -26057,7 +25869,7 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26057
25869
|
for (const sf of readdirSync21(srcPath)) {
|
|
26058
25870
|
if (!copiedFiles.has(sf)) {
|
|
26059
25871
|
try {
|
|
26060
|
-
copyFileSync5(
|
|
25872
|
+
copyFileSync5(join54(srcPath, sf), join54(dstPath, sf));
|
|
26061
25873
|
copiedFiles.add(sf);
|
|
26062
25874
|
count2++;
|
|
26063
25875
|
} catch {
|
|
@@ -26076,7 +25888,7 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26076
25888
|
}
|
|
26077
25889
|
function collectManifestLines(manifestPath, out) {
|
|
26078
25890
|
try {
|
|
26079
|
-
const content =
|
|
25891
|
+
const content = readFileSync32(manifestPath, "utf-8");
|
|
26080
25892
|
for (const line2 of content.split("\n")) {
|
|
26081
25893
|
if (!line2.trim()) continue;
|
|
26082
25894
|
let rewritten = line2;
|
|
@@ -26089,11 +25901,11 @@ function collectManifestLines(manifestPath, out) {
|
|
|
26089
25901
|
}
|
|
26090
25902
|
}
|
|
26091
25903
|
function mergeManifests(newDir, hadCanonical, legacyLines) {
|
|
26092
|
-
const manifestPath =
|
|
25904
|
+
const manifestPath = join54(newDir, "MANIFEST.jsonl");
|
|
26093
25905
|
const existingLines = [];
|
|
26094
25906
|
if (hadCanonical && existsSync50(manifestPath)) {
|
|
26095
25907
|
try {
|
|
26096
|
-
const existing =
|
|
25908
|
+
const existing = readFileSync32(manifestPath, "utf-8");
|
|
26097
25909
|
for (const line2 of existing.split("\n")) {
|
|
26098
25910
|
if (line2.trim()) existingLines.push(line2);
|
|
26099
25911
|
}
|
|
@@ -26125,10 +25937,10 @@ function mergeManifests(newDir, hadCanonical, legacyLines) {
|
|
|
26125
25937
|
return finalLines.length;
|
|
26126
25938
|
}
|
|
26127
25939
|
function updateConfigPaths(cleoDir) {
|
|
26128
|
-
const configPath =
|
|
25940
|
+
const configPath = join54(cleoDir, "config.json");
|
|
26129
25941
|
if (!existsSync50(configPath)) return;
|
|
26130
25942
|
try {
|
|
26131
|
-
const config2 = JSON.parse(
|
|
25943
|
+
const config2 = JSON.parse(readFileSync32(configPath, "utf-8"));
|
|
26132
25944
|
const currentDir = config2.agentOutputs?.directory ?? config2.agentOutputs ?? config2.research?.outputDir;
|
|
26133
25945
|
if (currentDir && currentDir !== CANONICAL_DIR) {
|
|
26134
25946
|
if (typeof config2.agentOutputs === "object") {
|
|
@@ -26151,19 +25963,19 @@ function removeLegacyDirs(projectRoot, detection) {
|
|
|
26151
25963
|
const removed = [];
|
|
26152
25964
|
if (detection.hasResearchOutputs) {
|
|
26153
25965
|
try {
|
|
26154
|
-
rmSync2(
|
|
25966
|
+
rmSync2(join54(projectRoot, "claudedocs", "research-outputs"), { recursive: true, force: true });
|
|
26155
25967
|
removed.push("claudedocs/research-outputs/");
|
|
26156
25968
|
} catch {
|
|
26157
25969
|
}
|
|
26158
25970
|
}
|
|
26159
25971
|
if (detection.hasLegacyAgentOutputs) {
|
|
26160
25972
|
try {
|
|
26161
|
-
rmSync2(
|
|
25973
|
+
rmSync2(join54(projectRoot, "claudedocs", "agent-outputs"), { recursive: true, force: true });
|
|
26162
25974
|
removed.push("claudedocs/agent-outputs/");
|
|
26163
25975
|
} catch {
|
|
26164
25976
|
}
|
|
26165
25977
|
}
|
|
26166
|
-
const claudedocsDir =
|
|
25978
|
+
const claudedocsDir = join54(projectRoot, "claudedocs");
|
|
26167
25979
|
if (existsSync50(claudedocsDir)) {
|
|
26168
25980
|
try {
|
|
26169
25981
|
if (readdirSync21(claudedocsDir).length === 0) {
|
|
@@ -26193,8 +26005,8 @@ __export(migrate_json_to_sqlite_exports, {
|
|
|
26193
26005
|
migrateJsonToSqlite: () => migrateJsonToSqlite
|
|
26194
26006
|
});
|
|
26195
26007
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
26196
|
-
import { existsSync as existsSync55, readFileSync as
|
|
26197
|
-
import { join as
|
|
26008
|
+
import { existsSync as existsSync55, readFileSync as readFileSync37, renameSync as renameSync4 } from "node:fs";
|
|
26009
|
+
import { join as join60 } from "node:path";
|
|
26198
26010
|
import { sql as sql10 } from "drizzle-orm";
|
|
26199
26011
|
async function migrateJsonToSqlite() {
|
|
26200
26012
|
const jsonPath = getRegistryPath();
|
|
@@ -26202,7 +26014,7 @@ async function migrateJsonToSqlite() {
|
|
|
26202
26014
|
const logger = getLogger("nexus");
|
|
26203
26015
|
let raw;
|
|
26204
26016
|
try {
|
|
26205
|
-
raw =
|
|
26017
|
+
raw = readFileSync37(jsonPath, "utf-8");
|
|
26206
26018
|
} catch {
|
|
26207
26019
|
return 0;
|
|
26208
26020
|
}
|
|
@@ -26226,9 +26038,9 @@ async function migrateJsonToSqlite() {
|
|
|
26226
26038
|
if (!projectPath || !projectHash) continue;
|
|
26227
26039
|
let projectId = randomUUID3();
|
|
26228
26040
|
try {
|
|
26229
|
-
const infoPath =
|
|
26041
|
+
const infoPath = join60(projectPath, ".cleo", "project-info.json");
|
|
26230
26042
|
if (existsSync55(infoPath)) {
|
|
26231
|
-
const info = JSON.parse(
|
|
26043
|
+
const info = JSON.parse(readFileSync37(infoPath, "utf-8"));
|
|
26232
26044
|
if (typeof info["projectId"] === "string" && info["projectId"]) {
|
|
26233
26045
|
projectId = info["projectId"];
|
|
26234
26046
|
}
|
|
@@ -26298,15 +26110,15 @@ __export(registry_exports3, {
|
|
|
26298
26110
|
});
|
|
26299
26111
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
26300
26112
|
import { mkdir as mkdir12 } from "node:fs/promises";
|
|
26301
|
-
import { basename as basename8, join as
|
|
26113
|
+
import { basename as basename8, join as join61 } from "node:path";
|
|
26302
26114
|
function getNexusHome() {
|
|
26303
|
-
return process.env["NEXUS_HOME"] ??
|
|
26115
|
+
return process.env["NEXUS_HOME"] ?? join61(getCleoHome(), "nexus");
|
|
26304
26116
|
}
|
|
26305
26117
|
function getNexusCacheDir() {
|
|
26306
|
-
return process.env["NEXUS_CACHE_DIR"] ??
|
|
26118
|
+
return process.env["NEXUS_CACHE_DIR"] ?? join61(getNexusHome(), "cache");
|
|
26307
26119
|
}
|
|
26308
26120
|
function getRegistryPath() {
|
|
26309
|
-
return process.env["NEXUS_REGISTRY_FILE"] ??
|
|
26121
|
+
return process.env["NEXUS_REGISTRY_FILE"] ?? join61(getCleoHome(), "projects-registry.json");
|
|
26310
26122
|
}
|
|
26311
26123
|
function rowToProject(row) {
|
|
26312
26124
|
let labels = [];
|
|
@@ -26423,10 +26235,10 @@ async function readProjectMeta(projectPath) {
|
|
|
26423
26235
|
}
|
|
26424
26236
|
async function readProjectId(projectPath) {
|
|
26425
26237
|
try {
|
|
26426
|
-
const { readFileSync:
|
|
26427
|
-
const infoPath =
|
|
26238
|
+
const { readFileSync: readFileSync79, existsSync: existsSync107 } = await import("node:fs");
|
|
26239
|
+
const infoPath = join61(projectPath, ".cleo", "project-info.json");
|
|
26428
26240
|
if (!existsSync107(infoPath)) return "";
|
|
26429
|
-
const data = JSON.parse(
|
|
26241
|
+
const data = JSON.parse(readFileSync79(infoPath, "utf-8"));
|
|
26430
26242
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
26431
26243
|
} catch {
|
|
26432
26244
|
return "";
|
|
@@ -27090,6 +26902,208 @@ var init_complete = __esm({
|
|
|
27090
26902
|
}
|
|
27091
26903
|
});
|
|
27092
26904
|
|
|
26905
|
+
// packages/core/src/validation/validation-rules.ts
|
|
26906
|
+
var validation_rules_exports = {};
|
|
26907
|
+
__export(validation_rules_exports, {
|
|
26908
|
+
hasErrors: () => hasErrors,
|
|
26909
|
+
validateHierarchy: () => validateHierarchy,
|
|
26910
|
+
validateIdUniqueness: () => validateIdUniqueness,
|
|
26911
|
+
validateNewTask: () => validateNewTask,
|
|
26912
|
+
validateNoDuplicateDescription: () => validateNoDuplicateDescription,
|
|
26913
|
+
validateStatusTransition: () => validateStatusTransition,
|
|
26914
|
+
validateTimestamps: () => validateTimestamps,
|
|
26915
|
+
validateTitleDescription: () => validateTitleDescription
|
|
26916
|
+
});
|
|
26917
|
+
function validateTitleDescription(title, description) {
|
|
26918
|
+
const violations = [];
|
|
26919
|
+
if (!title || title.trim().length === 0) {
|
|
26920
|
+
violations.push({
|
|
26921
|
+
rule: "title-required",
|
|
26922
|
+
field: "title",
|
|
26923
|
+
message: "Title is required and cannot be empty",
|
|
26924
|
+
severity: "error"
|
|
26925
|
+
});
|
|
26926
|
+
}
|
|
26927
|
+
if (!description || description.trim().length === 0) {
|
|
26928
|
+
violations.push({
|
|
26929
|
+
rule: "description-required",
|
|
26930
|
+
field: "description",
|
|
26931
|
+
message: "Description is required and cannot be empty",
|
|
26932
|
+
severity: "error"
|
|
26933
|
+
});
|
|
26934
|
+
}
|
|
26935
|
+
if (title && description && title.trim().toLowerCase() === description.trim().toLowerCase()) {
|
|
26936
|
+
violations.push({
|
|
26937
|
+
rule: "title-description-different",
|
|
26938
|
+
field: "description",
|
|
26939
|
+
message: "Title and description must be different",
|
|
26940
|
+
severity: "error"
|
|
26941
|
+
});
|
|
26942
|
+
}
|
|
26943
|
+
return violations;
|
|
26944
|
+
}
|
|
26945
|
+
function validateTimestamps(task) {
|
|
26946
|
+
const violations = [];
|
|
26947
|
+
const now = /* @__PURE__ */ new Date();
|
|
26948
|
+
const threshold = new Date(now.getTime() + 5 * 60 * 1e3);
|
|
26949
|
+
const timestampFields = [
|
|
26950
|
+
["createdAt", task.createdAt],
|
|
26951
|
+
["updatedAt", task.updatedAt],
|
|
26952
|
+
["completedAt", task.completedAt],
|
|
26953
|
+
["cancelledAt", task.cancelledAt]
|
|
26954
|
+
];
|
|
26955
|
+
for (const [field, value] of timestampFields) {
|
|
26956
|
+
if (value) {
|
|
26957
|
+
const date6 = new Date(value);
|
|
26958
|
+
if (Number.isNaN(date6.getTime())) {
|
|
26959
|
+
violations.push({
|
|
26960
|
+
rule: "valid-timestamp",
|
|
26961
|
+
field,
|
|
26962
|
+
message: `Invalid timestamp format: ${value}`,
|
|
26963
|
+
severity: "error"
|
|
26964
|
+
});
|
|
26965
|
+
} else if (date6 > threshold) {
|
|
26966
|
+
violations.push({
|
|
26967
|
+
rule: "no-future-timestamps",
|
|
26968
|
+
field,
|
|
26969
|
+
message: `Timestamp ${value} is in the future`,
|
|
26970
|
+
severity: "error"
|
|
26971
|
+
});
|
|
26972
|
+
}
|
|
26973
|
+
}
|
|
26974
|
+
}
|
|
26975
|
+
return violations;
|
|
26976
|
+
}
|
|
26977
|
+
function validateIdUniqueness(taskId, existingIds) {
|
|
26978
|
+
if (existingIds.has(taskId)) {
|
|
26979
|
+
return [
|
|
26980
|
+
{
|
|
26981
|
+
rule: "unique-id",
|
|
26982
|
+
field: "id",
|
|
26983
|
+
message: `Task ID '${taskId}' already exists`,
|
|
26984
|
+
severity: "error"
|
|
26985
|
+
}
|
|
26986
|
+
];
|
|
26987
|
+
}
|
|
26988
|
+
return [];
|
|
26989
|
+
}
|
|
26990
|
+
function validateNoDuplicateDescription(description, existingDescriptions, _excludeTaskId) {
|
|
26991
|
+
const normalizedNew = description.trim().toLowerCase();
|
|
26992
|
+
for (const existing of existingDescriptions) {
|
|
26993
|
+
if (existing.trim().toLowerCase() === normalizedNew) {
|
|
26994
|
+
return [
|
|
26995
|
+
{
|
|
26996
|
+
rule: "no-duplicate-description",
|
|
26997
|
+
field: "description",
|
|
26998
|
+
message: "A task with this exact description already exists",
|
|
26999
|
+
severity: "warning"
|
|
27000
|
+
}
|
|
27001
|
+
];
|
|
27002
|
+
}
|
|
27003
|
+
}
|
|
27004
|
+
return [];
|
|
27005
|
+
}
|
|
27006
|
+
function validateHierarchy(parentId, tasks2, _taskType, limits) {
|
|
27007
|
+
const violations = [];
|
|
27008
|
+
if (!parentId) {
|
|
27009
|
+
return violations;
|
|
27010
|
+
}
|
|
27011
|
+
const maxDepth = limits?.maxDepth ?? 3;
|
|
27012
|
+
const maxSiblings = limits?.maxSiblings ?? 0;
|
|
27013
|
+
const parent = tasks2.find((t) => t.id === parentId);
|
|
27014
|
+
if (!parent) {
|
|
27015
|
+
violations.push({
|
|
27016
|
+
rule: "parent-exists",
|
|
27017
|
+
field: "parentId",
|
|
27018
|
+
message: `Parent task '${parentId}' not found`,
|
|
27019
|
+
severity: "error"
|
|
27020
|
+
});
|
|
27021
|
+
return violations;
|
|
27022
|
+
}
|
|
27023
|
+
let depth = 1;
|
|
27024
|
+
let current = parent;
|
|
27025
|
+
while (current.parentId) {
|
|
27026
|
+
depth++;
|
|
27027
|
+
const nextParent = tasks2.find((t) => t.id === current.parentId);
|
|
27028
|
+
if (!nextParent) break;
|
|
27029
|
+
current = nextParent;
|
|
27030
|
+
}
|
|
27031
|
+
if (depth > maxDepth - 1) {
|
|
27032
|
+
violations.push({
|
|
27033
|
+
rule: "max-depth",
|
|
27034
|
+
field: "parentId",
|
|
27035
|
+
message: `Maximum hierarchy depth of ${maxDepth} exceeded (epic -> task -> subtask)`,
|
|
27036
|
+
severity: "error"
|
|
27037
|
+
});
|
|
27038
|
+
}
|
|
27039
|
+
const siblingCount = tasks2.filter((t) => t.parentId === parentId).length;
|
|
27040
|
+
if (maxSiblings > 0 && siblingCount >= maxSiblings) {
|
|
27041
|
+
violations.push({
|
|
27042
|
+
rule: "max-siblings",
|
|
27043
|
+
field: "parentId",
|
|
27044
|
+
message: `Parent '${parentId}' already has ${siblingCount} children (max ${maxSiblings})`,
|
|
27045
|
+
severity: "error"
|
|
27046
|
+
});
|
|
27047
|
+
}
|
|
27048
|
+
return violations;
|
|
27049
|
+
}
|
|
27050
|
+
function validateStatusTransition(currentStatus, newStatus) {
|
|
27051
|
+
const validTransitions = {
|
|
27052
|
+
pending: ["active", "blocked", "done", "cancelled"],
|
|
27053
|
+
active: ["pending", "blocked", "done", "cancelled"],
|
|
27054
|
+
blocked: ["pending", "active", "done", "cancelled"],
|
|
27055
|
+
done: ["pending", "active"],
|
|
27056
|
+
// restore (alias: reopen)
|
|
27057
|
+
cancelled: ["pending"]
|
|
27058
|
+
// restore (alias: uncancel)
|
|
27059
|
+
};
|
|
27060
|
+
const allowed = validTransitions[currentStatus];
|
|
27061
|
+
if (!allowed) {
|
|
27062
|
+
return [
|
|
27063
|
+
{
|
|
27064
|
+
rule: "valid-status-transition",
|
|
27065
|
+
field: "status",
|
|
27066
|
+
message: `Unknown current status: '${currentStatus}'`,
|
|
27067
|
+
severity: "error"
|
|
27068
|
+
}
|
|
27069
|
+
];
|
|
27070
|
+
}
|
|
27071
|
+
if (!allowed.includes(newStatus)) {
|
|
27072
|
+
return [
|
|
27073
|
+
{
|
|
27074
|
+
rule: "valid-status-transition",
|
|
27075
|
+
field: "status",
|
|
27076
|
+
message: `Cannot transition from '${currentStatus}' to '${newStatus}'. Valid: ${allowed.join(", ")}`,
|
|
27077
|
+
severity: "error"
|
|
27078
|
+
}
|
|
27079
|
+
];
|
|
27080
|
+
}
|
|
27081
|
+
return [];
|
|
27082
|
+
}
|
|
27083
|
+
function validateNewTask(task, existingIds, existingDescriptions, existingTasks, limits) {
|
|
27084
|
+
const violations = [];
|
|
27085
|
+
violations.push(...validateTitleDescription(task.title, task.description));
|
|
27086
|
+
violations.push(...validateTimestamps(task));
|
|
27087
|
+
if (task.id) {
|
|
27088
|
+
violations.push(...validateIdUniqueness(task.id, existingIds));
|
|
27089
|
+
}
|
|
27090
|
+
if (task.description) {
|
|
27091
|
+
violations.push(...validateNoDuplicateDescription(task.description, existingDescriptions));
|
|
27092
|
+
}
|
|
27093
|
+
if (task.parentId) {
|
|
27094
|
+
violations.push(...validateHierarchy(task.parentId, existingTasks, task.type, limits));
|
|
27095
|
+
}
|
|
27096
|
+
return violations;
|
|
27097
|
+
}
|
|
27098
|
+
function hasErrors(violations) {
|
|
27099
|
+
return violations.some((v) => v.severity === "error");
|
|
27100
|
+
}
|
|
27101
|
+
var init_validation_rules = __esm({
|
|
27102
|
+
"packages/core/src/validation/validation-rules.ts"() {
|
|
27103
|
+
"use strict";
|
|
27104
|
+
}
|
|
27105
|
+
});
|
|
27106
|
+
|
|
27093
27107
|
// packages/core/src/tasks/update.ts
|
|
27094
27108
|
var update_exports = {};
|
|
27095
27109
|
__export(update_exports, {
|
|
@@ -27139,6 +27153,11 @@ async function updateTask(options, cwd, accessor) {
|
|
|
27139
27153
|
}
|
|
27140
27154
|
if (options.status !== void 0) {
|
|
27141
27155
|
validateStatus(options.status);
|
|
27156
|
+
const { validateStatusTransition: validateStatusTransition3 } = await Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports));
|
|
27157
|
+
const transitionViolations = validateStatusTransition3(task.status, options.status);
|
|
27158
|
+
if (transitionViolations.length > 0) {
|
|
27159
|
+
throw new CleoError(6 /* VALIDATION_ERROR */, transitionViolations[0].message);
|
|
27160
|
+
}
|
|
27142
27161
|
const oldStatus = task.status;
|
|
27143
27162
|
task.status = options.status;
|
|
27144
27163
|
changes.push("status");
|
|
@@ -27362,10 +27381,10 @@ var init_update2 = __esm({
|
|
|
27362
27381
|
// packages/core/src/hooks.ts
|
|
27363
27382
|
import { existsSync as existsSync86 } from "node:fs";
|
|
27364
27383
|
import { chmod, copyFile as copyFile2, mkdir as mkdir14, readFile as readFile14 } from "node:fs/promises";
|
|
27365
|
-
import { join as
|
|
27384
|
+
import { join as join89 } from "node:path";
|
|
27366
27385
|
async function ensureGitHooks(projectRoot, opts) {
|
|
27367
|
-
const gitDir =
|
|
27368
|
-
const gitHooksDir =
|
|
27386
|
+
const gitDir = join89(projectRoot, ".git");
|
|
27387
|
+
const gitHooksDir = join89(gitDir, "hooks");
|
|
27369
27388
|
if (!existsSync86(gitDir)) {
|
|
27370
27389
|
return {
|
|
27371
27390
|
action: "skipped",
|
|
@@ -27374,7 +27393,7 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27374
27393
|
};
|
|
27375
27394
|
}
|
|
27376
27395
|
const packageRoot = getPackageRoot();
|
|
27377
|
-
const sourceDir =
|
|
27396
|
+
const sourceDir = join89(packageRoot, "templates", "git-hooks");
|
|
27378
27397
|
if (!existsSync86(sourceDir)) {
|
|
27379
27398
|
return {
|
|
27380
27399
|
action: "skipped",
|
|
@@ -27387,8 +27406,8 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27387
27406
|
let installedCount = 0;
|
|
27388
27407
|
const errors = [];
|
|
27389
27408
|
for (const hook of MANAGED_HOOKS) {
|
|
27390
|
-
const sourcePath =
|
|
27391
|
-
const destPath =
|
|
27409
|
+
const sourcePath = join89(sourceDir, hook);
|
|
27410
|
+
const destPath = join89(gitHooksDir, hook);
|
|
27392
27411
|
if (!existsSync86(sourcePath)) {
|
|
27393
27412
|
continue;
|
|
27394
27413
|
}
|
|
@@ -27426,13 +27445,13 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27426
27445
|
};
|
|
27427
27446
|
}
|
|
27428
27447
|
async function checkGitHooks(projectRoot) {
|
|
27429
|
-
const gitHooksDir =
|
|
27448
|
+
const gitHooksDir = join89(projectRoot, ".git", "hooks");
|
|
27430
27449
|
const packageRoot = getPackageRoot();
|
|
27431
|
-
const sourceDir =
|
|
27450
|
+
const sourceDir = join89(packageRoot, "templates", "git-hooks");
|
|
27432
27451
|
const results = [];
|
|
27433
27452
|
for (const hook of MANAGED_HOOKS) {
|
|
27434
|
-
const sourcePath =
|
|
27435
|
-
const installedPath =
|
|
27453
|
+
const sourcePath = join89(sourceDir, hook);
|
|
27454
|
+
const installedPath = join89(gitHooksDir, hook);
|
|
27436
27455
|
const result = {
|
|
27437
27456
|
hook,
|
|
27438
27457
|
installed: false,
|
|
@@ -27485,10 +27504,10 @@ __export(init_exports, {
|
|
|
27485
27504
|
isAutoInitEnabled: () => isAutoInitEnabled,
|
|
27486
27505
|
updateDocs: () => updateDocs
|
|
27487
27506
|
});
|
|
27488
|
-
import { existsSync as existsSync103, readdirSync as readdirSync35, readFileSync as
|
|
27507
|
+
import { existsSync as existsSync103, readdirSync as readdirSync35, readFileSync as readFileSync75 } from "node:fs";
|
|
27489
27508
|
import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
|
|
27490
27509
|
import { platform as platform4 } from "node:os";
|
|
27491
|
-
import { basename as basename17, dirname as dirname20, join as
|
|
27510
|
+
import { basename as basename17, dirname as dirname20, join as join103 } from "node:path";
|
|
27492
27511
|
async function initAgentDefinition(created, warnings) {
|
|
27493
27512
|
let agentSourceDir = null;
|
|
27494
27513
|
try {
|
|
@@ -27496,7 +27515,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27496
27515
|
const req = createRequire7(import.meta.url);
|
|
27497
27516
|
const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
|
|
27498
27517
|
const agentsPkgRoot = dirname20(agentsPkgMain);
|
|
27499
|
-
const candidate =
|
|
27518
|
+
const candidate = join103(agentsPkgRoot, "cleo-subagent");
|
|
27500
27519
|
if (existsSync103(candidate)) {
|
|
27501
27520
|
agentSourceDir = candidate;
|
|
27502
27521
|
}
|
|
@@ -27504,7 +27523,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27504
27523
|
}
|
|
27505
27524
|
if (!agentSourceDir) {
|
|
27506
27525
|
const packageRoot = getPackageRoot();
|
|
27507
|
-
const bundled =
|
|
27526
|
+
const bundled = join103(packageRoot, "agents", "cleo-subagent");
|
|
27508
27527
|
if (existsSync103(bundled)) {
|
|
27509
27528
|
agentSourceDir = bundled;
|
|
27510
27529
|
}
|
|
@@ -27513,7 +27532,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27513
27532
|
warnings.push("agents/cleo-subagent/ not found in package, skipping agent definition install");
|
|
27514
27533
|
return;
|
|
27515
27534
|
}
|
|
27516
|
-
const globalAgentsDir =
|
|
27535
|
+
const globalAgentsDir = join103(getAgentsHome(), "agents", "cleo-subagent");
|
|
27517
27536
|
await mkdir16(dirname20(globalAgentsDir), { recursive: true });
|
|
27518
27537
|
try {
|
|
27519
27538
|
try {
|
|
@@ -27537,7 +27556,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27537
27556
|
await mkdir16(globalAgentsDir, { recursive: true });
|
|
27538
27557
|
const files = readdirSync35(agentSourceDir);
|
|
27539
27558
|
for (const file2 of files) {
|
|
27540
|
-
await copyFile3(
|
|
27559
|
+
await copyFile3(join103(agentSourceDir, file2), join103(globalAgentsDir, file2));
|
|
27541
27560
|
}
|
|
27542
27561
|
created.push("agent: cleo-subagent (copied)");
|
|
27543
27562
|
} catch (copyErr) {
|
|
@@ -27547,37 +27566,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27547
27566
|
}
|
|
27548
27567
|
}
|
|
27549
27568
|
}
|
|
27550
|
-
async function initMcpServer(
|
|
27551
|
-
try {
|
|
27552
|
-
const { detectEnvMode: detectEnvMode2, generateMcpServerEntry: generateMcpServerEntry2, getMcpServerName: getMcpServerName2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
|
|
27553
|
-
const { getInstalledProviders: getInstalledProviders3, installMcpServerToAll } = await import("@cleocode/caamp");
|
|
27554
|
-
const env = detectEnvMode2();
|
|
27555
|
-
const serverEntry = generateMcpServerEntry2(env);
|
|
27556
|
-
const serverName = getMcpServerName2(env);
|
|
27557
|
-
const providers = getInstalledProviders3();
|
|
27558
|
-
if (providers.length === 0) {
|
|
27559
|
-
return;
|
|
27560
|
-
}
|
|
27561
|
-
const results = await installMcpServerToAll(
|
|
27562
|
-
providers,
|
|
27563
|
-
serverName,
|
|
27564
|
-
serverEntry,
|
|
27565
|
-
"global",
|
|
27566
|
-
projectRoot
|
|
27567
|
-
);
|
|
27568
|
-
const successes = results.filter((r) => r.success);
|
|
27569
|
-
const failures = results.filter((r) => !r.success);
|
|
27570
|
-
if (successes.length > 0) {
|
|
27571
|
-
created.push(`MCP server: ${successes.map((r) => r.provider.id).join(", ")}`);
|
|
27572
|
-
}
|
|
27573
|
-
for (const f of failures) {
|
|
27574
|
-
if (f.error) {
|
|
27575
|
-
warnings.push(`MCP install to ${f.provider.id}: ${f.error}`);
|
|
27576
|
-
}
|
|
27577
|
-
}
|
|
27578
|
-
} catch (err) {
|
|
27579
|
-
warnings.push(`MCP server install: ${err instanceof Error ? err.message : String(err)}`);
|
|
27580
|
-
}
|
|
27569
|
+
async function initMcpServer(_projectRoot, _created, _warnings) {
|
|
27581
27570
|
}
|
|
27582
27571
|
async function initCoreSkills(created, warnings) {
|
|
27583
27572
|
try {
|
|
@@ -27593,19 +27582,19 @@ async function initCoreSkills(created, warnings) {
|
|
|
27593
27582
|
const req = createRequire7(import.meta.url);
|
|
27594
27583
|
const skillsPkgMain = req.resolve("@cleocode/skills/package.json");
|
|
27595
27584
|
const skillsPkgRoot = dirname20(skillsPkgMain);
|
|
27596
|
-
if (existsSync103(
|
|
27585
|
+
if (existsSync103(join103(skillsPkgRoot, "skills.json"))) {
|
|
27597
27586
|
ctSkillsRoot = skillsPkgRoot;
|
|
27598
27587
|
}
|
|
27599
27588
|
} catch {
|
|
27600
27589
|
}
|
|
27601
27590
|
if (!ctSkillsRoot) {
|
|
27602
27591
|
try {
|
|
27603
|
-
const bundledPath =
|
|
27604
|
-
if (existsSync103(
|
|
27592
|
+
const bundledPath = join103(packageRoot, "packages", "skills");
|
|
27593
|
+
if (existsSync103(join103(bundledPath, "skills.json"))) {
|
|
27605
27594
|
ctSkillsRoot = bundledPath;
|
|
27606
27595
|
} else {
|
|
27607
|
-
const ctSkillsPath =
|
|
27608
|
-
if (existsSync103(
|
|
27596
|
+
const ctSkillsPath = join103(packageRoot, "node_modules", "@cleocode", "skills");
|
|
27597
|
+
if (existsSync103(join103(ctSkillsPath, "skills.json"))) {
|
|
27609
27598
|
ctSkillsRoot = ctSkillsPath;
|
|
27610
27599
|
}
|
|
27611
27600
|
}
|
|
@@ -27621,13 +27610,13 @@ async function initCoreSkills(created, warnings) {
|
|
|
27621
27610
|
} catch {
|
|
27622
27611
|
warnings.push("Failed to register skill library with CAAMP");
|
|
27623
27612
|
}
|
|
27624
|
-
const catalogPath =
|
|
27625
|
-
const catalog3 = JSON.parse(
|
|
27613
|
+
const catalogPath = join103(ctSkillsRoot, "skills.json");
|
|
27614
|
+
const catalog3 = JSON.parse(readFileSync75(catalogPath, "utf-8"));
|
|
27626
27615
|
const skills = catalog3.skills ?? [];
|
|
27627
27616
|
const coreSkills = skills.filter((s) => s.tier <= 2);
|
|
27628
27617
|
const installed = [];
|
|
27629
27618
|
for (const skill of coreSkills) {
|
|
27630
|
-
const skillSourceDir = dirname20(
|
|
27619
|
+
const skillSourceDir = dirname20(join103(ctSkillsRoot, skill.path));
|
|
27631
27620
|
if (!existsSync103(skillSourceDir)) {
|
|
27632
27621
|
continue;
|
|
27633
27622
|
}
|
|
@@ -27671,38 +27660,38 @@ async function initNexusRegistration(projectRoot, created, warnings) {
|
|
|
27671
27660
|
}
|
|
27672
27661
|
}
|
|
27673
27662
|
async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
27674
|
-
if (!existsSync103(
|
|
27663
|
+
if (!existsSync103(join103(projectRoot, ".git"))) {
|
|
27675
27664
|
return;
|
|
27676
27665
|
}
|
|
27677
|
-
const githubDir =
|
|
27678
|
-
const issueTemplateDir =
|
|
27666
|
+
const githubDir = join103(projectRoot, ".github");
|
|
27667
|
+
const issueTemplateDir = join103(githubDir, "ISSUE_TEMPLATE");
|
|
27679
27668
|
const packageRoot = getPackageRoot();
|
|
27680
|
-
const templateSrcDir =
|
|
27669
|
+
const templateSrcDir = join103(packageRoot, "templates", "github");
|
|
27681
27670
|
if (!existsSync103(templateSrcDir)) {
|
|
27682
27671
|
return;
|
|
27683
27672
|
}
|
|
27684
27673
|
await mkdir16(issueTemplateDir, { recursive: true });
|
|
27685
|
-
const issueSrcDir =
|
|
27674
|
+
const issueSrcDir = join103(templateSrcDir, "ISSUE_TEMPLATE");
|
|
27686
27675
|
if (existsSync103(issueSrcDir)) {
|
|
27687
27676
|
const issueFiles = readdirSync35(issueSrcDir);
|
|
27688
27677
|
for (const file2 of issueFiles) {
|
|
27689
|
-
const dest =
|
|
27678
|
+
const dest = join103(issueTemplateDir, file2);
|
|
27690
27679
|
if (existsSync103(dest)) {
|
|
27691
27680
|
skipped.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27692
27681
|
continue;
|
|
27693
27682
|
}
|
|
27694
|
-
const content =
|
|
27683
|
+
const content = readFileSync75(join103(issueSrcDir, file2), "utf-8");
|
|
27695
27684
|
await writeFile11(dest, content, "utf-8");
|
|
27696
27685
|
created.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27697
27686
|
}
|
|
27698
27687
|
}
|
|
27699
|
-
const prTemplateSrc =
|
|
27700
|
-
const prTemplateDest =
|
|
27688
|
+
const prTemplateSrc = join103(templateSrcDir, "pull_request_template.md");
|
|
27689
|
+
const prTemplateDest = join103(githubDir, "pull_request_template.md");
|
|
27701
27690
|
if (existsSync103(prTemplateSrc)) {
|
|
27702
27691
|
if (existsSync103(prTemplateDest)) {
|
|
27703
27692
|
skipped.push(".github/pull_request_template.md");
|
|
27704
27693
|
} else {
|
|
27705
|
-
const content =
|
|
27694
|
+
const content = readFileSync75(prTemplateSrc, "utf-8");
|
|
27706
27695
|
await writeFile11(prTemplateDest, content, "utf-8");
|
|
27707
27696
|
created.push(".github/pull_request_template.md");
|
|
27708
27697
|
}
|
|
@@ -27733,7 +27722,7 @@ async function updateDocs() {
|
|
|
27733
27722
|
async function initProject(opts = {}) {
|
|
27734
27723
|
const cleoDir = getCleoDirAbsolute();
|
|
27735
27724
|
const projRoot = getProjectRoot();
|
|
27736
|
-
const alreadyInitialized = existsSync103(cleoDir) && (existsSync103(
|
|
27725
|
+
const alreadyInitialized = existsSync103(cleoDir) && (existsSync103(join103(cleoDir, "tasks.db")) || existsSync103(join103(cleoDir, "config.json")));
|
|
27737
27726
|
if (alreadyInitialized && !opts.force) {
|
|
27738
27727
|
throw new CleoError(
|
|
27739
27728
|
1 /* GENERAL_ERROR */,
|
|
@@ -27757,7 +27746,7 @@ async function initProject(opts = {}) {
|
|
|
27757
27746
|
}
|
|
27758
27747
|
try {
|
|
27759
27748
|
const { getDb: getDb3 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
27760
|
-
await getDb3(
|
|
27749
|
+
await getDb3(join103(cleoDir, ".."));
|
|
27761
27750
|
created.push("tasks.db");
|
|
27762
27751
|
} catch (err) {
|
|
27763
27752
|
created.push(`tasks.db (deferred: ${err instanceof Error ? err.message : String(err)})`);
|
|
@@ -27787,7 +27776,7 @@ async function initProject(opts = {}) {
|
|
|
27787
27776
|
created.push(".gitignore");
|
|
27788
27777
|
}
|
|
27789
27778
|
} else {
|
|
27790
|
-
const gitignorePath =
|
|
27779
|
+
const gitignorePath = join103(cleoDir, ".gitignore");
|
|
27791
27780
|
if (existsSync103(gitignorePath)) {
|
|
27792
27781
|
skipped.push(".gitignore");
|
|
27793
27782
|
} else {
|
|
@@ -27799,12 +27788,12 @@ async function initProject(opts = {}) {
|
|
|
27799
27788
|
}
|
|
27800
27789
|
}
|
|
27801
27790
|
}
|
|
27802
|
-
const legacySequencePath =
|
|
27791
|
+
const legacySequencePath = join103(cleoDir, ".sequence");
|
|
27803
27792
|
try {
|
|
27804
27793
|
await unlink4(legacySequencePath);
|
|
27805
27794
|
} catch {
|
|
27806
27795
|
}
|
|
27807
|
-
const legacySequenceJsonPath =
|
|
27796
|
+
const legacySequenceJsonPath = join103(cleoDir, ".sequence.json");
|
|
27808
27797
|
try {
|
|
27809
27798
|
await unlink4(legacySequenceJsonPath);
|
|
27810
27799
|
} catch {
|
|
@@ -27901,12 +27890,12 @@ async function initProject(opts = {}) {
|
|
|
27901
27890
|
}
|
|
27902
27891
|
try {
|
|
27903
27892
|
const { ensureContributorMcp: ensureContributorMcp2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
|
|
27904
|
-
const
|
|
27905
|
-
if (
|
|
27906
|
-
created.push(`contributor
|
|
27893
|
+
const devResult = await ensureContributorMcp2(projRoot);
|
|
27894
|
+
if (devResult.action !== "skipped") {
|
|
27895
|
+
created.push(`contributor dev channel: ${devResult.details ?? devResult.action}`);
|
|
27907
27896
|
}
|
|
27908
27897
|
} catch (err) {
|
|
27909
|
-
warnings.push(`Contributor
|
|
27898
|
+
warnings.push(`Contributor dev channel: ${err instanceof Error ? err.message : String(err)}`);
|
|
27910
27899
|
}
|
|
27911
27900
|
await initAgentDefinition(created, warnings);
|
|
27912
27901
|
await initNexusRegistration(projRoot, created, warnings);
|
|
@@ -27965,8 +27954,8 @@ function isAutoInitEnabled() {
|
|
|
27965
27954
|
}
|
|
27966
27955
|
async function ensureInitialized(projectRoot) {
|
|
27967
27956
|
const root = projectRoot ?? getProjectRoot();
|
|
27968
|
-
const cleoDir =
|
|
27969
|
-
const isInit = existsSync103(cleoDir) && (existsSync103(
|
|
27957
|
+
const cleoDir = join103(root, ".cleo");
|
|
27958
|
+
const isInit = existsSync103(cleoDir) && (existsSync103(join103(cleoDir, "tasks.db")) || existsSync103(join103(cleoDir, "config.json")));
|
|
27970
27959
|
if (isInit) {
|
|
27971
27960
|
return { initialized: true };
|
|
27972
27961
|
}
|
|
@@ -27978,7 +27967,7 @@ async function ensureInitialized(projectRoot) {
|
|
|
27978
27967
|
}
|
|
27979
27968
|
async function getVersion2(projectRoot) {
|
|
27980
27969
|
const root = projectRoot ?? getProjectRoot();
|
|
27981
|
-
const versionPaths = [
|
|
27970
|
+
const versionPaths = [join103(root, "VERSION"), join103(root, "..", "VERSION")];
|
|
27982
27971
|
for (const versionPath of versionPaths) {
|
|
27983
27972
|
try {
|
|
27984
27973
|
const content = await readFile17(versionPath, "utf-8");
|
|
@@ -27989,7 +27978,7 @@ async function getVersion2(projectRoot) {
|
|
|
27989
27978
|
} catch {
|
|
27990
27979
|
}
|
|
27991
27980
|
}
|
|
27992
|
-
const pkg = await readJson(
|
|
27981
|
+
const pkg = await readJson(join103(root, "package.json"));
|
|
27993
27982
|
if (pkg?.version) {
|
|
27994
27983
|
return { version: pkg.version };
|
|
27995
27984
|
}
|
|
@@ -29848,22 +29837,15 @@ async function recoverCrashedAgents(thresholdMs = 3e4, cwd) {
|
|
|
29848
29837
|
var caamp_exports = {};
|
|
29849
29838
|
__export(caamp_exports, {
|
|
29850
29839
|
batchInstallWithRollback: () => batchInstallWithRollback,
|
|
29851
|
-
caampBuildServerConfig: () => buildServerConfig,
|
|
29852
29840
|
caampGenerateInjectionContent: () => generateInjectionContent,
|
|
29853
29841
|
caampGetInstructionFiles: () => getInstructionFiles,
|
|
29854
29842
|
caampResolveAlias: () => resolveAlias,
|
|
29855
29843
|
checkProviderCapabilities: () => checkProviderCapabilities,
|
|
29856
29844
|
checkProviderCapability: () => checkProviderCapability,
|
|
29857
|
-
dualScopeConfigure: () => dualScopeConfigure,
|
|
29858
29845
|
injectionCheck: () => injectionCheck,
|
|
29859
29846
|
injectionCheckAll: () => injectionCheckAll,
|
|
29860
29847
|
injectionUpdate: () => injectionUpdate,
|
|
29861
29848
|
injectionUpdateAll: () => injectionUpdateAll,
|
|
29862
|
-
mcpConfigPath: () => mcpConfigPath,
|
|
29863
|
-
mcpInstall: () => mcpInstall,
|
|
29864
|
-
mcpList: () => mcpList,
|
|
29865
|
-
mcpListAll: () => mcpListAll,
|
|
29866
|
-
mcpRemove: () => mcpRemove,
|
|
29867
29849
|
providerCount: () => providerCount,
|
|
29868
29850
|
providerDetect: () => providerDetect,
|
|
29869
29851
|
providerGet: () => providerGet,
|
|
@@ -29874,10 +29856,8 @@ __export(caamp_exports, {
|
|
|
29874
29856
|
|
|
29875
29857
|
// packages/core/src/caamp/adapter.ts
|
|
29876
29858
|
import {
|
|
29877
|
-
buildServerConfig,
|
|
29878
29859
|
checkAllInjections,
|
|
29879
29860
|
checkInjection,
|
|
29880
|
-
configureProviderGlobalAndProject,
|
|
29881
29861
|
detectAllProviders,
|
|
29882
29862
|
generateInjectionContent,
|
|
29883
29863
|
getAllProviders,
|
|
@@ -29889,12 +29869,7 @@ import {
|
|
|
29889
29869
|
inject,
|
|
29890
29870
|
injectAll,
|
|
29891
29871
|
installBatchWithRollback,
|
|
29892
|
-
|
|
29893
|
-
listAllMcpServers,
|
|
29894
|
-
listMcpServers,
|
|
29895
|
-
removeMcpServer,
|
|
29896
|
-
resolveAlias,
|
|
29897
|
-
resolveConfigPath
|
|
29872
|
+
resolveAlias
|
|
29898
29873
|
} from "@cleocode/caamp";
|
|
29899
29874
|
function providerList() {
|
|
29900
29875
|
try {
|
|
@@ -29989,117 +29964,6 @@ function registryVersion() {
|
|
|
29989
29964
|
};
|
|
29990
29965
|
}
|
|
29991
29966
|
}
|
|
29992
|
-
async function mcpList(providerId, scope, projectDir) {
|
|
29993
|
-
try {
|
|
29994
|
-
const provider = getProvider(providerId);
|
|
29995
|
-
if (!provider) {
|
|
29996
|
-
return {
|
|
29997
|
-
success: false,
|
|
29998
|
-
error: {
|
|
29999
|
-
code: "E_CAAMP_PROVIDER_NOT_FOUND",
|
|
30000
|
-
message: `Provider not found: ${providerId}`
|
|
30001
|
-
}
|
|
30002
|
-
};
|
|
30003
|
-
}
|
|
30004
|
-
const servers = await listMcpServers(provider, scope, projectDir);
|
|
30005
|
-
return { success: true, data: { servers } };
|
|
30006
|
-
} catch (err) {
|
|
30007
|
-
return {
|
|
30008
|
-
success: false,
|
|
30009
|
-
error: {
|
|
30010
|
-
code: "E_CAAMP_MCP_LIST",
|
|
30011
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30012
|
-
}
|
|
30013
|
-
};
|
|
30014
|
-
}
|
|
30015
|
-
}
|
|
30016
|
-
async function mcpListAll(scope, projectDir) {
|
|
30017
|
-
try {
|
|
30018
|
-
const providers = getInstalledProviders();
|
|
30019
|
-
const servers = await listAllMcpServers(providers, scope, projectDir);
|
|
30020
|
-
return { success: true, data: { servers } };
|
|
30021
|
-
} catch (err) {
|
|
30022
|
-
return {
|
|
30023
|
-
success: false,
|
|
30024
|
-
error: {
|
|
30025
|
-
code: "E_CAAMP_MCP_LIST_ALL",
|
|
30026
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30027
|
-
}
|
|
30028
|
-
};
|
|
30029
|
-
}
|
|
30030
|
-
}
|
|
30031
|
-
async function mcpInstall(providerId, serverName, config2, scope, projectDir) {
|
|
30032
|
-
try {
|
|
30033
|
-
const provider = getProvider(providerId);
|
|
30034
|
-
if (!provider) {
|
|
30035
|
-
return {
|
|
30036
|
-
success: false,
|
|
30037
|
-
error: {
|
|
30038
|
-
code: "E_CAAMP_PROVIDER_NOT_FOUND",
|
|
30039
|
-
message: `Provider not found: ${providerId}`
|
|
30040
|
-
}
|
|
30041
|
-
};
|
|
30042
|
-
}
|
|
30043
|
-
const result = await installMcpServer(provider, serverName, config2, scope, projectDir);
|
|
30044
|
-
return { success: true, data: result };
|
|
30045
|
-
} catch (err) {
|
|
30046
|
-
return {
|
|
30047
|
-
success: false,
|
|
30048
|
-
error: {
|
|
30049
|
-
code: "E_CAAMP_MCP_INSTALL",
|
|
30050
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30051
|
-
}
|
|
30052
|
-
};
|
|
30053
|
-
}
|
|
30054
|
-
}
|
|
30055
|
-
async function mcpRemove(providerId, serverName, scope, projectDir) {
|
|
30056
|
-
try {
|
|
30057
|
-
const provider = getProvider(providerId);
|
|
30058
|
-
if (!provider) {
|
|
30059
|
-
return {
|
|
30060
|
-
success: false,
|
|
30061
|
-
error: {
|
|
30062
|
-
code: "E_CAAMP_PROVIDER_NOT_FOUND",
|
|
30063
|
-
message: `Provider not found: ${providerId}`
|
|
30064
|
-
}
|
|
30065
|
-
};
|
|
30066
|
-
}
|
|
30067
|
-
const removed = await removeMcpServer(provider, serverName, scope, projectDir);
|
|
30068
|
-
return { success: true, data: { removed } };
|
|
30069
|
-
} catch (err) {
|
|
30070
|
-
return {
|
|
30071
|
-
success: false,
|
|
30072
|
-
error: {
|
|
30073
|
-
code: "E_CAAMP_MCP_REMOVE",
|
|
30074
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30075
|
-
}
|
|
30076
|
-
};
|
|
30077
|
-
}
|
|
30078
|
-
}
|
|
30079
|
-
function mcpConfigPath(providerId, scope, projectDir) {
|
|
30080
|
-
try {
|
|
30081
|
-
const provider = getProvider(providerId);
|
|
30082
|
-
if (!provider) {
|
|
30083
|
-
return {
|
|
30084
|
-
success: false,
|
|
30085
|
-
error: {
|
|
30086
|
-
code: "E_CAAMP_PROVIDER_NOT_FOUND",
|
|
30087
|
-
message: `Provider not found: ${providerId}`
|
|
30088
|
-
}
|
|
30089
|
-
};
|
|
30090
|
-
}
|
|
30091
|
-
const path2 = resolveConfigPath(provider, scope, projectDir);
|
|
30092
|
-
return { success: true, data: { path: path2 } };
|
|
30093
|
-
} catch (err) {
|
|
30094
|
-
return {
|
|
30095
|
-
success: false,
|
|
30096
|
-
error: {
|
|
30097
|
-
code: "E_CAAMP_MCP_CONFIG_PATH",
|
|
30098
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30099
|
-
}
|
|
30100
|
-
};
|
|
30101
|
-
}
|
|
30102
|
-
}
|
|
30103
29967
|
async function injectionCheck(filePath, expectedContent) {
|
|
30104
29968
|
try {
|
|
30105
29969
|
const status = await checkInjection(filePath, expectedContent);
|
|
@@ -30176,30 +30040,6 @@ async function batchInstallWithRollback(options) {
|
|
|
30176
30040
|
};
|
|
30177
30041
|
}
|
|
30178
30042
|
}
|
|
30179
|
-
async function dualScopeConfigure(providerId, options) {
|
|
30180
|
-
try {
|
|
30181
|
-
const provider = getProvider(providerId);
|
|
30182
|
-
if (!provider) {
|
|
30183
|
-
return {
|
|
30184
|
-
success: false,
|
|
30185
|
-
error: {
|
|
30186
|
-
code: "E_CAAMP_PROVIDER_NOT_FOUND",
|
|
30187
|
-
message: `Provider not found: ${providerId}`
|
|
30188
|
-
}
|
|
30189
|
-
};
|
|
30190
|
-
}
|
|
30191
|
-
const result = await configureProviderGlobalAndProject(provider, options);
|
|
30192
|
-
return { success: true, data: result };
|
|
30193
|
-
} catch (err) {
|
|
30194
|
-
return {
|
|
30195
|
-
success: false,
|
|
30196
|
-
error: {
|
|
30197
|
-
code: "E_CAAMP_DUAL_SCOPE_CONFIGURE",
|
|
30198
|
-
message: err instanceof Error ? err.message : String(err)
|
|
30199
|
-
}
|
|
30200
|
-
};
|
|
30201
|
-
}
|
|
30202
|
-
}
|
|
30203
30043
|
|
|
30204
30044
|
// packages/core/src/caamp/capability-check.ts
|
|
30205
30045
|
import { providerSupports, providerSupportsById } from "@cleocode/caamp";
|
|
@@ -30284,14 +30124,26 @@ import { existsSync as existsSync17, mkdtempSync, rmSync, writeFileSync as write
|
|
|
30284
30124
|
import { tmpdir } from "node:os";
|
|
30285
30125
|
import { join as join20, relative } from "node:path";
|
|
30286
30126
|
function resolveTreeSitterBin() {
|
|
30127
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
30128
|
+
const binName = `tree-sitter${ext}`;
|
|
30287
30129
|
const candidates = [
|
|
30288
|
-
join20(process.cwd(), "packages", "core", "node_modules", ".bin",
|
|
30289
|
-
join20(process.cwd(), "node_modules", ".bin",
|
|
30130
|
+
join20(process.cwd(), "packages", "core", "node_modules", ".bin", binName),
|
|
30131
|
+
join20(process.cwd(), "node_modules", ".bin", binName),
|
|
30132
|
+
// npm global install paths
|
|
30133
|
+
join20(process.cwd(), "node_modules", "tree-sitter-cli", binName)
|
|
30290
30134
|
];
|
|
30135
|
+
if (ext) {
|
|
30136
|
+
candidates.push(
|
|
30137
|
+
join20(process.cwd(), "packages", "core", "node_modules", ".bin", "tree-sitter"),
|
|
30138
|
+
join20(process.cwd(), "node_modules", ".bin", "tree-sitter")
|
|
30139
|
+
);
|
|
30140
|
+
}
|
|
30291
30141
|
for (const p of candidates) {
|
|
30292
30142
|
if (existsSync17(p)) return p;
|
|
30293
30143
|
}
|
|
30294
|
-
throw new Error(
|
|
30144
|
+
throw new Error(
|
|
30145
|
+
"tree-sitter CLI not found. Code analysis features (cleo code outline/search/unfold) require tree-sitter. Install with: npm install tree-sitter-cli"
|
|
30146
|
+
);
|
|
30295
30147
|
}
|
|
30296
30148
|
var QUERY_PATTERNS = {
|
|
30297
30149
|
// TypeScript / JavaScript
|
|
@@ -31153,6 +31005,10 @@ var ConduitClient = class {
|
|
|
31153
31005
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
31154
31006
|
};
|
|
31155
31007
|
}
|
|
31008
|
+
/** One-shot poll for new messages. Delegates to the transport's poll method. */
|
|
31009
|
+
async poll(options) {
|
|
31010
|
+
return this.transport.poll(options);
|
|
31011
|
+
}
|
|
31156
31012
|
/** Subscribe to incoming messages. Uses real-time transport when available, else polls. */
|
|
31157
31013
|
onMessage(handler) {
|
|
31158
31014
|
if (this.transport.subscribe) {
|
|
@@ -31254,11 +31110,10 @@ var HttpTransport = class {
|
|
|
31254
31110
|
const messageId = data.data?.message?.id ?? data.data?.id ?? "unknown";
|
|
31255
31111
|
return { messageId };
|
|
31256
31112
|
}
|
|
31257
|
-
/** Poll for new messages
|
|
31113
|
+
/** Poll for new messages for this agent. Returns empty array on HTTP error. */
|
|
31258
31114
|
async poll(options) {
|
|
31259
31115
|
this.ensureConnected();
|
|
31260
31116
|
const params = new URLSearchParams();
|
|
31261
|
-
params.set("mentioned", this.state.agentId);
|
|
31262
31117
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
31263
31118
|
if (options?.since) params.set("since", options.since);
|
|
31264
31119
|
const response = await this.fetchWithFallback(`/messages/peek?${params}`, {
|
|
@@ -31806,14 +31661,16 @@ var SseTransport = class {
|
|
|
31806
31661
|
|
|
31807
31662
|
// packages/core/src/conduit/factory.ts
|
|
31808
31663
|
function resolveTransport(credential) {
|
|
31664
|
+
const isCloudBacked = credential.apiBaseUrl && credential.apiBaseUrl !== "local" && credential.apiBaseUrl.startsWith("http");
|
|
31665
|
+
if (isCloudBacked) {
|
|
31666
|
+
if (credential.transportConfig.sseEndpoint) {
|
|
31667
|
+
return new SseTransport();
|
|
31668
|
+
}
|
|
31669
|
+
return new HttpTransport();
|
|
31670
|
+
}
|
|
31809
31671
|
if (LocalTransport.isAvailable()) {
|
|
31810
31672
|
return new LocalTransport();
|
|
31811
31673
|
}
|
|
31812
|
-
if (credential.transportConfig.wsUrl) {
|
|
31813
|
-
}
|
|
31814
|
-
if (credential.transportConfig.sseEndpoint) {
|
|
31815
|
-
return new SseTransport();
|
|
31816
|
-
}
|
|
31817
31674
|
return new HttpTransport();
|
|
31818
31675
|
}
|
|
31819
31676
|
async function createConduit(registry2, agentId) {
|
|
@@ -31976,8 +31833,6 @@ __export(hooks_exports, {
|
|
|
31976
31833
|
handleFileChange: () => handleFileChange,
|
|
31977
31834
|
handlePostCompact: () => handlePostCompact,
|
|
31978
31835
|
handlePreCompact: () => handlePreCompact,
|
|
31979
|
-
handlePromptSubmit: () => handlePromptSubmit,
|
|
31980
|
-
handleResponseComplete: () => handleResponseComplete,
|
|
31981
31836
|
handleSessionEnd: () => handleSessionEnd,
|
|
31982
31837
|
handleSessionStart: () => handleSessionStart,
|
|
31983
31838
|
handleSubagentStart: () => handleSubagentStart,
|
|
@@ -46642,9 +46497,6 @@ async function listEpicsWithLifecycle(cwd) {
|
|
|
46642
46497
|
}
|
|
46643
46498
|
}
|
|
46644
46499
|
|
|
46645
|
-
// packages/core/src/index.ts
|
|
46646
|
-
init_mcp();
|
|
46647
|
-
|
|
46648
46500
|
// packages/core/src/memory/index.ts
|
|
46649
46501
|
var memory_exports = {};
|
|
46650
46502
|
__export(memory_exports, {
|
|
@@ -46713,8 +46565,8 @@ init_paths();
|
|
|
46713
46565
|
init_atomic();
|
|
46714
46566
|
init_json2();
|
|
46715
46567
|
init_add();
|
|
46716
|
-
import { existsSync as existsSync44, readFileSync as
|
|
46717
|
-
import { join as
|
|
46568
|
+
import { existsSync as existsSync44, readFileSync as readFileSync28 } from "node:fs";
|
|
46569
|
+
import { join as join48, resolve as resolve6 } from "node:path";
|
|
46718
46570
|
|
|
46719
46571
|
// packages/core/src/memory/brain-lifecycle.ts
|
|
46720
46572
|
init_brain_accessor();
|
|
@@ -46944,13 +46796,13 @@ init_brain_links();
|
|
|
46944
46796
|
|
|
46945
46797
|
// packages/core/src/memory/brain-migration.ts
|
|
46946
46798
|
init_brain_accessor();
|
|
46947
|
-
import { existsSync as existsSync43, readFileSync as
|
|
46948
|
-
import { join as
|
|
46799
|
+
import { existsSync as existsSync43, readFileSync as readFileSync27 } from "node:fs";
|
|
46800
|
+
import { join as join47 } from "node:path";
|
|
46949
46801
|
function readJsonlFile(filePath) {
|
|
46950
46802
|
if (!existsSync43(filePath)) {
|
|
46951
46803
|
return { entries: [], errors: [] };
|
|
46952
46804
|
}
|
|
46953
|
-
const content =
|
|
46805
|
+
const content = readFileSync27(filePath, "utf-8").trim();
|
|
46954
46806
|
if (!content) {
|
|
46955
46807
|
return { entries: [], errors: [] };
|
|
46956
46808
|
}
|
|
@@ -46975,7 +46827,7 @@ async function migrateBrainData(projectRoot) {
|
|
|
46975
46827
|
duplicatesSkipped: 0,
|
|
46976
46828
|
errors: []
|
|
46977
46829
|
};
|
|
46978
|
-
const patternsPath =
|
|
46830
|
+
const patternsPath = join47(projectRoot, ".cleo", "memory", "patterns.jsonl");
|
|
46979
46831
|
const { entries: patterns, errors: patternErrors } = readJsonlFile(patternsPath);
|
|
46980
46832
|
result.errors.push(...patternErrors);
|
|
46981
46833
|
for (const p of patterns) {
|
|
@@ -47005,7 +46857,7 @@ async function migrateBrainData(projectRoot) {
|
|
|
47005
46857
|
result.errors.push(`Pattern ${p.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
47006
46858
|
}
|
|
47007
46859
|
}
|
|
47008
|
-
const learningsPath =
|
|
46860
|
+
const learningsPath = join47(projectRoot, ".cleo", "memory", "learnings.jsonl");
|
|
47009
46861
|
const { entries: learnings, errors: learningErrors } = readJsonlFile(learningsPath);
|
|
47010
46862
|
result.errors.push(...learningErrors);
|
|
47011
46863
|
for (const l of learnings) {
|
|
@@ -47057,7 +46909,7 @@ init_decisions2();
|
|
|
47057
46909
|
init_learnings();
|
|
47058
46910
|
init_patterns();
|
|
47059
46911
|
function getResearchPath(cwd) {
|
|
47060
|
-
return
|
|
46912
|
+
return join48(getCleoDirAbsolute(cwd), "research.json");
|
|
47061
46913
|
}
|
|
47062
46914
|
function getManifestPath2(cwd) {
|
|
47063
46915
|
return getManifestPath(cwd);
|
|
@@ -47278,7 +47130,7 @@ async function showManifestEntry(researchId, cwd) {
|
|
|
47278
47130
|
try {
|
|
47279
47131
|
const filePath = resolve6(root, entry.file);
|
|
47280
47132
|
if (existsSync44(filePath)) {
|
|
47281
|
-
fileContent =
|
|
47133
|
+
fileContent = readFileSync28(filePath, "utf-8");
|
|
47282
47134
|
}
|
|
47283
47135
|
} catch {
|
|
47284
47136
|
}
|
|
@@ -47524,7 +47376,7 @@ async function readProtocolInjection(protocolType, params, cwd) {
|
|
|
47524
47376
|
for (const loc of protocolLocations) {
|
|
47525
47377
|
if (existsSync44(loc)) {
|
|
47526
47378
|
try {
|
|
47527
|
-
protocolContent =
|
|
47379
|
+
protocolContent = readFileSync28(loc, "utf-8");
|
|
47528
47380
|
protocolPath = loc.replace(root + "/", "");
|
|
47529
47381
|
break;
|
|
47530
47382
|
} catch {
|
|
@@ -47711,28 +47563,28 @@ __export(metrics_exports, {
|
|
|
47711
47563
|
init_paths();
|
|
47712
47564
|
import { appendFileSync as appendFileSync5, existsSync as existsSync47 } from "node:fs";
|
|
47713
47565
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
47714
|
-
import { join as
|
|
47566
|
+
import { join as join51 } from "node:path";
|
|
47715
47567
|
|
|
47716
47568
|
// packages/core/src/metrics/common.ts
|
|
47717
47569
|
init_paths();
|
|
47718
|
-
import { existsSync as existsSync45, readFileSync as
|
|
47570
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29 } from "node:fs";
|
|
47719
47571
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
47720
|
-
import { join as
|
|
47572
|
+
import { join as join49 } from "node:path";
|
|
47721
47573
|
async function ensureMetricsDir(metricsDir) {
|
|
47722
|
-
const dir = metricsDir ??
|
|
47574
|
+
const dir = metricsDir ?? join49(getCleoDir(), "metrics");
|
|
47723
47575
|
if (!existsSync45(dir)) {
|
|
47724
47576
|
await mkdir7(dir, { recursive: true });
|
|
47725
47577
|
}
|
|
47726
47578
|
return dir;
|
|
47727
47579
|
}
|
|
47728
47580
|
function getCompliancePath(metricsDir) {
|
|
47729
|
-
return
|
|
47581
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "COMPLIANCE.jsonl");
|
|
47730
47582
|
}
|
|
47731
47583
|
function getViolationsPath(metricsDir) {
|
|
47732
|
-
return
|
|
47584
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "PROTOCOL_VIOLATIONS.jsonl");
|
|
47733
47585
|
}
|
|
47734
47586
|
function getSessionsMetricsPath(metricsDir) {
|
|
47735
|
-
return
|
|
47587
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "SESSIONS.jsonl");
|
|
47736
47588
|
}
|
|
47737
47589
|
function isoTimestamp() {
|
|
47738
47590
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
@@ -47742,7 +47594,7 @@ function isoDate() {
|
|
|
47742
47594
|
}
|
|
47743
47595
|
function readJsonlFile2(filePath) {
|
|
47744
47596
|
if (!existsSync45(filePath)) return [];
|
|
47745
|
-
const content =
|
|
47597
|
+
const content = readFileSync29(filePath, "utf-8").trim();
|
|
47746
47598
|
if (!content) return [];
|
|
47747
47599
|
return content.split("\n").filter((line2) => line2.trim()).map((line2) => JSON.parse(line2));
|
|
47748
47600
|
}
|
|
@@ -47763,14 +47615,14 @@ function getComplianceSummaryBase(compliancePath) {
|
|
|
47763
47615
|
|
|
47764
47616
|
// packages/core/src/metrics/otel-integration.ts
|
|
47765
47617
|
init_paths();
|
|
47766
|
-
import { appendFileSync as appendFileSync4, existsSync as existsSync46, readdirSync as readdirSync20, readFileSync as
|
|
47618
|
+
import { appendFileSync as appendFileSync4, existsSync as existsSync46, readdirSync as readdirSync20, readFileSync as readFileSync30, statSync as statSync9 } from "node:fs";
|
|
47767
47619
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
47768
|
-
import { join as
|
|
47620
|
+
import { join as join50 } from "node:path";
|
|
47769
47621
|
function getOtelDir(cwd) {
|
|
47770
|
-
return process.env.OTEL_METRICS_DIR ??
|
|
47622
|
+
return process.env.OTEL_METRICS_DIR ?? join50(getCleoDir(cwd), "metrics", "otel");
|
|
47771
47623
|
}
|
|
47772
47624
|
function getTokenMetricsPath(cwd) {
|
|
47773
|
-
return
|
|
47625
|
+
return join50(getOtelDir(cwd), "token_metrics.jsonl");
|
|
47774
47626
|
}
|
|
47775
47627
|
function isOtelEnabled() {
|
|
47776
47628
|
return process.env.CLAUDE_CODE_ENABLE_TELEMETRY === "1";
|
|
@@ -47801,7 +47653,7 @@ function getOtelSetupCommands(mode = "file", cwd) {
|
|
|
47801
47653
|
function findLatestMetricsFile(cwd) {
|
|
47802
47654
|
const otelDir = getOtelDir(cwd);
|
|
47803
47655
|
if (!existsSync46(otelDir)) return null;
|
|
47804
|
-
const files = readdirSync20(otelDir).filter((f) => f.endsWith(".json")).map((f) =>
|
|
47656
|
+
const files = readdirSync20(otelDir).filter((f) => f.endsWith(".json")).map((f) => join50(otelDir, f)).filter((f) => {
|
|
47805
47657
|
try {
|
|
47806
47658
|
return statSync9(f).isFile();
|
|
47807
47659
|
} catch {
|
|
@@ -47814,7 +47666,7 @@ function parseTokenMetrics(inputFile, cwd) {
|
|
|
47814
47666
|
const file2 = inputFile ?? findLatestMetricsFile(cwd);
|
|
47815
47667
|
if (!file2 || !existsSync46(file2)) return [];
|
|
47816
47668
|
try {
|
|
47817
|
-
const raw = JSON.parse(
|
|
47669
|
+
const raw = JSON.parse(readFileSync30(file2, "utf-8"));
|
|
47818
47670
|
if (raw.resourceMetrics) {
|
|
47819
47671
|
const points = [];
|
|
47820
47672
|
for (const rm3 of raw.resourceMetrics ?? []) {
|
|
@@ -47898,7 +47750,7 @@ async function recordSessionEnd(sessionId, cwd) {
|
|
|
47898
47750
|
let deltaInput = 0;
|
|
47899
47751
|
let deltaOutput = 0;
|
|
47900
47752
|
if (existsSync46(metricsPath)) {
|
|
47901
|
-
const lines =
|
|
47753
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47902
47754
|
const startLine = lines.reverse().find((l) => l.includes(`"session_id":"${sessionId}"`) && l.includes("session_start"));
|
|
47903
47755
|
if (startLine) {
|
|
47904
47756
|
const startData = JSON.parse(startLine);
|
|
@@ -47925,7 +47777,7 @@ function compareSessions(sessionA, sessionB, cwd) {
|
|
|
47925
47777
|
if (!existsSync46(metricsPath)) {
|
|
47926
47778
|
return { error: "One or both sessions not found" };
|
|
47927
47779
|
}
|
|
47928
|
-
const lines =
|
|
47780
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47929
47781
|
const findSessionEnd = (id) => {
|
|
47930
47782
|
const line2 = lines.reverse().find((l) => l.includes(`"session_id":"${id}"`) && l.includes("session_end"));
|
|
47931
47783
|
if (!line2) return 0;
|
|
@@ -47960,7 +47812,7 @@ function getTokenStats(cwd) {
|
|
|
47960
47812
|
if (!existsSync46(metricsPath)) {
|
|
47961
47813
|
return { error: "No token metrics recorded" };
|
|
47962
47814
|
}
|
|
47963
|
-
const lines =
|
|
47815
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47964
47816
|
const endEvents = lines.filter((l) => l.includes("session_end"));
|
|
47965
47817
|
if (endEvents.length === 0) {
|
|
47966
47818
|
return { sessions: 0, avg_tokens: 0, min_tokens: 0, max_tokens: 0 };
|
|
@@ -47987,10 +47839,10 @@ function getTokenStats(cwd) {
|
|
|
47987
47839
|
// packages/core/src/metrics/ab-test.ts
|
|
47988
47840
|
var currentTest = null;
|
|
47989
47841
|
function getABMetricsDir(cwd) {
|
|
47990
|
-
return process.env.AB_TEST_METRICS_DIR ??
|
|
47842
|
+
return process.env.AB_TEST_METRICS_DIR ?? join51(getCleoDir(cwd), "metrics", "ab-tests");
|
|
47991
47843
|
}
|
|
47992
47844
|
function getABMetricsFile(cwd) {
|
|
47993
|
-
return
|
|
47845
|
+
return join51(getABMetricsDir(cwd), "AB_TESTS.jsonl");
|
|
47994
47846
|
}
|
|
47995
47847
|
async function logABEvent(eventType, testName, variant, context, cwd) {
|
|
47996
47848
|
const dir = getABMetricsDir(cwd);
|
|
@@ -48049,7 +47901,7 @@ async function endABTest(options = {}, cwd) {
|
|
|
48049
47901
|
totalTokens = endTokenData.tokens.total - currentTest.startTokens;
|
|
48050
47902
|
tokenSource = "otel";
|
|
48051
47903
|
} else {
|
|
48052
|
-
const tokenFile =
|
|
47904
|
+
const tokenFile = join51(getCleoDir(cwd), "metrics", "TOKEN_USAGE.jsonl");
|
|
48053
47905
|
if (existsSync47(tokenFile)) {
|
|
48054
47906
|
const entries = readJsonlFile2(tokenFile);
|
|
48055
47907
|
totalTokens = entries.filter((e) => e.session_id === currentTest.testName).reduce((sum, e) => sum + (e.estimated_tokens ?? 0), 0);
|
|
@@ -48214,15 +48066,15 @@ init_paths();
|
|
|
48214
48066
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
48215
48067
|
import { appendFileSync as appendFileSync6, existsSync as existsSync48 } from "node:fs";
|
|
48216
48068
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
48217
|
-
import { basename as basename7, join as
|
|
48069
|
+
import { basename as basename7, join as join52 } from "node:path";
|
|
48218
48070
|
function getProjectMetricsDir(cwd) {
|
|
48219
|
-
return
|
|
48071
|
+
return join52(getCleoDir(cwd), "metrics");
|
|
48220
48072
|
}
|
|
48221
48073
|
function getGlobalMetricsDir() {
|
|
48222
|
-
return
|
|
48074
|
+
return join52(getCleoHome(), "metrics");
|
|
48223
48075
|
}
|
|
48224
48076
|
function getGlobalPath() {
|
|
48225
|
-
return
|
|
48077
|
+
return join52(getGlobalMetricsDir(), "GLOBAL.jsonl");
|
|
48226
48078
|
}
|
|
48227
48079
|
function getProjectName() {
|
|
48228
48080
|
try {
|
|
@@ -48237,7 +48089,7 @@ function getProjectName() {
|
|
|
48237
48089
|
return basename7(process.cwd());
|
|
48238
48090
|
}
|
|
48239
48091
|
async function syncMetricsToGlobal(options = {}, cwd) {
|
|
48240
|
-
const projectPath = getCompliancePath(
|
|
48092
|
+
const projectPath = getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48241
48093
|
if (!existsSync48(projectPath)) {
|
|
48242
48094
|
return { success: true, result: { synced: 0, skipped: 0, reason: "No project metrics file" } };
|
|
48243
48095
|
}
|
|
@@ -48278,7 +48130,7 @@ async function syncMetricsToGlobal(options = {}, cwd) {
|
|
|
48278
48130
|
};
|
|
48279
48131
|
}
|
|
48280
48132
|
function getProjectComplianceSummary(options = {}, cwd) {
|
|
48281
|
-
const projectPath = getCompliancePath(
|
|
48133
|
+
const projectPath = getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48282
48134
|
const projectName = getProjectName();
|
|
48283
48135
|
if (!existsSync48(projectPath)) {
|
|
48284
48136
|
return {
|
|
@@ -48377,7 +48229,7 @@ function computeComplianceSummary(entries, projectName) {
|
|
|
48377
48229
|
};
|
|
48378
48230
|
}
|
|
48379
48231
|
function getComplianceTrend2(days = 7, options = {}, cwd) {
|
|
48380
|
-
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(
|
|
48232
|
+
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48381
48233
|
if (!existsSync48(metricsPath)) {
|
|
48382
48234
|
return { success: true, result: { days, dataPoints: [], trend: "no_data" } };
|
|
48383
48235
|
}
|
|
@@ -48409,7 +48261,7 @@ function getComplianceTrend2(days = 7, options = {}, cwd) {
|
|
|
48409
48261
|
return { success: true, result: { days, dataPoints, trend } };
|
|
48410
48262
|
}
|
|
48411
48263
|
function getSkillReliability2(options = {}, cwd) {
|
|
48412
|
-
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(
|
|
48264
|
+
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48413
48265
|
if (!existsSync48(metricsPath)) {
|
|
48414
48266
|
return {
|
|
48415
48267
|
success: true,
|
|
@@ -48448,7 +48300,7 @@ function getSkillReliability2(options = {}, cwd) {
|
|
|
48448
48300
|
async function logSessionMetrics(metricsJson, cwd) {
|
|
48449
48301
|
const metricsDir = getProjectMetricsDir(cwd);
|
|
48450
48302
|
await mkdir10(metricsDir, { recursive: true });
|
|
48451
|
-
const sessionsPath = getSessionsMetricsPath(
|
|
48303
|
+
const sessionsPath = getSessionsMetricsPath(join52(getCleoDir(cwd), "metrics"));
|
|
48452
48304
|
try {
|
|
48453
48305
|
appendFileSync6(sessionsPath, JSON.stringify(metricsJson) + "\n");
|
|
48454
48306
|
} catch {
|
|
@@ -48464,7 +48316,7 @@ async function logSessionMetrics(metricsJson, cwd) {
|
|
|
48464
48316
|
};
|
|
48465
48317
|
}
|
|
48466
48318
|
function getSessionMetricsSummary(options = {}, cwd) {
|
|
48467
|
-
const sessionsPath = getSessionsMetricsPath(
|
|
48319
|
+
const sessionsPath = getSessionsMetricsPath(join52(getCleoDir(cwd), "metrics"));
|
|
48468
48320
|
if (!existsSync48(sessionsPath)) {
|
|
48469
48321
|
return {
|
|
48470
48322
|
success: true,
|
|
@@ -48586,12 +48438,12 @@ function isValidEnumValue(enumObj, value) {
|
|
|
48586
48438
|
|
|
48587
48439
|
// packages/core/src/metrics/token-estimation.ts
|
|
48588
48440
|
init_paths();
|
|
48589
|
-
import { existsSync as existsSync49, readFileSync as
|
|
48441
|
+
import { existsSync as existsSync49, readFileSync as readFileSync31, statSync as statSync10 } from "node:fs";
|
|
48590
48442
|
import { appendFile as appendFile2, mkdir as mkdir11 } from "node:fs/promises";
|
|
48591
|
-
import { dirname as dirname12, join as
|
|
48443
|
+
import { dirname as dirname12, join as join53 } from "node:path";
|
|
48592
48444
|
var currentSession = null;
|
|
48593
48445
|
function getTokenFilePath(cwd) {
|
|
48594
|
-
return
|
|
48446
|
+
return join53(getCleoDir(cwd), "metrics", "TOKEN_USAGE.jsonl");
|
|
48595
48447
|
}
|
|
48596
48448
|
function isTrackingEnabled() {
|
|
48597
48449
|
return (process.env.CLEO_TRACK_TOKENS ?? "1") === "1";
|
|
@@ -48759,7 +48611,7 @@ function getTokenSummary(days = 7, cwd) {
|
|
|
48759
48611
|
const threshold = /* @__PURE__ */ new Date();
|
|
48760
48612
|
threshold.setDate(threshold.getDate() - days);
|
|
48761
48613
|
const thresholdStr = threshold.toISOString();
|
|
48762
|
-
const entries =
|
|
48614
|
+
const entries = readFileSync31(tokenFile, "utf-8").trim().split("\n").filter(Boolean);
|
|
48763
48615
|
let manifestTokens = 0;
|
|
48764
48616
|
let fullFileTokens = 0;
|
|
48765
48617
|
let skillTokens = 0;
|
|
@@ -48871,12 +48723,12 @@ init_agent_outputs();
|
|
|
48871
48723
|
|
|
48872
48724
|
// packages/core/src/migration/checksum.ts
|
|
48873
48725
|
import { createHash as createHash5 } from "node:crypto";
|
|
48874
|
-
import { readFileSync as
|
|
48726
|
+
import { readFileSync as readFileSync33 } from "node:fs";
|
|
48875
48727
|
import { createRequire as createRequire5 } from "node:module";
|
|
48876
48728
|
var _require5 = createRequire5(import.meta.url);
|
|
48877
48729
|
var { DatabaseSync: DatabaseSync3 } = _require5("node:sqlite");
|
|
48878
48730
|
async function computeChecksum(filePath) {
|
|
48879
|
-
const content =
|
|
48731
|
+
const content = readFileSync33(filePath);
|
|
48880
48732
|
return createHash5("sha256").update(content).digest("hex");
|
|
48881
48733
|
}
|
|
48882
48734
|
async function verifyBackup(sourcePath, backupPath) {
|
|
@@ -48925,11 +48777,11 @@ import {
|
|
|
48925
48777
|
existsSync as existsSync51,
|
|
48926
48778
|
mkdirSync as mkdirSync13,
|
|
48927
48779
|
readdirSync as readdirSync22,
|
|
48928
|
-
readFileSync as
|
|
48780
|
+
readFileSync as readFileSync34,
|
|
48929
48781
|
statSync as statSync12,
|
|
48930
48782
|
unlinkSync as unlinkSync3
|
|
48931
48783
|
} from "node:fs";
|
|
48932
|
-
import { dirname as dirname13, join as
|
|
48784
|
+
import { dirname as dirname13, join as join55, relative as relative8 } from "node:path";
|
|
48933
48785
|
var MigrationLogger = class {
|
|
48934
48786
|
logPath;
|
|
48935
48787
|
entries = [];
|
|
@@ -48949,7 +48801,7 @@ var MigrationLogger = class {
|
|
|
48949
48801
|
consoleOutput: config2.consoleOutput ?? false
|
|
48950
48802
|
};
|
|
48951
48803
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
48952
|
-
this.logPath =
|
|
48804
|
+
this.logPath = join55(cleoDir, "logs", `migration-${timestamp2}.jsonl`);
|
|
48953
48805
|
const logsDir = dirname13(this.logPath);
|
|
48954
48806
|
if (!existsSync51(logsDir)) {
|
|
48955
48807
|
mkdirSync13(logsDir, { recursive: true });
|
|
@@ -49119,14 +48971,14 @@ var MigrationLogger = class {
|
|
|
49119
48971
|
*/
|
|
49120
48972
|
cleanupOldLogs() {
|
|
49121
48973
|
try {
|
|
49122
|
-
const logsDir =
|
|
48974
|
+
const logsDir = join55(this.cleoDir, "logs");
|
|
49123
48975
|
if (!existsSync51(logsDir)) {
|
|
49124
48976
|
return;
|
|
49125
48977
|
}
|
|
49126
48978
|
const files = readdirSync22(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
|
|
49127
48979
|
name: f,
|
|
49128
|
-
path:
|
|
49129
|
-
mtime: statSync12(
|
|
48980
|
+
path: join55(logsDir, f),
|
|
48981
|
+
mtime: statSync12(join55(logsDir, f)).mtime.getTime()
|
|
49130
48982
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
49131
48983
|
const filesToRemove = files.slice(this.config.maxLogFiles);
|
|
49132
48984
|
for (const file2 of filesToRemove) {
|
|
@@ -49204,7 +49056,7 @@ function createMigrationLogger(cleoDir, config2) {
|
|
|
49204
49056
|
return new MigrationLogger(cleoDir, config2);
|
|
49205
49057
|
}
|
|
49206
49058
|
function readMigrationLog(logPath) {
|
|
49207
|
-
const content =
|
|
49059
|
+
const content = readFileSync34(logPath, "utf-8");
|
|
49208
49060
|
return content.split("\n").filter((line2) => line2.trim()).map((line2) => JSON.parse(line2));
|
|
49209
49061
|
}
|
|
49210
49062
|
function logFileExists(logPath) {
|
|
@@ -49217,14 +49069,14 @@ function logFileExists(logPath) {
|
|
|
49217
49069
|
}
|
|
49218
49070
|
function getLatestMigrationLog(cleoDir) {
|
|
49219
49071
|
try {
|
|
49220
|
-
const logsDir =
|
|
49072
|
+
const logsDir = join55(cleoDir, "logs");
|
|
49221
49073
|
if (!existsSync51(logsDir)) {
|
|
49222
49074
|
return null;
|
|
49223
49075
|
}
|
|
49224
49076
|
const files = readdirSync22(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
|
|
49225
49077
|
name: f,
|
|
49226
|
-
path:
|
|
49227
|
-
mtime: statSync12(
|
|
49078
|
+
path: join55(logsDir, f),
|
|
49079
|
+
mtime: statSync12(join55(logsDir, f)).mtime.getTime()
|
|
49228
49080
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
49229
49081
|
return files.length > 0 ? files[0].path : null;
|
|
49230
49082
|
} catch {
|
|
@@ -49234,8 +49086,8 @@ function getLatestMigrationLog(cleoDir) {
|
|
|
49234
49086
|
|
|
49235
49087
|
// packages/core/src/system/storage-preflight.ts
|
|
49236
49088
|
init_paths();
|
|
49237
|
-
import { existsSync as existsSync52, readFileSync as
|
|
49238
|
-
import { join as
|
|
49089
|
+
import { existsSync as existsSync52, readFileSync as readFileSync35, statSync as statSync13 } from "node:fs";
|
|
49090
|
+
import { join as join56 } from "node:path";
|
|
49239
49091
|
function checkStorageMigration(cwd) {
|
|
49240
49092
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
49241
49093
|
const details = {
|
|
@@ -49249,42 +49101,42 @@ function checkStorageMigration(cwd) {
|
|
|
49249
49101
|
tasksDbSize: 0,
|
|
49250
49102
|
configEngine: null
|
|
49251
49103
|
};
|
|
49252
|
-
const configPath =
|
|
49104
|
+
const configPath = join56(cleoDir, "config.json");
|
|
49253
49105
|
if (existsSync52(configPath)) {
|
|
49254
49106
|
try {
|
|
49255
|
-
const config2 = JSON.parse(
|
|
49107
|
+
const config2 = JSON.parse(readFileSync35(configPath, "utf-8"));
|
|
49256
49108
|
details.configEngine = config2?.storage?.engine ?? null;
|
|
49257
49109
|
} catch {
|
|
49258
49110
|
}
|
|
49259
49111
|
}
|
|
49260
|
-
const todoPath =
|
|
49112
|
+
const todoPath = join56(cleoDir, "todo.json");
|
|
49261
49113
|
if (existsSync52(todoPath)) {
|
|
49262
49114
|
details.todoJsonExists = true;
|
|
49263
49115
|
try {
|
|
49264
|
-
const data = JSON.parse(
|
|
49116
|
+
const data = JSON.parse(readFileSync35(todoPath, "utf-8"));
|
|
49265
49117
|
details.todoJsonTaskCount = (data.tasks ?? []).length;
|
|
49266
49118
|
} catch {
|
|
49267
49119
|
}
|
|
49268
49120
|
}
|
|
49269
|
-
const archivePath =
|
|
49121
|
+
const archivePath = join56(cleoDir, "todo-archive.json");
|
|
49270
49122
|
if (existsSync52(archivePath)) {
|
|
49271
49123
|
details.archiveJsonExists = true;
|
|
49272
49124
|
try {
|
|
49273
|
-
const data = JSON.parse(
|
|
49125
|
+
const data = JSON.parse(readFileSync35(archivePath, "utf-8"));
|
|
49274
49126
|
details.archiveJsonTaskCount = (data.tasks ?? data.archivedTasks ?? []).length;
|
|
49275
49127
|
} catch {
|
|
49276
49128
|
}
|
|
49277
49129
|
}
|
|
49278
|
-
const sessionsPath =
|
|
49130
|
+
const sessionsPath = join56(cleoDir, "sessions.json");
|
|
49279
49131
|
if (existsSync52(sessionsPath)) {
|
|
49280
49132
|
details.sessionsJsonExists = true;
|
|
49281
49133
|
try {
|
|
49282
|
-
const data = JSON.parse(
|
|
49134
|
+
const data = JSON.parse(readFileSync35(sessionsPath, "utf-8"));
|
|
49283
49135
|
details.sessionsJsonCount = (data.sessions ?? []).length;
|
|
49284
49136
|
} catch {
|
|
49285
49137
|
}
|
|
49286
49138
|
}
|
|
49287
|
-
const dbPath =
|
|
49139
|
+
const dbPath = join56(cleoDir, "tasks.db");
|
|
49288
49140
|
if (existsSync52(dbPath)) {
|
|
49289
49141
|
details.tasksDbExists = true;
|
|
49290
49142
|
try {
|
|
@@ -49325,7 +49177,7 @@ function checkStorageMigration(cwd) {
|
|
|
49325
49177
|
import { createHash as createHash6 } from "node:crypto";
|
|
49326
49178
|
import { existsSync as existsSync53 } from "node:fs";
|
|
49327
49179
|
import { readFile as readFile9, unlink as unlink3, writeFile as writeFile8 } from "node:fs/promises";
|
|
49328
|
-
import { join as
|
|
49180
|
+
import { join as join57 } from "node:path";
|
|
49329
49181
|
var STATE_FILENAME = ".migration-state.json";
|
|
49330
49182
|
async function computeFileChecksum(filePath) {
|
|
49331
49183
|
try {
|
|
@@ -49347,7 +49199,7 @@ async function countRecords(filePath, key) {
|
|
|
49347
49199
|
async function createMigrationState(cleoDir, sourceFiles) {
|
|
49348
49200
|
const files = sourceFiles ?? {};
|
|
49349
49201
|
if (!files.todoJson) {
|
|
49350
|
-
const todoPath =
|
|
49202
|
+
const todoPath = join57(cleoDir, "todo.json");
|
|
49351
49203
|
if (existsSync53(todoPath)) {
|
|
49352
49204
|
files.todoJson = {
|
|
49353
49205
|
path: todoPath,
|
|
@@ -49357,7 +49209,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49357
49209
|
}
|
|
49358
49210
|
}
|
|
49359
49211
|
if (!files.sessionsJson) {
|
|
49360
|
-
const sessionsPath =
|
|
49212
|
+
const sessionsPath = join57(cleoDir, "sessions.json");
|
|
49361
49213
|
if (existsSync53(sessionsPath)) {
|
|
49362
49214
|
files.sessionsJson = {
|
|
49363
49215
|
path: sessionsPath,
|
|
@@ -49367,7 +49219,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49367
49219
|
}
|
|
49368
49220
|
}
|
|
49369
49221
|
if (!files.archiveJson) {
|
|
49370
|
-
const archivePath =
|
|
49222
|
+
const archivePath = join57(cleoDir, "todo-archive.json");
|
|
49371
49223
|
if (existsSync53(archivePath)) {
|
|
49372
49224
|
files.archiveJson = {
|
|
49373
49225
|
path: archivePath,
|
|
@@ -49396,7 +49248,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49396
49248
|
return state;
|
|
49397
49249
|
}
|
|
49398
49250
|
async function writeMigrationState(cleoDir, state) {
|
|
49399
|
-
const statePath =
|
|
49251
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49400
49252
|
const tempPath = `${statePath}.tmp`;
|
|
49401
49253
|
await writeFile8(tempPath, JSON.stringify(state, null, 2));
|
|
49402
49254
|
await writeFile8(statePath, await readFile9(tempPath));
|
|
@@ -49471,7 +49323,7 @@ async function addMigrationWarning(cleoDir, warning) {
|
|
|
49471
49323
|
}
|
|
49472
49324
|
async function loadMigrationState(cleoDir) {
|
|
49473
49325
|
try {
|
|
49474
|
-
const statePath =
|
|
49326
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49475
49327
|
const content = await readFile9(statePath, "utf-8");
|
|
49476
49328
|
return JSON.parse(content);
|
|
49477
49329
|
} catch {
|
|
@@ -49513,7 +49365,7 @@ async function failMigration(cleoDir, error40) {
|
|
|
49513
49365
|
}
|
|
49514
49366
|
async function clearMigrationState(cleoDir) {
|
|
49515
49367
|
try {
|
|
49516
|
-
const statePath =
|
|
49368
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49517
49369
|
await unlink3(statePath);
|
|
49518
49370
|
} catch {
|
|
49519
49371
|
}
|
|
@@ -49574,8 +49426,8 @@ async function verifySourceIntegrity(cleoDir) {
|
|
|
49574
49426
|
}
|
|
49575
49427
|
|
|
49576
49428
|
// packages/core/src/migration/validate.ts
|
|
49577
|
-
import { existsSync as existsSync54, readFileSync as
|
|
49578
|
-
import { join as
|
|
49429
|
+
import { existsSync as existsSync54, readFileSync as readFileSync36, statSync as statSync14 } from "node:fs";
|
|
49430
|
+
import { join as join58 } from "node:path";
|
|
49579
49431
|
function parseJsonError(error40) {
|
|
49580
49432
|
const message = String(error40);
|
|
49581
49433
|
const lineMatch = message.match(/line\s+(\d+)/i);
|
|
@@ -49603,7 +49455,7 @@ function validateJsonFile(filePath, countExtractor) {
|
|
|
49603
49455
|
result.error = "File is empty (0 bytes)";
|
|
49604
49456
|
return result;
|
|
49605
49457
|
}
|
|
49606
|
-
const content =
|
|
49458
|
+
const content = readFileSync36(filePath, "utf-8");
|
|
49607
49459
|
if (content.trim().length === 0) {
|
|
49608
49460
|
result.error = "File contains only whitespace";
|
|
49609
49461
|
return result;
|
|
@@ -49621,7 +49473,7 @@ function validateJsonFile(filePath, countExtractor) {
|
|
|
49621
49473
|
}
|
|
49622
49474
|
function validateSourceFiles(cleoDir) {
|
|
49623
49475
|
const warnings = [];
|
|
49624
|
-
const todoPath =
|
|
49476
|
+
const todoPath = join58(cleoDir, "todo.json");
|
|
49625
49477
|
const todoJson = validateJsonFile(todoPath, (data) => {
|
|
49626
49478
|
const record2 = data;
|
|
49627
49479
|
return Array.isArray(record2.tasks) ? record2.tasks.length : 0;
|
|
@@ -49633,7 +49485,7 @@ function validateSourceFiles(cleoDir) {
|
|
|
49633
49485
|
const location = todoJson.line ? ` at line ${todoJson.line}${todoJson.column ? `, column ${todoJson.column}` : ""}` : "";
|
|
49634
49486
|
todoJson.error = `${todoJson.error}${location} in ${todoPath}`;
|
|
49635
49487
|
}
|
|
49636
|
-
const sessionsPath =
|
|
49488
|
+
const sessionsPath = join58(cleoDir, "sessions.json");
|
|
49637
49489
|
const sessionsJson = validateJsonFile(sessionsPath, (data) => {
|
|
49638
49490
|
const record2 = data;
|
|
49639
49491
|
return Array.isArray(record2.sessions) ? record2.sessions.length : 0;
|
|
@@ -49645,7 +49497,7 @@ function validateSourceFiles(cleoDir) {
|
|
|
49645
49497
|
const location = sessionsJson.line ? ` at line ${sessionsJson.line}${sessionsJson.column ? `, column ${sessionsJson.column}` : ""}` : "";
|
|
49646
49498
|
sessionsJson.error = `${sessionsJson.error}${location} in ${sessionsPath}`;
|
|
49647
49499
|
}
|
|
49648
|
-
const archivePath =
|
|
49500
|
+
const archivePath = join58(cleoDir, "todo-archive.json");
|
|
49649
49501
|
const archiveJson = validateJsonFile(archivePath, (data) => {
|
|
49650
49502
|
const record2 = data;
|
|
49651
49503
|
const tasks2 = Array.isArray(record2.tasks) ? record2.tasks : [];
|
|
@@ -49717,7 +49569,7 @@ Total tasks to migrate: ${result.totalTasks}`);
|
|
|
49717
49569
|
return lines.join("\n");
|
|
49718
49570
|
}
|
|
49719
49571
|
function checkTaskCountMismatch(cleoDir, jsonTaskCount) {
|
|
49720
|
-
const dbPath =
|
|
49572
|
+
const dbPath = join58(cleoDir, "tasks.db");
|
|
49721
49573
|
if (!existsSync54(dbPath)) {
|
|
49722
49574
|
return null;
|
|
49723
49575
|
}
|
|
@@ -49739,7 +49591,7 @@ init_src();
|
|
|
49739
49591
|
init_errors3();
|
|
49740
49592
|
init_paths();
|
|
49741
49593
|
init_json2();
|
|
49742
|
-
import { join as
|
|
49594
|
+
import { join as join59 } from "node:path";
|
|
49743
49595
|
var TARGET_VERSIONS = {
|
|
49744
49596
|
todo: "2.10.0",
|
|
49745
49597
|
config: "2.0.0",
|
|
@@ -49869,7 +49721,7 @@ async function getMigrationStatus(cwd) {
|
|
|
49869
49721
|
} catch {
|
|
49870
49722
|
}
|
|
49871
49723
|
try {
|
|
49872
|
-
const archivePath =
|
|
49724
|
+
const archivePath = join59(getCleoDirAbsolute(cwd), "todo-archive.json");
|
|
49873
49725
|
const archiveData = await readJson(archivePath);
|
|
49874
49726
|
if (archiveData) {
|
|
49875
49727
|
const current = detectVersion(archiveData);
|
|
@@ -49888,7 +49740,7 @@ async function runMigration(fileType, options = {}, cwd) {
|
|
|
49888
49740
|
const filePaths = {
|
|
49889
49741
|
todo: getTaskPath(cwd),
|
|
49890
49742
|
config: getConfigPath(cwd),
|
|
49891
|
-
archive:
|
|
49743
|
+
archive: join59(getCleoDirAbsolute(cwd), "todo-archive.json")
|
|
49892
49744
|
};
|
|
49893
49745
|
const filePath = filePaths[fileType];
|
|
49894
49746
|
if (!filePath) {
|
|
@@ -50085,8 +49937,8 @@ init_src();
|
|
|
50085
49937
|
init_errors3();
|
|
50086
49938
|
init_data_accessor();
|
|
50087
49939
|
init_registry3();
|
|
50088
|
-
import { existsSync as existsSync56, readFileSync as
|
|
50089
|
-
import { basename as basename9, join as
|
|
49940
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "node:fs";
|
|
49941
|
+
import { basename as basename9, join as join62 } from "node:path";
|
|
50090
49942
|
var TASK_ID_RE = /^T\d{3,}$/;
|
|
50091
49943
|
var QUALIFIED_RE = /^([a-z0-9_-]+|\.|\*):T\d{3,}$/;
|
|
50092
49944
|
function validateSyntax(query) {
|
|
@@ -50123,9 +49975,9 @@ function getCurrentProject() {
|
|
|
50123
49975
|
return process.env["NEXUS_CURRENT_PROJECT"];
|
|
50124
49976
|
}
|
|
50125
49977
|
try {
|
|
50126
|
-
const infoPath =
|
|
49978
|
+
const infoPath = join62(process.cwd(), ".cleo", "project-info.json");
|
|
50127
49979
|
if (existsSync56(infoPath)) {
|
|
50128
|
-
const data = JSON.parse(
|
|
49980
|
+
const data = JSON.parse(readFileSync38(infoPath, "utf-8"));
|
|
50129
49981
|
if (typeof data.name === "string" && data.name.length > 0) {
|
|
50130
49982
|
return data.name;
|
|
50131
49983
|
}
|
|
@@ -50162,7 +50014,7 @@ async function resolveProjectPath2(projectName) {
|
|
|
50162
50014
|
return project.path;
|
|
50163
50015
|
}
|
|
50164
50016
|
async function readProjectTasks(projectPath) {
|
|
50165
|
-
const tasksDbPath =
|
|
50017
|
+
const tasksDbPath = join62(projectPath, ".cleo", "tasks.db");
|
|
50166
50018
|
try {
|
|
50167
50019
|
const accessor = await getAccessor(projectPath);
|
|
50168
50020
|
const { tasks: tasks2 } = await accessor.queryTasks({});
|
|
@@ -50766,7 +50618,7 @@ init_paths();
|
|
|
50766
50618
|
init_git_checkpoint();
|
|
50767
50619
|
import { existsSync as existsSync57, readdirSync as readdirSync23, statSync as statSync15 } from "node:fs";
|
|
50768
50620
|
import { readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
|
|
50769
|
-
import { join as
|
|
50621
|
+
import { join as join63, relative as relative9 } from "node:path";
|
|
50770
50622
|
var GITIGNORE_START = "# CLEO:SHARING:START - Auto-managed by cleo sharing sync";
|
|
50771
50623
|
var GITIGNORE_END = "# CLEO:SHARING:END";
|
|
50772
50624
|
function matchesPattern(filePath, pattern) {
|
|
@@ -50794,7 +50646,7 @@ function collectCleoFiles(cleoDir) {
|
|
|
50794
50646
|
const entries = readdirSync23(dir);
|
|
50795
50647
|
for (const entry of entries) {
|
|
50796
50648
|
if (entry === ".git") continue;
|
|
50797
|
-
const fullPath =
|
|
50649
|
+
const fullPath = join63(dir, entry);
|
|
50798
50650
|
const relPath = relative9(cleoDir, fullPath);
|
|
50799
50651
|
try {
|
|
50800
50652
|
const stat2 = statSync15(fullPath);
|
|
@@ -50893,7 +50745,7 @@ function generateGitignoreEntries(sharing) {
|
|
|
50893
50745
|
async function syncGitignore(cwd) {
|
|
50894
50746
|
const config2 = await loadConfig(cwd);
|
|
50895
50747
|
const projectRoot = getProjectRoot(cwd);
|
|
50896
|
-
const gitignorePath =
|
|
50748
|
+
const gitignorePath = join63(projectRoot, ".gitignore");
|
|
50897
50749
|
const entries = generateGitignoreEntries(config2.sharing);
|
|
50898
50750
|
const managedSection = ["", GITIGNORE_START, ...entries, GITIGNORE_END, ""].join("\n");
|
|
50899
50751
|
let content = "";
|
|
@@ -51642,8 +51494,8 @@ function parseLogLines(lines) {
|
|
|
51642
51494
|
// packages/core/src/observability/log-reader.ts
|
|
51643
51495
|
init_logger();
|
|
51644
51496
|
init_paths();
|
|
51645
|
-
import { createReadStream, existsSync as existsSync58, readdirSync as readdirSync24, readFileSync as
|
|
51646
|
-
import { join as
|
|
51497
|
+
import { createReadStream, existsSync as existsSync58, readdirSync as readdirSync24, readFileSync as readFileSync39, statSync as statSync16 } from "node:fs";
|
|
51498
|
+
import { join as join64 } from "node:path";
|
|
51647
51499
|
import { createInterface } from "node:readline";
|
|
51648
51500
|
var CLEO_LOG_PATTERN = /^cleo\.(\d{4}-\d{2}-\d{2})\.(\d+)\.log$/;
|
|
51649
51501
|
var MIGRATION_LOG_PATTERN = /^migration-.*\.jsonl$/;
|
|
@@ -51651,11 +51503,11 @@ function getProjectLogDir(cwd) {
|
|
|
51651
51503
|
const runtimeDir = getLogDir();
|
|
51652
51504
|
if (runtimeDir) return runtimeDir;
|
|
51653
51505
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
51654
|
-
const logsDir =
|
|
51506
|
+
const logsDir = join64(cleoDir, "logs");
|
|
51655
51507
|
return existsSync58(logsDir) ? logsDir : null;
|
|
51656
51508
|
}
|
|
51657
51509
|
function getGlobalLogDir() {
|
|
51658
|
-
return
|
|
51510
|
+
return join64(getCleoHome(), "logs");
|
|
51659
51511
|
}
|
|
51660
51512
|
function scanLogDir(dir, includeMigration) {
|
|
51661
51513
|
if (!existsSync58(dir)) return [];
|
|
@@ -51670,7 +51522,7 @@ function scanLogDir(dir, includeMigration) {
|
|
|
51670
51522
|
const cleoMatch = name2.match(CLEO_LOG_PATTERN);
|
|
51671
51523
|
const isMigration = MIGRATION_LOG_PATTERN.test(name2);
|
|
51672
51524
|
if (!cleoMatch && (!isMigration || !includeMigration)) continue;
|
|
51673
|
-
const filePath =
|
|
51525
|
+
const filePath = join64(dir, name2);
|
|
51674
51526
|
let stat2;
|
|
51675
51527
|
try {
|
|
51676
51528
|
stat2 = statSync16(filePath);
|
|
@@ -51714,7 +51566,7 @@ function discoverLogFiles(options, cwd) {
|
|
|
51714
51566
|
function readLogFileLines(filePath) {
|
|
51715
51567
|
let content;
|
|
51716
51568
|
try {
|
|
51717
|
-
content =
|
|
51569
|
+
content = readFileSync39(filePath, "utf-8");
|
|
51718
51570
|
} catch {
|
|
51719
51571
|
return [];
|
|
51720
51572
|
}
|
|
@@ -51981,14 +51833,14 @@ function analyzeDependencies(children, allTasks) {
|
|
|
51981
51833
|
|
|
51982
51834
|
// packages/core/src/orchestration/context.ts
|
|
51983
51835
|
init_paths();
|
|
51984
|
-
import { existsSync as existsSync59, readFileSync as
|
|
51836
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "node:fs";
|
|
51985
51837
|
function countManifestEntries(projectRoot) {
|
|
51986
51838
|
const manifestPath = getManifestPath(projectRoot);
|
|
51987
51839
|
if (!existsSync59(manifestPath)) {
|
|
51988
51840
|
return 0;
|
|
51989
51841
|
}
|
|
51990
51842
|
try {
|
|
51991
|
-
const content =
|
|
51843
|
+
const content = readFileSync40(manifestPath, "utf-8");
|
|
51992
51844
|
return content.split("\n").filter((l) => l.trim()).length;
|
|
51993
51845
|
} catch {
|
|
51994
51846
|
return 0;
|
|
@@ -52521,22 +52373,22 @@ __export(otel_exports, {
|
|
|
52521
52373
|
getOtelSummary: () => getOtelSummary,
|
|
52522
52374
|
getRealTokenUsage: () => getRealTokenUsage
|
|
52523
52375
|
});
|
|
52524
|
-
import { copyFileSync as copyFileSync6, existsSync as existsSync60, readFileSync as
|
|
52525
|
-
import { join as
|
|
52376
|
+
import { copyFileSync as copyFileSync6, existsSync as existsSync60, readFileSync as readFileSync41, writeFileSync as writeFileSync6 } from "node:fs";
|
|
52377
|
+
import { join as join65 } from "node:path";
|
|
52526
52378
|
function getProjectRoot2() {
|
|
52527
52379
|
let dir = process.cwd();
|
|
52528
52380
|
while (dir !== "/") {
|
|
52529
|
-
if (existsSync60(
|
|
52530
|
-
dir =
|
|
52381
|
+
if (existsSync60(join65(dir, ".cleo", "config.json"))) return dir;
|
|
52382
|
+
dir = join65(dir, "..");
|
|
52531
52383
|
}
|
|
52532
52384
|
return process.cwd();
|
|
52533
52385
|
}
|
|
52534
52386
|
function getTokenFilePath2() {
|
|
52535
|
-
return
|
|
52387
|
+
return join65(getProjectRoot2(), ".cleo", "metrics", "TOKEN_USAGE.jsonl");
|
|
52536
52388
|
}
|
|
52537
52389
|
function readJsonlFile3(filePath) {
|
|
52538
52390
|
if (!existsSync60(filePath)) return [];
|
|
52539
|
-
const content =
|
|
52391
|
+
const content = readFileSync41(filePath, "utf-8").trim();
|
|
52540
52392
|
if (!content) return [];
|
|
52541
52393
|
return content.split("\n").map((line2) => JSON.parse(line2));
|
|
52542
52394
|
}
|
|
@@ -53397,7 +53249,7 @@ __export(release_exports, {
|
|
|
53397
53249
|
|
|
53398
53250
|
// packages/core/src/release/artifacts.ts
|
|
53399
53251
|
import { execFile as execFile4 } from "node:child_process";
|
|
53400
|
-
import { existsSync as existsSync61, readFileSync as
|
|
53252
|
+
import { existsSync as existsSync61, readFileSync as readFileSync42 } from "node:fs";
|
|
53401
53253
|
import { promisify as promisify4 } from "node:util";
|
|
53402
53254
|
var execFileAsync4 = promisify4(execFile4);
|
|
53403
53255
|
async function commandExists(cmd) {
|
|
@@ -53466,7 +53318,7 @@ var npmPackageHandler = {
|
|
|
53466
53318
|
return { success: false, output: `package.json not found: ${packageFile}`, dryRun: false };
|
|
53467
53319
|
}
|
|
53468
53320
|
try {
|
|
53469
|
-
const content = JSON.parse(
|
|
53321
|
+
const content = JSON.parse(readFileSync42(packageFile, "utf-8"));
|
|
53470
53322
|
const requiredFields = ["name", "version", "description", "license"];
|
|
53471
53323
|
const missing = requiredFields.filter((f) => !content[f]);
|
|
53472
53324
|
if (missing.length > 0) {
|
|
@@ -53547,7 +53399,7 @@ var goModuleHandler = {
|
|
|
53547
53399
|
if (!await commandExists("go")) {
|
|
53548
53400
|
return { success: false, output: "go command not found", dryRun: false };
|
|
53549
53401
|
}
|
|
53550
|
-
const content =
|
|
53402
|
+
const content = readFileSync42(packageFile, "utf-8");
|
|
53551
53403
|
const moduleMatch = content.match(/^module\s+(\S+)/m);
|
|
53552
53404
|
if (!moduleMatch) {
|
|
53553
53405
|
return { success: false, output: "Module path not found in go.mod", dryRun: false };
|
|
@@ -53578,7 +53430,7 @@ var cargoCrateHandler = {
|
|
|
53578
53430
|
if (!await commandExists("cargo")) {
|
|
53579
53431
|
return { success: false, output: "cargo command not found", dryRun: false };
|
|
53580
53432
|
}
|
|
53581
|
-
const content =
|
|
53433
|
+
const content = readFileSync42(packageFile, "utf-8");
|
|
53582
53434
|
if (!content.includes("[package]")) {
|
|
53583
53435
|
return { success: false, output: "[package] section not found in Cargo.toml", dryRun: false };
|
|
53584
53436
|
}
|
|
@@ -53937,18 +53789,18 @@ function describeChannel(channel) {
|
|
|
53937
53789
|
}
|
|
53938
53790
|
|
|
53939
53791
|
// packages/core/src/release/ci.ts
|
|
53940
|
-
import { existsSync as existsSync64, mkdirSync as mkdirSync14, readFileSync as
|
|
53941
|
-
import { dirname as dirname14, join as
|
|
53792
|
+
import { existsSync as existsSync64, mkdirSync as mkdirSync14, readFileSync as readFileSync44, writeFileSync as writeFileSync7 } from "node:fs";
|
|
53793
|
+
import { dirname as dirname14, join as join67 } from "node:path";
|
|
53942
53794
|
|
|
53943
53795
|
// packages/core/src/release/release-config.ts
|
|
53944
53796
|
init_paths();
|
|
53945
|
-
import { existsSync as existsSync63, readFileSync as
|
|
53946
|
-
import { join as
|
|
53797
|
+
import { existsSync as existsSync63, readFileSync as readFileSync43 } from "node:fs";
|
|
53798
|
+
import { join as join66 } from "node:path";
|
|
53947
53799
|
function readConfigValueSync2(path2, defaultValue, cwd) {
|
|
53948
53800
|
try {
|
|
53949
|
-
const configPath =
|
|
53801
|
+
const configPath = join66(getCleoDir(cwd), "config.json");
|
|
53950
53802
|
if (!existsSync63(configPath)) return defaultValue;
|
|
53951
|
-
const config2 = JSON.parse(
|
|
53803
|
+
const config2 = JSON.parse(readFileSync43(configPath, "utf-8"));
|
|
53952
53804
|
const keys = path2.split(".");
|
|
53953
53805
|
let value = config2;
|
|
53954
53806
|
for (const key of keys) {
|
|
@@ -54110,9 +53962,9 @@ function getPlatformPath(platform5) {
|
|
|
54110
53962
|
}
|
|
54111
53963
|
function detectCIPlatform(projectDir) {
|
|
54112
53964
|
const dir = projectDir ?? process.cwd();
|
|
54113
|
-
if (existsSync64(
|
|
54114
|
-
if (existsSync64(
|
|
54115
|
-
if (existsSync64(
|
|
53965
|
+
if (existsSync64(join67(dir, ".github"))) return "github-actions";
|
|
53966
|
+
if (existsSync64(join67(dir, ".gitlab-ci.yml"))) return "gitlab-ci";
|
|
53967
|
+
if (existsSync64(join67(dir, ".circleci"))) return "circleci";
|
|
54116
53968
|
return null;
|
|
54117
53969
|
}
|
|
54118
53970
|
function generateGitHubActions(config2) {
|
|
@@ -54214,7 +54066,7 @@ function generateCIConfig(platform5, cwd) {
|
|
|
54214
54066
|
}
|
|
54215
54067
|
function writeCIConfig(platform5, options = {}) {
|
|
54216
54068
|
const projectDir = options.projectDir ?? process.cwd();
|
|
54217
|
-
const outputPath =
|
|
54069
|
+
const outputPath = join67(projectDir, getPlatformPath(platform5));
|
|
54218
54070
|
const content = generateCIConfig(platform5, projectDir);
|
|
54219
54071
|
if (options.dryRun) {
|
|
54220
54072
|
return { action: "would_write", path: outputPath, content };
|
|
@@ -54225,13 +54077,13 @@ function writeCIConfig(platform5, options = {}) {
|
|
|
54225
54077
|
}
|
|
54226
54078
|
function validateCIConfig(platform5, projectDir) {
|
|
54227
54079
|
const dir = projectDir ?? process.cwd();
|
|
54228
|
-
const configPath =
|
|
54080
|
+
const configPath = join67(dir, getPlatformPath(platform5));
|
|
54229
54081
|
if (!existsSync64(configPath)) {
|
|
54230
54082
|
return { valid: false, exists: false, errors: ["Config file not found"] };
|
|
54231
54083
|
}
|
|
54232
54084
|
const errors = [];
|
|
54233
54085
|
try {
|
|
54234
|
-
const content =
|
|
54086
|
+
const content = readFileSync44(configPath, "utf-8");
|
|
54235
54087
|
if (!content.trim()) errors.push("Config file is empty");
|
|
54236
54088
|
} catch (err) {
|
|
54237
54089
|
errors.push(`Cannot read config: ${String(err)}`);
|
|
@@ -54483,7 +54335,7 @@ function checkDoubleListing(releaseTaskIds, existingReleases) {
|
|
|
54483
54335
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
54484
54336
|
import { existsSync as existsSync66, renameSync as renameSync5 } from "node:fs";
|
|
54485
54337
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
54486
|
-
import { join as
|
|
54338
|
+
import { join as join69 } from "node:path";
|
|
54487
54339
|
import { and as and9, count, desc as desc4, eq as eq12 } from "drizzle-orm";
|
|
54488
54340
|
init_paths();
|
|
54489
54341
|
init_tasks_schema();
|
|
@@ -54492,13 +54344,13 @@ init_tasks_schema();
|
|
|
54492
54344
|
init_src();
|
|
54493
54345
|
init_errors3();
|
|
54494
54346
|
init_paths();
|
|
54495
|
-
import { existsSync as existsSync65, readFileSync as
|
|
54496
|
-
import { join as
|
|
54347
|
+
import { existsSync as existsSync65, readFileSync as readFileSync45, writeFileSync as writeFileSync8 } from "node:fs";
|
|
54348
|
+
import { join as join68 } from "node:path";
|
|
54497
54349
|
function readConfigValueSync3(path2, defaultValue, cwd) {
|
|
54498
54350
|
try {
|
|
54499
|
-
const configPath =
|
|
54351
|
+
const configPath = join68(getCleoDir(cwd), "config.json");
|
|
54500
54352
|
if (!existsSync65(configPath)) return defaultValue;
|
|
54501
|
-
const config2 = JSON.parse(
|
|
54353
|
+
const config2 = JSON.parse(readFileSync45(configPath, "utf-8"));
|
|
54502
54354
|
const keys = path2.split(".");
|
|
54503
54355
|
let value = config2;
|
|
54504
54356
|
for (const key of keys) {
|
|
@@ -54593,7 +54445,7 @@ function isVersionBumpConfigured(cwd) {
|
|
|
54593
54445
|
return getVersionBumpConfig(cwd).length > 0;
|
|
54594
54446
|
}
|
|
54595
54447
|
function bumpFile(target, newVersion, projectRoot) {
|
|
54596
|
-
const filePath =
|
|
54448
|
+
const filePath = join68(projectRoot, target.file);
|
|
54597
54449
|
if (!existsSync65(filePath)) {
|
|
54598
54450
|
return {
|
|
54599
54451
|
file: target.file,
|
|
@@ -54603,7 +54455,7 @@ function bumpFile(target, newVersion, projectRoot) {
|
|
|
54603
54455
|
};
|
|
54604
54456
|
}
|
|
54605
54457
|
try {
|
|
54606
|
-
const content =
|
|
54458
|
+
const content = readFileSync45(filePath, "utf-8");
|
|
54607
54459
|
let previousVersion;
|
|
54608
54460
|
let newContent;
|
|
54609
54461
|
switch (target.strategy) {
|
|
@@ -54974,7 +54826,7 @@ async function generateReleaseChangelog(version2, loadTasksFn, cwd) {
|
|
|
54974
54826
|
}
|
|
54975
54827
|
const changelog = sections.join("\n");
|
|
54976
54828
|
await db.update(releaseManifests).set({ changelog }).where(eq12(releaseManifests.version, normalizedVersion)).run();
|
|
54977
|
-
const changelogPath =
|
|
54829
|
+
const changelogPath = join69(cwd ?? process.cwd(), "CHANGELOG.md");
|
|
54978
54830
|
let existingChangelogContent = "";
|
|
54979
54831
|
try {
|
|
54980
54832
|
existingChangelogContent = await readFile12(changelogPath, "utf8");
|
|
@@ -55130,10 +54982,10 @@ async function runReleaseGates(version2, loadTasksFn, cwd, opts) {
|
|
|
55130
54982
|
message: incompleteTasks.length === 0 ? "All tasks completed" : `${incompleteTasks.length} tasks not completed: ${incompleteTasks.join(", ")}`
|
|
55131
54983
|
});
|
|
55132
54984
|
const projectRoot = cwd ?? getProjectRoot();
|
|
55133
|
-
const monorepoDist =
|
|
55134
|
-
const rootDist =
|
|
54985
|
+
const monorepoDist = join69(projectRoot, "packages", "cleo", "dist", "cli", "index.js");
|
|
54986
|
+
const rootDist = join69(projectRoot, "dist", "cli", "index.js");
|
|
55135
54987
|
const distExists = existsSync66(monorepoDist) || existsSync66(rootDist);
|
|
55136
|
-
const isNodeProject = existsSync66(
|
|
54988
|
+
const isNodeProject = existsSync66(join69(projectRoot, "package.json"));
|
|
55137
54989
|
if (isNodeProject) {
|
|
55138
54990
|
gates.push({
|
|
55139
54991
|
name: "build_artifact",
|
|
@@ -55280,7 +55132,7 @@ async function rollbackRelease(version2, reason, cwd) {
|
|
|
55280
55132
|
};
|
|
55281
55133
|
}
|
|
55282
55134
|
async function readPushPolicy(cwd) {
|
|
55283
|
-
const configPath =
|
|
55135
|
+
const configPath = join69(getCleoDirAbsolute(cwd), "config.json");
|
|
55284
55136
|
let config2;
|
|
55285
55137
|
try {
|
|
55286
55138
|
const raw = await readFile12(configPath, "utf-8");
|
|
@@ -55384,7 +55236,7 @@ async function markReleasePushed(version2, pushedAt, cwd, provenance) {
|
|
|
55384
55236
|
}).where(eq12(releaseManifests.version, normalizedVersion)).run();
|
|
55385
55237
|
}
|
|
55386
55238
|
async function migrateReleasesJsonToSqlite(projectRoot) {
|
|
55387
|
-
const releasesPath =
|
|
55239
|
+
const releasesPath = join69(getCleoDirAbsolute(projectRoot), "releases.json");
|
|
55388
55240
|
if (!existsSync66(releasesPath)) {
|
|
55389
55241
|
return { migrated: 0 };
|
|
55390
55242
|
}
|
|
@@ -55706,22 +55558,22 @@ __export(roadmap_exports, {
|
|
|
55706
55558
|
getRoadmap: () => getRoadmap
|
|
55707
55559
|
});
|
|
55708
55560
|
init_data_accessor();
|
|
55709
|
-
import { existsSync as existsSync67, readFileSync as
|
|
55710
|
-
import { join as
|
|
55561
|
+
import { existsSync as existsSync67, readFileSync as readFileSync46 } from "node:fs";
|
|
55562
|
+
import { join as join70 } from "node:path";
|
|
55711
55563
|
async function getRoadmap(opts, accessor) {
|
|
55712
55564
|
const acc = accessor ?? await getAccessor(opts.cwd);
|
|
55713
55565
|
const { tasks: tasks2 } = await acc.queryTasks({});
|
|
55714
|
-
const versionPath =
|
|
55715
|
-
const currentVersion = existsSync67(versionPath) ?
|
|
55566
|
+
const versionPath = join70(opts.cwd ?? process.cwd(), "VERSION");
|
|
55567
|
+
const currentVersion = existsSync67(versionPath) ? readFileSync46(versionPath, "utf-8").trim() : "unknown";
|
|
55716
55568
|
const childParentIds = new Set(tasks2.filter((t) => t.parentId).map((t) => t.parentId));
|
|
55717
55569
|
const epics = tasks2.filter((t) => childParentIds.has(t.id));
|
|
55718
55570
|
const pending = epics.filter((e) => e.status !== "done");
|
|
55719
55571
|
const completed = epics.filter((e) => e.status === "done");
|
|
55720
55572
|
const releaseHistory = [];
|
|
55721
55573
|
if (opts.includeHistory) {
|
|
55722
|
-
const changelogPath =
|
|
55574
|
+
const changelogPath = join70(opts.cwd ?? process.cwd(), "CHANGELOG.md");
|
|
55723
55575
|
if (existsSync67(changelogPath)) {
|
|
55724
|
-
const content =
|
|
55576
|
+
const content = readFileSync46(changelogPath, "utf-8");
|
|
55725
55577
|
const versionRegex = /^##\s+\[?v?(\d+\.\d+\.\d+[^\]]*)\]?\s*[-(]?\s*(\d{4}-\d{2}-\d{2})?/gm;
|
|
55726
55578
|
for (const match of content.matchAll(versionRegex)) {
|
|
55727
55579
|
releaseHistory.push({
|
|
@@ -55767,9 +55619,9 @@ __export(routing_exports, {
|
|
|
55767
55619
|
var CAPABILITY_MATRIX = [
|
|
55768
55620
|
// === Tasks Domain ===
|
|
55769
55621
|
// Query operations
|
|
55770
|
-
{ domain: "tasks", operation: "show", gateway: "query", mode: "native", preferredChannel: "
|
|
55771
|
-
{ domain: "tasks", operation: "list", gateway: "query", mode: "native", preferredChannel: "
|
|
55772
|
-
{ domain: "tasks", operation: "find", gateway: "query", mode: "native", preferredChannel: "
|
|
55622
|
+
{ domain: "tasks", operation: "show", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55623
|
+
{ domain: "tasks", operation: "list", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55624
|
+
{ domain: "tasks", operation: "find", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55773
55625
|
{
|
|
55774
55626
|
domain: "tasks",
|
|
55775
55627
|
operation: "tree",
|
|
@@ -55798,8 +55650,8 @@ var CAPABILITY_MATRIX = [
|
|
|
55798
55650
|
mode: "native",
|
|
55799
55651
|
preferredChannel: "either"
|
|
55800
55652
|
},
|
|
55801
|
-
{ domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "
|
|
55802
|
-
{ domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "
|
|
55653
|
+
{ domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55654
|
+
{ domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55803
55655
|
{
|
|
55804
55656
|
domain: "tasks",
|
|
55805
55657
|
operation: "relates",
|
|
@@ -55826,7 +55678,7 @@ var CAPABILITY_MATRIX = [
|
|
|
55826
55678
|
operation: "current",
|
|
55827
55679
|
gateway: "query",
|
|
55828
55680
|
mode: "native",
|
|
55829
|
-
preferredChannel: "
|
|
55681
|
+
preferredChannel: "cli"
|
|
55830
55682
|
},
|
|
55831
55683
|
{
|
|
55832
55684
|
domain: "tasks",
|
|
@@ -55836,20 +55688,20 @@ var CAPABILITY_MATRIX = [
|
|
|
55836
55688
|
preferredChannel: "either"
|
|
55837
55689
|
},
|
|
55838
55690
|
// Mutate operations
|
|
55839
|
-
{ domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "
|
|
55691
|
+
{ domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "cli" },
|
|
55840
55692
|
{
|
|
55841
55693
|
domain: "tasks",
|
|
55842
55694
|
operation: "update",
|
|
55843
55695
|
gateway: "mutate",
|
|
55844
55696
|
mode: "native",
|
|
55845
|
-
preferredChannel: "
|
|
55697
|
+
preferredChannel: "cli"
|
|
55846
55698
|
},
|
|
55847
55699
|
{
|
|
55848
55700
|
domain: "tasks",
|
|
55849
55701
|
operation: "complete",
|
|
55850
55702
|
gateway: "mutate",
|
|
55851
55703
|
mode: "native",
|
|
55852
|
-
preferredChannel: "
|
|
55704
|
+
preferredChannel: "cli"
|
|
55853
55705
|
},
|
|
55854
55706
|
{
|
|
55855
55707
|
domain: "tasks",
|
|
@@ -55905,14 +55757,14 @@ var CAPABILITY_MATRIX = [
|
|
|
55905
55757
|
operation: "start",
|
|
55906
55758
|
gateway: "mutate",
|
|
55907
55759
|
mode: "native",
|
|
55908
|
-
preferredChannel: "
|
|
55760
|
+
preferredChannel: "cli"
|
|
55909
55761
|
},
|
|
55910
55762
|
{
|
|
55911
55763
|
domain: "tasks",
|
|
55912
55764
|
operation: "stop",
|
|
55913
55765
|
gateway: "mutate",
|
|
55914
55766
|
mode: "native",
|
|
55915
|
-
preferredChannel: "
|
|
55767
|
+
preferredChannel: "cli"
|
|
55916
55768
|
},
|
|
55917
55769
|
// Sync sub-domain (provider-agnostic task reconciliation)
|
|
55918
55770
|
{
|
|
@@ -55943,7 +55795,7 @@ var CAPABILITY_MATRIX = [
|
|
|
55943
55795
|
operation: "status",
|
|
55944
55796
|
gateway: "query",
|
|
55945
55797
|
mode: "native",
|
|
55946
|
-
preferredChannel: "
|
|
55798
|
+
preferredChannel: "cli"
|
|
55947
55799
|
},
|
|
55948
55800
|
{
|
|
55949
55801
|
domain: "session",
|
|
@@ -55978,14 +55830,14 @@ var CAPABILITY_MATRIX = [
|
|
|
55978
55830
|
operation: "handoff.show",
|
|
55979
55831
|
gateway: "query",
|
|
55980
55832
|
mode: "native",
|
|
55981
|
-
preferredChannel: "
|
|
55833
|
+
preferredChannel: "cli"
|
|
55982
55834
|
},
|
|
55983
55835
|
{
|
|
55984
55836
|
domain: "session",
|
|
55985
55837
|
operation: "briefing.show",
|
|
55986
55838
|
gateway: "query",
|
|
55987
55839
|
mode: "native",
|
|
55988
|
-
preferredChannel: "
|
|
55840
|
+
preferredChannel: "cli"
|
|
55989
55841
|
},
|
|
55990
55842
|
{
|
|
55991
55843
|
domain: "session",
|
|
@@ -56000,14 +55852,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56000
55852
|
operation: "start",
|
|
56001
55853
|
gateway: "mutate",
|
|
56002
55854
|
mode: "native",
|
|
56003
|
-
preferredChannel: "
|
|
55855
|
+
preferredChannel: "cli"
|
|
56004
55856
|
},
|
|
56005
55857
|
{
|
|
56006
55858
|
domain: "session",
|
|
56007
55859
|
operation: "end",
|
|
56008
55860
|
gateway: "mutate",
|
|
56009
55861
|
mode: "native",
|
|
56010
|
-
preferredChannel: "
|
|
55862
|
+
preferredChannel: "cli"
|
|
56011
55863
|
},
|
|
56012
55864
|
{
|
|
56013
55865
|
domain: "session",
|
|
@@ -56095,7 +55947,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56095
55947
|
mode: "native",
|
|
56096
55948
|
preferredChannel: "either"
|
|
56097
55949
|
},
|
|
56098
|
-
{ domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "
|
|
55950
|
+
{ domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56099
55951
|
{
|
|
56100
55952
|
domain: "admin",
|
|
56101
55953
|
operation: "log",
|
|
@@ -56110,7 +55962,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56110
55962
|
mode: "native",
|
|
56111
55963
|
preferredChannel: "either"
|
|
56112
55964
|
},
|
|
56113
|
-
{ domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "
|
|
55965
|
+
{ domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56114
55966
|
{
|
|
56115
55967
|
domain: "admin",
|
|
56116
55968
|
operation: "token",
|
|
@@ -56139,7 +55991,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56139
55991
|
mode: "native",
|
|
56140
55992
|
preferredChannel: "either"
|
|
56141
55993
|
},
|
|
56142
|
-
{ domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "
|
|
55994
|
+
{ domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56143
55995
|
// Mutate operations
|
|
56144
55996
|
{
|
|
56145
55997
|
domain: "admin",
|
|
@@ -56302,7 +56154,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56302
56154
|
operation: "compliance.summary",
|
|
56303
56155
|
gateway: "query",
|
|
56304
56156
|
mode: "native",
|
|
56305
|
-
preferredChannel: "
|
|
56157
|
+
preferredChannel: "cli"
|
|
56306
56158
|
},
|
|
56307
56159
|
{
|
|
56308
56160
|
domain: "check",
|
|
@@ -56359,7 +56211,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56359
56211
|
operation: "compliance.record",
|
|
56360
56212
|
gateway: "mutate",
|
|
56361
56213
|
mode: "native",
|
|
56362
|
-
preferredChannel: "
|
|
56214
|
+
preferredChannel: "cli"
|
|
56363
56215
|
},
|
|
56364
56216
|
{
|
|
56365
56217
|
domain: "check",
|
|
@@ -56460,7 +56312,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56460
56312
|
operation: "spawn",
|
|
56461
56313
|
gateway: "mutate",
|
|
56462
56314
|
mode: "native",
|
|
56463
|
-
preferredChannel: "
|
|
56315
|
+
preferredChannel: "cli"
|
|
56464
56316
|
},
|
|
56465
56317
|
{
|
|
56466
56318
|
domain: "orchestrate",
|
|
@@ -56504,42 +56356,42 @@ var CAPABILITY_MATRIX = [
|
|
|
56504
56356
|
operation: "find",
|
|
56505
56357
|
gateway: "query",
|
|
56506
56358
|
mode: "native",
|
|
56507
|
-
preferredChannel: "
|
|
56359
|
+
preferredChannel: "cli"
|
|
56508
56360
|
},
|
|
56509
56361
|
{
|
|
56510
56362
|
domain: "memory",
|
|
56511
56363
|
operation: "timeline",
|
|
56512
56364
|
gateway: "query",
|
|
56513
56365
|
mode: "native",
|
|
56514
|
-
preferredChannel: "
|
|
56366
|
+
preferredChannel: "cli"
|
|
56515
56367
|
},
|
|
56516
56368
|
{
|
|
56517
56369
|
domain: "memory",
|
|
56518
56370
|
operation: "fetch",
|
|
56519
56371
|
gateway: "query",
|
|
56520
56372
|
mode: "native",
|
|
56521
|
-
preferredChannel: "
|
|
56373
|
+
preferredChannel: "cli"
|
|
56522
56374
|
},
|
|
56523
56375
|
{
|
|
56524
56376
|
domain: "memory",
|
|
56525
56377
|
operation: "decision.find",
|
|
56526
56378
|
gateway: "query",
|
|
56527
56379
|
mode: "native",
|
|
56528
|
-
preferredChannel: "
|
|
56380
|
+
preferredChannel: "cli"
|
|
56529
56381
|
},
|
|
56530
56382
|
{
|
|
56531
56383
|
domain: "memory",
|
|
56532
56384
|
operation: "pattern.find",
|
|
56533
56385
|
gateway: "query",
|
|
56534
56386
|
mode: "native",
|
|
56535
|
-
preferredChannel: "
|
|
56387
|
+
preferredChannel: "cli"
|
|
56536
56388
|
},
|
|
56537
56389
|
{
|
|
56538
56390
|
domain: "memory",
|
|
56539
56391
|
operation: "learning.find",
|
|
56540
56392
|
gateway: "query",
|
|
56541
56393
|
mode: "native",
|
|
56542
|
-
preferredChannel: "
|
|
56394
|
+
preferredChannel: "cli"
|
|
56543
56395
|
},
|
|
56544
56396
|
{
|
|
56545
56397
|
domain: "memory",
|
|
@@ -56582,28 +56434,28 @@ var CAPABILITY_MATRIX = [
|
|
|
56582
56434
|
operation: "observe",
|
|
56583
56435
|
gateway: "mutate",
|
|
56584
56436
|
mode: "native",
|
|
56585
|
-
preferredChannel: "
|
|
56437
|
+
preferredChannel: "cli"
|
|
56586
56438
|
},
|
|
56587
56439
|
{
|
|
56588
56440
|
domain: "memory",
|
|
56589
56441
|
operation: "decision.store",
|
|
56590
56442
|
gateway: "mutate",
|
|
56591
56443
|
mode: "native",
|
|
56592
|
-
preferredChannel: "
|
|
56444
|
+
preferredChannel: "cli"
|
|
56593
56445
|
},
|
|
56594
56446
|
{
|
|
56595
56447
|
domain: "memory",
|
|
56596
56448
|
operation: "pattern.store",
|
|
56597
56449
|
gateway: "mutate",
|
|
56598
56450
|
mode: "native",
|
|
56599
|
-
preferredChannel: "
|
|
56451
|
+
preferredChannel: "cli"
|
|
56600
56452
|
},
|
|
56601
56453
|
{
|
|
56602
56454
|
domain: "memory",
|
|
56603
56455
|
operation: "learning.store",
|
|
56604
56456
|
gateway: "mutate",
|
|
56605
56457
|
mode: "native",
|
|
56606
|
-
preferredChannel: "
|
|
56458
|
+
preferredChannel: "cli"
|
|
56607
56459
|
},
|
|
56608
56460
|
{
|
|
56609
56461
|
domain: "memory",
|
|
@@ -56633,14 +56485,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56633
56485
|
operation: "stage.validate",
|
|
56634
56486
|
gateway: "query",
|
|
56635
56487
|
mode: "native",
|
|
56636
|
-
preferredChannel: "
|
|
56488
|
+
preferredChannel: "cli"
|
|
56637
56489
|
},
|
|
56638
56490
|
{
|
|
56639
56491
|
domain: "pipeline",
|
|
56640
56492
|
operation: "stage.status",
|
|
56641
56493
|
gateway: "query",
|
|
56642
56494
|
mode: "native",
|
|
56643
|
-
preferredChannel: "
|
|
56495
|
+
preferredChannel: "cli"
|
|
56644
56496
|
},
|
|
56645
56497
|
{
|
|
56646
56498
|
domain: "pipeline",
|
|
@@ -56864,21 +56716,21 @@ var CAPABILITY_MATRIX = [
|
|
|
56864
56716
|
operation: "skill.list",
|
|
56865
56717
|
gateway: "query",
|
|
56866
56718
|
mode: "native",
|
|
56867
|
-
preferredChannel: "
|
|
56719
|
+
preferredChannel: "cli"
|
|
56868
56720
|
},
|
|
56869
56721
|
{
|
|
56870
56722
|
domain: "tools",
|
|
56871
56723
|
operation: "skill.show",
|
|
56872
56724
|
gateway: "query",
|
|
56873
56725
|
mode: "native",
|
|
56874
|
-
preferredChannel: "
|
|
56726
|
+
preferredChannel: "cli"
|
|
56875
56727
|
},
|
|
56876
56728
|
{
|
|
56877
56729
|
domain: "tools",
|
|
56878
56730
|
operation: "skill.find",
|
|
56879
56731
|
gateway: "query",
|
|
56880
56732
|
mode: "native",
|
|
56881
|
-
preferredChannel: "
|
|
56733
|
+
preferredChannel: "cli"
|
|
56882
56734
|
},
|
|
56883
56735
|
{
|
|
56884
56736
|
domain: "tools",
|
|
@@ -56949,14 +56801,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56949
56801
|
operation: "provider.list",
|
|
56950
56802
|
gateway: "query",
|
|
56951
56803
|
mode: "native",
|
|
56952
|
-
preferredChannel: "
|
|
56804
|
+
preferredChannel: "cli"
|
|
56953
56805
|
},
|
|
56954
56806
|
{
|
|
56955
56807
|
domain: "tools",
|
|
56956
56808
|
operation: "provider.detect",
|
|
56957
56809
|
gateway: "query",
|
|
56958
56810
|
mode: "native",
|
|
56959
|
-
preferredChannel: "
|
|
56811
|
+
preferredChannel: "cli"
|
|
56960
56812
|
},
|
|
56961
56813
|
{
|
|
56962
56814
|
domain: "tools",
|
|
@@ -56992,14 +56844,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56992
56844
|
operation: "adapter.list",
|
|
56993
56845
|
gateway: "query",
|
|
56994
56846
|
mode: "native",
|
|
56995
|
-
preferredChannel: "
|
|
56847
|
+
preferredChannel: "cli"
|
|
56996
56848
|
},
|
|
56997
56849
|
{
|
|
56998
56850
|
domain: "tools",
|
|
56999
56851
|
operation: "adapter.show",
|
|
57000
56852
|
gateway: "query",
|
|
57001
56853
|
mode: "native",
|
|
57002
|
-
preferredChannel: "
|
|
56854
|
+
preferredChannel: "cli"
|
|
57003
56855
|
},
|
|
57004
56856
|
{
|
|
57005
56857
|
domain: "tools",
|
|
@@ -57020,7 +56872,7 @@ var CAPABILITY_MATRIX = [
|
|
|
57020
56872
|
operation: "adapter.activate",
|
|
57021
56873
|
gateway: "mutate",
|
|
57022
56874
|
mode: "native",
|
|
57023
|
-
preferredChannel: "
|
|
56875
|
+
preferredChannel: "cli"
|
|
57024
56876
|
},
|
|
57025
56877
|
{
|
|
57026
56878
|
domain: "tools",
|
|
@@ -57193,14 +57045,14 @@ var CAPABILITY_MATRIX = [
|
|
|
57193
57045
|
operation: "list",
|
|
57194
57046
|
gateway: "query",
|
|
57195
57047
|
mode: "native",
|
|
57196
|
-
preferredChannel: "
|
|
57048
|
+
preferredChannel: "cli"
|
|
57197
57049
|
},
|
|
57198
57050
|
{
|
|
57199
57051
|
domain: "sticky",
|
|
57200
57052
|
operation: "show",
|
|
57201
57053
|
gateway: "query",
|
|
57202
57054
|
mode: "native",
|
|
57203
|
-
preferredChannel: "
|
|
57055
|
+
preferredChannel: "cli"
|
|
57204
57056
|
},
|
|
57205
57057
|
// Mutate operations
|
|
57206
57058
|
{
|
|
@@ -57208,7 +57060,7 @@ var CAPABILITY_MATRIX = [
|
|
|
57208
57060
|
operation: "add",
|
|
57209
57061
|
gateway: "mutate",
|
|
57210
57062
|
mode: "native",
|
|
57211
|
-
preferredChannel: "
|
|
57063
|
+
preferredChannel: "cli"
|
|
57212
57064
|
},
|
|
57213
57065
|
{
|
|
57214
57066
|
domain: "sticky",
|
|
@@ -57684,13 +57536,13 @@ import { catalog as catalog2 } from "@cleocode/caamp";
|
|
|
57684
57536
|
|
|
57685
57537
|
// packages/core/src/skills/agents/config.ts
|
|
57686
57538
|
init_paths();
|
|
57687
|
-
import { existsSync as existsSync69, readFileSync as
|
|
57688
|
-
import { basename as basename11, join as
|
|
57539
|
+
import { existsSync as existsSync69, readFileSync as readFileSync48 } from "node:fs";
|
|
57540
|
+
import { basename as basename11, join as join72 } from "node:path";
|
|
57689
57541
|
|
|
57690
57542
|
// packages/core/src/skills/discovery.ts
|
|
57691
57543
|
init_paths();
|
|
57692
|
-
import { existsSync as existsSync68, readdirSync as readdirSync25, readFileSync as
|
|
57693
|
-
import { basename as basename10, join as
|
|
57544
|
+
import { existsSync as existsSync68, readdirSync as readdirSync25, readFileSync as readFileSync47, statSync as statSync17 } from "node:fs";
|
|
57545
|
+
import { basename as basename10, join as join71 } from "node:path";
|
|
57694
57546
|
import {
|
|
57695
57547
|
discoverSkill as caampDiscoverSkill,
|
|
57696
57548
|
discoverSkills as caampDiscoverSkills,
|
|
@@ -57780,12 +57632,12 @@ var SKILL_NAME_MAP = {
|
|
|
57780
57632
|
function getSkillSearchPaths(cwd) {
|
|
57781
57633
|
const projectRoot = getProjectRoot(cwd);
|
|
57782
57634
|
const cleoHome = getCleoHome();
|
|
57783
|
-
const projectAgentsSkills =
|
|
57635
|
+
const projectAgentsSkills = join71(getProjectAgentsDir(projectRoot), "skills");
|
|
57784
57636
|
const paths = [
|
|
57785
57637
|
{ scope: "agent-skills", path: getCanonicalSkillsDir(), priority: 1 },
|
|
57786
57638
|
{ scope: "project-custom", path: projectAgentsSkills, priority: 2 }
|
|
57787
57639
|
];
|
|
57788
|
-
const mpCacheDir = process.env["CLEO_SKILLS_MP_CACHE"] ??
|
|
57640
|
+
const mpCacheDir = process.env["CLEO_SKILLS_MP_CACHE"] ?? join71(cleoHome, ".skills-cache");
|
|
57789
57641
|
if (existsSync68(mpCacheDir)) {
|
|
57790
57642
|
paths.push({ scope: "marketplace", path: mpCacheDir, priority: 4 });
|
|
57791
57643
|
}
|
|
@@ -57796,7 +57648,7 @@ function getSkillsDir(cwd) {
|
|
|
57796
57648
|
return getCanonicalSkillsDir();
|
|
57797
57649
|
}
|
|
57798
57650
|
function getSharedDir(cwd) {
|
|
57799
|
-
return
|
|
57651
|
+
return join71(getSkillsDir(cwd), "_shared");
|
|
57800
57652
|
}
|
|
57801
57653
|
function mapSkillName(input) {
|
|
57802
57654
|
if (SKILL_NAME_MAP[input]) {
|
|
@@ -57879,11 +57731,11 @@ function parseFrontmatter3(content) {
|
|
|
57879
57731
|
};
|
|
57880
57732
|
}
|
|
57881
57733
|
function discoverSkill(skillDir) {
|
|
57882
|
-
const skillMdPath =
|
|
57734
|
+
const skillMdPath = join71(skillDir, "SKILL.md");
|
|
57883
57735
|
if (!existsSync68(skillMdPath)) {
|
|
57884
57736
|
return null;
|
|
57885
57737
|
}
|
|
57886
|
-
const content =
|
|
57738
|
+
const content = readFileSync47(skillMdPath, "utf-8");
|
|
57887
57739
|
const frontmatter = parseFrontmatter3(content);
|
|
57888
57740
|
const dirName = basename10(skillDir);
|
|
57889
57741
|
return {
|
|
@@ -57904,7 +57756,7 @@ function discoverSkillsInDir(dir) {
|
|
|
57904
57756
|
const entries = readdirSync25(dir);
|
|
57905
57757
|
for (const entry of entries) {
|
|
57906
57758
|
if (entry.startsWith(".") || entry.startsWith("_")) continue;
|
|
57907
|
-
const entryPath =
|
|
57759
|
+
const entryPath = join71(dir, entry);
|
|
57908
57760
|
try {
|
|
57909
57761
|
if (statSync17(entryPath).isDirectory()) {
|
|
57910
57762
|
const skill = discoverSkill(entryPath);
|
|
@@ -57938,14 +57790,14 @@ function findSkill(name2, cwd) {
|
|
|
57938
57790
|
const { canonical } = mapSkillName(name2);
|
|
57939
57791
|
const searchPaths = getSkillSearchPaths(cwd);
|
|
57940
57792
|
for (const sp of searchPaths) {
|
|
57941
|
-
const skillDir =
|
|
57793
|
+
const skillDir = join71(sp.path, canonical);
|
|
57942
57794
|
const skill = discoverSkill(skillDir);
|
|
57943
57795
|
if (skill) return skill;
|
|
57944
57796
|
}
|
|
57945
57797
|
if (canonical.startsWith("ct-")) {
|
|
57946
57798
|
const legacy = canonical.slice(3);
|
|
57947
57799
|
for (const sp of searchPaths) {
|
|
57948
|
-
const skillDir =
|
|
57800
|
+
const skillDir = join71(sp.path, legacy);
|
|
57949
57801
|
const skill = discoverSkill(skillDir);
|
|
57950
57802
|
if (skill) return skill;
|
|
57951
57803
|
}
|
|
@@ -57984,14 +57836,14 @@ function resolveTemplatePath(name2, cwd) {
|
|
|
57984
57836
|
|
|
57985
57837
|
// packages/core/src/skills/agents/config.ts
|
|
57986
57838
|
function getAgentsDir(cwd) {
|
|
57987
|
-
return
|
|
57839
|
+
return join72(getProjectRoot(cwd), "agents");
|
|
57988
57840
|
}
|
|
57989
57841
|
function parseAgentConfig(agentDir) {
|
|
57990
|
-
const agentMdPath =
|
|
57842
|
+
const agentMdPath = join72(agentDir, "AGENT.md");
|
|
57991
57843
|
if (!existsSync69(agentMdPath)) {
|
|
57992
57844
|
return null;
|
|
57993
57845
|
}
|
|
57994
|
-
const content =
|
|
57846
|
+
const content = readFileSync48(agentMdPath, "utf-8");
|
|
57995
57847
|
const fm = parseFrontmatter3(content);
|
|
57996
57848
|
return {
|
|
57997
57849
|
name: fm.name || basename11(agentDir),
|
|
@@ -58003,7 +57855,7 @@ function parseAgentConfig(agentDir) {
|
|
|
58003
57855
|
}
|
|
58004
57856
|
function loadAgentConfig(agentName, cwd) {
|
|
58005
57857
|
const agentsDir = getAgentsDir(cwd);
|
|
58006
|
-
const agentDir =
|
|
57858
|
+
const agentDir = join72(agentsDir, agentName);
|
|
58007
57859
|
return parseAgentConfig(agentDir);
|
|
58008
57860
|
}
|
|
58009
57861
|
function getSubagentConfig(cwd) {
|
|
@@ -58011,7 +57863,7 @@ function getSubagentConfig(cwd) {
|
|
|
58011
57863
|
}
|
|
58012
57864
|
function agentExists(agentName, cwd) {
|
|
58013
57865
|
const agentsDir = getAgentsDir(cwd);
|
|
58014
|
-
const agentMdPath =
|
|
57866
|
+
const agentMdPath = join72(agentsDir, agentName, "AGENT.md");
|
|
58015
57867
|
return existsSync69(agentMdPath);
|
|
58016
57868
|
}
|
|
58017
57869
|
function extractBody(content) {
|
|
@@ -58035,7 +57887,7 @@ function extractBody(content) {
|
|
|
58035
57887
|
init_paths();
|
|
58036
57888
|
import { existsSync as existsSync70, mkdirSync as mkdirSync15, readdirSync as readdirSync26, readlinkSync, symlinkSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
58037
57889
|
import { platform as platform2 } from "node:os";
|
|
58038
|
-
import { basename as basename12, join as
|
|
57890
|
+
import { basename as basename12, join as join73 } from "node:path";
|
|
58039
57891
|
var DIR_SYMLINK_TYPE = platform2() === "win32" ? "junction" : "dir";
|
|
58040
57892
|
function getAgentInstallDir() {
|
|
58041
57893
|
return getClaudeAgentsDir();
|
|
@@ -58043,7 +57895,7 @@ function getAgentInstallDir() {
|
|
|
58043
57895
|
function installAgent(agentDir) {
|
|
58044
57896
|
const targetDir = getAgentInstallDir();
|
|
58045
57897
|
const agentName = basename12(agentDir);
|
|
58046
|
-
const targetPath =
|
|
57898
|
+
const targetPath = join73(targetDir, agentName);
|
|
58047
57899
|
if (!existsSync70(targetDir)) {
|
|
58048
57900
|
mkdirSync15(targetDir, { recursive: true });
|
|
58049
57901
|
}
|
|
@@ -58081,8 +57933,8 @@ function installAllAgents(cwd) {
|
|
|
58081
57933
|
const entries = readdirSync26(agentsDir);
|
|
58082
57934
|
for (const entry of entries) {
|
|
58083
57935
|
if (entry.startsWith(".")) continue;
|
|
58084
|
-
const agentDir =
|
|
58085
|
-
const agentMdPath =
|
|
57936
|
+
const agentDir = join73(agentsDir, entry);
|
|
57937
|
+
const agentMdPath = join73(agentDir, "AGENT.md");
|
|
58086
57938
|
if (!existsSync70(agentMdPath)) continue;
|
|
58087
57939
|
const result = installAgent(agentDir);
|
|
58088
57940
|
results.push({
|
|
@@ -58095,7 +57947,7 @@ function installAllAgents(cwd) {
|
|
|
58095
57947
|
}
|
|
58096
57948
|
function uninstallAgent(agentName) {
|
|
58097
57949
|
const targetDir = getAgentInstallDir();
|
|
58098
|
-
const targetPath =
|
|
57950
|
+
const targetPath = join73(targetDir, agentName);
|
|
58099
57951
|
if (!existsSync70(targetPath)) {
|
|
58100
57952
|
return false;
|
|
58101
57953
|
}
|
|
@@ -58109,16 +57961,16 @@ function uninstallAgent(agentName) {
|
|
|
58109
57961
|
|
|
58110
57962
|
// packages/core/src/skills/agents/registry.ts
|
|
58111
57963
|
init_paths();
|
|
58112
|
-
import { existsSync as existsSync71, mkdirSync as mkdirSync16, readdirSync as readdirSync27, readFileSync as
|
|
58113
|
-
import { dirname as dirname15, join as
|
|
57964
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync16, readdirSync as readdirSync27, readFileSync as readFileSync49, writeFileSync as writeFileSync9 } from "node:fs";
|
|
57965
|
+
import { dirname as dirname15, join as join74 } from "node:path";
|
|
58114
57966
|
function getRegistryPath2() {
|
|
58115
|
-
return
|
|
57967
|
+
return join74(getCleoHome(), "agent-registry.json");
|
|
58116
57968
|
}
|
|
58117
57969
|
function readRegistry2() {
|
|
58118
57970
|
const registryPath = getRegistryPath2();
|
|
58119
57971
|
if (existsSync71(registryPath)) {
|
|
58120
57972
|
try {
|
|
58121
|
-
const content =
|
|
57973
|
+
const content = readFileSync49(registryPath, "utf-8");
|
|
58122
57974
|
return JSON.parse(content);
|
|
58123
57975
|
} catch {
|
|
58124
57976
|
}
|
|
@@ -58181,7 +58033,7 @@ function syncRegistry(cwd) {
|
|
|
58181
58033
|
const entries = readdirSync27(agentsDir);
|
|
58182
58034
|
for (const entry of entries) {
|
|
58183
58035
|
if (entry.startsWith(".")) continue;
|
|
58184
|
-
const agentDir =
|
|
58036
|
+
const agentDir = join74(agentsDir, entry);
|
|
58185
58037
|
try {
|
|
58186
58038
|
const config2 = parseAgentConfig(agentDir);
|
|
58187
58039
|
if (config2) {
|
|
@@ -58195,7 +58047,7 @@ function syncRegistry(cwd) {
|
|
|
58195
58047
|
if (existingNames.has(name2)) {
|
|
58196
58048
|
result.unchanged.push(name2);
|
|
58197
58049
|
} else {
|
|
58198
|
-
registerAgent2(name2,
|
|
58050
|
+
registerAgent2(name2, join74(agentsDir, name2), config2);
|
|
58199
58051
|
result.added.push(name2);
|
|
58200
58052
|
}
|
|
58201
58053
|
}
|
|
@@ -58214,8 +58066,8 @@ import { catalog } from "@cleocode/caamp";
|
|
|
58214
58066
|
|
|
58215
58067
|
// packages/core/src/skills/injection/token.ts
|
|
58216
58068
|
init_paths();
|
|
58217
|
-
import { existsSync as existsSync72, readFileSync as
|
|
58218
|
-
import { join as
|
|
58069
|
+
import { existsSync as existsSync72, readFileSync as readFileSync50 } from "node:fs";
|
|
58070
|
+
import { join as join75 } from "node:path";
|
|
58219
58071
|
var REQUIRED_TOKENS = ["TASK_ID", "DATE", "TOPIC_SLUG"];
|
|
58220
58072
|
var TOKEN_PATTERNS = {
|
|
58221
58073
|
TASK_ID: /^T\d+$/,
|
|
@@ -58251,10 +58103,10 @@ var CLEO_DEFAULTS = {
|
|
|
58251
58103
|
};
|
|
58252
58104
|
function loadPlaceholders(cwd) {
|
|
58253
58105
|
const projectRoot = getProjectRoot(cwd);
|
|
58254
|
-
const path2 =
|
|
58106
|
+
const path2 = join75(projectRoot, "skills", "_shared", "placeholders.json");
|
|
58255
58107
|
if (!existsSync72(path2)) return null;
|
|
58256
58108
|
try {
|
|
58257
|
-
return JSON.parse(
|
|
58109
|
+
return JSON.parse(readFileSync50(path2, "utf-8"));
|
|
58258
58110
|
} catch {
|
|
58259
58111
|
return null;
|
|
58260
58112
|
}
|
|
@@ -58343,7 +58195,7 @@ function loadAndInject(templatePath, values) {
|
|
|
58343
58195
|
if (!existsSync72(templatePath)) {
|
|
58344
58196
|
throw new Error(`Template not found: ${templatePath}`);
|
|
58345
58197
|
}
|
|
58346
|
-
const template =
|
|
58198
|
+
const template = readFileSync50(templatePath, "utf-8");
|
|
58347
58199
|
const content = injectTokens(template, values);
|
|
58348
58200
|
const unresolvedTokens = hasUnresolvedTokens(content);
|
|
58349
58201
|
return { content, unresolvedTokens };
|
|
@@ -58634,15 +58486,15 @@ ${promptParts.join("\n")}`;
|
|
|
58634
58486
|
init_src();
|
|
58635
58487
|
init_errors3();
|
|
58636
58488
|
init_paths();
|
|
58637
|
-
import { existsSync as existsSync73, readFileSync as
|
|
58638
|
-
import { join as
|
|
58489
|
+
import { existsSync as existsSync73, readFileSync as readFileSync51 } from "node:fs";
|
|
58490
|
+
import { join as join76 } from "node:path";
|
|
58639
58491
|
function getProtocolBasePath(cwd) {
|
|
58640
|
-
return
|
|
58492
|
+
return join76(getProjectRoot(cwd), "skills", "_shared", "subagent-protocol-base.md");
|
|
58641
58493
|
}
|
|
58642
58494
|
function loadProtocolBase(cwd) {
|
|
58643
58495
|
const path2 = getProtocolBasePath(cwd);
|
|
58644
58496
|
if (!existsSync73(path2)) return null;
|
|
58645
|
-
return
|
|
58497
|
+
return readFileSync51(path2, "utf-8");
|
|
58646
58498
|
}
|
|
58647
58499
|
async function buildTaskContext(taskId, cwd) {
|
|
58648
58500
|
const { getAccessor: getAccessor2 } = await Promise.resolve().then(() => (init_data_accessor(), data_accessor_exports));
|
|
@@ -58784,7 +58636,7 @@ async function installSkill(skillName, projectDir) {
|
|
|
58784
58636
|
// packages/core/src/skills/manifests/contribution.ts
|
|
58785
58637
|
init_data_accessor();
|
|
58786
58638
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
58787
|
-
import { existsSync as existsSync74, readFileSync as
|
|
58639
|
+
import { existsSync as existsSync74, readFileSync as readFileSync52 } from "node:fs";
|
|
58788
58640
|
function generateContributionId(taskId) {
|
|
58789
58641
|
const hash = randomBytes11(4).toString("hex");
|
|
58790
58642
|
const date6 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
@@ -58824,7 +58676,7 @@ function getContributionInjection(taskId, protocolPath, _cwd) {
|
|
|
58824
58676
|
if (protocolPath && existsSync74(protocolPath)) {
|
|
58825
58677
|
lines.push("### Protocol Details");
|
|
58826
58678
|
lines.push("");
|
|
58827
|
-
lines.push(
|
|
58679
|
+
lines.push(readFileSync52(protocolPath, "utf-8"));
|
|
58828
58680
|
}
|
|
58829
58681
|
lines.push("---");
|
|
58830
58682
|
return lines.join("\n");
|
|
@@ -58917,13 +58769,13 @@ function createContributionManifestEntry(taskId, contributionId, decisions) {
|
|
|
58917
58769
|
init_src();
|
|
58918
58770
|
init_errors3();
|
|
58919
58771
|
init_paths();
|
|
58920
|
-
import { appendFileSync as appendFileSync8, existsSync as existsSync75, mkdirSync as mkdirSync17, readFileSync as
|
|
58921
|
-
import { join as
|
|
58772
|
+
import { appendFileSync as appendFileSync8, existsSync as existsSync75, mkdirSync as mkdirSync17, readFileSync as readFileSync53, writeFileSync as writeFileSync10 } from "node:fs";
|
|
58773
|
+
import { join as join77 } from "node:path";
|
|
58922
58774
|
function ensureOutputs(cwd) {
|
|
58923
58775
|
const outputDir = getAgentOutputsDir(cwd);
|
|
58924
58776
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
58925
58777
|
const manifestPath = getManifestPath(cwd);
|
|
58926
|
-
const archiveDir =
|
|
58778
|
+
const archiveDir = join77(absOutputDir, "archive");
|
|
58927
58779
|
const created = [];
|
|
58928
58780
|
if (!existsSync75(absOutputDir)) {
|
|
58929
58781
|
mkdirSync17(absOutputDir, { recursive: true });
|
|
@@ -58942,7 +58794,7 @@ function ensureOutputs(cwd) {
|
|
|
58942
58794
|
function readManifest2(cwd) {
|
|
58943
58795
|
const manifestPath = getManifestPath(cwd);
|
|
58944
58796
|
if (!existsSync75(manifestPath)) return [];
|
|
58945
|
-
const content =
|
|
58797
|
+
const content = readFileSync53(manifestPath, "utf-8");
|
|
58946
58798
|
const entries = [];
|
|
58947
58799
|
for (const line2 of content.split("\n")) {
|
|
58948
58800
|
const trimmed = line2.trim();
|
|
@@ -59019,7 +58871,7 @@ function taskHasResearch(taskId, cwd) {
|
|
|
59019
58871
|
function archiveEntry(entryId, cwd) {
|
|
59020
58872
|
const manifestPath = getManifestPath(cwd);
|
|
59021
58873
|
if (!existsSync75(manifestPath)) return false;
|
|
59022
|
-
const content =
|
|
58874
|
+
const content = readFileSync53(manifestPath, "utf-8");
|
|
59023
58875
|
const lines = content.split("\n");
|
|
59024
58876
|
let found = false;
|
|
59025
58877
|
const newLines = [];
|
|
@@ -59052,13 +58904,13 @@ function rotateManifest(maxEntries = 100, cwd) {
|
|
|
59052
58904
|
if (entries.length <= maxEntries) return 0;
|
|
59053
58905
|
const manifestPath = getManifestPath(cwd);
|
|
59054
58906
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59055
|
-
const archiveDir =
|
|
58907
|
+
const archiveDir = join77(absOutputDir, "archive");
|
|
59056
58908
|
const toKeep = entries.slice(-maxEntries);
|
|
59057
58909
|
const toArchive = entries.slice(0, entries.length - maxEntries);
|
|
59058
58910
|
if (!existsSync75(archiveDir)) {
|
|
59059
58911
|
mkdirSync17(archiveDir, { recursive: true });
|
|
59060
58912
|
}
|
|
59061
|
-
const archivePath =
|
|
58913
|
+
const archivePath = join77(archiveDir, `MANIFEST-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.jsonl`);
|
|
59062
58914
|
const archiveContent = toArchive.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
59063
58915
|
appendFileSync8(archivePath, archiveContent, "utf-8");
|
|
59064
58916
|
const keepContent = toKeep.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
@@ -59120,20 +58972,20 @@ function validateEntry(entry) {
|
|
|
59120
58972
|
|
|
59121
58973
|
// packages/core/src/skills/manifests/resolver.ts
|
|
59122
58974
|
init_paths();
|
|
59123
|
-
import { existsSync as existsSync76, mkdirSync as mkdirSync18, readFileSync as
|
|
59124
|
-
import { join as
|
|
58975
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync18, readFileSync as readFileSync54, writeFileSync as writeFileSync11 } from "node:fs";
|
|
58976
|
+
import { join as join78 } from "node:path";
|
|
59125
58977
|
var DEFAULT_CACHE_TTL = 300;
|
|
59126
58978
|
function getCacheDir() {
|
|
59127
|
-
return process.env["CLEO_MANIFEST_CACHE_DIR"] ??
|
|
58979
|
+
return process.env["CLEO_MANIFEST_CACHE_DIR"] ?? join78(getCleoHome(), "cache");
|
|
59128
58980
|
}
|
|
59129
58981
|
function getCachedManifestPath() {
|
|
59130
|
-
return
|
|
58982
|
+
return join78(getCacheDir(), "skills-manifest.json");
|
|
59131
58983
|
}
|
|
59132
58984
|
function isCacheFresh(cachePath) {
|
|
59133
58985
|
const path2 = cachePath ?? getCachedManifestPath();
|
|
59134
58986
|
if (!existsSync76(path2)) return false;
|
|
59135
58987
|
try {
|
|
59136
|
-
const content =
|
|
58988
|
+
const content = readFileSync54(path2, "utf-8");
|
|
59137
58989
|
const manifest = JSON.parse(content);
|
|
59138
58990
|
const ttl = manifest._meta?.ttlSeconds ?? DEFAULT_CACHE_TTL;
|
|
59139
58991
|
const generatedAt = new Date(manifest._meta?.generatedAt ?? 0).getTime();
|
|
@@ -59156,13 +59008,13 @@ function resolveManifest(cwd) {
|
|
|
59156
59008
|
const cachePath = getCachedManifestPath();
|
|
59157
59009
|
if (isCacheFresh(cachePath)) {
|
|
59158
59010
|
try {
|
|
59159
|
-
return JSON.parse(
|
|
59011
|
+
return JSON.parse(readFileSync54(cachePath, "utf-8"));
|
|
59160
59012
|
} catch {
|
|
59161
59013
|
}
|
|
59162
59014
|
}
|
|
59163
59015
|
if (existsSync76(cachePath)) {
|
|
59164
59016
|
try {
|
|
59165
|
-
const content =
|
|
59017
|
+
const content = readFileSync54(cachePath, "utf-8");
|
|
59166
59018
|
if (content.trim()) {
|
|
59167
59019
|
const staleManifest = JSON.parse(content);
|
|
59168
59020
|
if (staleManifest.skills?.length > 0) {
|
|
@@ -59200,15 +59052,15 @@ function regenerateCache(cwd) {
|
|
|
59200
59052
|
|
|
59201
59053
|
// packages/core/src/skills/marketplace.ts
|
|
59202
59054
|
init_paths();
|
|
59203
|
-
import { existsSync as existsSync77, readFileSync as
|
|
59204
|
-
import { join as
|
|
59055
|
+
import { existsSync as existsSync77, readFileSync as readFileSync55 } from "node:fs";
|
|
59056
|
+
import { join as join79 } from "node:path";
|
|
59205
59057
|
import { searchSkills as caampSearchSkills, MarketplaceClient } from "@cleocode/caamp";
|
|
59206
59058
|
function loadConfig2(cwd) {
|
|
59207
59059
|
const projectRoot = getProjectRoot(cwd);
|
|
59208
|
-
const configFile =
|
|
59060
|
+
const configFile = join79(projectRoot, ".cleo", "skillsmp.json");
|
|
59209
59061
|
if (!existsSync77(configFile)) return null;
|
|
59210
59062
|
try {
|
|
59211
|
-
const data = JSON.parse(
|
|
59063
|
+
const data = JSON.parse(readFileSync55(configFile, "utf-8"));
|
|
59212
59064
|
if (data.enabled !== true) return null;
|
|
59213
59065
|
return {
|
|
59214
59066
|
enabled: true,
|
|
@@ -59384,8 +59236,8 @@ async function spawnBatch(taskIds, templateName, cwd, tier) {
|
|
|
59384
59236
|
// packages/core/src/skills/orchestrator/startup.ts
|
|
59385
59237
|
init_paths();
|
|
59386
59238
|
init_data_accessor();
|
|
59387
|
-
import { existsSync as existsSync78, readFileSync as
|
|
59388
|
-
import { join as
|
|
59239
|
+
import { existsSync as existsSync78, readFileSync as readFileSync56 } from "node:fs";
|
|
59240
|
+
import { join as join80 } from "node:path";
|
|
59389
59241
|
var DEFAULT_THRESHOLDS = { warning: 70, critical: 80 };
|
|
59390
59242
|
function getThresholds(config2) {
|
|
59391
59243
|
const orc = config2?.orchestrator?.contextThresholds;
|
|
@@ -59407,19 +59259,19 @@ function getContextState(sessionId, cwd) {
|
|
|
59407
59259
|
};
|
|
59408
59260
|
let stateFile = "";
|
|
59409
59261
|
if (sessionId) {
|
|
59410
|
-
stateFile =
|
|
59262
|
+
stateFile = join80(cleoDirAbs, "sessions", sessionId, ".context-state.json");
|
|
59411
59263
|
if (!existsSync78(stateFile)) {
|
|
59412
|
-
stateFile =
|
|
59264
|
+
stateFile = join80(cleoDirAbs, `.context-state-${sessionId}.json`);
|
|
59413
59265
|
}
|
|
59414
59266
|
}
|
|
59415
59267
|
if (!stateFile || !existsSync78(stateFile)) {
|
|
59416
|
-
stateFile =
|
|
59268
|
+
stateFile = join80(cleoDirAbs, ".context-state.json");
|
|
59417
59269
|
}
|
|
59418
59270
|
if (!existsSync78(stateFile)) {
|
|
59419
59271
|
return defaultState;
|
|
59420
59272
|
}
|
|
59421
59273
|
try {
|
|
59422
|
-
const data = JSON.parse(
|
|
59274
|
+
const data = JSON.parse(readFileSync56(stateFile, "utf-8"));
|
|
59423
59275
|
const cw = data.contextWindow ?? data;
|
|
59424
59276
|
const timestamp2 = data.timestamp;
|
|
59425
59277
|
const staleAfterMs = data.staleAfterMs ?? 5e3;
|
|
@@ -59727,8 +59579,8 @@ function priorityRank(priority) {
|
|
|
59727
59579
|
init_src();
|
|
59728
59580
|
init_paths();
|
|
59729
59581
|
init_data_accessor();
|
|
59730
|
-
import { existsSync as existsSync79, readFileSync as
|
|
59731
|
-
import { join as
|
|
59582
|
+
import { existsSync as existsSync79, readFileSync as readFileSync57 } from "node:fs";
|
|
59583
|
+
import { join as join81 } from "node:path";
|
|
59732
59584
|
var KEY_FINDINGS_MIN = 3;
|
|
59733
59585
|
var KEY_FINDINGS_MAX = 7;
|
|
59734
59586
|
var MANIFEST_REQUIRED_FIELDS = [
|
|
@@ -59748,7 +59600,7 @@ function getManifestPath3(cwd) {
|
|
|
59748
59600
|
function readManifestEntries(cwd) {
|
|
59749
59601
|
const manifestPath = getManifestPath3(cwd);
|
|
59750
59602
|
if (!existsSync79(manifestPath)) return [];
|
|
59751
|
-
const content =
|
|
59603
|
+
const content = readFileSync57(manifestPath, "utf-8");
|
|
59752
59604
|
const entries = [];
|
|
59753
59605
|
for (const line2 of content.split("\n")) {
|
|
59754
59606
|
const trimmed = line2.trim();
|
|
@@ -59809,7 +59661,7 @@ function validateSubagentOutput(researchId, cwd) {
|
|
|
59809
59661
|
}
|
|
59810
59662
|
if (entry.file) {
|
|
59811
59663
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59812
|
-
const filePath =
|
|
59664
|
+
const filePath = join81(absOutputDir, entry.file);
|
|
59813
59665
|
if (!existsSync79(filePath)) {
|
|
59814
59666
|
issues.push(`FILE_NOT_FOUND: Expected file at ${filePath}`);
|
|
59815
59667
|
}
|
|
@@ -59821,7 +59673,7 @@ function validateManifestIntegrity(cwd) {
|
|
|
59821
59673
|
if (!existsSync79(manifestPath)) {
|
|
59822
59674
|
return { exists: false, passed: true, issues: [] };
|
|
59823
59675
|
}
|
|
59824
|
-
const content =
|
|
59676
|
+
const content = readFileSync57(manifestPath, "utf-8");
|
|
59825
59677
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
59826
59678
|
const issues = [];
|
|
59827
59679
|
let validEntries = 0;
|
|
@@ -59852,7 +59704,7 @@ function validateManifestIntegrity(cwd) {
|
|
|
59852
59704
|
seenIds.add(entry.id);
|
|
59853
59705
|
if (entry.file) {
|
|
59854
59706
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59855
|
-
const filePath =
|
|
59707
|
+
const filePath = join81(absOutputDir, entry.file);
|
|
59856
59708
|
if (!existsSync79(filePath)) {
|
|
59857
59709
|
issues.push(`LINE_${lineNum}_FILE_MISSING: ${entry.file} does not exist`);
|
|
59858
59710
|
}
|
|
@@ -59926,7 +59778,7 @@ async function validateOrchestratorCompliance(epicId, cwd) {
|
|
|
59926
59778
|
if (!existsSync79(manifestPath)) {
|
|
59927
59779
|
warnings.push(`ORC-005_NO_MANIFEST: Manifest file not found at ${manifestPath}`);
|
|
59928
59780
|
} else {
|
|
59929
|
-
const content =
|
|
59781
|
+
const content = readFileSync57(manifestPath, "utf-8").trim();
|
|
59930
59782
|
if (!content) {
|
|
59931
59783
|
warnings.push("ORC-005_EMPTY_MANIFEST: Manifest exists but has no entries");
|
|
59932
59784
|
}
|
|
@@ -59962,22 +59814,22 @@ async function validateOrchestratorCompliance(epicId, cwd) {
|
|
|
59962
59814
|
}
|
|
59963
59815
|
|
|
59964
59816
|
// packages/core/src/skills/skill-paths.ts
|
|
59965
|
-
import { existsSync as existsSync80, lstatSync, readlinkSync as readlinkSync2, realpathSync
|
|
59966
|
-
import { delimiter, join as
|
|
59817
|
+
import { existsSync as existsSync80, lstatSync, readlinkSync as readlinkSync2, realpathSync } from "node:fs";
|
|
59818
|
+
import { delimiter, join as join82, resolve as resolve9 } from "node:path";
|
|
59967
59819
|
import { getCanonicalSkillsDir as getCanonicalSkillsDir2 } from "@cleocode/caamp";
|
|
59968
59820
|
function getCaampCanonical() {
|
|
59969
59821
|
return getCanonicalSkillsDir2();
|
|
59970
59822
|
}
|
|
59971
59823
|
function getProjectEmbedded(projectRoot) {
|
|
59972
59824
|
const root = projectRoot ?? process.cwd();
|
|
59973
|
-
return
|
|
59825
|
+
return join82(root, "skills");
|
|
59974
59826
|
}
|
|
59975
59827
|
function getProjectRoot3(cwd) {
|
|
59976
59828
|
return cwd ?? process.cwd();
|
|
59977
59829
|
}
|
|
59978
59830
|
function safeRealpath(path2) {
|
|
59979
59831
|
try {
|
|
59980
|
-
return
|
|
59832
|
+
return realpathSync(path2);
|
|
59981
59833
|
} catch {
|
|
59982
59834
|
return path2;
|
|
59983
59835
|
}
|
|
@@ -60020,8 +59872,8 @@ function getSkillSearchPaths2(projectRoot) {
|
|
|
60020
59872
|
function resolveSkillPath(skillName, projectRoot) {
|
|
60021
59873
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60022
59874
|
for (const { path: searchPath } of searchPaths) {
|
|
60023
|
-
const candidate =
|
|
60024
|
-
if (existsSync80(
|
|
59875
|
+
const candidate = join82(searchPath, skillName);
|
|
59876
|
+
if (existsSync80(join82(candidate, "SKILL.md"))) {
|
|
60025
59877
|
return safeRealpath(candidate);
|
|
60026
59878
|
}
|
|
60027
59879
|
}
|
|
@@ -60030,13 +59882,13 @@ function resolveSkillPath(skillName, projectRoot) {
|
|
|
60030
59882
|
function resolveProtocolPath(protocolName, projectRoot) {
|
|
60031
59883
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60032
59884
|
for (const { path: searchPath } of searchPaths) {
|
|
60033
|
-
const candidate =
|
|
59885
|
+
const candidate = join82(searchPath, "_ct-skills-protocols", `${protocolName}.md`);
|
|
60034
59886
|
if (existsSync80(candidate)) {
|
|
60035
59887
|
return safeRealpath(candidate);
|
|
60036
59888
|
}
|
|
60037
59889
|
}
|
|
60038
59890
|
const root = getProjectRoot3(projectRoot);
|
|
60039
|
-
const legacy =
|
|
59891
|
+
const legacy = join82(root, "src", "protocols", `${protocolName}.md`);
|
|
60040
59892
|
if (existsSync80(legacy)) {
|
|
60041
59893
|
return safeRealpath(legacy);
|
|
60042
59894
|
}
|
|
@@ -60045,11 +59897,11 @@ function resolveProtocolPath(protocolName, projectRoot) {
|
|
|
60045
59897
|
function resolveSharedPath(resourceName, projectRoot) {
|
|
60046
59898
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60047
59899
|
for (const { path: searchPath } of searchPaths) {
|
|
60048
|
-
const candidate =
|
|
59900
|
+
const candidate = join82(searchPath, "_ct-skills-shared", `${resourceName}.md`);
|
|
60049
59901
|
if (existsSync80(candidate)) {
|
|
60050
59902
|
return safeRealpath(candidate);
|
|
60051
59903
|
}
|
|
60052
|
-
const legacy =
|
|
59904
|
+
const legacy = join82(searchPath, "_shared", `${resourceName}.md`);
|
|
60053
59905
|
if (existsSync80(legacy)) {
|
|
60054
59906
|
return safeRealpath(legacy);
|
|
60055
59907
|
}
|
|
@@ -60075,7 +59927,7 @@ function getSkillSourceType(skillDir, projectRoot) {
|
|
|
60075
59927
|
}
|
|
60076
59928
|
} catch {
|
|
60077
59929
|
}
|
|
60078
|
-
if (normalizedDir.startsWith(resolve9(embeddedDir)) || normalizedDir.startsWith(
|
|
59930
|
+
if (normalizedDir.startsWith(resolve9(embeddedDir)) || normalizedDir.startsWith(join82(root, "skills"))) {
|
|
60079
59931
|
return "embedded";
|
|
60080
59932
|
}
|
|
60081
59933
|
if (normalizedDir.startsWith(caampDir)) {
|
|
@@ -60106,8 +59958,8 @@ function formatDateYMD(date6) {
|
|
|
60106
59958
|
}
|
|
60107
59959
|
|
|
60108
59960
|
// packages/core/src/skills/validation.ts
|
|
60109
|
-
import { existsSync as existsSync81, readFileSync as
|
|
60110
|
-
import { basename as basename13, join as
|
|
59961
|
+
import { existsSync as existsSync81, readFileSync as readFileSync58 } from "node:fs";
|
|
59962
|
+
import { basename as basename13, join as join83 } from "node:path";
|
|
60111
59963
|
var VALID_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
60112
59964
|
"research",
|
|
60113
59965
|
"consensus",
|
|
@@ -60130,7 +59982,7 @@ function validateSkill(skillDir) {
|
|
|
60130
59982
|
});
|
|
60131
59983
|
return buildResult(dirName, skillDir, issues);
|
|
60132
59984
|
}
|
|
60133
|
-
const skillMdPath =
|
|
59985
|
+
const skillMdPath = join83(skillDir, "SKILL.md");
|
|
60134
59986
|
if (!existsSync81(skillMdPath)) {
|
|
60135
59987
|
issues.push({
|
|
60136
59988
|
severity: "error",
|
|
@@ -60140,7 +59992,7 @@ function validateSkill(skillDir) {
|
|
|
60140
59992
|
});
|
|
60141
59993
|
return buildResult(dirName, skillDir, issues);
|
|
60142
59994
|
}
|
|
60143
|
-
const content =
|
|
59995
|
+
const content = readFileSync58(skillMdPath, "utf-8");
|
|
60144
59996
|
const fm = parseFrontmatter3(content);
|
|
60145
59997
|
validateFrontmatter(fm, issues, skillMdPath);
|
|
60146
59998
|
if (!dirName.startsWith("ct-") && !dirName.startsWith("_")) {
|
|
@@ -60152,7 +60004,7 @@ function validateSkill(skillDir) {
|
|
|
60152
60004
|
}
|
|
60153
60005
|
const optionalFiles = ["README.md", "references"];
|
|
60154
60006
|
for (const file2 of optionalFiles) {
|
|
60155
|
-
const filePath =
|
|
60007
|
+
const filePath = join83(skillDir, file2);
|
|
60156
60008
|
if (!existsSync81(filePath)) {
|
|
60157
60009
|
issues.push({
|
|
60158
60010
|
severity: "info",
|
|
@@ -60302,7 +60154,7 @@ init_data_accessor();
|
|
|
60302
60154
|
import { createHash as createHash8 } from "node:crypto";
|
|
60303
60155
|
import { existsSync as existsSync82 } from "node:fs";
|
|
60304
60156
|
import { mkdir as mkdir13, readFile as readFile13, writeFile as writeFile10 } from "node:fs/promises";
|
|
60305
|
-
import { dirname as dirname16, join as
|
|
60157
|
+
import { dirname as dirname16, join as join84 } from "node:path";
|
|
60306
60158
|
var SNAPSHOT_FORMAT_VERSION = "1.0.0";
|
|
60307
60159
|
function toSnapshotTask(task) {
|
|
60308
60160
|
return {
|
|
@@ -60378,7 +60230,7 @@ async function readSnapshot(inputPath) {
|
|
|
60378
60230
|
function getDefaultSnapshotPath(cwd) {
|
|
60379
60231
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
60380
60232
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
60381
|
-
return
|
|
60233
|
+
return join84(cleoDir, "snapshots", `snapshot-${timestamp2}.json`);
|
|
60382
60234
|
}
|
|
60383
60235
|
async function importSnapshot(snapshot, cwd) {
|
|
60384
60236
|
const accessor = await getAccessor(cwd);
|
|
@@ -60606,8 +60458,8 @@ async function initializeSpawnAdapters(manifests) {
|
|
|
60606
60458
|
if (!manifest.capabilities?.supportsSpawn) continue;
|
|
60607
60459
|
if (spawnRegistry.hasAdapterForProvider(manifest.provider)) continue;
|
|
60608
60460
|
try {
|
|
60609
|
-
const { join:
|
|
60610
|
-
const modulePath =
|
|
60461
|
+
const { join: join107 } = await import("node:path");
|
|
60462
|
+
const modulePath = join107(manifest.packagePath, manifest.entryPoint);
|
|
60611
60463
|
const adapterModule = await import(modulePath);
|
|
60612
60464
|
let SpawnProviderClass;
|
|
60613
60465
|
for (const [exportName, exportValue] of Object.entries(adapterModule)) {
|
|
@@ -61844,14 +61696,14 @@ async function getArchiveStats(opts, accessor) {
|
|
|
61844
61696
|
|
|
61845
61697
|
// packages/core/src/system/audit.ts
|
|
61846
61698
|
init_data_accessor();
|
|
61847
|
-
import { existsSync as existsSync83, readFileSync as
|
|
61848
|
-
import { join as
|
|
61699
|
+
import { existsSync as existsSync83, readFileSync as readFileSync59 } from "node:fs";
|
|
61700
|
+
import { join as join85 } from "node:path";
|
|
61849
61701
|
async function auditData(projectRoot, opts) {
|
|
61850
|
-
const cleoDir =
|
|
61702
|
+
const cleoDir = join85(projectRoot, ".cleo");
|
|
61851
61703
|
const scope = opts?.scope ?? "all";
|
|
61852
61704
|
const issues = [];
|
|
61853
61705
|
if (scope === "all" || scope === "tasks") {
|
|
61854
|
-
const tasksDbPath =
|
|
61706
|
+
const tasksDbPath = join85(cleoDir, "tasks.db");
|
|
61855
61707
|
if (existsSync83(tasksDbPath)) {
|
|
61856
61708
|
try {
|
|
61857
61709
|
const accessor = await getAccessor(projectRoot);
|
|
@@ -61914,10 +61766,10 @@ async function auditData(projectRoot, opts) {
|
|
|
61914
61766
|
}
|
|
61915
61767
|
}
|
|
61916
61768
|
if (scope === "all" || scope === "sessions") {
|
|
61917
|
-
const sessPath =
|
|
61769
|
+
const sessPath = join85(cleoDir, "sessions.json");
|
|
61918
61770
|
if (existsSync83(sessPath)) {
|
|
61919
61771
|
try {
|
|
61920
|
-
const data = JSON.parse(
|
|
61772
|
+
const data = JSON.parse(readFileSync59(sessPath, "utf-8"));
|
|
61921
61773
|
const sessions2 = data.sessions ?? [];
|
|
61922
61774
|
const sessionIds = /* @__PURE__ */ new Set();
|
|
61923
61775
|
for (const s of sessions2) {
|
|
@@ -61949,10 +61801,10 @@ async function auditData(projectRoot, opts) {
|
|
|
61949
61801
|
}
|
|
61950
61802
|
}
|
|
61951
61803
|
if (scope === "all") {
|
|
61952
|
-
const seqPath =
|
|
61804
|
+
const seqPath = join85(cleoDir, ".sequence.json");
|
|
61953
61805
|
if (existsSync83(seqPath)) {
|
|
61954
61806
|
try {
|
|
61955
|
-
const seq = JSON.parse(
|
|
61807
|
+
const seq = JSON.parse(readFileSync59(seqPath, "utf-8"));
|
|
61956
61808
|
if (typeof seq.counter !== "number") {
|
|
61957
61809
|
issues.push({
|
|
61958
61810
|
severity: "error",
|
|
@@ -61983,32 +61835,32 @@ async function auditData(projectRoot, opts) {
|
|
|
61983
61835
|
// packages/core/src/system/backup.ts
|
|
61984
61836
|
init_src();
|
|
61985
61837
|
init_errors3();
|
|
61986
|
-
import { existsSync as existsSync84, mkdirSync as mkdirSync19, readdirSync as readdirSync28, readFileSync as
|
|
61987
|
-
import { join as
|
|
61838
|
+
import { existsSync as existsSync84, mkdirSync as mkdirSync19, readdirSync as readdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync12 } from "node:fs";
|
|
61839
|
+
import { join as join86 } from "node:path";
|
|
61988
61840
|
function createBackup2(projectRoot, opts) {
|
|
61989
|
-
const cleoDir =
|
|
61841
|
+
const cleoDir = join86(projectRoot, ".cleo");
|
|
61990
61842
|
const btype = opts?.type || "snapshot";
|
|
61991
61843
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
61992
61844
|
const backupId = `${btype}-${timestamp2.replace(/[:.]/g, "-")}`;
|
|
61993
|
-
const backupDir =
|
|
61845
|
+
const backupDir = join86(cleoDir, "backups", btype);
|
|
61994
61846
|
if (!existsSync84(backupDir)) {
|
|
61995
61847
|
mkdirSync19(backupDir, { recursive: true });
|
|
61996
61848
|
}
|
|
61997
61849
|
const filesToBackup = ["tasks.db", "brain.db", "config.json", "project-info.json"];
|
|
61998
61850
|
const backedUp = [];
|
|
61999
61851
|
for (const file2 of filesToBackup) {
|
|
62000
|
-
const src =
|
|
61852
|
+
const src = join86(cleoDir, file2);
|
|
62001
61853
|
if (existsSync84(src)) {
|
|
62002
|
-
const dest =
|
|
61854
|
+
const dest = join86(backupDir, `${file2}.${backupId}`);
|
|
62003
61855
|
try {
|
|
62004
|
-
const content =
|
|
61856
|
+
const content = readFileSync60(src);
|
|
62005
61857
|
writeFileSync12(dest, content);
|
|
62006
61858
|
backedUp.push(file2);
|
|
62007
61859
|
} catch {
|
|
62008
61860
|
}
|
|
62009
61861
|
}
|
|
62010
61862
|
}
|
|
62011
|
-
const metaPath =
|
|
61863
|
+
const metaPath = join86(backupDir, `${backupId}.meta.json`);
|
|
62012
61864
|
try {
|
|
62013
61865
|
writeFileSync12(
|
|
62014
61866
|
metaPath,
|
|
@@ -62033,15 +61885,15 @@ function restoreBackup(projectRoot, params) {
|
|
|
62033
61885
|
if (!params.backupId) {
|
|
62034
61886
|
throw new CleoError(2 /* INVALID_INPUT */, "backupId is required");
|
|
62035
61887
|
}
|
|
62036
|
-
const cleoDir =
|
|
61888
|
+
const cleoDir = join86(projectRoot, ".cleo");
|
|
62037
61889
|
const backupTypes = ["snapshot", "safety", "migration"];
|
|
62038
61890
|
let metaPath = null;
|
|
62039
61891
|
let backupDir = null;
|
|
62040
61892
|
for (const btype of backupTypes) {
|
|
62041
|
-
const candidateMeta =
|
|
61893
|
+
const candidateMeta = join86(cleoDir, "backups", btype, `${params.backupId}.meta.json`);
|
|
62042
61894
|
if (existsSync84(candidateMeta)) {
|
|
62043
61895
|
metaPath = candidateMeta;
|
|
62044
|
-
backupDir =
|
|
61896
|
+
backupDir = join86(cleoDir, "backups", btype);
|
|
62045
61897
|
break;
|
|
62046
61898
|
}
|
|
62047
61899
|
}
|
|
@@ -62050,17 +61902,17 @@ function restoreBackup(projectRoot, params) {
|
|
|
62050
61902
|
}
|
|
62051
61903
|
let meta;
|
|
62052
61904
|
try {
|
|
62053
|
-
meta = JSON.parse(
|
|
61905
|
+
meta = JSON.parse(readFileSync60(metaPath, "utf-8"));
|
|
62054
61906
|
} catch {
|
|
62055
61907
|
throw new CleoError(3 /* FILE_ERROR */, "Failed to read backup metadata");
|
|
62056
61908
|
}
|
|
62057
61909
|
const restored = [];
|
|
62058
61910
|
for (const file2 of meta.files ?? []) {
|
|
62059
|
-
const backupFile =
|
|
61911
|
+
const backupFile = join86(backupDir, `${file2}.${params.backupId}`);
|
|
62060
61912
|
if (existsSync84(backupFile)) {
|
|
62061
61913
|
try {
|
|
62062
|
-
const content =
|
|
62063
|
-
writeFileSync12(
|
|
61914
|
+
const content = readFileSync60(backupFile);
|
|
61915
|
+
writeFileSync12(join86(cleoDir, file2), content);
|
|
62064
61916
|
restored.push(file2);
|
|
62065
61917
|
} catch {
|
|
62066
61918
|
}
|
|
@@ -62076,13 +61928,13 @@ function restoreBackup(projectRoot, params) {
|
|
|
62076
61928
|
|
|
62077
61929
|
// packages/core/src/system/cleanup.ts
|
|
62078
61930
|
init_src();
|
|
62079
|
-
import { existsSync as existsSync85, readdirSync as readdirSync29, readFileSync as
|
|
62080
|
-
import { join as
|
|
61931
|
+
import { existsSync as existsSync85, readdirSync as readdirSync29, readFileSync as readFileSync61, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
|
|
61932
|
+
import { join as join88 } from "node:path";
|
|
62081
61933
|
|
|
62082
61934
|
// packages/core/src/audit-prune.ts
|
|
62083
61935
|
init_logger();
|
|
62084
61936
|
import { createWriteStream, mkdirSync as mkdirSync20 } from "node:fs";
|
|
62085
|
-
import { join as
|
|
61937
|
+
import { join as join87 } from "node:path";
|
|
62086
61938
|
import { Readable } from "node:stream";
|
|
62087
61939
|
import { pipeline } from "node:stream/promises";
|
|
62088
61940
|
import { createGzip } from "node:zlib";
|
|
@@ -62094,7 +61946,7 @@ async function pruneAuditLog(cleoDir, config2) {
|
|
|
62094
61946
|
return { rowsArchived: 0, rowsDeleted: 0 };
|
|
62095
61947
|
}
|
|
62096
61948
|
const cutoff = new Date(Date.now() - config2.auditRetentionDays * 864e5).toISOString();
|
|
62097
|
-
const projectRoot =
|
|
61949
|
+
const projectRoot = join87(cleoDir, "..");
|
|
62098
61950
|
const { getDb: getDb3 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62099
61951
|
const { auditLog: auditLog2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
62100
61952
|
const { lt: lt3 } = await import("drizzle-orm");
|
|
@@ -62108,10 +61960,10 @@ async function pruneAuditLog(cleoDir, config2) {
|
|
|
62108
61960
|
let rowsArchived = 0;
|
|
62109
61961
|
if (config2.archiveBeforePrune) {
|
|
62110
61962
|
try {
|
|
62111
|
-
const archiveDir =
|
|
61963
|
+
const archiveDir = join87(cleoDir, "backups", "logs");
|
|
62112
61964
|
mkdirSync20(archiveDir, { recursive: true });
|
|
62113
61965
|
const dateStamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
62114
|
-
archivePath =
|
|
61966
|
+
archivePath = join87(archiveDir, `audit-${dateStamp}.jsonl.gz`);
|
|
62115
61967
|
const lines = oldRows.map((row) => JSON.stringify(row));
|
|
62116
61968
|
const jsonlContent = lines.join("\n") + "\n";
|
|
62117
61969
|
const gzip = createGzip();
|
|
@@ -62154,7 +62006,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62154
62006
|
"target is required (sessions|backups|logs|archive)"
|
|
62155
62007
|
);
|
|
62156
62008
|
}
|
|
62157
|
-
const cleoDir =
|
|
62009
|
+
const cleoDir = join88(projectRoot, ".cleo");
|
|
62158
62010
|
const dryRun = params.dryRun ?? false;
|
|
62159
62011
|
const items = [];
|
|
62160
62012
|
let prunedRows;
|
|
@@ -62162,10 +62014,10 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62162
62014
|
let archivePath;
|
|
62163
62015
|
switch (params.target) {
|
|
62164
62016
|
case "sessions": {
|
|
62165
|
-
const sessPath =
|
|
62017
|
+
const sessPath = join88(cleoDir, "sessions.json");
|
|
62166
62018
|
if (existsSync85(sessPath)) {
|
|
62167
62019
|
try {
|
|
62168
|
-
const data = JSON.parse(
|
|
62020
|
+
const data = JSON.parse(readFileSync61(sessPath, "utf-8"));
|
|
62169
62021
|
const sessions2 = data.sessions ?? [];
|
|
62170
62022
|
const stale = sessions2.filter(
|
|
62171
62023
|
(s) => {
|
|
@@ -62191,16 +62043,16 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62191
62043
|
break;
|
|
62192
62044
|
}
|
|
62193
62045
|
case "backups": {
|
|
62194
|
-
const backupBaseDir =
|
|
62046
|
+
const backupBaseDir = join88(cleoDir, "backups");
|
|
62195
62047
|
if (existsSync85(backupBaseDir)) {
|
|
62196
62048
|
for (const typeDir of readdirSync29(backupBaseDir)) {
|
|
62197
|
-
const fullDir =
|
|
62049
|
+
const fullDir = join88(backupBaseDir, typeDir);
|
|
62198
62050
|
try {
|
|
62199
62051
|
for (const file2 of readdirSync29(fullDir)) {
|
|
62200
62052
|
if (file2.endsWith(".meta.json")) {
|
|
62201
|
-
const metaFilePath =
|
|
62053
|
+
const metaFilePath = join88(fullDir, file2);
|
|
62202
62054
|
try {
|
|
62203
|
-
const meta = JSON.parse(
|
|
62055
|
+
const meta = JSON.parse(readFileSync61(metaFilePath, "utf-8"));
|
|
62204
62056
|
if (params.olderThan && meta.timestamp < params.olderThan) {
|
|
62205
62057
|
items.push(file2.replace(".meta.json", ""));
|
|
62206
62058
|
if (!dryRun) {
|
|
@@ -62208,7 +62060,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62208
62060
|
for (const bf of readdirSync29(fullDir)) {
|
|
62209
62061
|
if (bf.includes(meta.backupId)) {
|
|
62210
62062
|
try {
|
|
62211
|
-
unlinkSync5(
|
|
62063
|
+
unlinkSync5(join88(fullDir, bf));
|
|
62212
62064
|
} catch {
|
|
62213
62065
|
}
|
|
62214
62066
|
}
|
|
@@ -62240,7 +62092,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62240
62092
|
items.push(file2);
|
|
62241
62093
|
if (!dryRun) {
|
|
62242
62094
|
try {
|
|
62243
|
-
unlinkSync5(
|
|
62095
|
+
unlinkSync5(join88(cleoDir, file2));
|
|
62244
62096
|
} catch {
|
|
62245
62097
|
}
|
|
62246
62098
|
}
|
|
@@ -62268,9 +62120,9 @@ init_hooks();
|
|
|
62268
62120
|
init_injection();
|
|
62269
62121
|
init_paths();
|
|
62270
62122
|
import { execFile as execFile6, execFileSync as execFileSync11 } from "node:child_process";
|
|
62271
|
-
import { existsSync as existsSync89, readFileSync as
|
|
62123
|
+
import { existsSync as existsSync89, readFileSync as readFileSync64, statSync as statSync19 } from "node:fs";
|
|
62272
62124
|
import { createRequire as createRequire6 } from "node:module";
|
|
62273
|
-
import { join as
|
|
62125
|
+
import { join as join92 } from "node:path";
|
|
62274
62126
|
import { promisify as promisify6 } from "node:util";
|
|
62275
62127
|
|
|
62276
62128
|
// packages/core/src/platform.ts
|
|
@@ -62292,30 +62144,30 @@ import {
|
|
|
62292
62144
|
existsSync as existsSync87,
|
|
62293
62145
|
mkdirSync as mkdirSync21,
|
|
62294
62146
|
readdirSync as readdirSync30,
|
|
62295
|
-
readFileSync as
|
|
62147
|
+
readFileSync as readFileSync62,
|
|
62296
62148
|
renameSync as renameSync6,
|
|
62297
62149
|
unlinkSync as unlinkSync6,
|
|
62298
62150
|
writeFileSync as writeFileSync14
|
|
62299
62151
|
} from "node:fs";
|
|
62300
|
-
import { basename as basename14, dirname as dirname17, join as
|
|
62152
|
+
import { basename as basename14, dirname as dirname17, join as join90 } from "node:path";
|
|
62301
62153
|
import * as lockfile2 from "proper-lockfile";
|
|
62302
62154
|
var MAX_BACKUPS = 10;
|
|
62303
62155
|
function rotateBackup(filePath) {
|
|
62304
62156
|
const dir = dirname17(filePath);
|
|
62305
62157
|
const name2 = basename14(filePath);
|
|
62306
|
-
const backupDir =
|
|
62158
|
+
const backupDir = join90(dir, ".backups");
|
|
62307
62159
|
if (!existsSync87(backupDir)) {
|
|
62308
62160
|
mkdirSync21(backupDir, { recursive: true });
|
|
62309
62161
|
}
|
|
62310
62162
|
for (let i = MAX_BACKUPS; i >= 1; i--) {
|
|
62311
|
-
const current =
|
|
62163
|
+
const current = join90(backupDir, `${name2}.${i}`);
|
|
62312
62164
|
if (i === MAX_BACKUPS) {
|
|
62313
62165
|
try {
|
|
62314
62166
|
unlinkSync6(current);
|
|
62315
62167
|
} catch {
|
|
62316
62168
|
}
|
|
62317
62169
|
} else {
|
|
62318
|
-
const next =
|
|
62170
|
+
const next = join90(backupDir, `${name2}.${i + 1}`);
|
|
62319
62171
|
try {
|
|
62320
62172
|
if (existsSync87(current)) renameSync6(current, next);
|
|
62321
62173
|
} catch {
|
|
@@ -62323,14 +62175,14 @@ function rotateBackup(filePath) {
|
|
|
62323
62175
|
}
|
|
62324
62176
|
}
|
|
62325
62177
|
try {
|
|
62326
|
-
const content =
|
|
62327
|
-
writeFileSync14(
|
|
62178
|
+
const content = readFileSync62(filePath, "utf-8");
|
|
62179
|
+
writeFileSync14(join90(backupDir, `${name2}.1`), content, "utf-8");
|
|
62328
62180
|
} catch {
|
|
62329
62181
|
}
|
|
62330
62182
|
}
|
|
62331
62183
|
function writeJsonFileAtomic(filePath, data, indent = 2) {
|
|
62332
62184
|
const dir = dirname17(filePath);
|
|
62333
|
-
const tempPath =
|
|
62185
|
+
const tempPath = join90(dir, `.${basename14(filePath)}.${randomBytes12(6).toString("hex")}.tmp`);
|
|
62334
62186
|
const content = JSON.stringify(data, null, indent) + "\n";
|
|
62335
62187
|
writeFileSync14(tempPath, content, "utf-8");
|
|
62336
62188
|
try {
|
|
@@ -62347,7 +62199,7 @@ function writeJsonFileAtomic(filePath, data, indent = 2) {
|
|
|
62347
62199
|
}
|
|
62348
62200
|
}
|
|
62349
62201
|
function getDataPath(projectRoot, filename) {
|
|
62350
|
-
return
|
|
62202
|
+
return join90(projectRoot, ".cleo", filename);
|
|
62351
62203
|
}
|
|
62352
62204
|
|
|
62353
62205
|
// packages/core/src/platform.ts
|
|
@@ -62469,9 +62321,9 @@ init_data_accessor();
|
|
|
62469
62321
|
|
|
62470
62322
|
// packages/core/src/validation/doctor/checks.ts
|
|
62471
62323
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
62472
|
-
import { accessSync as accessSync2, constants as constants2, existsSync as existsSync88, readFileSync as
|
|
62324
|
+
import { accessSync as accessSync2, constants as constants2, existsSync as existsSync88, readFileSync as readFileSync63, statSync as statSync18 } from "node:fs";
|
|
62473
62325
|
import { homedir as homedir4 } from "node:os";
|
|
62474
|
-
import { join as
|
|
62326
|
+
import { join as join91 } from "node:path";
|
|
62475
62327
|
|
|
62476
62328
|
// packages/core/src/constants.ts
|
|
62477
62329
|
var CORE_PROTECTED_FILES = [
|
|
@@ -62499,7 +62351,7 @@ function checkCliInstallation(cleoHome = getCleoHome()) {
|
|
|
62499
62351
|
}
|
|
62500
62352
|
var VERSION_REGEX = /^\d+\.\d+\.\d+$/;
|
|
62501
62353
|
function checkCliVersion(cleoHome = getCleoHome()) {
|
|
62502
|
-
const versionFile =
|
|
62354
|
+
const versionFile = join91(cleoHome, "VERSION");
|
|
62503
62355
|
if (!existsSync88(versionFile)) {
|
|
62504
62356
|
return {
|
|
62505
62357
|
id: "cli_version",
|
|
@@ -62510,7 +62362,7 @@ function checkCliVersion(cleoHome = getCleoHome()) {
|
|
|
62510
62362
|
fix: "Run install.sh to reinstall CLEO"
|
|
62511
62363
|
};
|
|
62512
62364
|
}
|
|
62513
|
-
const version2 =
|
|
62365
|
+
const version2 = readFileSync63(versionFile, "utf-8").trim().split("\n")[0].trim();
|
|
62514
62366
|
const valid = VERSION_REGEX.test(version2);
|
|
62515
62367
|
return {
|
|
62516
62368
|
id: "cli_version",
|
|
@@ -62522,7 +62374,7 @@ function checkCliVersion(cleoHome = getCleoHome()) {
|
|
|
62522
62374
|
};
|
|
62523
62375
|
}
|
|
62524
62376
|
function checkDocsAccessibility(cleoHome = getCleoHome()) {
|
|
62525
|
-
const docsFile =
|
|
62377
|
+
const docsFile = join91(cleoHome, "templates", "CLEO-INJECTION.md");
|
|
62526
62378
|
if (!existsSync88(docsFile)) {
|
|
62527
62379
|
return {
|
|
62528
62380
|
id: "docs_accessibility",
|
|
@@ -62556,7 +62408,7 @@ function checkDocsAccessibility(cleoHome = getCleoHome()) {
|
|
|
62556
62408
|
};
|
|
62557
62409
|
}
|
|
62558
62410
|
function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
62559
|
-
const docsFile =
|
|
62411
|
+
const docsFile = join91(cleoHome, "templates", "CLEO-INJECTION.md");
|
|
62560
62412
|
const reference = "@~/.cleo/templates/CLEO-INJECTION.md";
|
|
62561
62413
|
if (!existsSync88(docsFile)) {
|
|
62562
62414
|
return {
|
|
@@ -62570,7 +62422,7 @@ function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
|
62570
62422
|
}
|
|
62571
62423
|
try {
|
|
62572
62424
|
accessSync2(docsFile, constants2.R_OK);
|
|
62573
|
-
const content =
|
|
62425
|
+
const content = readFileSync63(docsFile, "utf-8");
|
|
62574
62426
|
const firstLine = content.split("\n")[0] ?? "";
|
|
62575
62427
|
if (!firstLine) {
|
|
62576
62428
|
return {
|
|
@@ -62604,7 +62456,7 @@ function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
|
62604
62456
|
}
|
|
62605
62457
|
function checkAgentsMdHub(projectRoot) {
|
|
62606
62458
|
const root = projectRoot ?? process.cwd();
|
|
62607
|
-
const agentsMdPath =
|
|
62459
|
+
const agentsMdPath = join91(root, "AGENTS.md");
|
|
62608
62460
|
if (!existsSync88(agentsMdPath)) {
|
|
62609
62461
|
return {
|
|
62610
62462
|
id: "agents_md_hub",
|
|
@@ -62617,7 +62469,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
62617
62469
|
}
|
|
62618
62470
|
let content;
|
|
62619
62471
|
try {
|
|
62620
|
-
content =
|
|
62472
|
+
content = readFileSync63(agentsMdPath, "utf-8");
|
|
62621
62473
|
} catch {
|
|
62622
62474
|
return {
|
|
62623
62475
|
id: "agents_md_hub",
|
|
@@ -62649,7 +62501,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
62649
62501
|
}
|
|
62650
62502
|
function checkRootGitignore(projectRoot) {
|
|
62651
62503
|
const root = projectRoot ?? process.cwd();
|
|
62652
|
-
const gitignorePath =
|
|
62504
|
+
const gitignorePath = join91(root, ".gitignore");
|
|
62653
62505
|
if (!existsSync88(gitignorePath)) {
|
|
62654
62506
|
return {
|
|
62655
62507
|
id: "root_gitignore",
|
|
@@ -62662,7 +62514,7 @@ function checkRootGitignore(projectRoot) {
|
|
|
62662
62514
|
}
|
|
62663
62515
|
let content;
|
|
62664
62516
|
try {
|
|
62665
|
-
content =
|
|
62517
|
+
content = readFileSync63(gitignorePath, "utf-8");
|
|
62666
62518
|
} catch {
|
|
62667
62519
|
return {
|
|
62668
62520
|
id: "root_gitignore",
|
|
@@ -62700,7 +62552,7 @@ function checkRootGitignore(projectRoot) {
|
|
|
62700
62552
|
}
|
|
62701
62553
|
function checkCleoGitignore(projectRoot) {
|
|
62702
62554
|
const root = projectRoot ?? process.cwd();
|
|
62703
|
-
const gitignorePath =
|
|
62555
|
+
const gitignorePath = join91(root, ".cleo", ".gitignore");
|
|
62704
62556
|
if (!existsSync88(gitignorePath)) {
|
|
62705
62557
|
return {
|
|
62706
62558
|
id: "cleo_gitignore",
|
|
@@ -62713,7 +62565,7 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62713
62565
|
}
|
|
62714
62566
|
let installedContent;
|
|
62715
62567
|
try {
|
|
62716
|
-
installedContent =
|
|
62568
|
+
installedContent = readFileSync63(gitignorePath, "utf-8");
|
|
62717
62569
|
} catch {
|
|
62718
62570
|
return {
|
|
62719
62571
|
id: "cleo_gitignore",
|
|
@@ -62730,12 +62582,12 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62730
62582
|
} catch {
|
|
62731
62583
|
try {
|
|
62732
62584
|
const templatePaths = [
|
|
62733
|
-
|
|
62734
|
-
|
|
62585
|
+
join91(root, "templates", "cleo-gitignore"),
|
|
62586
|
+
join91(getCleoHome(), "templates", "cleo-gitignore")
|
|
62735
62587
|
];
|
|
62736
62588
|
for (const tp of templatePaths) {
|
|
62737
62589
|
if (existsSync88(tp)) {
|
|
62738
|
-
templateContent =
|
|
62590
|
+
templateContent = readFileSync63(tp, "utf-8");
|
|
62739
62591
|
break;
|
|
62740
62592
|
}
|
|
62741
62593
|
}
|
|
@@ -62768,10 +62620,10 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62768
62620
|
};
|
|
62769
62621
|
}
|
|
62770
62622
|
function detectStorageEngine(projectRoot) {
|
|
62771
|
-
const configPath =
|
|
62623
|
+
const configPath = join91(projectRoot, ".cleo", "config.json");
|
|
62772
62624
|
if (existsSync88(configPath)) {
|
|
62773
62625
|
try {
|
|
62774
|
-
const config2 = JSON.parse(
|
|
62626
|
+
const config2 = JSON.parse(readFileSync63(configPath, "utf-8"));
|
|
62775
62627
|
if (typeof config2.storageEngine === "string" && config2.storageEngine) {
|
|
62776
62628
|
return config2.storageEngine;
|
|
62777
62629
|
}
|
|
@@ -62782,7 +62634,7 @@ function detectStorageEngine(projectRoot) {
|
|
|
62782
62634
|
}
|
|
62783
62635
|
function checkVitalFilesTracked(projectRoot) {
|
|
62784
62636
|
const root = projectRoot ?? process.cwd();
|
|
62785
|
-
const gitDir =
|
|
62637
|
+
const gitDir = join91(root, ".git");
|
|
62786
62638
|
if (!existsSync88(gitDir)) {
|
|
62787
62639
|
return {
|
|
62788
62640
|
id: "vital_files_tracked",
|
|
@@ -62797,7 +62649,7 @@ function checkVitalFilesTracked(projectRoot) {
|
|
|
62797
62649
|
const vitalFiles = CORE_PROTECTED_FILES.map((f) => `.cleo/${f}`);
|
|
62798
62650
|
const untracked = [];
|
|
62799
62651
|
for (const file2 of vitalFiles) {
|
|
62800
|
-
const fullPath =
|
|
62652
|
+
const fullPath = join91(root, file2);
|
|
62801
62653
|
if (!existsSync88(fullPath)) continue;
|
|
62802
62654
|
try {
|
|
62803
62655
|
execFileSync10("git", ["ls-files", "--error-unmatch", file2], {
|
|
@@ -62829,7 +62681,7 @@ function checkVitalFilesTracked(projectRoot) {
|
|
|
62829
62681
|
}
|
|
62830
62682
|
function checkCoreFilesNotIgnored(projectRoot) {
|
|
62831
62683
|
const root = projectRoot ?? process.cwd();
|
|
62832
|
-
const gitDir =
|
|
62684
|
+
const gitDir = join91(root, ".git");
|
|
62833
62685
|
if (!existsSync88(gitDir)) {
|
|
62834
62686
|
return {
|
|
62835
62687
|
id: "core_files_not_ignored",
|
|
@@ -62843,7 +62695,7 @@ function checkCoreFilesNotIgnored(projectRoot) {
|
|
|
62843
62695
|
const ignoredFiles = [];
|
|
62844
62696
|
for (const file2 of CORE_PROTECTED_FILES) {
|
|
62845
62697
|
const relPath = `.cleo/${file2}`;
|
|
62846
|
-
const fullPath =
|
|
62698
|
+
const fullPath = join91(root, relPath);
|
|
62847
62699
|
if (!existsSync88(fullPath)) continue;
|
|
62848
62700
|
try {
|
|
62849
62701
|
execFileSync10("git", ["check-ignore", "-q", relPath], {
|
|
@@ -62875,7 +62727,7 @@ function checkCoreFilesNotIgnored(projectRoot) {
|
|
|
62875
62727
|
}
|
|
62876
62728
|
function checkSqliteNotTracked(projectRoot) {
|
|
62877
62729
|
const root = projectRoot ?? process.cwd();
|
|
62878
|
-
const gitDir =
|
|
62730
|
+
const gitDir = join91(root, ".git");
|
|
62879
62731
|
if (!existsSync88(gitDir)) {
|
|
62880
62732
|
return {
|
|
62881
62733
|
id: "sqlite_not_tracked",
|
|
@@ -62887,7 +62739,7 @@ function checkSqliteNotTracked(projectRoot) {
|
|
|
62887
62739
|
};
|
|
62888
62740
|
}
|
|
62889
62741
|
const sqliteFile = ".cleo/tasks.db";
|
|
62890
|
-
const fullPath =
|
|
62742
|
+
const fullPath = join91(root, sqliteFile);
|
|
62891
62743
|
if (!existsSync88(fullPath)) {
|
|
62892
62744
|
return {
|
|
62893
62745
|
id: "sqlite_not_tracked",
|
|
@@ -62924,7 +62776,7 @@ function checkSqliteNotTracked(projectRoot) {
|
|
|
62924
62776
|
}
|
|
62925
62777
|
function checkLegacyAgentOutputs(projectRoot) {
|
|
62926
62778
|
const root = projectRoot ?? process.cwd();
|
|
62927
|
-
const cleoDir =
|
|
62779
|
+
const cleoDir = join91(root, ".cleo");
|
|
62928
62780
|
const detection = detectLegacyAgentOutputs(root, cleoDir);
|
|
62929
62781
|
if (detection.hasLegacy) {
|
|
62930
62782
|
return {
|
|
@@ -62950,11 +62802,11 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
62950
62802
|
const files = ["CLAUDE.md", "AGENTS.md"];
|
|
62951
62803
|
const issues = [];
|
|
62952
62804
|
for (const file2 of files) {
|
|
62953
|
-
const filePath =
|
|
62805
|
+
const filePath = join91(root, file2);
|
|
62954
62806
|
if (!existsSync88(filePath)) continue;
|
|
62955
62807
|
let content;
|
|
62956
62808
|
try {
|
|
62957
|
-
content =
|
|
62809
|
+
content = readFileSync63(filePath, "utf-8");
|
|
62958
62810
|
} catch {
|
|
62959
62811
|
continue;
|
|
62960
62812
|
}
|
|
@@ -62988,7 +62840,7 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
62988
62840
|
}
|
|
62989
62841
|
function checkAtReferenceTargetExists(projectRoot) {
|
|
62990
62842
|
const root = projectRoot ?? process.cwd();
|
|
62991
|
-
const agentsPath =
|
|
62843
|
+
const agentsPath = join91(root, "AGENTS.md");
|
|
62992
62844
|
if (!existsSync88(agentsPath)) {
|
|
62993
62845
|
return {
|
|
62994
62846
|
id: "at_reference_targets",
|
|
@@ -63001,7 +62853,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63001
62853
|
}
|
|
63002
62854
|
let content;
|
|
63003
62855
|
try {
|
|
63004
|
-
content =
|
|
62856
|
+
content = readFileSync63(agentsPath, "utf-8");
|
|
63005
62857
|
} catch {
|
|
63006
62858
|
return {
|
|
63007
62859
|
id: "at_reference_targets",
|
|
@@ -63028,7 +62880,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63028
62880
|
const missing = [];
|
|
63029
62881
|
for (const ref of refs) {
|
|
63030
62882
|
const rawPath = ref.slice(1).trim();
|
|
63031
|
-
const resolvedPath = rawPath.startsWith("~/") ?
|
|
62883
|
+
const resolvedPath = rawPath.startsWith("~/") ? join91(homedir4(), rawPath.slice(2)) : join91(root, rawPath);
|
|
63032
62884
|
if (!existsSync88(resolvedPath)) {
|
|
63033
62885
|
missing.push(rawPath);
|
|
63034
62886
|
}
|
|
@@ -63055,8 +62907,8 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63055
62907
|
function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
63056
62908
|
const root = projectRoot ?? process.cwd();
|
|
63057
62909
|
const home = cleoHome ?? getCleoHome();
|
|
63058
|
-
const sourcePath =
|
|
63059
|
-
const deployedPath =
|
|
62910
|
+
const sourcePath = join91(root, "templates", "CLEO-INJECTION.md");
|
|
62911
|
+
const deployedPath = join91(home, "templates", "CLEO-INJECTION.md");
|
|
63060
62912
|
if (!existsSync88(sourcePath)) {
|
|
63061
62913
|
return {
|
|
63062
62914
|
id: "template_freshness",
|
|
@@ -63077,8 +62929,8 @@ function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
|
63077
62929
|
fix: "cp templates/CLEO-INJECTION.md ~/.cleo/templates/CLEO-INJECTION.md"
|
|
63078
62930
|
};
|
|
63079
62931
|
}
|
|
63080
|
-
const sourceContent =
|
|
63081
|
-
const deployedContent =
|
|
62932
|
+
const sourceContent = readFileSync63(sourcePath, "utf-8");
|
|
62933
|
+
const deployedContent = readFileSync63(deployedPath, "utf-8");
|
|
63082
62934
|
if (sourceContent !== deployedContent) {
|
|
63083
62935
|
return {
|
|
63084
62936
|
id: "template_freshness",
|
|
@@ -63100,7 +62952,7 @@ function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
|
63100
62952
|
}
|
|
63101
62953
|
function checkTierMarkersPresent(cleoHome) {
|
|
63102
62954
|
const home = cleoHome ?? getCleoHome();
|
|
63103
|
-
const templatePath =
|
|
62955
|
+
const templatePath = join91(home, "templates", "CLEO-INJECTION.md");
|
|
63104
62956
|
if (!existsSync88(templatePath)) {
|
|
63105
62957
|
return {
|
|
63106
62958
|
id: "tier_markers_present",
|
|
@@ -63111,7 +62963,7 @@ function checkTierMarkersPresent(cleoHome) {
|
|
|
63111
62963
|
fix: "Run install.sh to reinstall CLEO"
|
|
63112
62964
|
};
|
|
63113
62965
|
}
|
|
63114
|
-
const content =
|
|
62966
|
+
const content = readFileSync63(templatePath, "utf-8");
|
|
63115
62967
|
const expectedTiers = ["minimal", "standard", "orchestrator"];
|
|
63116
62968
|
const missing = [];
|
|
63117
62969
|
const unclosed = [];
|
|
@@ -63222,7 +63074,7 @@ function checkGlobalSchemaHealth(_projectRoot) {
|
|
|
63222
63074
|
}
|
|
63223
63075
|
function checkNoLocalSchemas(projectRoot) {
|
|
63224
63076
|
const root = projectRoot ?? process.cwd();
|
|
63225
|
-
const localSchemasDir =
|
|
63077
|
+
const localSchemasDir = join91(root, ".cleo", "schemas");
|
|
63226
63078
|
if (!existsSync88(localSchemasDir)) {
|
|
63227
63079
|
return {
|
|
63228
63080
|
id: "no_local_schemas",
|
|
@@ -63287,13 +63139,13 @@ var databaseSyncCtor = (() => {
|
|
|
63287
63139
|
})();
|
|
63288
63140
|
var STALE_JSON_FILES = ["todo.json", "sessions.json", "todo-archive.json"];
|
|
63289
63141
|
function resolveStructuredLogPath(cleoDir) {
|
|
63290
|
-
const defaultPath =
|
|
63291
|
-
const configPath =
|
|
63142
|
+
const defaultPath = join92(cleoDir, "logs", "cleo.log");
|
|
63143
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63292
63144
|
if (!existsSync89(configPath)) return defaultPath;
|
|
63293
63145
|
try {
|
|
63294
|
-
const config2 = JSON.parse(
|
|
63146
|
+
const config2 = JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63295
63147
|
if (!config2.logging?.filePath) return defaultPath;
|
|
63296
|
-
return
|
|
63148
|
+
return join92(cleoDir, config2.logging.filePath);
|
|
63297
63149
|
} catch {
|
|
63298
63150
|
return defaultPath;
|
|
63299
63151
|
}
|
|
@@ -63335,14 +63187,14 @@ function checkAuditLogAvailability(dbPath) {
|
|
|
63335
63187
|
}
|
|
63336
63188
|
}
|
|
63337
63189
|
async function getSystemHealth(projectRoot, opts) {
|
|
63338
|
-
const cleoDir =
|
|
63190
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63339
63191
|
const checks = [];
|
|
63340
63192
|
if (existsSync89(cleoDir)) {
|
|
63341
63193
|
checks.push({ name: "cleo_dir", status: "pass", message: ".cleo directory exists" });
|
|
63342
63194
|
} else {
|
|
63343
63195
|
checks.push({ name: "cleo_dir", status: "fail", message: ".cleo directory not found" });
|
|
63344
63196
|
}
|
|
63345
|
-
const dbPath =
|
|
63197
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63346
63198
|
if (existsSync89(dbPath)) {
|
|
63347
63199
|
try {
|
|
63348
63200
|
const dbSize = statSync19(dbPath).size;
|
|
@@ -63364,7 +63216,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63364
63216
|
if (existsSync89(dbPath)) {
|
|
63365
63217
|
checks.push(checkAuditLogAvailability(dbPath));
|
|
63366
63218
|
}
|
|
63367
|
-
const sdDbPath =
|
|
63219
|
+
const sdDbPath = join92(cleoDir, "signaldock.db");
|
|
63368
63220
|
if (existsSync89(sdDbPath)) {
|
|
63369
63221
|
try {
|
|
63370
63222
|
const { DatabaseSync: SdDb } = _require6("node:sqlite");
|
|
@@ -63402,10 +63254,10 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63402
63254
|
message: "signaldock.db not found. Run: cleo init"
|
|
63403
63255
|
});
|
|
63404
63256
|
}
|
|
63405
|
-
const configPath =
|
|
63257
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63406
63258
|
if (existsSync89(configPath)) {
|
|
63407
63259
|
try {
|
|
63408
|
-
JSON.parse(
|
|
63260
|
+
JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63409
63261
|
checks.push({ name: "config_json", status: "pass", message: "config.json is valid JSON" });
|
|
63410
63262
|
} catch {
|
|
63411
63263
|
checks.push({
|
|
@@ -63418,7 +63270,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63418
63270
|
checks.push({ name: "config_json", status: "warn", message: "config.json not found" });
|
|
63419
63271
|
}
|
|
63420
63272
|
if (existsSync89(dbPath)) {
|
|
63421
|
-
const staleFiles = STALE_JSON_FILES.filter((f) => existsSync89(
|
|
63273
|
+
const staleFiles = STALE_JSON_FILES.filter((f) => existsSync89(join92(cleoDir, f)));
|
|
63422
63274
|
if (staleFiles.length > 0) {
|
|
63423
63275
|
checks.push({
|
|
63424
63276
|
name: "stale_json",
|
|
@@ -63442,7 +63294,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63442
63294
|
message: `structured log not found: ${logPath}`
|
|
63443
63295
|
});
|
|
63444
63296
|
}
|
|
63445
|
-
const backupDir =
|
|
63297
|
+
const backupDir = join92(cleoDir, ".backups");
|
|
63446
63298
|
if (existsSync89(backupDir)) {
|
|
63447
63299
|
checks.push({ name: "backups_dir", status: "pass", message: ".backups directory exists" });
|
|
63448
63300
|
} else {
|
|
@@ -63455,9 +63307,9 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63455
63307
|
}
|
|
63456
63308
|
let version2 = "unknown";
|
|
63457
63309
|
try {
|
|
63458
|
-
const pkgPath =
|
|
63310
|
+
const pkgPath = join92(projectRoot, "package.json");
|
|
63459
63311
|
if (existsSync89(pkgPath)) {
|
|
63460
|
-
const pkg = JSON.parse(
|
|
63312
|
+
const pkg = JSON.parse(readFileSync64(pkgPath, "utf-8"));
|
|
63461
63313
|
version2 = pkg.version || "unknown";
|
|
63462
63314
|
}
|
|
63463
63315
|
} catch {
|
|
@@ -63491,8 +63343,8 @@ async function getSystemDiagnostics(projectRoot, opts) {
|
|
|
63491
63343
|
details: preflight.summary
|
|
63492
63344
|
});
|
|
63493
63345
|
}
|
|
63494
|
-
const cleoDir =
|
|
63495
|
-
const dbPath =
|
|
63346
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63347
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63496
63348
|
if (existsSync89(dbPath)) {
|
|
63497
63349
|
try {
|
|
63498
63350
|
const accessor = await getAccessor(projectRoot);
|
|
@@ -63632,14 +63484,14 @@ function mapSchemaCheckResult(sr) {
|
|
|
63632
63484
|
};
|
|
63633
63485
|
}
|
|
63634
63486
|
function checkContributorChannel(projectRoot) {
|
|
63635
|
-
const configPath =
|
|
63487
|
+
const configPath = join92(projectRoot, ".cleo", "config.json");
|
|
63636
63488
|
if (!existsSync89(configPath)) {
|
|
63637
63489
|
return { check: "contributor_channel", status: "ok", message: "Not a contributor project" };
|
|
63638
63490
|
}
|
|
63639
63491
|
let isContributor = false;
|
|
63640
63492
|
let devCli = "cleo-dev";
|
|
63641
63493
|
try {
|
|
63642
|
-
const config2 = JSON.parse(
|
|
63494
|
+
const config2 = JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63643
63495
|
isContributor = config2.contributor?.isContributorProject === true;
|
|
63644
63496
|
devCli = config2.contributor?.devCli ?? "cleo-dev";
|
|
63645
63497
|
} catch {
|
|
@@ -63649,7 +63501,7 @@ function checkContributorChannel(projectRoot) {
|
|
|
63649
63501
|
return { check: "contributor_channel", status: "ok", message: "Not a contributor project" };
|
|
63650
63502
|
}
|
|
63651
63503
|
const pathDirs = (process.env["PATH"] ?? "").split(":").filter(Boolean);
|
|
63652
|
-
const devCliOnPath = pathDirs.some((dir) => existsSync89(
|
|
63504
|
+
const devCliOnPath = pathDirs.some((dir) => existsSync89(join92(dir, devCli)));
|
|
63653
63505
|
if (!devCliOnPath) {
|
|
63654
63506
|
return {
|
|
63655
63507
|
check: "contributor_channel",
|
|
@@ -63682,14 +63534,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63682
63534
|
status: gitPath ? "ok" : "warning",
|
|
63683
63535
|
message: gitPath ? `git found: ${gitPath}` : "git not found (optional, needed for version control features)"
|
|
63684
63536
|
});
|
|
63685
|
-
const cleoDir =
|
|
63537
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63686
63538
|
const dirExists = existsSync89(cleoDir);
|
|
63687
63539
|
checks.push({
|
|
63688
63540
|
check: "project_dir",
|
|
63689
63541
|
status: dirExists ? "ok" : "error",
|
|
63690
63542
|
message: dirExists ? `Project dir: ${cleoDir}` : `Project dir not found: ${cleoDir}. Run: cleo init`
|
|
63691
63543
|
});
|
|
63692
|
-
const dbPath =
|
|
63544
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63693
63545
|
const dbExists2 = existsSync89(dbPath);
|
|
63694
63546
|
const dbSize = await fileSize(dbPath);
|
|
63695
63547
|
checks.push({
|
|
@@ -63739,14 +63591,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63739
63591
|
} catch {
|
|
63740
63592
|
}
|
|
63741
63593
|
}
|
|
63742
|
-
const configPath =
|
|
63594
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63743
63595
|
const configExists = existsSync89(configPath);
|
|
63744
63596
|
checks.push({
|
|
63745
63597
|
check: "config_file",
|
|
63746
63598
|
status: configExists ? "ok" : "warning",
|
|
63747
63599
|
message: configExists ? "config.json present" : "config.json not found (using defaults)"
|
|
63748
63600
|
});
|
|
63749
|
-
const staleJsonFiles = STALE_JSON_FILES.filter((f) => existsSync89(
|
|
63601
|
+
const staleJsonFiles = STALE_JSON_FILES.filter((f) => existsSync89(join92(cleoDir, f)));
|
|
63750
63602
|
if (dbExists2 && staleJsonFiles.length > 0) {
|
|
63751
63603
|
checks.push({
|
|
63752
63604
|
check: "stale_json",
|
|
@@ -63762,10 +63614,10 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63762
63614
|
status: logExists ? "ok" : "warning",
|
|
63763
63615
|
message: logExists ? `structured log present: ${logPath}` : `structured log not found: ${logPath}`
|
|
63764
63616
|
});
|
|
63765
|
-
const rootGitignorePath =
|
|
63617
|
+
const rootGitignorePath = join92(projectRoot, ".gitignore");
|
|
63766
63618
|
if (existsSync89(rootGitignorePath)) {
|
|
63767
63619
|
try {
|
|
63768
|
-
const gitignoreContent =
|
|
63620
|
+
const gitignoreContent = readFileSync64(rootGitignorePath, "utf-8");
|
|
63769
63621
|
const blockingLines = gitignoreContent.split("\n").filter((line2) => {
|
|
63770
63622
|
const trimmed = line2.trim();
|
|
63771
63623
|
if (trimmed.startsWith("#") || trimmed === "") return false;
|
|
@@ -63784,7 +63636,7 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63784
63636
|
checks.push(mapCheckResult(checkVitalFilesTracked(projectRoot)));
|
|
63785
63637
|
checks.push(mapCheckResult(checkCoreFilesNotIgnored(projectRoot)));
|
|
63786
63638
|
checks.push(mapCheckResult(checkLegacyAgentOutputs(projectRoot)));
|
|
63787
|
-
const cleoGitHeadExists = existsSync89(
|
|
63639
|
+
const cleoGitHeadExists = existsSync89(join92(cleoDir, ".git", "HEAD"));
|
|
63788
63640
|
checks.push({
|
|
63789
63641
|
check: "cleo_git_repo",
|
|
63790
63642
|
status: cleoGitHeadExists ? "ok" : "warning",
|
|
@@ -63800,15 +63652,15 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63800
63652
|
checks.push(mapCheckResult(checkProjectContext(projectRoot)));
|
|
63801
63653
|
checks.push(mapCheckResult(checkInjection2(projectRoot)));
|
|
63802
63654
|
checks.push(checkContributorChannel(projectRoot));
|
|
63803
|
-
const agentDefPath =
|
|
63655
|
+
const agentDefPath = join92(getAgentsHome(), "agents", "cleo-subagent");
|
|
63804
63656
|
checks.push({
|
|
63805
63657
|
check: "agent_definition",
|
|
63806
63658
|
status: existsSync89(agentDefPath) ? "ok" : "warning",
|
|
63807
63659
|
message: existsSync89(agentDefPath) ? "cleo-subagent agent definition installed" : "cleo-subagent not found \u2014 run: cleo init",
|
|
63808
63660
|
...existsSync89(agentDefPath) ? {} : { fix: "cleo init" }
|
|
63809
63661
|
});
|
|
63810
|
-
const gitDir =
|
|
63811
|
-
const gitHubTemplatesDir =
|
|
63662
|
+
const gitDir = join92(projectRoot, ".git");
|
|
63663
|
+
const gitHubTemplatesDir = join92(projectRoot, ".github", "ISSUE_TEMPLATE");
|
|
63812
63664
|
if (existsSync89(gitDir)) {
|
|
63813
63665
|
checks.push({
|
|
63814
63666
|
check: "github_templates",
|
|
@@ -63842,14 +63694,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63842
63694
|
|
|
63843
63695
|
// packages/core/src/system/inject-generate.ts
|
|
63844
63696
|
init_data_accessor();
|
|
63845
|
-
import { existsSync as existsSync90, readFileSync as
|
|
63846
|
-
import { join as
|
|
63697
|
+
import { existsSync as existsSync90, readFileSync as readFileSync65 } from "node:fs";
|
|
63698
|
+
import { join as join93 } from "node:path";
|
|
63847
63699
|
async function generateInjection(projectRoot, accessor) {
|
|
63848
63700
|
let version2 = "unknown";
|
|
63849
63701
|
try {
|
|
63850
|
-
const pkgPath =
|
|
63702
|
+
const pkgPath = join93(projectRoot, "package.json");
|
|
63851
63703
|
if (existsSync90(pkgPath)) {
|
|
63852
|
-
const pkg = JSON.parse(
|
|
63704
|
+
const pkg = JSON.parse(readFileSync65(pkgPath, "utf-8"));
|
|
63853
63705
|
version2 = pkg.version || "unknown";
|
|
63854
63706
|
}
|
|
63855
63707
|
} catch {
|
|
@@ -63896,7 +63748,7 @@ function buildMviMarkdown(state) {
|
|
|
63896
63748
|
const focusLine = state.focusTask ? `| Focus | \`${state.focusTask}\` |` : "| Focus | none |";
|
|
63897
63749
|
return `## CLEO Task Management (MVI)
|
|
63898
63750
|
|
|
63899
|
-
> **Bootstrap**:
|
|
63751
|
+
> **Bootstrap**: Run \`cleo session status\` then \`cleo dash\` at session start.
|
|
63900
63752
|
|
|
63901
63753
|
| Key | Value |
|
|
63902
63754
|
|-----|-------|
|
|
@@ -63909,40 +63761,40 @@ ${focusLine}
|
|
|
63909
63761
|
|
|
63910
63762
|
| Command | Description |
|
|
63911
63763
|
|---------|-------------|
|
|
63912
|
-
| \`
|
|
63913
|
-
| \`
|
|
63914
|
-
| \`
|
|
63915
|
-
| \`
|
|
63916
|
-
| \`
|
|
63917
|
-
| \`
|
|
63918
|
-
| \`
|
|
63919
|
-
| \`
|
|
63920
|
-
| \`
|
|
63921
|
-
| \`
|
|
63922
|
-
| \`
|
|
63923
|
-
| \`
|
|
63764
|
+
| \`cleo find "query"\` | Fuzzy search tasks (minimal context) |
|
|
63765
|
+
| \`cleo show T1234\` | Full task details |
|
|
63766
|
+
| \`cleo add "Title" -d "..."\` | Create task |
|
|
63767
|
+
| \`cleo done <id>\` | Complete task |
|
|
63768
|
+
| \`cleo start <id>\` | Start working on task |
|
|
63769
|
+
| \`cleo current\` | Show current task |
|
|
63770
|
+
| \`cleo next\` | Suggest next task |
|
|
63771
|
+
| \`cleo session list\` | List sessions |
|
|
63772
|
+
| \`cleo session start --scope epic:T### --auto-start --name "..."\` | Start session |
|
|
63773
|
+
| \`cleo session end --note "..."\` | End session |
|
|
63774
|
+
| \`cleo dash\` | Project overview |
|
|
63775
|
+
| \`cleo context\` | Context window usage |
|
|
63924
63776
|
|
|
63925
63777
|
### Session Protocol
|
|
63926
63778
|
|
|
63927
|
-
1. **START**: \`
|
|
63928
|
-
2. **WORK**: \`
|
|
63929
|
-
3. **END**: \`
|
|
63779
|
+
1. **START**: \`cleo session list\` then \`cleo session resume <id>\` or \`cleo session start --scope epic:T### --auto-start --name "Work"\`
|
|
63780
|
+
2. **WORK**: \`cleo current\` / \`cleo next\` / \`cleo complete <id>\` / \`cleo start <id>\`
|
|
63781
|
+
3. **END**: \`cleo complete <id>\` then \`cleo session end --note "Progress"\`
|
|
63930
63782
|
|
|
63931
63783
|
### Error Handling
|
|
63932
63784
|
|
|
63933
63785
|
| Exit | Code | Fix |
|
|
63934
63786
|
|:----:|------|-----|
|
|
63935
|
-
| 4 | \`E_NOT_FOUND\` | Use \`
|
|
63787
|
+
| 4 | \`E_NOT_FOUND\` | Use \`cleo find\` or \`cleo list\` to verify |
|
|
63936
63788
|
| 6 | \`E_VALIDATION\` | Check field lengths, escape \`$\` as \`\\$\` |
|
|
63937
|
-
| 10 | \`E_PARENT_NOT_FOUND\` | Verify with \`
|
|
63789
|
+
| 10 | \`E_PARENT_NOT_FOUND\` | Verify with \`cleo exists <parent-id>\` |
|
|
63938
63790
|
| 11 | \`E_DEPTH_EXCEEDED\` | Exceeds configured hierarchy.maxDepth (default: 3) |
|
|
63939
63791
|
| 12 | \`E_SIBLING_LIMIT\` | Exceeds configured maxSiblings (default: unlimited) |
|
|
63940
63792
|
|
|
63941
|
-
**After EVERY command**: Check exit code (\`0\` = success), check \`"success"\` in JSON output
|
|
63793
|
+
**After EVERY command**: Check exit code (\`0\` = success), check \`"success"\` in JSON output.
|
|
63942
63794
|
|
|
63943
63795
|
### Detailed Guidance
|
|
63944
63796
|
|
|
63945
|
-
For full protocol details, load the **ct-cleo** skill
|
|
63797
|
+
For full protocol details, load the **ct-cleo** skill.
|
|
63946
63798
|
`;
|
|
63947
63799
|
}
|
|
63948
63800
|
|
|
@@ -63977,10 +63829,10 @@ async function getLabels(cwd, accessor) {
|
|
|
63977
63829
|
}
|
|
63978
63830
|
|
|
63979
63831
|
// packages/core/src/system/metrics.ts
|
|
63980
|
-
import { existsSync as existsSync91, readFileSync as
|
|
63981
|
-
import { join as
|
|
63832
|
+
import { existsSync as existsSync91, readFileSync as readFileSync66 } from "node:fs";
|
|
63833
|
+
import { join as join94 } from "node:path";
|
|
63982
63834
|
async function getSystemMetrics(projectRoot, opts, accessor) {
|
|
63983
|
-
const cleoDir =
|
|
63835
|
+
const cleoDir = join94(projectRoot, ".cleo");
|
|
63984
63836
|
let complianceEntries = readComplianceJsonl(projectRoot);
|
|
63985
63837
|
if (opts?.since) {
|
|
63986
63838
|
complianceEntries = complianceEntries.filter((e) => e.timestamp >= opts.since);
|
|
@@ -64007,9 +63859,9 @@ async function getSystemMetrics(projectRoot, opts, accessor) {
|
|
|
64007
63859
|
sessionsActive = sessions2.filter((s) => s.status === "active").length;
|
|
64008
63860
|
sessionsCompleted = sessions2.filter((s) => s.status === "ended").length;
|
|
64009
63861
|
} else {
|
|
64010
|
-
const sessionsPath =
|
|
63862
|
+
const sessionsPath = join94(cleoDir, "sessions.json");
|
|
64011
63863
|
if (existsSync91(sessionsPath)) {
|
|
64012
|
-
const sessionsData = JSON.parse(
|
|
63864
|
+
const sessionsData = JSON.parse(readFileSync66(sessionsPath, "utf-8"));
|
|
64013
63865
|
const sessions2 = sessionsData.sessions ?? [];
|
|
64014
63866
|
sessionsTotal = sessions2.length;
|
|
64015
63867
|
sessionsActive = sessions2.filter((s) => s.status === "active").length;
|
|
@@ -64032,9 +63884,9 @@ init_src();
|
|
|
64032
63884
|
init_errors3();
|
|
64033
63885
|
init_data_accessor();
|
|
64034
63886
|
import { existsSync as existsSync92 } from "node:fs";
|
|
64035
|
-
import { join as
|
|
63887
|
+
import { join as join95 } from "node:path";
|
|
64036
63888
|
async function getMigrationStatus2(projectRoot, opts) {
|
|
64037
|
-
const taskPath =
|
|
63889
|
+
const taskPath = join95(projectRoot, ".cleo", "tasks.db");
|
|
64038
63890
|
let currentVersion = "unknown";
|
|
64039
63891
|
if (existsSync92(taskPath)) {
|
|
64040
63892
|
try {
|
|
@@ -64066,7 +63918,7 @@ init_paths();
|
|
|
64066
63918
|
import { execFile as execFile7 } from "node:child_process";
|
|
64067
63919
|
import { existsSync as existsSync93 } from "node:fs";
|
|
64068
63920
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
64069
|
-
import { basename as basename15, join as
|
|
63921
|
+
import { basename as basename15, join as join96 } from "node:path";
|
|
64070
63922
|
import { promisify as promisify7 } from "node:util";
|
|
64071
63923
|
function normalizeChannel(value) {
|
|
64072
63924
|
if (!value) return null;
|
|
@@ -64091,15 +63943,15 @@ function detectFromDataRoot(dataRoot) {
|
|
|
64091
63943
|
function getExpectedNaming(channel) {
|
|
64092
63944
|
switch (channel) {
|
|
64093
63945
|
case "dev":
|
|
64094
|
-
return { cli: "cleo-dev", mcp: "
|
|
63946
|
+
return { cli: "cleo-dev", mcp: "cli", server: "cleo-dev" };
|
|
64095
63947
|
case "beta":
|
|
64096
|
-
return { cli: "cleo-beta", mcp: "
|
|
63948
|
+
return { cli: "cleo-beta", mcp: "cli", server: "cleo-beta" };
|
|
64097
63949
|
default:
|
|
64098
|
-
return { cli: "cleo", mcp: "
|
|
63950
|
+
return { cli: "cleo", mcp: "cli", server: "cleo" };
|
|
64099
63951
|
}
|
|
64100
63952
|
}
|
|
64101
63953
|
async function parseVersionFile(dataRoot) {
|
|
64102
|
-
const versionPath =
|
|
63954
|
+
const versionPath = join96(dataRoot, "VERSION");
|
|
64103
63955
|
if (!existsSync93(versionPath)) return null;
|
|
64104
63956
|
let content;
|
|
64105
63957
|
try {
|
|
@@ -64129,9 +63981,9 @@ async function parseVersionFile(dataRoot) {
|
|
|
64129
63981
|
async function getPackageInfo(sourceDir) {
|
|
64130
63982
|
const candidates = [];
|
|
64131
63983
|
if (sourceDir && sourceDir !== "unknown" && sourceDir !== "npm") {
|
|
64132
|
-
candidates.push(
|
|
63984
|
+
candidates.push(join96(sourceDir, "package.json"));
|
|
64133
63985
|
}
|
|
64134
|
-
candidates.push(
|
|
63986
|
+
candidates.push(join96(process.cwd(), "package.json"));
|
|
64135
63987
|
for (const candidate of candidates) {
|
|
64136
63988
|
try {
|
|
64137
63989
|
const raw = await readFile15(candidate, "utf-8");
|
|
@@ -64210,17 +64062,17 @@ async function getRuntimeDiagnostics(options) {
|
|
|
64210
64062
|
init_src();
|
|
64211
64063
|
init_errors3();
|
|
64212
64064
|
init_data_accessor();
|
|
64213
|
-
import { existsSync as existsSync94, readFileSync as
|
|
64214
|
-
import { join as
|
|
64065
|
+
import { existsSync as existsSync94, readFileSync as readFileSync67, writeFileSync as writeFileSync15 } from "node:fs";
|
|
64066
|
+
import { join as join97 } from "node:path";
|
|
64215
64067
|
function safestop(projectRoot, opts) {
|
|
64216
64068
|
const dryRun = opts?.dryRun ?? false;
|
|
64217
64069
|
const reason = opts?.reason ?? "Manual safestop";
|
|
64218
64070
|
let sessionEnded = false;
|
|
64219
64071
|
if (!dryRun && !opts?.noSessionEnd) {
|
|
64220
|
-
const sessPath =
|
|
64072
|
+
const sessPath = join97(projectRoot, ".cleo", "sessions.json");
|
|
64221
64073
|
if (existsSync94(sessPath)) {
|
|
64222
64074
|
try {
|
|
64223
|
-
const data = JSON.parse(
|
|
64075
|
+
const data = JSON.parse(readFileSync67(sessPath, "utf-8"));
|
|
64224
64076
|
const sessions2 = data.sessions ?? [];
|
|
64225
64077
|
let changed = false;
|
|
64226
64078
|
for (const s of sessions2) {
|
|
@@ -64245,7 +64097,7 @@ async function uncancelTask(projectRoot, params) {
|
|
|
64245
64097
|
if (!params.taskId) {
|
|
64246
64098
|
throw new CleoError(2 /* INVALID_INPUT */, "taskId is required");
|
|
64247
64099
|
}
|
|
64248
|
-
const taskDbPath =
|
|
64100
|
+
const taskDbPath = join97(projectRoot, ".cleo", "tasks.db");
|
|
64249
64101
|
if (!existsSync94(taskDbPath)) {
|
|
64250
64102
|
throw new CleoError(8 /* CONFIG_ERROR */, "No tasks.db found");
|
|
64251
64103
|
}
|
|
@@ -64757,8 +64609,8 @@ __export(templates_exports, {
|
|
|
64757
64609
|
});
|
|
64758
64610
|
|
|
64759
64611
|
// packages/core/src/templates/parser.ts
|
|
64760
|
-
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as
|
|
64761
|
-
import { join as
|
|
64612
|
+
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as readFileSync68 } from "fs";
|
|
64613
|
+
import { join as join98 } from "path";
|
|
64762
64614
|
import { parse as parseYaml } from "yaml";
|
|
64763
64615
|
var SUFFIX_PATTERNS = ["_report", "_request", "_question"];
|
|
64764
64616
|
function deriveSubcommand(filename) {
|
|
@@ -64773,8 +64625,8 @@ function deriveSubcommand(filename) {
|
|
|
64773
64625
|
return firstWord.toLowerCase();
|
|
64774
64626
|
}
|
|
64775
64627
|
function parseTemplateFile2(templateDir, filename) {
|
|
64776
|
-
const filePath =
|
|
64777
|
-
const raw =
|
|
64628
|
+
const filePath = join98(templateDir, filename);
|
|
64629
|
+
const raw = readFileSync68(filePath, "utf-8");
|
|
64778
64630
|
const parsed = parseYaml(raw);
|
|
64779
64631
|
const name2 = typeof parsed.name === "string" ? parsed.name : filename;
|
|
64780
64632
|
const titlePrefix = typeof parsed.title === "string" ? parsed.title : "";
|
|
@@ -64823,7 +64675,7 @@ function parseTemplateFile2(templateDir, filename) {
|
|
|
64823
64675
|
};
|
|
64824
64676
|
}
|
|
64825
64677
|
function parseIssueTemplates2(projectRoot) {
|
|
64826
|
-
const templateDir =
|
|
64678
|
+
const templateDir = join98(projectRoot, ".github", "ISSUE_TEMPLATE");
|
|
64827
64679
|
if (!existsSync95(templateDir)) {
|
|
64828
64680
|
return {
|
|
64829
64681
|
success: false,
|
|
@@ -64971,9 +64823,9 @@ __export(ui_exports, {
|
|
|
64971
64823
|
});
|
|
64972
64824
|
|
|
64973
64825
|
// packages/core/src/ui/aliases.ts
|
|
64974
|
-
import { existsSync as existsSync96, readFileSync as
|
|
64826
|
+
import { existsSync as existsSync96, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
|
|
64975
64827
|
import { homedir as homedir5, platform as platform3 } from "node:os";
|
|
64976
|
-
import { join as
|
|
64828
|
+
import { join as join99 } from "node:path";
|
|
64977
64829
|
var MARKER_START = "# CLEO-CLAUDE-ALIASES:START";
|
|
64978
64830
|
var MARKER_END = "# CLEO-CLAUDE-ALIASES:END";
|
|
64979
64831
|
var ALIASES_VERSION = "1.0.0";
|
|
@@ -64995,16 +64847,16 @@ function getRcFilePath(shell) {
|
|
|
64995
64847
|
const sh = shell ?? getCurrentShell();
|
|
64996
64848
|
switch (sh) {
|
|
64997
64849
|
case "bash":
|
|
64998
|
-
return
|
|
64850
|
+
return join99(home, ".bashrc");
|
|
64999
64851
|
case "zsh":
|
|
65000
|
-
return
|
|
64852
|
+
return join99(home, ".zshrc");
|
|
65001
64853
|
case "powershell":
|
|
65002
|
-
return
|
|
64854
|
+
return join99(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
|
|
65003
64855
|
case "cmd":
|
|
65004
64856
|
return "";
|
|
65005
64857
|
// CMD doesn't have a standard RC
|
|
65006
64858
|
default:
|
|
65007
|
-
return
|
|
64859
|
+
return join99(home, ".bashrc");
|
|
65008
64860
|
}
|
|
65009
64861
|
}
|
|
65010
64862
|
function detectAvailableShells() {
|
|
@@ -65043,12 +64895,12 @@ function generatePowershellAliases(cleoPath) {
|
|
|
65043
64895
|
}
|
|
65044
64896
|
function hasAliasBlock(filePath) {
|
|
65045
64897
|
if (!existsSync96(filePath)) return false;
|
|
65046
|
-
const content =
|
|
64898
|
+
const content = readFileSync69(filePath, "utf-8");
|
|
65047
64899
|
return content.includes(MARKER_START) && content.includes(MARKER_END);
|
|
65048
64900
|
}
|
|
65049
64901
|
function getInstalledVersion(filePath) {
|
|
65050
64902
|
if (!existsSync96(filePath)) return null;
|
|
65051
|
-
const content =
|
|
64903
|
+
const content = readFileSync69(filePath, "utf-8");
|
|
65052
64904
|
const match = content.match(/CLEO CLI aliases \(v([^)]+)\)/);
|
|
65053
64905
|
return match?.[1] ?? null;
|
|
65054
64906
|
}
|
|
@@ -65058,7 +64910,7 @@ function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
|
65058
64910
|
writeFileSync16(filePath, content + "\n", "utf-8");
|
|
65059
64911
|
return { action: "created", version: ALIASES_VERSION };
|
|
65060
64912
|
}
|
|
65061
|
-
const existing =
|
|
64913
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
65062
64914
|
if (hasAliasBlock(filePath)) {
|
|
65063
64915
|
const startIdx = existing.indexOf(MARKER_START);
|
|
65064
64916
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
@@ -65071,7 +64923,7 @@ function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
|
65071
64923
|
}
|
|
65072
64924
|
function removeAliases(filePath) {
|
|
65073
64925
|
if (!existsSync96(filePath) || !hasAliasBlock(filePath)) return false;
|
|
65074
|
-
const existing =
|
|
64926
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
65075
64927
|
const startIdx = existing.indexOf(MARKER_START);
|
|
65076
64928
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
65077
64929
|
const before = existing.slice(0, startIdx).replace(/\n+$/, "\n");
|
|
@@ -65093,7 +64945,7 @@ function checkAliasesStatus(shell) {
|
|
|
65093
64945
|
|
|
65094
64946
|
// packages/core/src/ui/changelog.ts
|
|
65095
64947
|
init_data_accessor();
|
|
65096
|
-
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as
|
|
64948
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as readFileSync70, writeFileSync as writeFileSync17 } from "node:fs";
|
|
65097
64949
|
var LABEL_CATEGORIES = {
|
|
65098
64950
|
feature: "Features",
|
|
65099
64951
|
feat: "Features",
|
|
@@ -65203,7 +65055,7 @@ function appendToChangelog(filePath, newContent) {
|
|
|
65203
65055
|
${newContent}`, "utf-8");
|
|
65204
65056
|
return;
|
|
65205
65057
|
}
|
|
65206
|
-
const existing =
|
|
65058
|
+
const existing = readFileSync70(filePath, "utf-8");
|
|
65207
65059
|
const headerMatch = existing.match(/^# .+\n/m);
|
|
65208
65060
|
if (headerMatch) {
|
|
65209
65061
|
const insertPos = (headerMatch.index ?? 0) + headerMatch[0].length;
|
|
@@ -65243,13 +65095,13 @@ ${markdown}`);
|
|
|
65243
65095
|
}
|
|
65244
65096
|
|
|
65245
65097
|
// packages/core/src/ui/command-registry.ts
|
|
65246
|
-
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as
|
|
65247
|
-
import { basename as basename16, join as
|
|
65098
|
+
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as readFileSync71 } from "node:fs";
|
|
65099
|
+
import { basename as basename16, join as join100 } from "node:path";
|
|
65248
65100
|
var CLEO_HEADER_START = "###CLEO";
|
|
65249
65101
|
var CLEO_HEADER_END = "###END";
|
|
65250
65102
|
function parseCommandHeader(scriptPath) {
|
|
65251
65103
|
if (!existsSync98(scriptPath)) return null;
|
|
65252
|
-
const content =
|
|
65104
|
+
const content = readFileSync71(scriptPath, "utf-8");
|
|
65253
65105
|
const lines = content.split("\n");
|
|
65254
65106
|
let inHeader = false;
|
|
65255
65107
|
const headerLines = [];
|
|
@@ -65330,7 +65182,7 @@ function scanAllCommands(scriptsDir) {
|
|
|
65330
65182
|
if (!existsSync98(scriptsDir)) return registry2;
|
|
65331
65183
|
for (const file2 of readdirSync32(scriptsDir)) {
|
|
65332
65184
|
if (!file2.endsWith(".sh") && !file2.endsWith(".ts")) continue;
|
|
65333
|
-
const meta = parseCommandHeader(
|
|
65185
|
+
const meta = parseCommandHeader(join100(scriptsDir, file2));
|
|
65334
65186
|
if (meta) {
|
|
65335
65187
|
registry2.set(meta.command, meta);
|
|
65336
65188
|
}
|
|
@@ -65621,7 +65473,7 @@ __export(validation_exports, {
|
|
|
65621
65473
|
validatePhaseTimestamps: () => validatePhaseTimestamps,
|
|
65622
65474
|
validateSessionNote: () => validateSessionNote,
|
|
65623
65475
|
validateSingleActivePhase: () => validateSingleActivePhase,
|
|
65624
|
-
validateStatusTransition: () =>
|
|
65476
|
+
validateStatusTransition: () => validateStatusTransition2,
|
|
65625
65477
|
validateTask: () => validateTask,
|
|
65626
65478
|
validateTitle: () => validateTitle2
|
|
65627
65479
|
});
|
|
@@ -66270,8 +66122,8 @@ function calculateOrchestrationOverhead(orchestratorTokens, totalSubagentTokens,
|
|
|
66270
66122
|
}
|
|
66271
66123
|
|
|
66272
66124
|
// packages/core/src/validation/docs-sync.ts
|
|
66273
|
-
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as
|
|
66274
|
-
import { join as
|
|
66125
|
+
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as readFileSync72 } from "node:fs";
|
|
66126
|
+
import { join as join101 } from "node:path";
|
|
66275
66127
|
function getScriptCommands(scriptsDir) {
|
|
66276
66128
|
if (!existsSync99(scriptsDir)) return [];
|
|
66277
66129
|
try {
|
|
@@ -66283,7 +66135,7 @@ function getScriptCommands(scriptsDir) {
|
|
|
66283
66135
|
function getIndexScripts(indexPath) {
|
|
66284
66136
|
if (!existsSync99(indexPath)) return [];
|
|
66285
66137
|
try {
|
|
66286
|
-
const content =
|
|
66138
|
+
const content = readFileSync72(indexPath, "utf-8");
|
|
66287
66139
|
const index2 = JSON.parse(content);
|
|
66288
66140
|
return index2.commands.map((cmd) => cmd.script ?? "").filter((s) => s).map((s) => s.replace(/\.sh$/, "")).sort();
|
|
66289
66141
|
} catch {
|
|
@@ -66293,7 +66145,7 @@ function getIndexScripts(indexPath) {
|
|
|
66293
66145
|
function getIndexCommands(indexPath) {
|
|
66294
66146
|
if (!existsSync99(indexPath)) return [];
|
|
66295
66147
|
try {
|
|
66296
|
-
const content =
|
|
66148
|
+
const content = readFileSync72(indexPath, "utf-8");
|
|
66297
66149
|
const index2 = JSON.parse(content);
|
|
66298
66150
|
return index2.commands.map((cmd) => cmd.name).sort();
|
|
66299
66151
|
} catch {
|
|
@@ -66330,8 +66182,8 @@ function checkWrapperSync(wrapperPath, indexPath) {
|
|
|
66330
66182
|
if (!existsSync99(wrapperPath) || !existsSync99(indexPath)) return [];
|
|
66331
66183
|
const issues = [];
|
|
66332
66184
|
try {
|
|
66333
|
-
const wrapperContent =
|
|
66334
|
-
const indexContent =
|
|
66185
|
+
const wrapperContent = readFileSync72(wrapperPath, "utf-8");
|
|
66186
|
+
const indexContent = readFileSync72(indexPath, "utf-8");
|
|
66335
66187
|
const index2 = JSON.parse(indexContent);
|
|
66336
66188
|
const match = wrapperContent.match(/_get_all_commands\(\)\s*\{[^}]*echo\s+"([^"]+)"/);
|
|
66337
66189
|
const wrapperCmds = new Set(match ? match[1].split(/\s+/).filter(Boolean) : []);
|
|
@@ -66364,16 +66216,16 @@ var CRITICAL_COMMANDS = [
|
|
|
66364
66216
|
];
|
|
66365
66217
|
function detectDrift(mode = "full", projectRoot = ".") {
|
|
66366
66218
|
const issues = [];
|
|
66367
|
-
const scriptsDir =
|
|
66368
|
-
const indexPath =
|
|
66219
|
+
const scriptsDir = join101(projectRoot, "scripts");
|
|
66220
|
+
const indexPath = join101(projectRoot, "docs/commands/COMMANDS-INDEX.json");
|
|
66369
66221
|
issues.push(...checkCommandsSync(scriptsDir, indexPath));
|
|
66370
|
-
const wrapperPath =
|
|
66222
|
+
const wrapperPath = join101(projectRoot, "installer/lib/link.sh");
|
|
66371
66223
|
issues.push(...checkWrapperSync(wrapperPath, indexPath));
|
|
66372
66224
|
if (mode === "full") {
|
|
66373
|
-
const readmePath =
|
|
66225
|
+
const readmePath = join101(projectRoot, "README.md");
|
|
66374
66226
|
if (existsSync99(readmePath)) {
|
|
66375
66227
|
try {
|
|
66376
|
-
const readme =
|
|
66228
|
+
const readme = readFileSync72(readmePath, "utf-8");
|
|
66377
66229
|
const readmeCmds = new Set(
|
|
66378
66230
|
(readme.match(/cleo [a-z-]+/g) ?? []).map((m) => m.replace("cleo ", ""))
|
|
66379
66231
|
);
|
|
@@ -66391,9 +66243,9 @@ function detectDrift(mode = "full", projectRoot = ".") {
|
|
|
66391
66243
|
}
|
|
66392
66244
|
}
|
|
66393
66245
|
}
|
|
66394
|
-
const
|
|
66246
|
+
const hasErrors2 = issues.some((i) => i.severity === "error");
|
|
66395
66247
|
const hasWarnings = issues.some((i) => i.severity === "warning");
|
|
66396
|
-
const exitCode =
|
|
66248
|
+
const exitCode = hasErrors2 ? 2 : hasWarnings ? 1 : 0;
|
|
66397
66249
|
return { mode, issues, exitCode };
|
|
66398
66250
|
}
|
|
66399
66251
|
function shouldRunDriftDetection(enabled = true, autoCheck = false, command, criticalCommands = []) {
|
|
@@ -66407,14 +66259,14 @@ function shouldRunDriftDetection(enabled = true, autoCheck = false, command, cri
|
|
|
66407
66259
|
// packages/core/src/validation/doctor/project-cache.ts
|
|
66408
66260
|
init_paths();
|
|
66409
66261
|
import { createHash as createHash10 } from "node:crypto";
|
|
66410
|
-
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as
|
|
66411
|
-
import { dirname as dirname18, join as
|
|
66262
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as readFileSync73, unlinkSync as unlinkSync7, writeFileSync as writeFileSync18 } from "node:fs";
|
|
66263
|
+
import { dirname as dirname18, join as join102 } from "node:path";
|
|
66412
66264
|
var CACHE_VERSION = "1.0.0";
|
|
66413
66265
|
var CACHE_TTL_SECONDS = 300;
|
|
66414
66266
|
var CACHE_FILE2 = "doctor-project-cache.json";
|
|
66415
66267
|
function getCacheFilePath(cleoHome) {
|
|
66416
66268
|
const home = cleoHome ?? getCleoHome();
|
|
66417
|
-
return
|
|
66269
|
+
return join102(home, CACHE_FILE2);
|
|
66418
66270
|
}
|
|
66419
66271
|
function initCacheFile(cacheFile) {
|
|
66420
66272
|
const cache = {
|
|
@@ -66432,7 +66284,7 @@ function initCacheFile(cacheFile) {
|
|
|
66432
66284
|
function loadCache(cacheFile) {
|
|
66433
66285
|
if (!existsSync100(cacheFile)) return null;
|
|
66434
66286
|
try {
|
|
66435
|
-
const content =
|
|
66287
|
+
const content = readFileSync73(cacheFile, "utf-8");
|
|
66436
66288
|
return JSON.parse(content);
|
|
66437
66289
|
} catch {
|
|
66438
66290
|
return null;
|
|
@@ -66441,7 +66293,7 @@ function loadCache(cacheFile) {
|
|
|
66441
66293
|
function getFileHash(filePath) {
|
|
66442
66294
|
if (!existsSync100(filePath)) return "";
|
|
66443
66295
|
try {
|
|
66444
|
-
const content =
|
|
66296
|
+
const content = readFileSync73(filePath);
|
|
66445
66297
|
return createHash10("sha256").update(content).digest("hex");
|
|
66446
66298
|
} catch {
|
|
66447
66299
|
return "";
|
|
@@ -66458,8 +66310,8 @@ function getCachedValidation(projectHash, projectPath, cacheFile) {
|
|
|
66458
66310
|
const now = Date.now();
|
|
66459
66311
|
const age = (now - lastValidated) / 1e3;
|
|
66460
66312
|
if (age > (entry.ttl || CACHE_TTL_SECONDS)) return null;
|
|
66461
|
-
const currentTasksDbHash = getFileHash(
|
|
66462
|
-
const currentConfigHash = getFileHash(
|
|
66313
|
+
const currentTasksDbHash = getFileHash(join102(projectPath, ".cleo", "tasks.db"));
|
|
66314
|
+
const currentConfigHash = getFileHash(join102(projectPath, ".cleo", "config.json"));
|
|
66463
66315
|
if (currentTasksDbHash !== (entry.fileHashes["tasks.db"] ?? "")) return null;
|
|
66464
66316
|
if (currentConfigHash !== (entry.fileHashes["config.json"] ?? "")) return null;
|
|
66465
66317
|
return entry;
|
|
@@ -66470,8 +66322,8 @@ function cacheValidationResult(projectHash, projectPath, validationStatus, issue
|
|
|
66470
66322
|
if (!cache) {
|
|
66471
66323
|
cache = initCacheFile(cachePath);
|
|
66472
66324
|
}
|
|
66473
|
-
const tasksDbHash = getFileHash(
|
|
66474
|
-
const configHash = getFileHash(
|
|
66325
|
+
const tasksDbHash = getFileHash(join102(projectPath, ".cleo", "tasks.db"));
|
|
66326
|
+
const configHash = getFileHash(join102(projectPath, ".cleo", "config.json"));
|
|
66475
66327
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
66476
66328
|
cache.projects[projectHash] = {
|
|
66477
66329
|
path: projectPath,
|
|
@@ -66889,7 +66741,7 @@ var STATUS_TRANSITIONS = {
|
|
|
66889
66741
|
cancelled: ["pending"],
|
|
66890
66742
|
archived: []
|
|
66891
66743
|
};
|
|
66892
|
-
function
|
|
66744
|
+
function validateStatusTransition2(oldStatus, newStatus) {
|
|
66893
66745
|
if (oldStatus === newStatus) {
|
|
66894
66746
|
return { valid: true, errors: [], warnings: [] };
|
|
66895
66747
|
}
|
|
@@ -67653,7 +67505,7 @@ async function validateAndLog(taskId, manifestPath = DEFAULT_MANIFEST_PATH, comp
|
|
|
67653
67505
|
|
|
67654
67506
|
// packages/core/src/validation/protocol-common.ts
|
|
67655
67507
|
init_src();
|
|
67656
|
-
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as
|
|
67508
|
+
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as readFileSync74 } from "node:fs";
|
|
67657
67509
|
function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
67658
67510
|
if (!existsSync102(expectedDir)) return false;
|
|
67659
67511
|
const filePattern = pattern ?? `${taskId}`;
|
|
@@ -67667,7 +67519,7 @@ function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
|
67667
67519
|
function checkDocumentationSections(filePath, sections) {
|
|
67668
67520
|
if (!existsSync102(filePath)) return false;
|
|
67669
67521
|
try {
|
|
67670
|
-
const content =
|
|
67522
|
+
const content = readFileSync74(filePath, "utf-8");
|
|
67671
67523
|
return sections.every((section) => {
|
|
67672
67524
|
const regex = new RegExp(`^#+ .*${escapeRegex3(section)}`, "m");
|
|
67673
67525
|
return regex.test(content);
|
|
@@ -67762,7 +67614,7 @@ function checkLinkedTasksPresent(entry, requiredIds) {
|
|
|
67762
67614
|
function checkProvenanceTags(filePath, taskId) {
|
|
67763
67615
|
if (!existsSync102(filePath)) return false;
|
|
67764
67616
|
try {
|
|
67765
|
-
const content =
|
|
67617
|
+
const content = readFileSync74(filePath, "utf-8");
|
|
67766
67618
|
if (taskId) {
|
|
67767
67619
|
return content.includes(`@task ${taskId}`);
|
|
67768
67620
|
}
|
|
@@ -68424,13 +68276,13 @@ import { randomUUID as randomUUID7 } from "node:crypto";
|
|
|
68424
68276
|
|
|
68425
68277
|
// packages/core/src/sessions/context-alert.ts
|
|
68426
68278
|
init_paths();
|
|
68427
|
-
import { existsSync as existsSync104, readFileSync as
|
|
68428
|
-
import { join as
|
|
68279
|
+
import { existsSync as existsSync104, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
|
|
68280
|
+
import { join as join104 } from "node:path";
|
|
68429
68281
|
function getCurrentSessionId(cwd) {
|
|
68430
68282
|
if (process.env.CLEO_SESSION) return process.env.CLEO_SESSION;
|
|
68431
|
-
const sessionFile =
|
|
68283
|
+
const sessionFile = join104(getCleoDir(cwd), ".current-session");
|
|
68432
68284
|
if (existsSync104(sessionFile)) {
|
|
68433
|
-
return
|
|
68285
|
+
return readFileSync76(sessionFile, "utf-8").trim() || null;
|
|
68434
68286
|
}
|
|
68435
68287
|
return null;
|
|
68436
68288
|
}
|
|
@@ -68522,13 +68374,13 @@ init_paths();
|
|
|
68522
68374
|
|
|
68523
68375
|
// packages/core/src/project-info.ts
|
|
68524
68376
|
init_paths();
|
|
68525
|
-
import { existsSync as existsSync105, readFileSync as
|
|
68377
|
+
import { existsSync as existsSync105, readFileSync as readFileSync77, writeFileSync as writeFileSync20 } from "node:fs";
|
|
68526
68378
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
68527
|
-
import { join as
|
|
68379
|
+
import { join as join105 } from "node:path";
|
|
68528
68380
|
async function getProjectInfo(cwd) {
|
|
68529
68381
|
const projectRoot = cwd ?? process.cwd();
|
|
68530
68382
|
const cleoDir = getCleoDirAbsolute(projectRoot);
|
|
68531
|
-
const infoPath =
|
|
68383
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68532
68384
|
const raw = await readFile18(infoPath, "utf-8");
|
|
68533
68385
|
const data = JSON.parse(raw);
|
|
68534
68386
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
@@ -68546,10 +68398,10 @@ async function getProjectInfo(cwd) {
|
|
|
68546
68398
|
function getProjectInfoSync(cwd) {
|
|
68547
68399
|
const projectRoot = cwd ?? process.cwd();
|
|
68548
68400
|
const cleoDir = getCleoDirAbsolute(projectRoot);
|
|
68549
|
-
const infoPath =
|
|
68401
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68550
68402
|
if (!existsSync105(infoPath)) return null;
|
|
68551
68403
|
try {
|
|
68552
|
-
const raw =
|
|
68404
|
+
const raw = readFileSync77(infoPath, "utf-8");
|
|
68553
68405
|
const data = JSON.parse(raw);
|
|
68554
68406
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
68555
68407
|
return null;
|
|
@@ -68568,9 +68420,9 @@ function getProjectInfoSync(cwd) {
|
|
|
68568
68420
|
}
|
|
68569
68421
|
function updateProjectName(cwd, name2) {
|
|
68570
68422
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
68571
|
-
const infoPath =
|
|
68423
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68572
68424
|
if (!existsSync105(infoPath)) return;
|
|
68573
|
-
const data = JSON.parse(
|
|
68425
|
+
const data = JSON.parse(readFileSync77(infoPath, "utf-8"));
|
|
68574
68426
|
data.projectName = name2;
|
|
68575
68427
|
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
68576
68428
|
writeFileSync20(infoPath, `${JSON.stringify(data, null, 2)}
|
|
@@ -68584,10 +68436,10 @@ init_adapters();
|
|
|
68584
68436
|
// packages/core/src/bootstrap.ts
|
|
68585
68437
|
init_paths();
|
|
68586
68438
|
init_scaffold();
|
|
68587
|
-
import { existsSync as existsSync106, readFileSync as
|
|
68439
|
+
import { existsSync as existsSync106, readFileSync as readFileSync78 } from "node:fs";
|
|
68588
68440
|
import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
|
|
68589
68441
|
import { homedir as homedir6 } from "node:os";
|
|
68590
|
-
import { join as
|
|
68442
|
+
import { join as join106 } from "node:path";
|
|
68591
68443
|
async function bootstrapGlobalCleo(options) {
|
|
68592
68444
|
const ctx = {
|
|
68593
68445
|
created: [],
|
|
@@ -68600,7 +68452,6 @@ async function bootstrapGlobalCleo(options) {
|
|
|
68600
68452
|
}
|
|
68601
68453
|
await ensureGlobalTemplatesBootstrap(ctx, options?.packageRoot);
|
|
68602
68454
|
await injectAgentsHub(ctx);
|
|
68603
|
-
await installMcpToProviders(ctx);
|
|
68604
68455
|
await installSkillsGlobally(ctx);
|
|
68605
68456
|
await installAgentDefinitionGlobally(ctx);
|
|
68606
68457
|
await installProviderAdapters(ctx, options?.packageRoot);
|
|
@@ -68622,9 +68473,9 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
68622
68473
|
let templateContent = null;
|
|
68623
68474
|
try {
|
|
68624
68475
|
const pkgRoot = packageRootOverride ?? getPackageRoot();
|
|
68625
|
-
const templatePath =
|
|
68476
|
+
const templatePath = join106(pkgRoot, "templates", "CLEO-INJECTION.md");
|
|
68626
68477
|
if (existsSync106(templatePath)) {
|
|
68627
|
-
templateContent =
|
|
68478
|
+
templateContent = readFileSync78(templatePath, "utf-8");
|
|
68628
68479
|
}
|
|
68629
68480
|
} catch {
|
|
68630
68481
|
}
|
|
@@ -68641,15 +68492,15 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
68641
68492
|
ctx.warnings.push("Could not refresh CLEO-INJECTION.md template");
|
|
68642
68493
|
return;
|
|
68643
68494
|
}
|
|
68644
|
-
const xdgDest =
|
|
68495
|
+
const xdgDest = join106(globalTemplatesDir, "CLEO-INJECTION.md");
|
|
68645
68496
|
const xdgWritten = await writeTemplateTo(templateContent, xdgDest, ctx.isDryRun);
|
|
68646
68497
|
ctx.created.push(
|
|
68647
68498
|
`${getCleoTemplatesTildePath()}/CLEO-INJECTION.md (${xdgWritten ? "refreshed" : "would refresh"})`
|
|
68648
68499
|
);
|
|
68649
68500
|
const home = homedir6();
|
|
68650
|
-
const legacyTemplatesDir =
|
|
68651
|
-
if (legacyTemplatesDir !== globalTemplatesDir && existsSync106(
|
|
68652
|
-
const legacyDest =
|
|
68501
|
+
const legacyTemplatesDir = join106(home, ".cleo", "templates");
|
|
68502
|
+
if (legacyTemplatesDir !== globalTemplatesDir && existsSync106(join106(home, ".cleo"))) {
|
|
68503
|
+
const legacyDest = join106(legacyTemplatesDir, "CLEO-INJECTION.md");
|
|
68653
68504
|
const legacyWritten = await writeTemplateTo(templateContent, legacyDest, ctx.isDryRun);
|
|
68654
68505
|
if (legacyWritten) {
|
|
68655
68506
|
ctx.created.push("~/.cleo/templates/CLEO-INJECTION.md (legacy sync)");
|
|
@@ -68668,7 +68519,7 @@ function sanitizeCaampFile(content) {
|
|
|
68668
68519
|
}
|
|
68669
68520
|
async function injectAgentsHub(ctx) {
|
|
68670
68521
|
const globalAgentsDir = getAgentsHome();
|
|
68671
|
-
const globalAgentsMd =
|
|
68522
|
+
const globalAgentsMd = join106(globalAgentsDir, "AGENTS.md");
|
|
68672
68523
|
try {
|
|
68673
68524
|
const { inject: inject2, getInstalledProviders: getInstalledProviders3, injectAll: injectAll2, buildInjectionContent } = await import("@cleocode/caamp");
|
|
68674
68525
|
if (!ctx.isDryRun) {
|
|
@@ -68708,7 +68559,7 @@ async function injectAgentsHub(ctx) {
|
|
|
68708
68559
|
});
|
|
68709
68560
|
if (!ctx.isDryRun) {
|
|
68710
68561
|
for (const provider of providers) {
|
|
68711
|
-
const instructFilePath =
|
|
68562
|
+
const instructFilePath = join106(provider.pathGlobal, provider.instructFile);
|
|
68712
68563
|
if (existsSync106(instructFilePath)) {
|
|
68713
68564
|
const fileContent = await readFile19(instructFilePath, "utf8");
|
|
68714
68565
|
const stripped = fileContent.replace(
|
|
@@ -68727,7 +68578,7 @@ async function injectAgentsHub(ctx) {
|
|
|
68727
68578
|
}
|
|
68728
68579
|
} else {
|
|
68729
68580
|
for (const p of providers) {
|
|
68730
|
-
const displayPath =
|
|
68581
|
+
const displayPath = join106(p.pathGlobal, p.instructFile).replace(homedir6(), "~");
|
|
68731
68582
|
ctx.created.push(`${displayPath} (would update CAAMP block)`);
|
|
68732
68583
|
}
|
|
68733
68584
|
}
|
|
@@ -68736,37 +68587,6 @@ async function injectAgentsHub(ctx) {
|
|
|
68736
68587
|
ctx.warnings.push(`CAAMP injection: ${err instanceof Error ? err.message : String(err)}`);
|
|
68737
68588
|
}
|
|
68738
68589
|
}
|
|
68739
|
-
async function installMcpToProviders(ctx) {
|
|
68740
|
-
try {
|
|
68741
|
-
const { detectEnvMode: detectEnvMode2, generateMcpServerEntry: generateMcpServerEntry2, getMcpServerName: getMcpServerName2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
|
|
68742
|
-
const { getInstalledProviders: getInstalledProviders3, installMcpServerToAll } = await import("@cleocode/caamp");
|
|
68743
|
-
const env = detectEnvMode2();
|
|
68744
|
-
const serverEntry = generateMcpServerEntry2(env);
|
|
68745
|
-
const serverName = getMcpServerName2(env);
|
|
68746
|
-
const providers = getInstalledProviders3();
|
|
68747
|
-
if (providers.length > 0) {
|
|
68748
|
-
if (!ctx.isDryRun) {
|
|
68749
|
-
const results = await installMcpServerToAll(
|
|
68750
|
-
providers,
|
|
68751
|
-
serverName,
|
|
68752
|
-
serverEntry,
|
|
68753
|
-
"global",
|
|
68754
|
-
homedir6()
|
|
68755
|
-
);
|
|
68756
|
-
const successes = results.filter((r) => r.success);
|
|
68757
|
-
if (successes.length > 0) {
|
|
68758
|
-
ctx.created.push(
|
|
68759
|
-
`MCP configs: ${successes.map((r) => r.provider.id).join(", ")}`
|
|
68760
|
-
);
|
|
68761
|
-
}
|
|
68762
|
-
} else {
|
|
68763
|
-
ctx.created.push("MCP configs (would update)");
|
|
68764
|
-
}
|
|
68765
|
-
}
|
|
68766
|
-
} catch {
|
|
68767
|
-
ctx.warnings.push("MCP config update skipped (non-critical)");
|
|
68768
|
-
}
|
|
68769
|
-
}
|
|
68770
68590
|
async function installSkillsGlobally(ctx) {
|
|
68771
68591
|
try {
|
|
68772
68592
|
if (!ctx.isDryRun) {
|
|
@@ -68832,8 +68652,8 @@ async function installProviderAdapters(ctx, packageRootOverride) {
|
|
|
68832
68652
|
async function verifyBootstrapHealth(ctx) {
|
|
68833
68653
|
if (ctx.isDryRun) return;
|
|
68834
68654
|
try {
|
|
68835
|
-
const xdgTemplatePath =
|
|
68836
|
-
const agentsMd =
|
|
68655
|
+
const xdgTemplatePath = join106(getCleoTemplatesDir(), "CLEO-INJECTION.md");
|
|
68656
|
+
const agentsMd = join106(getAgentsHome(), "AGENTS.md");
|
|
68837
68657
|
if (!existsSync106(xdgTemplatePath)) {
|
|
68838
68658
|
ctx.warnings.push("Health: XDG template missing after bootstrap");
|
|
68839
68659
|
return;
|
|
@@ -68841,7 +68661,7 @@ async function verifyBootstrapHealth(ctx) {
|
|
|
68841
68661
|
const xdgContent = await readFile19(xdgTemplatePath, "utf8");
|
|
68842
68662
|
const xdgVersion = xdgContent.match(/^Version:\s*(.+)$/m)?.[1]?.trim();
|
|
68843
68663
|
const home = homedir6();
|
|
68844
|
-
const legacyTemplatePath =
|
|
68664
|
+
const legacyTemplatePath = join106(home, ".cleo", "templates", "CLEO-INJECTION.md");
|
|
68845
68665
|
if (existsSync106(legacyTemplatePath)) {
|
|
68846
68666
|
const legacyContent = await readFile19(legacyTemplatePath, "utf8");
|
|
68847
68667
|
const legacyVersion = legacyContent.match(/^Version:\s*(.+)$/m)?.[1]?.trim();
|
|
@@ -69394,7 +69214,6 @@ export {
|
|
|
69394
69214
|
conduit_exports as conduit,
|
|
69395
69215
|
context_exports as context,
|
|
69396
69216
|
hooks_exports as coreHooks,
|
|
69397
|
-
mcp_exports as coreMcp,
|
|
69398
69217
|
createDataAccessor,
|
|
69399
69218
|
createErrorResult,
|
|
69400
69219
|
createPage,
|