akm-cli 0.9.30 → 0.10.261001-beta
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/CHANGELOG.md +438 -0
- package/README.md +10 -10
- package/ROADMAP.md +112 -0
- package/STABILITY.md +99 -57
- package/dist/api-node.mjs +20 -0
- package/dist/api.d.ts +23 -0
- package/dist/api.js +45 -0
- package/dist/assets/hints/cli-hints-full.md +15 -29
- package/dist/assets/hints/cli-hints-short.md +2 -2
- package/dist/assets/improve-strategies/default.json +3 -3
- package/dist/assets/prompts/consolidate-pair.md +9 -7
- package/dist/assets/stash-skeleton/README.md +1 -1
- package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
- package/dist/cli/shared.js +31 -48
- package/dist/cli/unknown-flags.js +6 -43
- package/dist/cli.js +8 -34
- package/dist/commands/agent/contribute-cli.js +1 -1
- package/dist/commands/completions.js +1 -2
- package/dist/commands/config-cli.js +5 -28
- package/dist/commands/env/env-cli.js +5 -5
- package/dist/commands/env/secret-cli.js +2 -2
- package/dist/commands/feedback-cli.js +75 -49
- package/dist/commands/health/checks.js +41 -16
- package/dist/commands/health/plugin-staleness.js +52 -22
- package/dist/commands/improve/autonomy-gate.js +5 -3
- package/dist/commands/improve/consolidate/chunking.js +3 -10
- package/dist/commands/improve/consolidate/continuity-check.js +4 -4
- package/dist/commands/improve/consolidate/pair-pass.js +29 -10
- package/dist/commands/improve/consolidate.js +10 -65
- package/dist/commands/improve/distill/lesson-update.js +91 -0
- package/dist/commands/improve/distill-guards.js +1 -43
- package/dist/commands/improve/distill.js +148 -21
- package/dist/commands/improve/eligibility.js +14 -1
- package/dist/commands/improve/extract-cli.js +1 -1
- package/dist/commands/improve/extract-prompt.js +17 -7
- package/dist/commands/improve/extract.js +5 -7
- package/dist/commands/improve/improve-cli.js +125 -118
- package/dist/commands/improve/improve-strategies.js +8 -12
- package/dist/commands/improve/improve.js +134 -52
- package/dist/commands/improve/loop-stages.js +18 -5
- package/dist/commands/improve/planner.js +0 -1
- package/dist/commands/improve/preparation.js +40 -99
- package/dist/commands/improve/proactive-maintenance.js +2 -2
- package/dist/commands/improve/reflect-noise.js +3 -55
- package/dist/commands/improve/reflect.js +29 -34
- package/dist/commands/improve/retrieval-queries.js +37 -0
- package/dist/commands/improve/retrieval-scope.js +2 -2
- package/dist/commands/improve/salience.js +2 -9
- package/dist/commands/improve/session-asset.js +4 -1
- package/dist/commands/improve/stage.js +23 -12
- package/dist/commands/lint/index.js +5 -20
- package/dist/commands/observability-cli.js +3 -9
- package/dist/commands/proposal/drain.js +43 -6
- package/dist/commands/proposal/proposal-cli.js +11 -31
- package/dist/commands/proposal/repository.js +20 -14
- package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -3
- package/dist/commands/read/knowledge.js +3 -3
- package/dist/commands/read/remember-cli.js +0 -13
- package/dist/commands/read/search-cli.js +29 -97
- package/dist/commands/read/search.js +0 -11
- package/dist/commands/read/show.js +0 -19
- package/dist/commands/sources/plugin-upgrade.js +164 -101
- package/dist/commands/sources/sources-cli.js +1 -15
- package/dist/commands/sources/stash-cli.js +6 -14
- package/dist/commands/tasks/tasks-cli.js +4 -115
- package/dist/commands/workflow/plan.js +11 -33
- package/dist/commands/workflow-cli.js +2 -7
- package/dist/core/adapter/adapter-ids.js +1 -2
- package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
- package/dist/core/adapter/adapters/akm-adapter.js +9 -48
- package/dist/core/adapter/adapters/akm-lint.js +10 -26
- package/dist/core/adapter/adapters/akm-metadata.js +2 -72
- package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
- package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
- package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
- package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
- package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
- package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
- package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
- package/dist/core/adapter/recognize-match.js +3 -4
- package/dist/core/common.js +18 -2
- package/dist/core/config/config-schema.js +12 -15
- package/dist/core/config/config-types.js +6 -15
- package/dist/core/config/config-walker.js +6 -23
- package/dist/core/config/config.js +17 -80
- package/dist/core/config/engine-semantics.js +7 -3
- package/dist/core/config/schema/engines.js +7 -7
- package/dist/core/config/schema/improve-processes.js +10 -63
- package/dist/core/config/schema/improve.js +2 -21
- package/dist/core/config/schema/index-config.js +6 -39
- package/dist/core/env-secret-ref.js +2 -45
- package/dist/core/errors.js +1 -2
- package/dist/core/extra-params.js +2 -86
- package/dist/core/file-lock.js +12 -7
- package/dist/core/improve-result.js +13 -1
- package/dist/core/mutation-target.js +2 -2
- package/dist/core/paths.js +4 -0
- package/dist/core/recognition-util.js +4 -5
- package/dist/core/run-lock.js +1 -1
- package/dist/core/subprocess.js +49 -0
- package/dist/core/warn.js +21 -4
- package/dist/core/write-source.js +3 -3
- package/dist/execution/target-ref.js +1 -2
- package/dist/indexer/indexer.js +15 -6
- package/dist/indexer/passes/memory-inference.js +15 -6
- package/dist/indexer/search/db-search.js +49 -36
- package/dist/indexer/search/fts-query.js +0 -19
- package/dist/indexer/search/ranking.js +29 -1
- package/dist/indexer/usage/usage-events.js +21 -16
- package/dist/integrations/agent/engine-resolution.js +5 -2
- package/dist/integrations/agent/index.js +1 -1
- package/dist/integrations/agent/profiles.js +41 -98
- package/dist/integrations/agent/request-lowering.js +3 -3
- package/dist/integrations/harnesses/aider/index.js +5 -0
- package/dist/integrations/harnesses/amazonq/index.js +1 -0
- package/dist/integrations/harnesses/claude/config-import.js +2 -3
- package/dist/integrations/harnesses/claude/index.js +5 -0
- package/dist/integrations/harnesses/codex/index.js +1 -0
- package/dist/integrations/harnesses/copilot/index.js +1 -0
- package/dist/integrations/harnesses/gemini/index.js +1 -0
- package/dist/integrations/harnesses/index.js +18 -39
- package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
- package/dist/integrations/harnesses/opencode/config-import.js +121 -52
- package/dist/integrations/harnesses/opencode/index.js +22 -0
- package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
- package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
- package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
- package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
- package/dist/integrations/harnesses/opencode/session-log.js +104 -115
- package/dist/integrations/harnesses/opencode/version.js +98 -0
- package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
- package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
- package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +254 -0
- package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
- package/dist/integrations/harnesses/openhands/index.js +1 -0
- package/dist/integrations/harnesses/pi/index.js +1 -0
- package/dist/integrations/harnesses/shared.js +2 -0
- package/dist/integrations/harnesses/types.js +2 -0
- package/dist/llm/client.js +74 -14
- package/dist/output/cli-hints.js +1 -1
- package/dist/output/context.js +10 -19
- package/dist/output/format-exempt.js +5 -8
- package/dist/output/shapes/helpers.js +1 -22
- package/dist/output/shapes/passthrough.js +0 -1
- package/dist/output/shapes.js +3 -31
- package/dist/output/stdout.js +5 -1
- package/dist/output/text/command-format.js +6 -1
- package/dist/output/text/workflow-format.js +4 -22
- package/dist/scripts/akm-migrate-node.js +15769 -16731
- package/dist/scripts/akm-migrate.js +16339 -17297
- package/dist/setup/detect.js +10 -4
- package/dist/setup/harness-config-import.js +5 -14
- package/dist/setup/setup.js +1 -1
- package/dist/setup/steps/tasks.js +12 -13
- package/dist/sources/providers/git-stash.js +94 -13
- package/dist/storage/repositories/index-utility-repository.js +2 -32
- package/dist/storage/repositories/index-vec-repository.js +4 -0
- package/dist/storage/repositories/task-history-repository.js +0 -5
- package/dist/storage/repositories/workflow-runs-repository.js +5 -15
- package/dist/tasks/embedded.js +2 -1
- package/dist/tasks/run/run-command-task.js +9 -1
- package/dist/tasks/run/run-workflow-task.js +4 -3
- package/dist/tasks/run/task-history.js +0 -2
- package/dist/tasks/run/task-log.js +38 -1
- package/dist/tasks/schedule-gates.js +39 -0
- package/dist/tasks/scheduler-binding.js +0 -16
- package/dist/tasks/scheduler-sync.js +3 -97
- package/dist/tasks/source/bounded-document.js +1 -1
- package/dist/tasks/source/task-source-v4.js +2 -12
- package/dist/tasks/task-run-reserved-flags.js +2 -31
- package/dist/workflows/authoring/authoring.js +6 -6
- package/dist/workflows/compile.js +8 -65
- package/dist/workflows/exec/child-workflow.js +22 -3
- package/dist/workflows/exec/native-executor.js +12 -147
- package/dist/workflows/exec/run-workflow.js +31 -103
- package/dist/workflows/exec/step-work.js +9 -178
- package/dist/workflows/exec/unit-dispatch.js +0 -10
- package/dist/workflows/freeze/environment.js +3 -44
- package/dist/workflows/freeze/freeze.js +8 -41
- package/dist/workflows/freeze/targets/child-workflow.js +27 -63
- package/dist/workflows/freeze/targets/command.js +2 -16
- package/dist/workflows/freeze/targets/shell.js +0 -2
- package/dist/workflows/freeze/task-bindings.js +2 -28
- package/dist/workflows/ir/params.js +12 -2
- package/dist/workflows/parser.js +82 -232
- package/dist/workflows/plan.js +1 -1
- package/dist/workflows/renderer.js +10 -19
- package/dist/workflows/runtime/run-plan.js +11 -53
- package/dist/workflows/runtime/runs.js +4 -27
- package/dist/workflows/source-files.js +12 -16
- package/dist/workflows/source-semantics.js +1 -93
- package/docs/README.md +43 -42
- package/docs/agents/README.md +15 -0
- package/docs/agents/agent-install.md +14 -0
- package/docs/architecture/0.10-process-rules.md +827 -0
- package/docs/architecture/README.md +67 -0
- package/docs/architecture/adapters.md +258 -0
- package/docs/architecture/akm-architecture-decision-history.md +2055 -0
- package/docs/architecture/akm-core-principles.md +126 -0
- package/docs/architecture/architecture.md +578 -0
- package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
- package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
- package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
- package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
- package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
- package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
- package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
- package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
- package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
- package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
- package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
- package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
- package/docs/architecture/decisions/README.md +62 -0
- package/docs/architecture/improvement.md +479 -0
- package/docs/architecture/internals/classification.md +154 -0
- package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
- package/docs/architecture/internals/functional-contract-patterns.md +340 -0
- package/docs/architecture/internals/health-advisories.md +110 -0
- package/docs/architecture/internals/improve-workflow.md +719 -0
- package/docs/architecture/internals/indexing.md +498 -0
- package/docs/architecture/internals/registry-network-boundary.md +57 -0
- package/docs/architecture/internals/search.md +248 -0
- package/docs/architecture/internals/storage-locations.md +943 -0
- package/docs/architecture/persisted-data-compat.md +68 -0
- package/docs/architecture/reviews/env-secret-access.md +319 -0
- package/docs/architecture/runtime-boundary-design.md +153 -0
- package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
- package/docs/architecture/specs/0.9.0-decisions.md +532 -0
- package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
- package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
- package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
- package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
- package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
- package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
- package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
- package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
- package/docs/architecture/specs/di-seams-plan.md +539 -0
- package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
- package/docs/architecture/specs/fact-asset-type.md +142 -0
- package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
- package/docs/architecture/specs/okf-support.md +148 -0
- package/docs/architecture/specs/ref.md +329 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
- package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
- package/docs/architecture/specs/stash-organization-conventions.md +377 -0
- package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
- package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
- package/docs/architecture/specs/workflow-format-unification.md +432 -0
- package/docs/architecture/testing/manual-testing-checklist.md +3411 -0
- package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
- package/docs/architecture/testing/task-workflow-manual-tests.md +1720 -0
- package/docs/architecture/testing/testing-workflow.md +446 -0
- package/docs/architecture/workflow-engine.md +223 -0
- package/docs/guides/README.md +33 -0
- package/docs/guides/author-bundles.md +310 -0
- package/docs/guides/author-workflows.md +490 -0
- package/docs/guides/bundles.md +323 -0
- package/docs/guides/capture-knowledge.md +136 -0
- package/docs/guides/claude-code-vs-akm-workflows.md +29 -0
- package/docs/guides/concepts.md +93 -0
- package/docs/guides/discover-and-load.md +158 -0
- package/docs/guides/getting-started.md +240 -0
- package/docs/guides/improve-the-library.md +247 -0
- package/docs/guides/knowledge-management.md +18 -0
- package/docs/guides/recipes/headless-install.md +97 -0
- package/docs/guides/recipes/website-source.md +28 -0
- package/docs/guides/run-workflows.md +279 -0
- package/docs/guides/scheduling.md +131 -0
- package/docs/guides/use-with-any-agent.md +174 -0
- package/docs/guides/wikis.md +81 -0
- package/docs/integration/bundling-akm.md +7 -6
- package/docs/maintainers/README.md +19 -0
- package/docs/maintainers/curate-workmap.md +335 -0
- package/docs/maintainers/eval.md +3 -0
- package/docs/maintainers/local-development.md +108 -0
- package/docs/maintainers/release-checklist.md +135 -0
- package/docs/migration/README.md +4 -2
- package/docs/migration/release-notes/0.0.13.md +1 -1
- package/docs/migration/release-notes/0.1.0.md +1 -1
- package/docs/migration/release-notes/0.10.0.md +201 -0
- package/docs/migration/release-notes/0.2.0.md +1 -1
- package/docs/migration/release-notes/0.3.0.md +1 -1
- package/docs/migration/release-notes/0.5.0.md +1 -1
- package/docs/migration/release-notes/0.6.0.md +1 -1
- package/docs/migration/release-notes/0.7.0.md +1 -1
- package/docs/migration/release-notes/0.7.3.md +2 -2
- package/docs/migration/release-notes/0.7.4.md +1 -1
- package/docs/migration/release-notes/0.7.5.md +1 -1
- package/docs/migration/release-notes/0.8.0.md +1 -1
- package/docs/migration/release-notes/0.9.0.md +1 -1
- package/docs/migration/release-notes/0.9.14.md +1 -1
- package/docs/migration/release-notes/0.9.15.md +1 -1
- package/docs/migration/release-notes/0.9.16.md +1 -1
- package/docs/migration/release-notes/0.9.17.md +1 -1
- package/docs/migration/release-notes/0.9.19.md +1 -1
- package/docs/migration/release-notes/0.9.2.md +1 -1
- package/docs/migration/release-notes/README.md +28 -31
- package/docs/migration/v0.5-to-v0.6.md +759 -0
- package/docs/migration/v0.8-to-v0.9.md +1 -1
- package/docs/migration/v0.9-to-v0.10.md +507 -0
- package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
- package/docs/posts/README.md +30 -0
- package/docs/posts/akm-command-tour.md +495 -0
- package/docs/posts/akm-logo-sized.webp +0 -0
- package/docs/posts/belief-aware-memory-12.md +139 -0
- package/docs/posts/config-v2-lessons-16.md +191 -0
- package/docs/posts/improve-loop-autonomous-10.md +225 -0
- package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
- package/docs/posts/intro-part-01.md +76 -0
- package/docs/posts/intro-part-02.md +221 -0
- package/docs/posts/intro-part-03.md +190 -0
- package/docs/posts/intro-part-04.md +221 -0
- package/docs/posts/llm-mode-reflect-13.md +166 -0
- package/docs/posts/openpalm-built-on-akm.md +86 -0
- package/docs/posts/progressive-disclosure-06.md +129 -0
- package/docs/posts/proposal-safety-net-15.md +112 -0
- package/docs/posts/release-0.5.0.md +247 -0
- package/docs/posts/release-0.6.0.md +117 -0
- package/docs/posts/release-0.7.0.md +159 -0
- package/docs/posts/release-0.8.0.md +332 -0
- package/docs/posts/scattered-skills-05.md +100 -0
- package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
- package/docs/posts/team-skills-07.md +198 -0
- package/docs/posts/wiki-agent-knowledge-08.md +223 -0
- package/docs/posts/workflows-vaults-09.md +321 -0
- package/docs/product-surface.md +54 -0
- package/docs/reference/README.md +2 -2
- package/docs/reference/api.md +65 -0
- package/docs/reference/asset-types.md +166 -0
- package/docs/reference/bundle-types.md +2 -4
- package/docs/reference/cli.md +163 -192
- package/docs/reference/configuration.md +101 -20
- package/docs/reference/data-and-telemetry.md +2 -2
- package/docs/reference/env-and-secrets.md +126 -0
- package/docs/reference/memory.md +124 -0
- package/docs/reference/refs.md +156 -0
- package/docs/reference/registry.md +489 -0
- package/docs/reference/supported-formats.md +3 -4
- package/docs/reference/tasks.md +12 -19
- package/docs/reference/website-sources.md +141 -0
- package/docs/reference/workflow-schema.md +89 -317
- package/docs/reference/workflows.md +20 -48
- package/package.json +23 -16
- package/schemas/akm-config.json +2 -243
- package/schemas/akm-task.json +2 -3
- package/schemas/akm-workflow.json +47 -84
- package/dist/assets/improve-strategies/catchup.json +0 -41
- package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
- package/dist/assets/improve-strategies/quick.json +0 -17
- package/dist/assets/improve-strategies/reflect-distill.json +0 -29
- package/dist/assets/improve-strategies/thorough.json +0 -49
- package/dist/assets/prompts/retrieval-relevance-judge.md +0 -6
- package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
- package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
- package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
- package/dist/cli/retired-commands.js +0 -118
- package/dist/commands/improve/retrieval-gate.js +0 -132
- package/dist/commands/tasks/validate.js +0 -176
- package/dist/core/config/legacy-source-shape-shim.js +0 -117
- package/dist/indexer/feedback/utility-policy.js +0 -75
- package/dist/integrations/harnesses/ids.js +0 -28
- package/dist/tasks/source/task-source-v3-frozen.js +0 -424
- package/dist/tasks/source/task-to-v4.js +0 -863
- package/dist/workflows/exec/worktree.js +0 -372
- package/dist/workflows/freeze/child-output-references.js +0 -83
- package/dist/workflows/freeze/identity.js +0 -22
- package/dist/workflows/freeze/targets/script.js +0 -50
- package/dist/workflows/freeze/targets/task.js +0 -124
- package/dist/workflows/github-yaml.js +0 -506
- package/dist/workflows/runtime/run-outputs.js +0 -80
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* commands are absorbed here as `extract` and `new` — no top-level
|
|
14
14
|
* registration remains for either spelling.
|
|
15
15
|
*/
|
|
16
|
-
import { getParsedInvocation } from "../../cli/invocation.js";
|
|
17
16
|
import { parsePositiveIntFlag } from "../../cli/parse-args.js";
|
|
18
17
|
import { defineGroupCommand, defineJsonCommand, output } from "../../cli/shared.js";
|
|
19
18
|
import { resolveStashDir } from "../../core/common.js";
|
|
@@ -36,20 +35,6 @@ export function mergeProposalDrainNotices(resolutionNotices, dispatchNotices) {
|
|
|
36
35
|
byKey.set(JSON.stringify(notice), notice);
|
|
37
36
|
return byKey.size > 0 ? Object.freeze([...byKey.values()]) : undefined;
|
|
38
37
|
}
|
|
39
|
-
/**
|
|
40
|
-
* `--source` was renamed to `--generator` on `proposal accept`/`proposal
|
|
41
|
-
* reject` in 0.9 (WS3/S8 — "Removed in 0.9.0"). citty is non-strict, so the
|
|
42
|
-
* retired spelling is silently absorbed rather than rejected — a bulk
|
|
43
|
-
* accept/reject invoked with `--source <name>` then has neither `--generator`
|
|
44
|
-
* nor a positional id, and falls through to the single-proposal path, which
|
|
45
|
-
* throws MISSING_REQUIRED_ARGUMENT instead of running the bulk action the
|
|
46
|
-
* caller asked for. Reject it explicitly instead.
|
|
47
|
-
*/
|
|
48
|
-
function rejectRetiredProposalSourceFlag(subcommand) {
|
|
49
|
-
if (!getParsedInvocation().hasFlag("--source"))
|
|
50
|
-
return;
|
|
51
|
-
throw new UsageError(`\`akm proposal ${subcommand} --source\` was renamed to \`--generator\` in 0.9. Use \`--generator <name>\` instead.`, "INVALID_FLAG_VALUE");
|
|
52
|
-
}
|
|
53
38
|
/**
|
|
54
39
|
* Parse + validate the shared bulk-adjudication filter flags
|
|
55
40
|
* (`--max-diff-lines`, `--older-than`). Extracted from the two verbatim
|
|
@@ -117,7 +102,7 @@ const proposalAcceptCommand = defineJsonCommand({
|
|
|
117
102
|
required: false,
|
|
118
103
|
},
|
|
119
104
|
queue: { type: "string", description: "Select the proposal queue by source name" },
|
|
120
|
-
|
|
105
|
+
bundle: { type: "string", description: "Write destination; must match the proposal's recorded target" },
|
|
121
106
|
// F-6 / #393: Batch accept by generator, diff size, or age.
|
|
122
107
|
generator: {
|
|
123
108
|
type: "string",
|
|
@@ -144,7 +129,6 @@ const proposalAcceptCommand = defineJsonCommand({
|
|
|
144
129
|
},
|
|
145
130
|
},
|
|
146
131
|
async run({ args }) {
|
|
147
|
-
rejectRetiredProposalSourceFlag("accept");
|
|
148
132
|
const generator = args.generator;
|
|
149
133
|
// F-6 / #393: Bulk-accept when --generator is provided without a positional id.
|
|
150
134
|
if (generator && !args.id) {
|
|
@@ -162,7 +146,7 @@ const proposalAcceptCommand = defineJsonCommand({
|
|
|
162
146
|
olderThanMs,
|
|
163
147
|
dryRun: args["dry-run"],
|
|
164
148
|
queue: args.queue,
|
|
165
|
-
target: args.
|
|
149
|
+
target: args.bundle,
|
|
166
150
|
});
|
|
167
151
|
output("proposal-accept-batch", {
|
|
168
152
|
accepted: count,
|
|
@@ -182,7 +166,7 @@ const proposalAcceptCommand = defineJsonCommand({
|
|
|
182
166
|
const result = await akmProposalAccept({
|
|
183
167
|
id: args.id,
|
|
184
168
|
queue: args.queue,
|
|
185
|
-
target: args.
|
|
169
|
+
target: args.bundle,
|
|
186
170
|
});
|
|
187
171
|
output("proposal-accept", result);
|
|
188
172
|
},
|
|
@@ -223,7 +207,6 @@ const proposalRejectCommand = defineJsonCommand({
|
|
|
223
207
|
},
|
|
224
208
|
},
|
|
225
209
|
async run({ args }) {
|
|
226
|
-
rejectRetiredProposalSourceFlag("reject");
|
|
227
210
|
const generator = args.generator;
|
|
228
211
|
if (!args.reason || !String(args.reason).trim()) {
|
|
229
212
|
throw new UsageError("Usage: akm proposal reject <id> --reason '<reason>' OR akm proposal reject --generator <generator> --reason '<reason>'", "MISSING_REQUIRED_ARGUMENT");
|
|
@@ -312,10 +295,10 @@ const proposalDiffCommand = defineJsonCommand({
|
|
|
312
295
|
required: true,
|
|
313
296
|
},
|
|
314
297
|
queue: { type: "string", description: "Select the proposal queue by source name" },
|
|
315
|
-
|
|
298
|
+
bundle: { type: "string", description: "Diff destination; must match the proposal's recorded target" },
|
|
316
299
|
},
|
|
317
300
|
run({ args }) {
|
|
318
|
-
const result = akmProposalDiff({ id: args.id, queue: args.queue, target: args.
|
|
301
|
+
const result = akmProposalDiff({ id: args.id, queue: args.queue, target: args.bundle });
|
|
319
302
|
output("proposal-diff", result);
|
|
320
303
|
},
|
|
321
304
|
});
|
|
@@ -342,13 +325,13 @@ const proposalRevertCommand = defineJsonCommand({
|
|
|
342
325
|
required: true,
|
|
343
326
|
},
|
|
344
327
|
queue: { type: "string", description: "Select the proposal queue by source name" },
|
|
345
|
-
|
|
328
|
+
bundle: { type: "string", description: "Write destination; must match the proposal's recorded target" },
|
|
346
329
|
},
|
|
347
330
|
async run({ args }) {
|
|
348
331
|
const result = await akmProposalRevert({
|
|
349
332
|
id: args.id,
|
|
350
333
|
queue: args.queue,
|
|
351
|
-
target: args.
|
|
334
|
+
target: args.bundle,
|
|
352
335
|
});
|
|
353
336
|
output("proposal-revert", result);
|
|
354
337
|
},
|
|
@@ -372,7 +355,7 @@ const proposalShowCommand = defineJsonCommand({
|
|
|
372
355
|
const proposalDrainCommand = defineJsonCommand({
|
|
373
356
|
meta: {
|
|
374
357
|
name: "drain",
|
|
375
|
-
description: "Drain the pending proposal backlog: accept what a quality judge passed, reject empty diffs, leave the rest for judgment or review",
|
|
358
|
+
description: "Drain the pending proposal backlog: accept what a quality judge passed, reject empty diffs, leave the rest for judgment or review. The judgment tier accepts only consolidate promotions; it accepted unsafe retirements and unreviewed fixes in testing (#1132), so every other kind waits for a person",
|
|
376
359
|
},
|
|
377
360
|
args: {
|
|
378
361
|
"dry-run": {
|
|
@@ -401,7 +384,7 @@ const proposalDrainCommand = defineJsonCommand({
|
|
|
401
384
|
},
|
|
402
385
|
judgment: {
|
|
403
386
|
type: "boolean",
|
|
404
|
-
description: "Enable the judgment tier for this drain (overrides judgment.enabled=false; agent/sdk per config). No-op with a logged triage_deferred summary when no runner is configured.",
|
|
387
|
+
description: "Enable the judgment tier for this drain (overrides judgment.enabled=false; agent/sdk per config). It accepts only consolidate promotions; every other kind it would accept is left for review. No-op with a logged triage_deferred summary when no runner is configured.",
|
|
405
388
|
default: false,
|
|
406
389
|
},
|
|
407
390
|
strategy: {
|
|
@@ -409,10 +392,7 @@ const proposalDrainCommand = defineJsonCommand({
|
|
|
409
392
|
description: "Read the triage block (applyMode, ceilings, judgment) from this improve strategy; enabled judgment runs the judge.",
|
|
410
393
|
},
|
|
411
394
|
},
|
|
412
|
-
async run({ args
|
|
413
|
-
if (rawArgs.some((arg) => arg === "--profile" || arg.startsWith("--profile="))) {
|
|
414
|
-
throw new UsageError("proposal drain: --profile is retired; use --strategy.", "INVALID_FLAG_VALUE");
|
|
415
|
-
}
|
|
395
|
+
async run({ args }) {
|
|
416
396
|
const stashDir = resolveStashDir();
|
|
417
397
|
const cfg = loadConfig();
|
|
418
398
|
// Phase 2: read the triage block from the named improve strategy. CLI flags
|
|
@@ -423,7 +403,7 @@ const proposalDrainCommand = defineJsonCommand({
|
|
|
423
403
|
const applyMode = args.promote === true ? "promote" : (triageConfig?.applyMode ?? "queue");
|
|
424
404
|
const maxAccepts = parsePositiveIntFlag(args["max-accepts"], "--max-accepts") ??
|
|
425
405
|
triageConfig?.maxAcceptsPerRun ??
|
|
426
|
-
|
|
406
|
+
200;
|
|
427
407
|
const rawOlderThan = parsePositiveIntFlag(args["older-than"], "--older-than");
|
|
428
408
|
const olderThanMs = rawOlderThan !== undefined ? rawOlderThan * 86_400_000 : undefined;
|
|
429
409
|
// Promotion in promote mode is destructive (commits to git, no batch revert).
|
|
@@ -612,14 +612,10 @@ export function expireStaleProposals(stashDir, config, ctx) {
|
|
|
612
612
|
const nowMs = (ctx?.now ?? Date.now)();
|
|
613
613
|
const pending = listProposals(stashDir, { status: "pending" }, ctx);
|
|
614
614
|
for (const p of pending) {
|
|
615
|
-
//
|
|
616
|
-
//
|
|
617
|
-
// one
|
|
618
|
-
//
|
|
619
|
-
// permanently drop a still-fresh pair nobody has reviewed yet, with no
|
|
620
|
-
// way back short of the pair pass finding it again from scratch.
|
|
621
|
-
if (isRetireProposal(p))
|
|
622
|
-
continue;
|
|
615
|
+
// A retire proposal expires like any other: `akm proposal reopen` (#997)
|
|
616
|
+
// brings an expired one back while its files and hashes are still fresh,
|
|
617
|
+
// and an unexpired one would hold its pair (pair-pass.ts's
|
|
618
|
+
// pendingRetireRefs) for good.
|
|
623
619
|
// A reopened proposal's wait starts over at the reopen (#997): expiring it
|
|
624
620
|
// on its original age would undo the reopen at the next sweep.
|
|
625
621
|
const createdMs = new Date(proposalWaitingSince(p)).getTime();
|
|
@@ -824,7 +820,7 @@ function resolveRecordedProposalTarget(config, proposalId, binding, explicitTarg
|
|
|
824
820
|
const targetBundleId = canonicalBundleIdForTarget(config, target);
|
|
825
821
|
if (targetBundleId !== binding.source || path.resolve(target.source.path) !== path.resolve(binding.root)) {
|
|
826
822
|
throw new UsageError(`Proposal ${proposalId} is bound to target "${binding.source}" at ${binding.root}; ` +
|
|
827
|
-
`--
|
|
823
|
+
`--bundle "${explicitTarget}" resolves to "${targetBundleId}" at ${target.source.path}.`, "INVALID_FLAG_VALUE");
|
|
828
824
|
}
|
|
829
825
|
return { ...target, source: { ...target.source, name: targetBundleId } };
|
|
830
826
|
}
|
|
@@ -841,7 +837,7 @@ function resolveProposalWriteTarget(config, proposal, explicitTarget, queueTarge
|
|
|
841
837
|
const target = named(resolveBundleWriteTarget(config, identity.bundle));
|
|
842
838
|
if (explicitTarget !== undefined &&
|
|
843
839
|
canonicalBundleIdForTarget(config, resolveWriteTarget(config, explicitTarget)) !== identity.bundle) {
|
|
844
|
-
throw new UsageError(`Proposal ${proposal.id} ref is bound to bundle "${identity.bundle}", which conflicts with --
|
|
840
|
+
throw new UsageError(`Proposal ${proposal.id} ref is bound to bundle "${identity.bundle}", which conflicts with --bundle "${explicitTarget}".`, "INVALID_FLAG_VALUE");
|
|
845
841
|
}
|
|
846
842
|
if (queueTarget && canonicalBundleIdForTarget(config, queueTarget) !== identity.bundle) {
|
|
847
843
|
throw new UsageError(`Proposal ${proposal.id} is bound to a different queue target.`, "INVALID_FLAG_VALUE");
|
|
@@ -850,7 +846,7 @@ function resolveProposalWriteTarget(config, proposal, explicitTarget, queueTarge
|
|
|
850
846
|
}
|
|
851
847
|
const target = explicitTarget ? resolveWriteTarget(config, explicitTarget) : queueTarget;
|
|
852
848
|
if (!target) {
|
|
853
|
-
throw new UsageError(`Unbound short proposal ${proposal.id} requires an explicit --
|
|
849
|
+
throw new UsageError(`Unbound short proposal ${proposal.id} requires an explicit --bundle or authenticated --queue context.`, "INVALID_PROPOSAL");
|
|
854
850
|
}
|
|
855
851
|
return named(target);
|
|
856
852
|
}
|
|
@@ -1521,7 +1517,14 @@ async function unretireProposalWithLease(stashDir, config, proposal, options, ct
|
|
|
1521
1517
|
if (originalExists && archivedExists) {
|
|
1522
1518
|
throw new UsageError(`Cannot revert proposal ${proposal.id}: ${originalRel} already exists (created since retirement); refusing to overwrite it.`, "INVALID_FLAG_VALUE");
|
|
1523
1519
|
}
|
|
1524
|
-
|
|
1520
|
+
// The graced purge deletes the archived bytes once git holds them, but the
|
|
1521
|
+
// proposal keeps the primary's exact pre-retire bytes (`backupContent`),
|
|
1522
|
+
// so the primary can still be restored from those.
|
|
1523
|
+
const fromBackup = !originalExists &&
|
|
1524
|
+
!archivedExists &&
|
|
1525
|
+
proposal.backupContent !== undefined &&
|
|
1526
|
+
path.resolve(originalAbs) === path.resolve(assetPath);
|
|
1527
|
+
if (!originalExists && !archivedExists && !fromBackup) {
|
|
1525
1528
|
throw new UsageError(`Cannot revert proposal ${proposal.id}: archived copy ${archivedRel} is missing.`, "INVALID_FLAG_VALUE");
|
|
1526
1529
|
}
|
|
1527
1530
|
// Must-fix 2 (third review round): "original present, archived copy
|
|
@@ -1546,12 +1549,15 @@ async function unretireProposalWithLease(stashDir, config, proposal, options, ct
|
|
|
1546
1549
|
throw new UsageError(`Cannot revert proposal ${proposal.id}: ${originalRel} exists but its content does not match what was retired (its path may have been reused since); refusing to overwrite it.`, "INVALID_FLAG_VALUE");
|
|
1547
1550
|
}
|
|
1548
1551
|
}
|
|
1549
|
-
pending.push({ dirAbs, auditPath, originalAbs, archivedAbs, alreadyDone: originalExists });
|
|
1552
|
+
pending.push({ dirAbs, auditPath, originalAbs, archivedAbs, alreadyDone: originalExists, fromBackup });
|
|
1550
1553
|
}
|
|
1551
1554
|
const restoredPaths = [];
|
|
1552
1555
|
let primaryOriginalAbs;
|
|
1553
1556
|
for (const p of pending) {
|
|
1554
|
-
if (
|
|
1557
|
+
if (p.fromBackup) {
|
|
1558
|
+
fs.mkdirSync(path.dirname(p.originalAbs), { recursive: true });
|
|
1559
|
+
}
|
|
1560
|
+
else if (!p.alreadyDone) {
|
|
1555
1561
|
fs.mkdirSync(path.dirname(p.originalAbs), { recursive: true });
|
|
1556
1562
|
fs.renameSync(p.archivedAbs, p.originalAbs);
|
|
1557
1563
|
recordWrittenPath(p.archivedAbs);
|
|
@@ -138,9 +138,6 @@ export function hasSupersededStatus(frontmatter) {
|
|
|
138
138
|
const status = frontmatter?.status;
|
|
139
139
|
return typeof status === "string" && status.trim().toLowerCase() === "superseded";
|
|
140
140
|
}
|
|
141
|
-
export function hasHotCaptureMode(frontmatter) {
|
|
142
|
-
return frontmatter?.captureMode === "hot";
|
|
143
|
-
}
|
|
144
141
|
export const REFLECT_SHRINK_RATIO_MIN = 0.5;
|
|
145
142
|
export const REFLECT_EXPAND_RATIO_MAX = 2.5;
|
|
146
143
|
export const REFLECT_SIZE_GUARD_MIN_BYTES = 200;
|
|
@@ -491,7 +491,7 @@ export function resolveSupersedesForWrite(rawRefs, target, targetFlag) {
|
|
|
491
491
|
: {
|
|
492
492
|
reason: namedWritableSource
|
|
493
493
|
? `resolves outside the write target and the working stash, in writable source "${namedWritableSource}" at ${root}; ` +
|
|
494
|
-
`re-run with ${targetFlag ?? "--
|
|
494
|
+
`re-run with ${targetFlag ?? "--bundle"} ${namedWritableSource} to demote it there`
|
|
495
495
|
: `resolves outside the write target and the working stash, in a read-only source at ${root}; ` +
|
|
496
496
|
"demotion only applies to assets in the write target or the working stash",
|
|
497
497
|
}),
|
|
@@ -506,7 +506,7 @@ export function resolveSupersedesForWrite(rawRefs, target, targetFlag) {
|
|
|
506
506
|
/**
|
|
507
507
|
* Write a markdown asset (knowledge or memory) to the resolved write target.
|
|
508
508
|
*
|
|
509
|
-
* Resolves the write target via the v1 precedence chain (`--
|
|
509
|
+
* Resolves the write target via the v1 precedence chain (`--bundle` →
|
|
510
510
|
* `defaultWriteTarget` → working stash), validates the path is within the
|
|
511
511
|
* type root, enforces `--force` semantics, and delegates the actual write
|
|
512
512
|
* to `writeAssetToSource`.
|
|
@@ -613,7 +613,7 @@ export async function writeMarkdownAsset(options) {
|
|
|
613
613
|
// Write-path indexing: the asset is searchable immediately. Fail-open; reads
|
|
614
614
|
// no longer trigger reindexes, so keeping the index current is the writer's
|
|
615
615
|
// job. Demoted files reindex under their own containing root (usually the
|
|
616
|
-
// write target itself; the working stash when writing to a --
|
|
616
|
+
// write target itself; the working stash when writing to a --bundle) so
|
|
617
617
|
// `--belief current` filtering takes effect without waiting for the next
|
|
618
618
|
// full index. (alpha.4 removed belief weights from ranking; `--belief` is
|
|
619
619
|
// the only reader of `beliefState` today.)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
-
import { getParsedInvocation } from "../../cli/invocation.js";
|
|
5
4
|
import { getStringArg } from "../../cli/parse-args.js";
|
|
6
5
|
import { defineJsonCommand, output, parseAllFlagValues } from "../../cli/shared.js";
|
|
7
6
|
import { UsageError } from "../../core/errors.js";
|
|
@@ -35,17 +34,6 @@ async function fetchSimilarMemories(query, excludeRef, eventSource) {
|
|
|
35
34
|
}
|
|
36
35
|
/** The flag `remember` takes for its destination, as its errors spell it. */
|
|
37
36
|
const TARGET_FLAG = "--bundle";
|
|
38
|
-
/**
|
|
39
|
-
* `--target` was renamed to `--bundle` on `remember` in 0.9 (S8). citty is
|
|
40
|
-
* non-strict, so the retired spelling is silently absorbed rather than
|
|
41
|
-
* rejected — the memory then lands in the default bundle instead of the one
|
|
42
|
-
* the caller named, with exit 0 and no error. Reject it explicitly instead.
|
|
43
|
-
*/
|
|
44
|
-
function rejectRetiredTargetFlag() {
|
|
45
|
-
if (!getParsedInvocation().hasFlag("--target"))
|
|
46
|
-
return;
|
|
47
|
-
throw new UsageError("`akm remember --target` was renamed to `--bundle` in 0.9. Use `--bundle <name>` instead.", "INVALID_FLAG_VALUE");
|
|
48
|
-
}
|
|
49
37
|
// ── Command definition ────────────────────────────────────────────────────────
|
|
50
38
|
export const rememberCommand = defineJsonCommand({
|
|
51
39
|
meta: {
|
|
@@ -140,7 +128,6 @@ export const rememberCommand = defineJsonCommand({
|
|
|
140
128
|
},
|
|
141
129
|
},
|
|
142
130
|
async run({ args }) {
|
|
143
|
-
rejectRetiredTargetFlag();
|
|
144
131
|
const body = readMemoryContent(args.content);
|
|
145
132
|
const eventSource = resolveUsageEventSource();
|
|
146
133
|
// `--name` is a flat name; subdirectory placement is `--path`'s job.
|
|
@@ -24,24 +24,6 @@ import { deliverRendered } from "../../output/html-render.js";
|
|
|
24
24
|
import { akmCurate, packCuratedHits } from "./curate.js";
|
|
25
25
|
import { akmSearch, parseBeliefFilterMode, parseScopeFilterFlags, parseSearchSource } from "./search.js";
|
|
26
26
|
import { akmShowUnified } from "./show.js";
|
|
27
|
-
/**
|
|
28
|
-
* `--source` was renamed to `--from` on `search`/`curate` in 0.9 (S8). citty
|
|
29
|
-
* is non-strict, so the retired spelling is silently absorbed rather than
|
|
30
|
-
* rejected — the command then runs against the DEFAULT `--from` value
|
|
31
|
-
* (local) instead of the source the caller named, with exit 0 and no error.
|
|
32
|
-
* Reject it explicitly instead.
|
|
33
|
-
*
|
|
34
|
-
* Exported so `akm task list` (`../tasks/tasks-cli.ts`, #951) — a pure
|
|
35
|
-
* delegating alias for `akm search --type task` — applies the identical
|
|
36
|
-
* guard rather than a second copy of it; a task-list-scoped `--source` must
|
|
37
|
-
* fail exactly like `search`'s does, not fall through to citty's silent
|
|
38
|
-
* unknown-flag absorption.
|
|
39
|
-
*/
|
|
40
|
-
export function rejectRetiredSourceFlag() {
|
|
41
|
-
if (!getParsedInvocation().hasFlag("--source"))
|
|
42
|
-
return;
|
|
43
|
-
throw new UsageError("`--source` was renamed to `--from` in 0.9. Use `--from local|registry|all` instead.", "INVALID_FLAG_VALUE");
|
|
44
|
-
}
|
|
45
27
|
export const searchCommand = defineJsonCommand({
|
|
46
28
|
meta: { name: "search", description: "Search the bundle" },
|
|
47
29
|
args: {
|
|
@@ -83,7 +65,6 @@ export const searchCommand = defineJsonCommand({
|
|
|
83
65
|
},
|
|
84
66
|
},
|
|
85
67
|
async run({ args }) {
|
|
86
|
-
rejectRetiredSourceFlag();
|
|
87
68
|
const query = (args.query ?? "").trim();
|
|
88
69
|
const type = args.type;
|
|
89
70
|
const limit = parsePositiveIntFlag(args.limit ?? undefined);
|
|
@@ -140,24 +121,9 @@ export const curateCommand = defineJsonCommand({
|
|
|
140
121
|
},
|
|
141
122
|
},
|
|
142
123
|
async run({ args }) {
|
|
143
|
-
rejectRetiredSourceFlag();
|
|
144
|
-
if (!args.query || !String(args.query).trim()) {
|
|
145
|
-
throw new UsageError('A curate query is required. Usage: akm curate "<task or prompt>" [--type <type>] [--limit <n>]', "MISSING_REQUIRED_ARGUMENT", 'Describe the task you want assets for, e.g. `akm curate "deploy to prod"`.');
|
|
146
|
-
}
|
|
147
|
-
const type = args.type;
|
|
148
|
-
const limitParsed = parsePositiveIntFlag(args.limit ?? undefined);
|
|
149
|
-
const limit = limitParsed && limitParsed > 0 ? limitParsed : 4;
|
|
150
|
-
const source = parseSearchSource(args.from ?? "local");
|
|
151
|
-
const outputMode = getOutputMode();
|
|
152
124
|
const packBudget = parsePositiveIntFlag(args.pack ?? undefined, "--pack");
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
type,
|
|
156
|
-
limit,
|
|
157
|
-
source,
|
|
158
|
-
eventSource: resolveUsageEventSource(),
|
|
159
|
-
attributionProjection: outputMode.shape === "agent" ? "agent" : outputMode.detail,
|
|
160
|
-
});
|
|
125
|
+
const outputMode = getOutputMode();
|
|
126
|
+
const curated = await runCurate({ query: args.query, type: args.type, limit: args.limit, from: args.from }, outputMode);
|
|
161
127
|
if (packBudget !== undefined) {
|
|
162
128
|
const packed = await packCuratedHits(curated, packBudget);
|
|
163
129
|
deliverRendered(outputMode.format === "text" ? formatCuratePackText(packed) : JSON.stringify(packed.items, null, 2), outputMode.outputPath);
|
|
@@ -166,6 +132,27 @@ export const curateCommand = defineJsonCommand({
|
|
|
166
132
|
output("curate", curated);
|
|
167
133
|
},
|
|
168
134
|
});
|
|
135
|
+
/**
|
|
136
|
+
* Validate the curate arguments and run the curation. The one path both
|
|
137
|
+
* `akm curate` and the in-process `curate()` of `src/api.ts` go through, so
|
|
138
|
+
* argument errors and ranking cannot drift between them. Takes the output
|
|
139
|
+
* mode explicitly (it only picks the attribution projection) instead of
|
|
140
|
+
* reading the process-level singleton.
|
|
141
|
+
*/
|
|
142
|
+
export async function runCurate(args, outputMode) {
|
|
143
|
+
if (!args.query || !String(args.query).trim()) {
|
|
144
|
+
throw new UsageError('A curate query is required. Usage: akm curate "<task or prompt>" [--type <type>] [--limit <n>]', "MISSING_REQUIRED_ARGUMENT", 'Describe the task you want assets for, e.g. `akm curate "deploy to prod"`.');
|
|
145
|
+
}
|
|
146
|
+
const limitParsed = parsePositiveIntFlag(args.limit ?? undefined);
|
|
147
|
+
return akmCurate({
|
|
148
|
+
query: args.query,
|
|
149
|
+
type: args.type,
|
|
150
|
+
limit: limitParsed && limitParsed > 0 ? limitParsed : 4,
|
|
151
|
+
source: parseSearchSource(args.from ?? "local"),
|
|
152
|
+
eventSource: resolveUsageEventSource(),
|
|
153
|
+
attributionProjection: outputMode.shape === "agent" ? "agent" : outputMode.detail,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
169
156
|
/** Human-readable rendering for `akm curate --pack`: concatenated content per hit under a `## <ref>` header. */
|
|
170
157
|
function formatCuratePackText(packed) {
|
|
171
158
|
if (packed.items.length === 0) {
|
|
@@ -174,62 +161,16 @@ function formatCuratePackText(packed) {
|
|
|
174
161
|
return packed.items.map((item) => `## ${item.ref}\n\n${item.content}`).join("\n\n");
|
|
175
162
|
}
|
|
176
163
|
/**
|
|
177
|
-
* Reject
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* this command, which means citty's default behavior for an undeclared flag
|
|
181
|
-
* kicks in — and that default is silent acceptance:
|
|
182
|
-
*
|
|
183
|
-
* - `--scope=user=nobody` (equals form): citty consumes it as an unknown
|
|
184
|
-
* flag's own inline value. It never reaches `args._`, so nothing downstream
|
|
185
|
-
* ever notices — the command runs to completion and exits 0, having
|
|
186
|
-
* silently ignored the caller's (unsatisfied) scope request. This is the
|
|
187
|
-
* dangerous case: the caller believes a read was scoped when it was not,
|
|
188
|
-
* and it directly violates guardrail 6's "removed spelling must fail
|
|
189
|
-
* loudly, not silently".
|
|
190
|
-
* - `--scope user=nobody` (space form): citty treats `--scope` as boolean
|
|
191
|
-
* and pushes `user=nobody` into `args._` as a stray positional, which
|
|
192
|
-
* incidentally trips `rejectExtraShowPositionals`'s arity check below —
|
|
193
|
-
* but with the wrong diagnosis (it blames the unrelated retired
|
|
194
|
-
* `toc|section|lines|frontmatter|full` view-mode grammar).
|
|
195
|
-
*
|
|
196
|
-
* This check runs FIRST, before the positional check, so both spellings are
|
|
197
|
-
* caught by one explicit, correctly-worded error — it does NOT make `--scope`
|
|
198
|
-
* work, it only makes the failure loud and the diagnosis accurate.
|
|
199
|
-
*
|
|
200
|
-
* NOTE (general issue, out of scope here): citty silently accepts ANY
|
|
201
|
-
* undeclared flag on ANY command (e.g. `akm info --totallybogus` exits 0) —
|
|
202
|
-
* this same silent-ignore failure mode applies repo-wide, not just to
|
|
203
|
-
* `--scope` on `show`. Fixing that generally is a separate, wide-blast-radius
|
|
204
|
-
* owner decision (same family as E-2, `akm list --type skill`); this function
|
|
205
|
-
* only closes the `--scope`/`show` instance of it.
|
|
206
|
-
*/
|
|
207
|
-
function rejectRemovedScopeFlag(ref) {
|
|
208
|
-
const usedScopeFlag = getParsedInvocation().userArgs.some((token) => token === "--scope" || token.startsWith("--scope="));
|
|
209
|
-
if (!usedScopeFlag)
|
|
210
|
-
return;
|
|
211
|
-
throw new UsageError("akm show has no --scope flag — it was removed in 0.9.0. Use --filter instead: " +
|
|
212
|
-
"--filter user=<id> --filter agent=<id> --filter run=<id> --filter channel=<name>.", "INVALID_FLAG_VALUE", `\`akm show ${ref} --filter user=<id>\` narrows resolution to assets whose frontmatter scope matches.`);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Reject any positional after the ref. The
|
|
216
|
-
* `akm show <ref> toc|section "H"|lines A B|frontmatter|full` view grammar was
|
|
217
|
-
* removed in 0.9.0; its keywords used to be rewritten into hidden flags before
|
|
218
|
-
* citty saw argv, so without this guard a stale invocation would silently
|
|
219
|
-
* render the whole item instead of the view the caller asked for.
|
|
220
|
-
*
|
|
221
|
-
* `--scope` is handled separately, and earlier, by {@link rejectRemovedScopeFlag}
|
|
222
|
-
* — by the time this runs, a `--scope`-caused stray positional has already
|
|
223
|
-
* been intercepted with the correct diagnosis, so this function's generic
|
|
224
|
-
* message is reached only by genuine leftover view-grammar tokens.
|
|
164
|
+
* Reject any positional after the ref: `akm show` takes one ref, and a stray
|
|
165
|
+
* token would otherwise silently render the whole item instead of what the
|
|
166
|
+
* caller asked for.
|
|
225
167
|
*/
|
|
226
168
|
function rejectExtraShowPositionals(positionals, ref) {
|
|
227
169
|
const extra = (Array.isArray(positionals) ? positionals.map(String) : []).slice(1);
|
|
228
170
|
if (extra.length === 0)
|
|
229
171
|
return;
|
|
230
172
|
throw new UsageError(`akm show takes a single ref, but got ${extra.map((token) => `"${token}"`).join(" ")} after "${ref}". ` +
|
|
231
|
-
|
|
232
|
-
`\`akm show ${ref}#<heading-slug>\` to read one section, or \`akm show ${ref}\` for the whole item.`, "INVALID_FLAG_VALUE", "An unmatched #fragment lists the available slugs.");
|
|
173
|
+
`Use \`akm show ${ref}#<heading-slug>\` to read one section, or \`akm show ${ref}\` for the whole item.`, "INVALID_FLAG_VALUE", "An unmatched #fragment lists the available slugs.");
|
|
233
174
|
}
|
|
234
175
|
export const showCommand = defineJsonCommand({
|
|
235
176
|
meta: {
|
|
@@ -265,10 +206,8 @@ export const showCommand = defineJsonCommand({
|
|
|
265
206
|
// direct-read it. (the ref parser would reject the non-type `meta`.)
|
|
266
207
|
if (!parseMetaRef(args.ref))
|
|
267
208
|
parseBundleRef(args.ref);
|
|
268
|
-
rejectRemovedScopeFlag(args.ref);
|
|
269
209
|
rejectExtraShowPositionals(args._, args.ref);
|
|
270
210
|
const invocation = getParsedInvocation();
|
|
271
|
-
const cliShape = getOutputMode().shape;
|
|
272
211
|
// F6/R-021 — `show` deliberately does NOT inherit `output.detail` from
|
|
273
212
|
// config the way `search`/`curate` do via `getOutputMode().detail`
|
|
274
213
|
// (which merges an explicit `--detail` flag with the config default,
|
|
@@ -282,15 +221,8 @@ export const showCommand = defineJsonCommand({
|
|
|
282
221
|
// `--detail full` (explicit or, since it's also the implicit default,
|
|
283
222
|
// omitted) and any other value fall through to the full response.
|
|
284
223
|
const explicitDetail = invocation.getFlagValue("--detail");
|
|
285
|
-
// `--
|
|
286
|
-
|
|
287
|
-
const showDetail = explicitDetail === "brief"
|
|
288
|
-
? "brief"
|
|
289
|
-
: explicitDetail === "full"
|
|
290
|
-
? "full"
|
|
291
|
-
: cliShape === "summary"
|
|
292
|
-
? "summary"
|
|
293
|
-
: undefined;
|
|
224
|
+
// `--detail brief` forces the brief response regardless of projection.
|
|
225
|
+
const showDetail = explicitDetail === "brief" ? "brief" : explicitDetail === "full" ? "full" : undefined;
|
|
294
226
|
// `--filter` is repeatable — citty only exposes the last value, so read
|
|
295
227
|
// every occurrence directly from argv (same helper as `akm search`; the two
|
|
296
228
|
// commands share one spelling for the scope-narrowing axis).
|
|
@@ -366,17 +366,6 @@ export function parseSearchSource(source) {
|
|
|
366
366
|
return source;
|
|
367
367
|
if (typeof source === "undefined")
|
|
368
368
|
return "local";
|
|
369
|
-
// 0.9.0 (S8): `--source stash`/`--source both` renamed to `--from
|
|
370
|
-
// local`/`--from all`. Reject the retired values explicitly — otherwise
|
|
371
|
-
// they fall through to the named-source lookup below and surface as a
|
|
372
|
-
// misleading "no source named stash/both" error instead of naming the
|
|
373
|
-
// rename.
|
|
374
|
-
if (source === "stash") {
|
|
375
|
-
throw new UsageError('"stash" was renamed to "local" in 0.9. Use `--from local` instead.', "INVALID_FLAG_VALUE");
|
|
376
|
-
}
|
|
377
|
-
if (source === "both") {
|
|
378
|
-
throw new UsageError('"both" was renamed to "all" in 0.9. Use `--from all` instead.', "INVALID_FLAG_VALUE");
|
|
379
|
-
}
|
|
380
369
|
// Pass through unknown strings — they may be valid named sources.
|
|
381
370
|
// `akmSearch` will validate against config.sources and throw a UsageError
|
|
382
371
|
// with a helpful message if the name isn't found.
|
|
@@ -67,11 +67,6 @@ export async function akmShowUnified(input) {
|
|
|
67
67
|
if (metaRef)
|
|
68
68
|
return showStashMeta(metaRef);
|
|
69
69
|
}
|
|
70
|
-
const legacyReplacement = legacyColonRefReplacement(ref);
|
|
71
|
-
if (legacyReplacement) {
|
|
72
|
-
throw new NotFoundError(`The legacy colon ref "${ref}" was removed in 0.9.0. Use the slash form instead: ` +
|
|
73
|
-
`akm show ${legacyReplacement}`);
|
|
74
|
-
}
|
|
75
70
|
// Env/secret bodies have no safe fragment surface, and a fragment cannot
|
|
76
71
|
// widen what the env/secret renderers expose: both always omit the body
|
|
77
72
|
// (env — key names only; secret — never rendered), fragment or not. Warn
|
|
@@ -107,20 +102,6 @@ export async function akmShowUnified(input) {
|
|
|
107
102
|
}
|
|
108
103
|
return result;
|
|
109
104
|
}
|
|
110
|
-
/** Actionable migration guidance for the retired `[bundle//]type:name` spelling. */
|
|
111
|
-
function legacyColonRefReplacement(ref) {
|
|
112
|
-
const match = /^(?:(?<bundle>[^/#]+)\/\/)?(?<type>[a-z][a-z0-9-]*):(?<name>[^#]+)(?<fragment>#.*)?$/i.exec(ref);
|
|
113
|
-
const type = match?.groups?.type?.toLowerCase();
|
|
114
|
-
const name = match?.groups?.name;
|
|
115
|
-
if (!type || !name)
|
|
116
|
-
return undefined;
|
|
117
|
-
const stashDir = stashDirFor(type);
|
|
118
|
-
if (!stashDir)
|
|
119
|
-
return undefined;
|
|
120
|
-
const bundle = match?.groups?.bundle;
|
|
121
|
-
const fragment = match?.groups?.fragment ?? "";
|
|
122
|
-
return `${bundle ? `${bundle}//` : ""}${stashDir}/${name}${fragment}`;
|
|
123
|
-
}
|
|
124
105
|
/**
|
|
125
106
|
* Resolve a stash `.meta/` doc and return it as a lightweight ShowResponse.
|
|
126
107
|
*
|