@unbrained/pm-cli 2026.5.12 → 2026.5.18
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/.claude-plugin/marketplace.json +4 -4
- package/AGENTS.md +78 -457
- package/CHANGELOG.md +22 -0
- package/CONTRIBUTING.md +1 -0
- package/PRD.md +7 -28
- package/README.md +8 -14
- package/dist/cli/argv-utils.js +4 -1
- package/dist/cli/argv-utils.js.map +1 -1
- package/dist/cli/bootstrap-args.js +4 -1
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/commander-usage.js +32 -1
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/activity.js +23 -5
- package/dist/cli/commands/activity.js.map +1 -1
- package/dist/cli/commands/aggregate.js +5 -2
- package/dist/cli/commands/aggregate.js.map +1 -1
- package/dist/cli/commands/append.js +4 -1
- package/dist/cli/commands/append.js.map +1 -1
- package/dist/cli/commands/calendar.js +9 -3
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/claim.d.ts +3 -0
- package/dist/cli/commands/claim.js +19 -3
- package/dist/cli/commands/claim.js.map +1 -1
- package/dist/cli/commands/close.js +4 -1
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/comments-audit.js +4 -1
- package/dist/cli/commands/comments-audit.js.map +1 -1
- package/dist/cli/commands/comments.js +4 -1
- package/dist/cli/commands/comments.js.map +1 -1
- package/dist/cli/commands/completion.js +98 -2
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.js +4 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/context.js +19 -5
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.d.ts +9 -0
- package/dist/cli/commands/contracts.js +205 -49
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.js +88 -9
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/dedupe-audit.js +4 -1
- package/dist/cli/commands/dedupe-audit.js.map +1 -1
- package/dist/cli/commands/delete.js +4 -1
- package/dist/cli/commands/delete.js.map +1 -1
- package/dist/cli/commands/deps.js +4 -1
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/docs.js +4 -1
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +7 -2
- package/dist/cli/commands/extension.js +360 -64
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/files.js +4 -1
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/gc.js +4 -1
- package/dist/cli/commands/gc.js.map +1 -1
- package/dist/cli/commands/get.d.ts +7 -3
- package/dist/cli/commands/get.js +91 -18
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/guide.js +6 -8
- package/dist/cli/commands/guide.js.map +1 -1
- package/dist/cli/commands/health.d.ts +4 -0
- package/dist/cli/commands/health.js +31 -8
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +42 -0
- package/dist/cli/commands/history-redact.js +559 -0
- package/dist/cli/commands/history-redact.js.map +1 -0
- package/dist/cli/commands/history.d.ts +4 -0
- package/dist/cli/commands/history.js +14 -3
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -8
- package/dist/cli/commands/index.js +6 -9
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init-agent-guidance.d.ts +31 -0
- package/dist/cli/commands/init-agent-guidance.js +336 -0
- package/dist/cli/commands/init-agent-guidance.js.map +1 -0
- package/dist/cli/commands/init.d.ts +14 -0
- package/dist/cli/commands/init.js +75 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learnings.js +4 -1
- package/dist/cli/commands/learnings.js.map +1 -1
- package/dist/cli/commands/list.d.ts +1 -0
- package/dist/cli/commands/list.js +42 -18
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/metadata-normalizers.js +4 -1
- package/dist/cli/commands/metadata-normalizers.js.map +1 -1
- package/dist/cli/commands/normalize.js +4 -1
- package/dist/cli/commands/normalize.js.map +1 -1
- package/dist/cli/commands/notes.js +4 -1
- package/dist/cli/commands/notes.js.map +1 -1
- package/dist/cli/commands/plan.d.ts +118 -0
- package/dist/cli/commands/plan.js +975 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/reindex.d.ts +8 -0
- package/dist/cli/commands/reindex.js +100 -24
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/restore.js +4 -1
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/search.js +58 -27
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/stats.js +4 -1
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/templates.js +4 -1
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/commands/test-all.js +4 -1
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/commands/test-runs.js +4 -1
- package/dist/cli/commands/test-runs.js.map +1 -1
- package/dist/cli/commands/test.js +4 -1
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update-many.js +4 -1
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.js +114 -71
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/upgrade.js +6 -3
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/validate.js +32 -4
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.js +5 -2
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-help.js +4 -1
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/extension-command-options.js +4 -1
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/guide-topics.js +4 -1
- package/dist/cli/guide-topics.js.map +1 -1
- package/dist/cli/help-content.js +52 -33
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.js +4 -1
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.js +276 -32
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migration-gates.js +4 -1
- package/dist/cli/migration-gates.js.map +1 -1
- package/dist/cli/register-list-query.js +55 -150
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +277 -261
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +62 -199
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +55 -146
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +2 -2
- package/dist/cli/registration-helpers.js +11 -21
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli/shared-parsers.js +4 -1
- package/dist/cli/shared-parsers.js.map +1 -1
- package/dist/cli/telemetry-flush.js +4 -1
- package/dist/cli/telemetry-flush.js.map +1 -1
- package/dist/cli.js +45 -3
- package/dist/cli.js.map +1 -1
- package/dist/core/extensions/extension-types.js +4 -1
- package/dist/core/extensions/extension-types.js.map +1 -1
- package/dist/core/extensions/index.js +4 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/item-fields.js +4 -1
- package/dist/core/extensions/item-fields.js.map +1 -1
- package/dist/core/extensions/loader.js +84 -54
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runtime-registrations.js +4 -1
- package/dist/core/extensions/runtime-registrations.js.map +1 -1
- package/dist/core/fs/fs-utils.js +4 -1
- package/dist/core/fs/fs-utils.js.map +1 -1
- package/dist/core/fs/index.js +4 -1
- package/dist/core/fs/index.js.map +1 -1
- package/dist/core/history/history-stream-policy.js +4 -1
- package/dist/core/history/history-stream-policy.js.map +1 -1
- package/dist/core/history/history.js +4 -1
- package/dist/core/history/history.js.map +1 -1
- package/dist/core/history/index.js +4 -1
- package/dist/core/history/index.js.map +1 -1
- package/dist/core/item/id.js +4 -1
- package/dist/core/item/id.js.map +1 -1
- package/dist/core/item/index.js +4 -1
- package/dist/core/item/index.js.map +1 -1
- package/dist/core/item/item-format.js +241 -2
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/parent-reference-policy.js +4 -1
- package/dist/core/item/parent-reference-policy.js.map +1 -1
- package/dist/core/item/parse.js +33 -3
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/item/sprint-release-format.js +4 -1
- package/dist/core/item/sprint-release-format.js.map +1 -1
- package/dist/core/item/status.js +4 -1
- package/dist/core/item/status.js.map +1 -1
- package/dist/core/item/type-registry.js +4 -1
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/lock/index.js +4 -1
- package/dist/core/lock/index.js.map +1 -1
- package/dist/core/lock/lock.js +4 -1
- package/dist/core/lock/lock.js.map +1 -1
- package/dist/core/output/command-aware.js +4 -1
- package/dist/core/output/command-aware.js.map +1 -1
- package/dist/core/output/output.d.ts +4 -0
- package/dist/core/output/output.js +47 -6
- package/dist/core/output/output.js.map +1 -1
- package/dist/core/packages/manifest.d.ts +27 -1
- package/dist/core/packages/manifest.js +87 -1
- package/dist/core/packages/manifest.js.map +1 -1
- package/dist/core/packages/root.d.ts +3 -0
- package/dist/core/packages/root.js +51 -0
- package/dist/core/packages/root.js.map +1 -0
- package/dist/core/schema/runtime-field-filters.js +4 -1
- package/dist/core/schema/runtime-field-filters.js.map +1 -1
- package/dist/core/schema/runtime-field-values.js +4 -1
- package/dist/core/schema/runtime-field-values.js.map +1 -1
- package/dist/core/schema/runtime-schema.js +4 -1
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/search/cache.js +7 -2
- package/dist/core/search/cache.js.map +1 -1
- package/dist/core/search/corpus.d.ts +2 -0
- package/dist/core/search/corpus.js +77 -2
- package/dist/core/search/corpus.js.map +1 -1
- package/dist/core/search/embedding-batches.d.ts +13 -1
- package/dist/core/search/embedding-batches.js +40 -8
- package/dist/core/search/embedding-batches.js.map +1 -1
- package/dist/core/search/http-client.js +4 -1
- package/dist/core/search/http-client.js.map +1 -1
- package/dist/core/search/providers.js +4 -1
- package/dist/core/search/providers.js.map +1 -1
- package/dist/core/search/semantic-defaults.js +11 -2
- package/dist/core/search/semantic-defaults.js.map +1 -1
- package/dist/core/search/vector-stores.js +4 -1
- package/dist/core/search/vector-stores.js.map +1 -1
- package/dist/core/sentry/helpers.js +4 -1
- package/dist/core/sentry/helpers.js.map +1 -1
- package/dist/core/sentry/instrument.js +10 -13
- package/dist/core/sentry/instrument.js.map +1 -1
- package/dist/core/shared/command-types.js +4 -1
- package/dist/core/shared/command-types.js.map +1 -1
- package/dist/core/shared/conflict-markers.js +4 -1
- package/dist/core/shared/conflict-markers.js.map +1 -1
- package/dist/core/shared/constants.d.ts +2 -2
- package/dist/core/shared/constants.js +24 -1
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/shared/errors.js +4 -1
- package/dist/core/shared/errors.js.map +1 -1
- package/dist/core/shared/index.js +4 -1
- package/dist/core/shared/index.js.map +1 -1
- package/dist/core/shared/levenshtein.js +4 -1
- package/dist/core/shared/levenshtein.js.map +1 -1
- package/dist/core/shared/primitives.js +4 -1
- package/dist/core/shared/primitives.js.map +1 -1
- package/dist/core/shared/serialization.js +4 -1
- package/dist/core/shared/serialization.js.map +1 -1
- package/dist/core/shared/text-normalization.js +4 -1
- package/dist/core/shared/text-normalization.js.map +1 -1
- package/dist/core/shared/time.js +4 -1
- package/dist/core/shared/time.js.map +1 -1
- package/dist/core/store/front-matter-cache.d.ts +8 -1
- package/dist/core/store/front-matter-cache.js +28 -14
- package/dist/core/store/front-matter-cache.js.map +1 -1
- package/dist/core/store/index.js +4 -1
- package/dist/core/store/index.js.map +1 -1
- package/dist/core/store/item-format-migration.js +4 -1
- package/dist/core/store/item-format-migration.js.map +1 -1
- package/dist/core/store/item-store.d.ts +2 -0
- package/dist/core/store/item-store.js +66 -3
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/paths.js +4 -1
- package/dist/core/store/paths.js.map +1 -1
- package/dist/core/store/settings.js +39 -1
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/consent.js +4 -1
- package/dist/core/telemetry/consent.js.map +1 -1
- package/dist/core/telemetry/observability.d.ts +1 -1
- package/dist/core/telemetry/observability.js +11 -2
- package/dist/core/telemetry/observability.js.map +1 -1
- package/dist/core/telemetry/runtime.js +31 -5
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/core/test/background-runs.js +4 -1
- package/dist/core/test/background-runs.js.map +1 -1
- package/dist/core/test/item-test-run-tracking.js +4 -1
- package/dist/core/test/item-test-run-tracking.js.map +1 -1
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +212 -53
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +7 -0
- package/dist/sdk/cli-contracts/commander-mutation-options.js +484 -0
- package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -0
- package/dist/sdk/cli-contracts/commander-types.d.ts +21 -0
- package/dist/sdk/cli-contracts/commander-types.js +95 -0
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -0
- package/dist/sdk/cli-contracts.d.ts +10 -17
- package/dist/sdk/cli-contracts.js +232 -282
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +5 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runtime.d.ts +29 -0
- package/dist/sdk/runtime.js +31 -0
- package/dist/sdk/runtime.js.map +1 -0
- package/dist/types/index.js +4 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types.d.ts +86 -2
- package/dist/types.js +34 -1
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +16 -6
- package/docs/CLAUDE_CODE_PLUGIN.md +10 -10
- package/docs/CODEX_PLUGIN.md +2 -2
- package/docs/COMMANDS.md +83 -8
- package/docs/CONFIGURATION.md +4 -1
- package/docs/EXTENSIONS.md +176 -807
- package/docs/QUICKSTART.md +12 -5
- package/docs/README.md +7 -6
- package/docs/RELEASING.md +6 -4
- package/docs/SDK.md +78 -441
- package/docs/TESTING.md +2 -2
- package/marketplace.json +3 -3
- package/package.json +7 -4
- package/packages/pm-beads/extensions/beads/index.js +90 -101
- package/packages/pm-beads/extensions/beads/index.ts +2 -2
- package/packages/pm-beads/extensions/beads/runtime.js +2 -17
- package/packages/pm-beads/extensions/beads/runtime.ts +41 -18
- package/packages/pm-beads/package.json +34 -1
- package/packages/pm-calendar/README.md +13 -0
- package/packages/pm-calendar/extensions/calendar/index.js +56 -0
- package/packages/pm-calendar/extensions/calendar/index.ts +62 -0
- package/packages/pm-calendar/extensions/calendar/manifest.json +7 -0
- package/packages/pm-calendar/extensions/calendar/runtime.js +114 -0
- package/packages/pm-calendar/extensions/calendar/runtime.ts +123 -0
- package/packages/pm-calendar/package.json +51 -0
- package/packages/pm-governance-audit/README.md +23 -0
- package/packages/pm-governance-audit/extensions/governance-audit/index.js +117 -0
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +118 -0
- package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +7 -0
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +159 -0
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +176 -0
- package/packages/pm-governance-audit/package.json +52 -0
- package/packages/pm-guide-shell/README.md +23 -0
- package/packages/pm-guide-shell/extensions/guide-shell/index.js +76 -0
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +81 -0
- package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +7 -0
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +263 -0
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +327 -0
- package/packages/pm-guide-shell/package.json +52 -0
- package/packages/pm-linked-test-adapters/README.md +24 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.js +101 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +102 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +7 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +142 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +173 -0
- package/packages/pm-linked-test-adapters/package.json +53 -0
- package/packages/pm-search-advanced/README.md +27 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +93 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +94 -0
- package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +7 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +120 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +144 -0
- package/packages/pm-search-advanced/package.json +54 -0
- package/packages/pm-templates/README.md +20 -0
- package/packages/pm-templates/extensions/templates/index.js +101 -0
- package/packages/pm-templates/extensions/templates/index.ts +109 -0
- package/packages/pm-templates/extensions/templates/manifest.json +7 -0
- package/packages/pm-templates/extensions/templates/runtime.js +226 -0
- package/packages/pm-templates/extensions/templates/runtime.ts +283 -0
- package/packages/pm-templates/package.json +50 -0
- package/packages/pm-todos/extensions/todos/index.js +105 -116
- package/packages/pm-todos/extensions/todos/index.ts +3 -2
- package/packages/pm-todos/extensions/todos/runtime.js +2 -17
- package/packages/pm-todos/extensions/todos/runtime.ts +40 -18
- package/packages/pm-todos/package.json +35 -1
- package/plugins/{pm-cli-claude → pm-claude}/.claude-plugin/plugin.json +2 -2
- package/plugins/{pm-cli-claude → pm-claude}/.mcp.json +1 -1
- package/plugins/{pm-cli-claude → pm-claude}/README.md +4 -4
- package/plugins/{pm-cli-claude → pm-claude}/agents/pm-coordinator.md +1 -1
- package/plugins/{pm-cli-claude → pm-claude}/commands/pm-init.md +10 -1
- package/plugins/{pm-cli-claude → pm-claude}/commands/pm-planner.md +18 -0
- package/plugins/{pm-cli-claude → pm-claude}/scripts/pm-mcp-server.mjs +4 -2
- package/plugins/{pm-cli-claude → pm-claude}/skills/pm-planner/SKILL.md +46 -1
- package/plugins/{pm-cli-codex → pm-codex}/.codex-plugin/plugin.json +3 -3
- package/plugins/{pm-cli-codex → pm-codex}/.mcp.json +1 -1
- package/plugins/{pm-cli-codex → pm-codex}/README.md +7 -4
- package/plugins/{pm-cli-codex → pm-codex}/scripts/pm-mcp-server.mjs +4 -2
- package/plugins/pm-codex/skills/pm-native/SKILL.md +81 -0
- package/scripts/finalize-build.mjs +28 -0
- package/scripts/prepare-build-cache.mjs +37 -0
- package/plugins/pm-cli-codex/skills/pm-native/SKILL.md +0 -57
- /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-delivery-chain.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-triage-agent.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-verification-agent.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-audit.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-calendar.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-close-task.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-developer.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-list.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-new.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-release.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-search.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-start-task.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-status.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-triage.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-workflow.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/hooks/hooks.json +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/hooks/session-start.mjs +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-audit/SKILL.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-developer/SKILL.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-release/SKILL.md +0 -0
- /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-workflow/SKILL.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/assets/pm-cli-small.svg +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-audit.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-close-task.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-start-task.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/SKILL.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/agents/openai.yaml +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-native/agents/openai.yaml +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/SKILL.md +0 -0
- /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/agents/openai.yaml +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fabece59-ecce-590b-8a6f-f37c0490f98e")}catch(e){}}();
|
|
1
3
|
import jsonPatch from "fast-json-patch";
|
|
2
4
|
import { pathExists, readFileIfExists } from "../../core/fs/fs-utils.js";
|
|
3
5
|
import { hashDocument, hashEmptyDocument } from "../../core/history/history.js";
|
|
@@ -106,7 +108,7 @@ function applyHistoryPatch(current, patch, entryNumber) {
|
|
|
106
108
|
throw new PmCliError(`Failed to apply history patch at entry ${entryNumber}.`, EXIT_CODE.GENERIC_FAILURE);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
|
-
function verifyHistoryChain(entries) {
|
|
111
|
+
export function verifyHistoryChain(entries) {
|
|
110
112
|
let replay = structuredClone(EMPTY_REPLAY_DOCUMENT);
|
|
111
113
|
for (let index = 0; index < entries.length; index += 1) {
|
|
112
114
|
const entry = entries[index];
|
|
@@ -117,7 +119,15 @@ function verifyHistoryChain(entries) {
|
|
|
117
119
|
errors: [`verify_failed:before_hash_mismatch:entry_${index + 1}`],
|
|
118
120
|
};
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
try {
|
|
123
|
+
replay = applyHistoryPatch(replay, entry.patch, index + 1);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return {
|
|
127
|
+
ok: false,
|
|
128
|
+
errors: [`verify_failed:patch_apply_failed:entry_${index + 1}`],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
121
131
|
const afterHash = replayHash(replay);
|
|
122
132
|
if (afterHash !== entry.after_hash) {
|
|
123
133
|
return {
|
|
@@ -227,4 +237,5 @@ export async function runHistory(id, options, global) {
|
|
|
227
237
|
}
|
|
228
238
|
return result;
|
|
229
239
|
}
|
|
230
|
-
//# sourceMappingURL=history.js.map
|
|
240
|
+
//# sourceMappingURL=history.js.map
|
|
241
|
+
//# debugId=fabece59-ecce-590b-8a6f-f37c0490f98e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"/","sources":["cli/commands/history.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAA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,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACtH,IAAI,eAAmC,CAAC;QACxC,IAAI,oBAAyC,CAAC;QAC9C,MAAM,MAAM,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3E,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChD,oBAAoB,GAAG,eAAe,KAAK,eAAe,CAAC;YAC3D,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,MAAM,CAAC,YAAY,GAAG;YACpB,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO,EAAE,WAAW,CAAC,MAAM;YAC3B,MAAM;YACN,iBAAiB,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YACtG,iBAAiB,EAAE,eAAe;YAClC,sBAAsB,EAAE,oBAAoB;SAC7C,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { hashDocument, hashEmptyDocument } from \"../../core/history/history.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { normalizeItemId } from \"../../core/item/id.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { parseLimit } from \"../shared-parsers.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\n\nexport interface HistoryCommandOptions {\n limit?: string;\n diff?: boolean;\n verify?: boolean;\n}\n\nexport interface HistoryDiffEntry {\n index: number;\n ts: string;\n op: string;\n author: string;\n patch_ops: number;\n changed_fields: string[];\n}\n\nexport interface HistoryVerificationResult {\n ok: boolean;\n entries: number;\n errors: string[];\n latest_after_hash?: string;\n current_item_hash?: string;\n current_matches_latest?: boolean;\n}\n\nexport interface HistoryResult {\n id: string;\n history: HistoryEntry[];\n count: number;\n limit: number | null;\n diff?: HistoryDiffEntry[];\n verification?: HistoryVerificationResult;\n}\n\ninterface ReplayDocument {\n metadata: Record<string, unknown>;\n body: string;\n}\n\nconst EMPTY_REPLAY_DOCUMENT: ReplayDocument = {\n metadata: {},\n body: \"\",\n};\n\nfunction limitEntries<T>(values: T[], limit: number | undefined): T[] {\n if (limit === undefined) return values;\n return values.slice(Math.max(0, values.length - limit));\n}\n\nfunction decodeJsonPointerSegment(segment: string): string {\n return segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\");\n}\n\nfunction patchPathToChangedField(path: string): string {\n if (path === \"/body\" || path.startsWith(\"/body/\")) {\n return \"body\";\n }\n if (\n path === \"/metadata\" ||\n path.startsWith(\"/metadata/\") ||\n path === \"/front_matter\" ||\n path.startsWith(\"/front_matter/\")\n ) {\n const segment = path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n if (!segment) {\n return \"metadata\";\n }\n return decodeJsonPointerSegment(segment);\n }\n const segment = path.replace(/^\\//, \"\").split(\"/\")[0];\n return segment ? decodeJsonPointerSegment(segment) : \"root\";\n}\n\nfunction buildDiffEntries(entries: HistoryEntry[], startIndex: number): HistoryDiffEntry[] {\n return entries.map((entry, index) => {\n const changedFields = new Set<string>();\n for (const op of entry.patch) {\n changedFields.add(patchPathToChangedField(op.path));\n if (op.from) {\n changedFields.add(patchPathToChangedField(op.from));\n }\n }\n return {\n index: startIndex + index + 1,\n ts: entry.ts,\n op: entry.op,\n author: entry.author,\n patch_ops: entry.patch.length,\n changed_fields: [...changedFields].sort((left, right) => left.localeCompare(right)),\n };\n });\n}\n\nfunction replayHash(document: ReplayDocument): string {\n const itemDocument: ItemDocument = {\n metadata: document.metadata as unknown as ItemDocument[\"metadata\"],\n body: document.body,\n };\n return hashDocument(itemDocument);\n}\n\nfunction normalizeReplayPatchPath(path: string): string {\n if (path === \"/front_matter\") {\n return \"/metadata\";\n }\n if (path.startsWith(\"/front_matter/\")) {\n return `/metadata/${path.slice(\"/front_matter/\".length)}`;\n }\n return path;\n}\n\nfunction normalizeReplayPatchOps(patch: HistoryPatchOp[]): HistoryPatchOp[] {\n return patch.map((operation) => ({\n ...operation,\n path: normalizeReplayPatchPath(operation.path),\n from: operation.from ? normalizeReplayPatchPath(operation.from) : undefined,\n }));\n}\n\nfunction applyHistoryPatch(current: ReplayDocument, patch: HistoryPatchOp[], entryNumber: number): ReplayDocument {\n try {\n const normalizedPatch = normalizeReplayPatchOps(patch);\n const applied = jsonPatch.applyPatch(\n structuredClone(current),\n normalizedPatch as jsonPatch.Operation[],\n true,\n false,\n ).newDocument as unknown;\n if (\n typeof applied !== \"object\" ||\n applied === null ||\n !(\"metadata\" in applied) ||\n !(\"body\" in applied) ||\n typeof (applied as { body: unknown }).body !== \"string\" ||\n typeof (applied as { metadata: unknown }).metadata !== \"object\" ||\n (applied as { metadata: unknown }).metadata === null\n ) {\n throw new PmCliError(\n `History replay produced an invalid document shape at entry ${entryNumber}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const replay = applied as { metadata: Record<string, unknown>; body: string };\n return {\n metadata: replay.metadata,\n body: replay.body,\n };\n } catch {\n throw new PmCliError(`Failed to apply history patch at entry ${entryNumber}.`, EXIT_CODE.GENERIC_FAILURE);\n }\n}\n\nfunction verifyHistoryChain(entries: HistoryEntry[]): { ok: boolean; errors: string[] } {\n let replay: ReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n const beforeHash = replayHash(replay);\n if (beforeHash !== entry.before_hash) {\n return {\n ok: false,\n errors: [`verify_failed:before_hash_mismatch:entry_${index + 1}`],\n };\n }\n replay = applyHistoryPatch(replay, entry.patch, index + 1);\n const afterHash = replayHash(replay);\n if (afterHash !== entry.after_hash) {\n return {\n ok: false,\n errors: [`verify_failed:after_hash_mismatch:entry_${index + 1}`],\n };\n }\n }\n return {\n ok: true,\n errors: [],\n };\n}\n\nexport async function readHistoryEntries(historyPath: string, itemId: string): Promise<HistoryEntry[]> {\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n return [];\n }\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n if (raw.trim() === \"\") {\n return [];\n }\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History for ${itemId} contains merge conflict markers at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n {\n code: \"history_merge_conflict_markers_detected\",\n required: \"Repair the history stream by resolving merge-conflict markers.\",\n why: \"Conflict markers break JSONL parsing and invalidate deterministic audit history.\",\n examples: [`pm history ${itemId}`, `pm restore ${itemId} <timestamp-or-version>`],\n nextSteps: [\"Resolve or restore the history file, then rerun the command.\"],\n },\n );\n }\n\n const entries: HistoryEntry[] = [];\n const lines = raw.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index]?.trim();\n if (!line) continue;\n try {\n entries.push(JSON.parse(line) as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History for ${itemId} contains invalid JSON at line ${index + 1}. Repair or restore the history stream and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n\nexport async function runHistory(id: string, options: HistoryCommandOptions, global: GlobalOptions): Promise<HistoryResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const limit = parseLimit(options.limit);\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const located = await locateItem(\n pmRoot,\n normalizedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const resolvedId = located?.id ?? normalizedId;\n const historyPath = getHistoryPath(pmRoot, resolvedId);\n if (!located && !(await pathExists(historyPath))) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n if (located) {\n await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"history\",\n });\n }\n\n const fullHistory = await readHistoryEntries(historyPath, resolvedId);\n const history = limitEntries(fullHistory, limit);\n const result: HistoryResult = {\n id: resolvedId,\n history,\n count: history.length,\n limit: limit ?? null,\n };\n\n if (options.diff) {\n result.diff = buildDiffEntries(history, Math.max(0, fullHistory.length - history.length));\n }\n\n if (options.verify) {\n const verification = verifyHistoryChain(fullHistory);\n const latestAfterHash = fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : hashEmptyDocument();\n let currentItemHash: string | undefined;\n let currentMatchesLatest: boolean | undefined;\n const errors = [...verification.errors];\n\n if (located) {\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n currentItemHash = hashDocument(loaded.document);\n currentMatchesLatest = currentItemHash === latestAfterHash;\n if (!currentMatchesLatest) {\n errors.push(\"verify_failed:current_item_hash_mismatch\");\n }\n }\n\n result.verification = {\n ok: errors.length === 0,\n entries: fullHistory.length,\n errors,\n latest_after_hash: fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : undefined,\n current_item_hash: currentItemHash,\n current_matches_latest: currentMatchesLatest,\n };\n }\n\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"history.js","sources":["cli/commands/history.ts"],"sourceRoot":"/","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { hashDocument, hashEmptyDocument } from \"../../core/history/history.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { normalizeItemId } from \"../../core/item/id.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { parseLimit } from \"../shared-parsers.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\n\nexport interface HistoryCommandOptions {\n limit?: string;\n diff?: boolean;\n verify?: boolean;\n}\n\nexport interface HistoryDiffEntry {\n index: number;\n ts: string;\n op: string;\n author: string;\n patch_ops: number;\n changed_fields: string[];\n}\n\nexport interface HistoryVerificationResult {\n ok: boolean;\n entries: number;\n errors: string[];\n latest_after_hash?: string;\n current_item_hash?: string;\n current_matches_latest?: boolean;\n}\n\nexport interface HistoryResult {\n id: string;\n history: HistoryEntry[];\n count: number;\n limit: number | null;\n diff?: HistoryDiffEntry[];\n verification?: HistoryVerificationResult;\n}\n\ninterface ReplayDocument {\n metadata: Record<string, unknown>;\n body: string;\n}\n\nconst EMPTY_REPLAY_DOCUMENT: ReplayDocument = {\n metadata: {},\n body: \"\",\n};\n\nfunction limitEntries<T>(values: T[], limit: number | undefined): T[] {\n if (limit === undefined) return values;\n return values.slice(Math.max(0, values.length - limit));\n}\n\nfunction decodeJsonPointerSegment(segment: string): string {\n return segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\");\n}\n\nfunction patchPathToChangedField(path: string): string {\n if (path === \"/body\" || path.startsWith(\"/body/\")) {\n return \"body\";\n }\n if (\n path === \"/metadata\" ||\n path.startsWith(\"/metadata/\") ||\n path === \"/front_matter\" ||\n path.startsWith(\"/front_matter/\")\n ) {\n const segment = path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n if (!segment) {\n return \"metadata\";\n }\n return decodeJsonPointerSegment(segment);\n }\n const segment = path.replace(/^\\//, \"\").split(\"/\")[0];\n return segment ? decodeJsonPointerSegment(segment) : \"root\";\n}\n\nfunction buildDiffEntries(entries: HistoryEntry[], startIndex: number): HistoryDiffEntry[] {\n return entries.map((entry, index) => {\n const changedFields = new Set<string>();\n for (const op of entry.patch) {\n changedFields.add(patchPathToChangedField(op.path));\n if (op.from) {\n changedFields.add(patchPathToChangedField(op.from));\n }\n }\n return {\n index: startIndex + index + 1,\n ts: entry.ts,\n op: entry.op,\n author: entry.author,\n patch_ops: entry.patch.length,\n changed_fields: [...changedFields].sort((left, right) => left.localeCompare(right)),\n };\n });\n}\n\nfunction replayHash(document: ReplayDocument): string {\n const itemDocument: ItemDocument = {\n metadata: document.metadata as unknown as ItemDocument[\"metadata\"],\n body: document.body,\n };\n return hashDocument(itemDocument);\n}\n\nfunction normalizeReplayPatchPath(path: string): string {\n if (path === \"/front_matter\") {\n return \"/metadata\";\n }\n if (path.startsWith(\"/front_matter/\")) {\n return `/metadata/${path.slice(\"/front_matter/\".length)}`;\n }\n return path;\n}\n\nfunction normalizeReplayPatchOps(patch: HistoryPatchOp[]): HistoryPatchOp[] {\n return patch.map((operation) => ({\n ...operation,\n path: normalizeReplayPatchPath(operation.path),\n from: operation.from ? normalizeReplayPatchPath(operation.from) : undefined,\n }));\n}\n\nfunction applyHistoryPatch(current: ReplayDocument, patch: HistoryPatchOp[], entryNumber: number): ReplayDocument {\n try {\n const normalizedPatch = normalizeReplayPatchOps(patch);\n const applied = jsonPatch.applyPatch(\n structuredClone(current),\n normalizedPatch as jsonPatch.Operation[],\n true,\n false,\n ).newDocument as unknown;\n if (\n typeof applied !== \"object\" ||\n applied === null ||\n !(\"metadata\" in applied) ||\n !(\"body\" in applied) ||\n typeof (applied as { body: unknown }).body !== \"string\" ||\n typeof (applied as { metadata: unknown }).metadata !== \"object\" ||\n (applied as { metadata: unknown }).metadata === null\n ) {\n throw new PmCliError(\n `History replay produced an invalid document shape at entry ${entryNumber}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const replay = applied as { metadata: Record<string, unknown>; body: string };\n return {\n metadata: replay.metadata,\n body: replay.body,\n };\n } catch {\n throw new PmCliError(`Failed to apply history patch at entry ${entryNumber}.`, EXIT_CODE.GENERIC_FAILURE);\n }\n}\n\nexport function verifyHistoryChain(entries: HistoryEntry[]): { ok: boolean; errors: string[] } {\n let replay: ReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n const beforeHash = replayHash(replay);\n if (beforeHash !== entry.before_hash) {\n return {\n ok: false,\n errors: [`verify_failed:before_hash_mismatch:entry_${index + 1}`],\n };\n }\n try {\n replay = applyHistoryPatch(replay, entry.patch, index + 1);\n } catch {\n return {\n ok: false,\n errors: [`verify_failed:patch_apply_failed:entry_${index + 1}`],\n };\n }\n const afterHash = replayHash(replay);\n if (afterHash !== entry.after_hash) {\n return {\n ok: false,\n errors: [`verify_failed:after_hash_mismatch:entry_${index + 1}`],\n };\n }\n }\n return {\n ok: true,\n errors: [],\n };\n}\n\nexport async function readHistoryEntries(historyPath: string, itemId: string): Promise<HistoryEntry[]> {\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n return [];\n }\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n if (raw.trim() === \"\") {\n return [];\n }\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History for ${itemId} contains merge conflict markers at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n {\n code: \"history_merge_conflict_markers_detected\",\n required: \"Repair the history stream by resolving merge-conflict markers.\",\n why: \"Conflict markers break JSONL parsing and invalidate deterministic audit history.\",\n examples: [`pm history ${itemId}`, `pm restore ${itemId} <timestamp-or-version>`],\n nextSteps: [\"Resolve or restore the history file, then rerun the command.\"],\n },\n );\n }\n\n const entries: HistoryEntry[] = [];\n const lines = raw.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index]?.trim();\n if (!line) continue;\n try {\n entries.push(JSON.parse(line) as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History for ${itemId} contains invalid JSON at line ${index + 1}. Repair or restore the history stream and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n\nexport async function runHistory(id: string, options: HistoryCommandOptions, global: GlobalOptions): Promise<HistoryResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const limit = parseLimit(options.limit);\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const located = await locateItem(\n pmRoot,\n normalizedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const resolvedId = located?.id ?? normalizedId;\n const historyPath = getHistoryPath(pmRoot, resolvedId);\n if (!located && !(await pathExists(historyPath))) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n if (located) {\n await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"history\",\n });\n }\n\n const fullHistory = await readHistoryEntries(historyPath, resolvedId);\n const history = limitEntries(fullHistory, limit);\n const result: HistoryResult = {\n id: resolvedId,\n history,\n count: history.length,\n limit: limit ?? null,\n };\n\n if (options.diff) {\n result.diff = buildDiffEntries(history, Math.max(0, fullHistory.length - history.length));\n }\n\n if (options.verify) {\n const verification = verifyHistoryChain(fullHistory);\n const latestAfterHash = fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : hashEmptyDocument();\n let currentItemHash: string | undefined;\n let currentMatchesLatest: boolean | undefined;\n const errors = [...verification.errors];\n\n if (located) {\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n currentItemHash = hashDocument(loaded.document);\n currentMatchesLatest = currentItemHash === latestAfterHash;\n if (!currentMatchesLatest) {\n errors.push(\"verify_failed:current_item_hash_mismatch\");\n }\n }\n\n result.verification = {\n ok: errors.length === 0,\n entries: fullHistory.length,\n errors,\n latest_after_hash: fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : undefined,\n current_item_hash: currentItemHash,\n current_matches_latest: currentMatchesLatest,\n };\n }\n\n return result;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE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,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YACtG,iBAAiB,EAAE,eAAe;YAClC,sBAAsB,EAAE,oBAAoB;SAC7C,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","debugId":"fabece59-ecce-590b-8a6f-f37c0490f98e"}
|
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
export { runAppend } from "./append.js";
|
|
2
2
|
export { runAggregate, type AggregateOptions, type AggregateResult } from "./aggregate.js";
|
|
3
|
-
export { runCompletion, type CompletionResult, type CompletionShell } from "./completion.js";
|
|
4
3
|
export { runActivity } from "./activity.js";
|
|
5
4
|
export { runClaim, runRelease } from "./claim.js";
|
|
6
5
|
export { runClose, type CloseCommandOptions, type CloseResult } from "./close.js";
|
|
7
6
|
export { runComments } from "./comments.js";
|
|
8
|
-
export { runCommentsAudit, type CommentsAuditOptions, type CommentsAuditResult } from "./comments-audit.js";
|
|
9
7
|
export { runConfig, type ConfigCommandOptions, type ConfigResult } from "./config.js";
|
|
10
8
|
export { runContracts, type ContractsCommandOptions, type ContractsResult } from "./contracts.js";
|
|
11
|
-
export { CALENDAR_OUTPUT_VALUES, CALENDAR_VIEW_VALUES, renderCalendarMarkdown, resolveCalendarOutputFormat, runCalendar, type CalendarOptions, type CalendarOutputFormat, type CalendarResult, type CalendarView, } from "./calendar.js";
|
|
12
9
|
export { CONTEXT_OUTPUT_VALUES, renderContextMarkdown, resolveContextOutputFormat, runContext, type ContextOptions, type ContextOutputFormat, type ContextResult, } from "./context.js";
|
|
13
10
|
export { runCreate, type CreateCommandOptions } from "./create.js";
|
|
14
11
|
export { runDelete, type DeleteCommandOptions, type DeleteResult } from "./delete.js";
|
|
15
12
|
export { runDeps, DEPS_FORMAT_VALUES, type DepsCommandOptions, type DepsFormat, type DepsResult } from "./deps.js";
|
|
16
|
-
export { runDedupeAudit, DEDUPE_AUDIT_MODES, type DedupeAuditMode, type DedupeAuditOptions, type DedupeAuditResult } from "./dedupe-audit.js";
|
|
17
13
|
export { runDocs } from "./docs.js";
|
|
18
|
-
export { GUIDE_DEPTH_VALUES, GUIDE_OUTPUT_VALUES, renderGuideMarkdown, resolveGuideOutputFormat, runGuide, type GuideDepth, type GuideOptions, type GuideOutputFormat, type GuideResult, } from "./guide.js";
|
|
19
14
|
export { runExtension, type ExtensionCommandOptions, type ExtensionCommandResult } from "./extension.js";
|
|
20
15
|
export { runFiles, runFilesDiscover } from "./files.js";
|
|
21
16
|
export { runGc } from "./gc.js";
|
|
22
17
|
export { runGet } from "./get.js";
|
|
23
18
|
export { runHealth } from "./health.js";
|
|
24
19
|
export { runHistory } from "./history.js";
|
|
20
|
+
export { runHistoryRedact, type HistoryRedactCommandOptions, type HistoryRedactResult } from "./history-redact.js";
|
|
25
21
|
export { runInit } from "./init.js";
|
|
26
22
|
export { runLearnings } from "./learnings.js";
|
|
27
23
|
export { runList, type ListOptions } from "./list.js";
|
|
28
|
-
export { runNormalize, type NormalizeCommandOptions, type NormalizeResult } from "./normalize.js";
|
|
29
24
|
export { runNotes } from "./notes.js";
|
|
25
|
+
export { runPlan, PLAN_SUBCOMMANDS, PLAN_SHOW_DEPTH_VALUES, type PlanCommandOptions, type PlanCommandResult, type PlanDispatchInput, type PlanResultPlan, type PlanStepSummary, type PlanShowDepth, type PlanSubcommand, } from "./plan.js";
|
|
30
26
|
export { runSearch } from "./search.js";
|
|
31
|
-
export { runReindex, type ReindexOptions, type ReindexResult } from "./reindex.js";
|
|
32
27
|
export { runRestore } from "./restore.js";
|
|
33
28
|
export { runStats } from "./stats.js";
|
|
34
29
|
export { runTest } from "./test.js";
|
|
35
30
|
export { runTestAll } from "./test-all.js";
|
|
36
31
|
export { runStartBackgroundRun, runTestRunsList, runTestRunsLogs, runTestRunsResume, runTestRunsStatus, runTestRunsStop, runTestRunsWorker, } from "./test-runs.js";
|
|
37
|
-
export { loadCreateTemplateOptions, runTemplatesList, runTemplatesSave, runTemplatesShow, type TemplatesListResult, type TemplatesSaveResult, type TemplatesShowResult, } from "./templates.js";
|
|
38
32
|
export { runUpdate } from "./update.js";
|
|
39
33
|
export { runUpdateMany, type UpdateManyCommandOptions, type UpdateManyResult } from "./update-many.js";
|
|
40
34
|
export { runUpgrade, type UpgradeCommandOptions, type UpgradeResult } from "./upgrade.js";
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a832a3d9-5b89-5660-96ae-68037ae50948")}catch(e){}}();
|
|
1
3
|
export { runAppend } from "./append.js";
|
|
2
4
|
export { runAggregate } from "./aggregate.js";
|
|
3
|
-
export { runCompletion } from "./completion.js";
|
|
4
5
|
export { runActivity } from "./activity.js";
|
|
5
6
|
export { runClaim, runRelease } from "./claim.js";
|
|
6
7
|
export { runClose } from "./close.js";
|
|
7
8
|
export { runComments } from "./comments.js";
|
|
8
|
-
export { runCommentsAudit } from "./comments-audit.js";
|
|
9
9
|
export { runConfig } from "./config.js";
|
|
10
10
|
export { runContracts } from "./contracts.js";
|
|
11
|
-
export { CALENDAR_OUTPUT_VALUES, CALENDAR_VIEW_VALUES, renderCalendarMarkdown, resolveCalendarOutputFormat, runCalendar, } from "./calendar.js";
|
|
12
11
|
export { CONTEXT_OUTPUT_VALUES, renderContextMarkdown, resolveContextOutputFormat, runContext, } from "./context.js";
|
|
13
12
|
export { runCreate } from "./create.js";
|
|
14
13
|
export { runDelete } from "./delete.js";
|
|
15
14
|
export { runDeps, DEPS_FORMAT_VALUES } from "./deps.js";
|
|
16
|
-
export { runDedupeAudit, DEDUPE_AUDIT_MODES } from "./dedupe-audit.js";
|
|
17
15
|
export { runDocs } from "./docs.js";
|
|
18
|
-
export { GUIDE_DEPTH_VALUES, GUIDE_OUTPUT_VALUES, renderGuideMarkdown, resolveGuideOutputFormat, runGuide, } from "./guide.js";
|
|
19
16
|
export { runExtension } from "./extension.js";
|
|
20
17
|
export { runFiles, runFilesDiscover } from "./files.js";
|
|
21
18
|
export { runGc } from "./gc.js";
|
|
22
19
|
export { runGet } from "./get.js";
|
|
23
20
|
export { runHealth } from "./health.js";
|
|
24
21
|
export { runHistory } from "./history.js";
|
|
22
|
+
export { runHistoryRedact } from "./history-redact.js";
|
|
25
23
|
export { runInit } from "./init.js";
|
|
26
24
|
export { runLearnings } from "./learnings.js";
|
|
27
25
|
export { runList } from "./list.js";
|
|
28
|
-
export { runNormalize } from "./normalize.js";
|
|
29
26
|
export { runNotes } from "./notes.js";
|
|
27
|
+
export { runPlan, PLAN_SUBCOMMANDS, PLAN_SHOW_DEPTH_VALUES, } from "./plan.js";
|
|
30
28
|
export { runSearch } from "./search.js";
|
|
31
|
-
export { runReindex } from "./reindex.js";
|
|
32
29
|
export { runRestore } from "./restore.js";
|
|
33
30
|
export { runStats } from "./stats.js";
|
|
34
31
|
export { runTest } from "./test.js";
|
|
35
32
|
export { runTestAll } from "./test-all.js";
|
|
36
33
|
export { runStartBackgroundRun, runTestRunsList, runTestRunsLogs, runTestRunsResume, runTestRunsStatus, runTestRunsStop, runTestRunsWorker, } from "./test-runs.js";
|
|
37
|
-
export { loadCreateTemplateOptions, runTemplatesList, runTemplatesSave, runTemplatesShow, } from "./templates.js";
|
|
38
34
|
export { runUpdate } from "./update.js";
|
|
39
35
|
export { runUpdateMany } from "./update-many.js";
|
|
40
36
|
export { runUpgrade } from "./upgrade.js";
|
|
41
37
|
export { runValidate } from "./validate.js";
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
39
|
+
//# debugId=a832a3d9-5b89-5660-96ae-68037ae50948
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["cli/commands/index.ts"],"sourceRoot":"/","sourcesContent":["export { runAppend } from \"./append.js\";\nexport { runAggregate, type AggregateOptions, type AggregateResult } from \"./aggregate.js\";\nexport { runActivity } from \"./activity.js\";\nexport { runClaim, runRelease } from \"./claim.js\";\nexport { runClose, type CloseCommandOptions, type CloseResult } from \"./close.js\";\nexport { runComments } from \"./comments.js\";\nexport { runConfig, type ConfigCommandOptions, type ConfigResult } from \"./config.js\";\nexport { runContracts, type ContractsCommandOptions, type ContractsResult } from \"./contracts.js\";\nexport {\n CONTEXT_OUTPUT_VALUES,\n renderContextMarkdown,\n resolveContextOutputFormat,\n runContext,\n type ContextOptions,\n type ContextOutputFormat,\n type ContextResult,\n} from \"./context.js\";\nexport { runCreate, type CreateCommandOptions } from \"./create.js\";\nexport { runDelete, type DeleteCommandOptions, type DeleteResult } from \"./delete.js\";\nexport { runDeps, DEPS_FORMAT_VALUES, type DepsCommandOptions, type DepsFormat, type DepsResult } from \"./deps.js\";\nexport { runDocs } from \"./docs.js\";\nexport { runExtension, type ExtensionCommandOptions, type ExtensionCommandResult } from \"./extension.js\";\nexport { runFiles, runFilesDiscover } from \"./files.js\";\nexport { runGc } from \"./gc.js\";\nexport { runGet } from \"./get.js\";\nexport { runHealth } from \"./health.js\";\nexport { runHistory } from \"./history.js\";\nexport { runHistoryRedact, type HistoryRedactCommandOptions, type HistoryRedactResult } from \"./history-redact.js\";\nexport { runInit } from \"./init.js\";\nexport { runLearnings } from \"./learnings.js\";\nexport { runList, type ListOptions } from \"./list.js\";\nexport { runNotes } from \"./notes.js\";\nexport {\n runPlan,\n PLAN_SUBCOMMANDS,\n PLAN_SHOW_DEPTH_VALUES,\n type PlanCommandOptions,\n type PlanCommandResult,\n type PlanDispatchInput,\n type PlanResultPlan,\n type PlanStepSummary,\n type PlanShowDepth,\n type PlanSubcommand,\n} from \"./plan.js\";\nexport { runSearch } from \"./search.js\";\nexport { runRestore } from \"./restore.js\";\nexport { runStats } from \"./stats.js\";\nexport { runTest } from \"./test.js\";\nexport { runTestAll } from \"./test-all.js\";\nexport {\n runStartBackgroundRun,\n runTestRunsList,\n runTestRunsLogs,\n runTestRunsResume,\n runTestRunsStatus,\n runTestRunsStop,\n runTestRunsWorker,\n} from \"./test-runs.js\";\nexport { runUpdate } from \"./update.js\";\nexport { runUpdateMany, type UpdateManyCommandOptions, type UpdateManyResult } from \"./update-many.js\";\nexport { runUpgrade, type UpgradeCommandOptions, type UpgradeResult } from \"./upgrade.js\";\nexport { runValidate, type ValidateCheck, type ValidateCommandOptions, type ValidateResult } from \"./validate.js\";\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAA+C,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAA8C,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAgD,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,YAAY,EAAsD,MAAM,gBAAgB,CAAC;AAClG,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,UAAU,GAIX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAA6B,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAgD,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAA6D,MAAM,WAAW,CAAC;AACnH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAA6D,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAA8D,MAAM,qBAAqB,CAAC;AACnH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAoB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,sBAAsB,GAQvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAwD,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAkD,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAwE,MAAM,eAAe,CAAC","debugId":"a832a3d9-5b89-5660-96ae-68037ae50948"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PmSettings } from "../../types/index.js";
|
|
2
|
+
export type InitAgentGuidanceMode = "ask" | "add" | "skip" | "status";
|
|
3
|
+
export declare const INIT_AGENT_GUIDANCE_MODE_VALUES: InitAgentGuidanceMode[];
|
|
4
|
+
export interface InitAgentGuidanceSummary {
|
|
5
|
+
mode: InitAgentGuidanceMode;
|
|
6
|
+
present: boolean;
|
|
7
|
+
prompted: boolean;
|
|
8
|
+
applied: boolean;
|
|
9
|
+
skipped: boolean;
|
|
10
|
+
declined: boolean;
|
|
11
|
+
prompt_completed: boolean;
|
|
12
|
+
template_version: number;
|
|
13
|
+
target_file: string;
|
|
14
|
+
checked_files: string[];
|
|
15
|
+
files_with_guidance: string[];
|
|
16
|
+
missing_files: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface RunInitAgentGuidanceOptions {
|
|
19
|
+
pm_root: string;
|
|
20
|
+
cwd: string;
|
|
21
|
+
mode: InitAgentGuidanceMode;
|
|
22
|
+
interactive: boolean;
|
|
23
|
+
settings: PmSettings;
|
|
24
|
+
}
|
|
25
|
+
export interface RunInitAgentGuidanceResult {
|
|
26
|
+
summary: InitAgentGuidanceSummary;
|
|
27
|
+
warnings: string[];
|
|
28
|
+
next_steps: string[];
|
|
29
|
+
settings_changed: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function runInitAgentGuidance(options: RunInitAgentGuidanceOptions): Promise<RunInitAgentGuidanceResult>;
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5a5676f5-f102-5fdd-9b33-04645e8971c2")}catch(e){}}();
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import readline from "node:readline/promises";
|
|
6
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
7
|
+
import { runActiveOnWriteHooks } from "../../core/extensions/index.js";
|
|
8
|
+
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
9
|
+
export const INIT_AGENT_GUIDANCE_MODE_VALUES = ["ask", "add", "skip", "status"];
|
|
10
|
+
const AGENT_GUIDANCE_TARGET_FILENAMES = ["AGENTS.md", "CLAUDE.md"];
|
|
11
|
+
const AGENT_GUIDANCE_REQUIRED_TOKENS = [
|
|
12
|
+
"pm init",
|
|
13
|
+
"pm context",
|
|
14
|
+
"pm search",
|
|
15
|
+
"pm create",
|
|
16
|
+
"pm claim",
|
|
17
|
+
"pm files",
|
|
18
|
+
"pm docs",
|
|
19
|
+
"pm test --run",
|
|
20
|
+
"pm close",
|
|
21
|
+
"pm release",
|
|
22
|
+
"pm_author",
|
|
23
|
+
];
|
|
24
|
+
const AGENT_GUIDANCE_REQUIRED_TOKEN_THRESHOLD = 8;
|
|
25
|
+
const AGENT_GUIDANCE_TEMPLATE_VERSION = 1;
|
|
26
|
+
const AGENT_GUIDANCE_START_MARKER_PREFIX = "<!-- pm-cli:agent-guidance:start:";
|
|
27
|
+
const AGENT_GUIDANCE_START_MARKER = `<!-- pm-cli:agent-guidance:start:v${AGENT_GUIDANCE_TEMPLATE_VERSION} -->`;
|
|
28
|
+
const AGENT_GUIDANCE_END_MARKER = "<!-- pm-cli:agent-guidance:end -->";
|
|
29
|
+
function toPortableRelativePath(projectRoot, targetPath) {
|
|
30
|
+
const relative = path.relative(projectRoot, targetPath);
|
|
31
|
+
if (relative.length === 0) {
|
|
32
|
+
return path.basename(targetPath);
|
|
33
|
+
}
|
|
34
|
+
return relative.split(path.sep).join("/");
|
|
35
|
+
}
|
|
36
|
+
function ensureTrailingNewline(value) {
|
|
37
|
+
return value.endsWith("\n") ? value : `${value}\n`;
|
|
38
|
+
}
|
|
39
|
+
function detectLineEnding(value) {
|
|
40
|
+
return value.includes("\r\n") ? "\r\n" : "\n";
|
|
41
|
+
}
|
|
42
|
+
function findGuidanceBlockRange(content) {
|
|
43
|
+
const startIndex = content.indexOf(AGENT_GUIDANCE_START_MARKER_PREFIX);
|
|
44
|
+
if (startIndex === -1) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const endMarkerIndex = content.indexOf(AGENT_GUIDANCE_END_MARKER, startIndex);
|
|
48
|
+
if (endMarkerIndex === -1) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
start_index: startIndex,
|
|
53
|
+
end_index: endMarkerIndex + AGENT_GUIDANCE_END_MARKER.length,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function hasGuidanceMarker(content) {
|
|
57
|
+
return findGuidanceBlockRange(content) !== null;
|
|
58
|
+
}
|
|
59
|
+
function buildAgentGuidanceBlock(lineEnding) {
|
|
60
|
+
const lines = [
|
|
61
|
+
AGENT_GUIDANCE_START_MARKER,
|
|
62
|
+
"## pm Workflow (Agent Quickstart)",
|
|
63
|
+
"",
|
|
64
|
+
"- Orient before mutate: `pm context --limit 10`, `pm search \"<keywords>\" --limit 10`, `pm list-open --limit 20`.",
|
|
65
|
+
"- Claim and execute: `pm claim <id>` then `pm update <id> --status in_progress`.",
|
|
66
|
+
"- Link evidence while coding: `pm files <id> --add ...`, `pm docs <id> --add ...`, `pm test <id> --add command=\"node scripts/run-tests.mjs test -- ...\"`.",
|
|
67
|
+
"- Verify and close: `pm test <id> --run --progress`, `pm close <id> \"<evidence>\" --validate-close warn`, `pm release <id>`.",
|
|
68
|
+
"- Set `PM_AUTHOR=<stable-agent-id>` before mutation commands.",
|
|
69
|
+
"",
|
|
70
|
+
AGENT_GUIDANCE_END_MARKER,
|
|
71
|
+
"",
|
|
72
|
+
];
|
|
73
|
+
return lines.join(lineEnding);
|
|
74
|
+
}
|
|
75
|
+
function upsertAgentGuidanceBlock(existingContent) {
|
|
76
|
+
const lineEnding = detectLineEnding(existingContent);
|
|
77
|
+
const nextBlock = buildAgentGuidanceBlock(lineEnding);
|
|
78
|
+
const existingRange = findGuidanceBlockRange(existingContent);
|
|
79
|
+
if (existingRange) {
|
|
80
|
+
const nextContent = ensureTrailingNewline(`${existingContent.slice(0, existingRange.start_index)}${nextBlock}${existingContent.slice(existingRange.end_index)}`);
|
|
81
|
+
return {
|
|
82
|
+
next_content: nextContent,
|
|
83
|
+
changed: nextContent !== existingContent,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const separator = existingContent.length === 0 ? "" : existingContent.endsWith("\n") ? "\n" : "\n\n";
|
|
87
|
+
const nextContent = ensureTrailingNewline(`${existingContent}${separator}${nextBlock}`);
|
|
88
|
+
return {
|
|
89
|
+
next_content: nextContent,
|
|
90
|
+
changed: nextContent !== existingContent,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function resolveProjectRoot(pmRoot, cwd) {
|
|
94
|
+
const parent = path.dirname(pmRoot);
|
|
95
|
+
if (path.basename(pmRoot) === "pm" && path.basename(parent) === ".agents") {
|
|
96
|
+
return path.dirname(parent);
|
|
97
|
+
}
|
|
98
|
+
return path.resolve(cwd, pmRoot);
|
|
99
|
+
}
|
|
100
|
+
function resolveTargetGuidancePath(scans, projectRoot) {
|
|
101
|
+
const existingAgents = scans.find((entry) => path.basename(entry.file_path) === "AGENTS.md" && entry.exists);
|
|
102
|
+
if (existingAgents) {
|
|
103
|
+
return existingAgents.file_path;
|
|
104
|
+
}
|
|
105
|
+
const existingAny = scans.find((entry) => entry.exists);
|
|
106
|
+
if (existingAny) {
|
|
107
|
+
return existingAny.file_path;
|
|
108
|
+
}
|
|
109
|
+
return path.join(projectRoot, "AGENTS.md");
|
|
110
|
+
}
|
|
111
|
+
function parsePromptChoice(answer, currentDefault) {
|
|
112
|
+
const normalized = answer.trim().toLowerCase();
|
|
113
|
+
if (normalized.length === 0) {
|
|
114
|
+
return currentDefault;
|
|
115
|
+
}
|
|
116
|
+
if (normalized === "y" || normalized === "yes") {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (normalized === "n" || normalized === "no") {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return currentDefault;
|
|
123
|
+
}
|
|
124
|
+
async function promptForGuidanceWrite(targetRelativePath) {
|
|
125
|
+
const rl = readline.createInterface({ input, output });
|
|
126
|
+
try {
|
|
127
|
+
output.write("\nAgent guidance check\n");
|
|
128
|
+
output.write("No AGENTS.md/CLAUDE.md file currently contains compact pm workflow guidance.\n");
|
|
129
|
+
const answer = await rl.question(`Add a compact pm workflow section to ${targetRelativePath}? [Y/n] `);
|
|
130
|
+
output.write("\n");
|
|
131
|
+
return parsePromptChoice(answer, true);
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
rl.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function normalizeAgentGuidanceState(settings) {
|
|
138
|
+
const current = settings.agent_guidance;
|
|
139
|
+
return {
|
|
140
|
+
prompt_completed: current?.prompt_completed === true,
|
|
141
|
+
declined: current?.declined === true,
|
|
142
|
+
declined_at: typeof current?.declined_at === "string" ? current.declined_at : "",
|
|
143
|
+
template_version: typeof current?.template_version === "number" && Number.isInteger(current.template_version) && current.template_version > 0
|
|
144
|
+
? current.template_version
|
|
145
|
+
: AGENT_GUIDANCE_TEMPLATE_VERSION,
|
|
146
|
+
last_checked_files: Array.isArray(current?.last_checked_files)
|
|
147
|
+
? [...new Set(current.last_checked_files.map((value) => value.trim()).filter((value) => value.length > 0))].sort((left, right) => left.localeCompare(right))
|
|
148
|
+
: [],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async function scanGuidanceFiles(projectRoot) {
|
|
152
|
+
const scans = [];
|
|
153
|
+
for (const filename of AGENT_GUIDANCE_TARGET_FILENAMES) {
|
|
154
|
+
const filePath = path.join(projectRoot, filename);
|
|
155
|
+
const exists = await pathExists(filePath);
|
|
156
|
+
if (!exists) {
|
|
157
|
+
scans.push({
|
|
158
|
+
file_path: filePath,
|
|
159
|
+
exists,
|
|
160
|
+
has_guidance: false,
|
|
161
|
+
has_marker: false,
|
|
162
|
+
});
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
166
|
+
const contentLower = content.toLowerCase();
|
|
167
|
+
const tokenHits = AGENT_GUIDANCE_REQUIRED_TOKENS.filter((token) => contentLower.includes(token));
|
|
168
|
+
const hasMarker = hasGuidanceMarker(content);
|
|
169
|
+
scans.push({
|
|
170
|
+
file_path: filePath,
|
|
171
|
+
exists,
|
|
172
|
+
has_guidance: hasMarker || tokenHits.length >= AGENT_GUIDANCE_REQUIRED_TOKEN_THRESHOLD,
|
|
173
|
+
has_marker: hasMarker,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return scans;
|
|
177
|
+
}
|
|
178
|
+
function pushUnique(target, value) {
|
|
179
|
+
if (!target.includes(value)) {
|
|
180
|
+
target.push(value);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function applyAgentGuidanceState(settings, currentState) {
|
|
184
|
+
const existing = normalizeAgentGuidanceState(settings);
|
|
185
|
+
const changed = JSON.stringify(existing) !== JSON.stringify(currentState);
|
|
186
|
+
if (changed) {
|
|
187
|
+
settings.agent_guidance = currentState;
|
|
188
|
+
}
|
|
189
|
+
return { changed, state: currentState };
|
|
190
|
+
}
|
|
191
|
+
async function writeGuidanceFile(filePath) {
|
|
192
|
+
const exists = await pathExists(filePath);
|
|
193
|
+
const currentContent = exists ? await fs.readFile(filePath, "utf8") : "";
|
|
194
|
+
const nextContent = upsertAgentGuidanceBlock(currentContent);
|
|
195
|
+
if (!nextContent.changed) {
|
|
196
|
+
return { changed: false, warnings: [] };
|
|
197
|
+
}
|
|
198
|
+
await fs.writeFile(filePath, nextContent.next_content, "utf8");
|
|
199
|
+
return {
|
|
200
|
+
changed: true,
|
|
201
|
+
warnings: await runActiveOnWriteHooks({
|
|
202
|
+
path: filePath,
|
|
203
|
+
scope: "project",
|
|
204
|
+
op: "init:agent_guidance_file",
|
|
205
|
+
}),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
export async function runInitAgentGuidance(options) {
|
|
209
|
+
const warnings = [];
|
|
210
|
+
const nextSteps = [];
|
|
211
|
+
const projectRoot = resolveProjectRoot(options.pm_root, options.cwd);
|
|
212
|
+
let scans = await scanGuidanceFiles(projectRoot);
|
|
213
|
+
const targetPath = resolveTargetGuidancePath(scans, projectRoot);
|
|
214
|
+
const targetRelativePath = toPortableRelativePath(projectRoot, targetPath);
|
|
215
|
+
const addLaterHint = "Add workflow guidance later: pm init --agent-guidance add";
|
|
216
|
+
let prompted = false;
|
|
217
|
+
let applied = false;
|
|
218
|
+
let skipped = false;
|
|
219
|
+
let state = normalizeAgentGuidanceState(options.settings);
|
|
220
|
+
const checkedFiles = scans.map((entry) => toPortableRelativePath(projectRoot, entry.file_path));
|
|
221
|
+
const presentBefore = scans.some((entry) => entry.has_guidance);
|
|
222
|
+
const markState = (partial) => {
|
|
223
|
+
state = {
|
|
224
|
+
...state,
|
|
225
|
+
...partial,
|
|
226
|
+
template_version: AGENT_GUIDANCE_TEMPLATE_VERSION,
|
|
227
|
+
last_checked_files: checkedFiles,
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
if (options.mode === "status") {
|
|
231
|
+
if (!presentBefore) {
|
|
232
|
+
warnings.push("agent_guidance:missing");
|
|
233
|
+
pushUnique(nextSteps, addLaterHint);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else if (options.mode === "skip") {
|
|
237
|
+
skipped = true;
|
|
238
|
+
markState({
|
|
239
|
+
prompt_completed: true,
|
|
240
|
+
declined: true,
|
|
241
|
+
declined_at: state.declined_at.length > 0 ? state.declined_at : new Date().toISOString(),
|
|
242
|
+
});
|
|
243
|
+
warnings.push("agent_guidance:explicit_skip");
|
|
244
|
+
pushUnique(nextSteps, addLaterHint);
|
|
245
|
+
}
|
|
246
|
+
else if (options.mode === "add") {
|
|
247
|
+
if (!presentBefore) {
|
|
248
|
+
const writeResult = await writeGuidanceFile(targetPath);
|
|
249
|
+
warnings.push(...writeResult.warnings);
|
|
250
|
+
if (writeResult.changed) {
|
|
251
|
+
applied = true;
|
|
252
|
+
warnings.push(`agent_guidance:added:${targetRelativePath}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
markState({
|
|
256
|
+
prompt_completed: true,
|
|
257
|
+
declined: false,
|
|
258
|
+
declined_at: "",
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
else if (presentBefore) {
|
|
262
|
+
if (state.declined) {
|
|
263
|
+
markState({
|
|
264
|
+
prompt_completed: true,
|
|
265
|
+
declined: false,
|
|
266
|
+
declined_at: "",
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (state.prompt_completed && state.declined) {
|
|
271
|
+
skipped = true;
|
|
272
|
+
warnings.push("agent_guidance:skipped_declined");
|
|
273
|
+
pushUnique(nextSteps, addLaterHint);
|
|
274
|
+
}
|
|
275
|
+
else if (options.interactive) {
|
|
276
|
+
prompted = true;
|
|
277
|
+
const approved = await promptForGuidanceWrite(targetRelativePath);
|
|
278
|
+
if (approved) {
|
|
279
|
+
const writeResult = await writeGuidanceFile(targetPath);
|
|
280
|
+
warnings.push(...writeResult.warnings);
|
|
281
|
+
if (writeResult.changed) {
|
|
282
|
+
applied = true;
|
|
283
|
+
warnings.push(`agent_guidance:added:${targetRelativePath}`);
|
|
284
|
+
}
|
|
285
|
+
markState({
|
|
286
|
+
prompt_completed: true,
|
|
287
|
+
declined: false,
|
|
288
|
+
declined_at: "",
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
skipped = true;
|
|
293
|
+
markState({
|
|
294
|
+
prompt_completed: true,
|
|
295
|
+
declined: true,
|
|
296
|
+
declined_at: new Date().toISOString(),
|
|
297
|
+
});
|
|
298
|
+
warnings.push("agent_guidance:declined");
|
|
299
|
+
pushUnique(nextSteps, addLaterHint);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
warnings.push("agent_guidance:missing_non_interactive");
|
|
304
|
+
pushUnique(nextSteps, addLaterHint);
|
|
305
|
+
}
|
|
306
|
+
const stateUpdate = applyAgentGuidanceState(options.settings, state);
|
|
307
|
+
if (applied) {
|
|
308
|
+
scans = await scanGuidanceFiles(projectRoot);
|
|
309
|
+
}
|
|
310
|
+
const summary = {
|
|
311
|
+
mode: options.mode,
|
|
312
|
+
present: scans.some((entry) => entry.has_guidance),
|
|
313
|
+
prompted,
|
|
314
|
+
applied,
|
|
315
|
+
skipped,
|
|
316
|
+
declined: state.declined,
|
|
317
|
+
prompt_completed: state.prompt_completed,
|
|
318
|
+
template_version: state.template_version,
|
|
319
|
+
target_file: targetRelativePath,
|
|
320
|
+
checked_files: scans.map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),
|
|
321
|
+
files_with_guidance: scans
|
|
322
|
+
.filter((entry) => entry.has_guidance)
|
|
323
|
+
.map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),
|
|
324
|
+
missing_files: scans
|
|
325
|
+
.filter((entry) => !entry.exists)
|
|
326
|
+
.map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),
|
|
327
|
+
};
|
|
328
|
+
return {
|
|
329
|
+
summary,
|
|
330
|
+
warnings,
|
|
331
|
+
next_steps: nextSteps,
|
|
332
|
+
settings_changed: stateUpdate.changed,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=init-agent-guidance.js.map
|
|
336
|
+
//# debugId=5a5676f5-f102-5fdd-9b33-04645e8971c2
|