akm-cli 0.9.0-rc.4 → 0.9.0-rc.6
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 +122 -26
- package/README.md +7 -7
- package/SECURITY.md +11 -10
- package/dist/akm +2 -2
- package/dist/akm-migrate-storage +2 -2
- package/dist/assets/hints/cli-hints-full.md +60 -73
- package/dist/assets/hints/cli-hints-short.md +8 -12
- package/dist/assets/improve-strategies/default.json +5 -7
- package/dist/assets/improve-strategies/frequent.json +2 -2
- package/dist/assets/improve-strategies/proactive-maintenance.json +2 -2
- package/dist/assets/improve-strategies/quick.json +1 -1
- package/dist/assets/improve-strategies/reflect-distill.json +3 -3
- package/dist/assets/improve-strategies/thorough.json +1 -1
- package/dist/assets/prompts/consolidate-system.md +5 -5
- package/dist/assets/prompts/extract-session.md +2 -6
- package/dist/assets/prompts/reflect-llm-framed-contract.md +11 -0
- package/dist/assets/prompts/reflect-llm-schema-contract.md +3 -0
- package/dist/assets/prompts/reflect-output-repair.md +3 -0
- package/dist/assets/stash-skeleton/README.md +10 -11
- package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +2 -2
- package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +1 -1
- package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +18 -18
- package/dist/assets/stash-skeleton/facts/conventions/domains.md +8 -9
- package/dist/assets/stash-skeleton/facts/conventions/organization.md +13 -15
- package/dist/assets/tasks/core/extract.yml +2 -2
- package/dist/assets/tasks/core/improve.yml +1 -1
- package/dist/assets/templates/html/health.html +2 -3
- package/dist/cli/config-migrate.js +1328 -101
- package/dist/cli/invocation.js +255 -0
- package/dist/cli/parse-args.js +20 -83
- package/dist/cli/shared.js +15 -37
- package/dist/cli.js +18 -49
- package/dist/commands/agent/agent-dispatch.js +2 -2
- package/dist/commands/agent/contribute-cli.js +5 -4
- package/dist/commands/bundle/bundle-cli.js +68 -0
- package/dist/commands/bundle/bundle.js +219 -0
- package/dist/commands/completions.js +2 -2
- package/dist/commands/config-cli.js +6 -3
- package/dist/commands/env/env-binding.js +13 -9
- package/dist/commands/env/env-cli.js +49 -48
- package/dist/commands/env/secret-cli.js +24 -10
- package/dist/commands/events.js +2 -2
- package/dist/commands/feedback-cli.js +59 -33
- package/dist/commands/graph/graph.js +6 -4
- package/dist/commands/health/advisories.js +4 -4
- package/dist/commands/health/html-report.js +190 -593
- package/dist/commands/health/improve-metrics.js +240 -188
- package/dist/commands/health/metrics.js +9 -17
- package/dist/commands/health/report-view-model.js +509 -0
- package/dist/commands/health/surfaces.js +6 -3
- package/dist/commands/health/types-checks.js +4 -0
- package/dist/commands/health/types-improve.js +22 -0
- package/dist/commands/health/types-metrics.js +4 -0
- package/dist/commands/health/types-result.js +7 -0
- package/dist/commands/health/types-runs.js +4 -0
- package/dist/commands/health/types-session-log.js +4 -0
- package/dist/commands/health/types-windows.js +4 -0
- package/dist/commands/health/types.js +26 -21
- package/dist/commands/health/windows.js +1 -2
- package/dist/commands/health.js +219 -161
- package/dist/commands/improve/collapse-detector.js +25 -14
- package/dist/commands/improve/consolidate/chunking.js +7 -5
- package/dist/commands/improve/consolidate.js +640 -740
- package/dist/commands/improve/content-hash.js +39 -0
- package/dist/commands/improve/distill/content-repair.js +4 -10
- package/dist/commands/improve/distill/promote-memory.js +79 -49
- package/dist/commands/improve/distill/quality-gate.js +113 -35
- package/dist/commands/improve/distill-promotion-policy.js +24 -885
- package/dist/commands/improve/distill.js +565 -337
- package/dist/commands/improve/eligibility.js +75 -36
- package/dist/commands/improve/extract-cli.js +6 -6
- package/dist/commands/improve/extract-prompt.js +5 -34
- package/dist/commands/improve/extract.js +526 -357
- package/dist/commands/improve/feedback-valence.js +2 -12
- package/dist/commands/improve/improve-cli.js +11 -20
- package/dist/commands/improve/improve-result-file.js +7 -6
- package/dist/commands/improve/improve-run-types.js +4 -0
- package/dist/commands/improve/improve-strategies.js +3 -9
- package/dist/commands/improve/improve.js +822 -727
- package/dist/commands/improve/locks.js +27 -95
- package/dist/commands/improve/loop-stages.js +941 -963
- package/dist/commands/improve/memory/derived-ref.js +122 -0
- package/dist/commands/improve/memory/memory-contradiction-detect.js +35 -38
- package/dist/commands/improve/memory/memory-improve.js +24 -37
- package/dist/commands/improve/outcome-loop.js +13 -33
- package/dist/commands/improve/preparation.js +889 -691
- package/dist/commands/improve/proactive-maintenance.js +37 -9
- package/dist/commands/improve/proposal-envelope.js +31 -0
- package/dist/commands/improve/reflect.js +974 -588
- package/dist/commands/improve/run-context.js +119 -0
- package/dist/commands/improve/salience.js +8 -4
- package/dist/commands/improve/session-asset.js +7 -3
- package/dist/commands/improve/shared.js +14 -40
- package/dist/commands/improve/source-identity.js +39 -26
- package/dist/commands/improve/triage.js +20 -17
- package/dist/commands/lint/base-linter.js +288 -295
- package/dist/commands/lint/index.js +132 -19
- package/dist/commands/mv-cli.js +257 -234
- package/dist/commands/observability-cli.js +2 -1
- package/dist/commands/proposal/diff-format.js +50 -0
- package/dist/commands/proposal/drain-policies.js +0 -6
- package/dist/commands/proposal/drain.js +17 -16
- package/dist/commands/proposal/proposal-cli.js +40 -77
- package/dist/commands/proposal/proposal-types.js +56 -0
- package/dist/commands/proposal/proposal.js +39 -1
- package/dist/commands/proposal/propose.js +41 -19
- package/dist/commands/proposal/repository.js +566 -486
- package/dist/commands/proposal/validators/proposal-quality-validators.js +22 -6
- package/dist/commands/proposal/validators/proposal-validators.js +6 -5
- package/dist/commands/proposal/validators/proposals.js +5 -4
- package/dist/commands/read/curate.js +50 -28
- package/dist/commands/read/knowledge.js +25 -16
- package/dist/commands/read/remember-cli.js +12 -4
- package/dist/commands/read/search-cli.js +33 -33
- package/dist/commands/read/search.js +68 -55
- package/dist/commands/read/show.js +54 -135
- package/dist/commands/remember.js +7 -5
- package/dist/commands/sources/add-cli.js +10 -24
- package/dist/commands/sources/bundle-config-ops.js +58 -0
- package/dist/commands/sources/history.js +13 -8
- package/dist/commands/sources/info.js +10 -11
- package/dist/commands/sources/init.js +12 -21
- package/dist/commands/sources/installed-stashes.js +151 -138
- package/dist/commands/sources/schema-repair.js +5 -3
- package/dist/commands/sources/self-update.js +9 -7
- package/dist/commands/sources/source-add.js +116 -154
- package/dist/commands/sources/source-clone.js +33 -14
- package/dist/commands/sources/source-manage.js +43 -32
- package/dist/commands/sources/sources-cli.js +12 -7
- package/dist/commands/sources/stash-cli.js +12 -5
- package/dist/commands/sources/stash-skeleton.js +1 -1
- package/dist/commands/tasks/default-tasks.js +13 -13
- package/dist/commands/tasks/tasks-cli.js +3 -3
- package/dist/commands/tasks/tasks.js +71 -31
- package/dist/commands/workflow-cli.js +22 -26
- package/dist/core/action-contributors.js +1 -1
- package/dist/core/activation-policy.js +49 -0
- package/dist/core/adapter/adapters/agent-skills-adapter.js +181 -0
- package/dist/core/adapter/adapters/akm-adapter.js +509 -0
- package/dist/core/adapter/adapters/akm-lint.js +381 -0
- package/dist/core/adapter/adapters/akm-metadata.js +416 -0
- package/dist/core/adapter/adapters/akm-task-adapter.js +150 -0
- package/dist/core/adapter/adapters/akm-workflow-adapter.js +196 -0
- package/dist/core/adapter/adapters/claude-adapter.js +61 -0
- package/dist/core/adapter/adapters/dotenv-adapter.js +187 -0
- package/dist/core/adapter/adapters/generic-files-adapter.js +117 -0
- package/dist/core/adapter/adapters/index.js +80 -0
- package/dist/core/adapter/adapters/llm-wiki-adapter.js +413 -0
- package/dist/core/adapter/adapters/okf-adapter.js +223 -0
- package/dist/core/adapter/adapters/opencode-adapter.js +68 -0
- package/dist/core/adapter/adapters/shared.js +286 -0
- package/dist/core/adapter/adapters/tool-dir-shared.js +212 -0
- package/dist/core/adapter/adapters/website-snapshot-adapter.js +154 -0
- package/dist/core/adapter/bundle-adapter.js +4 -0
- package/dist/core/adapter/recognize-match.js +42 -0
- package/dist/core/adapter/registry.js +56 -0
- package/dist/core/adapter/types.js +4 -0
- package/dist/core/asset/asset-placement.js +229 -0
- package/dist/core/asset/asset-ref.js +107 -78
- package/dist/core/asset/asset-serialize.js +20 -0
- package/dist/core/asset/frontmatter.js +1 -1
- package/dist/core/asset/resolve-ref.js +223 -0
- package/dist/core/asset/stash-meta.js +1 -1
- package/dist/core/common.js +141 -49
- package/dist/core/config/config-io.js +0 -108
- package/dist/core/config/config-schema.js +94 -1039
- package/dist/core/config/config-sources.js +115 -36
- package/dist/core/config/config-types.js +16 -11
- package/dist/core/config/config-walker.js +4 -2
- package/dist/core/config/config.js +21 -26
- package/dist/core/config/engine-semantics.js +0 -4
- package/dist/core/config/schema/embedding.js +38 -0
- package/dist/core/config/schema/engines.js +116 -0
- package/dist/core/config/schema/feedback.js +31 -0
- package/dist/core/config/schema/improve-processes.js +395 -0
- package/dist/core/config/schema/improve.js +76 -0
- package/dist/core/config/schema/index-config.js +183 -0
- package/dist/core/config/schema/output.js +15 -0
- package/dist/core/config/schema/primitives.js +94 -0
- package/dist/core/config/schema/search.js +30 -0
- package/dist/core/config/schema/setup.js +27 -0
- package/dist/core/config/schema/sources-bundles.js +164 -0
- package/dist/core/config/schema/workflow.js +29 -0
- package/dist/core/env-secret-ref.js +113 -8
- package/dist/core/errors.js +1 -1
- package/dist/core/events-types.js +4 -0
- package/dist/core/extra-params.js +1 -0
- package/dist/core/file-change.js +16 -0
- package/dist/core/fs-txn.js +316 -0
- package/dist/core/git-message.js +59 -0
- package/dist/core/improve-result.js +9 -1
- package/dist/core/logs-db.js +1 -1
- package/dist/core/maintenance-barrier.js +16 -0
- package/dist/core/migration-backup.js +332 -160
- package/dist/core/paths.js +3 -6
- package/dist/core/platform.js +10 -0
- package/dist/core/recognition-util.js +130 -0
- package/dist/core/redaction.js +2 -2
- package/dist/core/standards/resolve-standards-context.js +47 -64
- package/dist/core/standards/resolve-type-conventions.js +3 -3
- package/dist/core/state/migrations.js +201 -8
- package/dist/core/state-db.js +38 -2
- package/dist/core/subprocess.js +303 -0
- package/dist/core/time.js +20 -0
- package/dist/core/type-presentation.js +130 -0
- package/dist/core/write-source.js +39 -67
- package/dist/indexer/bundle-identity-guard.js +91 -0
- package/dist/indexer/db/graph-db.js +1 -1
- package/dist/indexer/db/llm-cache.js +1 -1
- package/dist/indexer/ensure-index.js +29 -9
- package/dist/indexer/graph/graph-boost.js +28 -24
- package/dist/indexer/graph/graph-extraction.js +5 -6
- package/dist/indexer/graph/graph-types.js +4 -0
- package/dist/indexer/index-written-assets.js +44 -17
- package/dist/indexer/indexer.js +289 -153
- package/dist/indexer/init.js +18 -25
- package/dist/indexer/installations.js +224 -0
- package/dist/indexer/passes/dir-staleness.js +2 -1
- package/dist/indexer/passes/memory-inference.js +8 -4
- package/dist/indexer/passes/metadata.js +96 -243
- package/dist/indexer/scan/doc-to-entry.js +123 -0
- package/dist/indexer/scan/drain-dir.js +144 -0
- package/dist/indexer/search/db-search.js +171 -99
- package/dist/indexer/search/fts-query.js +1 -1
- package/dist/indexer/search/ranking-contributors.js +57 -7
- package/dist/indexer/search/ranking-types.js +4 -0
- package/dist/indexer/search/ranking.js +31 -6
- package/dist/indexer/search/search-attribution.js +67 -0
- package/dist/indexer/search/search-hit-enrichers.js +30 -40
- package/dist/indexer/search/search-source.js +109 -52
- package/dist/indexer/search/semantic-status.js +4 -1
- package/dist/indexer/usage/unmigrated-vaults-guard.js +2 -1
- package/dist/indexer/usage/usage-events.js +72 -9
- package/dist/indexer/walk/file-context.js +1 -44
- package/dist/indexer/walk/matchers.js +16 -32
- package/dist/indexer/walk/path-resolver.js +6 -5
- package/dist/indexer/walk/walker.js +4 -2
- package/dist/integrations/agent/engine-resolution.js +22 -0
- package/dist/integrations/agent/model-aliases.js +1 -1
- package/dist/integrations/agent/prompts.js +35 -11
- package/dist/integrations/agent/spawn.js +41 -270
- package/dist/integrations/harnesses/aider/agent-builder.js +2 -2
- package/dist/integrations/harnesses/aider/index.js +2 -11
- package/dist/integrations/harnesses/amazonq/agent-builder.js +1 -9
- package/dist/integrations/harnesses/amazonq/index.js +3 -16
- package/dist/integrations/harnesses/claude/config-import.js +1 -3
- package/dist/integrations/harnesses/claude/index.js +1 -12
- package/dist/integrations/harnesses/claude/session-log.js +27 -65
- package/dist/integrations/harnesses/codex/agent-builder.js +1 -2
- package/dist/integrations/harnesses/codex/index.js +2 -12
- package/dist/integrations/harnesses/copilot/agent-builder.js +2 -3
- package/dist/integrations/harnesses/copilot/index.js +1 -12
- package/dist/integrations/harnesses/gemini/agent-builder.js +1 -3
- package/dist/integrations/harnesses/gemini/index.js +1 -12
- package/dist/integrations/harnesses/ids.js +24 -0
- package/dist/integrations/harnesses/index.js +27 -2
- package/dist/integrations/harnesses/opencode/config-import.js +1 -3
- package/dist/integrations/harnesses/opencode/index.js +1 -12
- package/dist/integrations/harnesses/opencode/session-log.js +67 -110
- package/dist/integrations/harnesses/opencode-sdk/harness.js +2 -11
- package/dist/integrations/harnesses/openhands/agent-builder.js +3 -3
- package/dist/integrations/harnesses/openhands/index.js +2 -11
- package/dist/integrations/harnesses/pi/agent-builder.js +3 -11
- package/dist/integrations/harnesses/pi/index.js +3 -15
- package/dist/integrations/harnesses/shared.js +17 -0
- package/dist/integrations/harnesses/types.js +37 -2
- package/dist/integrations/lockfile.js +36 -0
- package/dist/integrations/session-logs/index.js +21 -12
- package/dist/integrations/session-logs/provider-base.js +113 -0
- package/dist/llm/client.js +7 -5
- package/dist/llm/embedders/deterministic.js +2 -2
- package/dist/llm/embedders/remote.js +8 -4
- package/dist/llm/graph-extract.js +7 -2
- package/dist/llm/metadata-enhance.js +43 -26
- package/dist/llm/structured-call.js +15 -7
- package/dist/migrate/legacy/config-source-migration.js +223 -0
- package/dist/migrate/legacy/content-migration.js +305 -0
- package/dist/migrate/legacy/legacy-layout.js +779 -0
- package/dist/migrate/legacy/legacy-paths.js +25 -0
- package/dist/migrate/legacy/legacy-stash-json.js +72 -0
- package/dist/migrate/legacy/proposal-fs-import.js +168 -0
- package/dist/migrate/legacy/task-target-ref-migration.js +272 -0
- package/dist/migrate/legacy/three-db-cutover.js +840 -0
- package/dist/migrate/legacy/workflow-migrations-bodies.js +52 -0
- package/dist/migrate/legacy/workflow-migrations-frozen.js +21 -0
- package/dist/migrate/legacy-ref-grammar.js +209 -0
- package/dist/output/command-registry.js +27 -0
- package/dist/output/html-render.js +11 -16
- package/dist/output/renderers.js +32 -276
- package/dist/output/shapes/passthrough.js +3 -9
- package/dist/output/shapes/registry.js +12 -6
- package/dist/output/text/command-format.js +547 -0
- package/dist/output/text/helpers.js +15 -1377
- package/dist/output/text/proposal-format.js +230 -0
- package/dist/output/text/registry.js +12 -6
- package/dist/output/text/show-directives.js +107 -0
- package/dist/output/text/show-format.js +103 -0
- package/dist/output/text/workflow-format.js +345 -0
- package/dist/output/text.js +1 -3
- package/dist/registry/build-index.js +13 -17
- package/dist/registry/providers/static-index.js +2 -2
- package/dist/registry/resolve.js +4 -90
- package/dist/registry/semver.js +93 -0
- package/dist/runtime.js +90 -0
- package/dist/schemas/akm-config.json +2956 -14890
- package/dist/schemas/akm-task.json +2 -2
- package/dist/schemas/akm-workflow.json +2 -2
- package/dist/scripts/migrate-storage.js +2312 -19642
- package/dist/setup/detect.js +5 -7
- package/dist/setup/engine-config.js +2 -1
- package/dist/setup/registry-stash-loader.js +1 -1
- package/dist/setup/semantic-assets.js +12 -9
- package/dist/setup/setup.js +109 -39
- package/dist/setup/steps/connection-shared.js +120 -0
- package/dist/setup/steps/connection.js +50 -274
- package/dist/setup/steps/platforms.js +1 -0
- package/dist/setup/steps/sources.js +13 -6
- package/dist/setup/steps/stashdir.js +5 -2
- package/dist/sources/freshness.js +39 -0
- package/dist/sources/providers/git-provider.js +29 -33
- package/dist/sources/providers/git-stash.js +10 -5
- package/dist/sources/providers/provider-utils.js +40 -18
- package/dist/sources/providers/website.js +1 -1
- package/dist/sources/resolve.js +5 -5
- package/dist/sources/snapshot-fetchers/types.js +4 -0
- package/dist/sources/{website-ingest.js → snapshot-fetchers/website-ingest.js} +105 -39
- package/dist/storage/database.js +47 -3
- package/dist/storage/engines/sqlite-migrations.js +34 -16
- package/dist/storage/locations.js +1 -2
- package/dist/storage/repositories/improve-runs-repository.js +0 -20
- package/dist/storage/repositories/index-connection.js +80 -0
- package/dist/storage/repositories/index-db.js +4 -3
- package/dist/storage/repositories/index-entries-repository.js +952 -0
- package/dist/{indexer/db/entry-mapper.js → storage/repositories/index-entry-mapper.js} +15 -2
- package/dist/storage/repositories/index-entry-types.js +4 -0
- package/dist/storage/repositories/index-fts-repository.js +164 -0
- package/dist/storage/repositories/index-llm-cache-repository.js +109 -0
- package/dist/storage/repositories/index-meta-repository.js +50 -0
- package/dist/{indexer/db/schema.js → storage/repositories/index-schema.js} +241 -100
- package/dist/storage/repositories/index-sql.js +12 -0
- package/dist/storage/repositories/index-utility-repository.js +369 -0
- package/dist/storage/repositories/index-vec-repository.js +245 -0
- package/dist/storage/repositories/proposals-repository.js +41 -50
- package/dist/storage/repositories/registry-cache.js +1 -1
- package/dist/storage/repositories/workflow-runs-repository.js +17 -11
- package/dist/tasks/backends/cron.js +5 -5
- package/dist/tasks/backends/exec-utils.js +21 -0
- package/dist/tasks/backends/index.js +6 -9
- package/dist/tasks/backends/launchd.js +16 -17
- package/dist/tasks/backends/schtasks.js +33 -41
- package/dist/tasks/backends/types.js +4 -0
- package/dist/tasks/parser.js +25 -5
- package/dist/tasks/runner.js +33 -39
- package/dist/tasks/validator.js +5 -6
- package/dist/workflows/authoring/authoring.js +8 -11
- package/dist/workflows/exec/brief.js +10 -7
- package/dist/workflows/exec/report.js +261 -156
- package/dist/workflows/exec/run-workflow.js +2 -1
- package/dist/workflows/exec/step-work.js +3 -9
- package/dist/workflows/program/parser.js +4 -60
- package/dist/workflows/renderer.js +11 -60
- package/dist/workflows/runtime/checkin.js +1 -1
- package/dist/workflows/runtime/plan-classifier.js +7 -4
- package/dist/workflows/runtime/runs.js +11 -10
- package/dist/workflows/runtime/unit-checkin.js +1 -1
- package/dist/workflows/runtime/unit-phases.js +20 -0
- package/dist/workflows/runtime/workflow-asset-loader.js +27 -16
- package/dist/workflows/validate-summary.js +2 -2
- package/dist/workflows/validator.js +18 -2
- package/docs/migration/release-notes/0.9.0.md +45 -3
- package/docs/migration/v0.8-to-v0.9.md +466 -262
- package/docs/{data-and-telemetry.md → reference/data-and-telemetry.md} +61 -17
- package/package.json +10 -9
- package/schemas/akm-config.json +2956 -14890
- package/schemas/akm-task.json +2 -2
- package/schemas/akm-workflow.json +2 -2
- package/dist/assets/help/help-accept.md +0 -12
- package/dist/assets/help/help-improve.md +0 -84
- package/dist/assets/help/help-proposals.md +0 -17
- package/dist/assets/help/help-propose.md +0 -17
- package/dist/assets/help/help-reject.md +0 -11
- package/dist/assets/improve-strategies/recombine-only.json +0 -23
- package/dist/assets/improve-strategies/synthesize.json +0 -17
- package/dist/assets/prompts/procedural-system.md +0 -44
- package/dist/assets/prompts/recombine-system.md +0 -40
- package/dist/assets/prompts/staleness-detect-system.md +0 -6
- package/dist/assets/templates/html/default.html +0 -78
- package/dist/assets/templates/html/vendor/echarts.min.js +0 -45
- package/dist/assets/wiki/index-template.md +0 -12
- package/dist/assets/wiki/ingest-workflow-template.md +0 -83
- package/dist/assets/wiki/log-template.md +0 -8
- package/dist/assets/wiki/schema-template.md +0 -61
- package/dist/commands/improve/calibration.js +0 -161
- package/dist/commands/improve/dedup.js +0 -482
- package/dist/commands/improve/hot-probation.js +0 -45
- package/dist/commands/improve/improve-auto-accept.js +0 -262
- package/dist/commands/improve/procedural.js +0 -403
- package/dist/commands/improve/recombine.js +0 -843
- package/dist/commands/improve/schema-similarity-gate.js +0 -168
- package/dist/commands/lint/agent-linter.js +0 -44
- package/dist/commands/lint/command-linter.js +0 -44
- package/dist/commands/lint/default-linter.js +0 -16
- package/dist/commands/lint/fact-linter.js +0 -39
- package/dist/commands/lint/knowledge-linter.js +0 -16
- package/dist/commands/lint/memory-linter.js +0 -61
- package/dist/commands/lint/registry.js +0 -41
- package/dist/commands/lint/skill-linter.js +0 -45
- package/dist/commands/lint/task-linter.js +0 -50
- package/dist/commands/lint/workflow-linter.js +0 -81
- package/dist/commands/proposal/legacy-import.js +0 -115
- package/dist/commands/wiki-cli.js +0 -291
- package/dist/core/asset/asset-registry.js +0 -76
- package/dist/core/asset/asset-spec.js +0 -316
- package/dist/core/eval/rank-metrics.js +0 -113
- package/dist/core/ripgrep/install.js +0 -163
- package/dist/core/ripgrep/resolve.js +0 -81
- package/dist/indexer/db/db.js +0 -1585
- package/dist/indexer/manifest.js +0 -170
- package/dist/indexer/passes/metadata-contributors.js +0 -31
- package/dist/integrations/harnesses/opencode-sdk/index.js +0 -25
- package/dist/output/text/wiki.js +0 -16
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +0 -18228
- package/dist/scripts/migrations/v16-to-v17.js +0 -141
- package/dist/storage/repositories/consolidation-repository.js +0 -38
- package/dist/storage/repositories/recombine-repository.js +0 -213
- package/dist/wiki/wiki-templates.js +0 -15
- package/dist/wiki/wiki.js +0 -1013
- package/dist/workflows/db.js +0 -413
- package/docs/README.md +0 -103
- package/docs/migration/release-notes/0.9.0-beta.60.md +0 -19
- /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/registry.js +0 -0
- /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/youtube.js +0 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
export function formatInfoPlain(r) {
|
|
5
|
+
const lines = [];
|
|
6
|
+
if (r.version)
|
|
7
|
+
lines.push(`version: ${String(r.version)}`);
|
|
8
|
+
if (r.stashDir)
|
|
9
|
+
lines.push(`stashDir: ${String(r.stashDir)}`);
|
|
10
|
+
if (r.configPath)
|
|
11
|
+
lines.push(`configPath: ${String(r.configPath)}`);
|
|
12
|
+
if (r.cacheDir)
|
|
13
|
+
lines.push(`cacheDir: ${String(r.cacheDir)}`);
|
|
14
|
+
if (r.dbPath)
|
|
15
|
+
lines.push(`dbPath: ${String(r.dbPath)}`);
|
|
16
|
+
const capabilities = r.capabilities;
|
|
17
|
+
if (capabilities) {
|
|
18
|
+
lines.push("capabilities:");
|
|
19
|
+
for (const [k, v] of Object.entries(capabilities)) {
|
|
20
|
+
lines.push(` ${k}: ${typeof v === "object" ? JSON.stringify(v) : String(v)}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const indexStats = r.index;
|
|
24
|
+
if (indexStats) {
|
|
25
|
+
lines.push("index:");
|
|
26
|
+
for (const [k, v] of Object.entries(indexStats)) {
|
|
27
|
+
lines.push(` ${k}: ${typeof v === "object" ? JSON.stringify(v) : String(v)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (lines.length === 0)
|
|
31
|
+
return JSON.stringify(r, null, 2);
|
|
32
|
+
return lines.join("\n");
|
|
33
|
+
}
|
|
34
|
+
export function formatConfigPlain(r) {
|
|
35
|
+
// Recursive flattener: prints `key=value` lines, and nested objects as
|
|
36
|
+
// `parent.child=value`. Arrays render as JSON for compactness.
|
|
37
|
+
const lines = [];
|
|
38
|
+
const walk = (obj, prefix) => {
|
|
39
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
40
|
+
const path = prefix ? `${prefix}.${k}` : k;
|
|
41
|
+
if (v === null || v === undefined) {
|
|
42
|
+
lines.push(`${path}=`);
|
|
43
|
+
}
|
|
44
|
+
else if (Array.isArray(v)) {
|
|
45
|
+
lines.push(`${path}=${JSON.stringify(v)}`);
|
|
46
|
+
}
|
|
47
|
+
else if (typeof v === "object") {
|
|
48
|
+
walk(v, path);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
lines.push(`${path}=${String(v)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
walk(r, "");
|
|
56
|
+
if (lines.length === 0)
|
|
57
|
+
return "(empty config)";
|
|
58
|
+
return lines.join("\n");
|
|
59
|
+
}
|
|
60
|
+
export function formatFeedbackPlain(r) {
|
|
61
|
+
const ref = String(r.ref ?? "?");
|
|
62
|
+
const signal = String(r.signal ?? "?");
|
|
63
|
+
const note = typeof r.note === "string" && r.note ? ` — ${r.note}` : "";
|
|
64
|
+
return `Recorded ${signal} feedback for ${ref}${note}`;
|
|
65
|
+
}
|
|
66
|
+
export function formatRememberPlain(r) {
|
|
67
|
+
const ref = String(r.ref ?? "?");
|
|
68
|
+
const pathValue = String(r.path ?? "?");
|
|
69
|
+
return `Saved ${ref} at ${pathValue}`;
|
|
70
|
+
}
|
|
71
|
+
export function formatImportPlain(r) {
|
|
72
|
+
const ref = String(r.ref ?? "?");
|
|
73
|
+
const source = String(r.source ?? "?");
|
|
74
|
+
const pathValue = String(r.path ?? "?");
|
|
75
|
+
return `Imported ${source} → ${ref} at ${pathValue}`;
|
|
76
|
+
}
|
|
77
|
+
export function formatSavePlain(r) {
|
|
78
|
+
if (r.ok === false) {
|
|
79
|
+
const reason = typeof r.reason === "string" ? r.reason : "unknown";
|
|
80
|
+
return `save: failed (${reason})`;
|
|
81
|
+
}
|
|
82
|
+
const name = typeof r.name === "string" ? r.name : "primary stash";
|
|
83
|
+
const committed = r.committed === true;
|
|
84
|
+
const pushed = r.pushed === true;
|
|
85
|
+
const parts = [`save: ${name}`];
|
|
86
|
+
parts.push(committed ? "committed" : "no changes");
|
|
87
|
+
if (pushed)
|
|
88
|
+
parts.push("pushed");
|
|
89
|
+
return parts.join(" — ");
|
|
90
|
+
}
|
|
91
|
+
export function formatToggleComponentPlain(command, r) {
|
|
92
|
+
const verb = command === "enable" ? "Enabled" : "Disabled";
|
|
93
|
+
const component = String(r.component ?? "?");
|
|
94
|
+
const changed = r.changed === true;
|
|
95
|
+
return changed ? `${verb} ${component}` : `${component} was already ${command}d`;
|
|
96
|
+
}
|
|
97
|
+
export function formatRegistryListPlain(r) {
|
|
98
|
+
const registries = Array.isArray(r.registries) ? r.registries : [];
|
|
99
|
+
if (registries.length === 0) {
|
|
100
|
+
return "No registries configured. Add one with `akm registry add <url>`.";
|
|
101
|
+
}
|
|
102
|
+
const lines = [];
|
|
103
|
+
for (const reg of registries) {
|
|
104
|
+
const url = String(reg.url ?? "?");
|
|
105
|
+
const name = typeof reg.name === "string" ? reg.name : "";
|
|
106
|
+
const provider = typeof reg.provider === "string" ? ` (${reg.provider})` : "";
|
|
107
|
+
const enabled = reg.enabled === false ? " [disabled]" : "";
|
|
108
|
+
const head = name ? `${name}: ${url}` : url;
|
|
109
|
+
lines.push(`${head}${provider}${enabled}`);
|
|
110
|
+
}
|
|
111
|
+
return lines.join("\n");
|
|
112
|
+
}
|
|
113
|
+
export function formatRegistryAddPlain(r) {
|
|
114
|
+
if (r.added === false) {
|
|
115
|
+
return typeof r.message === "string" ? r.message : "Registry already configured.";
|
|
116
|
+
}
|
|
117
|
+
const registries = Array.isArray(r.registries) ? r.registries.length : 0;
|
|
118
|
+
return `Registry added (${registries} total).`;
|
|
119
|
+
}
|
|
120
|
+
export function formatRegistryRemovePlain(r) {
|
|
121
|
+
if (r.removed === false) {
|
|
122
|
+
return typeof r.message === "string" ? r.message : "No matching registry found.";
|
|
123
|
+
}
|
|
124
|
+
const entry = r.entry;
|
|
125
|
+
const url = entry ? String(entry.url ?? entry.name ?? "?") : "?";
|
|
126
|
+
return `Removed registry ${url}`;
|
|
127
|
+
}
|
|
128
|
+
export function formatRegistrySearchPlain(r, detail) {
|
|
129
|
+
// Reuse the same renderer as `search` — both share `hits` / `registryHits`.
|
|
130
|
+
return formatSearchPlain(r, detail);
|
|
131
|
+
}
|
|
132
|
+
export function formatRegistryBuildIndexPlain(r) {
|
|
133
|
+
const outPath = String(r.outPath ?? "?");
|
|
134
|
+
const total = typeof r.totalKits === "number" ? r.totalKits : 0;
|
|
135
|
+
const version = typeof r.version === "number" ? `v${r.version}` : "";
|
|
136
|
+
return `Wrote registry index ${version} (${total} kits) → ${outPath}`.replace(/\s+/g, " ").trim();
|
|
137
|
+
}
|
|
138
|
+
export function formatEnvListPlain(r) {
|
|
139
|
+
// Multi-env listing: { envs: [{ ref, path, keys }, ...] }
|
|
140
|
+
const envs = Array.isArray(r.envs) ? r.envs : [];
|
|
141
|
+
if (envs.length === 0) {
|
|
142
|
+
return "No env files. Create one with `akm env create <name>`, then edit the .env file directly.";
|
|
143
|
+
}
|
|
144
|
+
const lines = [];
|
|
145
|
+
for (const v of envs) {
|
|
146
|
+
const ref = String(v.ref ?? "?");
|
|
147
|
+
const keys = Array.isArray(v.keys) ? v.keys.map(String) : [];
|
|
148
|
+
if (lines.length > 0)
|
|
149
|
+
lines.push("");
|
|
150
|
+
lines.push(`## ${ref}`);
|
|
151
|
+
if (keys.length === 0) {
|
|
152
|
+
lines.push("- (no keys)");
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
for (const key of keys) {
|
|
156
|
+
lines.push(`- ${key}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return lines.join("\n");
|
|
160
|
+
}
|
|
161
|
+
export function formatEnvCreatePlain(r) {
|
|
162
|
+
return `Created env ${String(r.ref ?? "?")}`;
|
|
163
|
+
}
|
|
164
|
+
export function formatEnvExportPlain(r) {
|
|
165
|
+
return `Wrote ${String(r.ref ?? "?")} export script → ${String(r.out ?? "?")} (mode 0600; source it, then delete)`;
|
|
166
|
+
}
|
|
167
|
+
export function formatEnvRemovePlain(r) {
|
|
168
|
+
const removed = r.removed === true;
|
|
169
|
+
return removed ? `Removed env ${String(r.ref ?? "?")}` : `Env ${String(r.ref ?? "?")} was not present`;
|
|
170
|
+
}
|
|
171
|
+
export function formatEnvSetPlain(r) {
|
|
172
|
+
return `Set ${String(r.key ?? "?")} in env ${String(r.ref ?? "?")} (value not displayed)`;
|
|
173
|
+
}
|
|
174
|
+
export function formatEnvUnsetPlain(r) {
|
|
175
|
+
const removed = Array.isArray(r.removed) ? r.removed.map(String) : [];
|
|
176
|
+
const missing = Array.isArray(r.missing) ? r.missing.map(String) : [];
|
|
177
|
+
const ref = String(r.ref ?? "?");
|
|
178
|
+
const parts = [];
|
|
179
|
+
if (removed.length > 0)
|
|
180
|
+
parts.push(`Removed ${removed.join(", ")} from env ${ref}`);
|
|
181
|
+
if (missing.length > 0)
|
|
182
|
+
parts.push(`Not present in env ${ref}: ${missing.join(", ")}`);
|
|
183
|
+
return parts.join("\n") || `No keys changed in env ${ref}`;
|
|
184
|
+
}
|
|
185
|
+
export function formatEventsPlain(r) {
|
|
186
|
+
const events = Array.isArray(r.events) ? r.events : [];
|
|
187
|
+
const headerParts = [];
|
|
188
|
+
if (typeof r.ref === "string" && r.ref)
|
|
189
|
+
headerParts.push(`ref: ${r.ref}`);
|
|
190
|
+
if (typeof r.type === "string" && r.type)
|
|
191
|
+
headerParts.push(`type: ${r.type}`);
|
|
192
|
+
if (typeof r.since === "string" && r.since)
|
|
193
|
+
headerParts.push(`since: ${r.since}`);
|
|
194
|
+
const totalCount = typeof r.totalCount === "number" ? r.totalCount : events.length;
|
|
195
|
+
headerParts.push(`${totalCount} event(s)`);
|
|
196
|
+
const header = headerParts.join(" ");
|
|
197
|
+
if (events.length === 0) {
|
|
198
|
+
return `${header}\nNo events.`;
|
|
199
|
+
}
|
|
200
|
+
const lines = [header, ""];
|
|
201
|
+
for (const event of events) {
|
|
202
|
+
lines.push(formatEventLine(event));
|
|
203
|
+
}
|
|
204
|
+
return lines.join("\n").trimEnd();
|
|
205
|
+
}
|
|
206
|
+
export function formatEventLine(event) {
|
|
207
|
+
const ts = String(event.ts ?? "?");
|
|
208
|
+
const eventType = String(event.eventType ?? "?");
|
|
209
|
+
const ref = event.ref ? String(event.ref) : null;
|
|
210
|
+
const head = ref ? `${ts} [${eventType}] ${ref}` : `${ts} [${eventType}]`;
|
|
211
|
+
if (event.metadata != null && event.metadata !== "") {
|
|
212
|
+
const meta = typeof event.metadata === "string" ? event.metadata : JSON.stringify(event.metadata);
|
|
213
|
+
return `${head}\n metadata: ${meta}`;
|
|
214
|
+
}
|
|
215
|
+
return head;
|
|
216
|
+
}
|
|
217
|
+
export function formatHistoryPlain(r) {
|
|
218
|
+
const entries = Array.isArray(r.entries) ? r.entries : [];
|
|
219
|
+
const headerParts = [];
|
|
220
|
+
if (typeof r.ref === "string" && r.ref)
|
|
221
|
+
headerParts.push(`ref: ${r.ref}`);
|
|
222
|
+
if (typeof r.since === "string" && r.since)
|
|
223
|
+
headerParts.push(`since: ${r.since}`);
|
|
224
|
+
const totalCount = typeof r.totalCount === "number" ? r.totalCount : entries.length;
|
|
225
|
+
headerParts.push(`${totalCount} event(s)`);
|
|
226
|
+
// Show active event sources so operators know which streams were consulted.
|
|
227
|
+
if (Array.isArray(r.sources) && r.sources.length > 0) {
|
|
228
|
+
headerParts.push(`sources: ${r.sources.join(", ")}`);
|
|
229
|
+
}
|
|
230
|
+
const header = headerParts.join(" ");
|
|
231
|
+
if (entries.length === 0) {
|
|
232
|
+
const scope = typeof r.ref === "string" && r.ref ? ` for ${r.ref}` : "";
|
|
233
|
+
return `${header}\nNo history${scope}.`;
|
|
234
|
+
}
|
|
235
|
+
const lines = [header, ""];
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
const created = String(entry.createdAt ?? "?");
|
|
238
|
+
const eventType = String(entry.eventType ?? "?");
|
|
239
|
+
const ref = entry.ref ? String(entry.ref) : null;
|
|
240
|
+
const signal = entry.signal ? String(entry.signal) : null;
|
|
241
|
+
const query = entry.query ? String(entry.query) : null;
|
|
242
|
+
const head = ref ? `${created} [${eventType}] ${ref}` : `${created} [${eventType}]`;
|
|
243
|
+
lines.push(head);
|
|
244
|
+
if (signal)
|
|
245
|
+
lines.push(` signal: ${signal}`);
|
|
246
|
+
if (query)
|
|
247
|
+
lines.push(` query: ${query}`);
|
|
248
|
+
if (entry.metadata != null && entry.metadata !== "") {
|
|
249
|
+
const meta = typeof entry.metadata === "string" ? entry.metadata : JSON.stringify(entry.metadata);
|
|
250
|
+
lines.push(` metadata: ${meta}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return lines.join("\n").trimEnd();
|
|
254
|
+
}
|
|
255
|
+
export function formatSearchPlain(r, detail) {
|
|
256
|
+
const hits = r.hits ?? [];
|
|
257
|
+
const registryHits = r.registryHits ?? [];
|
|
258
|
+
const allHits = [...hits, ...registryHits];
|
|
259
|
+
if (allHits.length === 0) {
|
|
260
|
+
const warnings = Array.isArray(r.warnings) ? r.warnings : [];
|
|
261
|
+
const hasSetupWarning = warnings.some((w) => String(w).toLowerCase().includes("no stash") || String(w).toLowerCase().includes("not configured"));
|
|
262
|
+
if (hasSetupWarning) {
|
|
263
|
+
return "No stash configured. Run `akm init` to create your working stash, then `akm index` to build the search index.";
|
|
264
|
+
}
|
|
265
|
+
const base = r.tip ? String(r.tip) : "No matches found.";
|
|
266
|
+
return `${base}\nTry:\n akm search '<broader-term>' # fewer keywords\n akm list # see all configured sources\n akm curate '<query>' # let akm select the best match`;
|
|
267
|
+
}
|
|
268
|
+
const lines = [];
|
|
269
|
+
for (const hit of allHits) {
|
|
270
|
+
const type = hit.type ?? "unknown";
|
|
271
|
+
const name = hit.name ?? "unnamed";
|
|
272
|
+
const score = hit.score != null ? ` (score: ${hit.score})` : "";
|
|
273
|
+
const desc = hit.description ? ` ${hit.description}` : "";
|
|
274
|
+
lines.push(`${type}: ${name}${score}`);
|
|
275
|
+
if (desc)
|
|
276
|
+
lines.push(desc);
|
|
277
|
+
if (hit.id)
|
|
278
|
+
lines.push(` id: ${String(hit.id)}`);
|
|
279
|
+
if (hit.ref)
|
|
280
|
+
lines.push(` ref: ${String(hit.ref)}`);
|
|
281
|
+
if (hit.origin !== undefined)
|
|
282
|
+
lines.push(` origin: ${String(hit.origin)}`);
|
|
283
|
+
if (Array.isArray(hit.keys) && hit.keys.length > 0)
|
|
284
|
+
lines.push(` keys: ${hit.keys.join(", ")}`);
|
|
285
|
+
if (hit.size)
|
|
286
|
+
lines.push(` size: ${String(hit.size)}`);
|
|
287
|
+
if (hit.action)
|
|
288
|
+
lines.push(` action: ${String(hit.action)}`);
|
|
289
|
+
if (hit.run)
|
|
290
|
+
lines.push(` run: ${String(hit.run)}`);
|
|
291
|
+
if (Array.isArray(hit.tags) && hit.tags.length > 0)
|
|
292
|
+
lines.push(` tags: ${hit.tags.join(", ")}`);
|
|
293
|
+
// Optional v1 spec §4.2 quality marker (e.g. "curated" / "proposed").
|
|
294
|
+
if (typeof hit.quality === "string" && hit.quality)
|
|
295
|
+
lines.push(` quality: ${hit.quality}`);
|
|
296
|
+
// Surface optional hit-level warnings (v1 spec §4.2). The legacy
|
|
297
|
+
// `curated` boolean was removed in v1.
|
|
298
|
+
if (Array.isArray(hit.warnings) && hit.warnings.length > 0) {
|
|
299
|
+
lines.push(` warnings: ${hit.warnings.join("; ")}`);
|
|
300
|
+
}
|
|
301
|
+
const graph = typeof hit.graph === "object" && hit.graph !== null ? hit.graph : undefined;
|
|
302
|
+
if (graph) {
|
|
303
|
+
const entities = Array.isArray(graph.entities) ? graph.entities : [];
|
|
304
|
+
if (entities.length > 0) {
|
|
305
|
+
const matched = entities
|
|
306
|
+
.filter((entity) => String(entity.kind ?? "") === "matched")
|
|
307
|
+
.map((entity) => String(entity.name ?? "?"));
|
|
308
|
+
const neighbors = entities
|
|
309
|
+
.filter((entity) => String(entity.kind ?? "") !== "matched")
|
|
310
|
+
.map((entity) => String(entity.name ?? "?"));
|
|
311
|
+
lines.push(` graph: ${[
|
|
312
|
+
matched.length > 0 ? `query match=${matched.join(", ")}` : undefined,
|
|
313
|
+
neighbors.length > 0 ? `neighbors=${neighbors.join(", ")}` : undefined,
|
|
314
|
+
]
|
|
315
|
+
.filter(Boolean)
|
|
316
|
+
.join("; ")}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (detail === "full") {
|
|
320
|
+
if (hit.path)
|
|
321
|
+
lines.push(` path: ${String(hit.path)}`);
|
|
322
|
+
if (hit.editable != null)
|
|
323
|
+
lines.push(` editable: ${String(hit.editable)}`);
|
|
324
|
+
if (hit.editHint)
|
|
325
|
+
lines.push(` editHint: ${String(hit.editHint)}`);
|
|
326
|
+
const whyMatched = hit.whyMatched;
|
|
327
|
+
if (whyMatched && whyMatched.length > 0) {
|
|
328
|
+
lines.push(` whyMatched: ${whyMatched.join(", ")}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
lines.push(""); // blank line between hits
|
|
332
|
+
}
|
|
333
|
+
if (detail === "full" && r.timing) {
|
|
334
|
+
const timing = r.timing;
|
|
335
|
+
const parts = [];
|
|
336
|
+
if (timing.totalMs != null)
|
|
337
|
+
parts.push(`total: ${timing.totalMs}ms`);
|
|
338
|
+
if (timing.rankMs != null)
|
|
339
|
+
parts.push(`rank: ${timing.rankMs}ms`);
|
|
340
|
+
if (timing.embedMs != null)
|
|
341
|
+
parts.push(`embed: ${timing.embedMs}ms`);
|
|
342
|
+
if (parts.length > 0)
|
|
343
|
+
lines.push(`timing: ${parts.join(", ")}`);
|
|
344
|
+
}
|
|
345
|
+
// REC-02: When stash hits exist, tell the agent the next required step so it
|
|
346
|
+
// doesn't skip `akm show` and write from training memory instead.
|
|
347
|
+
if (hits.length >= 1) {
|
|
348
|
+
// Prefer skill/command/agent type hits for the "Next:" ref — knowledge docs are
|
|
349
|
+
// supplementary context, not the authoritative schema agents should load first.
|
|
350
|
+
const preferredHit = hits.find((h) => h.type === "skill" || h.type === "command" || h.type === "agent") ?? hits[0];
|
|
351
|
+
const topRef = typeof preferredHit.ref === "string" ? preferredHit.ref : null;
|
|
352
|
+
const hasWorkflowHit = hits.some((h) => h.type === "workflow");
|
|
353
|
+
if (topRef) {
|
|
354
|
+
if (hasWorkflowHit) {
|
|
355
|
+
const workflowRef = hits.find((h) => h.type === "workflow");
|
|
356
|
+
const wfRef = workflowRef && typeof workflowRef.ref === "string" ? workflowRef.ref : topRef;
|
|
357
|
+
lines.push(`Next: akm show '${topRef}' | To start a workflow: akm workflow next '${wfRef}'`);
|
|
358
|
+
lines.push("After running workflow next: follow each step and run `akm workflow complete <run-id> --step <step-id>` when done.");
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
lines.push(`Next: akm show '${topRef}'`);
|
|
362
|
+
lines.push("After reading the asset: check whether a workflow applies before editing — if so, use `akm workflow next` instead.");
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return lines.join("\n").trimEnd();
|
|
367
|
+
}
|
|
368
|
+
export function formatCuratePlain(r, detail) {
|
|
369
|
+
const query = typeof r.query === "string" ? r.query : "";
|
|
370
|
+
const summary = typeof r.summary === "string" ? r.summary : "";
|
|
371
|
+
const items = Array.isArray(r.items) ? r.items : [];
|
|
372
|
+
const lines = [`Curated results for "${query}"`];
|
|
373
|
+
if (summary)
|
|
374
|
+
lines.push(summary);
|
|
375
|
+
if (items.length === 0) {
|
|
376
|
+
if (r.tip)
|
|
377
|
+
lines.push(String(r.tip));
|
|
378
|
+
return lines.join("\n");
|
|
379
|
+
}
|
|
380
|
+
for (const item of items) {
|
|
381
|
+
const type = typeof item.type === "string" ? item.type : "unknown";
|
|
382
|
+
const name = typeof item.name === "string" ? item.name : "unnamed";
|
|
383
|
+
lines.push("");
|
|
384
|
+
lines.push(`[${type}] ${name}`);
|
|
385
|
+
if (item.description)
|
|
386
|
+
lines.push(` ${String(item.description)}`);
|
|
387
|
+
if (item.preview)
|
|
388
|
+
lines.push(` preview: ${String(item.preview)}`);
|
|
389
|
+
if (item.ref)
|
|
390
|
+
lines.push(` ref: ${String(item.ref)}`);
|
|
391
|
+
if (item.id)
|
|
392
|
+
lines.push(` id: ${String(item.id)}`);
|
|
393
|
+
if (Array.isArray(item.keys) && item.keys.length > 0) {
|
|
394
|
+
lines.push(` keys: ${item.keys.join(", ")}`);
|
|
395
|
+
}
|
|
396
|
+
if (Array.isArray(item.parameters) && item.parameters.length > 0) {
|
|
397
|
+
lines.push(` parameters: ${item.parameters.join(", ")}`);
|
|
398
|
+
}
|
|
399
|
+
if (item.run)
|
|
400
|
+
lines.push(` run: ${String(item.run)}`);
|
|
401
|
+
if (item.followUp)
|
|
402
|
+
lines.push(` show: ${String(item.followUp)}`);
|
|
403
|
+
if (Array.isArray(item.supportRefs) && item.supportRefs.length > 0) {
|
|
404
|
+
for (const support of item.supportRefs) {
|
|
405
|
+
if (!support.ref)
|
|
406
|
+
continue;
|
|
407
|
+
const label = typeof support.type === "string" ? `[${support.type}] ` : "";
|
|
408
|
+
const why = typeof support.reason === "string" ? ` — ${support.reason}` : "";
|
|
409
|
+
lines.push(` support: ${label}${String(support.ref)}${why}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (detail !== "brief" && item.reason)
|
|
413
|
+
lines.push(` why: ${String(item.reason)}`);
|
|
414
|
+
}
|
|
415
|
+
const warnings = Array.isArray(r.warnings) ? r.warnings : [];
|
|
416
|
+
if (warnings.length > 0) {
|
|
417
|
+
lines.push("");
|
|
418
|
+
lines.push("Warnings:");
|
|
419
|
+
for (const warning of warnings) {
|
|
420
|
+
lines.push(`- ${String(warning)}`);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
lines.push("");
|
|
424
|
+
lines.push("Next steps:");
|
|
425
|
+
lines.push(" 1. Run `akm show <ref>` for the best result above to read the full schema.");
|
|
426
|
+
lines.push(" 2. Edit the workspace file using the schema field names and your task-specific values.");
|
|
427
|
+
lines.push(" 3. Run `akm feedback <ref> --positive` when the task succeeds.");
|
|
428
|
+
lines.push("To search further: akm search '<query>'");
|
|
429
|
+
return lines.join("\n");
|
|
430
|
+
}
|
|
431
|
+
export function formatInitPlain(r) {
|
|
432
|
+
let out = `Stash initialized at ${r.stashDir ?? "unknown"}`;
|
|
433
|
+
// When --dir scaffolded a secondary stash but the default was deliberately
|
|
434
|
+
// left untouched, tell the user instead of silently repointing their default.
|
|
435
|
+
if (r.defaultStashUpdated === false && typeof r.previousStashDir === "string" && r.previousStashDir) {
|
|
436
|
+
out += `\nYour default stash is unchanged (${r.previousStashDir}). Re-run with --set-default to make ${r.stashDir} the default.`;
|
|
437
|
+
}
|
|
438
|
+
else if (r.configPath) {
|
|
439
|
+
out += `\nConfig saved to ${r.configPath}`;
|
|
440
|
+
}
|
|
441
|
+
return out;
|
|
442
|
+
}
|
|
443
|
+
export function formatIndexPlain(r) {
|
|
444
|
+
const indexResult = r;
|
|
445
|
+
let out = `Indexed ${indexResult.totalEntries ?? 0} entries from ${indexResult.directoriesScanned ?? 0} directories (mode: ${indexResult.mode ?? "unknown"})`;
|
|
446
|
+
const warnings = indexResult.warnings;
|
|
447
|
+
if (Array.isArray(warnings) && warnings.length > 0) {
|
|
448
|
+
out += `\nWarnings (${warnings.length}):`;
|
|
449
|
+
for (const message of warnings)
|
|
450
|
+
out += `\n - ${String(message)}`;
|
|
451
|
+
}
|
|
452
|
+
const verification = indexResult.verification;
|
|
453
|
+
if (verification?.ok === false && verification.message) {
|
|
454
|
+
out += `\nVerification: ${String(verification.message)}`;
|
|
455
|
+
}
|
|
456
|
+
const timing = indexResult.timing;
|
|
457
|
+
if (timing) {
|
|
458
|
+
out +=
|
|
459
|
+
`\nTiming: total ${timing.totalMs}ms` +
|
|
460
|
+
`, preflight ${timing.preflightMs}ms` +
|
|
461
|
+
`, walk ${timing.walkMs}ms` +
|
|
462
|
+
`, llm ${timing.llmMs}ms` +
|
|
463
|
+
`, embeddings ${timing.embedMs}ms` +
|
|
464
|
+
`, fts ${timing.ftsMs}ms` +
|
|
465
|
+
`, finalize ${timing.finalizeMs}ms` +
|
|
466
|
+
`, clean ${timing.cleanMs}ms` +
|
|
467
|
+
`, end-to-end ${timing.endToEndMs}ms`;
|
|
468
|
+
}
|
|
469
|
+
return out;
|
|
470
|
+
}
|
|
471
|
+
export function formatListPlain(r) {
|
|
472
|
+
const sources = Array.isArray(r.sources) ? r.sources : [];
|
|
473
|
+
if (sources.length === 0)
|
|
474
|
+
return "No sources configured. Use `akm add` to add a source.";
|
|
475
|
+
const lines = [];
|
|
476
|
+
for (const src of sources) {
|
|
477
|
+
const kind = typeof src.kind === "string" ? src.kind : "unknown";
|
|
478
|
+
const name = typeof src.name === "string" ? src.name : "unnamed";
|
|
479
|
+
const ver = typeof src.version === "string" ? ` v${src.version}` : "";
|
|
480
|
+
const prov = typeof src.provider === "string" ? ` (${src.provider})` : "";
|
|
481
|
+
const flags = [];
|
|
482
|
+
if (src.updatable === true)
|
|
483
|
+
flags.push("updatable");
|
|
484
|
+
if (src.writable === true)
|
|
485
|
+
flags.push("writable");
|
|
486
|
+
const flagText = flags.length > 0 ? ` [${flags.join(", ")}]` : "";
|
|
487
|
+
lines.push(`[${kind}] ${name}${ver}${prov}${flagText}`);
|
|
488
|
+
}
|
|
489
|
+
lines.push("");
|
|
490
|
+
lines.push("To search: akm search '<query>' | To view an asset: akm show <ref>");
|
|
491
|
+
return lines.join("\n");
|
|
492
|
+
}
|
|
493
|
+
export function formatAddPlain(r) {
|
|
494
|
+
const index = r.index;
|
|
495
|
+
const scanned = index?.directoriesScanned ?? 0;
|
|
496
|
+
const total = index?.totalEntries ?? 0;
|
|
497
|
+
const lines = [`Installed ${r.ref} (${scanned} directories scanned, ${total} total assets indexed)`];
|
|
498
|
+
const warnings = index?.warnings;
|
|
499
|
+
if (Array.isArray(warnings) && warnings.length > 0) {
|
|
500
|
+
lines.push(`Warnings (${warnings.length}):`);
|
|
501
|
+
for (const message of warnings)
|
|
502
|
+
lines.push(` - ${String(message)}`);
|
|
503
|
+
}
|
|
504
|
+
return lines.join("\n");
|
|
505
|
+
}
|
|
506
|
+
export function formatRemovePlain(r) {
|
|
507
|
+
const target = r.target ?? r.ref ?? "";
|
|
508
|
+
const ok = r.ok !== false ? "OK" : "FAILED";
|
|
509
|
+
return `remove: ${target} ${ok}`;
|
|
510
|
+
}
|
|
511
|
+
export function formatUpdatePlain(r) {
|
|
512
|
+
const processed = r.processed;
|
|
513
|
+
if (!processed?.length)
|
|
514
|
+
return `update: nothing to update`;
|
|
515
|
+
const lines = processed.map((item) => {
|
|
516
|
+
const changed = item.changed;
|
|
517
|
+
const installed = item.installed;
|
|
518
|
+
const previous = item.previous;
|
|
519
|
+
if (changed?.any) {
|
|
520
|
+
const prev = previous?.resolvedVersion ?? "unknown";
|
|
521
|
+
const next = installed?.resolvedVersion ?? "unknown";
|
|
522
|
+
return `update: ${item.id} v${prev} → v${next}`;
|
|
523
|
+
}
|
|
524
|
+
return `update: ${item.id} (unchanged)`;
|
|
525
|
+
});
|
|
526
|
+
return lines.join("\n");
|
|
527
|
+
}
|
|
528
|
+
export function formatUpgradePlain(r) {
|
|
529
|
+
if (r.upgraded === true) {
|
|
530
|
+
return `akm upgraded: v${r.currentVersion} → v${r.newVersion}`;
|
|
531
|
+
}
|
|
532
|
+
if (r.updateAvailable === true) {
|
|
533
|
+
return `akm v${r.currentVersion} → v${r.latestVersion} available (run 'akm upgrade' to install)`;
|
|
534
|
+
}
|
|
535
|
+
if (r.updateAvailable === false && r.latestVersion) {
|
|
536
|
+
return `akm v${r.currentVersion} is already the latest version`;
|
|
537
|
+
}
|
|
538
|
+
if (r.message)
|
|
539
|
+
return String(r.message);
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
export function formatClonePlain(r) {
|
|
543
|
+
const dst = r.destination?.path ?? "unknown";
|
|
544
|
+
const remote = r.remoteFetched ? " (fetched from remote)" : "";
|
|
545
|
+
const over = r.overwritten ? " (overwritten)" : "";
|
|
546
|
+
return `Cloned${remote} → ${dst}${over}`;
|
|
547
|
+
}
|