@cleocode/core 2026.4.0 → 2026.4.2
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 +645 -1038
- 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 +4 -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/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/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 +3 -6
- 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/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/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();
|
|
@@ -23854,7 +23802,7 @@ function checkInjection2(projectRoot) {
|
|
|
23854
23802
|
const missing = [];
|
|
23855
23803
|
for (const ref of refs) {
|
|
23856
23804
|
const rawPath = ref.slice(1).trim();
|
|
23857
|
-
const resolvedPath = rawPath.startsWith("~/") ? join40(homedir2(), rawPath.slice(2)) : join40(projectRoot, rawPath);
|
|
23805
|
+
const resolvedPath = rawPath.startsWith("~/") || rawPath.startsWith("~\\") ? join40(homedir2(), rawPath.slice(2)) : join40(projectRoot, rawPath);
|
|
23858
23806
|
if (!existsSync37(resolvedPath)) {
|
|
23859
23807
|
missing.push(rawPath);
|
|
23860
23808
|
}
|
|
@@ -24021,7 +23969,7 @@ function getCleoVersion() {
|
|
|
24021
23969
|
}
|
|
24022
23970
|
function isCleoContributorProject(projectRoot) {
|
|
24023
23971
|
const exists2 = (p) => existsSync38(join41(projectRoot, p));
|
|
24024
|
-
if (!exists2("src/
|
|
23972
|
+
if (!exists2("src/dispatch") || !exists2("src/core")) return false;
|
|
24025
23973
|
try {
|
|
24026
23974
|
const pkg = JSON.parse(readFileSync24(join41(projectRoot, "package.json"), "utf-8"));
|
|
24027
23975
|
return pkg.name === "@cleocode/cleo";
|
|
@@ -24183,46 +24131,10 @@ async function ensureProjectInfo(projectRoot, opts) {
|
|
|
24183
24131
|
return { action: "created", path: projectInfoPath };
|
|
24184
24132
|
}
|
|
24185
24133
|
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
24134
|
return {
|
|
24223
|
-
action:
|
|
24224
|
-
path:
|
|
24225
|
-
details
|
|
24135
|
+
action: "skipped",
|
|
24136
|
+
path: projectRoot,
|
|
24137
|
+
details: "Removed (Phase 2 production readiness)"
|
|
24226
24138
|
};
|
|
24227
24139
|
}
|
|
24228
24140
|
async function ensureProjectContext(projectRoot, opts) {
|
|
@@ -24736,7 +24648,7 @@ function checkGlobalHome() {
|
|
|
24736
24648
|
status: "failed",
|
|
24737
24649
|
message: "Global ~/.cleo/ directory not found",
|
|
24738
24650
|
details: { path: cleoHome, exists: false },
|
|
24739
|
-
fix: "cleo init
|
|
24651
|
+
fix: "cleo init"
|
|
24740
24652
|
};
|
|
24741
24653
|
}
|
|
24742
24654
|
const missingDirs = REQUIRED_GLOBAL_SUBDIRS.filter((dir) => !existsSync38(join41(cleoHome, dir)));
|
|
@@ -24769,7 +24681,7 @@ function checkGlobalTemplates() {
|
|
|
24769
24681
|
status: "failed",
|
|
24770
24682
|
message: "CLEO-INJECTION.md template not found in global templates",
|
|
24771
24683
|
details: { path: injectionPath, exists: false },
|
|
24772
|
-
fix: "cleo init
|
|
24684
|
+
fix: "cleo init"
|
|
24773
24685
|
};
|
|
24774
24686
|
}
|
|
24775
24687
|
const xdgContent = readFileSync24(injectionPath, "utf-8");
|
|
@@ -24897,119 +24809,14 @@ backups/
|
|
|
24897
24809
|
}
|
|
24898
24810
|
});
|
|
24899
24811
|
|
|
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
24812
|
// packages/core/src/sessions/session-enforcement.ts
|
|
25006
|
-
import { existsSync as existsSync42, readFileSync as
|
|
25007
|
-
import { join as
|
|
24813
|
+
import { existsSync as existsSync42, readFileSync as readFileSync26 } from "node:fs";
|
|
24814
|
+
import { join as join46 } from "node:path";
|
|
25008
24815
|
function readConfigValueSync(path2, defaultValue, cwd) {
|
|
25009
24816
|
try {
|
|
25010
|
-
const configPath =
|
|
24817
|
+
const configPath = join46(getCleoDir(cwd), "config.json");
|
|
25011
24818
|
if (!existsSync42(configPath)) return defaultValue;
|
|
25012
|
-
const config2 = JSON.parse(
|
|
24819
|
+
const config2 = JSON.parse(readFileSync26(configPath, "utf-8"));
|
|
25013
24820
|
const keys = path2.split(".");
|
|
25014
24821
|
let value = config2;
|
|
25015
24822
|
for (const key of keys) {
|
|
@@ -25974,16 +25781,16 @@ import {
|
|
|
25974
25781
|
existsSync as existsSync50,
|
|
25975
25782
|
mkdirSync as mkdirSync12,
|
|
25976
25783
|
readdirSync as readdirSync21,
|
|
25977
|
-
readFileSync as
|
|
25784
|
+
readFileSync as readFileSync32,
|
|
25978
25785
|
rmSync as rmSync2,
|
|
25979
25786
|
statSync as statSync11,
|
|
25980
25787
|
writeFileSync as writeFileSync5
|
|
25981
25788
|
} from "node:fs";
|
|
25982
|
-
import { join as
|
|
25789
|
+
import { join as join54 } from "node:path";
|
|
25983
25790
|
function detectLegacyAgentOutputs(projectRoot, cleoDir) {
|
|
25984
|
-
const hasResearchOutputs = existsSync50(
|
|
25985
|
-
const hasLegacyAgentOutputs = existsSync50(
|
|
25986
|
-
const hasCanonical = existsSync50(
|
|
25791
|
+
const hasResearchOutputs = existsSync50(join54(projectRoot, "claudedocs", "research-outputs"));
|
|
25792
|
+
const hasLegacyAgentOutputs = existsSync50(join54(projectRoot, "claudedocs", "agent-outputs"));
|
|
25793
|
+
const hasCanonical = existsSync50(join54(cleoDir, "agent-outputs"));
|
|
25987
25794
|
const legacyPaths = [];
|
|
25988
25795
|
if (hasResearchOutputs) legacyPaths.push("claudedocs/research-outputs/");
|
|
25989
25796
|
if (hasLegacyAgentOutputs) legacyPaths.push("claudedocs/agent-outputs/");
|
|
@@ -26006,7 +25813,7 @@ function migrateAgentOutputs(projectRoot, cleoDir) {
|
|
|
26006
25813
|
summary: "No legacy output directories found"
|
|
26007
25814
|
};
|
|
26008
25815
|
}
|
|
26009
|
-
const newDir =
|
|
25816
|
+
const newDir = join54(cleoDir, "agent-outputs");
|
|
26010
25817
|
const hadCanonical = detection.hasCanonical;
|
|
26011
25818
|
mkdirSync12(newDir, { recursive: true });
|
|
26012
25819
|
let totalCopied = 0;
|
|
@@ -26014,11 +25821,11 @@ function migrateAgentOutputs(projectRoot, cleoDir) {
|
|
|
26014
25821
|
const copiedFiles = /* @__PURE__ */ new Set();
|
|
26015
25822
|
const legacySources = [
|
|
26016
25823
|
{
|
|
26017
|
-
path:
|
|
25824
|
+
path: join54(projectRoot, "claudedocs", "research-outputs"),
|
|
26018
25825
|
exists: detection.hasResearchOutputs
|
|
26019
25826
|
},
|
|
26020
25827
|
{
|
|
26021
|
-
path:
|
|
25828
|
+
path: join54(projectRoot, "claudedocs", "agent-outputs"),
|
|
26022
25829
|
exists: detection.hasLegacyAgentOutputs
|
|
26023
25830
|
}
|
|
26024
25831
|
];
|
|
@@ -26045,11 +25852,11 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26045
25852
|
const entries = readdirSync21(srcDir);
|
|
26046
25853
|
for (const entry of entries) {
|
|
26047
25854
|
if (entry === "MANIFEST.jsonl") {
|
|
26048
|
-
collectManifestLines(
|
|
25855
|
+
collectManifestLines(join54(srcDir, entry), manifestLines);
|
|
26049
25856
|
continue;
|
|
26050
25857
|
}
|
|
26051
|
-
const srcPath =
|
|
26052
|
-
const dstPath =
|
|
25858
|
+
const srcPath = join54(srcDir, entry);
|
|
25859
|
+
const dstPath = join54(dstDir, entry);
|
|
26053
25860
|
try {
|
|
26054
25861
|
const st = statSync11(srcPath);
|
|
26055
25862
|
if (st.isDirectory()) {
|
|
@@ -26057,7 +25864,7 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26057
25864
|
for (const sf of readdirSync21(srcPath)) {
|
|
26058
25865
|
if (!copiedFiles.has(sf)) {
|
|
26059
25866
|
try {
|
|
26060
|
-
copyFileSync5(
|
|
25867
|
+
copyFileSync5(join54(srcPath, sf), join54(dstPath, sf));
|
|
26061
25868
|
copiedFiles.add(sf);
|
|
26062
25869
|
count2++;
|
|
26063
25870
|
} catch {
|
|
@@ -26076,7 +25883,7 @@ function copyDirContents(srcDir, dstDir, manifestLines, copiedFiles) {
|
|
|
26076
25883
|
}
|
|
26077
25884
|
function collectManifestLines(manifestPath, out) {
|
|
26078
25885
|
try {
|
|
26079
|
-
const content =
|
|
25886
|
+
const content = readFileSync32(manifestPath, "utf-8");
|
|
26080
25887
|
for (const line2 of content.split("\n")) {
|
|
26081
25888
|
if (!line2.trim()) continue;
|
|
26082
25889
|
let rewritten = line2;
|
|
@@ -26089,11 +25896,11 @@ function collectManifestLines(manifestPath, out) {
|
|
|
26089
25896
|
}
|
|
26090
25897
|
}
|
|
26091
25898
|
function mergeManifests(newDir, hadCanonical, legacyLines) {
|
|
26092
|
-
const manifestPath =
|
|
25899
|
+
const manifestPath = join54(newDir, "MANIFEST.jsonl");
|
|
26093
25900
|
const existingLines = [];
|
|
26094
25901
|
if (hadCanonical && existsSync50(manifestPath)) {
|
|
26095
25902
|
try {
|
|
26096
|
-
const existing =
|
|
25903
|
+
const existing = readFileSync32(manifestPath, "utf-8");
|
|
26097
25904
|
for (const line2 of existing.split("\n")) {
|
|
26098
25905
|
if (line2.trim()) existingLines.push(line2);
|
|
26099
25906
|
}
|
|
@@ -26125,10 +25932,10 @@ function mergeManifests(newDir, hadCanonical, legacyLines) {
|
|
|
26125
25932
|
return finalLines.length;
|
|
26126
25933
|
}
|
|
26127
25934
|
function updateConfigPaths(cleoDir) {
|
|
26128
|
-
const configPath =
|
|
25935
|
+
const configPath = join54(cleoDir, "config.json");
|
|
26129
25936
|
if (!existsSync50(configPath)) return;
|
|
26130
25937
|
try {
|
|
26131
|
-
const config2 = JSON.parse(
|
|
25938
|
+
const config2 = JSON.parse(readFileSync32(configPath, "utf-8"));
|
|
26132
25939
|
const currentDir = config2.agentOutputs?.directory ?? config2.agentOutputs ?? config2.research?.outputDir;
|
|
26133
25940
|
if (currentDir && currentDir !== CANONICAL_DIR) {
|
|
26134
25941
|
if (typeof config2.agentOutputs === "object") {
|
|
@@ -26151,19 +25958,19 @@ function removeLegacyDirs(projectRoot, detection) {
|
|
|
26151
25958
|
const removed = [];
|
|
26152
25959
|
if (detection.hasResearchOutputs) {
|
|
26153
25960
|
try {
|
|
26154
|
-
rmSync2(
|
|
25961
|
+
rmSync2(join54(projectRoot, "claudedocs", "research-outputs"), { recursive: true, force: true });
|
|
26155
25962
|
removed.push("claudedocs/research-outputs/");
|
|
26156
25963
|
} catch {
|
|
26157
25964
|
}
|
|
26158
25965
|
}
|
|
26159
25966
|
if (detection.hasLegacyAgentOutputs) {
|
|
26160
25967
|
try {
|
|
26161
|
-
rmSync2(
|
|
25968
|
+
rmSync2(join54(projectRoot, "claudedocs", "agent-outputs"), { recursive: true, force: true });
|
|
26162
25969
|
removed.push("claudedocs/agent-outputs/");
|
|
26163
25970
|
} catch {
|
|
26164
25971
|
}
|
|
26165
25972
|
}
|
|
26166
|
-
const claudedocsDir =
|
|
25973
|
+
const claudedocsDir = join54(projectRoot, "claudedocs");
|
|
26167
25974
|
if (existsSync50(claudedocsDir)) {
|
|
26168
25975
|
try {
|
|
26169
25976
|
if (readdirSync21(claudedocsDir).length === 0) {
|
|
@@ -26193,8 +26000,8 @@ __export(migrate_json_to_sqlite_exports, {
|
|
|
26193
26000
|
migrateJsonToSqlite: () => migrateJsonToSqlite
|
|
26194
26001
|
});
|
|
26195
26002
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
26196
|
-
import { existsSync as existsSync55, readFileSync as
|
|
26197
|
-
import { join as
|
|
26003
|
+
import { existsSync as existsSync55, readFileSync as readFileSync37, renameSync as renameSync4 } from "node:fs";
|
|
26004
|
+
import { join as join60 } from "node:path";
|
|
26198
26005
|
import { sql as sql10 } from "drizzle-orm";
|
|
26199
26006
|
async function migrateJsonToSqlite() {
|
|
26200
26007
|
const jsonPath = getRegistryPath();
|
|
@@ -26202,7 +26009,7 @@ async function migrateJsonToSqlite() {
|
|
|
26202
26009
|
const logger = getLogger("nexus");
|
|
26203
26010
|
let raw;
|
|
26204
26011
|
try {
|
|
26205
|
-
raw =
|
|
26012
|
+
raw = readFileSync37(jsonPath, "utf-8");
|
|
26206
26013
|
} catch {
|
|
26207
26014
|
return 0;
|
|
26208
26015
|
}
|
|
@@ -26226,9 +26033,9 @@ async function migrateJsonToSqlite() {
|
|
|
26226
26033
|
if (!projectPath || !projectHash) continue;
|
|
26227
26034
|
let projectId = randomUUID3();
|
|
26228
26035
|
try {
|
|
26229
|
-
const infoPath =
|
|
26036
|
+
const infoPath = join60(projectPath, ".cleo", "project-info.json");
|
|
26230
26037
|
if (existsSync55(infoPath)) {
|
|
26231
|
-
const info = JSON.parse(
|
|
26038
|
+
const info = JSON.parse(readFileSync37(infoPath, "utf-8"));
|
|
26232
26039
|
if (typeof info["projectId"] === "string" && info["projectId"]) {
|
|
26233
26040
|
projectId = info["projectId"];
|
|
26234
26041
|
}
|
|
@@ -26298,15 +26105,15 @@ __export(registry_exports3, {
|
|
|
26298
26105
|
});
|
|
26299
26106
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
26300
26107
|
import { mkdir as mkdir12 } from "node:fs/promises";
|
|
26301
|
-
import { basename as basename8, join as
|
|
26108
|
+
import { basename as basename8, join as join61 } from "node:path";
|
|
26302
26109
|
function getNexusHome() {
|
|
26303
|
-
return process.env["NEXUS_HOME"] ??
|
|
26110
|
+
return process.env["NEXUS_HOME"] ?? join61(getCleoHome(), "nexus");
|
|
26304
26111
|
}
|
|
26305
26112
|
function getNexusCacheDir() {
|
|
26306
|
-
return process.env["NEXUS_CACHE_DIR"] ??
|
|
26113
|
+
return process.env["NEXUS_CACHE_DIR"] ?? join61(getNexusHome(), "cache");
|
|
26307
26114
|
}
|
|
26308
26115
|
function getRegistryPath() {
|
|
26309
|
-
return process.env["NEXUS_REGISTRY_FILE"] ??
|
|
26116
|
+
return process.env["NEXUS_REGISTRY_FILE"] ?? join61(getCleoHome(), "projects-registry.json");
|
|
26310
26117
|
}
|
|
26311
26118
|
function rowToProject(row) {
|
|
26312
26119
|
let labels = [];
|
|
@@ -26423,10 +26230,10 @@ async function readProjectMeta(projectPath) {
|
|
|
26423
26230
|
}
|
|
26424
26231
|
async function readProjectId(projectPath) {
|
|
26425
26232
|
try {
|
|
26426
|
-
const { readFileSync:
|
|
26427
|
-
const infoPath =
|
|
26233
|
+
const { readFileSync: readFileSync79, existsSync: existsSync107 } = await import("node:fs");
|
|
26234
|
+
const infoPath = join61(projectPath, ".cleo", "project-info.json");
|
|
26428
26235
|
if (!existsSync107(infoPath)) return "";
|
|
26429
|
-
const data = JSON.parse(
|
|
26236
|
+
const data = JSON.parse(readFileSync79(infoPath, "utf-8"));
|
|
26430
26237
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
26431
26238
|
} catch {
|
|
26432
26239
|
return "";
|
|
@@ -27362,10 +27169,10 @@ var init_update2 = __esm({
|
|
|
27362
27169
|
// packages/core/src/hooks.ts
|
|
27363
27170
|
import { existsSync as existsSync86 } from "node:fs";
|
|
27364
27171
|
import { chmod, copyFile as copyFile2, mkdir as mkdir14, readFile as readFile14 } from "node:fs/promises";
|
|
27365
|
-
import { join as
|
|
27172
|
+
import { join as join89 } from "node:path";
|
|
27366
27173
|
async function ensureGitHooks(projectRoot, opts) {
|
|
27367
|
-
const gitDir =
|
|
27368
|
-
const gitHooksDir =
|
|
27174
|
+
const gitDir = join89(projectRoot, ".git");
|
|
27175
|
+
const gitHooksDir = join89(gitDir, "hooks");
|
|
27369
27176
|
if (!existsSync86(gitDir)) {
|
|
27370
27177
|
return {
|
|
27371
27178
|
action: "skipped",
|
|
@@ -27374,7 +27181,7 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27374
27181
|
};
|
|
27375
27182
|
}
|
|
27376
27183
|
const packageRoot = getPackageRoot();
|
|
27377
|
-
const sourceDir =
|
|
27184
|
+
const sourceDir = join89(packageRoot, "templates", "git-hooks");
|
|
27378
27185
|
if (!existsSync86(sourceDir)) {
|
|
27379
27186
|
return {
|
|
27380
27187
|
action: "skipped",
|
|
@@ -27387,8 +27194,8 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27387
27194
|
let installedCount = 0;
|
|
27388
27195
|
const errors = [];
|
|
27389
27196
|
for (const hook of MANAGED_HOOKS) {
|
|
27390
|
-
const sourcePath =
|
|
27391
|
-
const destPath =
|
|
27197
|
+
const sourcePath = join89(sourceDir, hook);
|
|
27198
|
+
const destPath = join89(gitHooksDir, hook);
|
|
27392
27199
|
if (!existsSync86(sourcePath)) {
|
|
27393
27200
|
continue;
|
|
27394
27201
|
}
|
|
@@ -27426,13 +27233,13 @@ async function ensureGitHooks(projectRoot, opts) {
|
|
|
27426
27233
|
};
|
|
27427
27234
|
}
|
|
27428
27235
|
async function checkGitHooks(projectRoot) {
|
|
27429
|
-
const gitHooksDir =
|
|
27236
|
+
const gitHooksDir = join89(projectRoot, ".git", "hooks");
|
|
27430
27237
|
const packageRoot = getPackageRoot();
|
|
27431
|
-
const sourceDir =
|
|
27238
|
+
const sourceDir = join89(packageRoot, "templates", "git-hooks");
|
|
27432
27239
|
const results = [];
|
|
27433
27240
|
for (const hook of MANAGED_HOOKS) {
|
|
27434
|
-
const sourcePath =
|
|
27435
|
-
const installedPath =
|
|
27241
|
+
const sourcePath = join89(sourceDir, hook);
|
|
27242
|
+
const installedPath = join89(gitHooksDir, hook);
|
|
27436
27243
|
const result = {
|
|
27437
27244
|
hook,
|
|
27438
27245
|
installed: false,
|
|
@@ -27485,10 +27292,10 @@ __export(init_exports, {
|
|
|
27485
27292
|
isAutoInitEnabled: () => isAutoInitEnabled,
|
|
27486
27293
|
updateDocs: () => updateDocs
|
|
27487
27294
|
});
|
|
27488
|
-
import { existsSync as existsSync103, readdirSync as readdirSync35, readFileSync as
|
|
27295
|
+
import { existsSync as existsSync103, readdirSync as readdirSync35, readFileSync as readFileSync75 } from "node:fs";
|
|
27489
27296
|
import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
|
|
27490
27297
|
import { platform as platform4 } from "node:os";
|
|
27491
|
-
import { basename as basename17, dirname as dirname20, join as
|
|
27298
|
+
import { basename as basename17, dirname as dirname20, join as join103 } from "node:path";
|
|
27492
27299
|
async function initAgentDefinition(created, warnings) {
|
|
27493
27300
|
let agentSourceDir = null;
|
|
27494
27301
|
try {
|
|
@@ -27496,7 +27303,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27496
27303
|
const req = createRequire7(import.meta.url);
|
|
27497
27304
|
const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
|
|
27498
27305
|
const agentsPkgRoot = dirname20(agentsPkgMain);
|
|
27499
|
-
const candidate =
|
|
27306
|
+
const candidate = join103(agentsPkgRoot, "cleo-subagent");
|
|
27500
27307
|
if (existsSync103(candidate)) {
|
|
27501
27308
|
agentSourceDir = candidate;
|
|
27502
27309
|
}
|
|
@@ -27504,7 +27311,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27504
27311
|
}
|
|
27505
27312
|
if (!agentSourceDir) {
|
|
27506
27313
|
const packageRoot = getPackageRoot();
|
|
27507
|
-
const bundled =
|
|
27314
|
+
const bundled = join103(packageRoot, "agents", "cleo-subagent");
|
|
27508
27315
|
if (existsSync103(bundled)) {
|
|
27509
27316
|
agentSourceDir = bundled;
|
|
27510
27317
|
}
|
|
@@ -27513,7 +27320,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27513
27320
|
warnings.push("agents/cleo-subagent/ not found in package, skipping agent definition install");
|
|
27514
27321
|
return;
|
|
27515
27322
|
}
|
|
27516
|
-
const globalAgentsDir =
|
|
27323
|
+
const globalAgentsDir = join103(getAgentsHome(), "agents", "cleo-subagent");
|
|
27517
27324
|
await mkdir16(dirname20(globalAgentsDir), { recursive: true });
|
|
27518
27325
|
try {
|
|
27519
27326
|
try {
|
|
@@ -27537,7 +27344,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27537
27344
|
await mkdir16(globalAgentsDir, { recursive: true });
|
|
27538
27345
|
const files = readdirSync35(agentSourceDir);
|
|
27539
27346
|
for (const file2 of files) {
|
|
27540
|
-
await copyFile3(
|
|
27347
|
+
await copyFile3(join103(agentSourceDir, file2), join103(globalAgentsDir, file2));
|
|
27541
27348
|
}
|
|
27542
27349
|
created.push("agent: cleo-subagent (copied)");
|
|
27543
27350
|
} catch (copyErr) {
|
|
@@ -27547,37 +27354,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
27547
27354
|
}
|
|
27548
27355
|
}
|
|
27549
27356
|
}
|
|
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
|
-
}
|
|
27357
|
+
async function initMcpServer(_projectRoot, _created, _warnings) {
|
|
27581
27358
|
}
|
|
27582
27359
|
async function initCoreSkills(created, warnings) {
|
|
27583
27360
|
try {
|
|
@@ -27593,19 +27370,19 @@ async function initCoreSkills(created, warnings) {
|
|
|
27593
27370
|
const req = createRequire7(import.meta.url);
|
|
27594
27371
|
const skillsPkgMain = req.resolve("@cleocode/skills/package.json");
|
|
27595
27372
|
const skillsPkgRoot = dirname20(skillsPkgMain);
|
|
27596
|
-
if (existsSync103(
|
|
27373
|
+
if (existsSync103(join103(skillsPkgRoot, "skills.json"))) {
|
|
27597
27374
|
ctSkillsRoot = skillsPkgRoot;
|
|
27598
27375
|
}
|
|
27599
27376
|
} catch {
|
|
27600
27377
|
}
|
|
27601
27378
|
if (!ctSkillsRoot) {
|
|
27602
27379
|
try {
|
|
27603
|
-
const bundledPath =
|
|
27604
|
-
if (existsSync103(
|
|
27380
|
+
const bundledPath = join103(packageRoot, "packages", "skills");
|
|
27381
|
+
if (existsSync103(join103(bundledPath, "skills.json"))) {
|
|
27605
27382
|
ctSkillsRoot = bundledPath;
|
|
27606
27383
|
} else {
|
|
27607
|
-
const ctSkillsPath =
|
|
27608
|
-
if (existsSync103(
|
|
27384
|
+
const ctSkillsPath = join103(packageRoot, "node_modules", "@cleocode", "skills");
|
|
27385
|
+
if (existsSync103(join103(ctSkillsPath, "skills.json"))) {
|
|
27609
27386
|
ctSkillsRoot = ctSkillsPath;
|
|
27610
27387
|
}
|
|
27611
27388
|
}
|
|
@@ -27621,13 +27398,13 @@ async function initCoreSkills(created, warnings) {
|
|
|
27621
27398
|
} catch {
|
|
27622
27399
|
warnings.push("Failed to register skill library with CAAMP");
|
|
27623
27400
|
}
|
|
27624
|
-
const catalogPath =
|
|
27625
|
-
const catalog3 = JSON.parse(
|
|
27401
|
+
const catalogPath = join103(ctSkillsRoot, "skills.json");
|
|
27402
|
+
const catalog3 = JSON.parse(readFileSync75(catalogPath, "utf-8"));
|
|
27626
27403
|
const skills = catalog3.skills ?? [];
|
|
27627
27404
|
const coreSkills = skills.filter((s) => s.tier <= 2);
|
|
27628
27405
|
const installed = [];
|
|
27629
27406
|
for (const skill of coreSkills) {
|
|
27630
|
-
const skillSourceDir = dirname20(
|
|
27407
|
+
const skillSourceDir = dirname20(join103(ctSkillsRoot, skill.path));
|
|
27631
27408
|
if (!existsSync103(skillSourceDir)) {
|
|
27632
27409
|
continue;
|
|
27633
27410
|
}
|
|
@@ -27671,38 +27448,38 @@ async function initNexusRegistration(projectRoot, created, warnings) {
|
|
|
27671
27448
|
}
|
|
27672
27449
|
}
|
|
27673
27450
|
async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
27674
|
-
if (!existsSync103(
|
|
27451
|
+
if (!existsSync103(join103(projectRoot, ".git"))) {
|
|
27675
27452
|
return;
|
|
27676
27453
|
}
|
|
27677
|
-
const githubDir =
|
|
27678
|
-
const issueTemplateDir =
|
|
27454
|
+
const githubDir = join103(projectRoot, ".github");
|
|
27455
|
+
const issueTemplateDir = join103(githubDir, "ISSUE_TEMPLATE");
|
|
27679
27456
|
const packageRoot = getPackageRoot();
|
|
27680
|
-
const templateSrcDir =
|
|
27457
|
+
const templateSrcDir = join103(packageRoot, "templates", "github");
|
|
27681
27458
|
if (!existsSync103(templateSrcDir)) {
|
|
27682
27459
|
return;
|
|
27683
27460
|
}
|
|
27684
27461
|
await mkdir16(issueTemplateDir, { recursive: true });
|
|
27685
|
-
const issueSrcDir =
|
|
27462
|
+
const issueSrcDir = join103(templateSrcDir, "ISSUE_TEMPLATE");
|
|
27686
27463
|
if (existsSync103(issueSrcDir)) {
|
|
27687
27464
|
const issueFiles = readdirSync35(issueSrcDir);
|
|
27688
27465
|
for (const file2 of issueFiles) {
|
|
27689
|
-
const dest =
|
|
27466
|
+
const dest = join103(issueTemplateDir, file2);
|
|
27690
27467
|
if (existsSync103(dest)) {
|
|
27691
27468
|
skipped.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27692
27469
|
continue;
|
|
27693
27470
|
}
|
|
27694
|
-
const content =
|
|
27471
|
+
const content = readFileSync75(join103(issueSrcDir, file2), "utf-8");
|
|
27695
27472
|
await writeFile11(dest, content, "utf-8");
|
|
27696
27473
|
created.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27697
27474
|
}
|
|
27698
27475
|
}
|
|
27699
|
-
const prTemplateSrc =
|
|
27700
|
-
const prTemplateDest =
|
|
27476
|
+
const prTemplateSrc = join103(templateSrcDir, "pull_request_template.md");
|
|
27477
|
+
const prTemplateDest = join103(githubDir, "pull_request_template.md");
|
|
27701
27478
|
if (existsSync103(prTemplateSrc)) {
|
|
27702
27479
|
if (existsSync103(prTemplateDest)) {
|
|
27703
27480
|
skipped.push(".github/pull_request_template.md");
|
|
27704
27481
|
} else {
|
|
27705
|
-
const content =
|
|
27482
|
+
const content = readFileSync75(prTemplateSrc, "utf-8");
|
|
27706
27483
|
await writeFile11(prTemplateDest, content, "utf-8");
|
|
27707
27484
|
created.push(".github/pull_request_template.md");
|
|
27708
27485
|
}
|
|
@@ -27733,7 +27510,7 @@ async function updateDocs() {
|
|
|
27733
27510
|
async function initProject(opts = {}) {
|
|
27734
27511
|
const cleoDir = getCleoDirAbsolute();
|
|
27735
27512
|
const projRoot = getProjectRoot();
|
|
27736
|
-
const alreadyInitialized = existsSync103(cleoDir) && (existsSync103(
|
|
27513
|
+
const alreadyInitialized = existsSync103(cleoDir) && (existsSync103(join103(cleoDir, "tasks.db")) || existsSync103(join103(cleoDir, "config.json")));
|
|
27737
27514
|
if (alreadyInitialized && !opts.force) {
|
|
27738
27515
|
throw new CleoError(
|
|
27739
27516
|
1 /* GENERAL_ERROR */,
|
|
@@ -27757,7 +27534,7 @@ async function initProject(opts = {}) {
|
|
|
27757
27534
|
}
|
|
27758
27535
|
try {
|
|
27759
27536
|
const { getDb: getDb3 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
27760
|
-
await getDb3(
|
|
27537
|
+
await getDb3(join103(cleoDir, ".."));
|
|
27761
27538
|
created.push("tasks.db");
|
|
27762
27539
|
} catch (err) {
|
|
27763
27540
|
created.push(`tasks.db (deferred: ${err instanceof Error ? err.message : String(err)})`);
|
|
@@ -27787,7 +27564,7 @@ async function initProject(opts = {}) {
|
|
|
27787
27564
|
created.push(".gitignore");
|
|
27788
27565
|
}
|
|
27789
27566
|
} else {
|
|
27790
|
-
const gitignorePath =
|
|
27567
|
+
const gitignorePath = join103(cleoDir, ".gitignore");
|
|
27791
27568
|
if (existsSync103(gitignorePath)) {
|
|
27792
27569
|
skipped.push(".gitignore");
|
|
27793
27570
|
} else {
|
|
@@ -27799,12 +27576,12 @@ async function initProject(opts = {}) {
|
|
|
27799
27576
|
}
|
|
27800
27577
|
}
|
|
27801
27578
|
}
|
|
27802
|
-
const legacySequencePath =
|
|
27579
|
+
const legacySequencePath = join103(cleoDir, ".sequence");
|
|
27803
27580
|
try {
|
|
27804
27581
|
await unlink4(legacySequencePath);
|
|
27805
27582
|
} catch {
|
|
27806
27583
|
}
|
|
27807
|
-
const legacySequenceJsonPath =
|
|
27584
|
+
const legacySequenceJsonPath = join103(cleoDir, ".sequence.json");
|
|
27808
27585
|
try {
|
|
27809
27586
|
await unlink4(legacySequenceJsonPath);
|
|
27810
27587
|
} catch {
|
|
@@ -27901,12 +27678,12 @@ async function initProject(opts = {}) {
|
|
|
27901
27678
|
}
|
|
27902
27679
|
try {
|
|
27903
27680
|
const { ensureContributorMcp: ensureContributorMcp2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
|
|
27904
|
-
const
|
|
27905
|
-
if (
|
|
27906
|
-
created.push(`contributor
|
|
27681
|
+
const devResult = await ensureContributorMcp2(projRoot);
|
|
27682
|
+
if (devResult.action !== "skipped") {
|
|
27683
|
+
created.push(`contributor dev channel: ${devResult.details ?? devResult.action}`);
|
|
27907
27684
|
}
|
|
27908
27685
|
} catch (err) {
|
|
27909
|
-
warnings.push(`Contributor
|
|
27686
|
+
warnings.push(`Contributor dev channel: ${err instanceof Error ? err.message : String(err)}`);
|
|
27910
27687
|
}
|
|
27911
27688
|
await initAgentDefinition(created, warnings);
|
|
27912
27689
|
await initNexusRegistration(projRoot, created, warnings);
|
|
@@ -27965,8 +27742,8 @@ function isAutoInitEnabled() {
|
|
|
27965
27742
|
}
|
|
27966
27743
|
async function ensureInitialized(projectRoot) {
|
|
27967
27744
|
const root = projectRoot ?? getProjectRoot();
|
|
27968
|
-
const cleoDir =
|
|
27969
|
-
const isInit = existsSync103(cleoDir) && (existsSync103(
|
|
27745
|
+
const cleoDir = join103(root, ".cleo");
|
|
27746
|
+
const isInit = existsSync103(cleoDir) && (existsSync103(join103(cleoDir, "tasks.db")) || existsSync103(join103(cleoDir, "config.json")));
|
|
27970
27747
|
if (isInit) {
|
|
27971
27748
|
return { initialized: true };
|
|
27972
27749
|
}
|
|
@@ -27978,7 +27755,7 @@ async function ensureInitialized(projectRoot) {
|
|
|
27978
27755
|
}
|
|
27979
27756
|
async function getVersion2(projectRoot) {
|
|
27980
27757
|
const root = projectRoot ?? getProjectRoot();
|
|
27981
|
-
const versionPaths = [
|
|
27758
|
+
const versionPaths = [join103(root, "VERSION"), join103(root, "..", "VERSION")];
|
|
27982
27759
|
for (const versionPath of versionPaths) {
|
|
27983
27760
|
try {
|
|
27984
27761
|
const content = await readFile17(versionPath, "utf-8");
|
|
@@ -27989,7 +27766,7 @@ async function getVersion2(projectRoot) {
|
|
|
27989
27766
|
} catch {
|
|
27990
27767
|
}
|
|
27991
27768
|
}
|
|
27992
|
-
const pkg = await readJson(
|
|
27769
|
+
const pkg = await readJson(join103(root, "package.json"));
|
|
27993
27770
|
if (pkg?.version) {
|
|
27994
27771
|
return { version: pkg.version };
|
|
27995
27772
|
}
|
|
@@ -29848,22 +29625,15 @@ async function recoverCrashedAgents(thresholdMs = 3e4, cwd) {
|
|
|
29848
29625
|
var caamp_exports = {};
|
|
29849
29626
|
__export(caamp_exports, {
|
|
29850
29627
|
batchInstallWithRollback: () => batchInstallWithRollback,
|
|
29851
|
-
caampBuildServerConfig: () => buildServerConfig,
|
|
29852
29628
|
caampGenerateInjectionContent: () => generateInjectionContent,
|
|
29853
29629
|
caampGetInstructionFiles: () => getInstructionFiles,
|
|
29854
29630
|
caampResolveAlias: () => resolveAlias,
|
|
29855
29631
|
checkProviderCapabilities: () => checkProviderCapabilities,
|
|
29856
29632
|
checkProviderCapability: () => checkProviderCapability,
|
|
29857
|
-
dualScopeConfigure: () => dualScopeConfigure,
|
|
29858
29633
|
injectionCheck: () => injectionCheck,
|
|
29859
29634
|
injectionCheckAll: () => injectionCheckAll,
|
|
29860
29635
|
injectionUpdate: () => injectionUpdate,
|
|
29861
29636
|
injectionUpdateAll: () => injectionUpdateAll,
|
|
29862
|
-
mcpConfigPath: () => mcpConfigPath,
|
|
29863
|
-
mcpInstall: () => mcpInstall,
|
|
29864
|
-
mcpList: () => mcpList,
|
|
29865
|
-
mcpListAll: () => mcpListAll,
|
|
29866
|
-
mcpRemove: () => mcpRemove,
|
|
29867
29637
|
providerCount: () => providerCount,
|
|
29868
29638
|
providerDetect: () => providerDetect,
|
|
29869
29639
|
providerGet: () => providerGet,
|
|
@@ -29874,10 +29644,8 @@ __export(caamp_exports, {
|
|
|
29874
29644
|
|
|
29875
29645
|
// packages/core/src/caamp/adapter.ts
|
|
29876
29646
|
import {
|
|
29877
|
-
buildServerConfig,
|
|
29878
29647
|
checkAllInjections,
|
|
29879
29648
|
checkInjection,
|
|
29880
|
-
configureProviderGlobalAndProject,
|
|
29881
29649
|
detectAllProviders,
|
|
29882
29650
|
generateInjectionContent,
|
|
29883
29651
|
getAllProviders,
|
|
@@ -29889,12 +29657,7 @@ import {
|
|
|
29889
29657
|
inject,
|
|
29890
29658
|
injectAll,
|
|
29891
29659
|
installBatchWithRollback,
|
|
29892
|
-
|
|
29893
|
-
listAllMcpServers,
|
|
29894
|
-
listMcpServers,
|
|
29895
|
-
removeMcpServer,
|
|
29896
|
-
resolveAlias,
|
|
29897
|
-
resolveConfigPath
|
|
29660
|
+
resolveAlias
|
|
29898
29661
|
} from "@cleocode/caamp";
|
|
29899
29662
|
function providerList() {
|
|
29900
29663
|
try {
|
|
@@ -29989,117 +29752,6 @@ function registryVersion() {
|
|
|
29989
29752
|
};
|
|
29990
29753
|
}
|
|
29991
29754
|
}
|
|
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
29755
|
async function injectionCheck(filePath, expectedContent) {
|
|
30104
29756
|
try {
|
|
30105
29757
|
const status = await checkInjection(filePath, expectedContent);
|
|
@@ -30176,30 +29828,6 @@ async function batchInstallWithRollback(options) {
|
|
|
30176
29828
|
};
|
|
30177
29829
|
}
|
|
30178
29830
|
}
|
|
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
29831
|
|
|
30204
29832
|
// packages/core/src/caamp/capability-check.ts
|
|
30205
29833
|
import { providerSupports, providerSupportsById } from "@cleocode/caamp";
|
|
@@ -30284,14 +29912,26 @@ import { existsSync as existsSync17, mkdtempSync, rmSync, writeFileSync as write
|
|
|
30284
29912
|
import { tmpdir } from "node:os";
|
|
30285
29913
|
import { join as join20, relative } from "node:path";
|
|
30286
29914
|
function resolveTreeSitterBin() {
|
|
29915
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
29916
|
+
const binName = `tree-sitter${ext}`;
|
|
30287
29917
|
const candidates = [
|
|
30288
|
-
join20(process.cwd(), "packages", "core", "node_modules", ".bin",
|
|
30289
|
-
join20(process.cwd(), "node_modules", ".bin",
|
|
29918
|
+
join20(process.cwd(), "packages", "core", "node_modules", ".bin", binName),
|
|
29919
|
+
join20(process.cwd(), "node_modules", ".bin", binName),
|
|
29920
|
+
// npm global install paths
|
|
29921
|
+
join20(process.cwd(), "node_modules", "tree-sitter-cli", binName)
|
|
30290
29922
|
];
|
|
29923
|
+
if (ext) {
|
|
29924
|
+
candidates.push(
|
|
29925
|
+
join20(process.cwd(), "packages", "core", "node_modules", ".bin", "tree-sitter"),
|
|
29926
|
+
join20(process.cwd(), "node_modules", ".bin", "tree-sitter")
|
|
29927
|
+
);
|
|
29928
|
+
}
|
|
30291
29929
|
for (const p of candidates) {
|
|
30292
29930
|
if (existsSync17(p)) return p;
|
|
30293
29931
|
}
|
|
30294
|
-
throw new Error(
|
|
29932
|
+
throw new Error(
|
|
29933
|
+
"tree-sitter CLI not found. Code analysis features (cleo code outline/search/unfold) require tree-sitter. Install with: npm install tree-sitter-cli"
|
|
29934
|
+
);
|
|
30295
29935
|
}
|
|
30296
29936
|
var QUERY_PATTERNS = {
|
|
30297
29937
|
// TypeScript / JavaScript
|
|
@@ -31153,6 +30793,10 @@ var ConduitClient = class {
|
|
|
31153
30793
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
31154
30794
|
};
|
|
31155
30795
|
}
|
|
30796
|
+
/** One-shot poll for new messages. Delegates to the transport's poll method. */
|
|
30797
|
+
async poll(options) {
|
|
30798
|
+
return this.transport.poll(options);
|
|
30799
|
+
}
|
|
31156
30800
|
/** Subscribe to incoming messages. Uses real-time transport when available, else polls. */
|
|
31157
30801
|
onMessage(handler) {
|
|
31158
30802
|
if (this.transport.subscribe) {
|
|
@@ -31254,11 +30898,10 @@ var HttpTransport = class {
|
|
|
31254
30898
|
const messageId = data.data?.message?.id ?? data.data?.id ?? "unknown";
|
|
31255
30899
|
return { messageId };
|
|
31256
30900
|
}
|
|
31257
|
-
/** Poll for new messages
|
|
30901
|
+
/** Poll for new messages for this agent. Returns empty array on HTTP error. */
|
|
31258
30902
|
async poll(options) {
|
|
31259
30903
|
this.ensureConnected();
|
|
31260
30904
|
const params = new URLSearchParams();
|
|
31261
|
-
params.set("mentioned", this.state.agentId);
|
|
31262
30905
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
31263
30906
|
if (options?.since) params.set("since", options.since);
|
|
31264
30907
|
const response = await this.fetchWithFallback(`/messages/peek?${params}`, {
|
|
@@ -31806,14 +31449,16 @@ var SseTransport = class {
|
|
|
31806
31449
|
|
|
31807
31450
|
// packages/core/src/conduit/factory.ts
|
|
31808
31451
|
function resolveTransport(credential) {
|
|
31452
|
+
const isCloudBacked = credential.apiBaseUrl && credential.apiBaseUrl !== "local" && credential.apiBaseUrl.startsWith("http");
|
|
31453
|
+
if (isCloudBacked) {
|
|
31454
|
+
if (credential.transportConfig.sseEndpoint) {
|
|
31455
|
+
return new SseTransport();
|
|
31456
|
+
}
|
|
31457
|
+
return new HttpTransport();
|
|
31458
|
+
}
|
|
31809
31459
|
if (LocalTransport.isAvailable()) {
|
|
31810
31460
|
return new LocalTransport();
|
|
31811
31461
|
}
|
|
31812
|
-
if (credential.transportConfig.wsUrl) {
|
|
31813
|
-
}
|
|
31814
|
-
if (credential.transportConfig.sseEndpoint) {
|
|
31815
|
-
return new SseTransport();
|
|
31816
|
-
}
|
|
31817
31462
|
return new HttpTransport();
|
|
31818
31463
|
}
|
|
31819
31464
|
async function createConduit(registry2, agentId) {
|
|
@@ -31976,8 +31621,6 @@ __export(hooks_exports, {
|
|
|
31976
31621
|
handleFileChange: () => handleFileChange,
|
|
31977
31622
|
handlePostCompact: () => handlePostCompact,
|
|
31978
31623
|
handlePreCompact: () => handlePreCompact,
|
|
31979
|
-
handlePromptSubmit: () => handlePromptSubmit,
|
|
31980
|
-
handleResponseComplete: () => handleResponseComplete,
|
|
31981
31624
|
handleSessionEnd: () => handleSessionEnd,
|
|
31982
31625
|
handleSessionStart: () => handleSessionStart,
|
|
31983
31626
|
handleSubagentStart: () => handleSubagentStart,
|
|
@@ -46642,9 +46285,6 @@ async function listEpicsWithLifecycle(cwd) {
|
|
|
46642
46285
|
}
|
|
46643
46286
|
}
|
|
46644
46287
|
|
|
46645
|
-
// packages/core/src/index.ts
|
|
46646
|
-
init_mcp();
|
|
46647
|
-
|
|
46648
46288
|
// packages/core/src/memory/index.ts
|
|
46649
46289
|
var memory_exports = {};
|
|
46650
46290
|
__export(memory_exports, {
|
|
@@ -46713,8 +46353,8 @@ init_paths();
|
|
|
46713
46353
|
init_atomic();
|
|
46714
46354
|
init_json2();
|
|
46715
46355
|
init_add();
|
|
46716
|
-
import { existsSync as existsSync44, readFileSync as
|
|
46717
|
-
import { join as
|
|
46356
|
+
import { existsSync as existsSync44, readFileSync as readFileSync28 } from "node:fs";
|
|
46357
|
+
import { join as join48, resolve as resolve6 } from "node:path";
|
|
46718
46358
|
|
|
46719
46359
|
// packages/core/src/memory/brain-lifecycle.ts
|
|
46720
46360
|
init_brain_accessor();
|
|
@@ -46944,13 +46584,13 @@ init_brain_links();
|
|
|
46944
46584
|
|
|
46945
46585
|
// packages/core/src/memory/brain-migration.ts
|
|
46946
46586
|
init_brain_accessor();
|
|
46947
|
-
import { existsSync as existsSync43, readFileSync as
|
|
46948
|
-
import { join as
|
|
46587
|
+
import { existsSync as existsSync43, readFileSync as readFileSync27 } from "node:fs";
|
|
46588
|
+
import { join as join47 } from "node:path";
|
|
46949
46589
|
function readJsonlFile(filePath) {
|
|
46950
46590
|
if (!existsSync43(filePath)) {
|
|
46951
46591
|
return { entries: [], errors: [] };
|
|
46952
46592
|
}
|
|
46953
|
-
const content =
|
|
46593
|
+
const content = readFileSync27(filePath, "utf-8").trim();
|
|
46954
46594
|
if (!content) {
|
|
46955
46595
|
return { entries: [], errors: [] };
|
|
46956
46596
|
}
|
|
@@ -46975,7 +46615,7 @@ async function migrateBrainData(projectRoot) {
|
|
|
46975
46615
|
duplicatesSkipped: 0,
|
|
46976
46616
|
errors: []
|
|
46977
46617
|
};
|
|
46978
|
-
const patternsPath =
|
|
46618
|
+
const patternsPath = join47(projectRoot, ".cleo", "memory", "patterns.jsonl");
|
|
46979
46619
|
const { entries: patterns, errors: patternErrors } = readJsonlFile(patternsPath);
|
|
46980
46620
|
result.errors.push(...patternErrors);
|
|
46981
46621
|
for (const p of patterns) {
|
|
@@ -47005,7 +46645,7 @@ async function migrateBrainData(projectRoot) {
|
|
|
47005
46645
|
result.errors.push(`Pattern ${p.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
47006
46646
|
}
|
|
47007
46647
|
}
|
|
47008
|
-
const learningsPath =
|
|
46648
|
+
const learningsPath = join47(projectRoot, ".cleo", "memory", "learnings.jsonl");
|
|
47009
46649
|
const { entries: learnings, errors: learningErrors } = readJsonlFile(learningsPath);
|
|
47010
46650
|
result.errors.push(...learningErrors);
|
|
47011
46651
|
for (const l of learnings) {
|
|
@@ -47057,7 +46697,7 @@ init_decisions2();
|
|
|
47057
46697
|
init_learnings();
|
|
47058
46698
|
init_patterns();
|
|
47059
46699
|
function getResearchPath(cwd) {
|
|
47060
|
-
return
|
|
46700
|
+
return join48(getCleoDirAbsolute(cwd), "research.json");
|
|
47061
46701
|
}
|
|
47062
46702
|
function getManifestPath2(cwd) {
|
|
47063
46703
|
return getManifestPath(cwd);
|
|
@@ -47278,7 +46918,7 @@ async function showManifestEntry(researchId, cwd) {
|
|
|
47278
46918
|
try {
|
|
47279
46919
|
const filePath = resolve6(root, entry.file);
|
|
47280
46920
|
if (existsSync44(filePath)) {
|
|
47281
|
-
fileContent =
|
|
46921
|
+
fileContent = readFileSync28(filePath, "utf-8");
|
|
47282
46922
|
}
|
|
47283
46923
|
} catch {
|
|
47284
46924
|
}
|
|
@@ -47524,7 +47164,7 @@ async function readProtocolInjection(protocolType, params, cwd) {
|
|
|
47524
47164
|
for (const loc of protocolLocations) {
|
|
47525
47165
|
if (existsSync44(loc)) {
|
|
47526
47166
|
try {
|
|
47527
|
-
protocolContent =
|
|
47167
|
+
protocolContent = readFileSync28(loc, "utf-8");
|
|
47528
47168
|
protocolPath = loc.replace(root + "/", "");
|
|
47529
47169
|
break;
|
|
47530
47170
|
} catch {
|
|
@@ -47711,28 +47351,28 @@ __export(metrics_exports, {
|
|
|
47711
47351
|
init_paths();
|
|
47712
47352
|
import { appendFileSync as appendFileSync5, existsSync as existsSync47 } from "node:fs";
|
|
47713
47353
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
47714
|
-
import { join as
|
|
47354
|
+
import { join as join51 } from "node:path";
|
|
47715
47355
|
|
|
47716
47356
|
// packages/core/src/metrics/common.ts
|
|
47717
47357
|
init_paths();
|
|
47718
|
-
import { existsSync as existsSync45, readFileSync as
|
|
47358
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29 } from "node:fs";
|
|
47719
47359
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
47720
|
-
import { join as
|
|
47360
|
+
import { join as join49 } from "node:path";
|
|
47721
47361
|
async function ensureMetricsDir(metricsDir) {
|
|
47722
|
-
const dir = metricsDir ??
|
|
47362
|
+
const dir = metricsDir ?? join49(getCleoDir(), "metrics");
|
|
47723
47363
|
if (!existsSync45(dir)) {
|
|
47724
47364
|
await mkdir7(dir, { recursive: true });
|
|
47725
47365
|
}
|
|
47726
47366
|
return dir;
|
|
47727
47367
|
}
|
|
47728
47368
|
function getCompliancePath(metricsDir) {
|
|
47729
|
-
return
|
|
47369
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "COMPLIANCE.jsonl");
|
|
47730
47370
|
}
|
|
47731
47371
|
function getViolationsPath(metricsDir) {
|
|
47732
|
-
return
|
|
47372
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "PROTOCOL_VIOLATIONS.jsonl");
|
|
47733
47373
|
}
|
|
47734
47374
|
function getSessionsMetricsPath(metricsDir) {
|
|
47735
|
-
return
|
|
47375
|
+
return join49(metricsDir ?? join49(getCleoDir(), "metrics"), "SESSIONS.jsonl");
|
|
47736
47376
|
}
|
|
47737
47377
|
function isoTimestamp() {
|
|
47738
47378
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
@@ -47742,7 +47382,7 @@ function isoDate() {
|
|
|
47742
47382
|
}
|
|
47743
47383
|
function readJsonlFile2(filePath) {
|
|
47744
47384
|
if (!existsSync45(filePath)) return [];
|
|
47745
|
-
const content =
|
|
47385
|
+
const content = readFileSync29(filePath, "utf-8").trim();
|
|
47746
47386
|
if (!content) return [];
|
|
47747
47387
|
return content.split("\n").filter((line2) => line2.trim()).map((line2) => JSON.parse(line2));
|
|
47748
47388
|
}
|
|
@@ -47763,14 +47403,14 @@ function getComplianceSummaryBase(compliancePath) {
|
|
|
47763
47403
|
|
|
47764
47404
|
// packages/core/src/metrics/otel-integration.ts
|
|
47765
47405
|
init_paths();
|
|
47766
|
-
import { appendFileSync as appendFileSync4, existsSync as existsSync46, readdirSync as readdirSync20, readFileSync as
|
|
47406
|
+
import { appendFileSync as appendFileSync4, existsSync as existsSync46, readdirSync as readdirSync20, readFileSync as readFileSync30, statSync as statSync9 } from "node:fs";
|
|
47767
47407
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
47768
|
-
import { join as
|
|
47408
|
+
import { join as join50 } from "node:path";
|
|
47769
47409
|
function getOtelDir(cwd) {
|
|
47770
|
-
return process.env.OTEL_METRICS_DIR ??
|
|
47410
|
+
return process.env.OTEL_METRICS_DIR ?? join50(getCleoDir(cwd), "metrics", "otel");
|
|
47771
47411
|
}
|
|
47772
47412
|
function getTokenMetricsPath(cwd) {
|
|
47773
|
-
return
|
|
47413
|
+
return join50(getOtelDir(cwd), "token_metrics.jsonl");
|
|
47774
47414
|
}
|
|
47775
47415
|
function isOtelEnabled() {
|
|
47776
47416
|
return process.env.CLAUDE_CODE_ENABLE_TELEMETRY === "1";
|
|
@@ -47801,7 +47441,7 @@ function getOtelSetupCommands(mode = "file", cwd) {
|
|
|
47801
47441
|
function findLatestMetricsFile(cwd) {
|
|
47802
47442
|
const otelDir = getOtelDir(cwd);
|
|
47803
47443
|
if (!existsSync46(otelDir)) return null;
|
|
47804
|
-
const files = readdirSync20(otelDir).filter((f) => f.endsWith(".json")).map((f) =>
|
|
47444
|
+
const files = readdirSync20(otelDir).filter((f) => f.endsWith(".json")).map((f) => join50(otelDir, f)).filter((f) => {
|
|
47805
47445
|
try {
|
|
47806
47446
|
return statSync9(f).isFile();
|
|
47807
47447
|
} catch {
|
|
@@ -47814,7 +47454,7 @@ function parseTokenMetrics(inputFile, cwd) {
|
|
|
47814
47454
|
const file2 = inputFile ?? findLatestMetricsFile(cwd);
|
|
47815
47455
|
if (!file2 || !existsSync46(file2)) return [];
|
|
47816
47456
|
try {
|
|
47817
|
-
const raw = JSON.parse(
|
|
47457
|
+
const raw = JSON.parse(readFileSync30(file2, "utf-8"));
|
|
47818
47458
|
if (raw.resourceMetrics) {
|
|
47819
47459
|
const points = [];
|
|
47820
47460
|
for (const rm3 of raw.resourceMetrics ?? []) {
|
|
@@ -47898,7 +47538,7 @@ async function recordSessionEnd(sessionId, cwd) {
|
|
|
47898
47538
|
let deltaInput = 0;
|
|
47899
47539
|
let deltaOutput = 0;
|
|
47900
47540
|
if (existsSync46(metricsPath)) {
|
|
47901
|
-
const lines =
|
|
47541
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47902
47542
|
const startLine = lines.reverse().find((l) => l.includes(`"session_id":"${sessionId}"`) && l.includes("session_start"));
|
|
47903
47543
|
if (startLine) {
|
|
47904
47544
|
const startData = JSON.parse(startLine);
|
|
@@ -47925,7 +47565,7 @@ function compareSessions(sessionA, sessionB, cwd) {
|
|
|
47925
47565
|
if (!existsSync46(metricsPath)) {
|
|
47926
47566
|
return { error: "One or both sessions not found" };
|
|
47927
47567
|
}
|
|
47928
|
-
const lines =
|
|
47568
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47929
47569
|
const findSessionEnd = (id) => {
|
|
47930
47570
|
const line2 = lines.reverse().find((l) => l.includes(`"session_id":"${id}"`) && l.includes("session_end"));
|
|
47931
47571
|
if (!line2) return 0;
|
|
@@ -47960,7 +47600,7 @@ function getTokenStats(cwd) {
|
|
|
47960
47600
|
if (!existsSync46(metricsPath)) {
|
|
47961
47601
|
return { error: "No token metrics recorded" };
|
|
47962
47602
|
}
|
|
47963
|
-
const lines =
|
|
47603
|
+
const lines = readFileSync30(metricsPath, "utf-8").trim().split("\n").filter(Boolean);
|
|
47964
47604
|
const endEvents = lines.filter((l) => l.includes("session_end"));
|
|
47965
47605
|
if (endEvents.length === 0) {
|
|
47966
47606
|
return { sessions: 0, avg_tokens: 0, min_tokens: 0, max_tokens: 0 };
|
|
@@ -47987,10 +47627,10 @@ function getTokenStats(cwd) {
|
|
|
47987
47627
|
// packages/core/src/metrics/ab-test.ts
|
|
47988
47628
|
var currentTest = null;
|
|
47989
47629
|
function getABMetricsDir(cwd) {
|
|
47990
|
-
return process.env.AB_TEST_METRICS_DIR ??
|
|
47630
|
+
return process.env.AB_TEST_METRICS_DIR ?? join51(getCleoDir(cwd), "metrics", "ab-tests");
|
|
47991
47631
|
}
|
|
47992
47632
|
function getABMetricsFile(cwd) {
|
|
47993
|
-
return
|
|
47633
|
+
return join51(getABMetricsDir(cwd), "AB_TESTS.jsonl");
|
|
47994
47634
|
}
|
|
47995
47635
|
async function logABEvent(eventType, testName, variant, context, cwd) {
|
|
47996
47636
|
const dir = getABMetricsDir(cwd);
|
|
@@ -48049,7 +47689,7 @@ async function endABTest(options = {}, cwd) {
|
|
|
48049
47689
|
totalTokens = endTokenData.tokens.total - currentTest.startTokens;
|
|
48050
47690
|
tokenSource = "otel";
|
|
48051
47691
|
} else {
|
|
48052
|
-
const tokenFile =
|
|
47692
|
+
const tokenFile = join51(getCleoDir(cwd), "metrics", "TOKEN_USAGE.jsonl");
|
|
48053
47693
|
if (existsSync47(tokenFile)) {
|
|
48054
47694
|
const entries = readJsonlFile2(tokenFile);
|
|
48055
47695
|
totalTokens = entries.filter((e) => e.session_id === currentTest.testName).reduce((sum, e) => sum + (e.estimated_tokens ?? 0), 0);
|
|
@@ -48214,15 +47854,15 @@ init_paths();
|
|
|
48214
47854
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
48215
47855
|
import { appendFileSync as appendFileSync6, existsSync as existsSync48 } from "node:fs";
|
|
48216
47856
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
48217
|
-
import { basename as basename7, join as
|
|
47857
|
+
import { basename as basename7, join as join52 } from "node:path";
|
|
48218
47858
|
function getProjectMetricsDir(cwd) {
|
|
48219
|
-
return
|
|
47859
|
+
return join52(getCleoDir(cwd), "metrics");
|
|
48220
47860
|
}
|
|
48221
47861
|
function getGlobalMetricsDir() {
|
|
48222
|
-
return
|
|
47862
|
+
return join52(getCleoHome(), "metrics");
|
|
48223
47863
|
}
|
|
48224
47864
|
function getGlobalPath() {
|
|
48225
|
-
return
|
|
47865
|
+
return join52(getGlobalMetricsDir(), "GLOBAL.jsonl");
|
|
48226
47866
|
}
|
|
48227
47867
|
function getProjectName() {
|
|
48228
47868
|
try {
|
|
@@ -48237,7 +47877,7 @@ function getProjectName() {
|
|
|
48237
47877
|
return basename7(process.cwd());
|
|
48238
47878
|
}
|
|
48239
47879
|
async function syncMetricsToGlobal(options = {}, cwd) {
|
|
48240
|
-
const projectPath = getCompliancePath(
|
|
47880
|
+
const projectPath = getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48241
47881
|
if (!existsSync48(projectPath)) {
|
|
48242
47882
|
return { success: true, result: { synced: 0, skipped: 0, reason: "No project metrics file" } };
|
|
48243
47883
|
}
|
|
@@ -48278,7 +47918,7 @@ async function syncMetricsToGlobal(options = {}, cwd) {
|
|
|
48278
47918
|
};
|
|
48279
47919
|
}
|
|
48280
47920
|
function getProjectComplianceSummary(options = {}, cwd) {
|
|
48281
|
-
const projectPath = getCompliancePath(
|
|
47921
|
+
const projectPath = getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48282
47922
|
const projectName = getProjectName();
|
|
48283
47923
|
if (!existsSync48(projectPath)) {
|
|
48284
47924
|
return {
|
|
@@ -48377,7 +48017,7 @@ function computeComplianceSummary(entries, projectName) {
|
|
|
48377
48017
|
};
|
|
48378
48018
|
}
|
|
48379
48019
|
function getComplianceTrend2(days = 7, options = {}, cwd) {
|
|
48380
|
-
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(
|
|
48020
|
+
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48381
48021
|
if (!existsSync48(metricsPath)) {
|
|
48382
48022
|
return { success: true, result: { days, dataPoints: [], trend: "no_data" } };
|
|
48383
48023
|
}
|
|
@@ -48409,7 +48049,7 @@ function getComplianceTrend2(days = 7, options = {}, cwd) {
|
|
|
48409
48049
|
return { success: true, result: { days, dataPoints, trend } };
|
|
48410
48050
|
}
|
|
48411
48051
|
function getSkillReliability2(options = {}, cwd) {
|
|
48412
|
-
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(
|
|
48052
|
+
const metricsPath = options.global ? getGlobalPath() : getCompliancePath(join52(getCleoDir(cwd), "metrics"));
|
|
48413
48053
|
if (!existsSync48(metricsPath)) {
|
|
48414
48054
|
return {
|
|
48415
48055
|
success: true,
|
|
@@ -48448,7 +48088,7 @@ function getSkillReliability2(options = {}, cwd) {
|
|
|
48448
48088
|
async function logSessionMetrics(metricsJson, cwd) {
|
|
48449
48089
|
const metricsDir = getProjectMetricsDir(cwd);
|
|
48450
48090
|
await mkdir10(metricsDir, { recursive: true });
|
|
48451
|
-
const sessionsPath = getSessionsMetricsPath(
|
|
48091
|
+
const sessionsPath = getSessionsMetricsPath(join52(getCleoDir(cwd), "metrics"));
|
|
48452
48092
|
try {
|
|
48453
48093
|
appendFileSync6(sessionsPath, JSON.stringify(metricsJson) + "\n");
|
|
48454
48094
|
} catch {
|
|
@@ -48464,7 +48104,7 @@ async function logSessionMetrics(metricsJson, cwd) {
|
|
|
48464
48104
|
};
|
|
48465
48105
|
}
|
|
48466
48106
|
function getSessionMetricsSummary(options = {}, cwd) {
|
|
48467
|
-
const sessionsPath = getSessionsMetricsPath(
|
|
48107
|
+
const sessionsPath = getSessionsMetricsPath(join52(getCleoDir(cwd), "metrics"));
|
|
48468
48108
|
if (!existsSync48(sessionsPath)) {
|
|
48469
48109
|
return {
|
|
48470
48110
|
success: true,
|
|
@@ -48586,12 +48226,12 @@ function isValidEnumValue(enumObj, value) {
|
|
|
48586
48226
|
|
|
48587
48227
|
// packages/core/src/metrics/token-estimation.ts
|
|
48588
48228
|
init_paths();
|
|
48589
|
-
import { existsSync as existsSync49, readFileSync as
|
|
48229
|
+
import { existsSync as existsSync49, readFileSync as readFileSync31, statSync as statSync10 } from "node:fs";
|
|
48590
48230
|
import { appendFile as appendFile2, mkdir as mkdir11 } from "node:fs/promises";
|
|
48591
|
-
import { dirname as dirname12, join as
|
|
48231
|
+
import { dirname as dirname12, join as join53 } from "node:path";
|
|
48592
48232
|
var currentSession = null;
|
|
48593
48233
|
function getTokenFilePath(cwd) {
|
|
48594
|
-
return
|
|
48234
|
+
return join53(getCleoDir(cwd), "metrics", "TOKEN_USAGE.jsonl");
|
|
48595
48235
|
}
|
|
48596
48236
|
function isTrackingEnabled() {
|
|
48597
48237
|
return (process.env.CLEO_TRACK_TOKENS ?? "1") === "1";
|
|
@@ -48759,7 +48399,7 @@ function getTokenSummary(days = 7, cwd) {
|
|
|
48759
48399
|
const threshold = /* @__PURE__ */ new Date();
|
|
48760
48400
|
threshold.setDate(threshold.getDate() - days);
|
|
48761
48401
|
const thresholdStr = threshold.toISOString();
|
|
48762
|
-
const entries =
|
|
48402
|
+
const entries = readFileSync31(tokenFile, "utf-8").trim().split("\n").filter(Boolean);
|
|
48763
48403
|
let manifestTokens = 0;
|
|
48764
48404
|
let fullFileTokens = 0;
|
|
48765
48405
|
let skillTokens = 0;
|
|
@@ -48871,12 +48511,12 @@ init_agent_outputs();
|
|
|
48871
48511
|
|
|
48872
48512
|
// packages/core/src/migration/checksum.ts
|
|
48873
48513
|
import { createHash as createHash5 } from "node:crypto";
|
|
48874
|
-
import { readFileSync as
|
|
48514
|
+
import { readFileSync as readFileSync33 } from "node:fs";
|
|
48875
48515
|
import { createRequire as createRequire5 } from "node:module";
|
|
48876
48516
|
var _require5 = createRequire5(import.meta.url);
|
|
48877
48517
|
var { DatabaseSync: DatabaseSync3 } = _require5("node:sqlite");
|
|
48878
48518
|
async function computeChecksum(filePath) {
|
|
48879
|
-
const content =
|
|
48519
|
+
const content = readFileSync33(filePath);
|
|
48880
48520
|
return createHash5("sha256").update(content).digest("hex");
|
|
48881
48521
|
}
|
|
48882
48522
|
async function verifyBackup(sourcePath, backupPath) {
|
|
@@ -48925,11 +48565,11 @@ import {
|
|
|
48925
48565
|
existsSync as existsSync51,
|
|
48926
48566
|
mkdirSync as mkdirSync13,
|
|
48927
48567
|
readdirSync as readdirSync22,
|
|
48928
|
-
readFileSync as
|
|
48568
|
+
readFileSync as readFileSync34,
|
|
48929
48569
|
statSync as statSync12,
|
|
48930
48570
|
unlinkSync as unlinkSync3
|
|
48931
48571
|
} from "node:fs";
|
|
48932
|
-
import { dirname as dirname13, join as
|
|
48572
|
+
import { dirname as dirname13, join as join55, relative as relative8 } from "node:path";
|
|
48933
48573
|
var MigrationLogger = class {
|
|
48934
48574
|
logPath;
|
|
48935
48575
|
entries = [];
|
|
@@ -48949,7 +48589,7 @@ var MigrationLogger = class {
|
|
|
48949
48589
|
consoleOutput: config2.consoleOutput ?? false
|
|
48950
48590
|
};
|
|
48951
48591
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
48952
|
-
this.logPath =
|
|
48592
|
+
this.logPath = join55(cleoDir, "logs", `migration-${timestamp2}.jsonl`);
|
|
48953
48593
|
const logsDir = dirname13(this.logPath);
|
|
48954
48594
|
if (!existsSync51(logsDir)) {
|
|
48955
48595
|
mkdirSync13(logsDir, { recursive: true });
|
|
@@ -49119,14 +48759,14 @@ var MigrationLogger = class {
|
|
|
49119
48759
|
*/
|
|
49120
48760
|
cleanupOldLogs() {
|
|
49121
48761
|
try {
|
|
49122
|
-
const logsDir =
|
|
48762
|
+
const logsDir = join55(this.cleoDir, "logs");
|
|
49123
48763
|
if (!existsSync51(logsDir)) {
|
|
49124
48764
|
return;
|
|
49125
48765
|
}
|
|
49126
48766
|
const files = readdirSync22(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
|
|
49127
48767
|
name: f,
|
|
49128
|
-
path:
|
|
49129
|
-
mtime: statSync12(
|
|
48768
|
+
path: join55(logsDir, f),
|
|
48769
|
+
mtime: statSync12(join55(logsDir, f)).mtime.getTime()
|
|
49130
48770
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
49131
48771
|
const filesToRemove = files.slice(this.config.maxLogFiles);
|
|
49132
48772
|
for (const file2 of filesToRemove) {
|
|
@@ -49204,7 +48844,7 @@ function createMigrationLogger(cleoDir, config2) {
|
|
|
49204
48844
|
return new MigrationLogger(cleoDir, config2);
|
|
49205
48845
|
}
|
|
49206
48846
|
function readMigrationLog(logPath) {
|
|
49207
|
-
const content =
|
|
48847
|
+
const content = readFileSync34(logPath, "utf-8");
|
|
49208
48848
|
return content.split("\n").filter((line2) => line2.trim()).map((line2) => JSON.parse(line2));
|
|
49209
48849
|
}
|
|
49210
48850
|
function logFileExists(logPath) {
|
|
@@ -49217,14 +48857,14 @@ function logFileExists(logPath) {
|
|
|
49217
48857
|
}
|
|
49218
48858
|
function getLatestMigrationLog(cleoDir) {
|
|
49219
48859
|
try {
|
|
49220
|
-
const logsDir =
|
|
48860
|
+
const logsDir = join55(cleoDir, "logs");
|
|
49221
48861
|
if (!existsSync51(logsDir)) {
|
|
49222
48862
|
return null;
|
|
49223
48863
|
}
|
|
49224
48864
|
const files = readdirSync22(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
|
|
49225
48865
|
name: f,
|
|
49226
|
-
path:
|
|
49227
|
-
mtime: statSync12(
|
|
48866
|
+
path: join55(logsDir, f),
|
|
48867
|
+
mtime: statSync12(join55(logsDir, f)).mtime.getTime()
|
|
49228
48868
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
49229
48869
|
return files.length > 0 ? files[0].path : null;
|
|
49230
48870
|
} catch {
|
|
@@ -49234,8 +48874,8 @@ function getLatestMigrationLog(cleoDir) {
|
|
|
49234
48874
|
|
|
49235
48875
|
// packages/core/src/system/storage-preflight.ts
|
|
49236
48876
|
init_paths();
|
|
49237
|
-
import { existsSync as existsSync52, readFileSync as
|
|
49238
|
-
import { join as
|
|
48877
|
+
import { existsSync as existsSync52, readFileSync as readFileSync35, statSync as statSync13 } from "node:fs";
|
|
48878
|
+
import { join as join56 } from "node:path";
|
|
49239
48879
|
function checkStorageMigration(cwd) {
|
|
49240
48880
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
49241
48881
|
const details = {
|
|
@@ -49249,42 +48889,42 @@ function checkStorageMigration(cwd) {
|
|
|
49249
48889
|
tasksDbSize: 0,
|
|
49250
48890
|
configEngine: null
|
|
49251
48891
|
};
|
|
49252
|
-
const configPath =
|
|
48892
|
+
const configPath = join56(cleoDir, "config.json");
|
|
49253
48893
|
if (existsSync52(configPath)) {
|
|
49254
48894
|
try {
|
|
49255
|
-
const config2 = JSON.parse(
|
|
48895
|
+
const config2 = JSON.parse(readFileSync35(configPath, "utf-8"));
|
|
49256
48896
|
details.configEngine = config2?.storage?.engine ?? null;
|
|
49257
48897
|
} catch {
|
|
49258
48898
|
}
|
|
49259
48899
|
}
|
|
49260
|
-
const todoPath =
|
|
48900
|
+
const todoPath = join56(cleoDir, "todo.json");
|
|
49261
48901
|
if (existsSync52(todoPath)) {
|
|
49262
48902
|
details.todoJsonExists = true;
|
|
49263
48903
|
try {
|
|
49264
|
-
const data = JSON.parse(
|
|
48904
|
+
const data = JSON.parse(readFileSync35(todoPath, "utf-8"));
|
|
49265
48905
|
details.todoJsonTaskCount = (data.tasks ?? []).length;
|
|
49266
48906
|
} catch {
|
|
49267
48907
|
}
|
|
49268
48908
|
}
|
|
49269
|
-
const archivePath =
|
|
48909
|
+
const archivePath = join56(cleoDir, "todo-archive.json");
|
|
49270
48910
|
if (existsSync52(archivePath)) {
|
|
49271
48911
|
details.archiveJsonExists = true;
|
|
49272
48912
|
try {
|
|
49273
|
-
const data = JSON.parse(
|
|
48913
|
+
const data = JSON.parse(readFileSync35(archivePath, "utf-8"));
|
|
49274
48914
|
details.archiveJsonTaskCount = (data.tasks ?? data.archivedTasks ?? []).length;
|
|
49275
48915
|
} catch {
|
|
49276
48916
|
}
|
|
49277
48917
|
}
|
|
49278
|
-
const sessionsPath =
|
|
48918
|
+
const sessionsPath = join56(cleoDir, "sessions.json");
|
|
49279
48919
|
if (existsSync52(sessionsPath)) {
|
|
49280
48920
|
details.sessionsJsonExists = true;
|
|
49281
48921
|
try {
|
|
49282
|
-
const data = JSON.parse(
|
|
48922
|
+
const data = JSON.parse(readFileSync35(sessionsPath, "utf-8"));
|
|
49283
48923
|
details.sessionsJsonCount = (data.sessions ?? []).length;
|
|
49284
48924
|
} catch {
|
|
49285
48925
|
}
|
|
49286
48926
|
}
|
|
49287
|
-
const dbPath =
|
|
48927
|
+
const dbPath = join56(cleoDir, "tasks.db");
|
|
49288
48928
|
if (existsSync52(dbPath)) {
|
|
49289
48929
|
details.tasksDbExists = true;
|
|
49290
48930
|
try {
|
|
@@ -49325,7 +48965,7 @@ function checkStorageMigration(cwd) {
|
|
|
49325
48965
|
import { createHash as createHash6 } from "node:crypto";
|
|
49326
48966
|
import { existsSync as existsSync53 } from "node:fs";
|
|
49327
48967
|
import { readFile as readFile9, unlink as unlink3, writeFile as writeFile8 } from "node:fs/promises";
|
|
49328
|
-
import { join as
|
|
48968
|
+
import { join as join57 } from "node:path";
|
|
49329
48969
|
var STATE_FILENAME = ".migration-state.json";
|
|
49330
48970
|
async function computeFileChecksum(filePath) {
|
|
49331
48971
|
try {
|
|
@@ -49347,7 +48987,7 @@ async function countRecords(filePath, key) {
|
|
|
49347
48987
|
async function createMigrationState(cleoDir, sourceFiles) {
|
|
49348
48988
|
const files = sourceFiles ?? {};
|
|
49349
48989
|
if (!files.todoJson) {
|
|
49350
|
-
const todoPath =
|
|
48990
|
+
const todoPath = join57(cleoDir, "todo.json");
|
|
49351
48991
|
if (existsSync53(todoPath)) {
|
|
49352
48992
|
files.todoJson = {
|
|
49353
48993
|
path: todoPath,
|
|
@@ -49357,7 +48997,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49357
48997
|
}
|
|
49358
48998
|
}
|
|
49359
48999
|
if (!files.sessionsJson) {
|
|
49360
|
-
const sessionsPath =
|
|
49000
|
+
const sessionsPath = join57(cleoDir, "sessions.json");
|
|
49361
49001
|
if (existsSync53(sessionsPath)) {
|
|
49362
49002
|
files.sessionsJson = {
|
|
49363
49003
|
path: sessionsPath,
|
|
@@ -49367,7 +49007,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49367
49007
|
}
|
|
49368
49008
|
}
|
|
49369
49009
|
if (!files.archiveJson) {
|
|
49370
|
-
const archivePath =
|
|
49010
|
+
const archivePath = join57(cleoDir, "todo-archive.json");
|
|
49371
49011
|
if (existsSync53(archivePath)) {
|
|
49372
49012
|
files.archiveJson = {
|
|
49373
49013
|
path: archivePath,
|
|
@@ -49396,7 +49036,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
|
|
|
49396
49036
|
return state;
|
|
49397
49037
|
}
|
|
49398
49038
|
async function writeMigrationState(cleoDir, state) {
|
|
49399
|
-
const statePath =
|
|
49039
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49400
49040
|
const tempPath = `${statePath}.tmp`;
|
|
49401
49041
|
await writeFile8(tempPath, JSON.stringify(state, null, 2));
|
|
49402
49042
|
await writeFile8(statePath, await readFile9(tempPath));
|
|
@@ -49471,7 +49111,7 @@ async function addMigrationWarning(cleoDir, warning) {
|
|
|
49471
49111
|
}
|
|
49472
49112
|
async function loadMigrationState(cleoDir) {
|
|
49473
49113
|
try {
|
|
49474
|
-
const statePath =
|
|
49114
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49475
49115
|
const content = await readFile9(statePath, "utf-8");
|
|
49476
49116
|
return JSON.parse(content);
|
|
49477
49117
|
} catch {
|
|
@@ -49513,7 +49153,7 @@ async function failMigration(cleoDir, error40) {
|
|
|
49513
49153
|
}
|
|
49514
49154
|
async function clearMigrationState(cleoDir) {
|
|
49515
49155
|
try {
|
|
49516
|
-
const statePath =
|
|
49156
|
+
const statePath = join57(cleoDir, STATE_FILENAME);
|
|
49517
49157
|
await unlink3(statePath);
|
|
49518
49158
|
} catch {
|
|
49519
49159
|
}
|
|
@@ -49574,8 +49214,8 @@ async function verifySourceIntegrity(cleoDir) {
|
|
|
49574
49214
|
}
|
|
49575
49215
|
|
|
49576
49216
|
// packages/core/src/migration/validate.ts
|
|
49577
|
-
import { existsSync as existsSync54, readFileSync as
|
|
49578
|
-
import { join as
|
|
49217
|
+
import { existsSync as existsSync54, readFileSync as readFileSync36, statSync as statSync14 } from "node:fs";
|
|
49218
|
+
import { join as join58 } from "node:path";
|
|
49579
49219
|
function parseJsonError(error40) {
|
|
49580
49220
|
const message = String(error40);
|
|
49581
49221
|
const lineMatch = message.match(/line\s+(\d+)/i);
|
|
@@ -49603,7 +49243,7 @@ function validateJsonFile(filePath, countExtractor) {
|
|
|
49603
49243
|
result.error = "File is empty (0 bytes)";
|
|
49604
49244
|
return result;
|
|
49605
49245
|
}
|
|
49606
|
-
const content =
|
|
49246
|
+
const content = readFileSync36(filePath, "utf-8");
|
|
49607
49247
|
if (content.trim().length === 0) {
|
|
49608
49248
|
result.error = "File contains only whitespace";
|
|
49609
49249
|
return result;
|
|
@@ -49621,7 +49261,7 @@ function validateJsonFile(filePath, countExtractor) {
|
|
|
49621
49261
|
}
|
|
49622
49262
|
function validateSourceFiles(cleoDir) {
|
|
49623
49263
|
const warnings = [];
|
|
49624
|
-
const todoPath =
|
|
49264
|
+
const todoPath = join58(cleoDir, "todo.json");
|
|
49625
49265
|
const todoJson = validateJsonFile(todoPath, (data) => {
|
|
49626
49266
|
const record2 = data;
|
|
49627
49267
|
return Array.isArray(record2.tasks) ? record2.tasks.length : 0;
|
|
@@ -49633,7 +49273,7 @@ function validateSourceFiles(cleoDir) {
|
|
|
49633
49273
|
const location = todoJson.line ? ` at line ${todoJson.line}${todoJson.column ? `, column ${todoJson.column}` : ""}` : "";
|
|
49634
49274
|
todoJson.error = `${todoJson.error}${location} in ${todoPath}`;
|
|
49635
49275
|
}
|
|
49636
|
-
const sessionsPath =
|
|
49276
|
+
const sessionsPath = join58(cleoDir, "sessions.json");
|
|
49637
49277
|
const sessionsJson = validateJsonFile(sessionsPath, (data) => {
|
|
49638
49278
|
const record2 = data;
|
|
49639
49279
|
return Array.isArray(record2.sessions) ? record2.sessions.length : 0;
|
|
@@ -49645,7 +49285,7 @@ function validateSourceFiles(cleoDir) {
|
|
|
49645
49285
|
const location = sessionsJson.line ? ` at line ${sessionsJson.line}${sessionsJson.column ? `, column ${sessionsJson.column}` : ""}` : "";
|
|
49646
49286
|
sessionsJson.error = `${sessionsJson.error}${location} in ${sessionsPath}`;
|
|
49647
49287
|
}
|
|
49648
|
-
const archivePath =
|
|
49288
|
+
const archivePath = join58(cleoDir, "todo-archive.json");
|
|
49649
49289
|
const archiveJson = validateJsonFile(archivePath, (data) => {
|
|
49650
49290
|
const record2 = data;
|
|
49651
49291
|
const tasks2 = Array.isArray(record2.tasks) ? record2.tasks : [];
|
|
@@ -49717,7 +49357,7 @@ Total tasks to migrate: ${result.totalTasks}`);
|
|
|
49717
49357
|
return lines.join("\n");
|
|
49718
49358
|
}
|
|
49719
49359
|
function checkTaskCountMismatch(cleoDir, jsonTaskCount) {
|
|
49720
|
-
const dbPath =
|
|
49360
|
+
const dbPath = join58(cleoDir, "tasks.db");
|
|
49721
49361
|
if (!existsSync54(dbPath)) {
|
|
49722
49362
|
return null;
|
|
49723
49363
|
}
|
|
@@ -49739,7 +49379,7 @@ init_src();
|
|
|
49739
49379
|
init_errors3();
|
|
49740
49380
|
init_paths();
|
|
49741
49381
|
init_json2();
|
|
49742
|
-
import { join as
|
|
49382
|
+
import { join as join59 } from "node:path";
|
|
49743
49383
|
var TARGET_VERSIONS = {
|
|
49744
49384
|
todo: "2.10.0",
|
|
49745
49385
|
config: "2.0.0",
|
|
@@ -49869,7 +49509,7 @@ async function getMigrationStatus(cwd) {
|
|
|
49869
49509
|
} catch {
|
|
49870
49510
|
}
|
|
49871
49511
|
try {
|
|
49872
|
-
const archivePath =
|
|
49512
|
+
const archivePath = join59(getCleoDirAbsolute(cwd), "todo-archive.json");
|
|
49873
49513
|
const archiveData = await readJson(archivePath);
|
|
49874
49514
|
if (archiveData) {
|
|
49875
49515
|
const current = detectVersion(archiveData);
|
|
@@ -49888,7 +49528,7 @@ async function runMigration(fileType, options = {}, cwd) {
|
|
|
49888
49528
|
const filePaths = {
|
|
49889
49529
|
todo: getTaskPath(cwd),
|
|
49890
49530
|
config: getConfigPath(cwd),
|
|
49891
|
-
archive:
|
|
49531
|
+
archive: join59(getCleoDirAbsolute(cwd), "todo-archive.json")
|
|
49892
49532
|
};
|
|
49893
49533
|
const filePath = filePaths[fileType];
|
|
49894
49534
|
if (!filePath) {
|
|
@@ -50085,8 +49725,8 @@ init_src();
|
|
|
50085
49725
|
init_errors3();
|
|
50086
49726
|
init_data_accessor();
|
|
50087
49727
|
init_registry3();
|
|
50088
|
-
import { existsSync as existsSync56, readFileSync as
|
|
50089
|
-
import { basename as basename9, join as
|
|
49728
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "node:fs";
|
|
49729
|
+
import { basename as basename9, join as join62 } from "node:path";
|
|
50090
49730
|
var TASK_ID_RE = /^T\d{3,}$/;
|
|
50091
49731
|
var QUALIFIED_RE = /^([a-z0-9_-]+|\.|\*):T\d{3,}$/;
|
|
50092
49732
|
function validateSyntax(query) {
|
|
@@ -50123,9 +49763,9 @@ function getCurrentProject() {
|
|
|
50123
49763
|
return process.env["NEXUS_CURRENT_PROJECT"];
|
|
50124
49764
|
}
|
|
50125
49765
|
try {
|
|
50126
|
-
const infoPath =
|
|
49766
|
+
const infoPath = join62(process.cwd(), ".cleo", "project-info.json");
|
|
50127
49767
|
if (existsSync56(infoPath)) {
|
|
50128
|
-
const data = JSON.parse(
|
|
49768
|
+
const data = JSON.parse(readFileSync38(infoPath, "utf-8"));
|
|
50129
49769
|
if (typeof data.name === "string" && data.name.length > 0) {
|
|
50130
49770
|
return data.name;
|
|
50131
49771
|
}
|
|
@@ -50162,7 +49802,7 @@ async function resolveProjectPath2(projectName) {
|
|
|
50162
49802
|
return project.path;
|
|
50163
49803
|
}
|
|
50164
49804
|
async function readProjectTasks(projectPath) {
|
|
50165
|
-
const tasksDbPath =
|
|
49805
|
+
const tasksDbPath = join62(projectPath, ".cleo", "tasks.db");
|
|
50166
49806
|
try {
|
|
50167
49807
|
const accessor = await getAccessor(projectPath);
|
|
50168
49808
|
const { tasks: tasks2 } = await accessor.queryTasks({});
|
|
@@ -50766,7 +50406,7 @@ init_paths();
|
|
|
50766
50406
|
init_git_checkpoint();
|
|
50767
50407
|
import { existsSync as existsSync57, readdirSync as readdirSync23, statSync as statSync15 } from "node:fs";
|
|
50768
50408
|
import { readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
|
|
50769
|
-
import { join as
|
|
50409
|
+
import { join as join63, relative as relative9 } from "node:path";
|
|
50770
50410
|
var GITIGNORE_START = "# CLEO:SHARING:START - Auto-managed by cleo sharing sync";
|
|
50771
50411
|
var GITIGNORE_END = "# CLEO:SHARING:END";
|
|
50772
50412
|
function matchesPattern(filePath, pattern) {
|
|
@@ -50794,7 +50434,7 @@ function collectCleoFiles(cleoDir) {
|
|
|
50794
50434
|
const entries = readdirSync23(dir);
|
|
50795
50435
|
for (const entry of entries) {
|
|
50796
50436
|
if (entry === ".git") continue;
|
|
50797
|
-
const fullPath =
|
|
50437
|
+
const fullPath = join63(dir, entry);
|
|
50798
50438
|
const relPath = relative9(cleoDir, fullPath);
|
|
50799
50439
|
try {
|
|
50800
50440
|
const stat2 = statSync15(fullPath);
|
|
@@ -50893,7 +50533,7 @@ function generateGitignoreEntries(sharing) {
|
|
|
50893
50533
|
async function syncGitignore(cwd) {
|
|
50894
50534
|
const config2 = await loadConfig(cwd);
|
|
50895
50535
|
const projectRoot = getProjectRoot(cwd);
|
|
50896
|
-
const gitignorePath =
|
|
50536
|
+
const gitignorePath = join63(projectRoot, ".gitignore");
|
|
50897
50537
|
const entries = generateGitignoreEntries(config2.sharing);
|
|
50898
50538
|
const managedSection = ["", GITIGNORE_START, ...entries, GITIGNORE_END, ""].join("\n");
|
|
50899
50539
|
let content = "";
|
|
@@ -51642,8 +51282,8 @@ function parseLogLines(lines) {
|
|
|
51642
51282
|
// packages/core/src/observability/log-reader.ts
|
|
51643
51283
|
init_logger();
|
|
51644
51284
|
init_paths();
|
|
51645
|
-
import { createReadStream, existsSync as existsSync58, readdirSync as readdirSync24, readFileSync as
|
|
51646
|
-
import { join as
|
|
51285
|
+
import { createReadStream, existsSync as existsSync58, readdirSync as readdirSync24, readFileSync as readFileSync39, statSync as statSync16 } from "node:fs";
|
|
51286
|
+
import { join as join64 } from "node:path";
|
|
51647
51287
|
import { createInterface } from "node:readline";
|
|
51648
51288
|
var CLEO_LOG_PATTERN = /^cleo\.(\d{4}-\d{2}-\d{2})\.(\d+)\.log$/;
|
|
51649
51289
|
var MIGRATION_LOG_PATTERN = /^migration-.*\.jsonl$/;
|
|
@@ -51651,11 +51291,11 @@ function getProjectLogDir(cwd) {
|
|
|
51651
51291
|
const runtimeDir = getLogDir();
|
|
51652
51292
|
if (runtimeDir) return runtimeDir;
|
|
51653
51293
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
51654
|
-
const logsDir =
|
|
51294
|
+
const logsDir = join64(cleoDir, "logs");
|
|
51655
51295
|
return existsSync58(logsDir) ? logsDir : null;
|
|
51656
51296
|
}
|
|
51657
51297
|
function getGlobalLogDir() {
|
|
51658
|
-
return
|
|
51298
|
+
return join64(getCleoHome(), "logs");
|
|
51659
51299
|
}
|
|
51660
51300
|
function scanLogDir(dir, includeMigration) {
|
|
51661
51301
|
if (!existsSync58(dir)) return [];
|
|
@@ -51670,7 +51310,7 @@ function scanLogDir(dir, includeMigration) {
|
|
|
51670
51310
|
const cleoMatch = name2.match(CLEO_LOG_PATTERN);
|
|
51671
51311
|
const isMigration = MIGRATION_LOG_PATTERN.test(name2);
|
|
51672
51312
|
if (!cleoMatch && (!isMigration || !includeMigration)) continue;
|
|
51673
|
-
const filePath =
|
|
51313
|
+
const filePath = join64(dir, name2);
|
|
51674
51314
|
let stat2;
|
|
51675
51315
|
try {
|
|
51676
51316
|
stat2 = statSync16(filePath);
|
|
@@ -51714,7 +51354,7 @@ function discoverLogFiles(options, cwd) {
|
|
|
51714
51354
|
function readLogFileLines(filePath) {
|
|
51715
51355
|
let content;
|
|
51716
51356
|
try {
|
|
51717
|
-
content =
|
|
51357
|
+
content = readFileSync39(filePath, "utf-8");
|
|
51718
51358
|
} catch {
|
|
51719
51359
|
return [];
|
|
51720
51360
|
}
|
|
@@ -51981,14 +51621,14 @@ function analyzeDependencies(children, allTasks) {
|
|
|
51981
51621
|
|
|
51982
51622
|
// packages/core/src/orchestration/context.ts
|
|
51983
51623
|
init_paths();
|
|
51984
|
-
import { existsSync as existsSync59, readFileSync as
|
|
51624
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "node:fs";
|
|
51985
51625
|
function countManifestEntries(projectRoot) {
|
|
51986
51626
|
const manifestPath = getManifestPath(projectRoot);
|
|
51987
51627
|
if (!existsSync59(manifestPath)) {
|
|
51988
51628
|
return 0;
|
|
51989
51629
|
}
|
|
51990
51630
|
try {
|
|
51991
|
-
const content =
|
|
51631
|
+
const content = readFileSync40(manifestPath, "utf-8");
|
|
51992
51632
|
return content.split("\n").filter((l) => l.trim()).length;
|
|
51993
51633
|
} catch {
|
|
51994
51634
|
return 0;
|
|
@@ -52521,22 +52161,22 @@ __export(otel_exports, {
|
|
|
52521
52161
|
getOtelSummary: () => getOtelSummary,
|
|
52522
52162
|
getRealTokenUsage: () => getRealTokenUsage
|
|
52523
52163
|
});
|
|
52524
|
-
import { copyFileSync as copyFileSync6, existsSync as existsSync60, readFileSync as
|
|
52525
|
-
import { join as
|
|
52164
|
+
import { copyFileSync as copyFileSync6, existsSync as existsSync60, readFileSync as readFileSync41, writeFileSync as writeFileSync6 } from "node:fs";
|
|
52165
|
+
import { join as join65 } from "node:path";
|
|
52526
52166
|
function getProjectRoot2() {
|
|
52527
52167
|
let dir = process.cwd();
|
|
52528
52168
|
while (dir !== "/") {
|
|
52529
|
-
if (existsSync60(
|
|
52530
|
-
dir =
|
|
52169
|
+
if (existsSync60(join65(dir, ".cleo", "config.json"))) return dir;
|
|
52170
|
+
dir = join65(dir, "..");
|
|
52531
52171
|
}
|
|
52532
52172
|
return process.cwd();
|
|
52533
52173
|
}
|
|
52534
52174
|
function getTokenFilePath2() {
|
|
52535
|
-
return
|
|
52175
|
+
return join65(getProjectRoot2(), ".cleo", "metrics", "TOKEN_USAGE.jsonl");
|
|
52536
52176
|
}
|
|
52537
52177
|
function readJsonlFile3(filePath) {
|
|
52538
52178
|
if (!existsSync60(filePath)) return [];
|
|
52539
|
-
const content =
|
|
52179
|
+
const content = readFileSync41(filePath, "utf-8").trim();
|
|
52540
52180
|
if (!content) return [];
|
|
52541
52181
|
return content.split("\n").map((line2) => JSON.parse(line2));
|
|
52542
52182
|
}
|
|
@@ -53397,7 +53037,7 @@ __export(release_exports, {
|
|
|
53397
53037
|
|
|
53398
53038
|
// packages/core/src/release/artifacts.ts
|
|
53399
53039
|
import { execFile as execFile4 } from "node:child_process";
|
|
53400
|
-
import { existsSync as existsSync61, readFileSync as
|
|
53040
|
+
import { existsSync as existsSync61, readFileSync as readFileSync42 } from "node:fs";
|
|
53401
53041
|
import { promisify as promisify4 } from "node:util";
|
|
53402
53042
|
var execFileAsync4 = promisify4(execFile4);
|
|
53403
53043
|
async function commandExists(cmd) {
|
|
@@ -53466,7 +53106,7 @@ var npmPackageHandler = {
|
|
|
53466
53106
|
return { success: false, output: `package.json not found: ${packageFile}`, dryRun: false };
|
|
53467
53107
|
}
|
|
53468
53108
|
try {
|
|
53469
|
-
const content = JSON.parse(
|
|
53109
|
+
const content = JSON.parse(readFileSync42(packageFile, "utf-8"));
|
|
53470
53110
|
const requiredFields = ["name", "version", "description", "license"];
|
|
53471
53111
|
const missing = requiredFields.filter((f) => !content[f]);
|
|
53472
53112
|
if (missing.length > 0) {
|
|
@@ -53547,7 +53187,7 @@ var goModuleHandler = {
|
|
|
53547
53187
|
if (!await commandExists("go")) {
|
|
53548
53188
|
return { success: false, output: "go command not found", dryRun: false };
|
|
53549
53189
|
}
|
|
53550
|
-
const content =
|
|
53190
|
+
const content = readFileSync42(packageFile, "utf-8");
|
|
53551
53191
|
const moduleMatch = content.match(/^module\s+(\S+)/m);
|
|
53552
53192
|
if (!moduleMatch) {
|
|
53553
53193
|
return { success: false, output: "Module path not found in go.mod", dryRun: false };
|
|
@@ -53578,7 +53218,7 @@ var cargoCrateHandler = {
|
|
|
53578
53218
|
if (!await commandExists("cargo")) {
|
|
53579
53219
|
return { success: false, output: "cargo command not found", dryRun: false };
|
|
53580
53220
|
}
|
|
53581
|
-
const content =
|
|
53221
|
+
const content = readFileSync42(packageFile, "utf-8");
|
|
53582
53222
|
if (!content.includes("[package]")) {
|
|
53583
53223
|
return { success: false, output: "[package] section not found in Cargo.toml", dryRun: false };
|
|
53584
53224
|
}
|
|
@@ -53937,18 +53577,18 @@ function describeChannel(channel) {
|
|
|
53937
53577
|
}
|
|
53938
53578
|
|
|
53939
53579
|
// packages/core/src/release/ci.ts
|
|
53940
|
-
import { existsSync as existsSync64, mkdirSync as mkdirSync14, readFileSync as
|
|
53941
|
-
import { dirname as dirname14, join as
|
|
53580
|
+
import { existsSync as existsSync64, mkdirSync as mkdirSync14, readFileSync as readFileSync44, writeFileSync as writeFileSync7 } from "node:fs";
|
|
53581
|
+
import { dirname as dirname14, join as join67 } from "node:path";
|
|
53942
53582
|
|
|
53943
53583
|
// packages/core/src/release/release-config.ts
|
|
53944
53584
|
init_paths();
|
|
53945
|
-
import { existsSync as existsSync63, readFileSync as
|
|
53946
|
-
import { join as
|
|
53585
|
+
import { existsSync as existsSync63, readFileSync as readFileSync43 } from "node:fs";
|
|
53586
|
+
import { join as join66 } from "node:path";
|
|
53947
53587
|
function readConfigValueSync2(path2, defaultValue, cwd) {
|
|
53948
53588
|
try {
|
|
53949
|
-
const configPath =
|
|
53589
|
+
const configPath = join66(getCleoDir(cwd), "config.json");
|
|
53950
53590
|
if (!existsSync63(configPath)) return defaultValue;
|
|
53951
|
-
const config2 = JSON.parse(
|
|
53591
|
+
const config2 = JSON.parse(readFileSync43(configPath, "utf-8"));
|
|
53952
53592
|
const keys = path2.split(".");
|
|
53953
53593
|
let value = config2;
|
|
53954
53594
|
for (const key of keys) {
|
|
@@ -54110,9 +53750,9 @@ function getPlatformPath(platform5) {
|
|
|
54110
53750
|
}
|
|
54111
53751
|
function detectCIPlatform(projectDir) {
|
|
54112
53752
|
const dir = projectDir ?? process.cwd();
|
|
54113
|
-
if (existsSync64(
|
|
54114
|
-
if (existsSync64(
|
|
54115
|
-
if (existsSync64(
|
|
53753
|
+
if (existsSync64(join67(dir, ".github"))) return "github-actions";
|
|
53754
|
+
if (existsSync64(join67(dir, ".gitlab-ci.yml"))) return "gitlab-ci";
|
|
53755
|
+
if (existsSync64(join67(dir, ".circleci"))) return "circleci";
|
|
54116
53756
|
return null;
|
|
54117
53757
|
}
|
|
54118
53758
|
function generateGitHubActions(config2) {
|
|
@@ -54214,7 +53854,7 @@ function generateCIConfig(platform5, cwd) {
|
|
|
54214
53854
|
}
|
|
54215
53855
|
function writeCIConfig(platform5, options = {}) {
|
|
54216
53856
|
const projectDir = options.projectDir ?? process.cwd();
|
|
54217
|
-
const outputPath =
|
|
53857
|
+
const outputPath = join67(projectDir, getPlatformPath(platform5));
|
|
54218
53858
|
const content = generateCIConfig(platform5, projectDir);
|
|
54219
53859
|
if (options.dryRun) {
|
|
54220
53860
|
return { action: "would_write", path: outputPath, content };
|
|
@@ -54225,13 +53865,13 @@ function writeCIConfig(platform5, options = {}) {
|
|
|
54225
53865
|
}
|
|
54226
53866
|
function validateCIConfig(platform5, projectDir) {
|
|
54227
53867
|
const dir = projectDir ?? process.cwd();
|
|
54228
|
-
const configPath =
|
|
53868
|
+
const configPath = join67(dir, getPlatformPath(platform5));
|
|
54229
53869
|
if (!existsSync64(configPath)) {
|
|
54230
53870
|
return { valid: false, exists: false, errors: ["Config file not found"] };
|
|
54231
53871
|
}
|
|
54232
53872
|
const errors = [];
|
|
54233
53873
|
try {
|
|
54234
|
-
const content =
|
|
53874
|
+
const content = readFileSync44(configPath, "utf-8");
|
|
54235
53875
|
if (!content.trim()) errors.push("Config file is empty");
|
|
54236
53876
|
} catch (err) {
|
|
54237
53877
|
errors.push(`Cannot read config: ${String(err)}`);
|
|
@@ -54483,7 +54123,7 @@ function checkDoubleListing(releaseTaskIds, existingReleases) {
|
|
|
54483
54123
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
54484
54124
|
import { existsSync as existsSync66, renameSync as renameSync5 } from "node:fs";
|
|
54485
54125
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
54486
|
-
import { join as
|
|
54126
|
+
import { join as join69 } from "node:path";
|
|
54487
54127
|
import { and as and9, count, desc as desc4, eq as eq12 } from "drizzle-orm";
|
|
54488
54128
|
init_paths();
|
|
54489
54129
|
init_tasks_schema();
|
|
@@ -54492,13 +54132,13 @@ init_tasks_schema();
|
|
|
54492
54132
|
init_src();
|
|
54493
54133
|
init_errors3();
|
|
54494
54134
|
init_paths();
|
|
54495
|
-
import { existsSync as existsSync65, readFileSync as
|
|
54496
|
-
import { join as
|
|
54135
|
+
import { existsSync as existsSync65, readFileSync as readFileSync45, writeFileSync as writeFileSync8 } from "node:fs";
|
|
54136
|
+
import { join as join68 } from "node:path";
|
|
54497
54137
|
function readConfigValueSync3(path2, defaultValue, cwd) {
|
|
54498
54138
|
try {
|
|
54499
|
-
const configPath =
|
|
54139
|
+
const configPath = join68(getCleoDir(cwd), "config.json");
|
|
54500
54140
|
if (!existsSync65(configPath)) return defaultValue;
|
|
54501
|
-
const config2 = JSON.parse(
|
|
54141
|
+
const config2 = JSON.parse(readFileSync45(configPath, "utf-8"));
|
|
54502
54142
|
const keys = path2.split(".");
|
|
54503
54143
|
let value = config2;
|
|
54504
54144
|
for (const key of keys) {
|
|
@@ -54593,7 +54233,7 @@ function isVersionBumpConfigured(cwd) {
|
|
|
54593
54233
|
return getVersionBumpConfig(cwd).length > 0;
|
|
54594
54234
|
}
|
|
54595
54235
|
function bumpFile(target, newVersion, projectRoot) {
|
|
54596
|
-
const filePath =
|
|
54236
|
+
const filePath = join68(projectRoot, target.file);
|
|
54597
54237
|
if (!existsSync65(filePath)) {
|
|
54598
54238
|
return {
|
|
54599
54239
|
file: target.file,
|
|
@@ -54603,7 +54243,7 @@ function bumpFile(target, newVersion, projectRoot) {
|
|
|
54603
54243
|
};
|
|
54604
54244
|
}
|
|
54605
54245
|
try {
|
|
54606
|
-
const content =
|
|
54246
|
+
const content = readFileSync45(filePath, "utf-8");
|
|
54607
54247
|
let previousVersion;
|
|
54608
54248
|
let newContent;
|
|
54609
54249
|
switch (target.strategy) {
|
|
@@ -54974,7 +54614,7 @@ async function generateReleaseChangelog(version2, loadTasksFn, cwd) {
|
|
|
54974
54614
|
}
|
|
54975
54615
|
const changelog = sections.join("\n");
|
|
54976
54616
|
await db.update(releaseManifests).set({ changelog }).where(eq12(releaseManifests.version, normalizedVersion)).run();
|
|
54977
|
-
const changelogPath =
|
|
54617
|
+
const changelogPath = join69(cwd ?? process.cwd(), "CHANGELOG.md");
|
|
54978
54618
|
let existingChangelogContent = "";
|
|
54979
54619
|
try {
|
|
54980
54620
|
existingChangelogContent = await readFile12(changelogPath, "utf8");
|
|
@@ -55130,10 +54770,10 @@ async function runReleaseGates(version2, loadTasksFn, cwd, opts) {
|
|
|
55130
54770
|
message: incompleteTasks.length === 0 ? "All tasks completed" : `${incompleteTasks.length} tasks not completed: ${incompleteTasks.join(", ")}`
|
|
55131
54771
|
});
|
|
55132
54772
|
const projectRoot = cwd ?? getProjectRoot();
|
|
55133
|
-
const monorepoDist =
|
|
55134
|
-
const rootDist =
|
|
54773
|
+
const monorepoDist = join69(projectRoot, "packages", "cleo", "dist", "cli", "index.js");
|
|
54774
|
+
const rootDist = join69(projectRoot, "dist", "cli", "index.js");
|
|
55135
54775
|
const distExists = existsSync66(monorepoDist) || existsSync66(rootDist);
|
|
55136
|
-
const isNodeProject = existsSync66(
|
|
54776
|
+
const isNodeProject = existsSync66(join69(projectRoot, "package.json"));
|
|
55137
54777
|
if (isNodeProject) {
|
|
55138
54778
|
gates.push({
|
|
55139
54779
|
name: "build_artifact",
|
|
@@ -55280,7 +54920,7 @@ async function rollbackRelease(version2, reason, cwd) {
|
|
|
55280
54920
|
};
|
|
55281
54921
|
}
|
|
55282
54922
|
async function readPushPolicy(cwd) {
|
|
55283
|
-
const configPath =
|
|
54923
|
+
const configPath = join69(getCleoDirAbsolute(cwd), "config.json");
|
|
55284
54924
|
let config2;
|
|
55285
54925
|
try {
|
|
55286
54926
|
const raw = await readFile12(configPath, "utf-8");
|
|
@@ -55384,7 +55024,7 @@ async function markReleasePushed(version2, pushedAt, cwd, provenance) {
|
|
|
55384
55024
|
}).where(eq12(releaseManifests.version, normalizedVersion)).run();
|
|
55385
55025
|
}
|
|
55386
55026
|
async function migrateReleasesJsonToSqlite(projectRoot) {
|
|
55387
|
-
const releasesPath =
|
|
55027
|
+
const releasesPath = join69(getCleoDirAbsolute(projectRoot), "releases.json");
|
|
55388
55028
|
if (!existsSync66(releasesPath)) {
|
|
55389
55029
|
return { migrated: 0 };
|
|
55390
55030
|
}
|
|
@@ -55706,22 +55346,22 @@ __export(roadmap_exports, {
|
|
|
55706
55346
|
getRoadmap: () => getRoadmap
|
|
55707
55347
|
});
|
|
55708
55348
|
init_data_accessor();
|
|
55709
|
-
import { existsSync as existsSync67, readFileSync as
|
|
55710
|
-
import { join as
|
|
55349
|
+
import { existsSync as existsSync67, readFileSync as readFileSync46 } from "node:fs";
|
|
55350
|
+
import { join as join70 } from "node:path";
|
|
55711
55351
|
async function getRoadmap(opts, accessor) {
|
|
55712
55352
|
const acc = accessor ?? await getAccessor(opts.cwd);
|
|
55713
55353
|
const { tasks: tasks2 } = await acc.queryTasks({});
|
|
55714
|
-
const versionPath =
|
|
55715
|
-
const currentVersion = existsSync67(versionPath) ?
|
|
55354
|
+
const versionPath = join70(opts.cwd ?? process.cwd(), "VERSION");
|
|
55355
|
+
const currentVersion = existsSync67(versionPath) ? readFileSync46(versionPath, "utf-8").trim() : "unknown";
|
|
55716
55356
|
const childParentIds = new Set(tasks2.filter((t) => t.parentId).map((t) => t.parentId));
|
|
55717
55357
|
const epics = tasks2.filter((t) => childParentIds.has(t.id));
|
|
55718
55358
|
const pending = epics.filter((e) => e.status !== "done");
|
|
55719
55359
|
const completed = epics.filter((e) => e.status === "done");
|
|
55720
55360
|
const releaseHistory = [];
|
|
55721
55361
|
if (opts.includeHistory) {
|
|
55722
|
-
const changelogPath =
|
|
55362
|
+
const changelogPath = join70(opts.cwd ?? process.cwd(), "CHANGELOG.md");
|
|
55723
55363
|
if (existsSync67(changelogPath)) {
|
|
55724
|
-
const content =
|
|
55364
|
+
const content = readFileSync46(changelogPath, "utf-8");
|
|
55725
55365
|
const versionRegex = /^##\s+\[?v?(\d+\.\d+\.\d+[^\]]*)\]?\s*[-(]?\s*(\d{4}-\d{2}-\d{2})?/gm;
|
|
55726
55366
|
for (const match of content.matchAll(versionRegex)) {
|
|
55727
55367
|
releaseHistory.push({
|
|
@@ -55767,9 +55407,9 @@ __export(routing_exports, {
|
|
|
55767
55407
|
var CAPABILITY_MATRIX = [
|
|
55768
55408
|
// === Tasks Domain ===
|
|
55769
55409
|
// 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: "
|
|
55410
|
+
{ domain: "tasks", operation: "show", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55411
|
+
{ domain: "tasks", operation: "list", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55412
|
+
{ domain: "tasks", operation: "find", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55773
55413
|
{
|
|
55774
55414
|
domain: "tasks",
|
|
55775
55415
|
operation: "tree",
|
|
@@ -55798,8 +55438,8 @@ var CAPABILITY_MATRIX = [
|
|
|
55798
55438
|
mode: "native",
|
|
55799
55439
|
preferredChannel: "either"
|
|
55800
55440
|
},
|
|
55801
|
-
{ domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "
|
|
55802
|
-
{ domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "
|
|
55441
|
+
{ domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55442
|
+
{ domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
55803
55443
|
{
|
|
55804
55444
|
domain: "tasks",
|
|
55805
55445
|
operation: "relates",
|
|
@@ -55826,7 +55466,7 @@ var CAPABILITY_MATRIX = [
|
|
|
55826
55466
|
operation: "current",
|
|
55827
55467
|
gateway: "query",
|
|
55828
55468
|
mode: "native",
|
|
55829
|
-
preferredChannel: "
|
|
55469
|
+
preferredChannel: "cli"
|
|
55830
55470
|
},
|
|
55831
55471
|
{
|
|
55832
55472
|
domain: "tasks",
|
|
@@ -55836,20 +55476,20 @@ var CAPABILITY_MATRIX = [
|
|
|
55836
55476
|
preferredChannel: "either"
|
|
55837
55477
|
},
|
|
55838
55478
|
// Mutate operations
|
|
55839
|
-
{ domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "
|
|
55479
|
+
{ domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "cli" },
|
|
55840
55480
|
{
|
|
55841
55481
|
domain: "tasks",
|
|
55842
55482
|
operation: "update",
|
|
55843
55483
|
gateway: "mutate",
|
|
55844
55484
|
mode: "native",
|
|
55845
|
-
preferredChannel: "
|
|
55485
|
+
preferredChannel: "cli"
|
|
55846
55486
|
},
|
|
55847
55487
|
{
|
|
55848
55488
|
domain: "tasks",
|
|
55849
55489
|
operation: "complete",
|
|
55850
55490
|
gateway: "mutate",
|
|
55851
55491
|
mode: "native",
|
|
55852
|
-
preferredChannel: "
|
|
55492
|
+
preferredChannel: "cli"
|
|
55853
55493
|
},
|
|
55854
55494
|
{
|
|
55855
55495
|
domain: "tasks",
|
|
@@ -55905,14 +55545,14 @@ var CAPABILITY_MATRIX = [
|
|
|
55905
55545
|
operation: "start",
|
|
55906
55546
|
gateway: "mutate",
|
|
55907
55547
|
mode: "native",
|
|
55908
|
-
preferredChannel: "
|
|
55548
|
+
preferredChannel: "cli"
|
|
55909
55549
|
},
|
|
55910
55550
|
{
|
|
55911
55551
|
domain: "tasks",
|
|
55912
55552
|
operation: "stop",
|
|
55913
55553
|
gateway: "mutate",
|
|
55914
55554
|
mode: "native",
|
|
55915
|
-
preferredChannel: "
|
|
55555
|
+
preferredChannel: "cli"
|
|
55916
55556
|
},
|
|
55917
55557
|
// Sync sub-domain (provider-agnostic task reconciliation)
|
|
55918
55558
|
{
|
|
@@ -55943,7 +55583,7 @@ var CAPABILITY_MATRIX = [
|
|
|
55943
55583
|
operation: "status",
|
|
55944
55584
|
gateway: "query",
|
|
55945
55585
|
mode: "native",
|
|
55946
|
-
preferredChannel: "
|
|
55586
|
+
preferredChannel: "cli"
|
|
55947
55587
|
},
|
|
55948
55588
|
{
|
|
55949
55589
|
domain: "session",
|
|
@@ -55978,14 +55618,14 @@ var CAPABILITY_MATRIX = [
|
|
|
55978
55618
|
operation: "handoff.show",
|
|
55979
55619
|
gateway: "query",
|
|
55980
55620
|
mode: "native",
|
|
55981
|
-
preferredChannel: "
|
|
55621
|
+
preferredChannel: "cli"
|
|
55982
55622
|
},
|
|
55983
55623
|
{
|
|
55984
55624
|
domain: "session",
|
|
55985
55625
|
operation: "briefing.show",
|
|
55986
55626
|
gateway: "query",
|
|
55987
55627
|
mode: "native",
|
|
55988
|
-
preferredChannel: "
|
|
55628
|
+
preferredChannel: "cli"
|
|
55989
55629
|
},
|
|
55990
55630
|
{
|
|
55991
55631
|
domain: "session",
|
|
@@ -56000,14 +55640,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56000
55640
|
operation: "start",
|
|
56001
55641
|
gateway: "mutate",
|
|
56002
55642
|
mode: "native",
|
|
56003
|
-
preferredChannel: "
|
|
55643
|
+
preferredChannel: "cli"
|
|
56004
55644
|
},
|
|
56005
55645
|
{
|
|
56006
55646
|
domain: "session",
|
|
56007
55647
|
operation: "end",
|
|
56008
55648
|
gateway: "mutate",
|
|
56009
55649
|
mode: "native",
|
|
56010
|
-
preferredChannel: "
|
|
55650
|
+
preferredChannel: "cli"
|
|
56011
55651
|
},
|
|
56012
55652
|
{
|
|
56013
55653
|
domain: "session",
|
|
@@ -56095,7 +55735,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56095
55735
|
mode: "native",
|
|
56096
55736
|
preferredChannel: "either"
|
|
56097
55737
|
},
|
|
56098
|
-
{ domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "
|
|
55738
|
+
{ domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56099
55739
|
{
|
|
56100
55740
|
domain: "admin",
|
|
56101
55741
|
operation: "log",
|
|
@@ -56110,7 +55750,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56110
55750
|
mode: "native",
|
|
56111
55751
|
preferredChannel: "either"
|
|
56112
55752
|
},
|
|
56113
|
-
{ domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "
|
|
55753
|
+
{ domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56114
55754
|
{
|
|
56115
55755
|
domain: "admin",
|
|
56116
55756
|
operation: "token",
|
|
@@ -56139,7 +55779,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56139
55779
|
mode: "native",
|
|
56140
55780
|
preferredChannel: "either"
|
|
56141
55781
|
},
|
|
56142
|
-
{ domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "
|
|
55782
|
+
{ domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "cli" },
|
|
56143
55783
|
// Mutate operations
|
|
56144
55784
|
{
|
|
56145
55785
|
domain: "admin",
|
|
@@ -56302,7 +55942,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56302
55942
|
operation: "compliance.summary",
|
|
56303
55943
|
gateway: "query",
|
|
56304
55944
|
mode: "native",
|
|
56305
|
-
preferredChannel: "
|
|
55945
|
+
preferredChannel: "cli"
|
|
56306
55946
|
},
|
|
56307
55947
|
{
|
|
56308
55948
|
domain: "check",
|
|
@@ -56359,7 +55999,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56359
55999
|
operation: "compliance.record",
|
|
56360
56000
|
gateway: "mutate",
|
|
56361
56001
|
mode: "native",
|
|
56362
|
-
preferredChannel: "
|
|
56002
|
+
preferredChannel: "cli"
|
|
56363
56003
|
},
|
|
56364
56004
|
{
|
|
56365
56005
|
domain: "check",
|
|
@@ -56460,7 +56100,7 @@ var CAPABILITY_MATRIX = [
|
|
|
56460
56100
|
operation: "spawn",
|
|
56461
56101
|
gateway: "mutate",
|
|
56462
56102
|
mode: "native",
|
|
56463
|
-
preferredChannel: "
|
|
56103
|
+
preferredChannel: "cli"
|
|
56464
56104
|
},
|
|
56465
56105
|
{
|
|
56466
56106
|
domain: "orchestrate",
|
|
@@ -56504,42 +56144,42 @@ var CAPABILITY_MATRIX = [
|
|
|
56504
56144
|
operation: "find",
|
|
56505
56145
|
gateway: "query",
|
|
56506
56146
|
mode: "native",
|
|
56507
|
-
preferredChannel: "
|
|
56147
|
+
preferredChannel: "cli"
|
|
56508
56148
|
},
|
|
56509
56149
|
{
|
|
56510
56150
|
domain: "memory",
|
|
56511
56151
|
operation: "timeline",
|
|
56512
56152
|
gateway: "query",
|
|
56513
56153
|
mode: "native",
|
|
56514
|
-
preferredChannel: "
|
|
56154
|
+
preferredChannel: "cli"
|
|
56515
56155
|
},
|
|
56516
56156
|
{
|
|
56517
56157
|
domain: "memory",
|
|
56518
56158
|
operation: "fetch",
|
|
56519
56159
|
gateway: "query",
|
|
56520
56160
|
mode: "native",
|
|
56521
|
-
preferredChannel: "
|
|
56161
|
+
preferredChannel: "cli"
|
|
56522
56162
|
},
|
|
56523
56163
|
{
|
|
56524
56164
|
domain: "memory",
|
|
56525
56165
|
operation: "decision.find",
|
|
56526
56166
|
gateway: "query",
|
|
56527
56167
|
mode: "native",
|
|
56528
|
-
preferredChannel: "
|
|
56168
|
+
preferredChannel: "cli"
|
|
56529
56169
|
},
|
|
56530
56170
|
{
|
|
56531
56171
|
domain: "memory",
|
|
56532
56172
|
operation: "pattern.find",
|
|
56533
56173
|
gateway: "query",
|
|
56534
56174
|
mode: "native",
|
|
56535
|
-
preferredChannel: "
|
|
56175
|
+
preferredChannel: "cli"
|
|
56536
56176
|
},
|
|
56537
56177
|
{
|
|
56538
56178
|
domain: "memory",
|
|
56539
56179
|
operation: "learning.find",
|
|
56540
56180
|
gateway: "query",
|
|
56541
56181
|
mode: "native",
|
|
56542
|
-
preferredChannel: "
|
|
56182
|
+
preferredChannel: "cli"
|
|
56543
56183
|
},
|
|
56544
56184
|
{
|
|
56545
56185
|
domain: "memory",
|
|
@@ -56582,28 +56222,28 @@ var CAPABILITY_MATRIX = [
|
|
|
56582
56222
|
operation: "observe",
|
|
56583
56223
|
gateway: "mutate",
|
|
56584
56224
|
mode: "native",
|
|
56585
|
-
preferredChannel: "
|
|
56225
|
+
preferredChannel: "cli"
|
|
56586
56226
|
},
|
|
56587
56227
|
{
|
|
56588
56228
|
domain: "memory",
|
|
56589
56229
|
operation: "decision.store",
|
|
56590
56230
|
gateway: "mutate",
|
|
56591
56231
|
mode: "native",
|
|
56592
|
-
preferredChannel: "
|
|
56232
|
+
preferredChannel: "cli"
|
|
56593
56233
|
},
|
|
56594
56234
|
{
|
|
56595
56235
|
domain: "memory",
|
|
56596
56236
|
operation: "pattern.store",
|
|
56597
56237
|
gateway: "mutate",
|
|
56598
56238
|
mode: "native",
|
|
56599
|
-
preferredChannel: "
|
|
56239
|
+
preferredChannel: "cli"
|
|
56600
56240
|
},
|
|
56601
56241
|
{
|
|
56602
56242
|
domain: "memory",
|
|
56603
56243
|
operation: "learning.store",
|
|
56604
56244
|
gateway: "mutate",
|
|
56605
56245
|
mode: "native",
|
|
56606
|
-
preferredChannel: "
|
|
56246
|
+
preferredChannel: "cli"
|
|
56607
56247
|
},
|
|
56608
56248
|
{
|
|
56609
56249
|
domain: "memory",
|
|
@@ -56633,14 +56273,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56633
56273
|
operation: "stage.validate",
|
|
56634
56274
|
gateway: "query",
|
|
56635
56275
|
mode: "native",
|
|
56636
|
-
preferredChannel: "
|
|
56276
|
+
preferredChannel: "cli"
|
|
56637
56277
|
},
|
|
56638
56278
|
{
|
|
56639
56279
|
domain: "pipeline",
|
|
56640
56280
|
operation: "stage.status",
|
|
56641
56281
|
gateway: "query",
|
|
56642
56282
|
mode: "native",
|
|
56643
|
-
preferredChannel: "
|
|
56283
|
+
preferredChannel: "cli"
|
|
56644
56284
|
},
|
|
56645
56285
|
{
|
|
56646
56286
|
domain: "pipeline",
|
|
@@ -56864,21 +56504,21 @@ var CAPABILITY_MATRIX = [
|
|
|
56864
56504
|
operation: "skill.list",
|
|
56865
56505
|
gateway: "query",
|
|
56866
56506
|
mode: "native",
|
|
56867
|
-
preferredChannel: "
|
|
56507
|
+
preferredChannel: "cli"
|
|
56868
56508
|
},
|
|
56869
56509
|
{
|
|
56870
56510
|
domain: "tools",
|
|
56871
56511
|
operation: "skill.show",
|
|
56872
56512
|
gateway: "query",
|
|
56873
56513
|
mode: "native",
|
|
56874
|
-
preferredChannel: "
|
|
56514
|
+
preferredChannel: "cli"
|
|
56875
56515
|
},
|
|
56876
56516
|
{
|
|
56877
56517
|
domain: "tools",
|
|
56878
56518
|
operation: "skill.find",
|
|
56879
56519
|
gateway: "query",
|
|
56880
56520
|
mode: "native",
|
|
56881
|
-
preferredChannel: "
|
|
56521
|
+
preferredChannel: "cli"
|
|
56882
56522
|
},
|
|
56883
56523
|
{
|
|
56884
56524
|
domain: "tools",
|
|
@@ -56949,14 +56589,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56949
56589
|
operation: "provider.list",
|
|
56950
56590
|
gateway: "query",
|
|
56951
56591
|
mode: "native",
|
|
56952
|
-
preferredChannel: "
|
|
56592
|
+
preferredChannel: "cli"
|
|
56953
56593
|
},
|
|
56954
56594
|
{
|
|
56955
56595
|
domain: "tools",
|
|
56956
56596
|
operation: "provider.detect",
|
|
56957
56597
|
gateway: "query",
|
|
56958
56598
|
mode: "native",
|
|
56959
|
-
preferredChannel: "
|
|
56599
|
+
preferredChannel: "cli"
|
|
56960
56600
|
},
|
|
56961
56601
|
{
|
|
56962
56602
|
domain: "tools",
|
|
@@ -56992,14 +56632,14 @@ var CAPABILITY_MATRIX = [
|
|
|
56992
56632
|
operation: "adapter.list",
|
|
56993
56633
|
gateway: "query",
|
|
56994
56634
|
mode: "native",
|
|
56995
|
-
preferredChannel: "
|
|
56635
|
+
preferredChannel: "cli"
|
|
56996
56636
|
},
|
|
56997
56637
|
{
|
|
56998
56638
|
domain: "tools",
|
|
56999
56639
|
operation: "adapter.show",
|
|
57000
56640
|
gateway: "query",
|
|
57001
56641
|
mode: "native",
|
|
57002
|
-
preferredChannel: "
|
|
56642
|
+
preferredChannel: "cli"
|
|
57003
56643
|
},
|
|
57004
56644
|
{
|
|
57005
56645
|
domain: "tools",
|
|
@@ -57020,7 +56660,7 @@ var CAPABILITY_MATRIX = [
|
|
|
57020
56660
|
operation: "adapter.activate",
|
|
57021
56661
|
gateway: "mutate",
|
|
57022
56662
|
mode: "native",
|
|
57023
|
-
preferredChannel: "
|
|
56663
|
+
preferredChannel: "cli"
|
|
57024
56664
|
},
|
|
57025
56665
|
{
|
|
57026
56666
|
domain: "tools",
|
|
@@ -57193,14 +56833,14 @@ var CAPABILITY_MATRIX = [
|
|
|
57193
56833
|
operation: "list",
|
|
57194
56834
|
gateway: "query",
|
|
57195
56835
|
mode: "native",
|
|
57196
|
-
preferredChannel: "
|
|
56836
|
+
preferredChannel: "cli"
|
|
57197
56837
|
},
|
|
57198
56838
|
{
|
|
57199
56839
|
domain: "sticky",
|
|
57200
56840
|
operation: "show",
|
|
57201
56841
|
gateway: "query",
|
|
57202
56842
|
mode: "native",
|
|
57203
|
-
preferredChannel: "
|
|
56843
|
+
preferredChannel: "cli"
|
|
57204
56844
|
},
|
|
57205
56845
|
// Mutate operations
|
|
57206
56846
|
{
|
|
@@ -57208,7 +56848,7 @@ var CAPABILITY_MATRIX = [
|
|
|
57208
56848
|
operation: "add",
|
|
57209
56849
|
gateway: "mutate",
|
|
57210
56850
|
mode: "native",
|
|
57211
|
-
preferredChannel: "
|
|
56851
|
+
preferredChannel: "cli"
|
|
57212
56852
|
},
|
|
57213
56853
|
{
|
|
57214
56854
|
domain: "sticky",
|
|
@@ -57684,13 +57324,13 @@ import { catalog as catalog2 } from "@cleocode/caamp";
|
|
|
57684
57324
|
|
|
57685
57325
|
// packages/core/src/skills/agents/config.ts
|
|
57686
57326
|
init_paths();
|
|
57687
|
-
import { existsSync as existsSync69, readFileSync as
|
|
57688
|
-
import { basename as basename11, join as
|
|
57327
|
+
import { existsSync as existsSync69, readFileSync as readFileSync48 } from "node:fs";
|
|
57328
|
+
import { basename as basename11, join as join72 } from "node:path";
|
|
57689
57329
|
|
|
57690
57330
|
// packages/core/src/skills/discovery.ts
|
|
57691
57331
|
init_paths();
|
|
57692
|
-
import { existsSync as existsSync68, readdirSync as readdirSync25, readFileSync as
|
|
57693
|
-
import { basename as basename10, join as
|
|
57332
|
+
import { existsSync as existsSync68, readdirSync as readdirSync25, readFileSync as readFileSync47, statSync as statSync17 } from "node:fs";
|
|
57333
|
+
import { basename as basename10, join as join71 } from "node:path";
|
|
57694
57334
|
import {
|
|
57695
57335
|
discoverSkill as caampDiscoverSkill,
|
|
57696
57336
|
discoverSkills as caampDiscoverSkills,
|
|
@@ -57780,12 +57420,12 @@ var SKILL_NAME_MAP = {
|
|
|
57780
57420
|
function getSkillSearchPaths(cwd) {
|
|
57781
57421
|
const projectRoot = getProjectRoot(cwd);
|
|
57782
57422
|
const cleoHome = getCleoHome();
|
|
57783
|
-
const projectAgentsSkills =
|
|
57423
|
+
const projectAgentsSkills = join71(getProjectAgentsDir(projectRoot), "skills");
|
|
57784
57424
|
const paths = [
|
|
57785
57425
|
{ scope: "agent-skills", path: getCanonicalSkillsDir(), priority: 1 },
|
|
57786
57426
|
{ scope: "project-custom", path: projectAgentsSkills, priority: 2 }
|
|
57787
57427
|
];
|
|
57788
|
-
const mpCacheDir = process.env["CLEO_SKILLS_MP_CACHE"] ??
|
|
57428
|
+
const mpCacheDir = process.env["CLEO_SKILLS_MP_CACHE"] ?? join71(cleoHome, ".skills-cache");
|
|
57789
57429
|
if (existsSync68(mpCacheDir)) {
|
|
57790
57430
|
paths.push({ scope: "marketplace", path: mpCacheDir, priority: 4 });
|
|
57791
57431
|
}
|
|
@@ -57796,7 +57436,7 @@ function getSkillsDir(cwd) {
|
|
|
57796
57436
|
return getCanonicalSkillsDir();
|
|
57797
57437
|
}
|
|
57798
57438
|
function getSharedDir(cwd) {
|
|
57799
|
-
return
|
|
57439
|
+
return join71(getSkillsDir(cwd), "_shared");
|
|
57800
57440
|
}
|
|
57801
57441
|
function mapSkillName(input) {
|
|
57802
57442
|
if (SKILL_NAME_MAP[input]) {
|
|
@@ -57879,11 +57519,11 @@ function parseFrontmatter3(content) {
|
|
|
57879
57519
|
};
|
|
57880
57520
|
}
|
|
57881
57521
|
function discoverSkill(skillDir) {
|
|
57882
|
-
const skillMdPath =
|
|
57522
|
+
const skillMdPath = join71(skillDir, "SKILL.md");
|
|
57883
57523
|
if (!existsSync68(skillMdPath)) {
|
|
57884
57524
|
return null;
|
|
57885
57525
|
}
|
|
57886
|
-
const content =
|
|
57526
|
+
const content = readFileSync47(skillMdPath, "utf-8");
|
|
57887
57527
|
const frontmatter = parseFrontmatter3(content);
|
|
57888
57528
|
const dirName = basename10(skillDir);
|
|
57889
57529
|
return {
|
|
@@ -57904,7 +57544,7 @@ function discoverSkillsInDir(dir) {
|
|
|
57904
57544
|
const entries = readdirSync25(dir);
|
|
57905
57545
|
for (const entry of entries) {
|
|
57906
57546
|
if (entry.startsWith(".") || entry.startsWith("_")) continue;
|
|
57907
|
-
const entryPath =
|
|
57547
|
+
const entryPath = join71(dir, entry);
|
|
57908
57548
|
try {
|
|
57909
57549
|
if (statSync17(entryPath).isDirectory()) {
|
|
57910
57550
|
const skill = discoverSkill(entryPath);
|
|
@@ -57938,14 +57578,14 @@ function findSkill(name2, cwd) {
|
|
|
57938
57578
|
const { canonical } = mapSkillName(name2);
|
|
57939
57579
|
const searchPaths = getSkillSearchPaths(cwd);
|
|
57940
57580
|
for (const sp of searchPaths) {
|
|
57941
|
-
const skillDir =
|
|
57581
|
+
const skillDir = join71(sp.path, canonical);
|
|
57942
57582
|
const skill = discoverSkill(skillDir);
|
|
57943
57583
|
if (skill) return skill;
|
|
57944
57584
|
}
|
|
57945
57585
|
if (canonical.startsWith("ct-")) {
|
|
57946
57586
|
const legacy = canonical.slice(3);
|
|
57947
57587
|
for (const sp of searchPaths) {
|
|
57948
|
-
const skillDir =
|
|
57588
|
+
const skillDir = join71(sp.path, legacy);
|
|
57949
57589
|
const skill = discoverSkill(skillDir);
|
|
57950
57590
|
if (skill) return skill;
|
|
57951
57591
|
}
|
|
@@ -57984,14 +57624,14 @@ function resolveTemplatePath(name2, cwd) {
|
|
|
57984
57624
|
|
|
57985
57625
|
// packages/core/src/skills/agents/config.ts
|
|
57986
57626
|
function getAgentsDir(cwd) {
|
|
57987
|
-
return
|
|
57627
|
+
return join72(getProjectRoot(cwd), "agents");
|
|
57988
57628
|
}
|
|
57989
57629
|
function parseAgentConfig(agentDir) {
|
|
57990
|
-
const agentMdPath =
|
|
57630
|
+
const agentMdPath = join72(agentDir, "AGENT.md");
|
|
57991
57631
|
if (!existsSync69(agentMdPath)) {
|
|
57992
57632
|
return null;
|
|
57993
57633
|
}
|
|
57994
|
-
const content =
|
|
57634
|
+
const content = readFileSync48(agentMdPath, "utf-8");
|
|
57995
57635
|
const fm = parseFrontmatter3(content);
|
|
57996
57636
|
return {
|
|
57997
57637
|
name: fm.name || basename11(agentDir),
|
|
@@ -58003,7 +57643,7 @@ function parseAgentConfig(agentDir) {
|
|
|
58003
57643
|
}
|
|
58004
57644
|
function loadAgentConfig(agentName, cwd) {
|
|
58005
57645
|
const agentsDir = getAgentsDir(cwd);
|
|
58006
|
-
const agentDir =
|
|
57646
|
+
const agentDir = join72(agentsDir, agentName);
|
|
58007
57647
|
return parseAgentConfig(agentDir);
|
|
58008
57648
|
}
|
|
58009
57649
|
function getSubagentConfig(cwd) {
|
|
@@ -58011,7 +57651,7 @@ function getSubagentConfig(cwd) {
|
|
|
58011
57651
|
}
|
|
58012
57652
|
function agentExists(agentName, cwd) {
|
|
58013
57653
|
const agentsDir = getAgentsDir(cwd);
|
|
58014
|
-
const agentMdPath =
|
|
57654
|
+
const agentMdPath = join72(agentsDir, agentName, "AGENT.md");
|
|
58015
57655
|
return existsSync69(agentMdPath);
|
|
58016
57656
|
}
|
|
58017
57657
|
function extractBody(content) {
|
|
@@ -58035,7 +57675,7 @@ function extractBody(content) {
|
|
|
58035
57675
|
init_paths();
|
|
58036
57676
|
import { existsSync as existsSync70, mkdirSync as mkdirSync15, readdirSync as readdirSync26, readlinkSync, symlinkSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
58037
57677
|
import { platform as platform2 } from "node:os";
|
|
58038
|
-
import { basename as basename12, join as
|
|
57678
|
+
import { basename as basename12, join as join73 } from "node:path";
|
|
58039
57679
|
var DIR_SYMLINK_TYPE = platform2() === "win32" ? "junction" : "dir";
|
|
58040
57680
|
function getAgentInstallDir() {
|
|
58041
57681
|
return getClaudeAgentsDir();
|
|
@@ -58043,7 +57683,7 @@ function getAgentInstallDir() {
|
|
|
58043
57683
|
function installAgent(agentDir) {
|
|
58044
57684
|
const targetDir = getAgentInstallDir();
|
|
58045
57685
|
const agentName = basename12(agentDir);
|
|
58046
|
-
const targetPath =
|
|
57686
|
+
const targetPath = join73(targetDir, agentName);
|
|
58047
57687
|
if (!existsSync70(targetDir)) {
|
|
58048
57688
|
mkdirSync15(targetDir, { recursive: true });
|
|
58049
57689
|
}
|
|
@@ -58081,8 +57721,8 @@ function installAllAgents(cwd) {
|
|
|
58081
57721
|
const entries = readdirSync26(agentsDir);
|
|
58082
57722
|
for (const entry of entries) {
|
|
58083
57723
|
if (entry.startsWith(".")) continue;
|
|
58084
|
-
const agentDir =
|
|
58085
|
-
const agentMdPath =
|
|
57724
|
+
const agentDir = join73(agentsDir, entry);
|
|
57725
|
+
const agentMdPath = join73(agentDir, "AGENT.md");
|
|
58086
57726
|
if (!existsSync70(agentMdPath)) continue;
|
|
58087
57727
|
const result = installAgent(agentDir);
|
|
58088
57728
|
results.push({
|
|
@@ -58095,7 +57735,7 @@ function installAllAgents(cwd) {
|
|
|
58095
57735
|
}
|
|
58096
57736
|
function uninstallAgent(agentName) {
|
|
58097
57737
|
const targetDir = getAgentInstallDir();
|
|
58098
|
-
const targetPath =
|
|
57738
|
+
const targetPath = join73(targetDir, agentName);
|
|
58099
57739
|
if (!existsSync70(targetPath)) {
|
|
58100
57740
|
return false;
|
|
58101
57741
|
}
|
|
@@ -58109,16 +57749,16 @@ function uninstallAgent(agentName) {
|
|
|
58109
57749
|
|
|
58110
57750
|
// packages/core/src/skills/agents/registry.ts
|
|
58111
57751
|
init_paths();
|
|
58112
|
-
import { existsSync as existsSync71, mkdirSync as mkdirSync16, readdirSync as readdirSync27, readFileSync as
|
|
58113
|
-
import { dirname as dirname15, join as
|
|
57752
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync16, readdirSync as readdirSync27, readFileSync as readFileSync49, writeFileSync as writeFileSync9 } from "node:fs";
|
|
57753
|
+
import { dirname as dirname15, join as join74 } from "node:path";
|
|
58114
57754
|
function getRegistryPath2() {
|
|
58115
|
-
return
|
|
57755
|
+
return join74(getCleoHome(), "agent-registry.json");
|
|
58116
57756
|
}
|
|
58117
57757
|
function readRegistry2() {
|
|
58118
57758
|
const registryPath = getRegistryPath2();
|
|
58119
57759
|
if (existsSync71(registryPath)) {
|
|
58120
57760
|
try {
|
|
58121
|
-
const content =
|
|
57761
|
+
const content = readFileSync49(registryPath, "utf-8");
|
|
58122
57762
|
return JSON.parse(content);
|
|
58123
57763
|
} catch {
|
|
58124
57764
|
}
|
|
@@ -58181,7 +57821,7 @@ function syncRegistry(cwd) {
|
|
|
58181
57821
|
const entries = readdirSync27(agentsDir);
|
|
58182
57822
|
for (const entry of entries) {
|
|
58183
57823
|
if (entry.startsWith(".")) continue;
|
|
58184
|
-
const agentDir =
|
|
57824
|
+
const agentDir = join74(agentsDir, entry);
|
|
58185
57825
|
try {
|
|
58186
57826
|
const config2 = parseAgentConfig(agentDir);
|
|
58187
57827
|
if (config2) {
|
|
@@ -58195,7 +57835,7 @@ function syncRegistry(cwd) {
|
|
|
58195
57835
|
if (existingNames.has(name2)) {
|
|
58196
57836
|
result.unchanged.push(name2);
|
|
58197
57837
|
} else {
|
|
58198
|
-
registerAgent2(name2,
|
|
57838
|
+
registerAgent2(name2, join74(agentsDir, name2), config2);
|
|
58199
57839
|
result.added.push(name2);
|
|
58200
57840
|
}
|
|
58201
57841
|
}
|
|
@@ -58214,8 +57854,8 @@ import { catalog } from "@cleocode/caamp";
|
|
|
58214
57854
|
|
|
58215
57855
|
// packages/core/src/skills/injection/token.ts
|
|
58216
57856
|
init_paths();
|
|
58217
|
-
import { existsSync as existsSync72, readFileSync as
|
|
58218
|
-
import { join as
|
|
57857
|
+
import { existsSync as existsSync72, readFileSync as readFileSync50 } from "node:fs";
|
|
57858
|
+
import { join as join75 } from "node:path";
|
|
58219
57859
|
var REQUIRED_TOKENS = ["TASK_ID", "DATE", "TOPIC_SLUG"];
|
|
58220
57860
|
var TOKEN_PATTERNS = {
|
|
58221
57861
|
TASK_ID: /^T\d+$/,
|
|
@@ -58251,10 +57891,10 @@ var CLEO_DEFAULTS = {
|
|
|
58251
57891
|
};
|
|
58252
57892
|
function loadPlaceholders(cwd) {
|
|
58253
57893
|
const projectRoot = getProjectRoot(cwd);
|
|
58254
|
-
const path2 =
|
|
57894
|
+
const path2 = join75(projectRoot, "skills", "_shared", "placeholders.json");
|
|
58255
57895
|
if (!existsSync72(path2)) return null;
|
|
58256
57896
|
try {
|
|
58257
|
-
return JSON.parse(
|
|
57897
|
+
return JSON.parse(readFileSync50(path2, "utf-8"));
|
|
58258
57898
|
} catch {
|
|
58259
57899
|
return null;
|
|
58260
57900
|
}
|
|
@@ -58343,7 +57983,7 @@ function loadAndInject(templatePath, values) {
|
|
|
58343
57983
|
if (!existsSync72(templatePath)) {
|
|
58344
57984
|
throw new Error(`Template not found: ${templatePath}`);
|
|
58345
57985
|
}
|
|
58346
|
-
const template =
|
|
57986
|
+
const template = readFileSync50(templatePath, "utf-8");
|
|
58347
57987
|
const content = injectTokens(template, values);
|
|
58348
57988
|
const unresolvedTokens = hasUnresolvedTokens(content);
|
|
58349
57989
|
return { content, unresolvedTokens };
|
|
@@ -58634,15 +58274,15 @@ ${promptParts.join("\n")}`;
|
|
|
58634
58274
|
init_src();
|
|
58635
58275
|
init_errors3();
|
|
58636
58276
|
init_paths();
|
|
58637
|
-
import { existsSync as existsSync73, readFileSync as
|
|
58638
|
-
import { join as
|
|
58277
|
+
import { existsSync as existsSync73, readFileSync as readFileSync51 } from "node:fs";
|
|
58278
|
+
import { join as join76 } from "node:path";
|
|
58639
58279
|
function getProtocolBasePath(cwd) {
|
|
58640
|
-
return
|
|
58280
|
+
return join76(getProjectRoot(cwd), "skills", "_shared", "subagent-protocol-base.md");
|
|
58641
58281
|
}
|
|
58642
58282
|
function loadProtocolBase(cwd) {
|
|
58643
58283
|
const path2 = getProtocolBasePath(cwd);
|
|
58644
58284
|
if (!existsSync73(path2)) return null;
|
|
58645
|
-
return
|
|
58285
|
+
return readFileSync51(path2, "utf-8");
|
|
58646
58286
|
}
|
|
58647
58287
|
async function buildTaskContext(taskId, cwd) {
|
|
58648
58288
|
const { getAccessor: getAccessor2 } = await Promise.resolve().then(() => (init_data_accessor(), data_accessor_exports));
|
|
@@ -58784,7 +58424,7 @@ async function installSkill(skillName, projectDir) {
|
|
|
58784
58424
|
// packages/core/src/skills/manifests/contribution.ts
|
|
58785
58425
|
init_data_accessor();
|
|
58786
58426
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
58787
|
-
import { existsSync as existsSync74, readFileSync as
|
|
58427
|
+
import { existsSync as existsSync74, readFileSync as readFileSync52 } from "node:fs";
|
|
58788
58428
|
function generateContributionId(taskId) {
|
|
58789
58429
|
const hash = randomBytes11(4).toString("hex");
|
|
58790
58430
|
const date6 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
@@ -58824,7 +58464,7 @@ function getContributionInjection(taskId, protocolPath, _cwd) {
|
|
|
58824
58464
|
if (protocolPath && existsSync74(protocolPath)) {
|
|
58825
58465
|
lines.push("### Protocol Details");
|
|
58826
58466
|
lines.push("");
|
|
58827
|
-
lines.push(
|
|
58467
|
+
lines.push(readFileSync52(protocolPath, "utf-8"));
|
|
58828
58468
|
}
|
|
58829
58469
|
lines.push("---");
|
|
58830
58470
|
return lines.join("\n");
|
|
@@ -58917,13 +58557,13 @@ function createContributionManifestEntry(taskId, contributionId, decisions) {
|
|
|
58917
58557
|
init_src();
|
|
58918
58558
|
init_errors3();
|
|
58919
58559
|
init_paths();
|
|
58920
|
-
import { appendFileSync as appendFileSync8, existsSync as existsSync75, mkdirSync as mkdirSync17, readFileSync as
|
|
58921
|
-
import { join as
|
|
58560
|
+
import { appendFileSync as appendFileSync8, existsSync as existsSync75, mkdirSync as mkdirSync17, readFileSync as readFileSync53, writeFileSync as writeFileSync10 } from "node:fs";
|
|
58561
|
+
import { join as join77 } from "node:path";
|
|
58922
58562
|
function ensureOutputs(cwd) {
|
|
58923
58563
|
const outputDir = getAgentOutputsDir(cwd);
|
|
58924
58564
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
58925
58565
|
const manifestPath = getManifestPath(cwd);
|
|
58926
|
-
const archiveDir =
|
|
58566
|
+
const archiveDir = join77(absOutputDir, "archive");
|
|
58927
58567
|
const created = [];
|
|
58928
58568
|
if (!existsSync75(absOutputDir)) {
|
|
58929
58569
|
mkdirSync17(absOutputDir, { recursive: true });
|
|
@@ -58942,7 +58582,7 @@ function ensureOutputs(cwd) {
|
|
|
58942
58582
|
function readManifest2(cwd) {
|
|
58943
58583
|
const manifestPath = getManifestPath(cwd);
|
|
58944
58584
|
if (!existsSync75(manifestPath)) return [];
|
|
58945
|
-
const content =
|
|
58585
|
+
const content = readFileSync53(manifestPath, "utf-8");
|
|
58946
58586
|
const entries = [];
|
|
58947
58587
|
for (const line2 of content.split("\n")) {
|
|
58948
58588
|
const trimmed = line2.trim();
|
|
@@ -59019,7 +58659,7 @@ function taskHasResearch(taskId, cwd) {
|
|
|
59019
58659
|
function archiveEntry(entryId, cwd) {
|
|
59020
58660
|
const manifestPath = getManifestPath(cwd);
|
|
59021
58661
|
if (!existsSync75(manifestPath)) return false;
|
|
59022
|
-
const content =
|
|
58662
|
+
const content = readFileSync53(manifestPath, "utf-8");
|
|
59023
58663
|
const lines = content.split("\n");
|
|
59024
58664
|
let found = false;
|
|
59025
58665
|
const newLines = [];
|
|
@@ -59052,13 +58692,13 @@ function rotateManifest(maxEntries = 100, cwd) {
|
|
|
59052
58692
|
if (entries.length <= maxEntries) return 0;
|
|
59053
58693
|
const manifestPath = getManifestPath(cwd);
|
|
59054
58694
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59055
|
-
const archiveDir =
|
|
58695
|
+
const archiveDir = join77(absOutputDir, "archive");
|
|
59056
58696
|
const toKeep = entries.slice(-maxEntries);
|
|
59057
58697
|
const toArchive = entries.slice(0, entries.length - maxEntries);
|
|
59058
58698
|
if (!existsSync75(archiveDir)) {
|
|
59059
58699
|
mkdirSync17(archiveDir, { recursive: true });
|
|
59060
58700
|
}
|
|
59061
|
-
const archivePath =
|
|
58701
|
+
const archivePath = join77(archiveDir, `MANIFEST-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.jsonl`);
|
|
59062
58702
|
const archiveContent = toArchive.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
59063
58703
|
appendFileSync8(archivePath, archiveContent, "utf-8");
|
|
59064
58704
|
const keepContent = toKeep.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
@@ -59120,20 +58760,20 @@ function validateEntry(entry) {
|
|
|
59120
58760
|
|
|
59121
58761
|
// packages/core/src/skills/manifests/resolver.ts
|
|
59122
58762
|
init_paths();
|
|
59123
|
-
import { existsSync as existsSync76, mkdirSync as mkdirSync18, readFileSync as
|
|
59124
|
-
import { join as
|
|
58763
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync18, readFileSync as readFileSync54, writeFileSync as writeFileSync11 } from "node:fs";
|
|
58764
|
+
import { join as join78 } from "node:path";
|
|
59125
58765
|
var DEFAULT_CACHE_TTL = 300;
|
|
59126
58766
|
function getCacheDir() {
|
|
59127
|
-
return process.env["CLEO_MANIFEST_CACHE_DIR"] ??
|
|
58767
|
+
return process.env["CLEO_MANIFEST_CACHE_DIR"] ?? join78(getCleoHome(), "cache");
|
|
59128
58768
|
}
|
|
59129
58769
|
function getCachedManifestPath() {
|
|
59130
|
-
return
|
|
58770
|
+
return join78(getCacheDir(), "skills-manifest.json");
|
|
59131
58771
|
}
|
|
59132
58772
|
function isCacheFresh(cachePath) {
|
|
59133
58773
|
const path2 = cachePath ?? getCachedManifestPath();
|
|
59134
58774
|
if (!existsSync76(path2)) return false;
|
|
59135
58775
|
try {
|
|
59136
|
-
const content =
|
|
58776
|
+
const content = readFileSync54(path2, "utf-8");
|
|
59137
58777
|
const manifest = JSON.parse(content);
|
|
59138
58778
|
const ttl = manifest._meta?.ttlSeconds ?? DEFAULT_CACHE_TTL;
|
|
59139
58779
|
const generatedAt = new Date(manifest._meta?.generatedAt ?? 0).getTime();
|
|
@@ -59156,13 +58796,13 @@ function resolveManifest(cwd) {
|
|
|
59156
58796
|
const cachePath = getCachedManifestPath();
|
|
59157
58797
|
if (isCacheFresh(cachePath)) {
|
|
59158
58798
|
try {
|
|
59159
|
-
return JSON.parse(
|
|
58799
|
+
return JSON.parse(readFileSync54(cachePath, "utf-8"));
|
|
59160
58800
|
} catch {
|
|
59161
58801
|
}
|
|
59162
58802
|
}
|
|
59163
58803
|
if (existsSync76(cachePath)) {
|
|
59164
58804
|
try {
|
|
59165
|
-
const content =
|
|
58805
|
+
const content = readFileSync54(cachePath, "utf-8");
|
|
59166
58806
|
if (content.trim()) {
|
|
59167
58807
|
const staleManifest = JSON.parse(content);
|
|
59168
58808
|
if (staleManifest.skills?.length > 0) {
|
|
@@ -59200,15 +58840,15 @@ function regenerateCache(cwd) {
|
|
|
59200
58840
|
|
|
59201
58841
|
// packages/core/src/skills/marketplace.ts
|
|
59202
58842
|
init_paths();
|
|
59203
|
-
import { existsSync as existsSync77, readFileSync as
|
|
59204
|
-
import { join as
|
|
58843
|
+
import { existsSync as existsSync77, readFileSync as readFileSync55 } from "node:fs";
|
|
58844
|
+
import { join as join79 } from "node:path";
|
|
59205
58845
|
import { searchSkills as caampSearchSkills, MarketplaceClient } from "@cleocode/caamp";
|
|
59206
58846
|
function loadConfig2(cwd) {
|
|
59207
58847
|
const projectRoot = getProjectRoot(cwd);
|
|
59208
|
-
const configFile =
|
|
58848
|
+
const configFile = join79(projectRoot, ".cleo", "skillsmp.json");
|
|
59209
58849
|
if (!existsSync77(configFile)) return null;
|
|
59210
58850
|
try {
|
|
59211
|
-
const data = JSON.parse(
|
|
58851
|
+
const data = JSON.parse(readFileSync55(configFile, "utf-8"));
|
|
59212
58852
|
if (data.enabled !== true) return null;
|
|
59213
58853
|
return {
|
|
59214
58854
|
enabled: true,
|
|
@@ -59384,8 +59024,8 @@ async function spawnBatch(taskIds, templateName, cwd, tier) {
|
|
|
59384
59024
|
// packages/core/src/skills/orchestrator/startup.ts
|
|
59385
59025
|
init_paths();
|
|
59386
59026
|
init_data_accessor();
|
|
59387
|
-
import { existsSync as existsSync78, readFileSync as
|
|
59388
|
-
import { join as
|
|
59027
|
+
import { existsSync as existsSync78, readFileSync as readFileSync56 } from "node:fs";
|
|
59028
|
+
import { join as join80 } from "node:path";
|
|
59389
59029
|
var DEFAULT_THRESHOLDS = { warning: 70, critical: 80 };
|
|
59390
59030
|
function getThresholds(config2) {
|
|
59391
59031
|
const orc = config2?.orchestrator?.contextThresholds;
|
|
@@ -59407,19 +59047,19 @@ function getContextState(sessionId, cwd) {
|
|
|
59407
59047
|
};
|
|
59408
59048
|
let stateFile = "";
|
|
59409
59049
|
if (sessionId) {
|
|
59410
|
-
stateFile =
|
|
59050
|
+
stateFile = join80(cleoDirAbs, "sessions", sessionId, ".context-state.json");
|
|
59411
59051
|
if (!existsSync78(stateFile)) {
|
|
59412
|
-
stateFile =
|
|
59052
|
+
stateFile = join80(cleoDirAbs, `.context-state-${sessionId}.json`);
|
|
59413
59053
|
}
|
|
59414
59054
|
}
|
|
59415
59055
|
if (!stateFile || !existsSync78(stateFile)) {
|
|
59416
|
-
stateFile =
|
|
59056
|
+
stateFile = join80(cleoDirAbs, ".context-state.json");
|
|
59417
59057
|
}
|
|
59418
59058
|
if (!existsSync78(stateFile)) {
|
|
59419
59059
|
return defaultState;
|
|
59420
59060
|
}
|
|
59421
59061
|
try {
|
|
59422
|
-
const data = JSON.parse(
|
|
59062
|
+
const data = JSON.parse(readFileSync56(stateFile, "utf-8"));
|
|
59423
59063
|
const cw = data.contextWindow ?? data;
|
|
59424
59064
|
const timestamp2 = data.timestamp;
|
|
59425
59065
|
const staleAfterMs = data.staleAfterMs ?? 5e3;
|
|
@@ -59727,8 +59367,8 @@ function priorityRank(priority) {
|
|
|
59727
59367
|
init_src();
|
|
59728
59368
|
init_paths();
|
|
59729
59369
|
init_data_accessor();
|
|
59730
|
-
import { existsSync as existsSync79, readFileSync as
|
|
59731
|
-
import { join as
|
|
59370
|
+
import { existsSync as existsSync79, readFileSync as readFileSync57 } from "node:fs";
|
|
59371
|
+
import { join as join81 } from "node:path";
|
|
59732
59372
|
var KEY_FINDINGS_MIN = 3;
|
|
59733
59373
|
var KEY_FINDINGS_MAX = 7;
|
|
59734
59374
|
var MANIFEST_REQUIRED_FIELDS = [
|
|
@@ -59748,7 +59388,7 @@ function getManifestPath3(cwd) {
|
|
|
59748
59388
|
function readManifestEntries(cwd) {
|
|
59749
59389
|
const manifestPath = getManifestPath3(cwd);
|
|
59750
59390
|
if (!existsSync79(manifestPath)) return [];
|
|
59751
|
-
const content =
|
|
59391
|
+
const content = readFileSync57(manifestPath, "utf-8");
|
|
59752
59392
|
const entries = [];
|
|
59753
59393
|
for (const line2 of content.split("\n")) {
|
|
59754
59394
|
const trimmed = line2.trim();
|
|
@@ -59809,7 +59449,7 @@ function validateSubagentOutput(researchId, cwd) {
|
|
|
59809
59449
|
}
|
|
59810
59450
|
if (entry.file) {
|
|
59811
59451
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59812
|
-
const filePath =
|
|
59452
|
+
const filePath = join81(absOutputDir, entry.file);
|
|
59813
59453
|
if (!existsSync79(filePath)) {
|
|
59814
59454
|
issues.push(`FILE_NOT_FOUND: Expected file at ${filePath}`);
|
|
59815
59455
|
}
|
|
@@ -59821,7 +59461,7 @@ function validateManifestIntegrity(cwd) {
|
|
|
59821
59461
|
if (!existsSync79(manifestPath)) {
|
|
59822
59462
|
return { exists: false, passed: true, issues: [] };
|
|
59823
59463
|
}
|
|
59824
|
-
const content =
|
|
59464
|
+
const content = readFileSync57(manifestPath, "utf-8");
|
|
59825
59465
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
59826
59466
|
const issues = [];
|
|
59827
59467
|
let validEntries = 0;
|
|
@@ -59852,7 +59492,7 @@ function validateManifestIntegrity(cwd) {
|
|
|
59852
59492
|
seenIds.add(entry.id);
|
|
59853
59493
|
if (entry.file) {
|
|
59854
59494
|
const absOutputDir = getAgentOutputsAbsolute(cwd);
|
|
59855
|
-
const filePath =
|
|
59495
|
+
const filePath = join81(absOutputDir, entry.file);
|
|
59856
59496
|
if (!existsSync79(filePath)) {
|
|
59857
59497
|
issues.push(`LINE_${lineNum}_FILE_MISSING: ${entry.file} does not exist`);
|
|
59858
59498
|
}
|
|
@@ -59926,7 +59566,7 @@ async function validateOrchestratorCompliance(epicId, cwd) {
|
|
|
59926
59566
|
if (!existsSync79(manifestPath)) {
|
|
59927
59567
|
warnings.push(`ORC-005_NO_MANIFEST: Manifest file not found at ${manifestPath}`);
|
|
59928
59568
|
} else {
|
|
59929
|
-
const content =
|
|
59569
|
+
const content = readFileSync57(manifestPath, "utf-8").trim();
|
|
59930
59570
|
if (!content) {
|
|
59931
59571
|
warnings.push("ORC-005_EMPTY_MANIFEST: Manifest exists but has no entries");
|
|
59932
59572
|
}
|
|
@@ -59962,22 +59602,22 @@ async function validateOrchestratorCompliance(epicId, cwd) {
|
|
|
59962
59602
|
}
|
|
59963
59603
|
|
|
59964
59604
|
// packages/core/src/skills/skill-paths.ts
|
|
59965
|
-
import { existsSync as existsSync80, lstatSync, readlinkSync as readlinkSync2, realpathSync
|
|
59966
|
-
import { delimiter, join as
|
|
59605
|
+
import { existsSync as existsSync80, lstatSync, readlinkSync as readlinkSync2, realpathSync } from "node:fs";
|
|
59606
|
+
import { delimiter, join as join82, resolve as resolve9 } from "node:path";
|
|
59967
59607
|
import { getCanonicalSkillsDir as getCanonicalSkillsDir2 } from "@cleocode/caamp";
|
|
59968
59608
|
function getCaampCanonical() {
|
|
59969
59609
|
return getCanonicalSkillsDir2();
|
|
59970
59610
|
}
|
|
59971
59611
|
function getProjectEmbedded(projectRoot) {
|
|
59972
59612
|
const root = projectRoot ?? process.cwd();
|
|
59973
|
-
return
|
|
59613
|
+
return join82(root, "skills");
|
|
59974
59614
|
}
|
|
59975
59615
|
function getProjectRoot3(cwd) {
|
|
59976
59616
|
return cwd ?? process.cwd();
|
|
59977
59617
|
}
|
|
59978
59618
|
function safeRealpath(path2) {
|
|
59979
59619
|
try {
|
|
59980
|
-
return
|
|
59620
|
+
return realpathSync(path2);
|
|
59981
59621
|
} catch {
|
|
59982
59622
|
return path2;
|
|
59983
59623
|
}
|
|
@@ -60020,8 +59660,8 @@ function getSkillSearchPaths2(projectRoot) {
|
|
|
60020
59660
|
function resolveSkillPath(skillName, projectRoot) {
|
|
60021
59661
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60022
59662
|
for (const { path: searchPath } of searchPaths) {
|
|
60023
|
-
const candidate =
|
|
60024
|
-
if (existsSync80(
|
|
59663
|
+
const candidate = join82(searchPath, skillName);
|
|
59664
|
+
if (existsSync80(join82(candidate, "SKILL.md"))) {
|
|
60025
59665
|
return safeRealpath(candidate);
|
|
60026
59666
|
}
|
|
60027
59667
|
}
|
|
@@ -60030,13 +59670,13 @@ function resolveSkillPath(skillName, projectRoot) {
|
|
|
60030
59670
|
function resolveProtocolPath(protocolName, projectRoot) {
|
|
60031
59671
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60032
59672
|
for (const { path: searchPath } of searchPaths) {
|
|
60033
|
-
const candidate =
|
|
59673
|
+
const candidate = join82(searchPath, "_ct-skills-protocols", `${protocolName}.md`);
|
|
60034
59674
|
if (existsSync80(candidate)) {
|
|
60035
59675
|
return safeRealpath(candidate);
|
|
60036
59676
|
}
|
|
60037
59677
|
}
|
|
60038
59678
|
const root = getProjectRoot3(projectRoot);
|
|
60039
|
-
const legacy =
|
|
59679
|
+
const legacy = join82(root, "src", "protocols", `${protocolName}.md`);
|
|
60040
59680
|
if (existsSync80(legacy)) {
|
|
60041
59681
|
return safeRealpath(legacy);
|
|
60042
59682
|
}
|
|
@@ -60045,11 +59685,11 @@ function resolveProtocolPath(protocolName, projectRoot) {
|
|
|
60045
59685
|
function resolveSharedPath(resourceName, projectRoot) {
|
|
60046
59686
|
const searchPaths = getSkillSearchPaths2(projectRoot);
|
|
60047
59687
|
for (const { path: searchPath } of searchPaths) {
|
|
60048
|
-
const candidate =
|
|
59688
|
+
const candidate = join82(searchPath, "_ct-skills-shared", `${resourceName}.md`);
|
|
60049
59689
|
if (existsSync80(candidate)) {
|
|
60050
59690
|
return safeRealpath(candidate);
|
|
60051
59691
|
}
|
|
60052
|
-
const legacy =
|
|
59692
|
+
const legacy = join82(searchPath, "_shared", `${resourceName}.md`);
|
|
60053
59693
|
if (existsSync80(legacy)) {
|
|
60054
59694
|
return safeRealpath(legacy);
|
|
60055
59695
|
}
|
|
@@ -60075,7 +59715,7 @@ function getSkillSourceType(skillDir, projectRoot) {
|
|
|
60075
59715
|
}
|
|
60076
59716
|
} catch {
|
|
60077
59717
|
}
|
|
60078
|
-
if (normalizedDir.startsWith(resolve9(embeddedDir)) || normalizedDir.startsWith(
|
|
59718
|
+
if (normalizedDir.startsWith(resolve9(embeddedDir)) || normalizedDir.startsWith(join82(root, "skills"))) {
|
|
60079
59719
|
return "embedded";
|
|
60080
59720
|
}
|
|
60081
59721
|
if (normalizedDir.startsWith(caampDir)) {
|
|
@@ -60106,8 +59746,8 @@ function formatDateYMD(date6) {
|
|
|
60106
59746
|
}
|
|
60107
59747
|
|
|
60108
59748
|
// packages/core/src/skills/validation.ts
|
|
60109
|
-
import { existsSync as existsSync81, readFileSync as
|
|
60110
|
-
import { basename as basename13, join as
|
|
59749
|
+
import { existsSync as existsSync81, readFileSync as readFileSync58 } from "node:fs";
|
|
59750
|
+
import { basename as basename13, join as join83 } from "node:path";
|
|
60111
59751
|
var VALID_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
60112
59752
|
"research",
|
|
60113
59753
|
"consensus",
|
|
@@ -60130,7 +59770,7 @@ function validateSkill(skillDir) {
|
|
|
60130
59770
|
});
|
|
60131
59771
|
return buildResult(dirName, skillDir, issues);
|
|
60132
59772
|
}
|
|
60133
|
-
const skillMdPath =
|
|
59773
|
+
const skillMdPath = join83(skillDir, "SKILL.md");
|
|
60134
59774
|
if (!existsSync81(skillMdPath)) {
|
|
60135
59775
|
issues.push({
|
|
60136
59776
|
severity: "error",
|
|
@@ -60140,7 +59780,7 @@ function validateSkill(skillDir) {
|
|
|
60140
59780
|
});
|
|
60141
59781
|
return buildResult(dirName, skillDir, issues);
|
|
60142
59782
|
}
|
|
60143
|
-
const content =
|
|
59783
|
+
const content = readFileSync58(skillMdPath, "utf-8");
|
|
60144
59784
|
const fm = parseFrontmatter3(content);
|
|
60145
59785
|
validateFrontmatter(fm, issues, skillMdPath);
|
|
60146
59786
|
if (!dirName.startsWith("ct-") && !dirName.startsWith("_")) {
|
|
@@ -60152,7 +59792,7 @@ function validateSkill(skillDir) {
|
|
|
60152
59792
|
}
|
|
60153
59793
|
const optionalFiles = ["README.md", "references"];
|
|
60154
59794
|
for (const file2 of optionalFiles) {
|
|
60155
|
-
const filePath =
|
|
59795
|
+
const filePath = join83(skillDir, file2);
|
|
60156
59796
|
if (!existsSync81(filePath)) {
|
|
60157
59797
|
issues.push({
|
|
60158
59798
|
severity: "info",
|
|
@@ -60302,7 +59942,7 @@ init_data_accessor();
|
|
|
60302
59942
|
import { createHash as createHash8 } from "node:crypto";
|
|
60303
59943
|
import { existsSync as existsSync82 } from "node:fs";
|
|
60304
59944
|
import { mkdir as mkdir13, readFile as readFile13, writeFile as writeFile10 } from "node:fs/promises";
|
|
60305
|
-
import { dirname as dirname16, join as
|
|
59945
|
+
import { dirname as dirname16, join as join84 } from "node:path";
|
|
60306
59946
|
var SNAPSHOT_FORMAT_VERSION = "1.0.0";
|
|
60307
59947
|
function toSnapshotTask(task) {
|
|
60308
59948
|
return {
|
|
@@ -60378,7 +60018,7 @@ async function readSnapshot(inputPath) {
|
|
|
60378
60018
|
function getDefaultSnapshotPath(cwd) {
|
|
60379
60019
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
60380
60020
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
60381
|
-
return
|
|
60021
|
+
return join84(cleoDir, "snapshots", `snapshot-${timestamp2}.json`);
|
|
60382
60022
|
}
|
|
60383
60023
|
async function importSnapshot(snapshot, cwd) {
|
|
60384
60024
|
const accessor = await getAccessor(cwd);
|
|
@@ -60606,8 +60246,8 @@ async function initializeSpawnAdapters(manifests) {
|
|
|
60606
60246
|
if (!manifest.capabilities?.supportsSpawn) continue;
|
|
60607
60247
|
if (spawnRegistry.hasAdapterForProvider(manifest.provider)) continue;
|
|
60608
60248
|
try {
|
|
60609
|
-
const { join:
|
|
60610
|
-
const modulePath =
|
|
60249
|
+
const { join: join107 } = await import("node:path");
|
|
60250
|
+
const modulePath = join107(manifest.packagePath, manifest.entryPoint);
|
|
60611
60251
|
const adapterModule = await import(modulePath);
|
|
60612
60252
|
let SpawnProviderClass;
|
|
60613
60253
|
for (const [exportName, exportValue] of Object.entries(adapterModule)) {
|
|
@@ -61844,14 +61484,14 @@ async function getArchiveStats(opts, accessor) {
|
|
|
61844
61484
|
|
|
61845
61485
|
// packages/core/src/system/audit.ts
|
|
61846
61486
|
init_data_accessor();
|
|
61847
|
-
import { existsSync as existsSync83, readFileSync as
|
|
61848
|
-
import { join as
|
|
61487
|
+
import { existsSync as existsSync83, readFileSync as readFileSync59 } from "node:fs";
|
|
61488
|
+
import { join as join85 } from "node:path";
|
|
61849
61489
|
async function auditData(projectRoot, opts) {
|
|
61850
|
-
const cleoDir =
|
|
61490
|
+
const cleoDir = join85(projectRoot, ".cleo");
|
|
61851
61491
|
const scope = opts?.scope ?? "all";
|
|
61852
61492
|
const issues = [];
|
|
61853
61493
|
if (scope === "all" || scope === "tasks") {
|
|
61854
|
-
const tasksDbPath =
|
|
61494
|
+
const tasksDbPath = join85(cleoDir, "tasks.db");
|
|
61855
61495
|
if (existsSync83(tasksDbPath)) {
|
|
61856
61496
|
try {
|
|
61857
61497
|
const accessor = await getAccessor(projectRoot);
|
|
@@ -61914,10 +61554,10 @@ async function auditData(projectRoot, opts) {
|
|
|
61914
61554
|
}
|
|
61915
61555
|
}
|
|
61916
61556
|
if (scope === "all" || scope === "sessions") {
|
|
61917
|
-
const sessPath =
|
|
61557
|
+
const sessPath = join85(cleoDir, "sessions.json");
|
|
61918
61558
|
if (existsSync83(sessPath)) {
|
|
61919
61559
|
try {
|
|
61920
|
-
const data = JSON.parse(
|
|
61560
|
+
const data = JSON.parse(readFileSync59(sessPath, "utf-8"));
|
|
61921
61561
|
const sessions2 = data.sessions ?? [];
|
|
61922
61562
|
const sessionIds = /* @__PURE__ */ new Set();
|
|
61923
61563
|
for (const s of sessions2) {
|
|
@@ -61949,10 +61589,10 @@ async function auditData(projectRoot, opts) {
|
|
|
61949
61589
|
}
|
|
61950
61590
|
}
|
|
61951
61591
|
if (scope === "all") {
|
|
61952
|
-
const seqPath =
|
|
61592
|
+
const seqPath = join85(cleoDir, ".sequence.json");
|
|
61953
61593
|
if (existsSync83(seqPath)) {
|
|
61954
61594
|
try {
|
|
61955
|
-
const seq = JSON.parse(
|
|
61595
|
+
const seq = JSON.parse(readFileSync59(seqPath, "utf-8"));
|
|
61956
61596
|
if (typeof seq.counter !== "number") {
|
|
61957
61597
|
issues.push({
|
|
61958
61598
|
severity: "error",
|
|
@@ -61983,32 +61623,32 @@ async function auditData(projectRoot, opts) {
|
|
|
61983
61623
|
// packages/core/src/system/backup.ts
|
|
61984
61624
|
init_src();
|
|
61985
61625
|
init_errors3();
|
|
61986
|
-
import { existsSync as existsSync84, mkdirSync as mkdirSync19, readdirSync as readdirSync28, readFileSync as
|
|
61987
|
-
import { join as
|
|
61626
|
+
import { existsSync as existsSync84, mkdirSync as mkdirSync19, readdirSync as readdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync12 } from "node:fs";
|
|
61627
|
+
import { join as join86 } from "node:path";
|
|
61988
61628
|
function createBackup2(projectRoot, opts) {
|
|
61989
|
-
const cleoDir =
|
|
61629
|
+
const cleoDir = join86(projectRoot, ".cleo");
|
|
61990
61630
|
const btype = opts?.type || "snapshot";
|
|
61991
61631
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
61992
61632
|
const backupId = `${btype}-${timestamp2.replace(/[:.]/g, "-")}`;
|
|
61993
|
-
const backupDir =
|
|
61633
|
+
const backupDir = join86(cleoDir, "backups", btype);
|
|
61994
61634
|
if (!existsSync84(backupDir)) {
|
|
61995
61635
|
mkdirSync19(backupDir, { recursive: true });
|
|
61996
61636
|
}
|
|
61997
61637
|
const filesToBackup = ["tasks.db", "brain.db", "config.json", "project-info.json"];
|
|
61998
61638
|
const backedUp = [];
|
|
61999
61639
|
for (const file2 of filesToBackup) {
|
|
62000
|
-
const src =
|
|
61640
|
+
const src = join86(cleoDir, file2);
|
|
62001
61641
|
if (existsSync84(src)) {
|
|
62002
|
-
const dest =
|
|
61642
|
+
const dest = join86(backupDir, `${file2}.${backupId}`);
|
|
62003
61643
|
try {
|
|
62004
|
-
const content =
|
|
61644
|
+
const content = readFileSync60(src);
|
|
62005
61645
|
writeFileSync12(dest, content);
|
|
62006
61646
|
backedUp.push(file2);
|
|
62007
61647
|
} catch {
|
|
62008
61648
|
}
|
|
62009
61649
|
}
|
|
62010
61650
|
}
|
|
62011
|
-
const metaPath =
|
|
61651
|
+
const metaPath = join86(backupDir, `${backupId}.meta.json`);
|
|
62012
61652
|
try {
|
|
62013
61653
|
writeFileSync12(
|
|
62014
61654
|
metaPath,
|
|
@@ -62033,15 +61673,15 @@ function restoreBackup(projectRoot, params) {
|
|
|
62033
61673
|
if (!params.backupId) {
|
|
62034
61674
|
throw new CleoError(2 /* INVALID_INPUT */, "backupId is required");
|
|
62035
61675
|
}
|
|
62036
|
-
const cleoDir =
|
|
61676
|
+
const cleoDir = join86(projectRoot, ".cleo");
|
|
62037
61677
|
const backupTypes = ["snapshot", "safety", "migration"];
|
|
62038
61678
|
let metaPath = null;
|
|
62039
61679
|
let backupDir = null;
|
|
62040
61680
|
for (const btype of backupTypes) {
|
|
62041
|
-
const candidateMeta =
|
|
61681
|
+
const candidateMeta = join86(cleoDir, "backups", btype, `${params.backupId}.meta.json`);
|
|
62042
61682
|
if (existsSync84(candidateMeta)) {
|
|
62043
61683
|
metaPath = candidateMeta;
|
|
62044
|
-
backupDir =
|
|
61684
|
+
backupDir = join86(cleoDir, "backups", btype);
|
|
62045
61685
|
break;
|
|
62046
61686
|
}
|
|
62047
61687
|
}
|
|
@@ -62050,17 +61690,17 @@ function restoreBackup(projectRoot, params) {
|
|
|
62050
61690
|
}
|
|
62051
61691
|
let meta;
|
|
62052
61692
|
try {
|
|
62053
|
-
meta = JSON.parse(
|
|
61693
|
+
meta = JSON.parse(readFileSync60(metaPath, "utf-8"));
|
|
62054
61694
|
} catch {
|
|
62055
61695
|
throw new CleoError(3 /* FILE_ERROR */, "Failed to read backup metadata");
|
|
62056
61696
|
}
|
|
62057
61697
|
const restored = [];
|
|
62058
61698
|
for (const file2 of meta.files ?? []) {
|
|
62059
|
-
const backupFile =
|
|
61699
|
+
const backupFile = join86(backupDir, `${file2}.${params.backupId}`);
|
|
62060
61700
|
if (existsSync84(backupFile)) {
|
|
62061
61701
|
try {
|
|
62062
|
-
const content =
|
|
62063
|
-
writeFileSync12(
|
|
61702
|
+
const content = readFileSync60(backupFile);
|
|
61703
|
+
writeFileSync12(join86(cleoDir, file2), content);
|
|
62064
61704
|
restored.push(file2);
|
|
62065
61705
|
} catch {
|
|
62066
61706
|
}
|
|
@@ -62076,13 +61716,13 @@ function restoreBackup(projectRoot, params) {
|
|
|
62076
61716
|
|
|
62077
61717
|
// packages/core/src/system/cleanup.ts
|
|
62078
61718
|
init_src();
|
|
62079
|
-
import { existsSync as existsSync85, readdirSync as readdirSync29, readFileSync as
|
|
62080
|
-
import { join as
|
|
61719
|
+
import { existsSync as existsSync85, readdirSync as readdirSync29, readFileSync as readFileSync61, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
|
|
61720
|
+
import { join as join88 } from "node:path";
|
|
62081
61721
|
|
|
62082
61722
|
// packages/core/src/audit-prune.ts
|
|
62083
61723
|
init_logger();
|
|
62084
61724
|
import { createWriteStream, mkdirSync as mkdirSync20 } from "node:fs";
|
|
62085
|
-
import { join as
|
|
61725
|
+
import { join as join87 } from "node:path";
|
|
62086
61726
|
import { Readable } from "node:stream";
|
|
62087
61727
|
import { pipeline } from "node:stream/promises";
|
|
62088
61728
|
import { createGzip } from "node:zlib";
|
|
@@ -62094,7 +61734,7 @@ async function pruneAuditLog(cleoDir, config2) {
|
|
|
62094
61734
|
return { rowsArchived: 0, rowsDeleted: 0 };
|
|
62095
61735
|
}
|
|
62096
61736
|
const cutoff = new Date(Date.now() - config2.auditRetentionDays * 864e5).toISOString();
|
|
62097
|
-
const projectRoot =
|
|
61737
|
+
const projectRoot = join87(cleoDir, "..");
|
|
62098
61738
|
const { getDb: getDb3 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62099
61739
|
const { auditLog: auditLog2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
62100
61740
|
const { lt: lt3 } = await import("drizzle-orm");
|
|
@@ -62108,10 +61748,10 @@ async function pruneAuditLog(cleoDir, config2) {
|
|
|
62108
61748
|
let rowsArchived = 0;
|
|
62109
61749
|
if (config2.archiveBeforePrune) {
|
|
62110
61750
|
try {
|
|
62111
|
-
const archiveDir =
|
|
61751
|
+
const archiveDir = join87(cleoDir, "backups", "logs");
|
|
62112
61752
|
mkdirSync20(archiveDir, { recursive: true });
|
|
62113
61753
|
const dateStamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
62114
|
-
archivePath =
|
|
61754
|
+
archivePath = join87(archiveDir, `audit-${dateStamp}.jsonl.gz`);
|
|
62115
61755
|
const lines = oldRows.map((row) => JSON.stringify(row));
|
|
62116
61756
|
const jsonlContent = lines.join("\n") + "\n";
|
|
62117
61757
|
const gzip = createGzip();
|
|
@@ -62154,7 +61794,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62154
61794
|
"target is required (sessions|backups|logs|archive)"
|
|
62155
61795
|
);
|
|
62156
61796
|
}
|
|
62157
|
-
const cleoDir =
|
|
61797
|
+
const cleoDir = join88(projectRoot, ".cleo");
|
|
62158
61798
|
const dryRun = params.dryRun ?? false;
|
|
62159
61799
|
const items = [];
|
|
62160
61800
|
let prunedRows;
|
|
@@ -62162,10 +61802,10 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62162
61802
|
let archivePath;
|
|
62163
61803
|
switch (params.target) {
|
|
62164
61804
|
case "sessions": {
|
|
62165
|
-
const sessPath =
|
|
61805
|
+
const sessPath = join88(cleoDir, "sessions.json");
|
|
62166
61806
|
if (existsSync85(sessPath)) {
|
|
62167
61807
|
try {
|
|
62168
|
-
const data = JSON.parse(
|
|
61808
|
+
const data = JSON.parse(readFileSync61(sessPath, "utf-8"));
|
|
62169
61809
|
const sessions2 = data.sessions ?? [];
|
|
62170
61810
|
const stale = sessions2.filter(
|
|
62171
61811
|
(s) => {
|
|
@@ -62191,16 +61831,16 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62191
61831
|
break;
|
|
62192
61832
|
}
|
|
62193
61833
|
case "backups": {
|
|
62194
|
-
const backupBaseDir =
|
|
61834
|
+
const backupBaseDir = join88(cleoDir, "backups");
|
|
62195
61835
|
if (existsSync85(backupBaseDir)) {
|
|
62196
61836
|
for (const typeDir of readdirSync29(backupBaseDir)) {
|
|
62197
|
-
const fullDir =
|
|
61837
|
+
const fullDir = join88(backupBaseDir, typeDir);
|
|
62198
61838
|
try {
|
|
62199
61839
|
for (const file2 of readdirSync29(fullDir)) {
|
|
62200
61840
|
if (file2.endsWith(".meta.json")) {
|
|
62201
|
-
const metaFilePath =
|
|
61841
|
+
const metaFilePath = join88(fullDir, file2);
|
|
62202
61842
|
try {
|
|
62203
|
-
const meta = JSON.parse(
|
|
61843
|
+
const meta = JSON.parse(readFileSync61(metaFilePath, "utf-8"));
|
|
62204
61844
|
if (params.olderThan && meta.timestamp < params.olderThan) {
|
|
62205
61845
|
items.push(file2.replace(".meta.json", ""));
|
|
62206
61846
|
if (!dryRun) {
|
|
@@ -62208,7 +61848,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62208
61848
|
for (const bf of readdirSync29(fullDir)) {
|
|
62209
61849
|
if (bf.includes(meta.backupId)) {
|
|
62210
61850
|
try {
|
|
62211
|
-
unlinkSync5(
|
|
61851
|
+
unlinkSync5(join88(fullDir, bf));
|
|
62212
61852
|
} catch {
|
|
62213
61853
|
}
|
|
62214
61854
|
}
|
|
@@ -62240,7 +61880,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
62240
61880
|
items.push(file2);
|
|
62241
61881
|
if (!dryRun) {
|
|
62242
61882
|
try {
|
|
62243
|
-
unlinkSync5(
|
|
61883
|
+
unlinkSync5(join88(cleoDir, file2));
|
|
62244
61884
|
} catch {
|
|
62245
61885
|
}
|
|
62246
61886
|
}
|
|
@@ -62268,9 +61908,9 @@ init_hooks();
|
|
|
62268
61908
|
init_injection();
|
|
62269
61909
|
init_paths();
|
|
62270
61910
|
import { execFile as execFile6, execFileSync as execFileSync11 } from "node:child_process";
|
|
62271
|
-
import { existsSync as existsSync89, readFileSync as
|
|
61911
|
+
import { existsSync as existsSync89, readFileSync as readFileSync64, statSync as statSync19 } from "node:fs";
|
|
62272
61912
|
import { createRequire as createRequire6 } from "node:module";
|
|
62273
|
-
import { join as
|
|
61913
|
+
import { join as join92 } from "node:path";
|
|
62274
61914
|
import { promisify as promisify6 } from "node:util";
|
|
62275
61915
|
|
|
62276
61916
|
// packages/core/src/platform.ts
|
|
@@ -62292,30 +61932,30 @@ import {
|
|
|
62292
61932
|
existsSync as existsSync87,
|
|
62293
61933
|
mkdirSync as mkdirSync21,
|
|
62294
61934
|
readdirSync as readdirSync30,
|
|
62295
|
-
readFileSync as
|
|
61935
|
+
readFileSync as readFileSync62,
|
|
62296
61936
|
renameSync as renameSync6,
|
|
62297
61937
|
unlinkSync as unlinkSync6,
|
|
62298
61938
|
writeFileSync as writeFileSync14
|
|
62299
61939
|
} from "node:fs";
|
|
62300
|
-
import { basename as basename14, dirname as dirname17, join as
|
|
61940
|
+
import { basename as basename14, dirname as dirname17, join as join90 } from "node:path";
|
|
62301
61941
|
import * as lockfile2 from "proper-lockfile";
|
|
62302
61942
|
var MAX_BACKUPS = 10;
|
|
62303
61943
|
function rotateBackup(filePath) {
|
|
62304
61944
|
const dir = dirname17(filePath);
|
|
62305
61945
|
const name2 = basename14(filePath);
|
|
62306
|
-
const backupDir =
|
|
61946
|
+
const backupDir = join90(dir, ".backups");
|
|
62307
61947
|
if (!existsSync87(backupDir)) {
|
|
62308
61948
|
mkdirSync21(backupDir, { recursive: true });
|
|
62309
61949
|
}
|
|
62310
61950
|
for (let i = MAX_BACKUPS; i >= 1; i--) {
|
|
62311
|
-
const current =
|
|
61951
|
+
const current = join90(backupDir, `${name2}.${i}`);
|
|
62312
61952
|
if (i === MAX_BACKUPS) {
|
|
62313
61953
|
try {
|
|
62314
61954
|
unlinkSync6(current);
|
|
62315
61955
|
} catch {
|
|
62316
61956
|
}
|
|
62317
61957
|
} else {
|
|
62318
|
-
const next =
|
|
61958
|
+
const next = join90(backupDir, `${name2}.${i + 1}`);
|
|
62319
61959
|
try {
|
|
62320
61960
|
if (existsSync87(current)) renameSync6(current, next);
|
|
62321
61961
|
} catch {
|
|
@@ -62323,14 +61963,14 @@ function rotateBackup(filePath) {
|
|
|
62323
61963
|
}
|
|
62324
61964
|
}
|
|
62325
61965
|
try {
|
|
62326
|
-
const content =
|
|
62327
|
-
writeFileSync14(
|
|
61966
|
+
const content = readFileSync62(filePath, "utf-8");
|
|
61967
|
+
writeFileSync14(join90(backupDir, `${name2}.1`), content, "utf-8");
|
|
62328
61968
|
} catch {
|
|
62329
61969
|
}
|
|
62330
61970
|
}
|
|
62331
61971
|
function writeJsonFileAtomic(filePath, data, indent = 2) {
|
|
62332
61972
|
const dir = dirname17(filePath);
|
|
62333
|
-
const tempPath =
|
|
61973
|
+
const tempPath = join90(dir, `.${basename14(filePath)}.${randomBytes12(6).toString("hex")}.tmp`);
|
|
62334
61974
|
const content = JSON.stringify(data, null, indent) + "\n";
|
|
62335
61975
|
writeFileSync14(tempPath, content, "utf-8");
|
|
62336
61976
|
try {
|
|
@@ -62347,7 +61987,7 @@ function writeJsonFileAtomic(filePath, data, indent = 2) {
|
|
|
62347
61987
|
}
|
|
62348
61988
|
}
|
|
62349
61989
|
function getDataPath(projectRoot, filename) {
|
|
62350
|
-
return
|
|
61990
|
+
return join90(projectRoot, ".cleo", filename);
|
|
62351
61991
|
}
|
|
62352
61992
|
|
|
62353
61993
|
// packages/core/src/platform.ts
|
|
@@ -62469,9 +62109,9 @@ init_data_accessor();
|
|
|
62469
62109
|
|
|
62470
62110
|
// packages/core/src/validation/doctor/checks.ts
|
|
62471
62111
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
62472
|
-
import { accessSync as accessSync2, constants as constants2, existsSync as existsSync88, readFileSync as
|
|
62112
|
+
import { accessSync as accessSync2, constants as constants2, existsSync as existsSync88, readFileSync as readFileSync63, statSync as statSync18 } from "node:fs";
|
|
62473
62113
|
import { homedir as homedir4 } from "node:os";
|
|
62474
|
-
import { join as
|
|
62114
|
+
import { join as join91 } from "node:path";
|
|
62475
62115
|
|
|
62476
62116
|
// packages/core/src/constants.ts
|
|
62477
62117
|
var CORE_PROTECTED_FILES = [
|
|
@@ -62499,7 +62139,7 @@ function checkCliInstallation(cleoHome = getCleoHome()) {
|
|
|
62499
62139
|
}
|
|
62500
62140
|
var VERSION_REGEX = /^\d+\.\d+\.\d+$/;
|
|
62501
62141
|
function checkCliVersion(cleoHome = getCleoHome()) {
|
|
62502
|
-
const versionFile =
|
|
62142
|
+
const versionFile = join91(cleoHome, "VERSION");
|
|
62503
62143
|
if (!existsSync88(versionFile)) {
|
|
62504
62144
|
return {
|
|
62505
62145
|
id: "cli_version",
|
|
@@ -62510,7 +62150,7 @@ function checkCliVersion(cleoHome = getCleoHome()) {
|
|
|
62510
62150
|
fix: "Run install.sh to reinstall CLEO"
|
|
62511
62151
|
};
|
|
62512
62152
|
}
|
|
62513
|
-
const version2 =
|
|
62153
|
+
const version2 = readFileSync63(versionFile, "utf-8").trim().split("\n")[0].trim();
|
|
62514
62154
|
const valid = VERSION_REGEX.test(version2);
|
|
62515
62155
|
return {
|
|
62516
62156
|
id: "cli_version",
|
|
@@ -62522,7 +62162,7 @@ function checkCliVersion(cleoHome = getCleoHome()) {
|
|
|
62522
62162
|
};
|
|
62523
62163
|
}
|
|
62524
62164
|
function checkDocsAccessibility(cleoHome = getCleoHome()) {
|
|
62525
|
-
const docsFile =
|
|
62165
|
+
const docsFile = join91(cleoHome, "templates", "CLEO-INJECTION.md");
|
|
62526
62166
|
if (!existsSync88(docsFile)) {
|
|
62527
62167
|
return {
|
|
62528
62168
|
id: "docs_accessibility",
|
|
@@ -62556,7 +62196,7 @@ function checkDocsAccessibility(cleoHome = getCleoHome()) {
|
|
|
62556
62196
|
};
|
|
62557
62197
|
}
|
|
62558
62198
|
function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
62559
|
-
const docsFile =
|
|
62199
|
+
const docsFile = join91(cleoHome, "templates", "CLEO-INJECTION.md");
|
|
62560
62200
|
const reference = "@~/.cleo/templates/CLEO-INJECTION.md";
|
|
62561
62201
|
if (!existsSync88(docsFile)) {
|
|
62562
62202
|
return {
|
|
@@ -62570,7 +62210,7 @@ function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
|
62570
62210
|
}
|
|
62571
62211
|
try {
|
|
62572
62212
|
accessSync2(docsFile, constants2.R_OK);
|
|
62573
|
-
const content =
|
|
62213
|
+
const content = readFileSync63(docsFile, "utf-8");
|
|
62574
62214
|
const firstLine = content.split("\n")[0] ?? "";
|
|
62575
62215
|
if (!firstLine) {
|
|
62576
62216
|
return {
|
|
@@ -62604,7 +62244,7 @@ function checkAtReferenceResolution(cleoHome = getCleoHome()) {
|
|
|
62604
62244
|
}
|
|
62605
62245
|
function checkAgentsMdHub(projectRoot) {
|
|
62606
62246
|
const root = projectRoot ?? process.cwd();
|
|
62607
|
-
const agentsMdPath =
|
|
62247
|
+
const agentsMdPath = join91(root, "AGENTS.md");
|
|
62608
62248
|
if (!existsSync88(agentsMdPath)) {
|
|
62609
62249
|
return {
|
|
62610
62250
|
id: "agents_md_hub",
|
|
@@ -62617,7 +62257,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
62617
62257
|
}
|
|
62618
62258
|
let content;
|
|
62619
62259
|
try {
|
|
62620
|
-
content =
|
|
62260
|
+
content = readFileSync63(agentsMdPath, "utf-8");
|
|
62621
62261
|
} catch {
|
|
62622
62262
|
return {
|
|
62623
62263
|
id: "agents_md_hub",
|
|
@@ -62649,7 +62289,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
62649
62289
|
}
|
|
62650
62290
|
function checkRootGitignore(projectRoot) {
|
|
62651
62291
|
const root = projectRoot ?? process.cwd();
|
|
62652
|
-
const gitignorePath =
|
|
62292
|
+
const gitignorePath = join91(root, ".gitignore");
|
|
62653
62293
|
if (!existsSync88(gitignorePath)) {
|
|
62654
62294
|
return {
|
|
62655
62295
|
id: "root_gitignore",
|
|
@@ -62662,7 +62302,7 @@ function checkRootGitignore(projectRoot) {
|
|
|
62662
62302
|
}
|
|
62663
62303
|
let content;
|
|
62664
62304
|
try {
|
|
62665
|
-
content =
|
|
62305
|
+
content = readFileSync63(gitignorePath, "utf-8");
|
|
62666
62306
|
} catch {
|
|
62667
62307
|
return {
|
|
62668
62308
|
id: "root_gitignore",
|
|
@@ -62700,7 +62340,7 @@ function checkRootGitignore(projectRoot) {
|
|
|
62700
62340
|
}
|
|
62701
62341
|
function checkCleoGitignore(projectRoot) {
|
|
62702
62342
|
const root = projectRoot ?? process.cwd();
|
|
62703
|
-
const gitignorePath =
|
|
62343
|
+
const gitignorePath = join91(root, ".cleo", ".gitignore");
|
|
62704
62344
|
if (!existsSync88(gitignorePath)) {
|
|
62705
62345
|
return {
|
|
62706
62346
|
id: "cleo_gitignore",
|
|
@@ -62713,7 +62353,7 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62713
62353
|
}
|
|
62714
62354
|
let installedContent;
|
|
62715
62355
|
try {
|
|
62716
|
-
installedContent =
|
|
62356
|
+
installedContent = readFileSync63(gitignorePath, "utf-8");
|
|
62717
62357
|
} catch {
|
|
62718
62358
|
return {
|
|
62719
62359
|
id: "cleo_gitignore",
|
|
@@ -62730,12 +62370,12 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62730
62370
|
} catch {
|
|
62731
62371
|
try {
|
|
62732
62372
|
const templatePaths = [
|
|
62733
|
-
|
|
62734
|
-
|
|
62373
|
+
join91(root, "templates", "cleo-gitignore"),
|
|
62374
|
+
join91(getCleoHome(), "templates", "cleo-gitignore")
|
|
62735
62375
|
];
|
|
62736
62376
|
for (const tp of templatePaths) {
|
|
62737
62377
|
if (existsSync88(tp)) {
|
|
62738
|
-
templateContent =
|
|
62378
|
+
templateContent = readFileSync63(tp, "utf-8");
|
|
62739
62379
|
break;
|
|
62740
62380
|
}
|
|
62741
62381
|
}
|
|
@@ -62768,10 +62408,10 @@ function checkCleoGitignore(projectRoot) {
|
|
|
62768
62408
|
};
|
|
62769
62409
|
}
|
|
62770
62410
|
function detectStorageEngine(projectRoot) {
|
|
62771
|
-
const configPath =
|
|
62411
|
+
const configPath = join91(projectRoot, ".cleo", "config.json");
|
|
62772
62412
|
if (existsSync88(configPath)) {
|
|
62773
62413
|
try {
|
|
62774
|
-
const config2 = JSON.parse(
|
|
62414
|
+
const config2 = JSON.parse(readFileSync63(configPath, "utf-8"));
|
|
62775
62415
|
if (typeof config2.storageEngine === "string" && config2.storageEngine) {
|
|
62776
62416
|
return config2.storageEngine;
|
|
62777
62417
|
}
|
|
@@ -62782,7 +62422,7 @@ function detectStorageEngine(projectRoot) {
|
|
|
62782
62422
|
}
|
|
62783
62423
|
function checkVitalFilesTracked(projectRoot) {
|
|
62784
62424
|
const root = projectRoot ?? process.cwd();
|
|
62785
|
-
const gitDir =
|
|
62425
|
+
const gitDir = join91(root, ".git");
|
|
62786
62426
|
if (!existsSync88(gitDir)) {
|
|
62787
62427
|
return {
|
|
62788
62428
|
id: "vital_files_tracked",
|
|
@@ -62797,7 +62437,7 @@ function checkVitalFilesTracked(projectRoot) {
|
|
|
62797
62437
|
const vitalFiles = CORE_PROTECTED_FILES.map((f) => `.cleo/${f}`);
|
|
62798
62438
|
const untracked = [];
|
|
62799
62439
|
for (const file2 of vitalFiles) {
|
|
62800
|
-
const fullPath =
|
|
62440
|
+
const fullPath = join91(root, file2);
|
|
62801
62441
|
if (!existsSync88(fullPath)) continue;
|
|
62802
62442
|
try {
|
|
62803
62443
|
execFileSync10("git", ["ls-files", "--error-unmatch", file2], {
|
|
@@ -62829,7 +62469,7 @@ function checkVitalFilesTracked(projectRoot) {
|
|
|
62829
62469
|
}
|
|
62830
62470
|
function checkCoreFilesNotIgnored(projectRoot) {
|
|
62831
62471
|
const root = projectRoot ?? process.cwd();
|
|
62832
|
-
const gitDir =
|
|
62472
|
+
const gitDir = join91(root, ".git");
|
|
62833
62473
|
if (!existsSync88(gitDir)) {
|
|
62834
62474
|
return {
|
|
62835
62475
|
id: "core_files_not_ignored",
|
|
@@ -62843,7 +62483,7 @@ function checkCoreFilesNotIgnored(projectRoot) {
|
|
|
62843
62483
|
const ignoredFiles = [];
|
|
62844
62484
|
for (const file2 of CORE_PROTECTED_FILES) {
|
|
62845
62485
|
const relPath = `.cleo/${file2}`;
|
|
62846
|
-
const fullPath =
|
|
62486
|
+
const fullPath = join91(root, relPath);
|
|
62847
62487
|
if (!existsSync88(fullPath)) continue;
|
|
62848
62488
|
try {
|
|
62849
62489
|
execFileSync10("git", ["check-ignore", "-q", relPath], {
|
|
@@ -62875,7 +62515,7 @@ function checkCoreFilesNotIgnored(projectRoot) {
|
|
|
62875
62515
|
}
|
|
62876
62516
|
function checkSqliteNotTracked(projectRoot) {
|
|
62877
62517
|
const root = projectRoot ?? process.cwd();
|
|
62878
|
-
const gitDir =
|
|
62518
|
+
const gitDir = join91(root, ".git");
|
|
62879
62519
|
if (!existsSync88(gitDir)) {
|
|
62880
62520
|
return {
|
|
62881
62521
|
id: "sqlite_not_tracked",
|
|
@@ -62887,7 +62527,7 @@ function checkSqliteNotTracked(projectRoot) {
|
|
|
62887
62527
|
};
|
|
62888
62528
|
}
|
|
62889
62529
|
const sqliteFile = ".cleo/tasks.db";
|
|
62890
|
-
const fullPath =
|
|
62530
|
+
const fullPath = join91(root, sqliteFile);
|
|
62891
62531
|
if (!existsSync88(fullPath)) {
|
|
62892
62532
|
return {
|
|
62893
62533
|
id: "sqlite_not_tracked",
|
|
@@ -62924,7 +62564,7 @@ function checkSqliteNotTracked(projectRoot) {
|
|
|
62924
62564
|
}
|
|
62925
62565
|
function checkLegacyAgentOutputs(projectRoot) {
|
|
62926
62566
|
const root = projectRoot ?? process.cwd();
|
|
62927
|
-
const cleoDir =
|
|
62567
|
+
const cleoDir = join91(root, ".cleo");
|
|
62928
62568
|
const detection = detectLegacyAgentOutputs(root, cleoDir);
|
|
62929
62569
|
if (detection.hasLegacy) {
|
|
62930
62570
|
return {
|
|
@@ -62950,11 +62590,11 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
62950
62590
|
const files = ["CLAUDE.md", "AGENTS.md"];
|
|
62951
62591
|
const issues = [];
|
|
62952
62592
|
for (const file2 of files) {
|
|
62953
|
-
const filePath =
|
|
62593
|
+
const filePath = join91(root, file2);
|
|
62954
62594
|
if (!existsSync88(filePath)) continue;
|
|
62955
62595
|
let content;
|
|
62956
62596
|
try {
|
|
62957
|
-
content =
|
|
62597
|
+
content = readFileSync63(filePath, "utf-8");
|
|
62958
62598
|
} catch {
|
|
62959
62599
|
continue;
|
|
62960
62600
|
}
|
|
@@ -62988,7 +62628,7 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
62988
62628
|
}
|
|
62989
62629
|
function checkAtReferenceTargetExists(projectRoot) {
|
|
62990
62630
|
const root = projectRoot ?? process.cwd();
|
|
62991
|
-
const agentsPath =
|
|
62631
|
+
const agentsPath = join91(root, "AGENTS.md");
|
|
62992
62632
|
if (!existsSync88(agentsPath)) {
|
|
62993
62633
|
return {
|
|
62994
62634
|
id: "at_reference_targets",
|
|
@@ -63001,7 +62641,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63001
62641
|
}
|
|
63002
62642
|
let content;
|
|
63003
62643
|
try {
|
|
63004
|
-
content =
|
|
62644
|
+
content = readFileSync63(agentsPath, "utf-8");
|
|
63005
62645
|
} catch {
|
|
63006
62646
|
return {
|
|
63007
62647
|
id: "at_reference_targets",
|
|
@@ -63028,7 +62668,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63028
62668
|
const missing = [];
|
|
63029
62669
|
for (const ref of refs) {
|
|
63030
62670
|
const rawPath = ref.slice(1).trim();
|
|
63031
|
-
const resolvedPath = rawPath.startsWith("~/") ?
|
|
62671
|
+
const resolvedPath = rawPath.startsWith("~/") ? join91(homedir4(), rawPath.slice(2)) : join91(root, rawPath);
|
|
63032
62672
|
if (!existsSync88(resolvedPath)) {
|
|
63033
62673
|
missing.push(rawPath);
|
|
63034
62674
|
}
|
|
@@ -63055,8 +62695,8 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
63055
62695
|
function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
63056
62696
|
const root = projectRoot ?? process.cwd();
|
|
63057
62697
|
const home = cleoHome ?? getCleoHome();
|
|
63058
|
-
const sourcePath =
|
|
63059
|
-
const deployedPath =
|
|
62698
|
+
const sourcePath = join91(root, "templates", "CLEO-INJECTION.md");
|
|
62699
|
+
const deployedPath = join91(home, "templates", "CLEO-INJECTION.md");
|
|
63060
62700
|
if (!existsSync88(sourcePath)) {
|
|
63061
62701
|
return {
|
|
63062
62702
|
id: "template_freshness",
|
|
@@ -63077,8 +62717,8 @@ function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
|
63077
62717
|
fix: "cp templates/CLEO-INJECTION.md ~/.cleo/templates/CLEO-INJECTION.md"
|
|
63078
62718
|
};
|
|
63079
62719
|
}
|
|
63080
|
-
const sourceContent =
|
|
63081
|
-
const deployedContent =
|
|
62720
|
+
const sourceContent = readFileSync63(sourcePath, "utf-8");
|
|
62721
|
+
const deployedContent = readFileSync63(deployedPath, "utf-8");
|
|
63082
62722
|
if (sourceContent !== deployedContent) {
|
|
63083
62723
|
return {
|
|
63084
62724
|
id: "template_freshness",
|
|
@@ -63100,7 +62740,7 @@ function checkTemplateFreshness(projectRoot, cleoHome) {
|
|
|
63100
62740
|
}
|
|
63101
62741
|
function checkTierMarkersPresent(cleoHome) {
|
|
63102
62742
|
const home = cleoHome ?? getCleoHome();
|
|
63103
|
-
const templatePath =
|
|
62743
|
+
const templatePath = join91(home, "templates", "CLEO-INJECTION.md");
|
|
63104
62744
|
if (!existsSync88(templatePath)) {
|
|
63105
62745
|
return {
|
|
63106
62746
|
id: "tier_markers_present",
|
|
@@ -63111,7 +62751,7 @@ function checkTierMarkersPresent(cleoHome) {
|
|
|
63111
62751
|
fix: "Run install.sh to reinstall CLEO"
|
|
63112
62752
|
};
|
|
63113
62753
|
}
|
|
63114
|
-
const content =
|
|
62754
|
+
const content = readFileSync63(templatePath, "utf-8");
|
|
63115
62755
|
const expectedTiers = ["minimal", "standard", "orchestrator"];
|
|
63116
62756
|
const missing = [];
|
|
63117
62757
|
const unclosed = [];
|
|
@@ -63222,7 +62862,7 @@ function checkGlobalSchemaHealth(_projectRoot) {
|
|
|
63222
62862
|
}
|
|
63223
62863
|
function checkNoLocalSchemas(projectRoot) {
|
|
63224
62864
|
const root = projectRoot ?? process.cwd();
|
|
63225
|
-
const localSchemasDir =
|
|
62865
|
+
const localSchemasDir = join91(root, ".cleo", "schemas");
|
|
63226
62866
|
if (!existsSync88(localSchemasDir)) {
|
|
63227
62867
|
return {
|
|
63228
62868
|
id: "no_local_schemas",
|
|
@@ -63287,13 +62927,13 @@ var databaseSyncCtor = (() => {
|
|
|
63287
62927
|
})();
|
|
63288
62928
|
var STALE_JSON_FILES = ["todo.json", "sessions.json", "todo-archive.json"];
|
|
63289
62929
|
function resolveStructuredLogPath(cleoDir) {
|
|
63290
|
-
const defaultPath =
|
|
63291
|
-
const configPath =
|
|
62930
|
+
const defaultPath = join92(cleoDir, "logs", "cleo.log");
|
|
62931
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63292
62932
|
if (!existsSync89(configPath)) return defaultPath;
|
|
63293
62933
|
try {
|
|
63294
|
-
const config2 = JSON.parse(
|
|
62934
|
+
const config2 = JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63295
62935
|
if (!config2.logging?.filePath) return defaultPath;
|
|
63296
|
-
return
|
|
62936
|
+
return join92(cleoDir, config2.logging.filePath);
|
|
63297
62937
|
} catch {
|
|
63298
62938
|
return defaultPath;
|
|
63299
62939
|
}
|
|
@@ -63335,14 +62975,14 @@ function checkAuditLogAvailability(dbPath) {
|
|
|
63335
62975
|
}
|
|
63336
62976
|
}
|
|
63337
62977
|
async function getSystemHealth(projectRoot, opts) {
|
|
63338
|
-
const cleoDir =
|
|
62978
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63339
62979
|
const checks = [];
|
|
63340
62980
|
if (existsSync89(cleoDir)) {
|
|
63341
62981
|
checks.push({ name: "cleo_dir", status: "pass", message: ".cleo directory exists" });
|
|
63342
62982
|
} else {
|
|
63343
62983
|
checks.push({ name: "cleo_dir", status: "fail", message: ".cleo directory not found" });
|
|
63344
62984
|
}
|
|
63345
|
-
const dbPath =
|
|
62985
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63346
62986
|
if (existsSync89(dbPath)) {
|
|
63347
62987
|
try {
|
|
63348
62988
|
const dbSize = statSync19(dbPath).size;
|
|
@@ -63364,7 +63004,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63364
63004
|
if (existsSync89(dbPath)) {
|
|
63365
63005
|
checks.push(checkAuditLogAvailability(dbPath));
|
|
63366
63006
|
}
|
|
63367
|
-
const sdDbPath =
|
|
63007
|
+
const sdDbPath = join92(cleoDir, "signaldock.db");
|
|
63368
63008
|
if (existsSync89(sdDbPath)) {
|
|
63369
63009
|
try {
|
|
63370
63010
|
const { DatabaseSync: SdDb } = _require6("node:sqlite");
|
|
@@ -63402,10 +63042,10 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63402
63042
|
message: "signaldock.db not found. Run: cleo init"
|
|
63403
63043
|
});
|
|
63404
63044
|
}
|
|
63405
|
-
const configPath =
|
|
63045
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63406
63046
|
if (existsSync89(configPath)) {
|
|
63407
63047
|
try {
|
|
63408
|
-
JSON.parse(
|
|
63048
|
+
JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63409
63049
|
checks.push({ name: "config_json", status: "pass", message: "config.json is valid JSON" });
|
|
63410
63050
|
} catch {
|
|
63411
63051
|
checks.push({
|
|
@@ -63418,7 +63058,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63418
63058
|
checks.push({ name: "config_json", status: "warn", message: "config.json not found" });
|
|
63419
63059
|
}
|
|
63420
63060
|
if (existsSync89(dbPath)) {
|
|
63421
|
-
const staleFiles = STALE_JSON_FILES.filter((f) => existsSync89(
|
|
63061
|
+
const staleFiles = STALE_JSON_FILES.filter((f) => existsSync89(join92(cleoDir, f)));
|
|
63422
63062
|
if (staleFiles.length > 0) {
|
|
63423
63063
|
checks.push({
|
|
63424
63064
|
name: "stale_json",
|
|
@@ -63442,7 +63082,7 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63442
63082
|
message: `structured log not found: ${logPath}`
|
|
63443
63083
|
});
|
|
63444
63084
|
}
|
|
63445
|
-
const backupDir =
|
|
63085
|
+
const backupDir = join92(cleoDir, ".backups");
|
|
63446
63086
|
if (existsSync89(backupDir)) {
|
|
63447
63087
|
checks.push({ name: "backups_dir", status: "pass", message: ".backups directory exists" });
|
|
63448
63088
|
} else {
|
|
@@ -63455,9 +63095,9 @@ async function getSystemHealth(projectRoot, opts) {
|
|
|
63455
63095
|
}
|
|
63456
63096
|
let version2 = "unknown";
|
|
63457
63097
|
try {
|
|
63458
|
-
const pkgPath =
|
|
63098
|
+
const pkgPath = join92(projectRoot, "package.json");
|
|
63459
63099
|
if (existsSync89(pkgPath)) {
|
|
63460
|
-
const pkg = JSON.parse(
|
|
63100
|
+
const pkg = JSON.parse(readFileSync64(pkgPath, "utf-8"));
|
|
63461
63101
|
version2 = pkg.version || "unknown";
|
|
63462
63102
|
}
|
|
63463
63103
|
} catch {
|
|
@@ -63491,8 +63131,8 @@ async function getSystemDiagnostics(projectRoot, opts) {
|
|
|
63491
63131
|
details: preflight.summary
|
|
63492
63132
|
});
|
|
63493
63133
|
}
|
|
63494
|
-
const cleoDir =
|
|
63495
|
-
const dbPath =
|
|
63134
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63135
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63496
63136
|
if (existsSync89(dbPath)) {
|
|
63497
63137
|
try {
|
|
63498
63138
|
const accessor = await getAccessor(projectRoot);
|
|
@@ -63632,14 +63272,14 @@ function mapSchemaCheckResult(sr) {
|
|
|
63632
63272
|
};
|
|
63633
63273
|
}
|
|
63634
63274
|
function checkContributorChannel(projectRoot) {
|
|
63635
|
-
const configPath =
|
|
63275
|
+
const configPath = join92(projectRoot, ".cleo", "config.json");
|
|
63636
63276
|
if (!existsSync89(configPath)) {
|
|
63637
63277
|
return { check: "contributor_channel", status: "ok", message: "Not a contributor project" };
|
|
63638
63278
|
}
|
|
63639
63279
|
let isContributor = false;
|
|
63640
63280
|
let devCli = "cleo-dev";
|
|
63641
63281
|
try {
|
|
63642
|
-
const config2 = JSON.parse(
|
|
63282
|
+
const config2 = JSON.parse(readFileSync64(configPath, "utf-8"));
|
|
63643
63283
|
isContributor = config2.contributor?.isContributorProject === true;
|
|
63644
63284
|
devCli = config2.contributor?.devCli ?? "cleo-dev";
|
|
63645
63285
|
} catch {
|
|
@@ -63649,7 +63289,7 @@ function checkContributorChannel(projectRoot) {
|
|
|
63649
63289
|
return { check: "contributor_channel", status: "ok", message: "Not a contributor project" };
|
|
63650
63290
|
}
|
|
63651
63291
|
const pathDirs = (process.env["PATH"] ?? "").split(":").filter(Boolean);
|
|
63652
|
-
const devCliOnPath = pathDirs.some((dir) => existsSync89(
|
|
63292
|
+
const devCliOnPath = pathDirs.some((dir) => existsSync89(join92(dir, devCli)));
|
|
63653
63293
|
if (!devCliOnPath) {
|
|
63654
63294
|
return {
|
|
63655
63295
|
check: "contributor_channel",
|
|
@@ -63682,14 +63322,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63682
63322
|
status: gitPath ? "ok" : "warning",
|
|
63683
63323
|
message: gitPath ? `git found: ${gitPath}` : "git not found (optional, needed for version control features)"
|
|
63684
63324
|
});
|
|
63685
|
-
const cleoDir =
|
|
63325
|
+
const cleoDir = join92(projectRoot, ".cleo");
|
|
63686
63326
|
const dirExists = existsSync89(cleoDir);
|
|
63687
63327
|
checks.push({
|
|
63688
63328
|
check: "project_dir",
|
|
63689
63329
|
status: dirExists ? "ok" : "error",
|
|
63690
63330
|
message: dirExists ? `Project dir: ${cleoDir}` : `Project dir not found: ${cleoDir}. Run: cleo init`
|
|
63691
63331
|
});
|
|
63692
|
-
const dbPath =
|
|
63332
|
+
const dbPath = join92(cleoDir, "tasks.db");
|
|
63693
63333
|
const dbExists2 = existsSync89(dbPath);
|
|
63694
63334
|
const dbSize = await fileSize(dbPath);
|
|
63695
63335
|
checks.push({
|
|
@@ -63739,14 +63379,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63739
63379
|
} catch {
|
|
63740
63380
|
}
|
|
63741
63381
|
}
|
|
63742
|
-
const configPath =
|
|
63382
|
+
const configPath = join92(cleoDir, "config.json");
|
|
63743
63383
|
const configExists = existsSync89(configPath);
|
|
63744
63384
|
checks.push({
|
|
63745
63385
|
check: "config_file",
|
|
63746
63386
|
status: configExists ? "ok" : "warning",
|
|
63747
63387
|
message: configExists ? "config.json present" : "config.json not found (using defaults)"
|
|
63748
63388
|
});
|
|
63749
|
-
const staleJsonFiles = STALE_JSON_FILES.filter((f) => existsSync89(
|
|
63389
|
+
const staleJsonFiles = STALE_JSON_FILES.filter((f) => existsSync89(join92(cleoDir, f)));
|
|
63750
63390
|
if (dbExists2 && staleJsonFiles.length > 0) {
|
|
63751
63391
|
checks.push({
|
|
63752
63392
|
check: "stale_json",
|
|
@@ -63762,10 +63402,10 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63762
63402
|
status: logExists ? "ok" : "warning",
|
|
63763
63403
|
message: logExists ? `structured log present: ${logPath}` : `structured log not found: ${logPath}`
|
|
63764
63404
|
});
|
|
63765
|
-
const rootGitignorePath =
|
|
63405
|
+
const rootGitignorePath = join92(projectRoot, ".gitignore");
|
|
63766
63406
|
if (existsSync89(rootGitignorePath)) {
|
|
63767
63407
|
try {
|
|
63768
|
-
const gitignoreContent =
|
|
63408
|
+
const gitignoreContent = readFileSync64(rootGitignorePath, "utf-8");
|
|
63769
63409
|
const blockingLines = gitignoreContent.split("\n").filter((line2) => {
|
|
63770
63410
|
const trimmed = line2.trim();
|
|
63771
63411
|
if (trimmed.startsWith("#") || trimmed === "") return false;
|
|
@@ -63784,7 +63424,7 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63784
63424
|
checks.push(mapCheckResult(checkVitalFilesTracked(projectRoot)));
|
|
63785
63425
|
checks.push(mapCheckResult(checkCoreFilesNotIgnored(projectRoot)));
|
|
63786
63426
|
checks.push(mapCheckResult(checkLegacyAgentOutputs(projectRoot)));
|
|
63787
|
-
const cleoGitHeadExists = existsSync89(
|
|
63427
|
+
const cleoGitHeadExists = existsSync89(join92(cleoDir, ".git", "HEAD"));
|
|
63788
63428
|
checks.push({
|
|
63789
63429
|
check: "cleo_git_repo",
|
|
63790
63430
|
status: cleoGitHeadExists ? "ok" : "warning",
|
|
@@ -63800,15 +63440,15 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63800
63440
|
checks.push(mapCheckResult(checkProjectContext(projectRoot)));
|
|
63801
63441
|
checks.push(mapCheckResult(checkInjection2(projectRoot)));
|
|
63802
63442
|
checks.push(checkContributorChannel(projectRoot));
|
|
63803
|
-
const agentDefPath =
|
|
63443
|
+
const agentDefPath = join92(getAgentsHome(), "agents", "cleo-subagent");
|
|
63804
63444
|
checks.push({
|
|
63805
63445
|
check: "agent_definition",
|
|
63806
63446
|
status: existsSync89(agentDefPath) ? "ok" : "warning",
|
|
63807
63447
|
message: existsSync89(agentDefPath) ? "cleo-subagent agent definition installed" : "cleo-subagent not found \u2014 run: cleo init",
|
|
63808
63448
|
...existsSync89(agentDefPath) ? {} : { fix: "cleo init" }
|
|
63809
63449
|
});
|
|
63810
|
-
const gitDir =
|
|
63811
|
-
const gitHubTemplatesDir =
|
|
63450
|
+
const gitDir = join92(projectRoot, ".git");
|
|
63451
|
+
const gitHubTemplatesDir = join92(projectRoot, ".github", "ISSUE_TEMPLATE");
|
|
63812
63452
|
if (existsSync89(gitDir)) {
|
|
63813
63453
|
checks.push({
|
|
63814
63454
|
check: "github_templates",
|
|
@@ -63842,14 +63482,14 @@ async function coreDoctorReport(projectRoot) {
|
|
|
63842
63482
|
|
|
63843
63483
|
// packages/core/src/system/inject-generate.ts
|
|
63844
63484
|
init_data_accessor();
|
|
63845
|
-
import { existsSync as existsSync90, readFileSync as
|
|
63846
|
-
import { join as
|
|
63485
|
+
import { existsSync as existsSync90, readFileSync as readFileSync65 } from "node:fs";
|
|
63486
|
+
import { join as join93 } from "node:path";
|
|
63847
63487
|
async function generateInjection(projectRoot, accessor) {
|
|
63848
63488
|
let version2 = "unknown";
|
|
63849
63489
|
try {
|
|
63850
|
-
const pkgPath =
|
|
63490
|
+
const pkgPath = join93(projectRoot, "package.json");
|
|
63851
63491
|
if (existsSync90(pkgPath)) {
|
|
63852
|
-
const pkg = JSON.parse(
|
|
63492
|
+
const pkg = JSON.parse(readFileSync65(pkgPath, "utf-8"));
|
|
63853
63493
|
version2 = pkg.version || "unknown";
|
|
63854
63494
|
}
|
|
63855
63495
|
} catch {
|
|
@@ -63896,7 +63536,7 @@ function buildMviMarkdown(state) {
|
|
|
63896
63536
|
const focusLine = state.focusTask ? `| Focus | \`${state.focusTask}\` |` : "| Focus | none |";
|
|
63897
63537
|
return `## CLEO Task Management (MVI)
|
|
63898
63538
|
|
|
63899
|
-
> **Bootstrap**:
|
|
63539
|
+
> **Bootstrap**: Run \`cleo session status\` then \`cleo dash\` at session start.
|
|
63900
63540
|
|
|
63901
63541
|
| Key | Value |
|
|
63902
63542
|
|-----|-------|
|
|
@@ -63909,40 +63549,40 @@ ${focusLine}
|
|
|
63909
63549
|
|
|
63910
63550
|
| Command | Description |
|
|
63911
63551
|
|---------|-------------|
|
|
63912
|
-
| \`
|
|
63913
|
-
| \`
|
|
63914
|
-
| \`
|
|
63915
|
-
| \`
|
|
63916
|
-
| \`
|
|
63917
|
-
| \`
|
|
63918
|
-
| \`
|
|
63919
|
-
| \`
|
|
63920
|
-
| \`
|
|
63921
|
-
| \`
|
|
63922
|
-
| \`
|
|
63923
|
-
| \`
|
|
63552
|
+
| \`cleo find "query"\` | Fuzzy search tasks (minimal context) |
|
|
63553
|
+
| \`cleo show T1234\` | Full task details |
|
|
63554
|
+
| \`cleo add "Title" -d "..."\` | Create task |
|
|
63555
|
+
| \`cleo done <id>\` | Complete task |
|
|
63556
|
+
| \`cleo start <id>\` | Start working on task |
|
|
63557
|
+
| \`cleo current\` | Show current task |
|
|
63558
|
+
| \`cleo next\` | Suggest next task |
|
|
63559
|
+
| \`cleo session list\` | List sessions |
|
|
63560
|
+
| \`cleo session start --scope epic:T### --auto-start --name "..."\` | Start session |
|
|
63561
|
+
| \`cleo session end --note "..."\` | End session |
|
|
63562
|
+
| \`cleo dash\` | Project overview |
|
|
63563
|
+
| \`cleo context\` | Context window usage |
|
|
63924
63564
|
|
|
63925
63565
|
### Session Protocol
|
|
63926
63566
|
|
|
63927
|
-
1. **START**: \`
|
|
63928
|
-
2. **WORK**: \`
|
|
63929
|
-
3. **END**: \`
|
|
63567
|
+
1. **START**: \`cleo session list\` then \`cleo session resume <id>\` or \`cleo session start --scope epic:T### --auto-start --name "Work"\`
|
|
63568
|
+
2. **WORK**: \`cleo current\` / \`cleo next\` / \`cleo complete <id>\` / \`cleo start <id>\`
|
|
63569
|
+
3. **END**: \`cleo complete <id>\` then \`cleo session end --note "Progress"\`
|
|
63930
63570
|
|
|
63931
63571
|
### Error Handling
|
|
63932
63572
|
|
|
63933
63573
|
| Exit | Code | Fix |
|
|
63934
63574
|
|:----:|------|-----|
|
|
63935
|
-
| 4 | \`E_NOT_FOUND\` | Use \`
|
|
63575
|
+
| 4 | \`E_NOT_FOUND\` | Use \`cleo find\` or \`cleo list\` to verify |
|
|
63936
63576
|
| 6 | \`E_VALIDATION\` | Check field lengths, escape \`$\` as \`\\$\` |
|
|
63937
|
-
| 10 | \`E_PARENT_NOT_FOUND\` | Verify with \`
|
|
63577
|
+
| 10 | \`E_PARENT_NOT_FOUND\` | Verify with \`cleo exists <parent-id>\` |
|
|
63938
63578
|
| 11 | \`E_DEPTH_EXCEEDED\` | Exceeds configured hierarchy.maxDepth (default: 3) |
|
|
63939
63579
|
| 12 | \`E_SIBLING_LIMIT\` | Exceeds configured maxSiblings (default: unlimited) |
|
|
63940
63580
|
|
|
63941
|
-
**After EVERY command**: Check exit code (\`0\` = success), check \`"success"\` in JSON output
|
|
63581
|
+
**After EVERY command**: Check exit code (\`0\` = success), check \`"success"\` in JSON output.
|
|
63942
63582
|
|
|
63943
63583
|
### Detailed Guidance
|
|
63944
63584
|
|
|
63945
|
-
For full protocol details, load the **ct-cleo** skill
|
|
63585
|
+
For full protocol details, load the **ct-cleo** skill.
|
|
63946
63586
|
`;
|
|
63947
63587
|
}
|
|
63948
63588
|
|
|
@@ -63977,10 +63617,10 @@ async function getLabels(cwd, accessor) {
|
|
|
63977
63617
|
}
|
|
63978
63618
|
|
|
63979
63619
|
// packages/core/src/system/metrics.ts
|
|
63980
|
-
import { existsSync as existsSync91, readFileSync as
|
|
63981
|
-
import { join as
|
|
63620
|
+
import { existsSync as existsSync91, readFileSync as readFileSync66 } from "node:fs";
|
|
63621
|
+
import { join as join94 } from "node:path";
|
|
63982
63622
|
async function getSystemMetrics(projectRoot, opts, accessor) {
|
|
63983
|
-
const cleoDir =
|
|
63623
|
+
const cleoDir = join94(projectRoot, ".cleo");
|
|
63984
63624
|
let complianceEntries = readComplianceJsonl(projectRoot);
|
|
63985
63625
|
if (opts?.since) {
|
|
63986
63626
|
complianceEntries = complianceEntries.filter((e) => e.timestamp >= opts.since);
|
|
@@ -64007,9 +63647,9 @@ async function getSystemMetrics(projectRoot, opts, accessor) {
|
|
|
64007
63647
|
sessionsActive = sessions2.filter((s) => s.status === "active").length;
|
|
64008
63648
|
sessionsCompleted = sessions2.filter((s) => s.status === "ended").length;
|
|
64009
63649
|
} else {
|
|
64010
|
-
const sessionsPath =
|
|
63650
|
+
const sessionsPath = join94(cleoDir, "sessions.json");
|
|
64011
63651
|
if (existsSync91(sessionsPath)) {
|
|
64012
|
-
const sessionsData = JSON.parse(
|
|
63652
|
+
const sessionsData = JSON.parse(readFileSync66(sessionsPath, "utf-8"));
|
|
64013
63653
|
const sessions2 = sessionsData.sessions ?? [];
|
|
64014
63654
|
sessionsTotal = sessions2.length;
|
|
64015
63655
|
sessionsActive = sessions2.filter((s) => s.status === "active").length;
|
|
@@ -64032,9 +63672,9 @@ init_src();
|
|
|
64032
63672
|
init_errors3();
|
|
64033
63673
|
init_data_accessor();
|
|
64034
63674
|
import { existsSync as existsSync92 } from "node:fs";
|
|
64035
|
-
import { join as
|
|
63675
|
+
import { join as join95 } from "node:path";
|
|
64036
63676
|
async function getMigrationStatus2(projectRoot, opts) {
|
|
64037
|
-
const taskPath =
|
|
63677
|
+
const taskPath = join95(projectRoot, ".cleo", "tasks.db");
|
|
64038
63678
|
let currentVersion = "unknown";
|
|
64039
63679
|
if (existsSync92(taskPath)) {
|
|
64040
63680
|
try {
|
|
@@ -64066,7 +63706,7 @@ init_paths();
|
|
|
64066
63706
|
import { execFile as execFile7 } from "node:child_process";
|
|
64067
63707
|
import { existsSync as existsSync93 } from "node:fs";
|
|
64068
63708
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
64069
|
-
import { basename as basename15, join as
|
|
63709
|
+
import { basename as basename15, join as join96 } from "node:path";
|
|
64070
63710
|
import { promisify as promisify7 } from "node:util";
|
|
64071
63711
|
function normalizeChannel(value) {
|
|
64072
63712
|
if (!value) return null;
|
|
@@ -64091,15 +63731,15 @@ function detectFromDataRoot(dataRoot) {
|
|
|
64091
63731
|
function getExpectedNaming(channel) {
|
|
64092
63732
|
switch (channel) {
|
|
64093
63733
|
case "dev":
|
|
64094
|
-
return { cli: "cleo-dev", mcp: "
|
|
63734
|
+
return { cli: "cleo-dev", mcp: "cli", server: "cleo-dev" };
|
|
64095
63735
|
case "beta":
|
|
64096
|
-
return { cli: "cleo-beta", mcp: "
|
|
63736
|
+
return { cli: "cleo-beta", mcp: "cli", server: "cleo-beta" };
|
|
64097
63737
|
default:
|
|
64098
|
-
return { cli: "cleo", mcp: "
|
|
63738
|
+
return { cli: "cleo", mcp: "cli", server: "cleo" };
|
|
64099
63739
|
}
|
|
64100
63740
|
}
|
|
64101
63741
|
async function parseVersionFile(dataRoot) {
|
|
64102
|
-
const versionPath =
|
|
63742
|
+
const versionPath = join96(dataRoot, "VERSION");
|
|
64103
63743
|
if (!existsSync93(versionPath)) return null;
|
|
64104
63744
|
let content;
|
|
64105
63745
|
try {
|
|
@@ -64129,9 +63769,9 @@ async function parseVersionFile(dataRoot) {
|
|
|
64129
63769
|
async function getPackageInfo(sourceDir) {
|
|
64130
63770
|
const candidates = [];
|
|
64131
63771
|
if (sourceDir && sourceDir !== "unknown" && sourceDir !== "npm") {
|
|
64132
|
-
candidates.push(
|
|
63772
|
+
candidates.push(join96(sourceDir, "package.json"));
|
|
64133
63773
|
}
|
|
64134
|
-
candidates.push(
|
|
63774
|
+
candidates.push(join96(process.cwd(), "package.json"));
|
|
64135
63775
|
for (const candidate of candidates) {
|
|
64136
63776
|
try {
|
|
64137
63777
|
const raw = await readFile15(candidate, "utf-8");
|
|
@@ -64210,17 +63850,17 @@ async function getRuntimeDiagnostics(options) {
|
|
|
64210
63850
|
init_src();
|
|
64211
63851
|
init_errors3();
|
|
64212
63852
|
init_data_accessor();
|
|
64213
|
-
import { existsSync as existsSync94, readFileSync as
|
|
64214
|
-
import { join as
|
|
63853
|
+
import { existsSync as existsSync94, readFileSync as readFileSync67, writeFileSync as writeFileSync15 } from "node:fs";
|
|
63854
|
+
import { join as join97 } from "node:path";
|
|
64215
63855
|
function safestop(projectRoot, opts) {
|
|
64216
63856
|
const dryRun = opts?.dryRun ?? false;
|
|
64217
63857
|
const reason = opts?.reason ?? "Manual safestop";
|
|
64218
63858
|
let sessionEnded = false;
|
|
64219
63859
|
if (!dryRun && !opts?.noSessionEnd) {
|
|
64220
|
-
const sessPath =
|
|
63860
|
+
const sessPath = join97(projectRoot, ".cleo", "sessions.json");
|
|
64221
63861
|
if (existsSync94(sessPath)) {
|
|
64222
63862
|
try {
|
|
64223
|
-
const data = JSON.parse(
|
|
63863
|
+
const data = JSON.parse(readFileSync67(sessPath, "utf-8"));
|
|
64224
63864
|
const sessions2 = data.sessions ?? [];
|
|
64225
63865
|
let changed = false;
|
|
64226
63866
|
for (const s of sessions2) {
|
|
@@ -64245,7 +63885,7 @@ async function uncancelTask(projectRoot, params) {
|
|
|
64245
63885
|
if (!params.taskId) {
|
|
64246
63886
|
throw new CleoError(2 /* INVALID_INPUT */, "taskId is required");
|
|
64247
63887
|
}
|
|
64248
|
-
const taskDbPath =
|
|
63888
|
+
const taskDbPath = join97(projectRoot, ".cleo", "tasks.db");
|
|
64249
63889
|
if (!existsSync94(taskDbPath)) {
|
|
64250
63890
|
throw new CleoError(8 /* CONFIG_ERROR */, "No tasks.db found");
|
|
64251
63891
|
}
|
|
@@ -64757,8 +64397,8 @@ __export(templates_exports, {
|
|
|
64757
64397
|
});
|
|
64758
64398
|
|
|
64759
64399
|
// packages/core/src/templates/parser.ts
|
|
64760
|
-
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as
|
|
64761
|
-
import { join as
|
|
64400
|
+
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as readFileSync68 } from "fs";
|
|
64401
|
+
import { join as join98 } from "path";
|
|
64762
64402
|
import { parse as parseYaml } from "yaml";
|
|
64763
64403
|
var SUFFIX_PATTERNS = ["_report", "_request", "_question"];
|
|
64764
64404
|
function deriveSubcommand(filename) {
|
|
@@ -64773,8 +64413,8 @@ function deriveSubcommand(filename) {
|
|
|
64773
64413
|
return firstWord.toLowerCase();
|
|
64774
64414
|
}
|
|
64775
64415
|
function parseTemplateFile2(templateDir, filename) {
|
|
64776
|
-
const filePath =
|
|
64777
|
-
const raw =
|
|
64416
|
+
const filePath = join98(templateDir, filename);
|
|
64417
|
+
const raw = readFileSync68(filePath, "utf-8");
|
|
64778
64418
|
const parsed = parseYaml(raw);
|
|
64779
64419
|
const name2 = typeof parsed.name === "string" ? parsed.name : filename;
|
|
64780
64420
|
const titlePrefix = typeof parsed.title === "string" ? parsed.title : "";
|
|
@@ -64823,7 +64463,7 @@ function parseTemplateFile2(templateDir, filename) {
|
|
|
64823
64463
|
};
|
|
64824
64464
|
}
|
|
64825
64465
|
function parseIssueTemplates2(projectRoot) {
|
|
64826
|
-
const templateDir =
|
|
64466
|
+
const templateDir = join98(projectRoot, ".github", "ISSUE_TEMPLATE");
|
|
64827
64467
|
if (!existsSync95(templateDir)) {
|
|
64828
64468
|
return {
|
|
64829
64469
|
success: false,
|
|
@@ -64971,9 +64611,9 @@ __export(ui_exports, {
|
|
|
64971
64611
|
});
|
|
64972
64612
|
|
|
64973
64613
|
// packages/core/src/ui/aliases.ts
|
|
64974
|
-
import { existsSync as existsSync96, readFileSync as
|
|
64614
|
+
import { existsSync as existsSync96, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
|
|
64975
64615
|
import { homedir as homedir5, platform as platform3 } from "node:os";
|
|
64976
|
-
import { join as
|
|
64616
|
+
import { join as join99 } from "node:path";
|
|
64977
64617
|
var MARKER_START = "# CLEO-CLAUDE-ALIASES:START";
|
|
64978
64618
|
var MARKER_END = "# CLEO-CLAUDE-ALIASES:END";
|
|
64979
64619
|
var ALIASES_VERSION = "1.0.0";
|
|
@@ -64995,16 +64635,16 @@ function getRcFilePath(shell) {
|
|
|
64995
64635
|
const sh = shell ?? getCurrentShell();
|
|
64996
64636
|
switch (sh) {
|
|
64997
64637
|
case "bash":
|
|
64998
|
-
return
|
|
64638
|
+
return join99(home, ".bashrc");
|
|
64999
64639
|
case "zsh":
|
|
65000
|
-
return
|
|
64640
|
+
return join99(home, ".zshrc");
|
|
65001
64641
|
case "powershell":
|
|
65002
|
-
return
|
|
64642
|
+
return join99(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
|
|
65003
64643
|
case "cmd":
|
|
65004
64644
|
return "";
|
|
65005
64645
|
// CMD doesn't have a standard RC
|
|
65006
64646
|
default:
|
|
65007
|
-
return
|
|
64647
|
+
return join99(home, ".bashrc");
|
|
65008
64648
|
}
|
|
65009
64649
|
}
|
|
65010
64650
|
function detectAvailableShells() {
|
|
@@ -65043,12 +64683,12 @@ function generatePowershellAliases(cleoPath) {
|
|
|
65043
64683
|
}
|
|
65044
64684
|
function hasAliasBlock(filePath) {
|
|
65045
64685
|
if (!existsSync96(filePath)) return false;
|
|
65046
|
-
const content =
|
|
64686
|
+
const content = readFileSync69(filePath, "utf-8");
|
|
65047
64687
|
return content.includes(MARKER_START) && content.includes(MARKER_END);
|
|
65048
64688
|
}
|
|
65049
64689
|
function getInstalledVersion(filePath) {
|
|
65050
64690
|
if (!existsSync96(filePath)) return null;
|
|
65051
|
-
const content =
|
|
64691
|
+
const content = readFileSync69(filePath, "utf-8");
|
|
65052
64692
|
const match = content.match(/CLEO CLI aliases \(v([^)]+)\)/);
|
|
65053
64693
|
return match?.[1] ?? null;
|
|
65054
64694
|
}
|
|
@@ -65058,7 +64698,7 @@ function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
|
65058
64698
|
writeFileSync16(filePath, content + "\n", "utf-8");
|
|
65059
64699
|
return { action: "created", version: ALIASES_VERSION };
|
|
65060
64700
|
}
|
|
65061
|
-
const existing =
|
|
64701
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
65062
64702
|
if (hasAliasBlock(filePath)) {
|
|
65063
64703
|
const startIdx = existing.indexOf(MARKER_START);
|
|
65064
64704
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
@@ -65071,7 +64711,7 @@ function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
|
65071
64711
|
}
|
|
65072
64712
|
function removeAliases(filePath) {
|
|
65073
64713
|
if (!existsSync96(filePath) || !hasAliasBlock(filePath)) return false;
|
|
65074
|
-
const existing =
|
|
64714
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
65075
64715
|
const startIdx = existing.indexOf(MARKER_START);
|
|
65076
64716
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
65077
64717
|
const before = existing.slice(0, startIdx).replace(/\n+$/, "\n");
|
|
@@ -65093,7 +64733,7 @@ function checkAliasesStatus(shell) {
|
|
|
65093
64733
|
|
|
65094
64734
|
// packages/core/src/ui/changelog.ts
|
|
65095
64735
|
init_data_accessor();
|
|
65096
|
-
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as
|
|
64736
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as readFileSync70, writeFileSync as writeFileSync17 } from "node:fs";
|
|
65097
64737
|
var LABEL_CATEGORIES = {
|
|
65098
64738
|
feature: "Features",
|
|
65099
64739
|
feat: "Features",
|
|
@@ -65203,7 +64843,7 @@ function appendToChangelog(filePath, newContent) {
|
|
|
65203
64843
|
${newContent}`, "utf-8");
|
|
65204
64844
|
return;
|
|
65205
64845
|
}
|
|
65206
|
-
const existing =
|
|
64846
|
+
const existing = readFileSync70(filePath, "utf-8");
|
|
65207
64847
|
const headerMatch = existing.match(/^# .+\n/m);
|
|
65208
64848
|
if (headerMatch) {
|
|
65209
64849
|
const insertPos = (headerMatch.index ?? 0) + headerMatch[0].length;
|
|
@@ -65243,13 +64883,13 @@ ${markdown}`);
|
|
|
65243
64883
|
}
|
|
65244
64884
|
|
|
65245
64885
|
// packages/core/src/ui/command-registry.ts
|
|
65246
|
-
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as
|
|
65247
|
-
import { basename as basename16, join as
|
|
64886
|
+
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as readFileSync71 } from "node:fs";
|
|
64887
|
+
import { basename as basename16, join as join100 } from "node:path";
|
|
65248
64888
|
var CLEO_HEADER_START = "###CLEO";
|
|
65249
64889
|
var CLEO_HEADER_END = "###END";
|
|
65250
64890
|
function parseCommandHeader(scriptPath) {
|
|
65251
64891
|
if (!existsSync98(scriptPath)) return null;
|
|
65252
|
-
const content =
|
|
64892
|
+
const content = readFileSync71(scriptPath, "utf-8");
|
|
65253
64893
|
const lines = content.split("\n");
|
|
65254
64894
|
let inHeader = false;
|
|
65255
64895
|
const headerLines = [];
|
|
@@ -65330,7 +64970,7 @@ function scanAllCommands(scriptsDir) {
|
|
|
65330
64970
|
if (!existsSync98(scriptsDir)) return registry2;
|
|
65331
64971
|
for (const file2 of readdirSync32(scriptsDir)) {
|
|
65332
64972
|
if (!file2.endsWith(".sh") && !file2.endsWith(".ts")) continue;
|
|
65333
|
-
const meta = parseCommandHeader(
|
|
64973
|
+
const meta = parseCommandHeader(join100(scriptsDir, file2));
|
|
65334
64974
|
if (meta) {
|
|
65335
64975
|
registry2.set(meta.command, meta);
|
|
65336
64976
|
}
|
|
@@ -66270,8 +65910,8 @@ function calculateOrchestrationOverhead(orchestratorTokens, totalSubagentTokens,
|
|
|
66270
65910
|
}
|
|
66271
65911
|
|
|
66272
65912
|
// packages/core/src/validation/docs-sync.ts
|
|
66273
|
-
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as
|
|
66274
|
-
import { join as
|
|
65913
|
+
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as readFileSync72 } from "node:fs";
|
|
65914
|
+
import { join as join101 } from "node:path";
|
|
66275
65915
|
function getScriptCommands(scriptsDir) {
|
|
66276
65916
|
if (!existsSync99(scriptsDir)) return [];
|
|
66277
65917
|
try {
|
|
@@ -66283,7 +65923,7 @@ function getScriptCommands(scriptsDir) {
|
|
|
66283
65923
|
function getIndexScripts(indexPath) {
|
|
66284
65924
|
if (!existsSync99(indexPath)) return [];
|
|
66285
65925
|
try {
|
|
66286
|
-
const content =
|
|
65926
|
+
const content = readFileSync72(indexPath, "utf-8");
|
|
66287
65927
|
const index2 = JSON.parse(content);
|
|
66288
65928
|
return index2.commands.map((cmd) => cmd.script ?? "").filter((s) => s).map((s) => s.replace(/\.sh$/, "")).sort();
|
|
66289
65929
|
} catch {
|
|
@@ -66293,7 +65933,7 @@ function getIndexScripts(indexPath) {
|
|
|
66293
65933
|
function getIndexCommands(indexPath) {
|
|
66294
65934
|
if (!existsSync99(indexPath)) return [];
|
|
66295
65935
|
try {
|
|
66296
|
-
const content =
|
|
65936
|
+
const content = readFileSync72(indexPath, "utf-8");
|
|
66297
65937
|
const index2 = JSON.parse(content);
|
|
66298
65938
|
return index2.commands.map((cmd) => cmd.name).sort();
|
|
66299
65939
|
} catch {
|
|
@@ -66330,8 +65970,8 @@ function checkWrapperSync(wrapperPath, indexPath) {
|
|
|
66330
65970
|
if (!existsSync99(wrapperPath) || !existsSync99(indexPath)) return [];
|
|
66331
65971
|
const issues = [];
|
|
66332
65972
|
try {
|
|
66333
|
-
const wrapperContent =
|
|
66334
|
-
const indexContent =
|
|
65973
|
+
const wrapperContent = readFileSync72(wrapperPath, "utf-8");
|
|
65974
|
+
const indexContent = readFileSync72(indexPath, "utf-8");
|
|
66335
65975
|
const index2 = JSON.parse(indexContent);
|
|
66336
65976
|
const match = wrapperContent.match(/_get_all_commands\(\)\s*\{[^}]*echo\s+"([^"]+)"/);
|
|
66337
65977
|
const wrapperCmds = new Set(match ? match[1].split(/\s+/).filter(Boolean) : []);
|
|
@@ -66364,16 +66004,16 @@ var CRITICAL_COMMANDS = [
|
|
|
66364
66004
|
];
|
|
66365
66005
|
function detectDrift(mode = "full", projectRoot = ".") {
|
|
66366
66006
|
const issues = [];
|
|
66367
|
-
const scriptsDir =
|
|
66368
|
-
const indexPath =
|
|
66007
|
+
const scriptsDir = join101(projectRoot, "scripts");
|
|
66008
|
+
const indexPath = join101(projectRoot, "docs/commands/COMMANDS-INDEX.json");
|
|
66369
66009
|
issues.push(...checkCommandsSync(scriptsDir, indexPath));
|
|
66370
|
-
const wrapperPath =
|
|
66010
|
+
const wrapperPath = join101(projectRoot, "installer/lib/link.sh");
|
|
66371
66011
|
issues.push(...checkWrapperSync(wrapperPath, indexPath));
|
|
66372
66012
|
if (mode === "full") {
|
|
66373
|
-
const readmePath =
|
|
66013
|
+
const readmePath = join101(projectRoot, "README.md");
|
|
66374
66014
|
if (existsSync99(readmePath)) {
|
|
66375
66015
|
try {
|
|
66376
|
-
const readme =
|
|
66016
|
+
const readme = readFileSync72(readmePath, "utf-8");
|
|
66377
66017
|
const readmeCmds = new Set(
|
|
66378
66018
|
(readme.match(/cleo [a-z-]+/g) ?? []).map((m) => m.replace("cleo ", ""))
|
|
66379
66019
|
);
|
|
@@ -66407,14 +66047,14 @@ function shouldRunDriftDetection(enabled = true, autoCheck = false, command, cri
|
|
|
66407
66047
|
// packages/core/src/validation/doctor/project-cache.ts
|
|
66408
66048
|
init_paths();
|
|
66409
66049
|
import { createHash as createHash10 } from "node:crypto";
|
|
66410
|
-
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as
|
|
66411
|
-
import { dirname as dirname18, join as
|
|
66050
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as readFileSync73, unlinkSync as unlinkSync7, writeFileSync as writeFileSync18 } from "node:fs";
|
|
66051
|
+
import { dirname as dirname18, join as join102 } from "node:path";
|
|
66412
66052
|
var CACHE_VERSION = "1.0.0";
|
|
66413
66053
|
var CACHE_TTL_SECONDS = 300;
|
|
66414
66054
|
var CACHE_FILE2 = "doctor-project-cache.json";
|
|
66415
66055
|
function getCacheFilePath(cleoHome) {
|
|
66416
66056
|
const home = cleoHome ?? getCleoHome();
|
|
66417
|
-
return
|
|
66057
|
+
return join102(home, CACHE_FILE2);
|
|
66418
66058
|
}
|
|
66419
66059
|
function initCacheFile(cacheFile) {
|
|
66420
66060
|
const cache = {
|
|
@@ -66432,7 +66072,7 @@ function initCacheFile(cacheFile) {
|
|
|
66432
66072
|
function loadCache(cacheFile) {
|
|
66433
66073
|
if (!existsSync100(cacheFile)) return null;
|
|
66434
66074
|
try {
|
|
66435
|
-
const content =
|
|
66075
|
+
const content = readFileSync73(cacheFile, "utf-8");
|
|
66436
66076
|
return JSON.parse(content);
|
|
66437
66077
|
} catch {
|
|
66438
66078
|
return null;
|
|
@@ -66441,7 +66081,7 @@ function loadCache(cacheFile) {
|
|
|
66441
66081
|
function getFileHash(filePath) {
|
|
66442
66082
|
if (!existsSync100(filePath)) return "";
|
|
66443
66083
|
try {
|
|
66444
|
-
const content =
|
|
66084
|
+
const content = readFileSync73(filePath);
|
|
66445
66085
|
return createHash10("sha256").update(content).digest("hex");
|
|
66446
66086
|
} catch {
|
|
66447
66087
|
return "";
|
|
@@ -66458,8 +66098,8 @@ function getCachedValidation(projectHash, projectPath, cacheFile) {
|
|
|
66458
66098
|
const now = Date.now();
|
|
66459
66099
|
const age = (now - lastValidated) / 1e3;
|
|
66460
66100
|
if (age > (entry.ttl || CACHE_TTL_SECONDS)) return null;
|
|
66461
|
-
const currentTasksDbHash = getFileHash(
|
|
66462
|
-
const currentConfigHash = getFileHash(
|
|
66101
|
+
const currentTasksDbHash = getFileHash(join102(projectPath, ".cleo", "tasks.db"));
|
|
66102
|
+
const currentConfigHash = getFileHash(join102(projectPath, ".cleo", "config.json"));
|
|
66463
66103
|
if (currentTasksDbHash !== (entry.fileHashes["tasks.db"] ?? "")) return null;
|
|
66464
66104
|
if (currentConfigHash !== (entry.fileHashes["config.json"] ?? "")) return null;
|
|
66465
66105
|
return entry;
|
|
@@ -66470,8 +66110,8 @@ function cacheValidationResult(projectHash, projectPath, validationStatus, issue
|
|
|
66470
66110
|
if (!cache) {
|
|
66471
66111
|
cache = initCacheFile(cachePath);
|
|
66472
66112
|
}
|
|
66473
|
-
const tasksDbHash = getFileHash(
|
|
66474
|
-
const configHash = getFileHash(
|
|
66113
|
+
const tasksDbHash = getFileHash(join102(projectPath, ".cleo", "tasks.db"));
|
|
66114
|
+
const configHash = getFileHash(join102(projectPath, ".cleo", "config.json"));
|
|
66475
66115
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
66476
66116
|
cache.projects[projectHash] = {
|
|
66477
66117
|
path: projectPath,
|
|
@@ -67653,7 +67293,7 @@ async function validateAndLog(taskId, manifestPath = DEFAULT_MANIFEST_PATH, comp
|
|
|
67653
67293
|
|
|
67654
67294
|
// packages/core/src/validation/protocol-common.ts
|
|
67655
67295
|
init_src();
|
|
67656
|
-
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as
|
|
67296
|
+
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as readFileSync74 } from "node:fs";
|
|
67657
67297
|
function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
67658
67298
|
if (!existsSync102(expectedDir)) return false;
|
|
67659
67299
|
const filePattern = pattern ?? `${taskId}`;
|
|
@@ -67667,7 +67307,7 @@ function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
|
67667
67307
|
function checkDocumentationSections(filePath, sections) {
|
|
67668
67308
|
if (!existsSync102(filePath)) return false;
|
|
67669
67309
|
try {
|
|
67670
|
-
const content =
|
|
67310
|
+
const content = readFileSync74(filePath, "utf-8");
|
|
67671
67311
|
return sections.every((section) => {
|
|
67672
67312
|
const regex = new RegExp(`^#+ .*${escapeRegex3(section)}`, "m");
|
|
67673
67313
|
return regex.test(content);
|
|
@@ -67762,7 +67402,7 @@ function checkLinkedTasksPresent(entry, requiredIds) {
|
|
|
67762
67402
|
function checkProvenanceTags(filePath, taskId) {
|
|
67763
67403
|
if (!existsSync102(filePath)) return false;
|
|
67764
67404
|
try {
|
|
67765
|
-
const content =
|
|
67405
|
+
const content = readFileSync74(filePath, "utf-8");
|
|
67766
67406
|
if (taskId) {
|
|
67767
67407
|
return content.includes(`@task ${taskId}`);
|
|
67768
67408
|
}
|
|
@@ -68424,13 +68064,13 @@ import { randomUUID as randomUUID7 } from "node:crypto";
|
|
|
68424
68064
|
|
|
68425
68065
|
// packages/core/src/sessions/context-alert.ts
|
|
68426
68066
|
init_paths();
|
|
68427
|
-
import { existsSync as existsSync104, readFileSync as
|
|
68428
|
-
import { join as
|
|
68067
|
+
import { existsSync as existsSync104, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
|
|
68068
|
+
import { join as join104 } from "node:path";
|
|
68429
68069
|
function getCurrentSessionId(cwd) {
|
|
68430
68070
|
if (process.env.CLEO_SESSION) return process.env.CLEO_SESSION;
|
|
68431
|
-
const sessionFile =
|
|
68071
|
+
const sessionFile = join104(getCleoDir(cwd), ".current-session");
|
|
68432
68072
|
if (existsSync104(sessionFile)) {
|
|
68433
|
-
return
|
|
68073
|
+
return readFileSync76(sessionFile, "utf-8").trim() || null;
|
|
68434
68074
|
}
|
|
68435
68075
|
return null;
|
|
68436
68076
|
}
|
|
@@ -68522,13 +68162,13 @@ init_paths();
|
|
|
68522
68162
|
|
|
68523
68163
|
// packages/core/src/project-info.ts
|
|
68524
68164
|
init_paths();
|
|
68525
|
-
import { existsSync as existsSync105, readFileSync as
|
|
68165
|
+
import { existsSync as existsSync105, readFileSync as readFileSync77, writeFileSync as writeFileSync20 } from "node:fs";
|
|
68526
68166
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
68527
|
-
import { join as
|
|
68167
|
+
import { join as join105 } from "node:path";
|
|
68528
68168
|
async function getProjectInfo(cwd) {
|
|
68529
68169
|
const projectRoot = cwd ?? process.cwd();
|
|
68530
68170
|
const cleoDir = getCleoDirAbsolute(projectRoot);
|
|
68531
|
-
const infoPath =
|
|
68171
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68532
68172
|
const raw = await readFile18(infoPath, "utf-8");
|
|
68533
68173
|
const data = JSON.parse(raw);
|
|
68534
68174
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
@@ -68546,10 +68186,10 @@ async function getProjectInfo(cwd) {
|
|
|
68546
68186
|
function getProjectInfoSync(cwd) {
|
|
68547
68187
|
const projectRoot = cwd ?? process.cwd();
|
|
68548
68188
|
const cleoDir = getCleoDirAbsolute(projectRoot);
|
|
68549
|
-
const infoPath =
|
|
68189
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68550
68190
|
if (!existsSync105(infoPath)) return null;
|
|
68551
68191
|
try {
|
|
68552
|
-
const raw =
|
|
68192
|
+
const raw = readFileSync77(infoPath, "utf-8");
|
|
68553
68193
|
const data = JSON.parse(raw);
|
|
68554
68194
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
68555
68195
|
return null;
|
|
@@ -68568,9 +68208,9 @@ function getProjectInfoSync(cwd) {
|
|
|
68568
68208
|
}
|
|
68569
68209
|
function updateProjectName(cwd, name2) {
|
|
68570
68210
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
68571
|
-
const infoPath =
|
|
68211
|
+
const infoPath = join105(cleoDir, "project-info.json");
|
|
68572
68212
|
if (!existsSync105(infoPath)) return;
|
|
68573
|
-
const data = JSON.parse(
|
|
68213
|
+
const data = JSON.parse(readFileSync77(infoPath, "utf-8"));
|
|
68574
68214
|
data.projectName = name2;
|
|
68575
68215
|
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
68576
68216
|
writeFileSync20(infoPath, `${JSON.stringify(data, null, 2)}
|
|
@@ -68584,10 +68224,10 @@ init_adapters();
|
|
|
68584
68224
|
// packages/core/src/bootstrap.ts
|
|
68585
68225
|
init_paths();
|
|
68586
68226
|
init_scaffold();
|
|
68587
|
-
import { existsSync as existsSync106, readFileSync as
|
|
68227
|
+
import { existsSync as existsSync106, readFileSync as readFileSync78 } from "node:fs";
|
|
68588
68228
|
import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
|
|
68589
68229
|
import { homedir as homedir6 } from "node:os";
|
|
68590
|
-
import { join as
|
|
68230
|
+
import { join as join106 } from "node:path";
|
|
68591
68231
|
async function bootstrapGlobalCleo(options) {
|
|
68592
68232
|
const ctx = {
|
|
68593
68233
|
created: [],
|
|
@@ -68600,7 +68240,6 @@ async function bootstrapGlobalCleo(options) {
|
|
|
68600
68240
|
}
|
|
68601
68241
|
await ensureGlobalTemplatesBootstrap(ctx, options?.packageRoot);
|
|
68602
68242
|
await injectAgentsHub(ctx);
|
|
68603
|
-
await installMcpToProviders(ctx);
|
|
68604
68243
|
await installSkillsGlobally(ctx);
|
|
68605
68244
|
await installAgentDefinitionGlobally(ctx);
|
|
68606
68245
|
await installProviderAdapters(ctx, options?.packageRoot);
|
|
@@ -68622,9 +68261,9 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
68622
68261
|
let templateContent = null;
|
|
68623
68262
|
try {
|
|
68624
68263
|
const pkgRoot = packageRootOverride ?? getPackageRoot();
|
|
68625
|
-
const templatePath =
|
|
68264
|
+
const templatePath = join106(pkgRoot, "templates", "CLEO-INJECTION.md");
|
|
68626
68265
|
if (existsSync106(templatePath)) {
|
|
68627
|
-
templateContent =
|
|
68266
|
+
templateContent = readFileSync78(templatePath, "utf-8");
|
|
68628
68267
|
}
|
|
68629
68268
|
} catch {
|
|
68630
68269
|
}
|
|
@@ -68641,15 +68280,15 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
68641
68280
|
ctx.warnings.push("Could not refresh CLEO-INJECTION.md template");
|
|
68642
68281
|
return;
|
|
68643
68282
|
}
|
|
68644
|
-
const xdgDest =
|
|
68283
|
+
const xdgDest = join106(globalTemplatesDir, "CLEO-INJECTION.md");
|
|
68645
68284
|
const xdgWritten = await writeTemplateTo(templateContent, xdgDest, ctx.isDryRun);
|
|
68646
68285
|
ctx.created.push(
|
|
68647
68286
|
`${getCleoTemplatesTildePath()}/CLEO-INJECTION.md (${xdgWritten ? "refreshed" : "would refresh"})`
|
|
68648
68287
|
);
|
|
68649
68288
|
const home = homedir6();
|
|
68650
|
-
const legacyTemplatesDir =
|
|
68651
|
-
if (legacyTemplatesDir !== globalTemplatesDir && existsSync106(
|
|
68652
|
-
const legacyDest =
|
|
68289
|
+
const legacyTemplatesDir = join106(home, ".cleo", "templates");
|
|
68290
|
+
if (legacyTemplatesDir !== globalTemplatesDir && existsSync106(join106(home, ".cleo"))) {
|
|
68291
|
+
const legacyDest = join106(legacyTemplatesDir, "CLEO-INJECTION.md");
|
|
68653
68292
|
const legacyWritten = await writeTemplateTo(templateContent, legacyDest, ctx.isDryRun);
|
|
68654
68293
|
if (legacyWritten) {
|
|
68655
68294
|
ctx.created.push("~/.cleo/templates/CLEO-INJECTION.md (legacy sync)");
|
|
@@ -68668,7 +68307,7 @@ function sanitizeCaampFile(content) {
|
|
|
68668
68307
|
}
|
|
68669
68308
|
async function injectAgentsHub(ctx) {
|
|
68670
68309
|
const globalAgentsDir = getAgentsHome();
|
|
68671
|
-
const globalAgentsMd =
|
|
68310
|
+
const globalAgentsMd = join106(globalAgentsDir, "AGENTS.md");
|
|
68672
68311
|
try {
|
|
68673
68312
|
const { inject: inject2, getInstalledProviders: getInstalledProviders3, injectAll: injectAll2, buildInjectionContent } = await import("@cleocode/caamp");
|
|
68674
68313
|
if (!ctx.isDryRun) {
|
|
@@ -68708,7 +68347,7 @@ async function injectAgentsHub(ctx) {
|
|
|
68708
68347
|
});
|
|
68709
68348
|
if (!ctx.isDryRun) {
|
|
68710
68349
|
for (const provider of providers) {
|
|
68711
|
-
const instructFilePath =
|
|
68350
|
+
const instructFilePath = join106(provider.pathGlobal, provider.instructFile);
|
|
68712
68351
|
if (existsSync106(instructFilePath)) {
|
|
68713
68352
|
const fileContent = await readFile19(instructFilePath, "utf8");
|
|
68714
68353
|
const stripped = fileContent.replace(
|
|
@@ -68727,7 +68366,7 @@ async function injectAgentsHub(ctx) {
|
|
|
68727
68366
|
}
|
|
68728
68367
|
} else {
|
|
68729
68368
|
for (const p of providers) {
|
|
68730
|
-
const displayPath =
|
|
68369
|
+
const displayPath = join106(p.pathGlobal, p.instructFile).replace(homedir6(), "~");
|
|
68731
68370
|
ctx.created.push(`${displayPath} (would update CAAMP block)`);
|
|
68732
68371
|
}
|
|
68733
68372
|
}
|
|
@@ -68736,37 +68375,6 @@ async function injectAgentsHub(ctx) {
|
|
|
68736
68375
|
ctx.warnings.push(`CAAMP injection: ${err instanceof Error ? err.message : String(err)}`);
|
|
68737
68376
|
}
|
|
68738
68377
|
}
|
|
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
68378
|
async function installSkillsGlobally(ctx) {
|
|
68771
68379
|
try {
|
|
68772
68380
|
if (!ctx.isDryRun) {
|
|
@@ -68832,8 +68440,8 @@ async function installProviderAdapters(ctx, packageRootOverride) {
|
|
|
68832
68440
|
async function verifyBootstrapHealth(ctx) {
|
|
68833
68441
|
if (ctx.isDryRun) return;
|
|
68834
68442
|
try {
|
|
68835
|
-
const xdgTemplatePath =
|
|
68836
|
-
const agentsMd =
|
|
68443
|
+
const xdgTemplatePath = join106(getCleoTemplatesDir(), "CLEO-INJECTION.md");
|
|
68444
|
+
const agentsMd = join106(getAgentsHome(), "AGENTS.md");
|
|
68837
68445
|
if (!existsSync106(xdgTemplatePath)) {
|
|
68838
68446
|
ctx.warnings.push("Health: XDG template missing after bootstrap");
|
|
68839
68447
|
return;
|
|
@@ -68841,7 +68449,7 @@ async function verifyBootstrapHealth(ctx) {
|
|
|
68841
68449
|
const xdgContent = await readFile19(xdgTemplatePath, "utf8");
|
|
68842
68450
|
const xdgVersion = xdgContent.match(/^Version:\s*(.+)$/m)?.[1]?.trim();
|
|
68843
68451
|
const home = homedir6();
|
|
68844
|
-
const legacyTemplatePath =
|
|
68452
|
+
const legacyTemplatePath = join106(home, ".cleo", "templates", "CLEO-INJECTION.md");
|
|
68845
68453
|
if (existsSync106(legacyTemplatePath)) {
|
|
68846
68454
|
const legacyContent = await readFile19(legacyTemplatePath, "utf8");
|
|
68847
68455
|
const legacyVersion = legacyContent.match(/^Version:\s*(.+)$/m)?.[1]?.trim();
|
|
@@ -69394,7 +69002,6 @@ export {
|
|
|
69394
69002
|
conduit_exports as conduit,
|
|
69395
69003
|
context_exports as context,
|
|
69396
69004
|
hooks_exports as coreHooks,
|
|
69397
|
-
mcp_exports as coreMcp,
|
|
69398
69005
|
createDataAccessor,
|
|
69399
69006
|
createErrorResult,
|
|
69400
69007
|
createPage,
|