@cleocode/core 2026.4.5 → 2026.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/discovery.d.ts +69 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1643 -2349
- package/dist/index.js.map +4 -4
- package/dist/init.d.ts +51 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/internal.d.ts +9 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/lifecycle/default-chain.d.ts +8 -2
- package/dist/lifecycle/default-chain.d.ts.map +1 -1
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/stage-guidance.d.ts +140 -0
- package/dist/lifecycle/stage-guidance.d.ts.map +1 -0
- package/dist/orchestration/protocol-validators.d.ts +122 -3
- package/dist/orchestration/protocol-validators.d.ts.map +1 -1
- package/dist/paths.d.ts +91 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/scaffold.d.ts +31 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/skills/dispatch.d.ts +1 -1
- package/dist/skills/skill-paths.d.ts +9 -6
- package/dist/skills/skill-paths.d.ts.map +1 -1
- package/dist/validation/protocols/_shared.d.ts +40 -0
- package/dist/validation/protocols/_shared.d.ts.map +1 -0
- package/dist/validation/protocols/architecture-decision.d.ts +23 -0
- package/dist/validation/protocols/architecture-decision.d.ts.map +1 -0
- package/dist/validation/protocols/artifact-publish.d.ts +22 -0
- package/dist/validation/protocols/artifact-publish.d.ts.map +1 -0
- package/dist/validation/protocols/consensus.d.ts +11 -17
- package/dist/validation/protocols/consensus.d.ts.map +1 -1
- package/dist/validation/protocols/contribution.d.ts +12 -17
- package/dist/validation/protocols/contribution.d.ts.map +1 -1
- package/dist/validation/protocols/decomposition.d.ts +18 -21
- package/dist/validation/protocols/decomposition.d.ts.map +1 -1
- package/dist/validation/protocols/implementation.d.ts +9 -17
- package/dist/validation/protocols/implementation.d.ts.map +1 -1
- package/dist/validation/protocols/provenance.d.ts +23 -0
- package/dist/validation/protocols/provenance.d.ts.map +1 -0
- package/dist/validation/protocols/release.d.ts +25 -0
- package/dist/validation/protocols/release.d.ts.map +1 -0
- package/dist/validation/protocols/research.d.ts +9 -17
- package/dist/validation/protocols/research.d.ts.map +1 -1
- package/dist/validation/protocols/specification.d.ts +7 -17
- package/dist/validation/protocols/specification.d.ts.map +1 -1
- package/dist/validation/protocols/testing.d.ts +22 -0
- package/dist/validation/protocols/testing.d.ts.map +1 -0
- package/dist/validation/protocols/validation.d.ts +22 -0
- package/dist/validation/protocols/validation.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/discovery.ts +235 -0
- package/src/index.ts +16 -0
- package/src/init.ts +196 -0
- package/src/internal.ts +31 -1
- package/src/lifecycle/default-chain.ts +11 -2
- package/src/lifecycle/index.ts +10 -0
- package/src/lifecycle/stage-guidance.ts +282 -0
- package/src/orchestration/__tests__/protocol-validators.test.ts +259 -7
- package/src/orchestration/protocol-validators.ts +419 -4
- package/src/paths.ts +110 -0
- package/src/scaffold.ts +240 -4
- package/src/skills/dispatch.ts +6 -6
- package/src/skills/skill-paths.ts +27 -23
- package/src/validation/protocols/_shared.ts +88 -0
- package/src/validation/protocols/architecture-decision.ts +52 -0
- package/src/validation/protocols/artifact-publish.ts +49 -0
- package/src/validation/protocols/consensus.ts +44 -74
- package/src/validation/protocols/contribution.ts +28 -65
- package/src/validation/protocols/decomposition.ts +37 -64
- package/src/validation/protocols/implementation.ts +25 -65
- package/src/validation/protocols/protocols-markdown/architecture-decision.md +303 -0
- package/src/validation/protocols/protocols-markdown/artifact-publish.md +600 -0
- package/src/validation/protocols/protocols-markdown/consensus.md +322 -0
- package/src/validation/protocols/protocols-markdown/contribution.md +388 -0
- package/src/validation/protocols/protocols-markdown/decomposition.md +421 -0
- package/src/validation/protocols/protocols-markdown/implementation.md +357 -0
- package/src/validation/protocols/protocols-markdown/provenance.md +613 -0
- package/src/validation/protocols/protocols-markdown/release.md +783 -0
- package/src/validation/protocols/protocols-markdown/research.md +261 -0
- package/src/validation/protocols/protocols-markdown/specification.md +300 -0
- package/src/validation/protocols/protocols-markdown/testing.md +287 -0
- package/src/validation/protocols/protocols-markdown/validation.md +242 -0
- package/src/validation/protocols/provenance.ts +50 -0
- package/src/validation/protocols/release.ts +44 -0
- package/src/validation/protocols/research.ts +25 -87
- package/src/validation/protocols/specification.ts +27 -89
- package/src/validation/protocols/testing.ts +46 -0
- package/src/validation/protocols/validation.ts +46 -0
- package/dist/cant/approval.d.ts +0 -110
- package/dist/cant/approval.d.ts.map +0 -1
- package/dist/cant/context-builder.d.ts +0 -79
- package/dist/cant/context-builder.d.ts.map +0 -1
- package/dist/cant/discretion.d.ts +0 -95
- package/dist/cant/discretion.d.ts.map +0 -1
- package/dist/cant/index.d.ts +0 -25
- package/dist/cant/index.d.ts.map +0 -1
- package/dist/cant/parallel-runner.d.ts +0 -38
- package/dist/cant/parallel-runner.d.ts.map +0 -1
- package/dist/cant/types.d.ts +0 -127
- package/dist/cant/types.d.ts.map +0 -1
- package/dist/cant/workflow-executor.d.ts +0 -105
- package/dist/cant/workflow-executor.d.ts.map +0 -1
- package/dist/validation/protocols/release-protocol.d.ts +0 -27
- package/dist/validation/protocols/release-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/testing-protocol.d.ts +0 -27
- package/dist/validation/protocols/testing-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/validation-protocol.d.ts +0 -27
- package/dist/validation/protocols/validation-protocol.d.ts.map +0 -1
- package/schemas/agent-configs.schema.json +0 -120
- package/schemas/agent-registry.schema.json +0 -132
- package/schemas/archive.schema.json +0 -450
- package/schemas/brain-decision.schema.json +0 -69
- package/schemas/brain-learning.schema.json +0 -57
- package/schemas/brain-pattern.schema.json +0 -72
- package/schemas/critical-path.schema.json +0 -246
- package/schemas/deps-cache.schema.json +0 -97
- package/schemas/doctor-output.schema.json +0 -283
- package/schemas/error.schema.json +0 -161
- package/schemas/global-config.schema.json +0 -219
- package/schemas/grade.schema.json +0 -49
- package/schemas/log.schema.json +0 -250
- package/schemas/metrics.schema.json +0 -328
- package/schemas/migrations.schema.json +0 -150
- package/schemas/nexus-registry.schema.json +0 -90
- package/schemas/operation-constitution.schema.json +0 -438
- package/schemas/output.schema.json +0 -164
- package/schemas/projects-registry.schema.json +0 -107
- package/schemas/protocol-frontmatter.schema.json +0 -72
- package/schemas/rcasd-consensus-report.schema.json +0 -10
- package/schemas/rcasd-evidence.schema.json +0 -42
- package/schemas/rcasd-gate-result.schema.json +0 -46
- package/schemas/rcasd-hitl-resolution.schema.json +0 -10
- package/schemas/rcasd-index.schema.json +0 -10
- package/schemas/rcasd-manifest.schema.json +0 -10
- package/schemas/rcasd-research-output.schema.json +0 -10
- package/schemas/rcasd-spec-frontmatter.schema.json +0 -10
- package/schemas/rcasd-stage-transition.schema.json +0 -38
- package/schemas/releases.schema.json +0 -267
- package/schemas/skills-manifest.schema.json +0 -91
- package/schemas/spec-index.schema.json +0 -196
- package/schemas/system-flow-atlas.schema.json +0 -125
- package/src/__tests__/audit-prune.test.d.ts.map +0 -1
- package/src/__tests__/audit-prune.test.js +0 -162
- package/src/__tests__/audit-prune.test.js.map +0 -1
- package/src/__tests__/caamp-skill-install.test.d.ts.map +0 -1
- package/src/__tests__/caamp-skill-install.test.js +0 -147
- package/src/__tests__/caamp-skill-install.test.js.map +0 -1
- package/src/__tests__/cli-parity.test.d.ts.map +0 -1
- package/src/__tests__/cli-parity.test.js +0 -209
- package/src/__tests__/cli-parity.test.js.map +0 -1
- package/src/__tests__/config.test.d.ts.map +0 -1
- package/src/__tests__/config.test.js +0 -144
- package/src/__tests__/config.test.js.map +0 -1
- package/src/__tests__/core-parity.test.d.ts.map +0 -1
- package/src/__tests__/core-parity.test.js +0 -645
- package/src/__tests__/core-parity.test.js.map +0 -1
- package/src/__tests__/error-catalog.test.d.ts.map +0 -1
- package/src/__tests__/error-catalog.test.js +0 -127
- package/src/__tests__/error-catalog.test.js.map +0 -1
- package/src/__tests__/golden-parity.test.d.ts.map +0 -1
- package/src/__tests__/golden-parity.test.js +0 -212
- package/src/__tests__/golden-parity.test.js.map +0 -1
- package/src/__tests__/hooks.test.d.ts.map +0 -1
- package/src/__tests__/hooks.test.js +0 -201
- package/src/__tests__/hooks.test.js.map +0 -1
- package/src/__tests__/human-output.test.d.ts.map +0 -1
- package/src/__tests__/human-output.test.js +0 -158
- package/src/__tests__/human-output.test.js.map +0 -1
- package/src/__tests__/index-api-compat.test.d.ts.map +0 -1
- package/src/__tests__/index-api-compat.test.js +0 -16
- package/src/__tests__/index-api-compat.test.js.map +0 -1
- package/src/__tests__/init-e2e.test.d.ts.map +0 -1
- package/src/__tests__/init-e2e.test.js +0 -221
- package/src/__tests__/init-e2e.test.js.map +0 -1
- package/src/__tests__/injection-chain.test.d.ts.map +0 -1
- package/src/__tests__/injection-chain.test.js +0 -234
- package/src/__tests__/injection-chain.test.js.map +0 -1
- package/src/__tests__/injection-mvi-tiers.test.d.ts.map +0 -1
- package/src/__tests__/injection-mvi-tiers.test.js +0 -152
- package/src/__tests__/injection-mvi-tiers.test.js.map +0 -1
- package/src/__tests__/injection-shared.test.d.ts.map +0 -1
- package/src/__tests__/injection-shared.test.js +0 -194
- package/src/__tests__/injection-shared.test.js.map +0 -1
- package/src/__tests__/lafs-conformance.test.d.ts.map +0 -1
- package/src/__tests__/lafs-conformance.test.js +0 -786
- package/src/__tests__/lafs-conformance.test.js.map +0 -1
- package/src/__tests__/logger.test.d.ts.map +0 -1
- package/src/__tests__/logger.test.js +0 -75
- package/src/__tests__/logger.test.js.map +0 -1
- package/src/__tests__/paths.test.d.ts.map +0 -1
- package/src/__tests__/paths.test.js +0 -327
- package/src/__tests__/paths.test.js.map +0 -1
- package/src/__tests__/project-info.test.d.ts.map +0 -1
- package/src/__tests__/project-info.test.js +0 -156
- package/src/__tests__/project-info.test.js.map +0 -1
- package/src/__tests__/rcsd-pipeline-e2e.test.d.ts.map +0 -1
- package/src/__tests__/rcsd-pipeline-e2e.test.js +0 -263
- package/src/__tests__/rcsd-pipeline-e2e.test.js.map +0 -1
- package/src/__tests__/remote.test.d.ts.map +0 -1
- package/src/__tests__/remote.test.js +0 -149
- package/src/__tests__/remote.test.js.map +0 -1
- package/src/__tests__/scaffold.test.d.ts.map +0 -1
- package/src/__tests__/scaffold.test.js +0 -474
- package/src/__tests__/scaffold.test.js.map +0 -1
- package/src/__tests__/schema-management.test.d.ts.map +0 -1
- package/src/__tests__/schema-management.test.js +0 -287
- package/src/__tests__/schema-management.test.js.map +0 -1
- package/src/__tests__/schema.test.d.ts.map +0 -1
- package/src/__tests__/schema.test.js +0 -51
- package/src/__tests__/schema.test.js.map +0 -1
- package/src/__tests__/sharing.test.d.ts.map +0 -1
- package/src/__tests__/sharing.test.js +0 -160
- package/src/__tests__/sharing.test.js.map +0 -1
- package/src/__tests__/snapshot.test.d.ts.map +0 -1
- package/src/__tests__/snapshot.test.js +0 -72
- package/src/__tests__/snapshot.test.js.map +0 -1
- package/src/__tests__/upgrade.test.d.ts.map +0 -1
- package/src/__tests__/upgrade.test.js +0 -321
- package/src/__tests__/upgrade.test.js.map +0 -1
- package/src/adapters/__tests__/discovery.test.d.ts.map +0 -1
- package/src/adapters/__tests__/discovery.test.js +0 -56
- package/src/adapters/__tests__/discovery.test.js.map +0 -1
- package/src/adapters/__tests__/manager.test.d.ts.map +0 -1
- package/src/adapters/__tests__/manager.test.js +0 -260
- package/src/adapters/__tests__/manager.test.js.map +0 -1
- package/src/agents/__tests__/agent-registry.test.d.ts.map +0 -1
- package/src/agents/__tests__/agent-registry.test.js +0 -262
- package/src/agents/__tests__/agent-registry.test.js.map +0 -1
- package/src/agents/__tests__/capacity.test.d.ts.map +0 -1
- package/src/agents/__tests__/capacity.test.js +0 -173
- package/src/agents/__tests__/capacity.test.js.map +0 -1
- package/src/agents/__tests__/execution-learning.test.d.ts.map +0 -1
- package/src/agents/__tests__/execution-learning.test.js +0 -533
- package/src/agents/__tests__/execution-learning.test.js.map +0 -1
- package/src/agents/__tests__/health-monitor.test.d.ts.map +0 -1
- package/src/agents/__tests__/health-monitor.test.js +0 -259
- package/src/agents/__tests__/health-monitor.test.js.map +0 -1
- package/src/agents/__tests__/registry.test.d.ts.map +0 -1
- package/src/agents/__tests__/registry.test.js +0 -373
- package/src/agents/__tests__/registry.test.js.map +0 -1
- package/src/agents/__tests__/retry.test.d.ts.map +0 -1
- package/src/agents/__tests__/retry.test.js +0 -225
- package/src/agents/__tests__/retry.test.js.map +0 -1
- package/src/cant/__tests__/cant-agent-parse.test.d.ts.map +0 -1
- package/src/cant/__tests__/cant-agent-parse.test.js +0 -77
- package/src/cant/__tests__/cant-agent-parse.test.js.map +0 -1
- package/src/cant/__tests__/cant-agent-parse.test.ts +0 -94
- package/src/cant/approval.ts +0 -218
- package/src/cant/context-builder.ts +0 -135
- package/src/cant/discretion.ts +0 -149
- package/src/cant/index.ts +0 -58
- package/src/cant/parallel-runner.ts +0 -205
- package/src/cant/types.ts +0 -158
- package/src/cant/workflow-executor.ts +0 -618
- package/src/compliance/__tests__/sync.test.d.ts.map +0 -1
- package/src/compliance/__tests__/sync.test.js +0 -119
- package/src/compliance/__tests__/sync.test.js.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.js +0 -178
- package/src/conduit/__tests__/dual-api-e2e.test.js.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.ts +0 -212
- package/src/conduit/__tests__/local-credential-flow.test.d.ts.map +0 -1
- package/src/conduit/__tests__/local-credential-flow.test.js +0 -185
- package/src/conduit/__tests__/local-credential-flow.test.js.map +0 -1
- package/src/conduit/__tests__/local-transport.test.d.ts.map +0 -1
- package/src/conduit/__tests__/local-transport.test.js +0 -404
- package/src/conduit/__tests__/local-transport.test.js.map +0 -1
- package/src/conduit/__tests__/sse-transport.test.d.ts.map +0 -1
- package/src/conduit/__tests__/sse-transport.test.js +0 -291
- package/src/conduit/__tests__/sse-transport.test.js.map +0 -1
- package/src/hooks/__tests__/provider-hooks.test.d.ts.map +0 -1
- package/src/hooks/__tests__/provider-hooks.test.js +0 -33
- package/src/hooks/__tests__/provider-hooks.test.js.map +0 -1
- package/src/hooks/__tests__/registry.test.d.ts.map +0 -1
- package/src/hooks/__tests__/registry.test.js +0 -37
- package/src/hooks/__tests__/registry.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/error-hooks.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/error-hooks.test.js +0 -90
- package/src/hooks/handlers/__tests__/error-hooks.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/file-hooks.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/file-hooks.test.js +0 -128
- package/src/hooks/handlers/__tests__/file-hooks.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +0 -501
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/session-hooks.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/session-hooks.test.js +0 -54
- package/src/hooks/handlers/__tests__/session-hooks.test.js.map +0 -1
- package/src/hooks/handlers/__tests__/task-hooks.test.d.ts.map +0 -1
- package/src/hooks/handlers/__tests__/task-hooks.test.js +0 -77
- package/src/hooks/handlers/__tests__/task-hooks.test.js.map +0 -1
- package/src/intelligence/__tests__/adaptive-validation.test.d.ts.map +0 -1
- package/src/intelligence/__tests__/adaptive-validation.test.js +0 -517
- package/src/intelligence/__tests__/adaptive-validation.test.js.map +0 -1
- package/src/intelligence/__tests__/impact.test.d.ts.map +0 -1
- package/src/intelligence/__tests__/impact.test.js +0 -515
- package/src/intelligence/__tests__/impact.test.js.map +0 -1
- package/src/intelligence/__tests__/patterns.test.d.ts.map +0 -1
- package/src/intelligence/__tests__/patterns.test.js +0 -370
- package/src/intelligence/__tests__/patterns.test.js.map +0 -1
- package/src/intelligence/__tests__/prediction.test.d.ts.map +0 -1
- package/src/intelligence/__tests__/prediction.test.js +0 -314
- package/src/intelligence/__tests__/prediction.test.js.map +0 -1
- package/src/lib/__tests__/retry.test.d.ts.map +0 -1
- package/src/lib/__tests__/retry.test.js +0 -225
- package/src/lib/__tests__/retry.test.js.map +0 -1
- package/src/lifecycle/__tests__/chain-store.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/chain-store.test.js +0 -243
- package/src/lifecycle/__tests__/chain-store.test.js.map +0 -1
- package/src/lifecycle/__tests__/consolidate-rcasd.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/consolidate-rcasd.test.js +0 -210
- package/src/lifecycle/__tests__/consolidate-rcasd.test.js.map +0 -1
- package/src/lifecycle/__tests__/default-chain.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/default-chain.test.js +0 -74
- package/src/lifecycle/__tests__/default-chain.test.js.map +0 -1
- package/src/lifecycle/__tests__/frontmatter.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/frontmatter.test.js +0 -229
- package/src/lifecycle/__tests__/frontmatter.test.js.map +0 -1
- package/src/lifecycle/__tests__/lifecycle.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/lifecycle.test.js +0 -126
- package/src/lifecycle/__tests__/lifecycle.test.js.map +0 -1
- package/src/lifecycle/__tests__/pipeline.integration.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/pipeline.integration.test.js +0 -977
- package/src/lifecycle/__tests__/pipeline.integration.test.js.map +0 -1
- package/src/lifecycle/__tests__/rcasd-paths.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/rcasd-paths.test.js +0 -206
- package/src/lifecycle/__tests__/rcasd-paths.test.js.map +0 -1
- package/src/lifecycle/__tests__/resume-schema-contract.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/resume-schema-contract.test.js +0 -246
- package/src/lifecycle/__tests__/resume-schema-contract.test.js.map +0 -1
- package/src/lifecycle/__tests__/stage-record-provenance.integration.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/stage-record-provenance.integration.test.js +0 -95
- package/src/lifecycle/__tests__/stage-record-provenance.integration.test.js.map +0 -1
- package/src/lifecycle/__tests__/tessera-engine.test.d.ts.map +0 -1
- package/src/lifecycle/__tests__/tessera-engine.test.js +0 -392
- package/src/lifecycle/__tests__/tessera-engine.test.js.map +0 -1
- package/src/memory/__tests__/auto-extract.test.d.ts.map +0 -1
- package/src/memory/__tests__/auto-extract.test.js +0 -197
- package/src/memory/__tests__/auto-extract.test.js.map +0 -1
- package/src/memory/__tests__/brain-automation.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-automation.test.js +0 -730
- package/src/memory/__tests__/brain-automation.test.js.map +0 -1
- package/src/memory/__tests__/brain-embedding.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-embedding.test.js +0 -92
- package/src/memory/__tests__/brain-embedding.test.js.map +0 -1
- package/src/memory/__tests__/brain-links.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-links.test.js +0 -221
- package/src/memory/__tests__/brain-links.test.js.map +0 -1
- package/src/memory/__tests__/brain-migration.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-migration.test.js +0 -180
- package/src/memory/__tests__/brain-migration.test.js.map +0 -1
- package/src/memory/__tests__/brain-retrieval.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-retrieval.test.js +0 -701
- package/src/memory/__tests__/brain-retrieval.test.js.map +0 -1
- package/src/memory/__tests__/brain-search.test.d.ts.map +0 -1
- package/src/memory/__tests__/brain-search.test.js +0 -180
- package/src/memory/__tests__/brain-search.test.js.map +0 -1
- package/src/memory/__tests__/claude-mem-migration.test.d.ts.map +0 -1
- package/src/memory/__tests__/claude-mem-migration.test.js +0 -424
- package/src/memory/__tests__/claude-mem-migration.test.js.map +0 -1
- package/src/memory/__tests__/decisions.test.d.ts.map +0 -1
- package/src/memory/__tests__/decisions.test.js +0 -253
- package/src/memory/__tests__/decisions.test.js.map +0 -1
- package/src/memory/__tests__/engine-compat.test.d.ts.map +0 -1
- package/src/memory/__tests__/engine-compat.test.js +0 -331
- package/src/memory/__tests__/engine-compat.test.js.map +0 -1
- package/src/memory/__tests__/memory-bridge.test.d.ts.map +0 -1
- package/src/memory/__tests__/memory-bridge.test.js +0 -231
- package/src/memory/__tests__/memory-bridge.test.js.map +0 -1
- package/src/memory/__tests__/pipeline-manifest-sqlite.test.d.ts.map +0 -1
- package/src/memory/__tests__/pipeline-manifest-sqlite.test.js +0 -516
- package/src/memory/__tests__/pipeline-manifest-sqlite.test.js.map +0 -1
- package/src/memory/__tests__/session-memory.test.d.ts.map +0 -1
- package/src/memory/__tests__/session-memory.test.js +0 -387
- package/src/memory/__tests__/session-memory.test.js.map +0 -1
- package/src/metrics/__tests__/model-provider-registry.test.d.ts.map +0 -1
- package/src/metrics/__tests__/model-provider-registry.test.js +0 -45
- package/src/metrics/__tests__/model-provider-registry.test.js.map +0 -1
- package/src/metrics/__tests__/provider-detection.test.d.ts.map +0 -1
- package/src/metrics/__tests__/provider-detection.test.js +0 -111
- package/src/metrics/__tests__/provider-detection.test.js.map +0 -1
- package/src/migration/__tests__/checksum.test.d.ts.map +0 -1
- package/src/migration/__tests__/checksum.test.js +0 -216
- package/src/migration/__tests__/checksum.test.js.map +0 -1
- package/src/migration/__tests__/logger.test.d.ts.map +0 -1
- package/src/migration/__tests__/logger.test.js +0 -256
- package/src/migration/__tests__/logger.test.js.map +0 -1
- package/src/migration/__tests__/migration-failure.integration.test.d.ts.map +0 -1
- package/src/migration/__tests__/migration-failure.integration.test.js +0 -515
- package/src/migration/__tests__/migration-failure.integration.test.js.map +0 -1
- package/src/migration/__tests__/migration.test.d.ts.map +0 -1
- package/src/migration/__tests__/migration.test.js +0 -82
- package/src/migration/__tests__/migration.test.js.map +0 -1
- package/src/migration/__tests__/state.test.d.ts.map +0 -1
- package/src/migration/__tests__/state.test.js +0 -330
- package/src/migration/__tests__/state.test.js.map +0 -1
- package/src/migration/__tests__/validate.test.d.ts.map +0 -1
- package/src/migration/__tests__/validate.test.js +0 -258
- package/src/migration/__tests__/validate.test.js.map +0 -1
- package/src/nexus/__tests__/deps.test.d.ts.map +0 -1
- package/src/nexus/__tests__/deps.test.js +0 -283
- package/src/nexus/__tests__/deps.test.js.map +0 -1
- package/src/nexus/__tests__/nexus-e2e.test.d.ts.map +0 -1
- package/src/nexus/__tests__/nexus-e2e.test.js +0 -1220
- package/src/nexus/__tests__/nexus-e2e.test.js.map +0 -1
- package/src/nexus/__tests__/permissions.test.d.ts.map +0 -1
- package/src/nexus/__tests__/permissions.test.js +0 -119
- package/src/nexus/__tests__/permissions.test.js.map +0 -1
- package/src/nexus/__tests__/query.test.d.ts.map +0 -1
- package/src/nexus/__tests__/query.test.js +0 -168
- package/src/nexus/__tests__/query.test.js.map +0 -1
- package/src/nexus/__tests__/reconcile.test.d.ts.map +0 -1
- package/src/nexus/__tests__/reconcile.test.js +0 -135
- package/src/nexus/__tests__/reconcile.test.js.map +0 -1
- package/src/nexus/__tests__/registry.test.d.ts.map +0 -1
- package/src/nexus/__tests__/registry.test.js +0 -229
- package/src/nexus/__tests__/registry.test.js.map +0 -1
- package/src/nexus/__tests__/transfer.test.d.ts.map +0 -1
- package/src/nexus/__tests__/transfer.test.js +0 -372
- package/src/nexus/__tests__/transfer.test.js.map +0 -1
- package/src/observability/__tests__/index.test.d.ts.map +0 -1
- package/src/observability/__tests__/index.test.js +0 -288
- package/src/observability/__tests__/index.test.js.map +0 -1
- package/src/observability/__tests__/log-filter.test.d.ts.map +0 -1
- package/src/observability/__tests__/log-filter.test.js +0 -151
- package/src/observability/__tests__/log-filter.test.js.map +0 -1
- package/src/observability/__tests__/log-parser.test.d.ts.map +0 -1
- package/src/observability/__tests__/log-parser.test.js +0 -170
- package/src/observability/__tests__/log-parser.test.js.map +0 -1
- package/src/observability/__tests__/log-reader.test.d.ts.map +0 -1
- package/src/observability/__tests__/log-reader.test.js +0 -150
- package/src/observability/__tests__/log-reader.test.js.map +0 -1
- package/src/orchestration/__tests__/autonomous-spec.test.d.ts.map +0 -1
- package/src/orchestration/__tests__/autonomous-spec.test.js +0 -419
- package/src/orchestration/__tests__/autonomous-spec.test.js.map +0 -1
- package/src/orchestration/__tests__/orchestration.test.d.ts.map +0 -1
- package/src/orchestration/__tests__/orchestration.test.js +0 -205
- package/src/orchestration/__tests__/orchestration.test.js.map +0 -1
- package/src/orchestration/__tests__/protocol-validators.test.d.ts.map +0 -1
- package/src/orchestration/__tests__/protocol-validators.test.js +0 -382
- package/src/orchestration/__tests__/protocol-validators.test.js.map +0 -1
- package/src/phases/__tests__/deps.test.d.ts.map +0 -1
- package/src/phases/__tests__/deps.test.js +0 -210
- package/src/phases/__tests__/deps.test.js.map +0 -1
- package/src/phases/__tests__/phases.test.d.ts.map +0 -1
- package/src/phases/__tests__/phases.test.js +0 -215
- package/src/phases/__tests__/phases.test.js.map +0 -1
- package/src/release/__tests__/artifacts.test.d.ts.map +0 -1
- package/src/release/__tests__/artifacts.test.js +0 -65
- package/src/release/__tests__/artifacts.test.js.map +0 -1
- package/src/release/__tests__/cancel-release.test.d.ts.map +0 -1
- package/src/release/__tests__/cancel-release.test.js +0 -154
- package/src/release/__tests__/cancel-release.test.js.map +0 -1
- package/src/release/__tests__/changelog-writer.test.d.ts.map +0 -1
- package/src/release/__tests__/changelog-writer.test.js +0 -132
- package/src/release/__tests__/changelog-writer.test.js.map +0 -1
- package/src/release/__tests__/push-policy.test.d.ts.map +0 -1
- package/src/release/__tests__/push-policy.test.js +0 -142
- package/src/release/__tests__/push-policy.test.js.map +0 -1
- package/src/release/__tests__/release.test.d.ts.map +0 -1
- package/src/release/__tests__/release.test.js +0 -25
- package/src/release/__tests__/release.test.js.map +0 -1
- package/src/sequence/__tests__/allocate.test.d.ts.map +0 -1
- package/src/sequence/__tests__/allocate.test.js +0 -113
- package/src/sequence/__tests__/allocate.test.js.map +0 -1
- package/src/sessions/__tests__/briefing-blocked.test.d.ts.map +0 -1
- package/src/sessions/__tests__/briefing-blocked.test.js +0 -117
- package/src/sessions/__tests__/briefing-blocked.test.js.map +0 -1
- package/src/sessions/__tests__/briefing.test.d.ts.map +0 -1
- package/src/sessions/__tests__/briefing.test.js +0 -336
- package/src/sessions/__tests__/briefing.test.js.map +0 -1
- package/src/sessions/__tests__/handoff-integration.test.d.ts.map +0 -1
- package/src/sessions/__tests__/handoff-integration.test.js +0 -264
- package/src/sessions/__tests__/handoff-integration.test.js.map +0 -1
- package/src/sessions/__tests__/handoff.test.d.ts.map +0 -1
- package/src/sessions/__tests__/handoff.test.js +0 -435
- package/src/sessions/__tests__/handoff.test.js.map +0 -1
- package/src/sessions/__tests__/index.test.d.ts.map +0 -1
- package/src/sessions/__tests__/index.test.js +0 -82
- package/src/sessions/__tests__/index.test.js.map +0 -1
- package/src/sessions/__tests__/session-cleanup.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-cleanup.test.js +0 -201
- package/src/sessions/__tests__/session-cleanup.test.js.map +0 -1
- package/src/sessions/__tests__/session-edge-cases.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-edge-cases.test.js +0 -251
- package/src/sessions/__tests__/session-edge-cases.test.js.map +0 -1
- package/src/sessions/__tests__/session-find.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-find.test.js +0 -210
- package/src/sessions/__tests__/session-find.test.js.map +0 -1
- package/src/sessions/__tests__/session-grade.integration.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-grade.integration.test.js +0 -287
- package/src/sessions/__tests__/session-grade.integration.test.js.map +0 -1
- package/src/sessions/__tests__/session-grade.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-grade.test.js +0 -630
- package/src/sessions/__tests__/session-grade.test.js.map +0 -1
- package/src/sessions/__tests__/session-memory-bridge.test.d.ts.map +0 -1
- package/src/sessions/__tests__/session-memory-bridge.test.js +0 -52
- package/src/sessions/__tests__/session-memory-bridge.test.js.map +0 -1
- package/src/sessions/__tests__/sessions.test.d.ts.map +0 -1
- package/src/sessions/__tests__/sessions.test.js +0 -113
- package/src/sessions/__tests__/sessions.test.js.map +0 -1
- package/src/skills/__tests__/discovery.test.d.ts.map +0 -1
- package/src/skills/__tests__/discovery.test.js +0 -171
- package/src/skills/__tests__/discovery.test.js.map +0 -1
- package/src/skills/__tests__/dispatch.test.d.ts.map +0 -1
- package/src/skills/__tests__/dispatch.test.js +0 -99
- package/src/skills/__tests__/dispatch.test.js.map +0 -1
- package/src/skills/__tests__/dynamic-skill-generator.test.d.ts.map +0 -1
- package/src/skills/__tests__/dynamic-skill-generator.test.js +0 -77
- package/src/skills/__tests__/dynamic-skill-generator.test.js.map +0 -1
- package/src/skills/__tests__/manifests.test.d.ts.map +0 -1
- package/src/skills/__tests__/manifests.test.js +0 -121
- package/src/skills/__tests__/manifests.test.js.map +0 -1
- package/src/skills/__tests__/precedence.test.d.ts.map +0 -1
- package/src/skills/__tests__/precedence.test.js +0 -325
- package/src/skills/__tests__/precedence.test.js.map +0 -1
- package/src/skills/__tests__/routing-table.test.d.ts.map +0 -1
- package/src/skills/__tests__/routing-table.test.js +0 -91
- package/src/skills/__tests__/routing-table.test.js.map +0 -1
- package/src/skills/__tests__/skill-paths.test.d.ts.map +0 -1
- package/src/skills/__tests__/skill-paths.test.js +0 -71
- package/src/skills/__tests__/skill-paths.test.js.map +0 -1
- package/src/skills/__tests__/test-utility.test.d.ts.map +0 -1
- package/src/skills/__tests__/test-utility.test.js +0 -59
- package/src/skills/__tests__/test-utility.test.js.map +0 -1
- package/src/skills/__tests__/token.test.d.ts.map +0 -1
- package/src/skills/__tests__/token.test.js +0 -135
- package/src/skills/__tests__/token.test.js.map +0 -1
- package/src/skills/__tests__/validation.test.d.ts.map +0 -1
- package/src/skills/__tests__/validation.test.js +0 -108
- package/src/skills/__tests__/validation.test.js.map +0 -1
- package/src/skills/__tests__/version.test.d.ts.map +0 -1
- package/src/skills/__tests__/version.test.js +0 -71
- package/src/skills/__tests__/version.test.js.map +0 -1
- package/src/skills/injection/__tests__/subagent.test.d.ts.map +0 -1
- package/src/skills/injection/__tests__/subagent.test.js +0 -122
- package/src/skills/injection/__tests__/subagent.test.js.map +0 -1
- package/src/skills/orchestrator/__tests__/spawn-tier.test.d.ts.map +0 -1
- package/src/skills/orchestrator/__tests__/spawn-tier.test.js +0 -228
- package/src/skills/orchestrator/__tests__/spawn-tier.test.js.map +0 -1
- package/src/spawn/__tests__/adapter-registry.test.d.ts.map +0 -1
- package/src/spawn/__tests__/adapter-registry.test.js +0 -76
- package/src/spawn/__tests__/adapter-registry.test.js.map +0 -1
- package/src/stats/__tests__/stats.test.d.ts.map +0 -1
- package/src/stats/__tests__/stats.test.js +0 -374
- package/src/stats/__tests__/stats.test.js.map +0 -1
- package/src/sticky/__tests__/purge.test.d.ts.map +0 -1
- package/src/sticky/__tests__/purge.test.js +0 -64
- package/src/sticky/__tests__/purge.test.js.map +0 -1
- package/src/store/__tests__/atomic.test.d.ts.map +0 -1
- package/src/store/__tests__/atomic.test.js +0 -81
- package/src/store/__tests__/atomic.test.js.map +0 -1
- package/src/store/__tests__/backup.test.d.ts.map +0 -1
- package/src/store/__tests__/backup.test.js +0 -131
- package/src/store/__tests__/backup.test.js.map +0 -1
- package/src/store/__tests__/brain-accessor-pageindex.test.d.ts.map +0 -1
- package/src/store/__tests__/brain-accessor-pageindex.test.js +0 -179
- package/src/store/__tests__/brain-accessor-pageindex.test.js.map +0 -1
- package/src/store/__tests__/brain-accessor.test.d.ts.map +0 -1
- package/src/store/__tests__/brain-accessor.test.js +0 -398
- package/src/store/__tests__/brain-accessor.test.js.map +0 -1
- package/src/store/__tests__/brain-pageindex.test.d.ts.map +0 -1
- package/src/store/__tests__/brain-pageindex.test.js +0 -137
- package/src/store/__tests__/brain-pageindex.test.js.map +0 -1
- package/src/store/__tests__/brain-schema.test.d.ts.map +0 -1
- package/src/store/__tests__/brain-schema.test.js +0 -137
- package/src/store/__tests__/brain-schema.test.js.map +0 -1
- package/src/store/__tests__/brain-vec.test.d.ts.map +0 -1
- package/src/store/__tests__/brain-vec.test.js +0 -100
- package/src/store/__tests__/brain-vec.test.js.map +0 -1
- package/src/store/__tests__/collision-detection.test.d.ts.map +0 -1
- package/src/store/__tests__/collision-detection.test.js +0 -165
- package/src/store/__tests__/collision-detection.test.js.map +0 -1
- package/src/store/__tests__/data-safety-central.test.d.ts.map +0 -1
- package/src/store/__tests__/data-safety-central.test.js +0 -408
- package/src/store/__tests__/data-safety-central.test.js.map +0 -1
- package/src/store/__tests__/db-helpers.test.d.ts.map +0 -1
- package/src/store/__tests__/db-helpers.test.js +0 -101
- package/src/store/__tests__/db-helpers.test.js.map +0 -1
- package/src/store/__tests__/e2e-safety-integration.test.d.ts.map +0 -1
- package/src/store/__tests__/e2e-safety-integration.test.js +0 -402
- package/src/store/__tests__/e2e-safety-integration.test.js.map +0 -1
- package/src/store/__tests__/git-checkpoint.test.d.ts.map +0 -1
- package/src/store/__tests__/git-checkpoint.test.js +0 -133
- package/src/store/__tests__/git-checkpoint.test.js.map +0 -1
- package/src/store/__tests__/idempotent-migration.test.d.ts.map +0 -1
- package/src/store/__tests__/idempotent-migration.test.js +0 -172
- package/src/store/__tests__/idempotent-migration.test.js.map +0 -1
- package/src/store/__tests__/import-logging.test.d.ts.map +0 -1
- package/src/store/__tests__/import-logging.test.js +0 -92
- package/src/store/__tests__/import-logging.test.js.map +0 -1
- package/src/store/__tests__/import-sort.test.d.ts.map +0 -1
- package/src/store/__tests__/import-sort.test.js +0 -109
- package/src/store/__tests__/import-sort.test.js.map +0 -1
- package/src/store/__tests__/json.test.d.ts.map +0 -1
- package/src/store/__tests__/json.test.js +0 -98
- package/src/store/__tests__/json.test.js.map +0 -1
- package/src/store/__tests__/lifecycle-schema-parity.test.d.ts.map +0 -1
- package/src/store/__tests__/lifecycle-schema-parity.test.js +0 -90
- package/src/store/__tests__/lifecycle-schema-parity.test.js.map +0 -1
- package/src/store/__tests__/migration-integration.test.d.ts.map +0 -1
- package/src/store/__tests__/migration-integration.test.js +0 -238
- package/src/store/__tests__/migration-integration.test.js.map +0 -1
- package/src/store/__tests__/migration-retry.test.d.ts.map +0 -1
- package/src/store/__tests__/migration-retry.test.js +0 -178
- package/src/store/__tests__/migration-retry.test.js.map +0 -1
- package/src/store/__tests__/migration-safety.test.d.ts.map +0 -1
- package/src/store/__tests__/migration-safety.test.js +0 -756
- package/src/store/__tests__/migration-safety.test.js.map +0 -1
- package/src/store/__tests__/migration-sqlite.test.d.ts.map +0 -1
- package/src/store/__tests__/migration-sqlite.test.js +0 -544
- package/src/store/__tests__/migration-sqlite.test.js.map +0 -1
- package/src/store/__tests__/performance-safety.test.d.ts.map +0 -1
- package/src/store/__tests__/performance-safety.test.js +0 -157
- package/src/store/__tests__/performance-safety.test.js.map +0 -1
- package/src/store/__tests__/project-detect.test.d.ts.map +0 -1
- package/src/store/__tests__/project-detect.test.js +0 -609
- package/src/store/__tests__/project-detect.test.js.map +0 -1
- package/src/store/__tests__/project-registry.test.d.ts.map +0 -1
- package/src/store/__tests__/project-registry.test.js +0 -28
- package/src/store/__tests__/project-registry.test.js.map +0 -1
- package/src/store/__tests__/provider.test.d.ts.map +0 -1
- package/src/store/__tests__/provider.test.js +0 -15
- package/src/store/__tests__/provider.test.js.map +0 -1
- package/src/store/__tests__/relations.test.d.ts.map +0 -1
- package/src/store/__tests__/relations.test.js +0 -318
- package/src/store/__tests__/relations.test.js.map +0 -1
- package/src/store/__tests__/safety-accessor.test.d.ts.map +0 -1
- package/src/store/__tests__/safety-accessor.test.js +0 -219
- package/src/store/__tests__/safety-accessor.test.js.map +0 -1
- package/src/store/__tests__/sequence-validation.test.d.ts.map +0 -1
- package/src/store/__tests__/sequence-validation.test.js +0 -94
- package/src/store/__tests__/sequence-validation.test.js.map +0 -1
- package/src/store/__tests__/session-store.test.d.ts.map +0 -1
- package/src/store/__tests__/session-store.test.js +0 -463
- package/src/store/__tests__/session-store.test.js.map +0 -1
- package/src/store/__tests__/sqlite-backup.test.d.ts.map +0 -1
- package/src/store/__tests__/sqlite-backup.test.js +0 -72
- package/src/store/__tests__/sqlite-backup.test.js.map +0 -1
- package/src/store/__tests__/sqlite.test.d.ts.map +0 -1
- package/src/store/__tests__/sqlite.test.js +0 -256
- package/src/store/__tests__/sqlite.test.js.map +0 -1
- package/src/store/__tests__/task-store.test.d.ts.map +0 -1
- package/src/store/__tests__/task-store.test.js +0 -514
- package/src/store/__tests__/task-store.test.js.map +0 -1
- package/src/store/__tests__/test-db-helper.d.ts.map +0 -1
- package/src/store/__tests__/test-db-helper.js +0 -110
- package/src/store/__tests__/test-db-helper.js.map +0 -1
- package/src/store/__tests__/write-verification.test.d.ts.map +0 -1
- package/src/store/__tests__/write-verification.test.js +0 -185
- package/src/store/__tests__/write-verification.test.js.map +0 -1
- package/src/system/__tests__/cleanup.test.d.ts.map +0 -1
- package/src/system/__tests__/cleanup.test.js +0 -87
- package/src/system/__tests__/cleanup.test.js.map +0 -1
- package/src/system/__tests__/health.test.d.ts.map +0 -1
- package/src/system/__tests__/health.test.js +0 -55
- package/src/system/__tests__/health.test.js.map +0 -1
- package/src/task-work/__tests__/start-deps.test.d.ts.map +0 -1
- package/src/task-work/__tests__/start-deps.test.js +0 -152
- package/src/task-work/__tests__/start-deps.test.js.map +0 -1
- package/src/tasks/__tests__/add.test.d.ts.map +0 -1
- package/src/tasks/__tests__/add.test.js +0 -226
- package/src/tasks/__tests__/add.test.js.map +0 -1
- package/src/tasks/__tests__/archive.test.d.ts.map +0 -1
- package/src/tasks/__tests__/archive.test.js +0 -196
- package/src/tasks/__tests__/archive.test.js.map +0 -1
- package/src/tasks/__tests__/assignee.test.d.ts.map +0 -1
- package/src/tasks/__tests__/assignee.test.js +0 -125
- package/src/tasks/__tests__/assignee.test.js.map +0 -1
- package/src/tasks/__tests__/atomicity.test.d.ts.map +0 -1
- package/src/tasks/__tests__/atomicity.test.js +0 -192
- package/src/tasks/__tests__/atomicity.test.js.map +0 -1
- package/src/tasks/__tests__/cancel-ops.test.d.ts.map +0 -1
- package/src/tasks/__tests__/cancel-ops.test.js +0 -115
- package/src/tasks/__tests__/cancel-ops.test.js.map +0 -1
- package/src/tasks/__tests__/complete-unblocks.test.d.ts.map +0 -1
- package/src/tasks/__tests__/complete-unblocks.test.js +0 -151
- package/src/tasks/__tests__/complete-unblocks.test.js.map +0 -1
- package/src/tasks/__tests__/complete.test.d.ts.map +0 -1
- package/src/tasks/__tests__/complete.test.js +0 -230
- package/src/tasks/__tests__/complete.test.js.map +0 -1
- package/src/tasks/__tests__/delete.test.d.ts.map +0 -1
- package/src/tasks/__tests__/delete.test.js +0 -183
- package/src/tasks/__tests__/delete.test.js.map +0 -1
- package/src/tasks/__tests__/dependency-check.test.d.ts.map +0 -1
- package/src/tasks/__tests__/dependency-check.test.js +0 -293
- package/src/tasks/__tests__/dependency-check.test.js.map +0 -1
- package/src/tasks/__tests__/deps-ready.test.d.ts.map +0 -1
- package/src/tasks/__tests__/deps-ready.test.js +0 -68
- package/src/tasks/__tests__/deps-ready.test.js.map +0 -1
- package/src/tasks/__tests__/epic-enforcement.test.d.ts.map +0 -1
- package/src/tasks/__tests__/epic-enforcement.test.js +0 -669
- package/src/tasks/__tests__/epic-enforcement.test.js.map +0 -1
- package/src/tasks/__tests__/find.test.d.ts.map +0 -1
- package/src/tasks/__tests__/find.test.js +0 -163
- package/src/tasks/__tests__/find.test.js.map +0 -1
- package/src/tasks/__tests__/graph-ops.test.d.ts.map +0 -1
- package/src/tasks/__tests__/graph-ops.test.js +0 -174
- package/src/tasks/__tests__/graph-ops.test.js.map +0 -1
- package/src/tasks/__tests__/hierarchy-policy.test.d.ts.map +0 -1
- package/src/tasks/__tests__/hierarchy-policy.test.js +0 -399
- package/src/tasks/__tests__/hierarchy-policy.test.js.map +0 -1
- package/src/tasks/__tests__/hierarchy.test.d.ts.map +0 -1
- package/src/tasks/__tests__/hierarchy.test.js +0 -302
- package/src/tasks/__tests__/hierarchy.test.js.map +0 -1
- package/src/tasks/__tests__/id-generator.test.d.ts.map +0 -1
- package/src/tasks/__tests__/id-generator.test.js +0 -59
- package/src/tasks/__tests__/id-generator.test.js.map +0 -1
- package/src/tasks/__tests__/labels.test.d.ts.map +0 -1
- package/src/tasks/__tests__/labels.test.js +0 -173
- package/src/tasks/__tests__/labels.test.js.map +0 -1
- package/src/tasks/__tests__/list.test.d.ts.map +0 -1
- package/src/tasks/__tests__/list.test.js +0 -272
- package/src/tasks/__tests__/list.test.js.map +0 -1
- package/src/tasks/__tests__/minimal-test.test.d.ts.map +0 -1
- package/src/tasks/__tests__/minimal-test.test.js +0 -25
- package/src/tasks/__tests__/minimal-test.test.js.map +0 -1
- package/src/tasks/__tests__/phase-tracking.test.d.ts.map +0 -1
- package/src/tasks/__tests__/phase-tracking.test.js +0 -209
- package/src/tasks/__tests__/phase-tracking.test.js.map +0 -1
- package/src/tasks/__tests__/pipeline-stage.test.d.ts.map +0 -1
- package/src/tasks/__tests__/pipeline-stage.test.js +0 -277
- package/src/tasks/__tests__/pipeline-stage.test.js.map +0 -1
- package/src/tasks/__tests__/plan-priority.test.d.ts.map +0 -1
- package/src/tasks/__tests__/plan-priority.test.js +0 -133
- package/src/tasks/__tests__/plan-priority.test.js.map +0 -1
- package/src/tasks/__tests__/priority-normalization.test.d.ts.map +0 -1
- package/src/tasks/__tests__/priority-normalization.test.js +0 -117
- package/src/tasks/__tests__/priority-normalization.test.js.map +0 -1
- package/src/tasks/__tests__/relates.test.d.ts.map +0 -1
- package/src/tasks/__tests__/relates.test.js +0 -84
- package/src/tasks/__tests__/relates.test.js.map +0 -1
- package/src/tasks/__tests__/show-deps.test.d.ts.map +0 -1
- package/src/tasks/__tests__/show-deps.test.js +0 -182
- package/src/tasks/__tests__/show-deps.test.js.map +0 -1
- package/src/tasks/__tests__/show.test.d.ts.map +0 -1
- package/src/tasks/__tests__/show.test.js +0 -126
- package/src/tasks/__tests__/show.test.js.map +0 -1
- package/src/tasks/__tests__/staleness.test.d.ts.map +0 -1
- package/src/tasks/__tests__/staleness.test.js +0 -154
- package/src/tasks/__tests__/staleness.test.js.map +0 -1
- package/src/tasks/__tests__/task-ops-depends.test.d.ts.map +0 -1
- package/src/tasks/__tests__/task-ops-depends.test.js +0 -118
- package/src/tasks/__tests__/task-ops-depends.test.js.map +0 -1
- package/src/tasks/__tests__/update.test.d.ts.map +0 -1
- package/src/tasks/__tests__/update.test.js +0 -320
- package/src/tasks/__tests__/update.test.js.map +0 -1
- package/src/validation/__tests__/chain-validation.test.d.ts.map +0 -1
- package/src/validation/__tests__/chain-validation.test.js +0 -204
- package/src/validation/__tests__/chain-validation.test.js.map +0 -1
- package/src/validation/__tests__/compliance.test.d.ts.map +0 -1
- package/src/validation/__tests__/compliance.test.js +0 -83
- package/src/validation/__tests__/compliance.test.js.map +0 -1
- package/src/validation/__tests__/docs-sync.test.d.ts.map +0 -1
- package/src/validation/__tests__/docs-sync.test.js +0 -243
- package/src/validation/__tests__/docs-sync.test.js.map +0 -1
- package/src/validation/__tests__/doctor-gitignore.test.d.ts.map +0 -1
- package/src/validation/__tests__/doctor-gitignore.test.js +0 -154
- package/src/validation/__tests__/doctor-gitignore.test.js.map +0 -1
- package/src/validation/__tests__/doctor-injection.test.d.ts.map +0 -1
- package/src/validation/__tests__/doctor-injection.test.js +0 -230
- package/src/validation/__tests__/doctor-injection.test.js.map +0 -1
- package/src/validation/__tests__/doctor.test.d.ts.map +0 -1
- package/src/validation/__tests__/doctor.test.js +0 -202
- package/src/validation/__tests__/doctor.test.js.map +0 -1
- package/src/validation/__tests__/engine.test.d.ts.map +0 -1
- package/src/validation/__tests__/engine.test.js +0 -346
- package/src/validation/__tests__/engine.test.js.map +0 -1
- package/src/validation/__tests__/manifest.test.d.ts.map +0 -1
- package/src/validation/__tests__/manifest.test.js +0 -244
- package/src/validation/__tests__/manifest.test.js.map +0 -1
- package/src/validation/__tests__/protocol-common.test.d.ts.map +0 -1
- package/src/validation/__tests__/protocol-common.test.js +0 -112
- package/src/validation/__tests__/protocol-common.test.js.map +0 -1
- package/src/validation/__tests__/verification.test.d.ts.map +0 -1
- package/src/validation/__tests__/verification.test.js +0 -277
- package/src/validation/__tests__/verification.test.js.map +0 -1
- package/src/validation/protocols/release-protocol.ts +0 -80
- package/src/validation/protocols/testing-protocol.ts +0 -93
- package/src/validation/protocols/validation-protocol.ts +0 -93
|
@@ -1,756 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration Safety Integration Tests
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive tests covering all failure modes and safety mechanisms:
|
|
5
|
-
* - Corrupted JSON handling
|
|
6
|
-
* - Migration interruption and recovery
|
|
7
|
-
* - Concurrent access blocking
|
|
8
|
-
* - Singleton reset
|
|
9
|
-
* - Backup restore on failure
|
|
10
|
-
* - Atomic rename verification
|
|
11
|
-
* - Idempotency
|
|
12
|
-
* - Data integrity
|
|
13
|
-
* - State file creation
|
|
14
|
-
* - Log file creation
|
|
15
|
-
* - Confirmation requirements
|
|
16
|
-
*
|
|
17
|
-
* @task T4729
|
|
18
|
-
* @epic T4454
|
|
19
|
-
*/
|
|
20
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
21
|
-
import { mkdir, mkdtemp, rm, stat, writeFile } from 'node:fs/promises';
|
|
22
|
-
import { tmpdir } from 'node:os';
|
|
23
|
-
import { join } from 'node:path';
|
|
24
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
25
|
-
describe('Migration Safety Integration Tests', () => {
|
|
26
|
-
let tempDir;
|
|
27
|
-
let cleoDir;
|
|
28
|
-
let logsDir;
|
|
29
|
-
let safetyDir;
|
|
30
|
-
beforeEach(async () => {
|
|
31
|
-
tempDir = await mkdtemp(join(tmpdir(), 'cleo-safety-'));
|
|
32
|
-
cleoDir = join(tempDir, '.cleo');
|
|
33
|
-
logsDir = join(cleoDir, 'logs');
|
|
34
|
-
safetyDir = join(cleoDir, 'backups', 'safety');
|
|
35
|
-
await mkdir(cleoDir, { recursive: true });
|
|
36
|
-
await mkdir(logsDir, { recursive: true });
|
|
37
|
-
await mkdir(safetyDir, { recursive: true });
|
|
38
|
-
process.env['CLEO_DIR'] = cleoDir;
|
|
39
|
-
// Reset SQLite singleton
|
|
40
|
-
const { closeDb } = await import('../sqlite.js');
|
|
41
|
-
closeDb();
|
|
42
|
-
// Clear any existing migration state
|
|
43
|
-
const { clearMigrationState } = await import('../../migration/state.js');
|
|
44
|
-
await clearMigrationState(cleoDir);
|
|
45
|
-
});
|
|
46
|
-
afterEach(async () => {
|
|
47
|
-
delete process.env['CLEO_DIR'];
|
|
48
|
-
// Close DB and cleanup
|
|
49
|
-
const { closeDb } = await import('../sqlite.js');
|
|
50
|
-
closeDb();
|
|
51
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
52
|
-
});
|
|
53
|
-
// === Test Data Fixtures ===
|
|
54
|
-
const createFullTask = (id, overrides = {}) => ({
|
|
55
|
-
id,
|
|
56
|
-
title: `Task ${id}`,
|
|
57
|
-
description: 'Detailed description',
|
|
58
|
-
status: 'active',
|
|
59
|
-
priority: 'critical',
|
|
60
|
-
type: 'epic',
|
|
61
|
-
phase: 'planning',
|
|
62
|
-
size: 'large',
|
|
63
|
-
position: 5,
|
|
64
|
-
labels: ['test', 'v2'],
|
|
65
|
-
notes: ['Note 1', 'Note 2'],
|
|
66
|
-
acceptance: ['Criteria 1'],
|
|
67
|
-
files: ['src/main.ts'],
|
|
68
|
-
origin: 'feature-request',
|
|
69
|
-
blockedBy: 'external',
|
|
70
|
-
epicLifecycle: 'active',
|
|
71
|
-
noAutoComplete: true,
|
|
72
|
-
createdAt: '2026-01-01T00:00:00.000Z',
|
|
73
|
-
updatedAt: '2026-01-05T00:00:00.000Z',
|
|
74
|
-
provenance: {
|
|
75
|
-
createdBy: 'agent-1',
|
|
76
|
-
modifiedBy: 'agent-2',
|
|
77
|
-
sessionId: 'sess-001',
|
|
78
|
-
},
|
|
79
|
-
...overrides,
|
|
80
|
-
});
|
|
81
|
-
const createTestSession = (id, overrides = {}) => ({
|
|
82
|
-
id,
|
|
83
|
-
name: `Session ${id}`,
|
|
84
|
-
status: 'ended',
|
|
85
|
-
scope: { type: 'epic', epicId: 'T001' },
|
|
86
|
-
taskWork: { taskId: 'T002', setAt: '2026-01-01T10:00:00.000Z' },
|
|
87
|
-
agent: 'claude',
|
|
88
|
-
notes: ['Session note'],
|
|
89
|
-
tasksCompleted: ['T003'],
|
|
90
|
-
tasksCreated: ['T002'],
|
|
91
|
-
startedAt: '2026-01-01T00:00:00.000Z',
|
|
92
|
-
endedAt: '2026-01-01T12:00:00.000Z',
|
|
93
|
-
...overrides,
|
|
94
|
-
});
|
|
95
|
-
const createTodoJson = (tasks = []) => ({
|
|
96
|
-
version: '2.10.0',
|
|
97
|
-
project: { name: 'test-project', phases: {} },
|
|
98
|
-
lastUpdated: new Date().toISOString(),
|
|
99
|
-
_meta: {
|
|
100
|
-
schemaVersion: '2.10.0',
|
|
101
|
-
checksum: '0000000000000000',
|
|
102
|
-
configVersion: '1.0.0',
|
|
103
|
-
},
|
|
104
|
-
focus: { currentTask: null },
|
|
105
|
-
tasks,
|
|
106
|
-
});
|
|
107
|
-
const createSessionsJson = (sessions = []) => ({
|
|
108
|
-
version: '1.0.0',
|
|
109
|
-
sessions,
|
|
110
|
-
_meta: { schemaVersion: '1.0.0', lastUpdated: new Date().toISOString() },
|
|
111
|
-
});
|
|
112
|
-
const createArchiveJson = (archivedTasks = []) => ({
|
|
113
|
-
_meta: { schemaVersion: '2.10.0' },
|
|
114
|
-
archivedTasks,
|
|
115
|
-
});
|
|
116
|
-
// === Failure Scenarios ===
|
|
117
|
-
describe('Failure Scenarios', () => {
|
|
118
|
-
it('should fail before destructive ops when JSON is corrupted', async () => {
|
|
119
|
-
// Setup: Create corrupted todo.json
|
|
120
|
-
await writeFile(join(cleoDir, 'todo.json'), '{ invalid json }');
|
|
121
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
122
|
-
// Run migration
|
|
123
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
124
|
-
const result = await migrateJsonToSqlite();
|
|
125
|
-
// Assert: Migration failed with parse error
|
|
126
|
-
expect(result.success).toBe(false);
|
|
127
|
-
expect(result.errors.length).toBeGreaterThan(0);
|
|
128
|
-
expect(result.errors[0]).toContain('parse');
|
|
129
|
-
// Assert: Database was not created (or is empty)
|
|
130
|
-
const dbPath = join(cleoDir, 'tasks.db');
|
|
131
|
-
if (existsSync(dbPath)) {
|
|
132
|
-
// If DB exists, it should be empty/invalid
|
|
133
|
-
const { getDb } = await import('../sqlite.js');
|
|
134
|
-
const { count } = await import('drizzle-orm');
|
|
135
|
-
const { tasks } = await import('../tasks-schema.js');
|
|
136
|
-
const db = await getDb();
|
|
137
|
-
const taskCount = db.select({ count: count() }).from(tasks).get();
|
|
138
|
-
expect(taskCount?.count ?? 0).toBe(0);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
it('should restore from backup when migration fails mid-process', async () => {
|
|
142
|
-
// Setup: Create initial DB with data
|
|
143
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
144
|
-
const { getDb, closeDb } = await import('../sqlite.js');
|
|
145
|
-
const { tasks } = await import('../tasks-schema.js');
|
|
146
|
-
const { eq } = await import('drizzle-orm');
|
|
147
|
-
// First migration: create initial DB
|
|
148
|
-
const initialTasks = [createFullTask('T001'), createFullTask('T002')];
|
|
149
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(initialTasks)));
|
|
150
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
151
|
-
const firstResult = await migrateJsonToSqlite();
|
|
152
|
-
expect(firstResult.success).toBe(true);
|
|
153
|
-
expect(firstResult.tasksImported).toBe(2);
|
|
154
|
-
// Verify DB exists
|
|
155
|
-
const dbPath = join(cleoDir, 'tasks.db');
|
|
156
|
-
expect(existsSync(dbPath)).toBe(true);
|
|
157
|
-
// Create backup manually (simulating pre-migration backup)
|
|
158
|
-
const backupPath = join(safetyDir, 'tasks.db.pre-migration.test');
|
|
159
|
-
await writeFile(backupPath, readFileSync(dbPath));
|
|
160
|
-
// Get original DB content for comparison
|
|
161
|
-
const originalDbContent = readFileSync(dbPath);
|
|
162
|
-
// Create corrupted JSON that will cause migration to fail
|
|
163
|
-
await writeFile(join(cleoDir, 'todo.json'), '{ corrupted }');
|
|
164
|
-
// Attempt migration (will fail)
|
|
165
|
-
const secondResult = await migrateJsonToSqlite(undefined, { force: true });
|
|
166
|
-
// Restore from backup manually (migration doesn't auto-restore on JSON parse error)
|
|
167
|
-
// In production, this would be handled by the upgrade.ts restore logic
|
|
168
|
-
await writeFile(dbPath, originalDbContent);
|
|
169
|
-
closeDb();
|
|
170
|
-
// Verify DB was restored (re-open to verify)
|
|
171
|
-
const db = await getDb();
|
|
172
|
-
const allTasks = await db.select().from(tasks).where(eq(tasks.status, 'active')).all();
|
|
173
|
-
expect(allTasks.length).toBe(2);
|
|
174
|
-
});
|
|
175
|
-
it('should block concurrent migration attempts', async () => {
|
|
176
|
-
// Setup: Create valid JSON files
|
|
177
|
-
const tasks = [createFullTask('T001')];
|
|
178
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
179
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
180
|
-
// Acquire lock on DB path
|
|
181
|
-
const { acquireLock } = await import('../lock.js');
|
|
182
|
-
const dbPath = join(cleoDir, 'tasks.db');
|
|
183
|
-
const release = await acquireLock(dbPath, { stale: 5000, retries: 0 });
|
|
184
|
-
try {
|
|
185
|
-
// Attempt to acquire lock again (should fail)
|
|
186
|
-
let lockError = null;
|
|
187
|
-
try {
|
|
188
|
-
await acquireLock(dbPath, { stale: 5000, retries: 0 });
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
lockError = err;
|
|
192
|
-
}
|
|
193
|
-
// Should fail with lock error
|
|
194
|
-
expect(lockError).not.toBeNull();
|
|
195
|
-
expect(lockError.message).toContain('lock');
|
|
196
|
-
}
|
|
197
|
-
finally {
|
|
198
|
-
await release();
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
it('should handle migration interruption and resume', async () => {
|
|
202
|
-
// Setup: Create migration state file simulating interrupted migration
|
|
203
|
-
const { createMigrationState, updateMigrationPhase, loadMigrationState, completeMigration } = await import('../../migration/state.js');
|
|
204
|
-
const tasks = [createFullTask('T001'), createFullTask('T002')];
|
|
205
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
206
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
207
|
-
// Create migration state at 'import' phase (interrupted)
|
|
208
|
-
await createMigrationState(cleoDir);
|
|
209
|
-
await updateMigrationPhase(cleoDir, 'import');
|
|
210
|
-
// Check that migration state shows it can be resumed
|
|
211
|
-
const { canResumeMigration } = await import('../../migration/state.js');
|
|
212
|
-
const resumeState = await canResumeMigration(cleoDir);
|
|
213
|
-
expect(resumeState).not.toBeNull();
|
|
214
|
-
expect(resumeState?.canResume).toBe(true);
|
|
215
|
-
expect(resumeState?.phase).toBe('import');
|
|
216
|
-
// Run migration again (should complete successfully)
|
|
217
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
218
|
-
const result = await migrateJsonToSqlite();
|
|
219
|
-
expect(result.success).toBe(true);
|
|
220
|
-
expect(result.tasksImported).toBe(2);
|
|
221
|
-
// Mark migration as complete
|
|
222
|
-
await completeMigration(cleoDir);
|
|
223
|
-
// Verify state was marked complete
|
|
224
|
-
const finalState = await loadMigrationState(cleoDir);
|
|
225
|
-
if (finalState) {
|
|
226
|
-
expect(finalState.phase).toBe('complete');
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
it('should detect and reject zero-task JSON with existing database', async () => {
|
|
230
|
-
// Setup: Create initial DB with data
|
|
231
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
232
|
-
const initialTasks = [createFullTask('T001')];
|
|
233
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(initialTasks)));
|
|
234
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
235
|
-
await migrateJsonToSqlite();
|
|
236
|
-
const { closeDb } = await import('../sqlite.js');
|
|
237
|
-
closeDb();
|
|
238
|
-
// Replace with empty JSON (simulating data loss scenario)
|
|
239
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([])));
|
|
240
|
-
// Attempt migration without force (should detect mismatch)
|
|
241
|
-
const result = await migrateJsonToSqlite();
|
|
242
|
-
// Should warn about data mismatch
|
|
243
|
-
expect(result.warnings.length).toBeGreaterThan(0);
|
|
244
|
-
expect(result.warnings[0]).toContain('mismatch');
|
|
245
|
-
});
|
|
246
|
-
it('should clear singleton state after migration', async () => {
|
|
247
|
-
// Setup: Create JSON files
|
|
248
|
-
const tasks = [createFullTask('T001')];
|
|
249
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
250
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
251
|
-
// Open DB before migration (to create singleton state)
|
|
252
|
-
const { getDb, closeDb, resetDbState } = await import('../sqlite.js');
|
|
253
|
-
const dbBefore = await getDb();
|
|
254
|
-
expect(dbBefore).toBeDefined();
|
|
255
|
-
closeDb();
|
|
256
|
-
resetDbState();
|
|
257
|
-
// Run migration
|
|
258
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
259
|
-
await migrateJsonToSqlite();
|
|
260
|
-
// After migration, getDb should return fresh instance
|
|
261
|
-
const dbAfter = await getDb();
|
|
262
|
-
expect(dbAfter).toBeDefined();
|
|
263
|
-
});
|
|
264
|
-
it('should verify backup with checksums not just file size', async () => {
|
|
265
|
-
// Setup: Create initial DB
|
|
266
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
267
|
-
const tasks = [createFullTask('T001')];
|
|
268
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
269
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
270
|
-
await migrateJsonToSqlite();
|
|
271
|
-
const { closeDb } = await import('../sqlite.js');
|
|
272
|
-
closeDb();
|
|
273
|
-
const dbPath = join(cleoDir, 'tasks.db');
|
|
274
|
-
expect(existsSync(dbPath)).toBe(true);
|
|
275
|
-
// Create backup with checksum verification
|
|
276
|
-
const { computeChecksum, compareChecksums } = await import('../../migration/checksum.js');
|
|
277
|
-
const originalChecksum = await computeChecksum(dbPath);
|
|
278
|
-
const backupPath = join(safetyDir, 'tasks.db.pre-migration.checksum');
|
|
279
|
-
await writeFile(backupPath, readFileSync(dbPath));
|
|
280
|
-
// Verify backup checksum matches original
|
|
281
|
-
const checksumsMatch = await compareChecksums(dbPath, backupPath);
|
|
282
|
-
expect(checksumsMatch).toBe(true);
|
|
283
|
-
// Verify both checksums are valid SHA-256 (64 hex chars)
|
|
284
|
-
const backupChecksum = await computeChecksum(backupPath);
|
|
285
|
-
expect(originalChecksum).toHaveLength(64);
|
|
286
|
-
expect(backupChecksum).toHaveLength(64);
|
|
287
|
-
expect(originalChecksum).toBe(backupChecksum);
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
// === Atomic Operations ===
|
|
291
|
-
describe('Atomic Operations', () => {
|
|
292
|
-
it('should never leave database in inconsistent state', async () => {
|
|
293
|
-
// Setup: Create valid JSON files
|
|
294
|
-
const tasks = [createFullTask('T001'), createFullTask('T002'), createFullTask('T003')];
|
|
295
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
296
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
297
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
298
|
-
const result = await migrateJsonToSqlite();
|
|
299
|
-
// Migration should succeed
|
|
300
|
-
expect(result.success).toBe(true);
|
|
301
|
-
// Verify all tasks were imported correctly
|
|
302
|
-
const { getDb } = await import('../sqlite.js');
|
|
303
|
-
const { tasks: taskSchema } = await import('../tasks-schema.js');
|
|
304
|
-
const { count } = await import('drizzle-orm');
|
|
305
|
-
const db = await getDb();
|
|
306
|
-
const taskCount = await db.select({ count: count() }).from(taskSchema).get();
|
|
307
|
-
expect(taskCount?.count).toBe(3);
|
|
308
|
-
// Verify database is valid (can run queries)
|
|
309
|
-
const allTasks = await db.select().from(taskSchema).all();
|
|
310
|
-
expect(allTasks.length).toBe(3);
|
|
311
|
-
expect(allTasks.every((t) => t.id && t.title)).toBe(true);
|
|
312
|
-
});
|
|
313
|
-
it('should use atomic rename, never delete-then-create', async () => {
|
|
314
|
-
// This test verifies the atomic pattern is used in migration-sqlite.ts
|
|
315
|
-
// by checking that the code uses temp file + rename pattern
|
|
316
|
-
const { migrateJsonToSqliteAtomic } = await import('../migration-sqlite.js');
|
|
317
|
-
// Setup: Create valid JSON files
|
|
318
|
-
const tasks = [createFullTask('T001')];
|
|
319
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
320
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
321
|
-
// Use atomic migration with temp path
|
|
322
|
-
const tempDbPath = join(cleoDir, 'tasks.db.migrating');
|
|
323
|
-
const result = await migrateJsonToSqliteAtomic(tempDir, tempDbPath);
|
|
324
|
-
if (!result.success) {
|
|
325
|
-
console.error('ATOMIC MIGRATION ERRORS:', JSON.stringify(result.errors, null, 2));
|
|
326
|
-
}
|
|
327
|
-
expect(result.success).toBe(true);
|
|
328
|
-
// Verify temp file was created
|
|
329
|
-
expect(existsSync(tempDbPath)).toBe(true);
|
|
330
|
-
// The migration should have exported to temp file (ready for rename)
|
|
331
|
-
const tempStats = await stat(tempDbPath);
|
|
332
|
-
expect(tempStats.size).toBeGreaterThan(0);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
// === Idempotency ===
|
|
336
|
-
describe('Idempotency', () => {
|
|
337
|
-
it('should skip migration when data already present', async () => {
|
|
338
|
-
// Setup: Create and run initial migration
|
|
339
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
340
|
-
const tasks = [createFullTask('T001'), createFullTask('T002')];
|
|
341
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
342
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
343
|
-
const firstResult = await migrateJsonToSqlite();
|
|
344
|
-
expect(firstResult.success).toBe(true);
|
|
345
|
-
expect(firstResult.tasksImported).toBe(2);
|
|
346
|
-
const { closeDb } = await import('../sqlite.js');
|
|
347
|
-
closeDb();
|
|
348
|
-
// Second migration without force should skip
|
|
349
|
-
const secondResult = await migrateJsonToSqlite();
|
|
350
|
-
expect(secondResult.success).toBe(true);
|
|
351
|
-
expect(secondResult.warnings.length).toBeGreaterThan(0);
|
|
352
|
-
expect(secondResult.warnings[0]).toContain('already contains migrated data');
|
|
353
|
-
expect(secondResult.tasksImported).toBe(0);
|
|
354
|
-
});
|
|
355
|
-
it('should re-import with --force flag', async () => {
|
|
356
|
-
// Setup: Create and run initial migration
|
|
357
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
358
|
-
const tasks = [createFullTask('T001')];
|
|
359
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
360
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
361
|
-
await migrateJsonToSqlite();
|
|
362
|
-
const { closeDb } = await import('../sqlite.js');
|
|
363
|
-
closeDb();
|
|
364
|
-
// Modify JSON with additional task
|
|
365
|
-
const newTasks = [createFullTask('T001'), createFullTask('T002')];
|
|
366
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(newTasks)));
|
|
367
|
-
// Re-import with force
|
|
368
|
-
const forceResult = await migrateJsonToSqlite(undefined, { force: true });
|
|
369
|
-
expect(forceResult.success).toBe(true);
|
|
370
|
-
expect(forceResult.warnings[0]).toContain('Force mode');
|
|
371
|
-
// Verify both tasks are present
|
|
372
|
-
const { getDb } = await import('../sqlite.js');
|
|
373
|
-
const { tasks: taskSchema } = await import('../tasks-schema.js');
|
|
374
|
-
const { count } = await import('drizzle-orm');
|
|
375
|
-
const db = await getDb();
|
|
376
|
-
const taskCount = await db.select({ count: count() }).from(taskSchema).get();
|
|
377
|
-
expect(taskCount?.count).toBe(2);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
// === Data Integrity ===
|
|
381
|
-
describe('Data Integrity', () => {
|
|
382
|
-
it('should preserve all task fields through migration', async () => {
|
|
383
|
-
const fullTask = createFullTask('T001');
|
|
384
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([fullTask])));
|
|
385
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
386
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
387
|
-
await migrateJsonToSqlite();
|
|
388
|
-
const { getTask } = await import('../task-store.js');
|
|
389
|
-
const task = await getTask('T001');
|
|
390
|
-
expect(task).not.toBeNull();
|
|
391
|
-
expect(task.id).toBe('T001');
|
|
392
|
-
expect(task.title).toBe('Task T001');
|
|
393
|
-
expect(task.description).toBe('Detailed description');
|
|
394
|
-
expect(task.status).toBe('active');
|
|
395
|
-
expect(task.priority).toBe('critical');
|
|
396
|
-
expect(task.type).toBe('epic');
|
|
397
|
-
expect(task.phase).toBe('planning');
|
|
398
|
-
expect(task.size).toBe('large');
|
|
399
|
-
expect(task.position).toBe(5);
|
|
400
|
-
expect(task.labels).toEqual(['test', 'v2']);
|
|
401
|
-
expect(task.notes).toEqual(['Note 1', 'Note 2']);
|
|
402
|
-
expect(task.acceptance).toEqual(['Criteria 1']);
|
|
403
|
-
expect(task.files).toEqual(['src/main.ts']);
|
|
404
|
-
expect(task.origin).toBe('feature-request');
|
|
405
|
-
expect(task.blockedBy).toBe('external');
|
|
406
|
-
expect(task.epicLifecycle).toBe('active');
|
|
407
|
-
expect(task.noAutoComplete).toBe(true);
|
|
408
|
-
expect(task.createdAt).toBe('2026-01-01T00:00:00.000Z');
|
|
409
|
-
expect(task.updatedAt).toBe('2026-01-05T00:00:00.000Z');
|
|
410
|
-
expect(task.provenance?.createdBy).toBe('agent-1');
|
|
411
|
-
expect(task.provenance?.modifiedBy).toBe('agent-2');
|
|
412
|
-
expect(task.provenance?.sessionId).toBe('sess-001');
|
|
413
|
-
});
|
|
414
|
-
it('should preserve dependencies through migration', async () => {
|
|
415
|
-
const tasks = [
|
|
416
|
-
createFullTask('T001'),
|
|
417
|
-
createFullTask('T002', { depends: ['T001'] }),
|
|
418
|
-
createFullTask('T003', { depends: ['T001', 'T002'] }),
|
|
419
|
-
];
|
|
420
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
421
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
422
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
423
|
-
await migrateJsonToSqlite();
|
|
424
|
-
const { getTask } = await import('../task-store.js');
|
|
425
|
-
const t1 = await getTask('T001');
|
|
426
|
-
const t2 = await getTask('T002');
|
|
427
|
-
const t3 = await getTask('T003');
|
|
428
|
-
expect(t1).not.toBeNull();
|
|
429
|
-
expect(t2).not.toBeNull();
|
|
430
|
-
expect(t3).not.toBeNull();
|
|
431
|
-
expect(t2.depends).toContain('T001');
|
|
432
|
-
expect(t3.depends).toContain('T001');
|
|
433
|
-
expect(t3.depends).toContain('T002');
|
|
434
|
-
});
|
|
435
|
-
it('should preserve sessions through migration', async () => {
|
|
436
|
-
const sessions = [
|
|
437
|
-
createTestSession('sess-001'),
|
|
438
|
-
createTestSession('sess-002', { status: 'active' }),
|
|
439
|
-
];
|
|
440
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson()));
|
|
441
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson(sessions)));
|
|
442
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
443
|
-
const result = await migrateJsonToSqlite();
|
|
444
|
-
expect(result.success).toBe(true);
|
|
445
|
-
expect(result.sessionsImported).toBe(2);
|
|
446
|
-
const { getSession } = await import('../session-store.js');
|
|
447
|
-
const s1 = await getSession('sess-001');
|
|
448
|
-
expect(s1).not.toBeNull();
|
|
449
|
-
expect(s1.name).toBe('Session sess-001');
|
|
450
|
-
expect(s1.status).toBe('ended');
|
|
451
|
-
expect(s1.agent).toBe('claude');
|
|
452
|
-
const s2 = await getSession('sess-002');
|
|
453
|
-
expect(s2).not.toBeNull();
|
|
454
|
-
expect(s2.status).toBe('active');
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
// === Safety Mechanisms ===
|
|
458
|
-
describe('Safety Mechanisms', () => {
|
|
459
|
-
it('should create state file during migration', async () => {
|
|
460
|
-
const { createMigrationState, loadMigrationState } = await import('../../migration/state.js');
|
|
461
|
-
// Create migration state
|
|
462
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T001')])));
|
|
463
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
464
|
-
const state = await createMigrationState(cleoDir);
|
|
465
|
-
expect(state).toBeDefined();
|
|
466
|
-
expect(state.phase).toBe('init');
|
|
467
|
-
expect(state.version).toBe('1.0.0');
|
|
468
|
-
expect(state.startedAt).toBeDefined();
|
|
469
|
-
// Verify state file was created on disk
|
|
470
|
-
const loadedState = await loadMigrationState(cleoDir);
|
|
471
|
-
expect(loadedState).not.toBeNull();
|
|
472
|
-
expect(loadedState.phase).toBe('init');
|
|
473
|
-
expect(loadedState.sourceFiles.todoJson).toBeDefined();
|
|
474
|
-
expect(loadedState.sourceFiles.todoJson.checksum).toBeDefined();
|
|
475
|
-
});
|
|
476
|
-
it('should create log file during migration', async () => {
|
|
477
|
-
const { MigrationLogger } = await import('../../migration/logger.js');
|
|
478
|
-
const logger = new MigrationLogger(cleoDir);
|
|
479
|
-
// Log some operations
|
|
480
|
-
logger.info('init', 'start', 'Migration started');
|
|
481
|
-
logger.info('backup', 'create', 'Backup created');
|
|
482
|
-
logger.warn('import', 'skip', 'Skipping duplicate task');
|
|
483
|
-
const logPath = logger.getLogPath();
|
|
484
|
-
// Verify log file exists
|
|
485
|
-
expect(existsSync(logPath)).toBe(true);
|
|
486
|
-
// Read and verify log entries
|
|
487
|
-
const logContent = readFileSync(logPath, 'utf-8');
|
|
488
|
-
const entries = logContent
|
|
489
|
-
.trim()
|
|
490
|
-
.split('\n')
|
|
491
|
-
.map((line) => JSON.parse(line));
|
|
492
|
-
expect(entries.length).toBeGreaterThanOrEqual(3);
|
|
493
|
-
expect(entries[0].level).toBe('info');
|
|
494
|
-
expect(entries[0].phase).toBe('init');
|
|
495
|
-
expect(entries[0].message).toContain('Migration started');
|
|
496
|
-
// Verify log file is in logs directory
|
|
497
|
-
expect(logPath).toContain('logs');
|
|
498
|
-
expect(logPath).toContain('migration-');
|
|
499
|
-
expect(logPath).toContain('.jsonl');
|
|
500
|
-
});
|
|
501
|
-
it('should track migration progress in state', async () => {
|
|
502
|
-
const { createMigrationState, updateMigrationProgress, loadMigrationState } = await import('../../migration/state.js');
|
|
503
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T001'), createFullTask('T002'), createFullTask('T003')])));
|
|
504
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
505
|
-
const state = await createMigrationState(cleoDir);
|
|
506
|
-
expect(state.progress.totalTasks).toBe(3);
|
|
507
|
-
// Update progress
|
|
508
|
-
await updateMigrationProgress(cleoDir, { tasksImported: 1 });
|
|
509
|
-
const updatedState = await loadMigrationState(cleoDir);
|
|
510
|
-
expect(updatedState.progress.tasksImported).toBe(1);
|
|
511
|
-
expect(updatedState.progress.totalTasks).toBe(3);
|
|
512
|
-
});
|
|
513
|
-
it('should track errors and warnings in state', async () => {
|
|
514
|
-
const { createMigrationState, addMigrationError, addMigrationWarning, loadMigrationState } = await import('../../migration/state.js');
|
|
515
|
-
await createMigrationState(cleoDir);
|
|
516
|
-
await addMigrationWarning(cleoDir, 'Test warning');
|
|
517
|
-
await addMigrationError(cleoDir, 'Test error');
|
|
518
|
-
const state = await loadMigrationState(cleoDir);
|
|
519
|
-
expect(state.warnings).toContain('Test warning');
|
|
520
|
-
expect(state.errors).toContain('Test error');
|
|
521
|
-
expect(state.phase).toBe('failed');
|
|
522
|
-
});
|
|
523
|
-
});
|
|
524
|
-
// === Checksum Verification ===
|
|
525
|
-
describe('Checksum Verification', () => {
|
|
526
|
-
it('should detect modified source files', async () => {
|
|
527
|
-
const { createMigrationState, verifySourceIntegrity } = await import('../../migration/state.js');
|
|
528
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T001')])));
|
|
529
|
-
await createMigrationState(cleoDir);
|
|
530
|
-
// Verify source files are intact
|
|
531
|
-
const initialCheck = await verifySourceIntegrity(cleoDir);
|
|
532
|
-
expect(initialCheck.valid).toBe(true);
|
|
533
|
-
expect(initialCheck.changed).toHaveLength(0);
|
|
534
|
-
// Modify the source file
|
|
535
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T002')])));
|
|
536
|
-
// Verify source files are now detected as changed
|
|
537
|
-
const finalCheck = await verifySourceIntegrity(cleoDir);
|
|
538
|
-
expect(finalCheck.valid).toBe(false);
|
|
539
|
-
expect(finalCheck.changed.length).toBeGreaterThan(0);
|
|
540
|
-
});
|
|
541
|
-
it('should compute consistent checksums for same content', async () => {
|
|
542
|
-
const { computeChecksum, compareChecksums } = await import('../../migration/checksum.js');
|
|
543
|
-
const content = JSON.stringify({ test: 'data', array: [1, 2, 3] });
|
|
544
|
-
const file1 = join(cleoDir, 'test1.json');
|
|
545
|
-
const file2 = join(cleoDir, 'test2.json');
|
|
546
|
-
await writeFile(file1, content);
|
|
547
|
-
await writeFile(file2, content);
|
|
548
|
-
const checksum1 = await computeChecksum(file1);
|
|
549
|
-
const checksum2 = await computeChecksum(file2);
|
|
550
|
-
expect(checksum1).toBe(checksum2);
|
|
551
|
-
expect(checksum1).toHaveLength(64); // SHA-256 hex length
|
|
552
|
-
const match = await compareChecksums(file1, file2);
|
|
553
|
-
expect(match).toBe(true);
|
|
554
|
-
});
|
|
555
|
-
});
|
|
556
|
-
// === Logger Functionality ===
|
|
557
|
-
describe('Logger Functionality', () => {
|
|
558
|
-
it('should log file operations with metadata', async () => {
|
|
559
|
-
const { MigrationLogger } = await import('../../migration/logger.js');
|
|
560
|
-
const logger = new MigrationLogger(cleoDir);
|
|
561
|
-
const testFile = join(cleoDir, 'test-file.txt');
|
|
562
|
-
await writeFile(testFile, 'test content');
|
|
563
|
-
logger.logFileOperation('test-phase', 'write', testFile, undefined, { custom: 'data' });
|
|
564
|
-
const summary = logger.getSummary();
|
|
565
|
-
expect(summary.totalEntries).toBeGreaterThan(0);
|
|
566
|
-
expect(summary.info).toBeGreaterThan(0);
|
|
567
|
-
const entries = logger.getEntries();
|
|
568
|
-
const fileOp = entries.find((e) => e.operation === 'file-write');
|
|
569
|
-
expect(fileOp).toBeDefined();
|
|
570
|
-
expect(fileOp.data?.sourcePath).toBeDefined();
|
|
571
|
-
});
|
|
572
|
-
it('should log validation results', async () => {
|
|
573
|
-
const { MigrationLogger } = await import('../../migration/logger.js');
|
|
574
|
-
const logger = new MigrationLogger(cleoDir);
|
|
575
|
-
logger.logValidation('validate', 'test-target', true, { field: 'value' });
|
|
576
|
-
logger.logValidation('validate', 'failing-target', false, { error: 'details' }, ['error1']);
|
|
577
|
-
const entries = logger.getEntries();
|
|
578
|
-
expect(entries.some((e) => e.operation === 'validation' && e.data?.valid === true)).toBe(true);
|
|
579
|
-
expect(entries.some((e) => e.operation === 'validation' && e.data?.valid === false)).toBe(true);
|
|
580
|
-
});
|
|
581
|
-
it('should log import progress', async () => {
|
|
582
|
-
const { MigrationLogger } = await import('../../migration/logger.js');
|
|
583
|
-
const logger = new MigrationLogger(cleoDir);
|
|
584
|
-
logger.logImportProgress('import', 'tasks', 50, 100);
|
|
585
|
-
const entries = logger.getEntriesByPhase('import');
|
|
586
|
-
const progressEntry = entries.find((e) => e.operation === 'import-progress');
|
|
587
|
-
expect(progressEntry).toBeDefined();
|
|
588
|
-
expect(progressEntry.data?.imported).toBe(50);
|
|
589
|
-
expect(progressEntry.data?.total).toBe(100);
|
|
590
|
-
expect(progressEntry.data?.percent).toBe(50);
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
// === Migration Phases ===
|
|
594
|
-
describe('Migration Phases', () => {
|
|
595
|
-
it('should transition through all phases correctly', async () => {
|
|
596
|
-
const { createMigrationState, updateMigrationPhase, loadMigrationState } = await import('../../migration/state.js');
|
|
597
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T001')])));
|
|
598
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
599
|
-
const phases = [
|
|
600
|
-
'init',
|
|
601
|
-
'backup',
|
|
602
|
-
'validate',
|
|
603
|
-
'import',
|
|
604
|
-
'verify',
|
|
605
|
-
'cleanup',
|
|
606
|
-
'complete',
|
|
607
|
-
];
|
|
608
|
-
await createMigrationState(cleoDir);
|
|
609
|
-
for (const phase of phases) {
|
|
610
|
-
await updateMigrationPhase(cleoDir, phase);
|
|
611
|
-
const state = await loadMigrationState(cleoDir);
|
|
612
|
-
expect(state.phase).toBe(phase);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
it('should complete migration and cleanup state', async () => {
|
|
616
|
-
const { createMigrationState, completeMigration, loadMigrationState } = await import('../../migration/state.js');
|
|
617
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([createFullTask('T001')])));
|
|
618
|
-
await createMigrationState(cleoDir);
|
|
619
|
-
const completed = await completeMigration(cleoDir);
|
|
620
|
-
expect(completed.phase).toBe('complete');
|
|
621
|
-
expect(completed.completedAt).toBeDefined();
|
|
622
|
-
// State cleanup happens async, so check immediately
|
|
623
|
-
const state = await loadMigrationState(cleoDir);
|
|
624
|
-
expect(state).not.toBeNull();
|
|
625
|
-
expect(state.phase).toBe('complete');
|
|
626
|
-
});
|
|
627
|
-
it('should fail migration with error details', async () => {
|
|
628
|
-
const { createMigrationState, failMigration, loadMigrationState } = await import('../../migration/state.js');
|
|
629
|
-
await createMigrationState(cleoDir);
|
|
630
|
-
await failMigration(cleoDir, 'Migration failed: corrupted data');
|
|
631
|
-
const state = await loadMigrationState(cleoDir);
|
|
632
|
-
expect(state.phase).toBe('failed');
|
|
633
|
-
expect(state.errors).toContain('Migration failed: corrupted data');
|
|
634
|
-
});
|
|
635
|
-
});
|
|
636
|
-
// === Dry Run Mode ===
|
|
637
|
-
describe('Dry Run Mode', () => {
|
|
638
|
-
it('should preview migration without making changes', async () => {
|
|
639
|
-
const tasks = [createFullTask('T001')];
|
|
640
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
641
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
642
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
643
|
-
const result = await migrateJsonToSqlite(undefined, { dryRun: true });
|
|
644
|
-
expect(result.success).toBe(true);
|
|
645
|
-
expect(result.warnings.length).toBeGreaterThan(0);
|
|
646
|
-
expect(result.warnings[0]).toContain('Dry-run');
|
|
647
|
-
// Database should not be created
|
|
648
|
-
const dbPath = join(cleoDir, 'tasks.db');
|
|
649
|
-
// Note: The current implementation may still create DB in dry-run mode
|
|
650
|
-
// depending on the implementation details
|
|
651
|
-
});
|
|
652
|
-
it('should show data counts in dry-run mode', async () => {
|
|
653
|
-
const tasks = [createFullTask('T001'), createFullTask('T002'), createFullTask('T003')];
|
|
654
|
-
const sessions = [createTestSession('sess-001')];
|
|
655
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
656
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson(sessions)));
|
|
657
|
-
const { countJsonRecords } = await import('../migration-sqlite.js');
|
|
658
|
-
const counts = countJsonRecords(cleoDir);
|
|
659
|
-
expect(counts.tasks).toBe(3);
|
|
660
|
-
expect(counts.sessions).toBe(1);
|
|
661
|
-
});
|
|
662
|
-
});
|
|
663
|
-
// === Archived Tasks ===
|
|
664
|
-
describe('Archived Task Migration', () => {
|
|
665
|
-
it('should migrate archived tasks separately', async () => {
|
|
666
|
-
const activeTasks = [createFullTask('T001')];
|
|
667
|
-
const archivedTasks = [
|
|
668
|
-
createFullTask('T100', { status: 'done' }),
|
|
669
|
-
createFullTask('T101', { status: 'done' }),
|
|
670
|
-
];
|
|
671
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(activeTasks)));
|
|
672
|
-
await writeFile(join(cleoDir, 'todo-archive.json'), JSON.stringify(createArchiveJson(archivedTasks)));
|
|
673
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
674
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
675
|
-
const result = await migrateJsonToSqlite();
|
|
676
|
-
expect(result.success).toBe(true);
|
|
677
|
-
expect(result.tasksImported).toBe(1);
|
|
678
|
-
expect(result.archivedImported).toBe(2);
|
|
679
|
-
});
|
|
680
|
-
it('should preserve archived task metadata', async () => {
|
|
681
|
-
const archivedTask = {
|
|
682
|
-
...createFullTask('T100', { status: 'done' }),
|
|
683
|
-
archivedAt: '2026-01-15T00:00:00.000Z',
|
|
684
|
-
archiveReason: 'completed',
|
|
685
|
-
cycleTimeDays: 14,
|
|
686
|
-
};
|
|
687
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson()));
|
|
688
|
-
await writeFile(join(cleoDir, 'todo-archive.json'), JSON.stringify(createArchiveJson([archivedTask])));
|
|
689
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
690
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
691
|
-
await migrateJsonToSqlite();
|
|
692
|
-
const { getDb } = await import('../sqlite.js');
|
|
693
|
-
const { tasks } = await import('../tasks-schema.js');
|
|
694
|
-
const { eq } = await import('drizzle-orm');
|
|
695
|
-
const db = await getDb();
|
|
696
|
-
const archivedRows = await db.select().from(tasks).where(eq(tasks.status, 'archived')).all();
|
|
697
|
-
expect(archivedRows.length).toBe(1);
|
|
698
|
-
expect(archivedRows[0].archivedAt).toBeDefined();
|
|
699
|
-
});
|
|
700
|
-
});
|
|
701
|
-
// === Complex Scenarios ===
|
|
702
|
-
describe('Complex Scenarios', () => {
|
|
703
|
-
it('should handle large datasets efficiently', async () => {
|
|
704
|
-
const manyTasks = Array.from({ length: 100 }, (_, i) => createFullTask(`T${String(i + 1).padStart(3, '0')}`));
|
|
705
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(manyTasks)));
|
|
706
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
707
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
708
|
-
const startTime = Date.now();
|
|
709
|
-
const result = await migrateJsonToSqlite();
|
|
710
|
-
const duration = Date.now() - startTime;
|
|
711
|
-
expect(result.success).toBe(true);
|
|
712
|
-
expect(result.tasksImported).toBe(100);
|
|
713
|
-
expect(duration).toBeLessThan(30000); // Should complete within 30 seconds
|
|
714
|
-
});
|
|
715
|
-
it('should handle tasks with circular references gracefully', async () => {
|
|
716
|
-
// Note: This tests that the migration doesn't crash on complex data
|
|
717
|
-
// Actual circular dependency handling depends on the application logic
|
|
718
|
-
const tasks = [
|
|
719
|
-
createFullTask('T001'),
|
|
720
|
-
createFullTask('T002', { depends: ['T001'] }),
|
|
721
|
-
createFullTask('T003', { depends: ['T002'] }),
|
|
722
|
-
];
|
|
723
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson(tasks)));
|
|
724
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
725
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
726
|
-
const result = await migrateJsonToSqlite();
|
|
727
|
-
expect(result.success).toBe(true);
|
|
728
|
-
const { getTask } = await import('../task-store.js');
|
|
729
|
-
const t2 = await getTask('T002');
|
|
730
|
-
const t3 = await getTask('T003');
|
|
731
|
-
expect(t2.depends).toContain('T001');
|
|
732
|
-
expect(t3.depends).toContain('T002');
|
|
733
|
-
});
|
|
734
|
-
it('should handle missing optional fields gracefully', async () => {
|
|
735
|
-
const minimalTask = {
|
|
736
|
-
id: 'T001',
|
|
737
|
-
title: 'Minimal Task',
|
|
738
|
-
status: 'pending',
|
|
739
|
-
priority: 'medium',
|
|
740
|
-
createdAt: '2026-01-01T00:00:00.000Z',
|
|
741
|
-
// Missing many optional fields
|
|
742
|
-
};
|
|
743
|
-
await writeFile(join(cleoDir, 'todo.json'), JSON.stringify(createTodoJson([minimalTask])));
|
|
744
|
-
await writeFile(join(cleoDir, 'sessions.json'), JSON.stringify(createSessionsJson()));
|
|
745
|
-
const { migrateJsonToSqlite } = await import('../migration-sqlite.js');
|
|
746
|
-
const result = await migrateJsonToSqlite();
|
|
747
|
-
expect(result.success).toBe(true);
|
|
748
|
-
expect(result.tasksImported).toBe(1);
|
|
749
|
-
const { getTask } = await import('../task-store.js');
|
|
750
|
-
const task = await getTask('T001');
|
|
751
|
-
expect(task).not.toBeNull();
|
|
752
|
-
expect(task.title).toBe('Minimal Task');
|
|
753
|
-
});
|
|
754
|
-
});
|
|
755
|
-
});
|
|
756
|
-
//# sourceMappingURL=migration-safety.test.js.map
|