@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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import type { GlobalOptions } from "../../../../src/sdk/runtime.js";
|
|
4
|
+
|
|
5
|
+
const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
|
|
6
|
+
|
|
7
|
+
interface GovernanceRuntimeSdkModule {
|
|
8
|
+
runDedupeAudit: (options: Record<string, unknown>, global: GlobalOptions) => Promise<unknown>;
|
|
9
|
+
runCommentsAudit: (options: Record<string, unknown>, global: GlobalOptions) => Promise<unknown>;
|
|
10
|
+
runNormalize: (options: Record<string, unknown>, global: GlobalOptions) => Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let governanceModule: GovernanceRuntimeSdkModule | null = null;
|
|
14
|
+
let governanceModulePromise: Promise<GovernanceRuntimeSdkModule> | null = null;
|
|
15
|
+
|
|
16
|
+
async function ensureGovernanceModule(): Promise<GovernanceRuntimeSdkModule> {
|
|
17
|
+
if (governanceModule) {
|
|
18
|
+
return governanceModule;
|
|
19
|
+
}
|
|
20
|
+
if (!governanceModulePromise) {
|
|
21
|
+
governanceModulePromise = loadGovernanceModule();
|
|
22
|
+
}
|
|
23
|
+
governanceModule = await governanceModulePromise;
|
|
24
|
+
return governanceModule;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function loadGovernanceModule(): Promise<GovernanceRuntimeSdkModule> {
|
|
28
|
+
const envRoot = process.env[PM_PACKAGE_ROOT_ENV];
|
|
29
|
+
if (typeof envRoot !== "string" || envRoot.trim().length === 0) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`builtin-governance-audit requires ${PM_PACKAGE_ROOT_ENV} to locate core SDK runtime exports.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
const modulePath = path.join(path.resolve(envRoot.trim()), "dist", "sdk", "runtime.js");
|
|
35
|
+
try {
|
|
36
|
+
const loaded = (await import(pathToFileURL(modulePath).href)) as Partial<GovernanceRuntimeSdkModule>;
|
|
37
|
+
if (
|
|
38
|
+
typeof loaded.runDedupeAudit === "function" &&
|
|
39
|
+
typeof loaded.runCommentsAudit === "function" &&
|
|
40
|
+
typeof loaded.runNormalize === "function"
|
|
41
|
+
) {
|
|
42
|
+
return loaded as GovernanceRuntimeSdkModule;
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
// Fall through to deterministic failure message below.
|
|
46
|
+
}
|
|
47
|
+
throw new Error(
|
|
48
|
+
`builtin-governance-audit failed to load governance SDK runtime exports from ${modulePath}.`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function readStringOption(options: Record<string, unknown>, key: string, aliases: string[] = []): string | undefined {
|
|
53
|
+
const keys = [key, ...aliases];
|
|
54
|
+
for (const candidate of keys) {
|
|
55
|
+
const value = options[candidate];
|
|
56
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readBooleanOption(options: Record<string, unknown>, key: string, aliases: string[] = []): boolean | undefined {
|
|
64
|
+
const keys = [key, ...aliases];
|
|
65
|
+
for (const candidate of keys) {
|
|
66
|
+
const value = options[candidate];
|
|
67
|
+
if (value === undefined) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (typeof value === "boolean") {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
if (typeof value === "string") {
|
|
74
|
+
const normalized = value.trim().toLowerCase();
|
|
75
|
+
if (normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on") {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (normalized === "false" || normalized === "0" || normalized === "no" || normalized === "off") {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function normalizeDedupeAuditOptions(raw: Record<string, unknown>): Record<string, unknown> {
|
|
87
|
+
return {
|
|
88
|
+
mode: readStringOption(raw, "mode"),
|
|
89
|
+
status: readStringOption(raw, "status"),
|
|
90
|
+
type: readStringOption(raw, "type"),
|
|
91
|
+
tag: readStringOption(raw, "tag"),
|
|
92
|
+
priority: readStringOption(raw, "priority"),
|
|
93
|
+
deadlineBefore: readStringOption(raw, "deadlineBefore", ["deadline_before"]),
|
|
94
|
+
deadlineAfter: readStringOption(raw, "deadlineAfter", ["deadline_after"]),
|
|
95
|
+
assignee: readStringOption(raw, "assignee"),
|
|
96
|
+
assigneeFilter: readStringOption(raw, "assigneeFilter", ["assignee_filter"]),
|
|
97
|
+
parent: readStringOption(raw, "parent"),
|
|
98
|
+
sprint: readStringOption(raw, "sprint"),
|
|
99
|
+
release: readStringOption(raw, "release"),
|
|
100
|
+
limit: readStringOption(raw, "limit"),
|
|
101
|
+
threshold: readStringOption(raw, "threshold"),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function normalizeCommentsAuditOptions(raw: Record<string, unknown>): Record<string, unknown> {
|
|
106
|
+
return {
|
|
107
|
+
status: readStringOption(raw, "status"),
|
|
108
|
+
type: readStringOption(raw, "type"),
|
|
109
|
+
tag: readStringOption(raw, "tag"),
|
|
110
|
+
priority: readStringOption(raw, "priority"),
|
|
111
|
+
parent: readStringOption(raw, "parent"),
|
|
112
|
+
sprint: readStringOption(raw, "sprint"),
|
|
113
|
+
release: readStringOption(raw, "release"),
|
|
114
|
+
assignee: readStringOption(raw, "assignee"),
|
|
115
|
+
assigneeFilter: readStringOption(raw, "assigneeFilter", ["assignee_filter"]),
|
|
116
|
+
limit: readStringOption(raw, "limit"),
|
|
117
|
+
limitItems: readStringOption(raw, "limitItems", ["limit_items"]),
|
|
118
|
+
latest: readStringOption(raw, "latest"),
|
|
119
|
+
fullHistory: readBooleanOption(raw, "fullHistory", ["full_history"]) === true ? true : undefined,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function normalizeNormalizeOptions(raw: Record<string, unknown>): Record<string, unknown> {
|
|
124
|
+
return {
|
|
125
|
+
status: readStringOption(raw, "filterStatus", ["filter_status", "status"]),
|
|
126
|
+
list: {
|
|
127
|
+
type: readStringOption(raw, "type"),
|
|
128
|
+
tag: readStringOption(raw, "tag"),
|
|
129
|
+
priority: readStringOption(raw, "priority"),
|
|
130
|
+
deadlineBefore: readStringOption(raw, "deadlineBefore", ["deadline_before"]),
|
|
131
|
+
deadlineAfter: readStringOption(raw, "deadlineAfter", ["deadline_after"]),
|
|
132
|
+
assignee: readStringOption(raw, "assignee"),
|
|
133
|
+
assigneeFilter: readStringOption(raw, "assigneeFilter", ["assignee_filter"]),
|
|
134
|
+
parent: readStringOption(raw, "parent"),
|
|
135
|
+
sprint: readStringOption(raw, "sprint"),
|
|
136
|
+
release: readStringOption(raw, "release"),
|
|
137
|
+
limit: readStringOption(raw, "limit"),
|
|
138
|
+
offset: readStringOption(raw, "offset"),
|
|
139
|
+
includeBody: readBooleanOption(raw, "includeBody", ["include_body"]) === true ? true : undefined,
|
|
140
|
+
compact: readBooleanOption(raw, "compact") === true ? true : undefined,
|
|
141
|
+
fields: readStringOption(raw, "fields"),
|
|
142
|
+
sort: readStringOption(raw, "sort"),
|
|
143
|
+
order: readStringOption(raw, "order"),
|
|
144
|
+
},
|
|
145
|
+
dryRun: readBooleanOption(raw, "dryRun", ["dry_run"]) === true ? true : undefined,
|
|
146
|
+
apply: readBooleanOption(raw, "apply") === true ? true : undefined,
|
|
147
|
+
author: readStringOption(raw, "author"),
|
|
148
|
+
message: readStringOption(raw, "message"),
|
|
149
|
+
force: readBooleanOption(raw, "force") === true ? true : undefined,
|
|
150
|
+
allowAuditUpdate: readBooleanOption(raw, "allowAuditUpdate", ["allow_audit_update"]) === true ? true : undefined,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export async function runDedupeAuditPackage(
|
|
155
|
+
options: Record<string, unknown>,
|
|
156
|
+
global: GlobalOptions,
|
|
157
|
+
): Promise<unknown> {
|
|
158
|
+
const module = await ensureGovernanceModule();
|
|
159
|
+
return module.runDedupeAudit(normalizeDedupeAuditOptions(options), global);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export async function runCommentsAuditPackage(
|
|
163
|
+
options: Record<string, unknown>,
|
|
164
|
+
global: GlobalOptions,
|
|
165
|
+
): Promise<unknown> {
|
|
166
|
+
const module = await ensureGovernanceModule();
|
|
167
|
+
return module.runCommentsAudit(normalizeCommentsAuditOptions(options), global);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export async function runNormalizePackage(
|
|
171
|
+
options: Record<string, unknown>,
|
|
172
|
+
global: GlobalOptions,
|
|
173
|
+
): Promise<unknown> {
|
|
174
|
+
const module = await ensureGovernanceModule();
|
|
175
|
+
return module.runNormalize(normalizeNormalizeOptions(options), global);
|
|
176
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unbrained/pm-governance-audit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "First-party pm package for governance audit and normalization workflows.",
|
|
7
|
+
"homepage": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/unbraind/pm-cli.git",
|
|
11
|
+
"directory": "packages/pm-governance-audit"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/unbraind/pm-cli/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"pm-package",
|
|
18
|
+
"project-management",
|
|
19
|
+
"governance",
|
|
20
|
+
"audit",
|
|
21
|
+
"normalize"
|
|
22
|
+
],
|
|
23
|
+
"pm": {
|
|
24
|
+
"aliases": [
|
|
25
|
+
"governance-audit"
|
|
26
|
+
],
|
|
27
|
+
"extensions": [
|
|
28
|
+
"extensions/governance-audit"
|
|
29
|
+
],
|
|
30
|
+
"catalog": {
|
|
31
|
+
"display_name": "Governance Audit",
|
|
32
|
+
"category": "governance",
|
|
33
|
+
"summary": "Run dedupe audits, comments audits, and normalize sweeps as package-owned workflows.",
|
|
34
|
+
"tags": [
|
|
35
|
+
"governance",
|
|
36
|
+
"audit",
|
|
37
|
+
"normalize"
|
|
38
|
+
],
|
|
39
|
+
"links": {
|
|
40
|
+
"docs": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme",
|
|
41
|
+
"repository": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit",
|
|
42
|
+
"report": "https://github.com/unbraind/pm-cli/issues"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"docs": [
|
|
46
|
+
"README.md"
|
|
47
|
+
],
|
|
48
|
+
"examples": [
|
|
49
|
+
"README.md"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# pm-guide-shell
|
|
2
|
+
|
|
3
|
+
First-party package that restores optional guide and shell-completion UX in bare-core `pm`.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `pm guide [topic]`
|
|
8
|
+
- `pm completion [bash|zsh|fish]`
|
|
9
|
+
- `pm completion-tags`
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pm install guide-shell --project
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Verify
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pm guide --list --json
|
|
21
|
+
pm completion bash
|
|
22
|
+
pm completion-tags
|
|
23
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderGuideShellPackageOutput,
|
|
3
|
+
runCompletionPackage,
|
|
4
|
+
runCompletionTagsPackage,
|
|
5
|
+
runGuidePackage,
|
|
6
|
+
} from "./runtime.js";
|
|
7
|
+
|
|
8
|
+
export const manifest = {
|
|
9
|
+
name: "builtin-guide-shell",
|
|
10
|
+
version: "0.1.0",
|
|
11
|
+
entry: "./index.js",
|
|
12
|
+
priority: 0,
|
|
13
|
+
capabilities: ["commands", "schema", "services"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const guideFlags = [
|
|
17
|
+
{ long: "--list", value_type: "boolean", description: "List available guide topics." },
|
|
18
|
+
{ long: "--format", value_name: "value", value_type: "string", description: "Output format override: markdown|toon|json." },
|
|
19
|
+
{ long: "--depth", value_name: "value", value_type: "string", description: "Guide detail depth." },
|
|
20
|
+
{ long: "--topic", value_name: "value", value_type: "string", description: "Explicit guide topic override." },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const completionFlags = [
|
|
24
|
+
{ long: "--shell", value_name: "value", value_type: "string", description: "Completion target shell: bash|zsh|fish." },
|
|
25
|
+
{ long: "--item-types", value_name: "csv", value_type: "string", description: "Filter completion item types." },
|
|
26
|
+
{ long: "--item_types", value_name: "csv", value_type: "string", description: "Alias for --item-types." },
|
|
27
|
+
{ long: "--tags", value_name: "csv", value_type: "string", description: "Filter completion tags." },
|
|
28
|
+
{ long: "--eager-tags", value_type: "boolean", description: "Expand all tag suggestions eagerly." },
|
|
29
|
+
{ long: "--eager_tags", value_type: "boolean", description: "Alias for --eager-tags." },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
function guideCommand() {
|
|
33
|
+
return {
|
|
34
|
+
name: "guide",
|
|
35
|
+
action: "guide",
|
|
36
|
+
description: "Show migration and usage guidance for pm command families.",
|
|
37
|
+
arguments: [{ name: "topic", required: false, description: "Optional guide topic." }],
|
|
38
|
+
flags: [...guideFlags],
|
|
39
|
+
run: async (context) => runGuidePackage(context.args, context.options, context.global),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function completionCommand() {
|
|
44
|
+
return {
|
|
45
|
+
name: "completion",
|
|
46
|
+
action: "completion",
|
|
47
|
+
description: "Generate shell completion scripts for bash, zsh, and fish.",
|
|
48
|
+
arguments: [{ name: "shell", required: false, description: "Target shell (bash|zsh|fish)." }],
|
|
49
|
+
flags: [...completionFlags],
|
|
50
|
+
run: async (context) => runCompletionPackage(context.args, context.options, context.global),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function completionTagsCommand() {
|
|
55
|
+
return {
|
|
56
|
+
name: "completion-tags",
|
|
57
|
+
action: "completion-tags",
|
|
58
|
+
description: "Print known tags for completion filters.",
|
|
59
|
+
run: async (context) => runCompletionTagsPackage(context.global),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function activate(api) {
|
|
64
|
+
api.registerCommand(guideCommand());
|
|
65
|
+
api.registerCommand(completionCommand());
|
|
66
|
+
api.registerCommand(completionTagsCommand());
|
|
67
|
+
api.registerService("output_format", (context) => {
|
|
68
|
+
const rendered = renderGuideShellPackageOutput(context);
|
|
69
|
+
return rendered ?? null;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
manifest,
|
|
75
|
+
activate,
|
|
76
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CommandDefinition,
|
|
3
|
+
ExtensionApi,
|
|
4
|
+
ServiceOverrideContext,
|
|
5
|
+
} from "../../../../src/sdk/index.js";
|
|
6
|
+
import {
|
|
7
|
+
renderGuideShellPackageOutput,
|
|
8
|
+
runCompletionPackage,
|
|
9
|
+
runCompletionTagsPackage,
|
|
10
|
+
runGuidePackage,
|
|
11
|
+
} from "./runtime.js";
|
|
12
|
+
|
|
13
|
+
export const manifest = {
|
|
14
|
+
name: "builtin-guide-shell",
|
|
15
|
+
version: "0.1.0",
|
|
16
|
+
entry: "./index.js",
|
|
17
|
+
priority: 0,
|
|
18
|
+
capabilities: ["commands", "schema", "services"],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const guideFlags = [
|
|
22
|
+
{ long: "--list", value_type: "boolean", description: "List available guide topics." },
|
|
23
|
+
{ long: "--format", value_name: "value", value_type: "string", description: "Output format override: markdown|toon|json." },
|
|
24
|
+
{ long: "--depth", value_name: "value", value_type: "string", description: "Guide detail depth." },
|
|
25
|
+
{ long: "--topic", value_name: "value", value_type: "string", description: "Explicit guide topic override." },
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
const completionFlags = [
|
|
29
|
+
{ long: "--shell", value_name: "value", value_type: "string", description: "Completion target shell: bash|zsh|fish." },
|
|
30
|
+
{ long: "--item-types", value_name: "csv", value_type: "string", description: "Filter completion item types." },
|
|
31
|
+
{ long: "--item_types", value_name: "csv", value_type: "string", description: "Alias for --item-types." },
|
|
32
|
+
{ long: "--tags", value_name: "csv", value_type: "string", description: "Filter completion tags." },
|
|
33
|
+
{ long: "--eager-tags", value_type: "boolean", description: "Expand all tag suggestions eagerly." },
|
|
34
|
+
{ long: "--eager_tags", value_type: "boolean", description: "Alias for --eager-tags." },
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
function guideCommand(): CommandDefinition {
|
|
38
|
+
return {
|
|
39
|
+
name: "guide",
|
|
40
|
+
action: "guide",
|
|
41
|
+
description: "Show migration and usage guidance for pm command families.",
|
|
42
|
+
arguments: [{ name: "topic", required: false, description: "Optional guide topic." }],
|
|
43
|
+
flags: [...guideFlags],
|
|
44
|
+
run: async (context) => runGuidePackage(context.args, context.options, context.global),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function completionCommand(): CommandDefinition {
|
|
49
|
+
return {
|
|
50
|
+
name: "completion",
|
|
51
|
+
action: "completion",
|
|
52
|
+
description: "Generate shell completion scripts for bash, zsh, and fish.",
|
|
53
|
+
arguments: [{ name: "shell", required: false, description: "Target shell (bash|zsh|fish)." }],
|
|
54
|
+
flags: [...completionFlags],
|
|
55
|
+
run: async (context) => runCompletionPackage(context.args, context.options, context.global),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function completionTagsCommand(): CommandDefinition {
|
|
60
|
+
return {
|
|
61
|
+
name: "completion-tags",
|
|
62
|
+
action: "completion-tags",
|
|
63
|
+
description: "Print known tags for completion filters.",
|
|
64
|
+
run: async (context) => runCompletionTagsPackage(context.global),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function activate(api: ExtensionApi): void {
|
|
69
|
+
api.registerCommand(guideCommand());
|
|
70
|
+
api.registerCommand(completionCommand());
|
|
71
|
+
api.registerCommand(completionTagsCommand());
|
|
72
|
+
api.registerService("output_format", (context) => {
|
|
73
|
+
const rendered = renderGuideShellPackageOutput(context as ServiceOverrideContext);
|
|
74
|
+
return rendered ?? null;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default {
|
|
79
|
+
manifest,
|
|
80
|
+
activate,
|
|
81
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
|
|
4
|
+
const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
|
|
5
|
+
let runtimeBundle = null;
|
|
6
|
+
let runtimeBundlePromise = null;
|
|
7
|
+
|
|
8
|
+
async function ensureRuntimeBundle() {
|
|
9
|
+
if (runtimeBundle) {
|
|
10
|
+
return runtimeBundle;
|
|
11
|
+
}
|
|
12
|
+
if (!runtimeBundlePromise) {
|
|
13
|
+
runtimeBundlePromise = loadRuntimeBundle();
|
|
14
|
+
}
|
|
15
|
+
runtimeBundle = await runtimeBundlePromise;
|
|
16
|
+
return runtimeBundle;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function loadRuntimeBundle() {
|
|
20
|
+
const envRoot = process.env[PM_PACKAGE_ROOT_ENV];
|
|
21
|
+
if (typeof envRoot !== "string" || envRoot.trim().length === 0) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`builtin-guide-shell requires ${PM_PACKAGE_ROOT_ENV} to locate core SDK runtime exports.`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const modulePath = path.join(path.resolve(envRoot.trim()), "dist", "sdk", "runtime.js");
|
|
27
|
+
try {
|
|
28
|
+
const sdkLoaded = await import(pathToFileURL(modulePath).href);
|
|
29
|
+
if (
|
|
30
|
+
typeof sdkLoaded.runGuide === "function" &&
|
|
31
|
+
typeof sdkLoaded.resolveGuideOutputFormat === "function" &&
|
|
32
|
+
typeof sdkLoaded.renderGuideMarkdown === "function" &&
|
|
33
|
+
typeof sdkLoaded.runCompletion === "function" &&
|
|
34
|
+
typeof sdkLoaded.pathExists === "function" &&
|
|
35
|
+
typeof sdkLoaded.getSettingsPath === "function" &&
|
|
36
|
+
typeof sdkLoaded.resolvePmRoot === "function" &&
|
|
37
|
+
typeof sdkLoaded.readSettings === "function" &&
|
|
38
|
+
typeof sdkLoaded.resolveItemTypeRegistry === "function" &&
|
|
39
|
+
typeof sdkLoaded.resolveRuntimeStatusRegistry === "function" &&
|
|
40
|
+
typeof sdkLoaded.resolveRuntimeFieldRegistry === "function" &&
|
|
41
|
+
typeof sdkLoaded.listAllFrontMatter === "function" &&
|
|
42
|
+
typeof sdkLoaded.getActiveExtensionRegistrations === "function"
|
|
43
|
+
) {
|
|
44
|
+
return {
|
|
45
|
+
sdk: sdkLoaded,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// Fall through to deterministic failure message below.
|
|
50
|
+
}
|
|
51
|
+
throw new Error(
|
|
52
|
+
`builtin-guide-shell failed to load guide/completion SDK runtime exports from ${modulePath}.`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function readStringOption(options, key, aliases = []) {
|
|
57
|
+
const keys = [key, ...aliases];
|
|
58
|
+
for (const candidate of keys) {
|
|
59
|
+
const value = options[candidate];
|
|
60
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function readBooleanOption(options, key, aliases = []) {
|
|
68
|
+
const keys = [key, ...aliases];
|
|
69
|
+
for (const candidate of keys) {
|
|
70
|
+
const value = options[candidate];
|
|
71
|
+
if (value === undefined) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (typeof value === "boolean") {
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
if (typeof value === "string") {
|
|
78
|
+
const normalized = value.trim().toLowerCase();
|
|
79
|
+
if (normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on") {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (normalized === "false" || normalized === "0" || normalized === "no" || normalized === "off") {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function readCsvListOption(options, key, aliases = []) {
|
|
91
|
+
const value = readStringOption(options, key, aliases);
|
|
92
|
+
if (!value) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
return value
|
|
96
|
+
.split(",")
|
|
97
|
+
.map((entry) => entry.trim())
|
|
98
|
+
.filter((entry) => entry.length > 0);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function normalizeGuideOptions(args, options) {
|
|
102
|
+
const topicFromArgs = args[0];
|
|
103
|
+
return {
|
|
104
|
+
topic: readStringOption(options, "topic") ?? (typeof topicFromArgs === "string" && topicFromArgs.trim().length > 0 ? topicFromArgs : undefined),
|
|
105
|
+
list: readBooleanOption(options, "list") === true ? true : undefined,
|
|
106
|
+
format: readStringOption(options, "format"),
|
|
107
|
+
depth: readStringOption(options, "depth"),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function normalizeCompletionOptions(args, options) {
|
|
112
|
+
const shellFromOptions = readStringOption(options, "shell");
|
|
113
|
+
const shellFromArgs = typeof args[0] === "string" && args[0].trim().length > 0 ? args[0].trim() : undefined;
|
|
114
|
+
return {
|
|
115
|
+
shell: shellFromOptions ?? shellFromArgs ?? "bash",
|
|
116
|
+
itemTypes: readCsvListOption(options, "itemTypes", ["item_types"]),
|
|
117
|
+
tags: readCsvListOption(options, "tags"),
|
|
118
|
+
eagerTags: readBooleanOption(options, "eagerTags", ["eager_tags"]) === true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function buildCompletionRuntimeConfig(bundle, global) {
|
|
123
|
+
const pmRoot = bundle.sdk.resolvePmRoot(process.cwd(), global.path);
|
|
124
|
+
if (!(await bundle.sdk.pathExists(bundle.sdk.getSettingsPath(pmRoot)))) {
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
const settings = await bundle.sdk.readSettings(pmRoot);
|
|
128
|
+
const schema = settings.schema;
|
|
129
|
+
const statuses = bundle.sdk.resolveRuntimeStatusRegistry(schema).definitions
|
|
130
|
+
.map((definition) => definition.id)
|
|
131
|
+
.filter((status) => typeof status === "string" && status.trim().length > 0)
|
|
132
|
+
.sort((left, right) => left.localeCompare(right));
|
|
133
|
+
const fieldRegistry = bundle.sdk.resolveRuntimeFieldRegistry(schema);
|
|
134
|
+
const runtimeCommands = ["list", "create", "update", "update-many", "search", "calendar", "context"];
|
|
135
|
+
const commandFlags = {};
|
|
136
|
+
for (const command of runtimeCommands) {
|
|
137
|
+
const definitions = fieldRegistry.command_to_fields.get(command) ?? [];
|
|
138
|
+
const flags = [
|
|
139
|
+
...new Set(
|
|
140
|
+
definitions
|
|
141
|
+
.map((definition) => definition.cli_flag)
|
|
142
|
+
.filter((value) => typeof value === "string" && value.trim().length > 0)
|
|
143
|
+
.map((value) => `--${value.trim().replaceAll("_", "-")}`),
|
|
144
|
+
),
|
|
145
|
+
].sort((left, right) => left.localeCompare(right));
|
|
146
|
+
if (flags.length > 0) {
|
|
147
|
+
commandFlags[command] = flags;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
statuses: statuses.length > 0 ? statuses : undefined,
|
|
152
|
+
command_flags: Object.keys(commandFlags).length > 0 ? commandFlags : undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function readPayloadFormat(payload) {
|
|
157
|
+
if (typeof payload === "object" && payload !== null) {
|
|
158
|
+
const format = payload.format;
|
|
159
|
+
if (format === "json") {
|
|
160
|
+
return "json";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return "toon";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function readPayloadResult(payload) {
|
|
167
|
+
if (typeof payload === "object" && payload !== null && "result" in payload) {
|
|
168
|
+
return payload.result;
|
|
169
|
+
}
|
|
170
|
+
return payload;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function collectTagsFromItems(items) {
|
|
174
|
+
const tagSet = new Set();
|
|
175
|
+
for (const item of items) {
|
|
176
|
+
const tags = Array.isArray(item.metadata.tags) ? item.metadata.tags : [];
|
|
177
|
+
for (const tag of tags) {
|
|
178
|
+
if (typeof tag === "string" && tag.trim().length > 0) {
|
|
179
|
+
tagSet.add(tag.trim());
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return [...tagSet].sort((left, right) => left.localeCompare(right));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export async function runGuidePackage(args, options, global) {
|
|
187
|
+
const bundle = await ensureRuntimeBundle();
|
|
188
|
+
return bundle.sdk.runGuide(normalizeGuideOptions(args, options), global);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export async function runCompletionPackage(args, options, global) {
|
|
192
|
+
const bundle = await ensureRuntimeBundle();
|
|
193
|
+
const normalized = normalizeCompletionOptions(args, options);
|
|
194
|
+
const runtimeConfig = await buildCompletionRuntimeConfig(bundle, global);
|
|
195
|
+
return bundle.sdk.runCompletion(
|
|
196
|
+
normalized.shell,
|
|
197
|
+
normalized.itemTypes,
|
|
198
|
+
normalized.tags,
|
|
199
|
+
normalized.eagerTags,
|
|
200
|
+
runtimeConfig,
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export async function runCompletionTagsPackage(global) {
|
|
205
|
+
const bundle = await ensureRuntimeBundle();
|
|
206
|
+
const pmRoot = bundle.sdk.resolvePmRoot(process.cwd(), global.path);
|
|
207
|
+
if (!(await bundle.sdk.pathExists(bundle.sdk.getSettingsPath(pmRoot)))) {
|
|
208
|
+
return { tags: [], count: 0 };
|
|
209
|
+
}
|
|
210
|
+
const settings = await bundle.sdk.readSettings(pmRoot);
|
|
211
|
+
const registrations = bundle.sdk.getActiveExtensionRegistrations();
|
|
212
|
+
const typeRegistry = bundle.sdk.resolveItemTypeRegistry(settings, registrations);
|
|
213
|
+
const typeToFolder = Object.fromEntries(
|
|
214
|
+
typeRegistry.definitions.map((definition) => [definition.name, definition.folder]),
|
|
215
|
+
);
|
|
216
|
+
const schema = settings.schema;
|
|
217
|
+
const itemFormat = settings.item_format === "json_markdown" ? "json_markdown" : "toon";
|
|
218
|
+
const items = await bundle.sdk.listAllFrontMatter(pmRoot, itemFormat, typeToFolder, undefined, schema);
|
|
219
|
+
const tags = collectTagsFromItems(items);
|
|
220
|
+
return {
|
|
221
|
+
tags,
|
|
222
|
+
count: tags.length,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function renderGuideShellPackageOutput(context) {
|
|
227
|
+
if (!runtimeBundle) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
const result = readPayloadResult(context.payload);
|
|
231
|
+
if (context.command === "guide") {
|
|
232
|
+
const options = context.options ?? {};
|
|
233
|
+
const global = context.global ?? {};
|
|
234
|
+
const outputFormat = runtimeBundle.sdk.resolveGuideOutputFormat(options, global);
|
|
235
|
+
if (outputFormat === "markdown") {
|
|
236
|
+
return `${runtimeBundle.sdk.renderGuideMarkdown(result)}\n`;
|
|
237
|
+
}
|
|
238
|
+
if (outputFormat === "json" || readPayloadFormat(context.payload) === "json") {
|
|
239
|
+
return `${JSON.stringify(result, null, 2)}\n`;
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
if (context.command === "completion") {
|
|
244
|
+
if (readPayloadFormat(context.payload) === "json") {
|
|
245
|
+
return `${JSON.stringify(result, null, 2)}\n`;
|
|
246
|
+
}
|
|
247
|
+
if (typeof result === "object" && result !== null && typeof result.script === "string") {
|
|
248
|
+
const script = result.script;
|
|
249
|
+
return script.endsWith("\n") ? script : `${script}\n`;
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
if (context.command === "completion-tags") {
|
|
254
|
+
if (readPayloadFormat(context.payload) === "json") {
|
|
255
|
+
return `${JSON.stringify(result, null, 2)}\n`;
|
|
256
|
+
}
|
|
257
|
+
const tags = typeof result === "object" && result !== null && Array.isArray(result.tags)
|
|
258
|
+
? result.tags.filter((entry) => typeof entry === "string")
|
|
259
|
+
: [];
|
|
260
|
+
return `${tags.join(" ")}\n`;
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|