agentera 3.0.0-dev.2 → 3.0.0-dev.21
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 +84 -6
- package/bundle/.agentera-npx-bundle.json +1 -1
- package/bundle/.codex-plugin/plugin.json +92 -0
- package/bundle/.cursor/agents/agentera.md +7 -0
- package/bundle/.cursor/hooks.json +32 -0
- package/bundle/.cursor-plugin/plugin.json +34 -0
- package/bundle/.github/hooks/postToolUse.json +9 -0
- package/bundle/.github/hooks/preToolUse.json +8 -0
- package/bundle/.github/hooks/sessionEnd.json +8 -0
- package/bundle/.github/hooks/sessionStart.json +8 -0
- package/bundle/.github/plugin/plugin.json +7 -0
- package/bundle/.opencode/agents/agentera.md +12 -0
- package/bundle/.opencode/commands/agentera.md +5 -0
- package/bundle/.opencode/package.json +31 -0
- package/bundle/.opencode/plugins/agentera.js +820 -0
- package/bundle/CHANGELOG.md +1101 -0
- package/bundle/DESIGN.md +233 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +158 -0
- package/bundle/UPGRADE.md +265 -0
- package/bundle/agents/openai.yaml +87 -0
- package/bundle/extract-corpus-parity.json +21 -0
- package/bundle/hooks/codex-hooks.json +31 -0
- package/bundle/hooks/codex-plugin-hooks.json +31 -0
- package/bundle/plugin.json +13 -0
- package/bundle/references/adapters/cursor.md +53 -42
- package/bundle/references/adapters/opencode.md +46 -47
- package/bundle/references/adapters/package-manifest-interface-model.yaml +32 -43
- package/bundle/references/adapters/package-registry.yaml +19 -53
- package/bundle/references/adapters/package-surface-characterization.md +55 -35
- package/bundle/references/adapters/runtime-adapter-characterization.md +44 -79
- package/bundle/references/adapters/runtime-adapter-registry.yaml +21 -182
- package/bundle/references/adapters/runtime-feature-parity.md +114 -174
- package/bundle/references/adapters/runtime-lifecycle-adapters.yaml +288 -0
- package/bundle/references/adapters/runtime-lifecycle-authority.yaml +90 -0
- package/bundle/references/adapters/runtime-lifecycle-operation-contract.yaml +84 -0
- package/bundle/references/adapters/runtime-retired-resources.yaml +33 -0
- package/bundle/references/analysis/benchmark.md +6 -6
- package/bundle/references/analysis/startup-measurement-contract.yaml +37 -26
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +9 -8
- package/bundle/references/artifacts/state-storage-authority.yaml +1446 -0
- package/bundle/references/cli/agent-ready-state-contract.yaml +37 -62
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +4 -4
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +57 -28
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +4 -32
- package/bundle/references/cli/capability-instruction-contract.yaml +98 -57
- package/bundle/references/cli/capability-instruction-structure.md +144 -0
- 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 +12 -12
- package/bundle/references/cli/routing-model.md +94 -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 +43 -7
- 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 +20 -15
- package/bundle/references/cli/vocabulary.md +342 -326
- package/bundle/references/meta/documentation-inventory.md +10 -3
- package/bundle/registry.json +14 -14
- package/bundle/skills/agentera/SKILL.md +136 -408
- 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/discuss.toml +6 -0
- package/bundle/skills/agentera/agents/document.toml +6 -0
- package/bundle/skills/agentera/agents/optimize.toml +6 -0
- 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/audit/schemas/artifacts.yaml +84 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/triggers.yaml +15 -6
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +20 -19
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/artifacts.yaml +22 -17
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +3 -3
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/triggers.yaml +13 -3
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/validation.yaml +11 -11
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/triggers.yaml +15 -3
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +49 -0
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/validation.yaml +9 -8
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/artifacts.yaml +23 -16
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/triggers.yaml +14 -4
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +18 -18
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +9 -9
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +9 -9
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +71 -0
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/triggers.yaml +16 -3
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +120 -0
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +63 -0
- 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/plan/schemas/validation.yaml +89 -0
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/artifacts.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +3 -3
- 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/research/schemas/artifacts.yaml +24 -0
- 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 +12 -8
- 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/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/triggers.yaml +19 -5
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +18 -20
- package/bundle/skills/agentera/capability_schema_contract.yaml +201 -38
- package/bundle/skills/agentera/protocol.yaml +29 -29
- package/bundle/skills/agentera/references/contract.md +387 -329
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +25 -20
- 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 +139 -8
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +21 -15
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +22 -8
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +285 -11
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +36 -51
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +77 -24
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
- package/dist/analytics/extractCorpus/cli.js +163 -0
- package/dist/analytics/extractCorpus/cli.js.map +1 -0
- package/dist/analytics/extractCorpus/copilotSessions.js +276 -0
- package/dist/analytics/extractCorpus/copilotSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/core.js +393 -0
- package/dist/analytics/extractCorpus/core.js.map +1 -0
- package/dist/analytics/extractCorpus/corpus.js +168 -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 +426 -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 +119 -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 +205 -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 +93 -27
- package/dist/analytics/usageStats.js.map +1 -1
- package/dist/bin/agentera.js +3 -1
- package/dist/bin/agentera.js.map +1 -1
- package/dist/capabilities/audit/instructions.js +4 -0
- package/dist/capabilities/audit/instructions.js.map +1 -0
- package/dist/capabilities/build/instructions.js +5 -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 +4 -0
- package/dist/capabilities/document/instructions.js.map +1 -0
- package/dist/capabilities/index.js +38 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/optimize/instructions.js +5 -0
- package/dist/capabilities/optimize/instructions.js.map +1 -0
- package/dist/capabilities/orchestrate/instructions.js +10 -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/profile/instructions.js +5 -0
- package/dist/capabilities/profile/instructions.js.map +1 -0
- package/dist/capabilities/research/instructions.js +6 -0
- package/dist/capabilities/research/instructions.js.map +1 -0
- package/dist/capabilities/status/instructions.js +5 -0
- package/dist/capabilities/status/instructions.js.map +1 -0
- package/dist/capabilities/vision/instructions.js +5 -0
- package/dist/capabilities/vision/instructions.js.map +1 -0
- package/dist/cli/appContext.js +30 -23
- 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 +38 -0
- package/dist/cli/capabilityContext/bespoke.js.map +1 -0
- package/dist/cli/capabilityContext/build.js +191 -0
- package/dist/cli/capabilityContext/build.js.map +1 -0
- package/dist/cli/capabilityContext/closeout.js +231 -0
- package/dist/cli/capabilityContext/closeout.js.map +1 -0
- package/dist/cli/capabilityContext/contract.js +219 -0
- package/dist/cli/capabilityContext/contract.js.map +1 -0
- package/dist/cli/capabilityContext/evidence.js +457 -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 +118 -0
- package/dist/cli/capabilityContext/orchestration.js.map +1 -0
- package/dist/cli/capabilityContext/planState.js +279 -0
- package/dist/cli/capabilityContext/planState.js.map +1 -0
- package/dist/cli/capabilityContext/progress.js +143 -0
- package/dist/cli/capabilityContext/progress.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 +139 -0
- package/dist/cli/capabilityContext/slim.js.map +1 -0
- package/dist/cli/capabilityContext/startup.js +241 -0
- package/dist/cli/capabilityContext/startup.js.map +1 -0
- package/dist/cli/capabilityContext/types.js +51 -0
- package/dist/cli/capabilityContext/types.js.map +1 -0
- package/dist/cli/capabilityContext.js +1 -2420
- 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 +186 -76
- package/dist/cli/commands/backfill.js.map +1 -1
- package/dist/cli/commands/capability.js +3 -10
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/cli/commands/compact.js +41 -12
- package/dist/cli/commands/compact.js.map +1 -1
- package/dist/cli/commands/doctor.js +116 -96
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/durability.js +85 -0
- package/dist/cli/commands/durability.js.map +1 -0
- package/dist/cli/commands/lint.js +16 -41
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/migrate.js +677 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/prime/bundleStatus.js +185 -0
- package/dist/cli/commands/prime/bundleStatus.js.map +1 -0
- package/dist/cli/commands/prime/collectOrientationState.js +202 -0
- package/dist/cli/commands/prime/collectOrientationState.js.map +1 -0
- package/dist/cli/commands/prime/orientationOutput.js +235 -0
- package/dist/cli/commands/prime/orientationOutput.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 -519
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/query.js +25 -4
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/report.js +50 -14
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/schema.js +343 -76
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/decisions.js +421 -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/experimentRecords.js +156 -0
- package/dist/cli/commands/state/experimentRecords.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/get.js +141 -0
- package/dist/cli/commands/state/get.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/list.js +159 -0
- package/dist/cli/commands/state/list.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 +379 -0
- package/dist/cli/commands/state/plan.js.map +1 -0
- package/dist/cli/commands/state/planTasks.js +164 -0
- package/dist/cli/commands/state/planTasks.js.map +1 -0
- package/dist/cli/commands/state/plans.js +154 -0
- package/dist/cli/commands/state/plans.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/write.js +346 -0
- package/dist/cli/commands/state/write.js.map +1 -0
- package/dist/cli/commands/upgrade.js +79 -1
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/upgradeVerify.js +81 -0
- package/dist/cli/commands/upgradeVerify.js.map +1 -0
- package/dist/cli/commands/validate.js +56 -96
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/verify.js +13 -7
- 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 +395 -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 +201 -0
- package/dist/cli/dispatch/index.js.map +1 -0
- package/dist/cli/dispatch/lifecycle.js +671 -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 +168 -0
- package/dist/cli/dispatch/state.js.map +1 -0
- package/dist/cli/dispatch.js +1 -957
- package/dist/cli/dispatch.js.map +1 -1
- package/dist/cli/errors.js +53 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/help.js +421 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/orientation/attention.js +163 -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 +336 -144
- package/dist/cli/orientation.js.map +1 -1
- package/dist/cli/planArtifacts.js +201 -0
- package/dist/cli/planArtifacts.js.map +1 -0
- package/dist/cli/planEvidence.js +158 -0
- package/dist/cli/planEvidence.js.map +1 -0
- package/dist/cli/planLifecycleState.js +34 -0
- package/dist/cli/planLifecycleState.js.map +1 -0
- package/dist/cli/prime-blob.js +69 -2
- package/dist/cli/prime-blob.js.map +1 -1
- package/dist/cli/startupCompletenessContract.js +57 -0
- package/dist/cli/startupCompletenessContract.js.map +1 -0
- package/dist/cli/stateQuery.js +22 -5
- package/dist/cli/stateQuery.js.map +1 -1
- package/dist/cli/todoMarkdown.js +33 -0
- package/dist/cli/todoMarkdown.js.map +1 -0
- package/dist/cli/todoSeverity.js +19 -0
- package/dist/cli/todoSeverity.js.map +1 -0
- package/dist/core/atomicWriter.js +21 -0
- package/dist/core/atomicWriter.js.map +1 -0
- package/dist/core/envPaths.js +21 -0
- package/dist/core/envPaths.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/core/text.js +11 -0
- package/dist/core/text.js.map +1 -0
- package/dist/core/yaml.js +8 -0
- package/dist/core/yaml.js.map +1 -1
- package/dist/eval/evalSkills.js +30 -25
- 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 +9 -26
- package/dist/hooks/common.js.map +1 -1
- package/dist/hooks/compaction/apply.js +447 -0
- package/dist/hooks/compaction/apply.js.map +1 -0
- package/dist/hooks/compaction/dryRun.js +185 -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 +326 -0
- package/dist/hooks/compaction/parse.js.map +1 -0
- package/dist/hooks/compaction/retention.js +203 -0
- package/dist/hooks/compaction/retention.js.map +1 -0
- package/dist/hooks/compaction/status.js +336 -0
- package/dist/hooks/compaction/status.js.map +1 -0
- package/dist/hooks/compaction/types.js +6 -0
- package/dist/hooks/compaction/types.js.map +1 -0
- 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 +57 -18
- package/dist/hooks/sessionStart.js.map +1 -1
- package/dist/hooks/sessionStop.js +8 -14
- package/dist/hooks/sessionStop.js.map +1 -1
- 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 +541 -0
- package/dist/hooks/validateArtifact/schema.js.map +1 -0
- package/dist/hooks/validateArtifact/traversal.js +108 -0
- package/dist/hooks/validateArtifact/traversal.js.map +1 -0
- package/dist/hooks/validateArtifact/violations.js +108 -0
- package/dist/hooks/validateArtifact/violations.js.map +1 -0
- package/dist/migrate/v2HandoffManifest.js +455 -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 +203 -53
- package/dist/registries/artifactRegistry.js.map +1 -1
- package/dist/registries/capabilityContract.js +156 -12
- package/dist/registries/capabilityContract.js.map +1 -1
- package/dist/registries/evaluatorHandoffContract.js +171 -0
- package/dist/registries/evaluatorHandoffContract.js.map +1 -0
- package/dist/registries/packageRegistry.js +40 -6
- package/dist/registries/packageRegistry.js.map +1 -1
- package/dist/registries/runtimeAdapterRegistry.js +30 -21
- 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 +329 -0
- package/dist/release/releaseMetadata.js.map +1 -0
- package/dist/runtime/lifecycleAdapterContract.js +458 -0
- package/dist/runtime/lifecycleAdapterContract.js.map +1 -0
- package/dist/runtime/lifecycleAdapters.js +766 -0
- package/dist/runtime/lifecycleAdapters.js.map +1 -0
- package/dist/runtime/lifecycleAuthority.js +493 -0
- package/dist/runtime/lifecycleAuthority.js.map +1 -0
- package/dist/runtime/lifecycleOperationContract.js +113 -0
- package/dist/runtime/lifecycleOperationContract.js.map +1 -0
- package/dist/runtime/lifecycleOperations.js +635 -0
- package/dist/runtime/lifecycleOperations.js.map +1 -0
- package/dist/runtime/lifecycleOwnershipJournal.js +623 -0
- package/dist/runtime/lifecycleOwnershipJournal.js.map +1 -0
- package/dist/runtime/lifecyclePublication.js +395 -0
- package/dist/runtime/lifecyclePublication.js.map +1 -0
- package/dist/runtime/lifecycleSnapshot.js +439 -0
- package/dist/runtime/lifecycleSnapshot.js.map +1 -0
- package/dist/runtime/retiredRuntimeCleanup.js +238 -0
- package/dist/runtime/retiredRuntimeCleanup.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 -1055
- package/dist/setup/codex.js.map +1 -1
- package/dist/setup/copilot.js +1 -1
- package/dist/setup/copilot.js.map +1 -1
- package/dist/setup/cursor.js +7 -5
- 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 +296 -0
- package/dist/setup/doctor/core.js.map +1 -0
- package/dist/setup/doctor/diagnostics.js +201 -0
- package/dist/setup/doctor/diagnostics.js.map +1 -0
- package/dist/setup/doctor/opencode.js +301 -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 -1275
- 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/opencodeConstants.js +2 -0
- package/dist/setup/opencodeConstants.js.map +1 -0
- package/dist/setup/smokeChecks.js +109 -0
- package/dist/setup/smokeChecks.js.map +1 -0
- package/dist/state/archiveDiscovery.js +589 -0
- package/dist/state/archiveDiscovery.js.map +1 -0
- package/dist/state/archivePublication.js +225 -0
- package/dist/state/archivePublication.js.map +1 -0
- package/dist/state/archiveRecovery.js +238 -0
- package/dist/state/archiveRecovery.js.map +1 -0
- package/dist/state/archiveReplay.js +54 -0
- package/dist/state/archiveReplay.js.map +1 -0
- package/dist/state/decisionOverlay.js +255 -0
- package/dist/state/decisionOverlay.js.map +1 -0
- package/dist/state/directRetrieval.js +322 -0
- package/dist/state/directRetrieval.js.map +1 -0
- package/dist/state/durability.js +451 -0
- package/dist/state/durability.js.map +1 -0
- package/dist/state/experimentArchive.js +64 -0
- package/dist/state/experimentArchive.js.map +1 -0
- package/dist/state/experimentIdentity.js +191 -0
- package/dist/state/experimentIdentity.js.map +1 -0
- package/dist/state/experimentRetrieval.js +447 -0
- package/dist/state/experimentRetrieval.js.map +1 -0
- package/dist/state/gitBackfill.js +561 -0
- package/dist/state/gitBackfill.js.map +1 -0
- package/dist/state/gitBackfillAuthority.js +141 -0
- package/dist/state/gitBackfillAuthority.js.map +1 -0
- package/dist/state/gitBackfillHistory.js +278 -0
- package/dist/state/gitBackfillHistory.js.map +1 -0
- package/dist/state/gitBackfillOutput.js +209 -0
- package/dist/state/gitBackfillOutput.js.map +1 -0
- package/dist/state/healthRepair.js +70 -0
- package/dist/state/healthRepair.js.map +1 -0
- package/dist/state/installRoot.js +64 -24
- package/dist/state/installRoot.js.map +1 -1
- package/dist/state/legacyIdentity.js +48 -0
- package/dist/state/legacyIdentity.js.map +1 -0
- package/dist/state/legacyMigration.js +516 -0
- package/dist/state/legacyMigration.js.map +1 -0
- package/dist/state/legacyMigrationParser.js +489 -0
- package/dist/state/legacyMigrationParser.js.map +1 -0
- package/dist/state/listAccounting.js +55 -0
- package/dist/state/listAccounting.js.map +1 -0
- package/dist/state/listClassification.js +18 -0
- package/dist/state/listClassification.js.map +1 -0
- package/dist/state/listRetrieval.js +782 -0
- package/dist/state/listRetrieval.js.map +1 -0
- package/dist/state/migrationAuthority.js +413 -0
- package/dist/state/migrationAuthority.js.map +1 -0
- package/dist/state/migrationEnrichment.js +35 -0
- package/dist/state/migrationEnrichment.js.map +1 -0
- package/dist/state/planIdentity.js +45 -0
- package/dist/state/planIdentity.js.map +1 -0
- package/dist/state/planRetrieval.js +314 -0
- package/dist/state/planRetrieval.js.map +1 -0
- package/dist/state/planTaskRetrieval.js +285 -0
- package/dist/state/planTaskRetrieval.js.map +1 -0
- package/dist/state/projectionPolicy.js +184 -0
- package/dist/state/projectionPolicy.js.map +1 -0
- package/dist/state/retrievalAuthority.js +326 -0
- package/dist/state/retrievalAuthority.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/state/startupProjection.js +498 -0
- package/dist/state/startupProjection.js.map +1 -0
- package/dist/state/write/assign.js +21 -0
- package/dist/state/write/assign.js.map +1 -0
- package/dist/state/write/errors.js +12 -0
- package/dist/state/write/errors.js.map +1 -0
- package/dist/state/write/experimentPublication.js +193 -0
- package/dist/state/write/experimentPublication.js.map +1 -0
- package/dist/state/write/explain.js +169 -0
- package/dist/state/write/explain.js.map +1 -0
- package/dist/state/write/fields.js +62 -0
- package/dist/state/write/fields.js.map +1 -0
- package/dist/state/write/helpers.js +8 -0
- package/dist/state/write/helpers.js.map +1 -0
- package/dist/state/write/index.js +12 -0
- package/dist/state/write/index.js.map +1 -0
- package/dist/state/write/input.js +22 -0
- package/dist/state/write/input.js.map +1 -0
- package/dist/state/write/lock.js +131 -0
- package/dist/state/write/lock.js.map +1 -0
- package/dist/state/write/mutation.js +190 -0
- package/dist/state/write/mutation.js.map +1 -0
- package/dist/state/write/operations.js +254 -0
- package/dist/state/write/operations.js.map +1 -0
- package/dist/state/write/planPublication.js +172 -0
- package/dist/state/write/planPublication.js.map +1 -0
- package/dist/state/write/serialize.js +2 -0
- package/dist/state/write/serialize.js.map +1 -0
- package/dist/state/write/transaction.js +800 -0
- package/dist/state/write/transaction.js.map +1 -0
- package/dist/state/write/validate.js +8 -0
- package/dist/state/write/validate.js.map +1 -0
- package/dist/upgrade/appContentRefresh.js +374 -0
- package/dist/upgrade/appContentRefresh.js.map +1 -0
- package/dist/upgrade/appModel.js +11 -6
- package/dist/upgrade/appModel.js.map +1 -1
- package/dist/upgrade/atomicWriter.js +2 -0
- package/dist/upgrade/atomicWriter.js.map +1 -0
- package/dist/upgrade/bundleEvidence.js +34 -0
- package/dist/upgrade/bundleEvidence.js.map +1 -0
- package/dist/upgrade/channels.js +27 -7
- package/dist/upgrade/channels.js.map +1 -1
- package/dist/upgrade/coexistenceProbe.js +105 -0
- package/dist/upgrade/coexistenceProbe.js.map +1 -0
- package/dist/upgrade/compatibility.js +52 -16
- package/dist/upgrade/compatibility.js.map +1 -1
- package/dist/upgrade/doctor.js +195 -193
- package/dist/upgrade/doctor.js.map +1 -1
- package/dist/upgrade/doctorClassifier.js +188 -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 +183 -0
- package/dist/upgrade/legacyAgentCleanup.js.map +1 -0
- package/dist/upgrade/lifecycleUpgrade.js +427 -0
- package/dist/upgrade/lifecycleUpgrade.js.map +1 -0
- package/dist/upgrade/migrateArtifactsV1ToV2.js +568 -0
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +1 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +273 -144
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
- package/dist/upgrade/nextMajorDoctor.js +156 -0
- package/dist/upgrade/nextMajorDoctor.js.map +1 -0
- package/dist/upgrade/npxPlatformStatus.js +23 -0
- package/dist/upgrade/npxPlatformStatus.js.map +1 -0
- package/dist/upgrade/projectIntegration.js +259 -104
- package/dist/upgrade/projectIntegration.js.map +1 -1
- package/dist/upgrade/projectIntegrationDecision.js +141 -0
- package/dist/upgrade/projectIntegrationDecision.js.map +1 -0
- package/dist/upgrade/runtimeMigration.js +342 -89
- package/dist/upgrade/runtimeMigration.js.map +1 -1
- package/dist/upgrade/upgradeCommands.js +8 -0
- package/dist/upgrade/upgradeCommands.js.map +1 -1
- package/dist/upgrade/upgradeLock.js +54 -0
- package/dist/upgrade/upgradeLock.js.map +1 -0
- package/dist/upgrade/upgradeOrchestrator.js +170 -46
- package/dist/upgrade/upgradeOrchestrator.js.map +1 -1
- package/dist/upgrade/upgradeSnapshot.js +93 -0
- package/dist/upgrade/upgradeSnapshot.js.map +1 -0
- package/dist/upgrade/v3CapabilitySurface.js +15 -0
- package/dist/upgrade/v3CapabilitySurface.js.map +1 -0
- package/dist/upgrade/versionResolution.js +12 -4
- package/dist/upgrade/versionResolution.js.map +1 -1
- package/dist/validate/appHomeContract.js +5 -5
- package/dist/validate/appHomeContract.js.map +1 -1
- package/dist/validate/capability.js +135 -14
- package/dist/validate/capability.js.map +1 -1
- package/dist/validate/crossCapability.js +10 -7
- 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 +481 -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 +91 -702
- package/dist/validate/lifecycleAdapters.js.map +1 -1
- package/dist/validate/selfAudit.js +63 -21
- 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 +30 -27
- package/bundle/references/v1-section-mapping.md +0 -47
- package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
- 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/optimera.toml +0 -6
- package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
- package/bundle/skills/agentera/agents/planera.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/resonera.toml +0 -6
- package/bundle/skills/agentera/agents/visionera.toml +0 -6
- package/bundle/skills/agentera/agents/visualisera.toml +0 -6
- package/bundle/skills/agentera/capabilities/dokumentera/instructions.md +0 -428
- package/bundle/skills/agentera/capabilities/hej/instructions.md +0 -331
- package/bundle/skills/agentera/capabilities/inspektera/instructions.md +0 -514
- package/bundle/skills/agentera/capabilities/inspektera/schemas/artifacts.yaml +0 -76
- package/bundle/skills/agentera/capabilities/inspirera/instructions.md +0 -280
- package/bundle/skills/agentera/capabilities/inspirera/schemas/artifacts.yaml +0 -24
- package/bundle/skills/agentera/capabilities/optimera/instructions.md +0 -437
- package/bundle/skills/agentera/capabilities/orkestrera/instructions.md +0 -433
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/artifacts.yaml +0 -64
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/validation.yaml +0 -107
- package/bundle/skills/agentera/capabilities/planera/instructions.md +0 -368
- package/bundle/skills/agentera/capabilities/planera/schemas/artifacts.yaml +0 -62
- package/bundle/skills/agentera/capabilities/planera/schemas/validation.yaml +0 -61
- package/bundle/skills/agentera/capabilities/profilera/instructions.md +0 -419
- package/bundle/skills/agentera/capabilities/realisera/instructions.md +0 -403
- package/bundle/skills/agentera/capabilities/resonera/instructions.md +0 -329
- package/bundle/skills/agentera/capabilities/resonera/schemas/artifacts.yaml +0 -47
- package/bundle/skills/agentera/capabilities/visionera/instructions.md +0 -309
- package/bundle/skills/agentera/capabilities/visualisera/instructions.md +0 -400
- 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/dist/cli/commands/state.js +0 -1012
- package/dist/cli/commands/state.js.map +0 -1
- package/dist/core/git.js +0 -43
- package/dist/core/git.js.map +0 -1
- package/dist/hooks/compaction.js +0 -935
- package/dist/hooks/compaction.js.map +0 -1
- package/dist/hooks/validateArtifact.js +0 -933
- package/dist/hooks/validateArtifact.js.map +0 -1
- package/dist/state/progressCommit.js +0 -289
- package/dist/state/progressCommit.js.map +0 -1
- /package/bundle/skills/agentera/capabilities/{dokumentera → document}/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
|
@@ -5,10 +5,19 @@ import { isFile, pathExists, resolvePath } from "../core/paths.js";
|
|
|
5
5
|
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
6
6
|
import { loadRegistry } from "../registries/runtimeAdapterRegistry.js";
|
|
7
7
|
import { codexCopiedHooksAreAgenteraOnly, codexPluginHooksEnabled, retireCodexCopiedHookTrust, } from "../setup/codex.js";
|
|
8
|
-
import { hasManagedMarker,
|
|
9
|
-
import {
|
|
8
|
+
import { hasManagedMarker, opencodeConfigDir, } from "../setup/opencode.js";
|
|
9
|
+
import { OPENCODE_SKILL_NAMES } from "../setup/opencodeConstants.js";
|
|
10
|
+
import { resolveInvokedUpdateChannel } from "./channels.js";
|
|
11
|
+
import { writeFileAtomic } from "./atomicWriter.js";
|
|
12
|
+
import { applyInstalledHooksRetirementItems, planInstalledHooksRetirementItems, textReferencesV2InstalledHooks, } from "./installedHooksRetirement.js";
|
|
13
|
+
import { projectUsesV3CapabilityInstructionModules } from "./v3CapabilitySurface.js";
|
|
10
14
|
const PYTHON_MANAGED_PATTERNS = [
|
|
11
15
|
/hooks\/validate_artifact\.py/,
|
|
16
|
+
/hooks\/cursor_session_start\.py/,
|
|
17
|
+
/hooks\/cursor_pre_tool_use\.py/,
|
|
18
|
+
/hooks\/cursor_session_stop\.py/,
|
|
19
|
+
/hooks\/session_start\.py/,
|
|
20
|
+
/hooks\/session_stop\.py/,
|
|
12
21
|
/\buv run\b/,
|
|
13
22
|
/\buvx\b/,
|
|
14
23
|
/scripts\/agentera/,
|
|
@@ -17,14 +26,23 @@ const PYTHON_MANAGED_PATTERNS = [
|
|
|
17
26
|
/cursor_pre_tool_use\.py/,
|
|
18
27
|
/cursor_session_stop\.py/,
|
|
19
28
|
];
|
|
29
|
+
export function projectHasProjectLevelRuntimeHooks(project) {
|
|
30
|
+
const root = resolvePath(project);
|
|
31
|
+
const candidates = [
|
|
32
|
+
path.join(root, ".cursor", "hooks.json"),
|
|
33
|
+
path.join(root, ".codex", "config.toml"),
|
|
34
|
+
path.join(root, ".codex", "hooks", "codex-hooks.json"),
|
|
35
|
+
path.join(root, ".github", "hooks"),
|
|
36
|
+
];
|
|
37
|
+
return candidates.some((candidate) => isFile(candidate) || pathExists(candidate));
|
|
38
|
+
}
|
|
20
39
|
const OPENCODE_COMMAND_NAMES = ["agentera"];
|
|
21
|
-
const OPENCODE_SKILL_NAMES = ["agentera", "hej"];
|
|
22
40
|
const CURSOR_AGENT_MARKER = "<!-- agentera: managed -->";
|
|
23
41
|
export function resolveNpxHookCommands(ctx) {
|
|
24
42
|
const env = ctx.env ?? process.env;
|
|
25
43
|
const home = ctx.home ?? env.HOME ?? os.homedir();
|
|
26
44
|
const sourceRoot = ctx.sourceRoot ?? resolveSourceRoot(env);
|
|
27
|
-
const channel =
|
|
45
|
+
const channel = resolveInvokedUpdateChannel({
|
|
28
46
|
channel: ctx.channel ?? null,
|
|
29
47
|
env,
|
|
30
48
|
home,
|
|
@@ -45,10 +63,16 @@ export function textUsesPythonManagedEntrypoint(text) {
|
|
|
45
63
|
}
|
|
46
64
|
return PYTHON_MANAGED_PATTERNS.some((pattern) => pattern.test(text));
|
|
47
65
|
}
|
|
66
|
+
const V3_NPX_ENTRYPOINT = /\bnpx\s+-y\s+agentera\b/;
|
|
67
|
+
export function textUsesV3NpmEntrypoint(text) {
|
|
68
|
+
return V3_NPX_ENTRYPOINT.test(text);
|
|
69
|
+
}
|
|
48
70
|
export function rewireRuntimeText(text, runtime, commands) {
|
|
49
71
|
let next = text;
|
|
50
72
|
next = next.replace(/uv run\s+\\?"?\$\{AGENTERA_HOME\}\/hooks\/validate_artifact\.py\\?"?/g, commands.validate);
|
|
73
|
+
next = next.replace(/uv run\s+\\?"?\$\{AGENTERA_HOME\}\/app\/hooks\/validate_artifact\.py\\?"?/g, commands.validate);
|
|
51
74
|
next = next.replace(/uv run\s+\\?"?\$\{PLUGIN_ROOT\}\/hooks\/validate_artifact\.py\\?"?/g, commands.validate);
|
|
75
|
+
next = next.replace(/uv run\s+hooks\/validate_artifact\.py/g, commands.validate);
|
|
52
76
|
if (next.includes("validate_artifact.py")) {
|
|
53
77
|
next = next.replace(/["']?[^"'\n]*hooks\/validate_artifact\.py[^"'\n]*["']?/g, `"${commands.validate}"`);
|
|
54
78
|
}
|
|
@@ -81,8 +105,8 @@ function needsChannelNpxRewire(text, cliEntrypoint) {
|
|
|
81
105
|
function pushRewireItem(items, runtime, filePath, commands) {
|
|
82
106
|
const text = fs.readFileSync(filePath, "utf8");
|
|
83
107
|
const needsBare = needsChannelNpxRewire(text, commands.cliEntrypoint);
|
|
84
|
-
if (!textUsesPythonManagedEntrypoint(text) && !needsBare) {
|
|
85
|
-
if (text
|
|
108
|
+
if (!textUsesPythonManagedEntrypoint(text) && !textReferencesV2InstalledHooks(text) && !needsBare) {
|
|
109
|
+
if (textUsesV3NpmEntrypoint(text)) {
|
|
86
110
|
items.push({
|
|
87
111
|
status: "noop",
|
|
88
112
|
action: "rewire-runtime",
|
|
@@ -91,6 +115,8 @@ function pushRewireItem(items, runtime, filePath, commands) {
|
|
|
91
115
|
message: "runtime config already references npm self-contained entrypoint",
|
|
92
116
|
});
|
|
93
117
|
}
|
|
118
|
+
// If the file has no Agentera content at all (no v2 Python, no v3 npm),
|
|
119
|
+
// it is not Agentera-managed. Do not push a blocked item — just return.
|
|
94
120
|
return;
|
|
95
121
|
}
|
|
96
122
|
const newText = rewireRuntimeText(text, runtime, commands);
|
|
@@ -122,49 +148,49 @@ function copyIfChanged(source, target) {
|
|
|
122
148
|
}
|
|
123
149
|
}
|
|
124
150
|
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
125
|
-
fs.
|
|
151
|
+
const sourceBytes = fs.readFileSync(source);
|
|
152
|
+
writeFileAtomic(target, sourceBytes);
|
|
126
153
|
return true;
|
|
127
154
|
}
|
|
128
|
-
function planCodexItems(items, home, commands, force) {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
pushRewireItem(items, "codex", hooksPath, commands);
|
|
133
|
-
}
|
|
134
|
-
if (isFile(configPath)) {
|
|
135
|
-
pushRewireItem(items, "codex", configPath, commands);
|
|
136
|
-
let configText = fs.readFileSync(configPath, "utf8");
|
|
155
|
+
function planCodexItems(items, home, project, commands, force) {
|
|
156
|
+
for (const root of [project, home]) {
|
|
157
|
+
const hooksPath = path.join(root, ".codex", "hooks", "codex-hooks.json");
|
|
158
|
+
const configPath = path.join(root, ".codex", "config.toml");
|
|
137
159
|
if (isFile(hooksPath)) {
|
|
138
|
-
|
|
160
|
+
pushRewireItem(items, "codex", hooksPath, commands);
|
|
139
161
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
if (isFile(configPath)) {
|
|
163
|
+
pushRewireItem(items, "codex", configPath, commands);
|
|
164
|
+
const configText = fs.readFileSync(configPath, "utf8");
|
|
165
|
+
const pluginHooks = codexPluginHooksEnabled(configText);
|
|
166
|
+
if (pluginHooks && isFile(hooksPath)) {
|
|
167
|
+
let hooksText;
|
|
168
|
+
try {
|
|
169
|
+
hooksText = fs.readFileSync(hooksPath, "utf8");
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
hooksText = "";
|
|
173
|
+
}
|
|
174
|
+
if (codexCopiedHooksAreAgenteraOnly(hooksText)) {
|
|
175
|
+
items.push({
|
|
176
|
+
status: "pending",
|
|
177
|
+
action: "retire-hooks",
|
|
178
|
+
runtime: "codex",
|
|
179
|
+
source: hooksPath,
|
|
180
|
+
target: configPath,
|
|
181
|
+
message: "will remove Agentera-owned copied Codex hooks because plugin hooks are enabled",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
else if (hooksText.includes("validate_artifact") || hooksText.includes("hook validate-artifact")) {
|
|
185
|
+
items.push({
|
|
186
|
+
status: force ? "pending" : "blocked",
|
|
187
|
+
action: "retire-hooks",
|
|
188
|
+
runtime: "codex",
|
|
189
|
+
source: hooksPath,
|
|
190
|
+
target: configPath,
|
|
191
|
+
message: "plugin hooks are enabled, but copied hook target needs manual review before retirement",
|
|
192
|
+
});
|
|
193
|
+
}
|
|
168
194
|
}
|
|
169
195
|
}
|
|
170
196
|
}
|
|
@@ -205,12 +231,21 @@ function planCursorItems(items, home, project, sourceRoot, commands) {
|
|
|
205
231
|
});
|
|
206
232
|
}
|
|
207
233
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
234
|
+
const skipInTreeCursorAgents = root === project && projectUsesV3CapabilityInstructionModules(project);
|
|
235
|
+
if (skipInTreeCursorAgents) {
|
|
236
|
+
items.push({
|
|
237
|
+
status: "noop",
|
|
238
|
+
action: "copy-agent",
|
|
239
|
+
runtime: "cursor",
|
|
240
|
+
target: agentsDir,
|
|
241
|
+
message: "v3 capability instruction modules present; in-tree .cursor/agents/ uses prime --context and is not overwritten",
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else if (pathExists(agentsSource)) {
|
|
245
|
+
const CURSOR_MANAGED_AGENT = "agentera.md";
|
|
246
|
+
const src = path.join(agentsSource, CURSOR_MANAGED_AGENT);
|
|
247
|
+
if (isFile(src)) {
|
|
248
|
+
const dst = path.join(agentsDir, CURSOR_MANAGED_AGENT);
|
|
214
249
|
if (!isFile(dst)) {
|
|
215
250
|
items.push({
|
|
216
251
|
status: "pending",
|
|
@@ -218,21 +253,22 @@ function planCursorItems(items, home, project, sourceRoot, commands) {
|
|
|
218
253
|
runtime: "cursor",
|
|
219
254
|
source: src,
|
|
220
255
|
target: dst,
|
|
221
|
-
message: "will copy managed Cursor
|
|
256
|
+
message: "will copy managed Cursor Agentera agent",
|
|
222
257
|
});
|
|
223
|
-
continue;
|
|
224
258
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
259
|
+
else {
|
|
260
|
+
const dstText = fs.readFileSync(dst, "utf8");
|
|
261
|
+
const srcText = fs.readFileSync(src, "utf8");
|
|
262
|
+
if (hasCursorManagedAgentMarker(dstText) && dstText !== srcText) {
|
|
263
|
+
items.push({
|
|
264
|
+
status: "pending",
|
|
265
|
+
action: "copy-agent",
|
|
266
|
+
runtime: "cursor",
|
|
267
|
+
source: src,
|
|
268
|
+
target: dst,
|
|
269
|
+
message: "will refresh stale managed Cursor Agentera agent",
|
|
270
|
+
});
|
|
271
|
+
}
|
|
236
272
|
}
|
|
237
273
|
}
|
|
238
274
|
}
|
|
@@ -243,9 +279,12 @@ function planOpencodeItems(items, home, sourceRoot, env, commands) {
|
|
|
243
279
|
const pluginSource = path.join(sourceRoot, ".opencode", "plugins", "agentera.js");
|
|
244
280
|
const pluginTarget = path.join(configDir, "plugins", "agentera.js");
|
|
245
281
|
if (isFile(pluginSource)) {
|
|
282
|
+
const targetContent = isFile(pluginTarget) ? fs.readFileSync(pluginTarget, "utf8") : "";
|
|
283
|
+
const sourceContent = fs.readFileSync(pluginSource, "utf8");
|
|
246
284
|
const needsCopy = !isFile(pluginTarget) ||
|
|
247
|
-
|
|
248
|
-
|
|
285
|
+
(targetContent !== sourceContent &&
|
|
286
|
+
(textUsesPythonManagedEntrypoint(targetContent) ||
|
|
287
|
+
needsChannelNpxRewire(targetContent, commands.cliEntrypoint)));
|
|
249
288
|
items.push({
|
|
250
289
|
status: needsCopy ? "pending" : "noop",
|
|
251
290
|
action: "copy-plugin",
|
|
@@ -261,10 +300,9 @@ function planOpencodeItems(items, home, sourceRoot, env, commands) {
|
|
|
261
300
|
const commandsTargetDir = path.join(configDir, "commands");
|
|
262
301
|
for (const name of OPENCODE_COMMAND_NAMES) {
|
|
263
302
|
const src = path.join(commandsSourceDir, `${name}.md`);
|
|
264
|
-
const expected = opencodeCommandTemplate(name);
|
|
265
303
|
const dst = path.join(commandsTargetDir, `${name}.md`);
|
|
266
304
|
if (isFile(src)) {
|
|
267
|
-
const needsCopy = !isFile(dst) || (hasManagedMarker(fs.readFileSync(dst, "utf8")) && fs.readFileSync(dst
|
|
305
|
+
const needsCopy = !isFile(dst) || (hasManagedMarker(fs.readFileSync(dst, "utf8")) && !fs.readFileSync(src).equals(fs.readFileSync(dst)));
|
|
268
306
|
items.push({
|
|
269
307
|
status: needsCopy ? "pending" : "noop",
|
|
270
308
|
action: "copy-command",
|
|
@@ -277,12 +315,11 @@ function planOpencodeItems(items, home, sourceRoot, env, commands) {
|
|
|
277
315
|
}
|
|
278
316
|
const agentsSourceDir = path.join(sourceRoot, ".opencode", "agents");
|
|
279
317
|
const agentsTargetDir = path.join(configDir, "agents");
|
|
318
|
+
const OPENCODE_MANAGED_AGENT = "agentera.md";
|
|
280
319
|
if (pathExists(agentsSourceDir)) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const src = path.join(agentsSourceDir, entry);
|
|
285
|
-
const dst = path.join(agentsTargetDir, entry);
|
|
320
|
+
const src = path.join(agentsSourceDir, OPENCODE_MANAGED_AGENT);
|
|
321
|
+
if (isFile(src)) {
|
|
322
|
+
const dst = path.join(agentsTargetDir, OPENCODE_MANAGED_AGENT);
|
|
286
323
|
const needsCopy = !isFile(dst) || !fs.readFileSync(src).equals(fs.readFileSync(dst));
|
|
287
324
|
items.push({
|
|
288
325
|
status: needsCopy ? "pending" : "noop",
|
|
@@ -290,12 +327,16 @@ function planOpencodeItems(items, home, sourceRoot, env, commands) {
|
|
|
290
327
|
runtime: "opencode",
|
|
291
328
|
source: src,
|
|
292
329
|
target: dst,
|
|
293
|
-
message: needsCopy ? "will copy managed OpenCode
|
|
330
|
+
message: needsCopy ? "will copy managed OpenCode Agentera agent" : "OpenCode Agentera agent already current",
|
|
294
331
|
});
|
|
295
332
|
}
|
|
296
333
|
}
|
|
297
334
|
const skillsSourceRoot = path.join(sourceRoot, "skills");
|
|
298
|
-
|
|
335
|
+
// D78: ~/.agents/skills is the canonical agent-compatible root (opencode loads
|
|
336
|
+
// from both ~/.config/opencode/skills and ~/.agents/skills and requires skill
|
|
337
|
+
// names unique across locations — opencode.ai/docs/skills). Maintain the link
|
|
338
|
+
// here; the legacy ~/.config/opencode/skills entry is retired below.
|
|
339
|
+
const skillsTargetDir = path.join(home, ".agents", "skills");
|
|
299
340
|
for (const name of OPENCODE_SKILL_NAMES) {
|
|
300
341
|
const src = path.join(skillsSourceRoot, name);
|
|
301
342
|
const dst = path.join(skillsTargetDir, name);
|
|
@@ -347,6 +388,144 @@ function planOpencodeItems(items, home, sourceRoot, env, commands) {
|
|
|
347
388
|
});
|
|
348
389
|
}
|
|
349
390
|
}
|
|
391
|
+
// D78: retire the legacy opencode-specific skill symlinks now that
|
|
392
|
+
// ~/.agents/skills is canonical. The opencode doc requires skill names
|
|
393
|
+
// unique across its discovery locations; a skill present in both
|
|
394
|
+
// ~/.config/opencode/skills and ~/.agents/skills is the duplicate-name error
|
|
395
|
+
// that let a stale copy load.
|
|
396
|
+
const legacySkillsDir = path.join(configDir, "skills");
|
|
397
|
+
if (pathExists(legacySkillsDir) && fs.statSync(legacySkillsDir).isDirectory()) {
|
|
398
|
+
for (const name of OPENCODE_SKILL_NAMES) {
|
|
399
|
+
const legacy = path.join(legacySkillsDir, name);
|
|
400
|
+
let linkTarget = null;
|
|
401
|
+
try {
|
|
402
|
+
linkTarget = fs.readlinkSync(legacy);
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
linkTarget = null;
|
|
406
|
+
}
|
|
407
|
+
if (linkTarget !== null) {
|
|
408
|
+
if (linkTarget.toLowerCase().includes("agentera") || path.basename(linkTarget) === name) {
|
|
409
|
+
items.push({
|
|
410
|
+
status: "pending",
|
|
411
|
+
action: "remove-stale-skill",
|
|
412
|
+
runtime: "opencode",
|
|
413
|
+
source: legacy,
|
|
414
|
+
message: `will retire duplicate OpenCode skill symlink ${name} (agent-compatible root ~/.agents/skills is canonical; D78)`,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
items.push({
|
|
419
|
+
status: "blocked",
|
|
420
|
+
action: "remove-stale-skill",
|
|
421
|
+
runtime: "opencode",
|
|
422
|
+
source: legacy,
|
|
423
|
+
message: `legacy OpenCode skill symlink ${name} targets a non-agentera path; manual review required`,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else if (pathExists(legacy)) {
|
|
428
|
+
try {
|
|
429
|
+
const dirEntries = fs.readdirSync(legacy);
|
|
430
|
+
if (dirEntries.length === 0) {
|
|
431
|
+
items.push({
|
|
432
|
+
status: "pending",
|
|
433
|
+
action: "remove-stale-skill",
|
|
434
|
+
runtime: "opencode",
|
|
435
|
+
source: legacy,
|
|
436
|
+
message: `will retire empty legacy OpenCode skill directory ${name} (agent-compatible root ~/.agents/skills is canonical; D78)`,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
items.push({
|
|
441
|
+
status: "blocked",
|
|
442
|
+
action: "remove-stale-skill",
|
|
443
|
+
runtime: "opencode",
|
|
444
|
+
source: legacy,
|
|
445
|
+
message: `legacy OpenCode skill path ${name} is a non-empty real directory (entries: ${dirEntries.length}); manual review required (D78 retires agentera-managed symlinks and empty dirs only)`,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
items.push({
|
|
451
|
+
status: "blocked",
|
|
452
|
+
action: "remove-stale-skill",
|
|
453
|
+
runtime: "opencode",
|
|
454
|
+
source: legacy,
|
|
455
|
+
message: `legacy OpenCode skill path ${name} could not be inspected; manual review required`,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
export function planStaleCommandCleanupItems(ctx, items) {
|
|
463
|
+
const env = ctx.env ?? process.env;
|
|
464
|
+
const home = resolvePath(ctx.home);
|
|
465
|
+
const commandsDir = path.join(opencodeConfigDir(home, env), "commands");
|
|
466
|
+
if (!pathExists(commandsDir) || !fs.statSync(commandsDir).isDirectory()) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const currentNames = new Set(OPENCODE_COMMAND_NAMES);
|
|
470
|
+
for (const entry of fs.readdirSync(commandsDir)) {
|
|
471
|
+
if (!entry.endsWith(".md")) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
const filePath = path.join(commandsDir, entry);
|
|
475
|
+
if (!isFile(filePath)) {
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const body = fs.readFileSync(filePath, "utf8");
|
|
479
|
+
if (!hasManagedMarker(body)) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
const name = entry.slice(0, -3);
|
|
483
|
+
if (currentNames.has(name)) {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
items.push({
|
|
487
|
+
status: "pending",
|
|
488
|
+
action: "remove-stale-command",
|
|
489
|
+
runtime: "opencode",
|
|
490
|
+
source: filePath,
|
|
491
|
+
message: `will remove stale managed command ${path.basename(filePath)}`,
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
export function planStaleSkillCleanupItems(ctx, items) {
|
|
496
|
+
const env = ctx.env ?? process.env;
|
|
497
|
+
const home = resolvePath(ctx.home);
|
|
498
|
+
const skillsDir = path.join(opencodeConfigDir(home, env), "skills");
|
|
499
|
+
if (!pathExists(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const requiredNames = new Set(OPENCODE_SKILL_NAMES);
|
|
503
|
+
for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
504
|
+
if (!entry.isSymbolicLink()) {
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
const linkPath = path.join(skillsDir, entry.name);
|
|
508
|
+
let linkTarget;
|
|
509
|
+
try {
|
|
510
|
+
linkTarget = fs.readlinkSync(linkPath);
|
|
511
|
+
}
|
|
512
|
+
catch {
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
if (!linkTarget.toLowerCase().includes("agentera")) {
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (requiredNames.has(entry.name)) {
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
items.push({
|
|
522
|
+
status: "pending",
|
|
523
|
+
action: "remove-stale-skill",
|
|
524
|
+
runtime: "opencode",
|
|
525
|
+
source: linkPath,
|
|
526
|
+
message: `will remove stale Agentera skill symlink ${entry.name}`,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
350
529
|
}
|
|
351
530
|
function walkJsonHookFiles(dir) {
|
|
352
531
|
if (!pathExists(dir)) {
|
|
@@ -382,28 +561,30 @@ function planCopilotItems(items, project, commands) {
|
|
|
382
561
|
});
|
|
383
562
|
}
|
|
384
563
|
}
|
|
385
|
-
function planEnvRuntimeNoops(items, runtime, message) {
|
|
386
|
-
if (!items.some((item) => item.runtime === runtime)) {
|
|
387
|
-
items.push({ status: "noop", action: "configure", runtime, message });
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
564
|
export function planRuntimeMigrationItems(ctx) {
|
|
565
|
+
if (!ctx.env) {
|
|
566
|
+
throw new Error("MigrationContext.env is required for runtime migration planning; pass sandboxMigrationEnv(home, sourceRoot) in tests or an explicit env in callers.");
|
|
567
|
+
}
|
|
391
568
|
const home = resolvePath(ctx.home);
|
|
392
569
|
const project = resolvePath(ctx.project);
|
|
393
|
-
const env = ctx.env
|
|
570
|
+
const env = ctx.env;
|
|
394
571
|
const sourceRoot = resolvePath(ctx.sourceRoot ?? resolveSourceRoot(env));
|
|
395
572
|
const commands = resolveNpxHookCommands({ ...ctx, home, env, sourceRoot });
|
|
396
573
|
const items = [];
|
|
397
|
-
planCodexItems(items, home, commands, ctx.force);
|
|
574
|
+
planCodexItems(items, home, project, commands, ctx.force);
|
|
398
575
|
planCursorItems(items, home, project, sourceRoot, commands);
|
|
399
576
|
planOpencodeItems(items, home, sourceRoot, env, commands);
|
|
577
|
+
planStaleCommandCleanupItems(ctx, items);
|
|
578
|
+
planStaleSkillCleanupItems(ctx, items);
|
|
400
579
|
planCopilotItems(items, project, commands);
|
|
401
|
-
|
|
402
|
-
|
|
580
|
+
const hookRetirement = planInstalledHooksRetirementItems(ctx).filter((item) => item.status === "pending");
|
|
581
|
+
if (hookRetirement.length > 0 && items.some((item) => item.action === "rewire-runtime" && item.status === "pending")) {
|
|
582
|
+
items.push(...hookRetirement);
|
|
583
|
+
}
|
|
403
584
|
void loadRegistry();
|
|
404
585
|
return items;
|
|
405
586
|
}
|
|
406
|
-
export function applyRuntimeMigrationItem(item,
|
|
587
|
+
export function applyRuntimeMigrationItem(item, _commands) {
|
|
407
588
|
if (item.status !== "pending") {
|
|
408
589
|
return;
|
|
409
590
|
}
|
|
@@ -415,7 +596,7 @@ export function applyRuntimeMigrationItem(item, commands) {
|
|
|
415
596
|
item.message = "rewire-runtime missing target or newText";
|
|
416
597
|
return;
|
|
417
598
|
}
|
|
418
|
-
|
|
599
|
+
writeFileAtomic(item.target, item.newText, "utf8");
|
|
419
600
|
item.status = "applied";
|
|
420
601
|
item.message = "runtime config rewired to npm self-contained entrypoint";
|
|
421
602
|
break;
|
|
@@ -439,9 +620,27 @@ export function applyRuntimeMigrationItem(item, commands) {
|
|
|
439
620
|
item.message = "link-skill missing source or target";
|
|
440
621
|
return;
|
|
441
622
|
}
|
|
623
|
+
if (!pathExists(item.source)) {
|
|
624
|
+
item.status = "failed";
|
|
625
|
+
item.message = `link-skill source disappeared between plan and apply: ${item.source}`;
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
442
628
|
fs.mkdirSync(path.dirname(item.target), { recursive: true });
|
|
443
|
-
|
|
444
|
-
|
|
629
|
+
// lstat (not stat): stat follows symlinks and ENOENTs on dangling links; rmSync then fails.
|
|
630
|
+
let targetStat = null;
|
|
631
|
+
try {
|
|
632
|
+
targetStat = fs.lstatSync(item.target);
|
|
633
|
+
}
|
|
634
|
+
catch {
|
|
635
|
+
/* target absent */
|
|
636
|
+
}
|
|
637
|
+
if (targetStat) {
|
|
638
|
+
if (targetStat.isSymbolicLink()) {
|
|
639
|
+
fs.unlinkSync(item.target);
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
fs.rmSync(item.target, { recursive: true, force: true });
|
|
643
|
+
}
|
|
445
644
|
}
|
|
446
645
|
fs.symlinkSync(item.source, item.target);
|
|
447
646
|
item.status = "applied";
|
|
@@ -460,12 +659,65 @@ export function applyRuntimeMigrationItem(item, commands) {
|
|
|
460
659
|
if (item.target && isFile(item.target)) {
|
|
461
660
|
const configText = fs.readFileSync(item.target, "utf8");
|
|
462
661
|
const next = retireCodexCopiedHookTrust(configText, item.source);
|
|
463
|
-
|
|
662
|
+
writeFileAtomic(item.target, next, "utf8");
|
|
464
663
|
}
|
|
465
664
|
item.status = "applied";
|
|
466
665
|
item.message = "retired Agentera-owned copied Codex hooks";
|
|
467
666
|
break;
|
|
468
667
|
}
|
|
668
|
+
case "remove-stale-command": {
|
|
669
|
+
if (!item.source) {
|
|
670
|
+
item.status = "failed";
|
|
671
|
+
item.message = "remove-stale-command missing source";
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (isFile(item.source)) {
|
|
675
|
+
fs.rmSync(item.source, { force: true });
|
|
676
|
+
item.status = "applied";
|
|
677
|
+
item.message = `removed stale managed command ${path.basename(item.source)}`;
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
item.status = "noop";
|
|
681
|
+
item.message = `stale command already absent at ${item.source}`;
|
|
682
|
+
}
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
case "remove-stale-skill": {
|
|
686
|
+
if (!item.source) {
|
|
687
|
+
item.status = "failed";
|
|
688
|
+
item.message = "remove-stale-skill missing source";
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
try {
|
|
692
|
+
const stat = fs.lstatSync(item.source);
|
|
693
|
+
if (stat.isSymbolicLink()) {
|
|
694
|
+
fs.unlinkSync(item.source);
|
|
695
|
+
item.status = "applied";
|
|
696
|
+
item.message = `removed stale skill symlink ${path.basename(item.source)}`;
|
|
697
|
+
}
|
|
698
|
+
else if (stat.isDirectory()) {
|
|
699
|
+
const entries = fs.readdirSync(item.source);
|
|
700
|
+
if (entries.length === 0) {
|
|
701
|
+
fs.rmdirSync(item.source);
|
|
702
|
+
item.status = "applied";
|
|
703
|
+
item.message = `removed empty skill directory ${path.basename(item.source)}`;
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
item.status = "blocked";
|
|
707
|
+
item.message = `skill directory ${path.basename(item.source)} is non-empty (entries: ${entries.length}); manual review required`;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
item.status = "noop";
|
|
712
|
+
item.message = "skill path is not a symlink or directory; skipped";
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
catch {
|
|
716
|
+
item.status = "noop";
|
|
717
|
+
item.message = "stale skill already absent";
|
|
718
|
+
}
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
469
721
|
default:
|
|
470
722
|
break;
|
|
471
723
|
}
|
|
@@ -480,5 +732,6 @@ export function applyRuntimeMigrationItems(items, ctx) {
|
|
|
480
732
|
for (const item of items) {
|
|
481
733
|
applyRuntimeMigrationItem(item, commands);
|
|
482
734
|
}
|
|
735
|
+
applyInstalledHooksRetirementItems(items, ctx);
|
|
483
736
|
}
|
|
484
737
|
//# sourceMappingURL=runtimeMigration.js.map
|