agentera 3.0.0-dev.5 → 3.0.0-dev.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/README.md +4 -3
- package/bundle/extract-corpus-parity.json +23 -0
- package/bundle/references/adapters/cursor.md +10 -9
- package/bundle/references/adapters/opencode.md +26 -26
- package/bundle/references/adapters/package-registry.yaml +0 -1
- package/bundle/references/adapters/package-surface-characterization.md +1 -2
- package/bundle/references/adapters/runtime-adapter-characterization.md +1 -1
- package/bundle/references/adapters/runtime-adapter-registry.yaml +16 -10
- package/bundle/references/adapters/runtime-feature-parity.md +2 -2
- package/bundle/references/analysis/benchmark.md +1 -1
- package/bundle/references/analysis/startup-measurement-contract.yaml +18 -18
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +4 -3
- package/bundle/references/cli/agent-ready-state-contract.yaml +6 -6
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +4 -4
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +40 -26
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +1 -29
- package/bundle/references/cli/capability-tool-classification.yaml +12 -12
- package/bundle/references/cli/coexistence-probe.yaml +13 -0
- package/bundle/references/cli/parity-expected-actual-template.md +30 -0
- package/bundle/references/cli/routing-execution-vocabulary.yaml +6 -6
- package/bundle/references/cli/routing-model.md +96 -0
- package/bundle/references/cli/single-name-protocol.yaml +42 -0
- package/bundle/references/cli/trigger-schema-enrichment.md +136 -0
- package/bundle/references/cli/update-channels.yaml +16 -0
- package/bundle/references/cli/upgrade-repair-wording.md +45 -0
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +98 -0
- package/bundle/references/cli/vocabulary-index.yaml +17 -12
- package/bundle/references/cli/vocabulary.md +316 -309
- package/bundle/references/meta/documentation-inventory.md +9 -3
- package/bundle/registry.json +13 -13
- package/bundle/skills/agentera/.claude-plugin/plugin.json +13 -13
- package/bundle/skills/agentera/SKILL.md +99 -415
- package/bundle/skills/agentera/agents/audit.toml +6 -0
- package/bundle/skills/agentera/agents/build.toml +6 -0
- package/bundle/skills/agentera/agents/design.toml +6 -0
- package/bundle/skills/agentera/agents/{planera.toml → discuss.toml} +3 -3
- package/bundle/skills/agentera/agents/{resonera.toml → document.toml} +3 -3
- package/bundle/skills/agentera/agents/{optimera.toml → optimize.toml} +2 -2
- package/bundle/skills/agentera/agents/orchestrate.toml +6 -0
- package/bundle/skills/agentera/agents/plan.toml +6 -0
- package/bundle/skills/agentera/agents/profile.toml +6 -0
- package/bundle/skills/agentera/agents/research.toml +6 -0
- package/bundle/skills/agentera/agents/status.toml +6 -0
- package/bundle/skills/agentera/agents/vision.toml +6 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/triggers.yaml +15 -6
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +9 -9
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/artifacts.yaml +11 -11
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/triggers.yaml +13 -3
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/triggers.yaml +15 -3
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/validation.yaml +4 -4
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/triggers.yaml +14 -3
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/triggers.yaml +16 -3
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/validation.yaml +27 -27
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/triggers.yaml +15 -3
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/validation.yaml +3 -3
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/artifacts.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +2 -1
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/triggers.yaml +7 -3
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/artifacts.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/triggers.yaml +9 -3
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/artifacts.yaml +14 -11
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/triggers.yaml +10 -4
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/triggers.yaml +17 -3
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capability_schema_contract.yaml +178 -34
- package/bundle/skills/agentera/protocol.yaml +29 -29
- package/bundle/skills/agentera/references/contract.md +328 -319
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +9 -9
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +8 -7
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +40 -35
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
- package/dist/analytics/extractCorpus/cli.js +149 -0
- package/dist/analytics/extractCorpus/cli.js.map +1 -0
- package/dist/analytics/extractCorpus/copilotSessions.js +273 -0
- package/dist/analytics/extractCorpus/copilotSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/core.js +364 -0
- package/dist/analytics/extractCorpus/core.js.map +1 -0
- package/dist/analytics/extractCorpus/corpus.js +145 -0
- package/dist/analytics/extractCorpus/corpus.js.map +1 -0
- package/dist/analytics/extractCorpus/coverageAudit.js +261 -0
- package/dist/analytics/extractCorpus/coverageAudit.js.map +1 -0
- package/dist/analytics/extractCorpus/cursorSessions.js +423 -0
- package/dist/analytics/extractCorpus/cursorSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +105 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js.map +1 -0
- package/dist/analytics/extractCorpus/filesystemSources.js +122 -0
- package/dist/analytics/extractCorpus/filesystemSources.js.map +1 -0
- package/dist/analytics/extractCorpus/index.js +12 -0
- package/dist/analytics/extractCorpus/index.js.map +1 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js +185 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js +44 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js +368 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js.map +1 -0
- package/dist/analytics/extractCorpus.js +2 -1790
- package/dist/analytics/extractCorpus.js.map +1 -1
- package/dist/analytics/usageStats.js +20 -20
- package/dist/analytics/usageStats.js.map +1 -1
- package/dist/capabilities/audit/instructions.js +6 -0
- package/dist/capabilities/audit/instructions.js.map +1 -0
- package/dist/capabilities/build/instructions.js +6 -0
- package/dist/capabilities/build/instructions.js.map +1 -0
- package/dist/capabilities/design/instructions.js +5 -0
- package/dist/capabilities/design/instructions.js.map +1 -0
- package/dist/capabilities/discuss/instructions.js +6 -0
- package/dist/capabilities/discuss/instructions.js.map +1 -0
- package/dist/capabilities/document/instructions.js +6 -0
- package/dist/capabilities/document/instructions.js.map +1 -0
- package/dist/capabilities/index.js +24 -24
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/inspirera/instructions.js +1 -1
- package/dist/capabilities/inspirera/instructions.js.map +1 -1
- package/dist/capabilities/optimize/instructions.js +6 -0
- package/dist/capabilities/optimize/instructions.js.map +1 -0
- package/dist/capabilities/orchestrate/instructions.js +6 -0
- package/dist/capabilities/orchestrate/instructions.js.map +1 -0
- package/dist/capabilities/plan/instructions.js +6 -0
- package/dist/capabilities/plan/instructions.js.map +1 -0
- package/dist/capabilities/planera/instructions.js +1 -1
- package/dist/capabilities/planera/instructions.js.map +1 -1
- package/dist/capabilities/profile/instructions.js +6 -0
- package/dist/capabilities/profile/instructions.js.map +1 -0
- package/dist/capabilities/profilera/instructions.js +1 -1
- package/dist/capabilities/profilera/instructions.js.map +1 -1
- package/dist/capabilities/realisera/instructions.js +1 -1
- package/dist/capabilities/realisera/instructions.js.map +1 -1
- package/dist/capabilities/research/instructions.js +6 -0
- package/dist/capabilities/research/instructions.js.map +1 -0
- package/dist/capabilities/resonera/instructions.js +1 -1
- package/dist/capabilities/resonera/instructions.js.map +1 -1
- package/dist/capabilities/status/instructions.js +6 -0
- package/dist/capabilities/status/instructions.js.map +1 -0
- package/dist/capabilities/vision/instructions.js +6 -0
- package/dist/capabilities/vision/instructions.js.map +1 -0
- package/dist/capabilities/visionera/instructions.js +1 -1
- package/dist/capabilities/visionera/instructions.js.map +1 -1
- package/dist/capabilities/visualisera/instructions.js +3 -4
- package/dist/capabilities/visualisera/instructions.js.map +1 -1
- package/dist/cli/appContext.js +16 -17
- package/dist/cli/appContext.js.map +1 -1
- package/dist/cli/capabilityContext/benchmark.js +564 -0
- package/dist/cli/capabilityContext/benchmark.js.map +1 -0
- package/dist/cli/capabilityContext/bespoke.js +36 -0
- package/dist/cli/capabilityContext/bespoke.js.map +1 -0
- package/dist/cli/capabilityContext/build.js +177 -0
- package/dist/cli/capabilityContext/build.js.map +1 -0
- package/dist/cli/capabilityContext/closeout.js +230 -0
- package/dist/cli/capabilityContext/closeout.js.map +1 -0
- package/dist/cli/capabilityContext/contract.js +188 -0
- package/dist/cli/capabilityContext/contract.js.map +1 -0
- package/dist/cli/capabilityContext/evidence.js +456 -0
- package/dist/cli/capabilityContext/evidence.js.map +1 -0
- package/dist/cli/capabilityContext/index.js +4 -0
- package/dist/cli/capabilityContext/index.js.map +1 -0
- package/dist/cli/capabilityContext/orchestration.js +107 -0
- package/dist/cli/capabilityContext/orchestration.js.map +1 -0
- package/dist/cli/capabilityContext/planState.js +271 -0
- package/dist/cli/capabilityContext/planState.js.map +1 -0
- package/dist/cli/capabilityContext/progress.js +103 -0
- package/dist/cli/capabilityContext/progress.js.map +1 -0
- package/dist/cli/capabilityContext/realisera.js +174 -0
- package/dist/cli/capabilityContext/realisera.js.map +1 -0
- package/dist/cli/capabilityContext/shared.js +94 -0
- package/dist/cli/capabilityContext/shared.js.map +1 -0
- package/dist/cli/capabilityContext/slim.js +108 -0
- package/dist/cli/capabilityContext/slim.js.map +1 -0
- package/dist/cli/capabilityContext/startup.js +213 -0
- package/dist/cli/capabilityContext/startup.js.map +1 -0
- package/dist/cli/capabilityContext/types.js +40 -0
- package/dist/cli/capabilityContext/types.js.map +1 -0
- package/dist/cli/capabilityContext.js +1 -2486
- package/dist/cli/capabilityContext.js.map +1 -1
- package/dist/cli/commands/appHome.js +23 -0
- package/dist/cli/commands/appHome.js.map +1 -0
- package/dist/cli/commands/backfill.js +84 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/capability.js +2 -2
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/cli/commands/compact.js +1 -1
- package/dist/cli/commands/compact.js.map +1 -1
- package/dist/cli/commands/doctor.js +17 -98
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/lint.js +4 -36
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/prime/bundleStatus.js +140 -0
- package/dist/cli/commands/prime/bundleStatus.js.map +1 -0
- package/dist/cli/commands/prime/collectOrientationState.js +156 -0
- package/dist/cli/commands/prime/collectOrientationState.js.map +1 -0
- package/dist/cli/commands/prime/orientationOutput.js +210 -0
- package/dist/cli/commands/prime/orientationOutput.js.map +1 -0
- package/dist/cli/commands/prime/routeOutput.js +50 -0
- package/dist/cli/commands/prime/routeOutput.js.map +1 -0
- package/dist/cli/commands/prime/types.js +2 -0
- package/dist/cli/commands/prime/types.js.map +1 -0
- package/dist/cli/commands/prime/v1Migration.js +39 -0
- package/dist/cli/commands/prime/v1Migration.js.map +1 -0
- package/dist/cli/commands/prime.js +11 -554
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/query.js +5 -2
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/report.js +27 -10
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/schema.js +24 -20
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/decisions.js +403 -0
- package/dist/cli/commands/state/decisions.js.map +1 -0
- package/dist/cli/commands/state/docs.js +97 -0
- package/dist/cli/commands/state/docs.js.map +1 -0
- package/dist/cli/commands/state/experiments.js +68 -0
- package/dist/cli/commands/state/experiments.js.map +1 -0
- package/dist/cli/commands/state/health.js +116 -0
- package/dist/cli/commands/state/health.js.map +1 -0
- package/dist/cli/commands/state/index.js +51 -0
- package/dist/cli/commands/state/index.js.map +1 -0
- package/dist/cli/commands/state/objective.js +69 -0
- package/dist/cli/commands/state/objective.js.map +1 -0
- package/dist/cli/commands/state/plan.js +173 -0
- package/dist/cli/commands/state/plan.js.map +1 -0
- package/dist/cli/commands/state/progress.js +47 -0
- package/dist/cli/commands/state/progress.js.map +1 -0
- package/dist/cli/commands/state/shared.js +15 -0
- package/dist/cli/commands/state/shared.js.map +1 -0
- package/dist/cli/commands/state/todo.js +121 -0
- package/dist/cli/commands/state/todo.js.map +1 -0
- package/dist/cli/commands/state.js +7 -7
- package/dist/cli/commands/state.js.map +1 -1
- package/dist/cli/commands/validate.js +50 -100
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/verify.js +1 -1
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/contracts/bundleStatus.js +2 -0
- package/dist/cli/contracts/bundleStatus.js.map +1 -0
- package/dist/cli/contracts/orientationState.js +2 -0
- package/dist/cli/contracts/orientationState.js.map +1 -0
- package/dist/cli/dispatch/argvParser.js +33 -0
- package/dist/cli/dispatch/argvParser.js.map +1 -0
- package/dist/cli/dispatch/check.js +328 -0
- package/dist/cli/dispatch/check.js.map +1 -0
- package/dist/cli/dispatch/commands.js +27 -0
- package/dist/cli/dispatch/commands.js.map +1 -0
- package/dist/cli/dispatch/index.js +182 -0
- package/dist/cli/dispatch/index.js.map +1 -0
- package/dist/cli/dispatch/lifecycle.js +597 -0
- package/dist/cli/dispatch/lifecycle.js.map +1 -0
- package/dist/cli/dispatch/prime.js +104 -0
- package/dist/cli/dispatch/prime.js.map +1 -0
- package/dist/cli/dispatch/shared.js +64 -0
- package/dist/cli/dispatch/shared.js.map +1 -0
- package/dist/cli/dispatch/state.js +144 -0
- package/dist/cli/dispatch/state.js.map +1 -0
- package/dist/cli/dispatch.js +1 -1293
- package/dist/cli/dispatch.js.map +1 -1
- package/dist/cli/help.js +41 -8
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/orientation/attention.js +61 -0
- package/dist/cli/orientation/attention.js.map +1 -0
- package/dist/cli/orientation/corpusCoverage.js +71 -0
- package/dist/cli/orientation/corpusCoverage.js.map +1 -0
- package/dist/cli/orientation.js +129 -78
- package/dist/cli/orientation.js.map +1 -1
- package/dist/cli/prime-blob.js +1 -1
- package/dist/cli/startupCompletenessContract.js +56 -0
- package/dist/cli/startupCompletenessContract.js.map +1 -0
- package/dist/cli/stateQuery.js +9 -2
- package/dist/cli/stateQuery.js.map +1 -1
- package/dist/cli/todoSeverity.js +19 -0
- package/dist/cli/todoSeverity.js.map +1 -0
- package/dist/core/envPaths.js +21 -0
- package/dist/core/envPaths.js.map +1 -0
- package/dist/core/git.js +43 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/jsonValue.js +6 -0
- package/dist/core/jsonValue.js.map +1 -0
- package/dist/core/pyjson.js +67 -2
- package/dist/core/pyjson.js.map +1 -1
- package/dist/eval/evalSkills.js +17 -12
- package/dist/eval/evalSkills.js.map +1 -1
- package/dist/eval/semanticEval.js +43 -19
- package/dist/eval/semanticEval.js.map +1 -1
- package/dist/eval/semanticFixtures.js +16 -4
- package/dist/eval/semanticFixtures.js.map +1 -1
- package/dist/hooks/common.js +8 -23
- package/dist/hooks/common.js.map +1 -1
- package/dist/hooks/compaction/apply.js +269 -0
- package/dist/hooks/compaction/apply.js.map +1 -0
- package/dist/hooks/compaction/dryRun.js +183 -0
- package/dist/hooks/compaction/dryRun.js.map +1 -0
- package/dist/hooks/compaction/index.js +23 -0
- package/dist/hooks/compaction/index.js.map +1 -0
- package/dist/hooks/compaction/parse.js +258 -0
- package/dist/hooks/compaction/parse.js.map +1 -0
- package/dist/hooks/compaction/retention.js +199 -0
- package/dist/hooks/compaction/retention.js.map +1 -0
- package/dist/hooks/compaction/status.js +241 -0
- package/dist/hooks/compaction/status.js.map +1 -0
- package/dist/hooks/compaction/todoResolved.js +137 -0
- package/dist/hooks/compaction/todoResolved.js.map +1 -0
- package/dist/hooks/compaction/types.js +6 -0
- package/dist/hooks/compaction/types.js.map +1 -0
- package/dist/hooks/compaction.js +20 -20
- package/dist/hooks/compaction.js.map +1 -1
- package/dist/hooks/cursorPreToolUse.js +1 -1
- package/dist/hooks/cursorPreToolUse.js.map +1 -1
- package/dist/hooks/cursorSessionStart.js +10 -2
- package/dist/hooks/cursorSessionStart.js.map +1 -1
- package/dist/hooks/sessionStart.js +18 -11
- package/dist/hooks/sessionStart.js.map +1 -1
- package/dist/hooks/sessionStop.js +6 -12
- package/dist/hooks/sessionStop.js.map +1 -1
- package/dist/hooks/todoLayout.js +177 -0
- package/dist/hooks/todoLayout.js.map +1 -0
- package/dist/hooks/validateArtifact/agentFacing.js +10 -0
- package/dist/hooks/validateArtifact/agentFacing.js.map +1 -0
- package/dist/hooks/validateArtifact/index.js +151 -0
- package/dist/hooks/validateArtifact/index.js.map +1 -0
- package/dist/hooks/validateArtifact/markdown.js +146 -0
- package/dist/hooks/validateArtifact/markdown.js.map +1 -0
- package/dist/hooks/validateArtifact/runtime.js +86 -0
- package/dist/hooks/validateArtifact/runtime.js.map +1 -0
- package/dist/hooks/validateArtifact/schema.js +459 -0
- package/dist/hooks/validateArtifact/schema.js.map +1 -0
- package/dist/hooks/validateArtifact/traversal.js +106 -0
- package/dist/hooks/validateArtifact/traversal.js.map +1 -0
- package/dist/hooks/validateArtifact/violations.js +105 -0
- package/dist/hooks/validateArtifact/violations.js.map +1 -0
- package/dist/hooks/validateArtifact.js +29 -40
- package/dist/hooks/validateArtifact.js.map +1 -1
- package/dist/migrate/v2HandoffManifest.js +447 -0
- package/dist/migrate/v2HandoffManifest.js.map +1 -0
- package/dist/registries/artifactProtocolIds.js +77 -0
- package/dist/registries/artifactProtocolIds.js.map +1 -0
- package/dist/registries/artifactRegistry.js +23 -9
- package/dist/registries/artifactRegistry.js.map +1 -1
- package/dist/registries/capabilityContract.js +144 -1
- package/dist/registries/capabilityContract.js.map +1 -1
- package/dist/registries/evaluatorHandoffContract.js +2 -2
- package/dist/registries/evaluatorHandoffContract.js.map +1 -1
- package/dist/registries/packageRegistry.js +4 -3
- package/dist/registries/packageRegistry.js.map +1 -1
- package/dist/registries/runtimeAdapterRegistry.js +5 -4
- package/dist/registries/runtimeAdapterRegistry.js.map +1 -1
- package/dist/registries/triggerLoader.js +211 -0
- package/dist/registries/triggerLoader.js.map +1 -0
- package/dist/release/releaseMetadata.js +235 -0
- package/dist/release/releaseMetadata.js.map +1 -0
- package/dist/routing/index.js +2 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/routeEngine.js +189 -0
- package/dist/routing/routeEngine.js.map +1 -0
- package/dist/setup/codex/agents.js +96 -0
- package/dist/setup/codex/agents.js.map +1 -0
- package/dist/setup/codex/cli.js +161 -0
- package/dist/setup/codex/cli.js.map +1 -0
- package/dist/setup/codex/configToml.js +639 -0
- package/dist/setup/codex/configToml.js.map +1 -0
- package/dist/setup/codex/constants.js +29 -0
- package/dist/setup/codex/constants.js.map +1 -0
- package/dist/setup/codex/installRoot.js +64 -0
- package/dist/setup/codex/installRoot.js.map +1 -0
- package/dist/setup/codex/state.js +270 -0
- package/dist/setup/codex/state.js.map +1 -0
- package/dist/setup/codex.js +11 -1196
- package/dist/setup/codex.js.map +1 -1
- package/dist/setup/cursor.js +6 -4
- package/dist/setup/cursor.js.map +1 -1
- package/dist/setup/cursorSurfaces.js +67 -0
- package/dist/setup/cursorSurfaces.js.map +1 -0
- package/dist/setup/doctor/core.js +300 -0
- package/dist/setup/doctor/core.js.map +1 -0
- package/dist/setup/doctor/diagnostics.js +240 -0
- package/dist/setup/doctor/diagnostics.js.map +1 -0
- package/dist/setup/doctor/opencode.js +313 -0
- package/dist/setup/doctor/opencode.js.map +1 -0
- package/dist/setup/doctor/report.js +425 -0
- package/dist/setup/doctor/report.js.map +1 -0
- package/dist/setup/doctor.js +9 -1296
- package/dist/setup/doctor.js.map +1 -1
- package/dist/setup/opencode.js +13 -0
- package/dist/setup/opencode.js.map +1 -0
- package/dist/setup/smokeChecks.js +11 -11
- package/dist/setup/smokeChecks.js.map +1 -1
- package/dist/state/installRoot.js +49 -18
- package/dist/state/installRoot.js.map +1 -1
- package/dist/state/progressCommit.js +289 -0
- package/dist/state/progressCommit.js.map +1 -0
- package/dist/state/startupAnalysis/benchmark.js +371 -0
- package/dist/state/startupAnalysis/benchmark.js.map +1 -0
- package/dist/state/startupAnalysis/contract.js +126 -0
- package/dist/state/startupAnalysis/contract.js.map +1 -0
- package/dist/state/startupAnalysis/helpers.js +287 -0
- package/dist/state/startupAnalysis/helpers.js.map +1 -0
- package/dist/state/startupAnalysis/index.js +7 -0
- package/dist/state/startupAnalysis/index.js.map +1 -0
- package/dist/state/startupAnalysis/metrics.js +341 -0
- package/dist/state/startupAnalysis/metrics.js.map +1 -0
- package/dist/state/startupAnalysis/records.js +199 -0
- package/dist/state/startupAnalysis/records.js.map +1 -0
- package/dist/state/startupAnalysis/report.js +112 -0
- package/dist/state/startupAnalysis/report.js.map +1 -0
- package/dist/state/startupAnalysis/threshold.js +500 -0
- package/dist/state/startupAnalysis/threshold.js.map +1 -0
- package/dist/state/startupAnalysis.js +2 -1952
- package/dist/state/startupAnalysis.js.map +1 -1
- package/dist/upgrade/appContentRefresh.js +342 -0
- package/dist/upgrade/appContentRefresh.js.map +1 -0
- package/dist/upgrade/appModel.js +8 -6
- package/dist/upgrade/appModel.js.map +1 -1
- package/dist/upgrade/bundleEvidence.js +34 -0
- package/dist/upgrade/bundleEvidence.js.map +1 -0
- package/dist/upgrade/channels.js +11 -4
- package/dist/upgrade/channels.js.map +1 -1
- package/dist/upgrade/cliProbe.js +22 -0
- package/dist/upgrade/cliProbe.js.map +1 -0
- package/dist/upgrade/coexistenceProbe.js +107 -0
- package/dist/upgrade/coexistenceProbe.js.map +1 -0
- package/dist/upgrade/compatibility.js +13 -4
- package/dist/upgrade/compatibility.js.map +1 -1
- package/dist/upgrade/doctor.js +165 -183
- package/dist/upgrade/doctor.js.map +1 -1
- package/dist/upgrade/doctorClassifier.js +177 -0
- package/dist/upgrade/doctorClassifier.js.map +1 -0
- package/dist/upgrade/installedHooksRetirement.js +190 -0
- package/dist/upgrade/installedHooksRetirement.js.map +1 -0
- package/dist/upgrade/legacyAgentCleanup.js +116 -0
- package/dist/upgrade/legacyAgentCleanup.js.map +1 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +57 -109
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
- package/dist/upgrade/nextMajorDoctor.js +42 -7
- package/dist/upgrade/nextMajorDoctor.js.map +1 -1
- package/dist/upgrade/npxPlatformStatus.js +23 -0
- package/dist/upgrade/npxPlatformStatus.js.map +1 -0
- package/dist/upgrade/projectIntegration.js +69 -73
- package/dist/upgrade/projectIntegration.js.map +1 -1
- package/dist/upgrade/projectIntegrationDecision.js +93 -0
- package/dist/upgrade/projectIntegrationDecision.js.map +1 -0
- package/dist/upgrade/runtimeMigration.js +169 -68
- package/dist/upgrade/runtimeMigration.js.map +1 -1
- package/dist/upgrade/v3CapabilitySurface.js +15 -0
- package/dist/upgrade/v3CapabilitySurface.js.map +1 -0
- package/dist/upgrade/versionResolution.js +8 -0
- package/dist/upgrade/versionResolution.js.map +1 -1
- package/dist/validate/appHomeContract.js +4 -4
- package/dist/validate/appHomeContract.js.map +1 -1
- package/dist/validate/capability.js +124 -11
- package/dist/validate/capability.js.map +1 -1
- package/dist/validate/crossCapability.js +1 -1
- package/dist/validate/crossCapability.js.map +1 -1
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js +93 -0
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +1 -0
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js +488 -0
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +1 -0
- package/dist/validate/lifecycleAdapters/shared.js +198 -0
- package/dist/validate/lifecycleAdapters/shared.js.map +1 -0
- package/dist/validate/lifecycleAdapters.js +13 -723
- package/dist/validate/lifecycleAdapters.js.map +1 -1
- package/dist/validate/selfAudit.js +62 -20
- package/dist/validate/selfAudit.js.map +1 -1
- package/dist/validate/vocabularyAuthority.js +303 -0
- package/dist/validate/vocabularyAuthority.js.map +1 -0
- package/package.json +27 -24
- package/bundle/references/v1-section-mapping.md +0 -47
- package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
- package/bundle/skills/agentera/agents/hej.toml +0 -6
- package/bundle/skills/agentera/agents/inspektera.toml +0 -6
- package/bundle/skills/agentera/agents/inspirera.toml +0 -6
- package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
- package/bundle/skills/agentera/agents/profilera.toml +0 -6
- package/bundle/skills/agentera/agents/realisera.toml +0 -6
- package/bundle/skills/agentera/agents/visionera.toml +0 -6
- package/bundle/skills/agentera/agents/visualisera.toml +0 -6
- package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
- package/bundle/skills/hej/SKILL.md +0 -69
- package/bundle/skills/hej/agents/hej.toml +0 -11
- package/bundle/skills/hej/agents/openai.yaml +0 -8
- /package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `state health` query (HEALTH.md / health.yaml audits).
|
|
3
|
+
*
|
|
4
|
+
* Surfaces the latest health audit by `number`, optionally filtered
|
|
5
|
+
* by dimension (a grade key or a dimensions_detail.name substring).
|
|
6
|
+
*/
|
|
7
|
+
import { asList, emitStateStructured, extractEntries, loadArtifact, missingSchemaError, sourceMetadata, structuredState, } from "../../stateQuery.js";
|
|
8
|
+
import { artifactPath } from "../../appContext.js";
|
|
9
|
+
import { out, err } from "./shared.js";
|
|
10
|
+
export function healthAuditNumber(entry) {
|
|
11
|
+
const number = entry.number;
|
|
12
|
+
if (typeof number === "number" && Number.isInteger(number))
|
|
13
|
+
return number;
|
|
14
|
+
if (typeof number === "string" && /^\d+$/.test(number))
|
|
15
|
+
return parseInt(number, 10);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
export function latestHealthAudit(entries) {
|
|
19
|
+
if (entries.length === 0)
|
|
20
|
+
return null;
|
|
21
|
+
let best = null;
|
|
22
|
+
let bestNumber = -1;
|
|
23
|
+
for (const entry of entries) {
|
|
24
|
+
const number = healthAuditNumber(entry);
|
|
25
|
+
if (number === null)
|
|
26
|
+
continue;
|
|
27
|
+
if (number > bestNumber) {
|
|
28
|
+
bestNumber = number;
|
|
29
|
+
best = entry;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return best !== null ? best : entries[entries.length - 1];
|
|
33
|
+
}
|
|
34
|
+
export function queryHealth(args, schemas, io) {
|
|
35
|
+
const o = out(io);
|
|
36
|
+
const e = err(io);
|
|
37
|
+
const info = schemas.health;
|
|
38
|
+
if (!info) {
|
|
39
|
+
e(missingSchemaError("health") + "\n");
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
const p = artifactPath(info, "health");
|
|
43
|
+
const data = loadArtifact(p);
|
|
44
|
+
const entries = extractEntries(data);
|
|
45
|
+
const dimension = args.dimension ?? null;
|
|
46
|
+
let latest = latestHealthAudit(entries);
|
|
47
|
+
let latestEntries = latest ? [latest] : [];
|
|
48
|
+
if (dimension && latestEntries.length > 0) {
|
|
49
|
+
latest = latestEntries[0];
|
|
50
|
+
const dimLower = dimension.toLowerCase();
|
|
51
|
+
let matched = false;
|
|
52
|
+
const grades = latest.grades;
|
|
53
|
+
if (grades && typeof grades === "object" && !Array.isArray(grades)) {
|
|
54
|
+
matched = Object.keys(grades).some((gk) => String(gk).toLowerCase().includes(dimLower));
|
|
55
|
+
}
|
|
56
|
+
const details = latest.dimensions_detail;
|
|
57
|
+
if (Array.isArray(details)) {
|
|
58
|
+
matched =
|
|
59
|
+
matched ||
|
|
60
|
+
details.some((d) => d && typeof d === "object" && !Array.isArray(d) && String(d.name ?? "").toLowerCase().includes(dimLower));
|
|
61
|
+
}
|
|
62
|
+
if (!matched)
|
|
63
|
+
latestEntries = [];
|
|
64
|
+
}
|
|
65
|
+
const format = args.format ?? "text";
|
|
66
|
+
if (format !== "text") {
|
|
67
|
+
return emitStateStructured("health", structuredState("health", latestEntries, sourceMetadata("health", p), {
|
|
68
|
+
filters: { dimension },
|
|
69
|
+
summary: { latest_only: true },
|
|
70
|
+
}), format, args.fields, o, e);
|
|
71
|
+
}
|
|
72
|
+
if (entries.length === 0)
|
|
73
|
+
return 0;
|
|
74
|
+
latest = latestHealthAudit(entries);
|
|
75
|
+
if (!latest)
|
|
76
|
+
return 0;
|
|
77
|
+
if (dimension) {
|
|
78
|
+
const dimLower = dimension.toLowerCase();
|
|
79
|
+
// cast: latest.grades is read from a parsed health.yaml audit entry (IO boundary)
|
|
80
|
+
const grades = (latest.grades ?? {});
|
|
81
|
+
let matched = false;
|
|
82
|
+
for (const [gk, gv] of Object.entries(grades)) {
|
|
83
|
+
if (String(gk).toLowerCase().includes(dimLower)) {
|
|
84
|
+
o(`${gk}: ${gv}\n`);
|
|
85
|
+
matched = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const details = asList(latest.dimensions_detail);
|
|
89
|
+
for (const d of details) {
|
|
90
|
+
const dn = String(d.name ?? "");
|
|
91
|
+
if (dn.toLowerCase().includes(dimLower)) {
|
|
92
|
+
const summary = d.summary ?? "";
|
|
93
|
+
if (summary)
|
|
94
|
+
o(` ${summary}\n`);
|
|
95
|
+
for (const f of asList(d.findings)) {
|
|
96
|
+
o(` [${f.severity ?? ""}] ${f.heading ?? ""}\n`);
|
|
97
|
+
}
|
|
98
|
+
matched = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!matched)
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const num = latest.number ?? "?";
|
|
106
|
+
const traj = latest.trajectory ?? "";
|
|
107
|
+
o(`Audit ${num}: ${traj}\n`);
|
|
108
|
+
// cast: latest.grades is read from a parsed health.yaml audit entry (IO boundary)
|
|
109
|
+
const grades = (latest.grades ?? {});
|
|
110
|
+
for (const [gk, gv] of Object.entries(grades)) {
|
|
111
|
+
o(` ${gk}: ${gv}\n`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,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AI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9C,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface for the `state <name>` command family.
|
|
3
|
+
*
|
|
4
|
+
* The `cmdState` entry point validates the incoming args, loads the
|
|
5
|
+
* schema directory, and dispatches to the per-state-family handler
|
|
6
|
+
* in `STATE_COMMAND_HANDLERS`. The `isPortedStateCommand` predicate
|
|
7
|
+
* is the public surface used by `cli/dispatch.ts` to decide whether
|
|
8
|
+
* a top-level token is a state command or a deprecated alias.
|
|
9
|
+
*/
|
|
10
|
+
import { COMMAND_FILTERS, validateFilterValues } from "../../stateQuery.js";
|
|
11
|
+
import { loadSchemas, discoverSchemasDir } from "../../appContext.js";
|
|
12
|
+
import { err } from "./shared.js";
|
|
13
|
+
import { queryProgress } from "./progress.js";
|
|
14
|
+
import { queryPlan } from "./plan.js";
|
|
15
|
+
import { queryHealth, healthAuditNumber, latestHealthAudit } from "./health.js";
|
|
16
|
+
import { queryDocs } from "./docs.js";
|
|
17
|
+
import { queryObjective } from "./objective.js";
|
|
18
|
+
import { queryExperiments } from "./experiments.js";
|
|
19
|
+
import { queryTodo, normalizeSeverity } from "./todo.js";
|
|
20
|
+
import { queryDecisions, decisionContextEntry, decisionSatisfactionContext, decisionSourceContract, extractDecisionEntries, displayFields, } from "./decisions.js";
|
|
21
|
+
export { queryProgress, queryPlan, queryHealth, queryDocs, queryObjective, queryExperiments, queryTodo, queryDecisions, healthAuditNumber, latestHealthAudit, normalizeSeverity, decisionContextEntry, decisionSatisfactionContext, decisionSourceContract, extractDecisionEntries, displayFields, };
|
|
22
|
+
const STATE_COMMAND_HANDLERS = {
|
|
23
|
+
progress: queryProgress,
|
|
24
|
+
plan: queryPlan,
|
|
25
|
+
health: queryHealth,
|
|
26
|
+
docs: queryDocs,
|
|
27
|
+
objective: queryObjective,
|
|
28
|
+
experiments: queryExperiments,
|
|
29
|
+
todo: queryTodo,
|
|
30
|
+
decisions: queryDecisions,
|
|
31
|
+
};
|
|
32
|
+
export function isPortedStateCommand(command) {
|
|
33
|
+
return command in STATE_COMMAND_HANDLERS;
|
|
34
|
+
}
|
|
35
|
+
export function cmdState(args, io) {
|
|
36
|
+
const e = err(io);
|
|
37
|
+
try {
|
|
38
|
+
validateFilterValues(args, COMMAND_FILTERS[args.command] ?? []);
|
|
39
|
+
if (args.limit !== null && args.limit !== undefined && args.limit < 0) {
|
|
40
|
+
throw new Error("limit must be zero or greater");
|
|
41
|
+
}
|
|
42
|
+
const schemas = loadSchemas(discoverSchemasDir());
|
|
43
|
+
const handler = STATE_COMMAND_HANDLERS[args.command];
|
|
44
|
+
return handler(args, schemas, io);
|
|
45
|
+
}
|
|
46
|
+
catch (exc) {
|
|
47
|
+
e(`Error: ${exc.message}\n`);
|
|
48
|
+
return 2;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAiB,GAAG,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;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AAC;QACD,MAAM,OAAO,GAAG,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,CAAC,CAAC,UAAW,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `state objective` query (OBJECTIVE.md / objective.yaml).
|
|
3
|
+
*
|
|
4
|
+
* Reports the single current objective plus its closure block (when
|
|
5
|
+
* status is "closed"), with the same envelope shape used by prime.
|
|
6
|
+
*/
|
|
7
|
+
import { asList, emitStateStructured, filterByFieldValue, formatEntry, loadArtifact, missingSchemaError, sourceMetadata, structuredState, truncate, } from "../../stateQuery.js";
|
|
8
|
+
import { artifactPath } from "../../appContext.js";
|
|
9
|
+
import { firstPresent } from "../../stateQuery.js";
|
|
10
|
+
import { out, err } from "./shared.js";
|
|
11
|
+
export function queryObjective(args, schemas, io) {
|
|
12
|
+
const o = out(io);
|
|
13
|
+
const e = err(io);
|
|
14
|
+
const info = schemas.objective;
|
|
15
|
+
if (!info) {
|
|
16
|
+
e(missingSchemaError("objective") + "\n");
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
const p = artifactPath(info, "objective");
|
|
20
|
+
const data = loadArtifact(p);
|
|
21
|
+
const format = args.format ?? "text";
|
|
22
|
+
const isDict = data !== null && typeof data === "object" && !Array.isArray(data);
|
|
23
|
+
if (!isDict) {
|
|
24
|
+
if (format !== "text") {
|
|
25
|
+
return emitStateStructured("objective", structuredState("objective", [], sourceMetadata("objective", p), { filters: { status: args.status ?? null } }), format, args.fields, o, e);
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
// cast: data is the parsed objective artifact from loadArtifact (YAML/MD IO boundary)
|
|
30
|
+
const d = data;
|
|
31
|
+
const legacyEntries = asList(d.entries);
|
|
32
|
+
if (legacyEntries.length > 0) {
|
|
33
|
+
let entries = legacyEntries;
|
|
34
|
+
const statusFilter = args.status ?? null;
|
|
35
|
+
if (statusFilter)
|
|
36
|
+
entries = filterByFieldValue(entries, "status", statusFilter);
|
|
37
|
+
if (format !== "text") {
|
|
38
|
+
return emitStateStructured("objective", structuredState("objective", entries, sourceMetadata("objective", p), { filters: { status: statusFilter } }), format, args.fields, o, e);
|
|
39
|
+
}
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
const line = formatEntry(entry, ["title", "status", "target", "reason"]);
|
|
42
|
+
if (line)
|
|
43
|
+
o(line + "\n");
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
const header = d.header && typeof d.header === "object" && !Array.isArray(d.header) ? d.header : {};
|
|
48
|
+
const objective = d.objective && typeof d.objective === "object" && !Array.isArray(d.objective) ? d.objective : d;
|
|
49
|
+
const title = firstPresent(header, ["title"], objective.title ?? "");
|
|
50
|
+
const status = firstPresent(header, ["status"], objective.status ?? "");
|
|
51
|
+
const closure = d.closure && typeof d.closure === "object" && !Array.isArray(d.closure) ? d.closure : {};
|
|
52
|
+
if (format !== "text") {
|
|
53
|
+
return emitStateStructured("objective", structuredState("objective", objective ? [objective] : [], sourceMetadata("objective", p), {
|
|
54
|
+
filters: { status: args.status ?? null },
|
|
55
|
+
summary: { title, status, header, closure },
|
|
56
|
+
}), format, args.fields, o, e);
|
|
57
|
+
}
|
|
58
|
+
o(`Objective: title=${truncate(title)} | status=${status || "unknown"}\n`);
|
|
59
|
+
for (const key of ["description", "target", "measurement", "direction", "unit"]) {
|
|
60
|
+
const value = objective[key] ?? d[key];
|
|
61
|
+
if (value)
|
|
62
|
+
o(`${key}: ${truncate(value)}\n`);
|
|
63
|
+
}
|
|
64
|
+
if (Object.keys(closure).length > 0) {
|
|
65
|
+
o(formatEntry(closure, ["final_value", "target", "reason"]) + "\n");
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=objective.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objective.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/objective.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAiB,MAAM,aAAa,CAAC;AAGtD,MAAM,UAAU,cAAc,CAAC,IAAe,EAAE,OAAmC,EAAE,EAAM;IACzF,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1C,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC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F,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACxC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;SAC5C,CAAC,EACF,MAAM,EACN,IAAI,CAAC,MAAM,EACX,CAAC,EACD,CAAC,CACF,CAAC;IACJ,CAAC;IACD,CAAC,CAAC,oBAAoB,QAAQ,CAAC,KAAK,CAAC,aAAa,MAAM,IAAI,SAAS,IAAI,CAAC,CAAC;IAC3E,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC;QAChF,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK;YAAE,CAAC,CAAC,GAAG,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `state plan` query (active PLAN.yaml → summary + task list).
|
|
3
|
+
*
|
|
4
|
+
* Source-contract builder for plan artifacts: declares the
|
|
5
|
+
* `complete_for_plan_artifact` / `complete_for_normal_startup_evaluation`
|
|
6
|
+
* flags that downstream capabilities (prime, orchestrate) read
|
|
7
|
+
* before raw plan access.
|
|
8
|
+
*/
|
|
9
|
+
import { asList, emitStateStructured, filterByFieldValue, formatEntry, loadArtifact, missingSchemaError, printStatusCounts, sourceMetadata, statusCounts, structuredState, truncate, } from "../../stateQuery.js";
|
|
10
|
+
import { artifactPath } from "../../appContext.js";
|
|
11
|
+
import { firstPresent } from "../../stateQuery.js";
|
|
12
|
+
import { out, err } from "./shared.js";
|
|
13
|
+
function planArtifactSummary(data, header) {
|
|
14
|
+
const summary = {
|
|
15
|
+
header,
|
|
16
|
+
title: firstPresent(header, ["title"], data.title ?? ""),
|
|
17
|
+
status: firstPresent(header, ["status"], data.status ?? ""),
|
|
18
|
+
created: firstPresent(header, ["created"], data.created ?? ""),
|
|
19
|
+
what: data.what,
|
|
20
|
+
why: data.why,
|
|
21
|
+
constraints: data.constraints,
|
|
22
|
+
scope: data.scope,
|
|
23
|
+
design: data.design,
|
|
24
|
+
overall_acceptance: data.overall_acceptance,
|
|
25
|
+
surprises: data.surprises,
|
|
26
|
+
previous_plan_archived: data.previous_plan_archived,
|
|
27
|
+
};
|
|
28
|
+
const out = {};
|
|
29
|
+
for (const [k, v] of Object.entries(summary)) {
|
|
30
|
+
if (v !== null && v !== undefined && v !== "")
|
|
31
|
+
out[k] = v;
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
function planSourceContract(source, summary) {
|
|
36
|
+
const legacyEntries = Boolean(summary.legacy_entries);
|
|
37
|
+
const complete = Boolean(source.exists) && !legacyEntries;
|
|
38
|
+
const missingState = [];
|
|
39
|
+
if (!source.exists)
|
|
40
|
+
missingState.push("plan artifact");
|
|
41
|
+
if (legacyEntries)
|
|
42
|
+
missingState.push("current plan task artifact shape");
|
|
43
|
+
const summaryFields = Object.keys(summary).sort();
|
|
44
|
+
const entryFields = ["number", "name", "depends_on", "status", "acceptance", "evidence", "blocked_reason"];
|
|
45
|
+
return {
|
|
46
|
+
artifact: "plan",
|
|
47
|
+
canonical_artifact_label: "plan",
|
|
48
|
+
persisted_artifact_path: source.path,
|
|
49
|
+
complete_for_plan_artifact: complete,
|
|
50
|
+
complete_for_normal_startup_evaluation: complete,
|
|
51
|
+
raw_artifact_reads_required: false,
|
|
52
|
+
raw_artifact_read_policy: "Use `agentera state plan --format json` entries, summary, source, and source_contract before raw plan access. " +
|
|
53
|
+
"When complete_for_plan_artifact is true, skip defensive `.agentera/plan.yaml` reads during normal read-only " +
|
|
54
|
+
"plan startup/evaluation; raw plan artifact access is reserved for writes, archival, validation, corruption " +
|
|
55
|
+
"diagnostics, or unavailable/incomplete CLI state.",
|
|
56
|
+
included_state: [
|
|
57
|
+
"header",
|
|
58
|
+
"what",
|
|
59
|
+
"why",
|
|
60
|
+
"constraints",
|
|
61
|
+
"scope",
|
|
62
|
+
"design",
|
|
63
|
+
"tasks",
|
|
64
|
+
"task dependencies",
|
|
65
|
+
"task acceptance criteria",
|
|
66
|
+
"task evidence",
|
|
67
|
+
"overall_acceptance",
|
|
68
|
+
"surprises",
|
|
69
|
+
"previous_plan_archived",
|
|
70
|
+
],
|
|
71
|
+
complete_state: {
|
|
72
|
+
summary: summaryFields,
|
|
73
|
+
entries: entryFields,
|
|
74
|
+
normal_startup_evaluation: complete,
|
|
75
|
+
},
|
|
76
|
+
raw_artifact_access_boundary: {
|
|
77
|
+
normal_read_only_startup_evaluation: "skip raw plan artifact reads when complete_for_plan_artifact is true",
|
|
78
|
+
allowed_raw_artifact_uses: [
|
|
79
|
+
"artifact writes",
|
|
80
|
+
"plan archival",
|
|
81
|
+
"artifact validation",
|
|
82
|
+
"corruption diagnostics",
|
|
83
|
+
"unavailable or incomplete CLI state after CLI fallbacks",
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
missing_state: missingState,
|
|
87
|
+
fallback: complete ? [] : ["agentera docs --format json"],
|
|
88
|
+
fallback_policy: "When plan CLI output is missing or incomplete, use supported CLI state such as `agentera docs --format json` " +
|
|
89
|
+
"for artifact mapping before any last-resort raw plan artifact read.",
|
|
90
|
+
summary_fields: summaryFields,
|
|
91
|
+
entry_fields: entryFields,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function queryPlan(args, schemas, io) {
|
|
95
|
+
const o = out(io);
|
|
96
|
+
const e = err(io);
|
|
97
|
+
const info = schemas.plan;
|
|
98
|
+
if (!info) {
|
|
99
|
+
e(missingSchemaError("plan") + "\n");
|
|
100
|
+
return 1;
|
|
101
|
+
}
|
|
102
|
+
const p = artifactPath(info, "plan");
|
|
103
|
+
const data = loadArtifact(p);
|
|
104
|
+
const isDict = data !== null && typeof data === "object" && !Array.isArray(data);
|
|
105
|
+
const format = args.format ?? "text";
|
|
106
|
+
if (!isDict) {
|
|
107
|
+
if (format !== "text") {
|
|
108
|
+
const source = sourceMetadata("plan", p);
|
|
109
|
+
const summary = { absence_reason: "No plan artifact is available from agentera plan." };
|
|
110
|
+
return emitStateStructured("plan", structuredState("plan", [], source, {
|
|
111
|
+
filters: { status: args.status ?? null },
|
|
112
|
+
summary,
|
|
113
|
+
sourceContract: planSourceContract(source, summary),
|
|
114
|
+
}), format, args.fields, o, e);
|
|
115
|
+
}
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
// cast: data is the parsed plan artifact from loadArtifact (YAML IO boundary)
|
|
119
|
+
const dataDict = data;
|
|
120
|
+
const legacyEntries = asList(dataDict.entries);
|
|
121
|
+
if (legacyEntries.length > 0) {
|
|
122
|
+
let entries = legacyEntries;
|
|
123
|
+
const statusFilter = args.status ?? null;
|
|
124
|
+
if (statusFilter)
|
|
125
|
+
entries = filterByFieldValue(entries, "status", statusFilter);
|
|
126
|
+
const source = sourceMetadata("plan", p);
|
|
127
|
+
const summary = { legacy_entries: true };
|
|
128
|
+
if (format !== "text") {
|
|
129
|
+
return emitStateStructured("plan", structuredState("plan", entries, source, {
|
|
130
|
+
filters: { status: statusFilter },
|
|
131
|
+
summary,
|
|
132
|
+
sourceContract: planSourceContract(source, summary),
|
|
133
|
+
}), format, args.fields, o, e);
|
|
134
|
+
}
|
|
135
|
+
for (const entry of entries) {
|
|
136
|
+
const line = formatEntry(entry, ["status", "title", "name"]);
|
|
137
|
+
if (line)
|
|
138
|
+
o(line + "\n");
|
|
139
|
+
}
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
const header = dataDict.header && typeof dataDict.header === "object" && !Array.isArray(dataDict.header) ? dataDict.header : {};
|
|
143
|
+
const summary = planArtifactSummary(dataDict, header);
|
|
144
|
+
const title = summary.title ?? "";
|
|
145
|
+
const status = summary.status ?? "";
|
|
146
|
+
const created = summary.created ?? "";
|
|
147
|
+
let tasks = asList(dataDict.tasks);
|
|
148
|
+
const statusFilter = args.status ?? null;
|
|
149
|
+
if (statusFilter)
|
|
150
|
+
tasks = filterByFieldValue(tasks, "status", statusFilter);
|
|
151
|
+
const source = sourceMetadata("plan", p);
|
|
152
|
+
if (format !== "text") {
|
|
153
|
+
return emitStateStructured("plan", structuredState("plan", tasks, source, {
|
|
154
|
+
filters: { status: statusFilter },
|
|
155
|
+
summary,
|
|
156
|
+
sourceContract: planSourceContract(source, summary),
|
|
157
|
+
}), format, args.fields, o, e);
|
|
158
|
+
}
|
|
159
|
+
o(`Plan: status=${status || "unknown"} | title=${truncate(title)} | created=${created || "-"}\n`);
|
|
160
|
+
for (const key of ["what", "why"]) {
|
|
161
|
+
const value = dataDict[key];
|
|
162
|
+
if (value)
|
|
163
|
+
o(`${key}: ${truncate(value)}\n`);
|
|
164
|
+
}
|
|
165
|
+
printStatusCounts("Task status", statusCounts(tasks), o);
|
|
166
|
+
for (const task of tasks.slice(0, 10)) {
|
|
167
|
+
const line = formatEntry(task, ["number", "status", "name", "title"]);
|
|
168
|
+
if (line)
|
|
169
|
+
o(`Task: ${line}\n`);
|
|
170
|
+
}
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EACl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MAAM,EACN,IAAI,CAAC,MAAM,EACX,CAAC,EACD,CAAC,CACF,CAAC;IACJ,CAAC;IACD,CAAC,CAAC,gBAAgB,MAAM,IAAI,SAAS,YAAY,QAAQ,CAAC,KAAK,CAAC,cAAc,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC;IAClG,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,KAAK;YAAE,CAAC,CAAC,GAAG,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,iBAAiB,CAAC,aAAa,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACtE,IAAI,IAAI;YAAE,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `state progress` query (PROGRESS.md / progress.yaml cycles).
|
|
3
|
+
*
|
|
4
|
+
* Reports the most recent N cycles (default 5), filtered by topic or
|
|
5
|
+
* type, with a structured envelope that downstream prime callers
|
|
6
|
+
* use to surface progress_verification without raw artifact reads.
|
|
7
|
+
*/
|
|
8
|
+
import { emitStateStructured, extractEntries, filterByFieldValue, filterByTopic, formatEntry, loadArtifact, missingSchemaError, progressEntriesForOutput, recentCycles, sourceMetadata, structuredState, truncate, } from "../../stateQuery.js";
|
|
9
|
+
import { artifactPath } from "../../appContext.js";
|
|
10
|
+
import { out, err } from "./shared.js";
|
|
11
|
+
export function queryProgress(args, schemas, io) {
|
|
12
|
+
const o = out(io);
|
|
13
|
+
const e = err(io);
|
|
14
|
+
const info = schemas.progress;
|
|
15
|
+
if (!info) {
|
|
16
|
+
e(missingSchemaError("progress") + "\n");
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
const p = artifactPath(info, "progress");
|
|
20
|
+
const data = loadArtifact(p);
|
|
21
|
+
let entries = extractEntries(data);
|
|
22
|
+
const topic = args.topic ?? null;
|
|
23
|
+
if (topic)
|
|
24
|
+
entries = filterByTopic(entries, topic, info.fields);
|
|
25
|
+
const statusFilter = args.status ?? null;
|
|
26
|
+
if (statusFilter)
|
|
27
|
+
entries = filterByFieldValue(entries, "type", statusFilter);
|
|
28
|
+
const effectiveLimit = (args.limit ?? 5) || 5;
|
|
29
|
+
entries = recentCycles(entries, effectiveLimit);
|
|
30
|
+
if ((args.format ?? "text") !== "text") {
|
|
31
|
+
return emitStateStructured("progress", structuredState("progress", progressEntriesForOutput(entries), sourceMetadata("progress", p), {
|
|
32
|
+
filters: { topic, status: statusFilter, limit: effectiveLimit },
|
|
33
|
+
}), args.format ?? "text", args.fields, o, e);
|
|
34
|
+
}
|
|
35
|
+
if (entries.length === 0)
|
|
36
|
+
return 0;
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
o(formatEntry(entry, ["number", "timestamp", "type", "phase"]) + "\n");
|
|
39
|
+
for (const key of ["what", "verified", "next"]) {
|
|
40
|
+
const value = entry[key];
|
|
41
|
+
if (value)
|
|
42
|
+
o(` ${key}: ${truncate(value)}\n`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/progress.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA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IAC9C,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAEhD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;QACvC,OAAO,mBAAmB,CACxB,UAAU,EACV,eAAe,CAAC,UAAU,EAAE,wBAAwB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE;YAC5F,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE;SAChE,CAAC,EACF,IAAI,CAAC,MAAM,IAAI,MAAM,EACrB,IAAI,CAAC,MAAM,EACX,CAAC,EACD,CAAC,CACF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACvE,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,KAAK;gBAAE,CAAC,CAAC,KAAK,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types and helpers for the per-state-family query modules.
|
|
3
|
+
*
|
|
4
|
+
* The state command family is split into one module per state
|
|
5
|
+
* artifact (plan, progress, health, docs, objective, experiments,
|
|
6
|
+
* todo, decisions). They all share the StateArgs/Io shape and the
|
|
7
|
+
* stdout/stderr write helpers.
|
|
8
|
+
*/
|
|
9
|
+
export function out(io) {
|
|
10
|
+
return io.out ?? ((t) => process.stdout.write(t));
|
|
11
|
+
}
|
|
12
|
+
export function err(io) {
|
|
13
|
+
return io.err ?? ((t) => process.stderr.write(t));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/cli/commands/state/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,MAAM,UAAU,GAAG,CAAC,EAAM;IACxB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,EAAM;IACxB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `state todo` query (TODO.md).
|
|
3
|
+
*
|
|
4
|
+
* Reads TODO.md, partitions entries by severity band (using the
|
|
5
|
+
* protocol glyphs as the section heading), and reports each entry
|
|
6
|
+
* with its severity, status, and description. Supports both the
|
|
7
|
+
* legacy structured YAML shape and the current markdown layout.
|
|
8
|
+
*/
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import { emitStateStructured, extractEntries, filterByFieldValue, formatEntry, loadArtifact, printStatusCounts, sourceMetadata, statusCounts, structuredState, } from "../../stateQuery.js";
|
|
11
|
+
import { artifactPath } from "../../appContext.js";
|
|
12
|
+
import { isResolvedTodoMarkdownStatus, parseTodoMarkdownListItem } from "../../todoMarkdown.js";
|
|
13
|
+
import { TODO_SEVERITY_ORDER_KEYS } from "../../todoSeverity.js";
|
|
14
|
+
import { out, err } from "./shared.js";
|
|
15
|
+
const TODO_SEV_GLYPHS = {
|
|
16
|
+
critical: "⇶",
|
|
17
|
+
degraded: "⇉",
|
|
18
|
+
warning: "⇉",
|
|
19
|
+
normal: "→",
|
|
20
|
+
info: "⇢",
|
|
21
|
+
annoying: "⇢",
|
|
22
|
+
};
|
|
23
|
+
export function normalizeSeverity(value, deflt = "normal") {
|
|
24
|
+
const text = String(value || deflt).toLowerCase();
|
|
25
|
+
for (const key of TODO_SEVERITY_ORDER_KEYS) {
|
|
26
|
+
if (text.includes(key))
|
|
27
|
+
return key;
|
|
28
|
+
}
|
|
29
|
+
return deflt;
|
|
30
|
+
}
|
|
31
|
+
export function queryTodo(args, schemas, io, openOnly = false) {
|
|
32
|
+
const o = out(io);
|
|
33
|
+
const info = schemas.todo ?? { path: "TODO.md", record: undefined, schema: {}, fields: {} };
|
|
34
|
+
const todoPath = artifactPath(info, "todo");
|
|
35
|
+
const severity = args.severity ?? null;
|
|
36
|
+
const status = args.status ?? null;
|
|
37
|
+
const format = args.format ?? "text";
|
|
38
|
+
if (!fs.existsSync(todoPath)) {
|
|
39
|
+
if (format !== "text") {
|
|
40
|
+
return emitStateStructured("todo", structuredState("todo", [], sourceMetadata("todo", todoPath), {
|
|
41
|
+
filters: { severity, status },
|
|
42
|
+
}), format, args.fields, o, err(io));
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
const data = loadArtifact(todoPath);
|
|
47
|
+
let entries = extractEntries(data);
|
|
48
|
+
if (entries.length > 0) {
|
|
49
|
+
if (severity)
|
|
50
|
+
entries = filterByFieldValue(entries, "severity", severity);
|
|
51
|
+
if (status)
|
|
52
|
+
entries = filterByFieldValue(entries, "status", status);
|
|
53
|
+
if (openOnly) {
|
|
54
|
+
entries = entries.filter((entry) => !["done", "closed", "resolved"].includes(String(entry.status ?? "open").toLowerCase()));
|
|
55
|
+
}
|
|
56
|
+
if (format !== "text") {
|
|
57
|
+
return emitStateStructured("todo", structuredState("todo", entries, sourceMetadata("todo", todoPath), {
|
|
58
|
+
filters: { severity, status, open_only: openOnly || null },
|
|
59
|
+
}), format, args.fields, o, err(io));
|
|
60
|
+
}
|
|
61
|
+
printStatusCounts("TODO status", statusCounts(entries), o);
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
const line = formatEntry(entry, ["severity", "status", "description", "title"]);
|
|
64
|
+
if (line)
|
|
65
|
+
o(line + "\n");
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
const text = fs.readFileSync(todoPath, "utf8");
|
|
70
|
+
const marker = severity ? TODO_SEV_GLYPHS[severity.toLowerCase()] ?? severity : null;
|
|
71
|
+
let currentSection = null;
|
|
72
|
+
const markdownEntries = [];
|
|
73
|
+
for (const rawLine of text.split(/\r\n|\r|\n/)) {
|
|
74
|
+
const sline = rawLine.trim();
|
|
75
|
+
if (sline.startsWith("## ")) {
|
|
76
|
+
const section = sline.slice(3).trim();
|
|
77
|
+
if (section.toLowerCase().includes("resolved")) {
|
|
78
|
+
currentSection = null;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
currentSection = section;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (currentSection === null)
|
|
85
|
+
continue;
|
|
86
|
+
const parsed = parseTodoMarkdownListItem(sline);
|
|
87
|
+
if (!parsed)
|
|
88
|
+
continue;
|
|
89
|
+
if (marker && !currentSection.includes(marker))
|
|
90
|
+
continue;
|
|
91
|
+
const itemStatus = parsed.status;
|
|
92
|
+
if (openOnly && isResolvedTodoMarkdownStatus(itemStatus))
|
|
93
|
+
continue;
|
|
94
|
+
if (status) {
|
|
95
|
+
const want = status.toLowerCase();
|
|
96
|
+
const have = itemStatus.toLowerCase();
|
|
97
|
+
if (want === "open" || want === "todo") {
|
|
98
|
+
if (isResolvedTodoMarkdownStatus(have))
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
else if (have !== want) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
markdownEntries.push({
|
|
106
|
+
severity: normalizeSeverity(currentSection),
|
|
107
|
+
status: itemStatus,
|
|
108
|
+
description: parsed.description,
|
|
109
|
+
section: currentSection,
|
|
110
|
+
});
|
|
111
|
+
if (format === "text")
|
|
112
|
+
o(`[${currentSection}] ${parsed.description}\n`);
|
|
113
|
+
}
|
|
114
|
+
if (format !== "text") {
|
|
115
|
+
return emitStateStructured("todo", structuredState("todo", markdownEntries, sourceMetadata("todo", todoPath), {
|
|
116
|
+
filters: { severity, status, open_only: openOnly || null },
|
|
117
|
+
}), format, args.fields, o, err(io));
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=todo.js.map
|