@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]="0eb4f7df-9f0e-5e86-9802-1490f5a73f6e")}catch(e){}}();
|
|
1
3
|
function normalizeRegistrationName(value) {
|
|
2
4
|
if (typeof value !== "string") {
|
|
3
5
|
return null;
|
|
@@ -48,4 +50,5 @@ export function resolveRegisteredVectorStoreAdapter(registrations, configuredAda
|
|
|
48
50
|
export function getMigrationRuntimeDefinition(migration) {
|
|
49
51
|
return migration.runtime_definition ?? migration.definition;
|
|
50
52
|
}
|
|
51
|
-
//# sourceMappingURL=runtime-registrations.js.map
|
|
53
|
+
//# sourceMappingURL=runtime-registrations.js.map
|
|
54
|
+
//# debugId=0eb4f7df-9f0e-5e86-9802-1490f5a73f6e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-registrations.js","
|
|
1
|
+
{"version":3,"file":"runtime-registrations.js","sources":["core/extensions/runtime-registrations.ts"],"sourceRoot":"/","sourcesContent":["import type {\n ExtensionRegistrationRegistry,\n RegisteredExtensionSchemaMigrationDefinition,\n RegisteredExtensionSearchProvider,\n RegisteredExtensionVectorStoreAdapter,\n} from \"./loader.js\";\n\nfunction normalizeRegistrationName(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim().toLowerCase();\n return normalized.length > 0 ? normalized : null;\n}\n\nexport function collectRegisteredItemFields(registrations: ExtensionRegistrationRegistry | null): Array<Record<string, unknown>> {\n if (!registrations) {\n return [];\n }\n const fields: Array<Record<string, unknown>> = [];\n for (const registration of registrations.item_fields) {\n for (const field of registration.fields) {\n fields.push(field);\n }\n }\n return fields;\n}\n\nexport function resolveRegisteredSearchProvider(\n registrations: ExtensionRegistrationRegistry | null,\n configuredProvider: string | undefined,\n): RegisteredExtensionSearchProvider | null {\n const providerName = normalizeRegistrationName(configuredProvider);\n if (!registrations || !providerName) {\n return null;\n }\n const matched = [...registrations.search_providers]\n .reverse()\n .find((registration) => {\n const definitionName =\n normalizeRegistrationName(registration.runtime_definition?.name) ??\n normalizeRegistrationName(registration.definition?.name);\n return definitionName === providerName;\n });\n return matched ?? null;\n}\n\nexport function resolveRegisteredVectorStoreAdapter(\n registrations: ExtensionRegistrationRegistry | null,\n configuredAdapter: string | undefined,\n): RegisteredExtensionVectorStoreAdapter | null {\n const adapterName = normalizeRegistrationName(configuredAdapter);\n if (!registrations || !adapterName) {\n return null;\n }\n const matched = [...registrations.vector_store_adapters]\n .reverse()\n .find((registration) => {\n const definitionName =\n normalizeRegistrationName(registration.runtime_definition?.name) ??\n normalizeRegistrationName(registration.definition?.name);\n return definitionName === adapterName;\n });\n return matched ?? null;\n}\n\nexport function getMigrationRuntimeDefinition(\n migration: RegisteredExtensionSchemaMigrationDefinition,\n): Record<string, unknown> {\n return migration.runtime_definition ?? migration.definition;\n}\n"],"names":[],"mappings":";;AAOA,SAAS,yBAAyB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,aAAmD;IAC7F,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,GAAmC,EAAE,CAAC;IAClD,KAAK,MAAM,YAAY,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;QACrD,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,aAAmD,EACnD,kBAAsC;IAEtC,MAAM,YAAY,GAAG,yBAAyB,CAAC,kBAAkB,CAAC,CAAC;IACnE,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC;SAChD,OAAO,EAAE;SACT,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;QACrB,MAAM,cAAc,GAClB,yBAAyB,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC;YAChE,yBAAyB,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC3D,OAAO,cAAc,KAAK,YAAY,CAAC;IACzC,CAAC,CAAC,CAAC;IACL,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,aAAmD,EACnD,iBAAqC;IAErC,MAAM,WAAW,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;IACjE,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,aAAa,CAAC,qBAAqB,CAAC;SACrD,OAAO,EAAE;SACT,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;QACrB,MAAM,cAAc,GAClB,yBAAyB,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC;YAChE,yBAAyB,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC3D,OAAO,cAAc,KAAK,WAAW,CAAC;IACxC,CAAC,CAAC,CAAC;IACL,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,SAAuD;IAEvD,OAAO,SAAS,CAAC,kBAAkB,IAAI,SAAS,CAAC,UAAU,CAAC;AAC9D,CAAC","debugId":"0eb4f7df-9f0e-5e86-9802-1490f5a73f6e"}
|
package/dist/core/fs/fs-utils.js
CHANGED
|
@@ -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]="24293159-379b-5416-a184-9ed7ef02ca92")}catch(e){}}();
|
|
1
3
|
import fs from "node:fs/promises";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import crypto from "node:crypto";
|
|
@@ -55,4 +57,5 @@ export async function removeFileIfExists(targetPath) {
|
|
|
55
57
|
function isErrno(error, code) {
|
|
56
58
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
57
59
|
}
|
|
58
|
-
//# sourceMappingURL=fs-utils.js.map
|
|
60
|
+
//# sourceMappingURL=fs-utils.js.map
|
|
61
|
+
//# debugId=24293159-379b-5416-a184-9ed7ef02ca92
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-utils.js","sourceRoot":"/","
|
|
1
|
+
{"version":3,"file":"fs-utils.js","sources":["core/fs/fs-utils.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport crypto from \"node:crypto\";\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await fs.mkdir(dirPath, { recursive: true });\n}\n\nexport async function pathExists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function readFileIfExists(targetPath: string): Promise<string | null> {\n try {\n return await fs.readFile(targetPath, \"utf8\");\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return null;\n }\n throw error;\n }\n}\n\nexport async function writeFileAtomic(targetPath: string, contents: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const tempPath = path.join(\n dirPath,\n `.${path.basename(targetPath)}.${process.pid}.${Date.now()}.${crypto.randomBytes(4).toString(\"hex\")}.tmp`,\n );\n await fs.writeFile(tempPath, contents, \"utf8\");\n await fs.rename(tempPath, targetPath);\n}\n\nexport async function appendLineAtomic(targetPath: string, line: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const handle = await fs.open(targetPath, \"a\");\n try {\n await handle.writeFile(`${line}\\n`, \"utf8\");\n } finally {\n await handle.close();\n }\n}\n\nexport async function removeFileIfExists(targetPath: string): Promise<void> {\n try {\n await fs.unlink(targetPath);\n } catch (error: unknown) {\n if (!isErrno(error, \"ENOENT\")) {\n throw error;\n }\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB;IACjD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,QAAgB;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,OAAO,EACP,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,MAAM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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]="13022892-a000-50a7-aa4f-127a54e9c35e")}catch(e){}}();
|
|
1
3
|
export * from "./fs-utils.js";
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# debugId=13022892-a000-50a7-aa4f-127a54e9c35e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["core/fs/index.ts"],"sourceRoot":"/","sourcesContent":["export * from \"./fs-utils.js\";\n"],"names":[],"mappings":";;AAAA,cAAc,eAAe,CAAC","debugId":"13022892-a000-50a7-aa4f-127a54e9c35e"}
|
|
@@ -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]="6aa88fb8-fe40-5d0f-bee8-b348eda9309e")}catch(e){}}();
|
|
1
3
|
import fs from "node:fs/promises";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import { runActiveOnWriteHooks } from "../extensions/index.js";
|
|
@@ -50,4 +52,5 @@ export async function enforceHistoryStreamPolicyForItems(params) {
|
|
|
50
52
|
warnings,
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
|
-
//# sourceMappingURL=history-stream-policy.js.map
|
|
55
|
+
//# sourceMappingURL=history-stream-policy.js.map
|
|
56
|
+
//# debugId=6aa88fb8-fe40-5d0f-bee8-b348eda9309e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-stream-policy.js","
|
|
1
|
+
{"version":3,"file":"history-stream-policy.js","sources":["core/history/history-stream-policy.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runActiveOnWriteHooks } from \"../extensions/index.js\";\nimport { ensureDir, pathExists } from \"../fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { getHistoryPath } from \"../store/paths.js\";\nimport type { PmSettings } from \"../../types/index.js\";\n\ninterface HistoryStreamPolicyParams {\n pmRoot: string;\n settings: PmSettings;\n itemId: string;\n commandLabel: string;\n}\n\ninterface HistoryStreamPolicyManyParams {\n pmRoot: string;\n settings: PmSettings;\n itemIds: string[];\n commandLabel: string;\n}\n\nexport interface HistoryStreamPolicyResult {\n auto_created_ids: string[];\n warnings: string[];\n}\n\nfunction toSortedUniqueItemIds(itemIds: string[]): string[] {\n return [...new Set(itemIds.filter((value) => value.trim().length > 0))].sort((left, right) => left.localeCompare(right));\n}\n\nfunction strictMissingStreamError(itemId: string, commandLabel: string): PmCliError {\n return new PmCliError(\n `Missing history stream for ${itemId}. ${commandLabel} requires history streams when settings.history.missing_stream is strict_error.`,\n EXIT_CODE.NOT_FOUND,\n );\n}\n\nasync function createStream(historyPath: string, commandLabel: string): Promise<string[]> {\n await ensureDir(path.dirname(historyPath));\n const handle = await fs.open(historyPath, \"a\");\n await handle.close();\n return runActiveOnWriteHooks({\n path: historyPath,\n scope: \"project\",\n op: `${commandLabel}:history:auto_create`,\n });\n}\n\nexport async function enforceHistoryStreamPolicyForItem(params: HistoryStreamPolicyParams): Promise<HistoryStreamPolicyResult> {\n return enforceHistoryStreamPolicyForItems({\n pmRoot: params.pmRoot,\n settings: params.settings,\n itemIds: [params.itemId],\n commandLabel: params.commandLabel,\n });\n}\n\nexport async function enforceHistoryStreamPolicyForItems(\n params: HistoryStreamPolicyManyParams,\n): Promise<HistoryStreamPolicyResult> {\n const ids = toSortedUniqueItemIds(params.itemIds);\n const autoCreated: string[] = [];\n const warnings: string[] = [];\n\n for (const itemId of ids) {\n const historyPath = getHistoryPath(params.pmRoot, itemId);\n if (await pathExists(historyPath)) {\n continue;\n }\n if (params.settings.history.missing_stream === \"strict_error\") {\n throw strictMissingStreamError(itemId, params.commandLabel);\n }\n warnings.push(...(await createStream(historyPath, params.commandLabel)));\n warnings.push(`history_stream_auto_created:${itemId}`);\n autoCreated.push(itemId);\n }\n\n return {\n auto_created_ids: autoCreated,\n warnings,\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAsBnD,SAAS,qBAAqB,CAAC,OAAiB;IAC9C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3H,CAAC;AAED,SAAS,wBAAwB,CAAC,MAAc,EAAE,YAAoB;IACpE,OAAO,IAAI,UAAU,CACnB,8BAA8B,MAAM,KAAK,YAAY,iFAAiF,EACtI,SAAS,CAAC,SAAS,CACpB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,WAAmB,EAAE,YAAoB;IACnE,MAAM,SAAS,CAA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YAAY,CAAC,CAAC,CAAC,CAAC;QACzE,QAAQ,CAAC,IAAI,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;QACvD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,gBAAgB,EAAE,WAAW;QAC7B,QAAQ;KACT,CAAC;AACJ,CAAC","debugId":"6aa88fb8-fe40-5d0f-bee8-b348eda9309e"}
|
|
@@ -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]="bd15b5bc-70d0-57d2-a06d-27b9d518656f")}catch(e){}}();
|
|
1
3
|
import jsonPatch from "fast-json-patch";
|
|
2
4
|
import { FRONT_MATTER_KEY_ORDER } from "../shared/constants.js";
|
|
3
5
|
import { runActiveServiceOverride } from "../extensions/index.js";
|
|
@@ -151,4 +153,5 @@ export async function appendHistoryEntry(historyPath, entry) {
|
|
|
151
153
|
}
|
|
152
154
|
await appendLineAtomic(historyPath, JSON.stringify(entry));
|
|
153
155
|
}
|
|
154
|
-
//# sourceMappingURL=history.js.map
|
|
156
|
+
//# sourceMappingURL=history.js.map
|
|
157
|
+
//# debugId=bd15b5bc-70d0-57d2-a06d-27b9d518656f
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"/","sources":["core/history/history.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CA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WAAW;QACzB,KAAK;KACN,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxC,MAAM,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACpE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAKvB,CAAC;YACF,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACzB,OAAO;YACT,CAAC;YACD,MAAM,eAAe,GAAG,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;YACpG,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACpC,MAAM,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;gBACrD,OAAO;YACT,CAAC;YACD,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAiB,CAAC;YAC1D,MAAM,gBAAgB,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;YACnE,OAAO;QACT,CAAC;IACH,CAAC;IACD,MAAM,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport { FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { runActiveServiceOverride } from \"../extensions/index.js\";\nimport { appendLineAtomic } from \"../fs/fs-utils.js\";\nimport { canonicalDocument } from \"../item/item-format.js\";\nimport { orderObject, sha256Hex, stableStringify } from \"../shared/serialization.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\n\nconst EMPTY_LEGACY_HASH_DOCUMENT = {\n front_matter: {},\n body: \"\",\n};\n\nfunction decodeJsonPointer(path: string): string[] {\n if (!path || path === \"/\") {\n return [];\n }\n if (!path.startsWith(\"/\")) {\n return [];\n }\n return path\n .slice(1)\n .split(\"/\")\n .map((segment) => segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n}\n\nfunction isDefinedPointerPath(document: unknown, path: string): boolean {\n const segments = decodeJsonPointer(path);\n if (segments.length === 0) {\n return true;\n }\n let cursor: unknown = document;\n for (const segment of segments) {\n if (Array.isArray(cursor)) {\n if (segment === \"-\" || !/^(0|[1-9]\\d*)$/.test(segment)) {\n return false;\n }\n const index = Number(segment);\n if (!Number.isInteger(index) || index < 0 || index >= cursor.length) {\n return false;\n }\n const next = cursor[index];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n continue;\n }\n if (typeof cursor !== \"object\" || cursor === null) {\n return false;\n }\n if (!Object.prototype.hasOwnProperty.call(cursor, segment)) {\n return false;\n }\n const next = (cursor as Record<string, unknown>)[segment];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n }\n return true;\n}\n\nfunction normalizeHistoryPatchOps(\n beforeDocument: { metadata: Record<string, unknown>; body: string },\n patch: HistoryPatchOp[],\n): HistoryPatchOp[] {\n const normalized: HistoryPatchOp[] = [];\n let replayCursor: unknown = structuredClone(beforeDocument);\n for (const operation of patch) {\n const normalizedOperation =\n operation.op === \"replace\" && !isDefinedPointerPath(replayCursor, operation.path)\n ? ({ ...operation, op: \"add\" } as HistoryPatchOp)\n : operation;\n normalized.push(normalizedOperation);\n replayCursor = jsonPatch.applyPatch(\n replayCursor,\n [normalizedOperation as jsonPatch.Operation],\n true,\n true,\n ).newDocument as unknown;\n }\n return normalized;\n}\n\nfunction canonicalHashDocument(document: ItemDocument): { front_matter: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n front_matter: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedFrontMatter = orderObject(canonical.metadata as unknown as Record<string, unknown>, FRONT_MATTER_KEY_ORDER);\n return {\n front_matter: orderedFrontMatter,\n body: canonical.body,\n };\n}\n\nfunction canonicalPatchDocument(document: ItemDocument): { metadata: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n metadata: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedMetadata = orderObject(canonical.metadata as unknown as Record<string, unknown>, FRONT_MATTER_KEY_ORDER);\n return {\n metadata: orderedMetadata,\n body: canonical.body,\n };\n}\n\nexport function hashDocument(document: ItemDocument): string {\n return sha256Hex(stableStringify(canonicalHashDocument(document)));\n}\n\nexport function hashEmptyDocument(): string {\n return sha256Hex(stableStringify(EMPTY_LEGACY_HASH_DOCUMENT));\n}\n\nexport function createHistoryEntry(params: {\n nowIso: string;\n author: string;\n op: string;\n before: ItemDocument;\n after: ItemDocument;\n message?: string;\n}): HistoryEntry {\n const beforeHashCanonical = canonicalHashDocument(params.before);\n const afterHashCanonical = canonicalHashDocument(params.after);\n const beforePatchCanonical = canonicalPatchDocument(params.before);\n const afterPatchCanonical = canonicalPatchDocument(params.after);\n const rawPatch = jsonPatch.compare(beforePatchCanonical, afterPatchCanonical) as HistoryPatchOp[];\n const patch = normalizeHistoryPatchOps(beforePatchCanonical, rawPatch);\n\n return {\n ts: params.nowIso,\n author: params.author,\n op: params.op,\n patch,\n before_hash: sha256Hex(stableStringify(beforeHashCanonical)),\n after_hash: sha256Hex(stableStringify(afterHashCanonical)),\n message: params.message === undefined ? undefined : params.message,\n };\n}\n\nexport async function appendHistoryEntry(historyPath: string, entry: HistoryEntry): Promise<void> {\n const override = await runActiveServiceOverride(\"history_append\", {\n history_path: historyPath,\n entry,\n });\n if (override.handled) {\n if (override.result === false) {\n return;\n }\n if (typeof override.result === \"string\") {\n await appendLineAtomic(historyPath, override.result);\n return;\n }\n if (typeof override.result === \"object\" && override.result !== null) {\n const record = override.result as {\n history_path?: unknown;\n entry?: unknown;\n line?: unknown;\n skip?: unknown;\n };\n if (record.skip === true) {\n return;\n }\n const nextHistoryPath = typeof record.history_path === \"string\" ? record.history_path : historyPath;\n if (typeof record.line === \"string\") {\n await appendLineAtomic(nextHistoryPath, record.line);\n return;\n }\n const nextEntry = (record.entry ?? entry) as HistoryEntry;\n await appendLineAtomic(nextHistoryPath, JSON.stringify(nextEntry));\n return;\n }\n }\n await appendLineAtomic(historyPath, JSON.stringify(entry));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"history.js","sources":["core/history/history.ts"],"sourceRoot":"/","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport { FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { runActiveServiceOverride } from \"../extensions/index.js\";\nimport { appendLineAtomic } from \"../fs/fs-utils.js\";\nimport { canonicalDocument } from \"../item/item-format.js\";\nimport { orderObject, sha256Hex, stableStringify } from \"../shared/serialization.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\n\nconst EMPTY_LEGACY_HASH_DOCUMENT = {\n front_matter: {},\n body: \"\",\n};\n\nfunction decodeJsonPointer(path: string): string[] {\n if (!path || path === \"/\") {\n return [];\n }\n if (!path.startsWith(\"/\")) {\n return [];\n }\n return path\n .slice(1)\n .split(\"/\")\n .map((segment) => segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n}\n\nfunction isDefinedPointerPath(document: unknown, path: string): boolean {\n const segments = decodeJsonPointer(path);\n if (segments.length === 0) {\n return true;\n }\n let cursor: unknown = document;\n for (const segment of segments) {\n if (Array.isArray(cursor)) {\n if (segment === \"-\" || !/^(0|[1-9]\\d*)$/.test(segment)) {\n return false;\n }\n const index = Number(segment);\n if (!Number.isInteger(index) || index < 0 || index >= cursor.length) {\n return false;\n }\n const next = cursor[index];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n continue;\n }\n if (typeof cursor !== \"object\" || cursor === null) {\n return false;\n }\n if (!Object.prototype.hasOwnProperty.call(cursor, segment)) {\n return false;\n }\n const next = (cursor as Record<string, unknown>)[segment];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n }\n return true;\n}\n\nfunction normalizeHistoryPatchOps(\n beforeDocument: { metadata: Record<string, unknown>; body: string },\n patch: HistoryPatchOp[],\n): HistoryPatchOp[] {\n const normalized: HistoryPatchOp[] = [];\n let replayCursor: unknown = structuredClone(beforeDocument);\n for (const operation of patch) {\n const normalizedOperation =\n operation.op === \"replace\" && !isDefinedPointerPath(replayCursor, operation.path)\n ? ({ ...operation, op: \"add\" } as HistoryPatchOp)\n : operation;\n normalized.push(normalizedOperation);\n replayCursor = jsonPatch.applyPatch(\n replayCursor,\n [normalizedOperation as jsonPatch.Operation],\n true,\n true,\n ).newDocument as unknown;\n }\n return normalized;\n}\n\nfunction canonicalHashDocument(document: ItemDocument): { front_matter: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n front_matter: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedFrontMatter = orderObject(canonical.metadata as unknown as Record<string, unknown>, FRONT_MATTER_KEY_ORDER);\n return {\n front_matter: orderedFrontMatter,\n body: canonical.body,\n };\n}\n\nfunction canonicalPatchDocument(document: ItemDocument): { metadata: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n metadata: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedMetadata = orderObject(canonical.metadata as unknown as Record<string, unknown>, FRONT_MATTER_KEY_ORDER);\n return {\n metadata: orderedMetadata,\n body: canonical.body,\n };\n}\n\nexport function hashDocument(document: ItemDocument): string {\n return sha256Hex(stableStringify(canonicalHashDocument(document)));\n}\n\nexport function hashEmptyDocument(): string {\n return sha256Hex(stableStringify(EMPTY_LEGACY_HASH_DOCUMENT));\n}\n\nexport function createHistoryEntry(params: {\n nowIso: string;\n author: string;\n op: string;\n before: ItemDocument;\n after: ItemDocument;\n message?: string;\n}): HistoryEntry {\n const beforeHashCanonical = canonicalHashDocument(params.before);\n const afterHashCanonical = canonicalHashDocument(params.after);\n const beforePatchCanonical = canonicalPatchDocument(params.before);\n const afterPatchCanonical = canonicalPatchDocument(params.after);\n const rawPatch = jsonPatch.compare(beforePatchCanonical, afterPatchCanonical) as HistoryPatchOp[];\n const patch = normalizeHistoryPatchOps(beforePatchCanonical, rawPatch);\n\n return {\n ts: params.nowIso,\n author: params.author,\n op: params.op,\n patch,\n before_hash: sha256Hex(stableStringify(beforeHashCanonical)),\n after_hash: sha256Hex(stableStringify(afterHashCanonical)),\n message: params.message === undefined ? undefined : params.message,\n };\n}\n\nexport async function appendHistoryEntry(historyPath: string, entry: HistoryEntry): Promise<void> {\n const override = await runActiveServiceOverride(\"history_append\", {\n history_path: historyPath,\n entry,\n });\n if (override.handled) {\n if (override.result === false) {\n return;\n }\n if (typeof override.result === \"string\") {\n await appendLineAtomic(historyPath, override.result);\n return;\n }\n if (typeof override.result === \"object\" && override.result !== null) {\n const record = override.result as {\n history_path?: unknown;\n entry?: unknown;\n line?: unknown;\n skip?: unknown;\n };\n if (record.skip === true) {\n return;\n }\n const nextHistoryPath = typeof record.history_path === \"string\" ? record.history_path : historyPath;\n if (typeof record.line === \"string\") {\n await appendLineAtomic(nextHistoryPath, record.line);\n return;\n }\n const nextEntry = (record.entry ?? entry) as HistoryEntry;\n await appendLineAtomic(nextHistoryPath, JSON.stringify(nextEntry));\n return;\n }\n }\n await appendLineAtomic(historyPath, JS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C,SAAS,CAAC,CAAC,CAAC;YACnE,OAAO;QACT,CAAC;IACH,CAAC;IACD,MAAM,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7D,CAAC","debugId":"bd15b5bc-70d0-57d2-a06d-27b9d518656f"}
|
|
@@ -1,2 +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]="d0e71cc2-051b-5492-afb3-a287982a1cd5")}catch(e){}}();
|
|
1
3
|
export * from "./history.js";
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# debugId=d0e71cc2-051b-5492-afb3-a287982a1cd5
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["core/history/index.ts"],"sourceRoot":"/","sourcesContent":["export * from \"./history.js\";\n"],"names":[],"mappings":";;AAAA,cAAc,cAAc,CAAC","debugId":"d0e71cc2-051b-5492-afb3-a287982a1cd5"}
|
package/dist/core/item/id.js
CHANGED
|
@@ -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]="f427a735-ffab-5a1c-b4cf-7069624a58cd")}catch(e){}}();
|
|
1
3
|
import crypto from "node:crypto";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import { TYPE_TO_FOLDER } from "../shared/constants.js";
|
|
@@ -58,4 +60,5 @@ export async function generateItemId(pmRoot, prefix) {
|
|
|
58
60
|
}
|
|
59
61
|
throw new Error(`Unable to generate unique id after ${attempts} attempts`);
|
|
60
62
|
}
|
|
61
|
-
//# sourceMappingURL=id.js.map
|
|
63
|
+
//# sourceMappingURL=id.js.map
|
|
64
|
+
//# debugId=f427a735-ffab-5a1c-b4cf-7069624a58cd
|
package/dist/core/item/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot":"/","
|
|
1
|
+
{"version":3,"file":"id.js","sources":["core/item/id.ts"],"sourceRoot":"/","sourcesContent":["import crypto from \"node:crypto\";\nimport path from \"node:path\";\nimport { TYPE_TO_FOLDER } from \"../shared/constants.js\";\nimport { pathExists } from \"../fs/fs-utils.js\";\n\nexport function normalizePrefix(input: string | undefined): string {\n const normalized = (input ?? \"\").trim().toLowerCase();\n if (!normalized) return \"pm-\";\n return normalized.endsWith(\"-\") ? normalized : `${normalized}-`;\n}\n\nexport function normalizeRawItemId(input: string): string {\n let normalized = input.trim().toLowerCase();\n if (normalized.startsWith(\"#\")) {\n normalized = normalized.slice(1);\n }\n return normalized;\n}\n\nexport function normalizeItemId(input: string, prefix: string): string {\n const canonicalPrefix = normalizePrefix(prefix);\n const normalized = normalizeRawItemId(input);\n if (normalized.startsWith(canonicalPrefix)) {\n return normalized;\n }\n return `${canonicalPrefix}${normalized}`;\n}\n\nfunction randomToken(length: number): string {\n const bytes = crypto.randomBytes(length);\n let token = \"\";\n for (const byte of bytes) {\n token += (byte % 36).toString(36);\n }\n return token;\n}\n\nasync function idExists(pmRoot: string, id: string): Promise<boolean> {\n const checks = Object.values(TYPE_TO_FOLDER).flatMap((folder) => [\n path.join(pmRoot, folder, `${id}.md`),\n path.join(pmRoot, folder, `${id}.toon`),\n ]);\n for (const target of checks) {\n if (await pathExists(target)) {\n return true;\n }\n }\n return false;\n}\n\nexport async function generateItemId(pmRoot: string, prefix: string): Promise<string> {\n let tokenLength = 4;\n let attempts = 0;\n\n while (tokenLength <= 10) {\n for (let i = 0; i < 32; i += 1) {\n const id = `${normalizePrefix(prefix)}${randomToken(tokenLength)}`;\n if (!(await idExists(pmRoot, id))) {\n return id;\n }\n attempts += 1;\n }\n tokenLength += 1;\n }\n\n throw new Error(`Unable to generate unique id after ${attempts} attempts`);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,MAAM,UAAU,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9B,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,IAAI,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,MAAc;IAC3D,MAAM,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3C,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,eAAe,GAA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,IAAI,CAAC,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;gBAClC,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,QAAQ,IAAI,CAAC,CAAC;QAChB,CAAC;QACD,WAAW,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,WAAW,CAAC,CAAC;AAC7E,CAAC","debugId":"f427a735-ffab-5a1c-b4cf-7069624a58cd"}
|
package/dist/core/item/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
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]="5bf96e1c-d6d4-5402-b212-19cd1ea27587")}catch(e){}}();
|
|
1
3
|
export * from "./id.js";
|
|
2
4
|
export * from "./item-format.js";
|
|
3
5
|
export * from "./parse.js";
|
|
4
6
|
export * from "./type-registry.js";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
//# debugId=5bf96e1c-d6d4-5402-b212-19cd1ea27587
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["core/item/index.ts"],"sourceRoot":"/","sourcesContent":["export * from \"./id.js\";\nexport * from \"./item-format.js\";\nexport * from \"./parse.js\";\nexport * from \"./type-registry.js\";\n"],"names":[],"mappings":";;AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC","debugId":"5bf96e1c-d6d4-5402-b212-19cd1ea27587"}
|
|
@@ -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]="db4086f4-7818-5cc1-a6c0-67949132208c")}catch(e){}}();
|
|
1
3
|
import { decode as decodeToon, encode as encodeToon } from "@toon-format/toon";
|
|
2
4
|
import { CONFIDENCE_TEXT_VALUES, ISSUE_SEVERITY_VALUES, RECURRENCE_FREQUENCY_VALUES, RECURRENCE_WEEKDAY_VALUES, STATUS_VALUES, } from "../../types/index.js";
|
|
3
5
|
import { coerceRuntimeFieldValue } from "../schema/runtime-field-values.js";
|
|
@@ -456,7 +458,9 @@ function sortTests(values) {
|
|
|
456
458
|
command: value.command?.trim() || undefined,
|
|
457
459
|
path: value.path ? normalizePathValue(value.path) : undefined,
|
|
458
460
|
scope: value.scope,
|
|
459
|
-
timeout_seconds: value.timeout_seconds
|
|
461
|
+
timeout_seconds: typeof value.timeout_seconds === "number" && Number.isFinite(value.timeout_seconds) && value.timeout_seconds > 0
|
|
462
|
+
? value.timeout_seconds
|
|
463
|
+
: undefined,
|
|
460
464
|
pm_context_mode: (() => {
|
|
461
465
|
const normalized = value.pm_context_mode?.trim().toLowerCase();
|
|
462
466
|
if (!normalized || !LINKED_TEST_PM_CONTEXT_MODE_VALUES.has(normalized)) {
|
|
@@ -573,6 +577,232 @@ function sortDocs(values) {
|
|
|
573
577
|
return (a.note ?? "").localeCompare(b.note ?? "");
|
|
574
578
|
});
|
|
575
579
|
}
|
|
580
|
+
function trimStringOrUndefined(value) {
|
|
581
|
+
if (typeof value !== "string")
|
|
582
|
+
return undefined;
|
|
583
|
+
const trimmed = value.trim();
|
|
584
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
585
|
+
}
|
|
586
|
+
function normalizePlanStepLinks(value) {
|
|
587
|
+
if (!Array.isArray(value))
|
|
588
|
+
return undefined;
|
|
589
|
+
const out = [];
|
|
590
|
+
for (const entry of value) {
|
|
591
|
+
if (entry === null || typeof entry !== "object")
|
|
592
|
+
continue;
|
|
593
|
+
const record = entry;
|
|
594
|
+
const id = trimStringOrUndefined(record.id);
|
|
595
|
+
const kind = trimStringOrUndefined(record.kind);
|
|
596
|
+
if (!id || !kind)
|
|
597
|
+
continue;
|
|
598
|
+
const link = { id, kind: kind };
|
|
599
|
+
const note = trimStringOrUndefined(record.note);
|
|
600
|
+
if (note)
|
|
601
|
+
link.note = note;
|
|
602
|
+
if (record.required_before_step === true)
|
|
603
|
+
link.required_before_step = true;
|
|
604
|
+
out.push(link);
|
|
605
|
+
}
|
|
606
|
+
return out.length > 0 ? out : undefined;
|
|
607
|
+
}
|
|
608
|
+
function normalizePlanStepFiles(value) {
|
|
609
|
+
if (!Array.isArray(value))
|
|
610
|
+
return undefined;
|
|
611
|
+
const out = [];
|
|
612
|
+
for (const entry of value) {
|
|
613
|
+
if (entry === null || typeof entry !== "object")
|
|
614
|
+
continue;
|
|
615
|
+
const record = entry;
|
|
616
|
+
const path = trimStringOrUndefined(record.path);
|
|
617
|
+
if (!path)
|
|
618
|
+
continue;
|
|
619
|
+
const file = { path: normalizePathValue(path) };
|
|
620
|
+
if (record.scope === "project" || record.scope === "global")
|
|
621
|
+
file.scope = record.scope;
|
|
622
|
+
const note = trimStringOrUndefined(record.note);
|
|
623
|
+
if (note)
|
|
624
|
+
file.note = note;
|
|
625
|
+
out.push(file);
|
|
626
|
+
}
|
|
627
|
+
return out.length > 0 ? out : undefined;
|
|
628
|
+
}
|
|
629
|
+
function normalizePlanStepTests(value) {
|
|
630
|
+
if (!Array.isArray(value))
|
|
631
|
+
return undefined;
|
|
632
|
+
const out = [];
|
|
633
|
+
for (const entry of value) {
|
|
634
|
+
if (entry === null || typeof entry !== "object")
|
|
635
|
+
continue;
|
|
636
|
+
const record = entry;
|
|
637
|
+
const command = trimStringOrUndefined(record.command);
|
|
638
|
+
const path = trimStringOrUndefined(record.path);
|
|
639
|
+
if (!command && !path)
|
|
640
|
+
continue;
|
|
641
|
+
const test = {};
|
|
642
|
+
if (command)
|
|
643
|
+
test.command = command;
|
|
644
|
+
if (path)
|
|
645
|
+
test.path = normalizePathValue(path);
|
|
646
|
+
const note = trimStringOrUndefined(record.note);
|
|
647
|
+
if (note)
|
|
648
|
+
test.note = note;
|
|
649
|
+
out.push(test);
|
|
650
|
+
}
|
|
651
|
+
return out.length > 0 ? out : undefined;
|
|
652
|
+
}
|
|
653
|
+
function normalizePlanStepDocs(value) {
|
|
654
|
+
if (!Array.isArray(value))
|
|
655
|
+
return undefined;
|
|
656
|
+
const out = [];
|
|
657
|
+
for (const entry of value) {
|
|
658
|
+
if (entry === null || typeof entry !== "object")
|
|
659
|
+
continue;
|
|
660
|
+
const record = entry;
|
|
661
|
+
const path = trimStringOrUndefined(record.path);
|
|
662
|
+
if (!path)
|
|
663
|
+
continue;
|
|
664
|
+
const doc = { path: normalizePathValue(path) };
|
|
665
|
+
if (record.scope === "project" || record.scope === "global")
|
|
666
|
+
doc.scope = record.scope;
|
|
667
|
+
const note = trimStringOrUndefined(record.note);
|
|
668
|
+
if (note)
|
|
669
|
+
doc.note = note;
|
|
670
|
+
out.push(doc);
|
|
671
|
+
}
|
|
672
|
+
return out.length > 0 ? out : undefined;
|
|
673
|
+
}
|
|
674
|
+
function normalizePlanSteps(value) {
|
|
675
|
+
if (!Array.isArray(value))
|
|
676
|
+
return undefined;
|
|
677
|
+
const out = [];
|
|
678
|
+
for (const entry of value) {
|
|
679
|
+
if (entry === null || typeof entry !== "object")
|
|
680
|
+
continue;
|
|
681
|
+
const record = entry;
|
|
682
|
+
const id = trimStringOrUndefined(record.id);
|
|
683
|
+
const title = trimStringOrUndefined(record.title);
|
|
684
|
+
const status = trimStringOrUndefined(record.status);
|
|
685
|
+
const orderRaw = record.order;
|
|
686
|
+
const order = typeof orderRaw === "number" && Number.isFinite(orderRaw) ? orderRaw : Number(orderRaw);
|
|
687
|
+
if (!id || !title || !status || !Number.isFinite(order))
|
|
688
|
+
continue;
|
|
689
|
+
const created_at = typeof record.created_at === "string" ? record.created_at : "";
|
|
690
|
+
const updated_at = typeof record.updated_at === "string" ? record.updated_at : "";
|
|
691
|
+
if (!created_at || !updated_at)
|
|
692
|
+
continue;
|
|
693
|
+
const step = {
|
|
694
|
+
id,
|
|
695
|
+
order,
|
|
696
|
+
title,
|
|
697
|
+
status: status,
|
|
698
|
+
created_at,
|
|
699
|
+
updated_at,
|
|
700
|
+
};
|
|
701
|
+
const body = trimStringOrUndefined(record.body);
|
|
702
|
+
if (body)
|
|
703
|
+
step.body = body;
|
|
704
|
+
const owner = trimStringOrUndefined(record.owner);
|
|
705
|
+
if (owner)
|
|
706
|
+
step.owner = owner;
|
|
707
|
+
const evidence = trimStringOrUndefined(record.evidence);
|
|
708
|
+
if (evidence)
|
|
709
|
+
step.evidence = evidence;
|
|
710
|
+
const blockedReason = trimStringOrUndefined(record.blocked_reason);
|
|
711
|
+
if (blockedReason)
|
|
712
|
+
step.blocked_reason = blockedReason;
|
|
713
|
+
const supersededBy = trimStringOrUndefined(record.superseded_by);
|
|
714
|
+
if (supersededBy)
|
|
715
|
+
step.superseded_by = supersededBy;
|
|
716
|
+
const completedAt = typeof record.completed_at === "string" ? record.completed_at : undefined;
|
|
717
|
+
if (completedAt && completedAt.length > 0)
|
|
718
|
+
step.completed_at = completedAt;
|
|
719
|
+
const links = normalizePlanStepLinks(record.linked_items);
|
|
720
|
+
if (links)
|
|
721
|
+
step.linked_items = links;
|
|
722
|
+
const files = normalizePlanStepFiles(record.files);
|
|
723
|
+
if (files)
|
|
724
|
+
step.files = files;
|
|
725
|
+
const tests = normalizePlanStepTests(record.tests);
|
|
726
|
+
if (tests)
|
|
727
|
+
step.tests = tests;
|
|
728
|
+
const docs = normalizePlanStepDocs(record.docs);
|
|
729
|
+
if (docs)
|
|
730
|
+
step.docs = docs;
|
|
731
|
+
out.push(step);
|
|
732
|
+
}
|
|
733
|
+
out.sort((left, right) => left.order - right.order);
|
|
734
|
+
return out.length > 0 ? out : undefined;
|
|
735
|
+
}
|
|
736
|
+
function normalizePlanDecisions(value) {
|
|
737
|
+
if (!Array.isArray(value))
|
|
738
|
+
return undefined;
|
|
739
|
+
const out = [];
|
|
740
|
+
for (const entry of value) {
|
|
741
|
+
if (entry === null || typeof entry !== "object")
|
|
742
|
+
continue;
|
|
743
|
+
const record = entry;
|
|
744
|
+
const ts = typeof record.ts === "string" ? record.ts : "";
|
|
745
|
+
const author = typeof record.author === "string" ? record.author : "";
|
|
746
|
+
const decision = trimStringOrUndefined(record.decision);
|
|
747
|
+
if (!ts || !author || !decision)
|
|
748
|
+
continue;
|
|
749
|
+
const item = { ts, author, decision };
|
|
750
|
+
const rationale = trimStringOrUndefined(record.rationale);
|
|
751
|
+
if (rationale)
|
|
752
|
+
item.rationale = rationale;
|
|
753
|
+
const evidence = trimStringOrUndefined(record.evidence);
|
|
754
|
+
if (evidence)
|
|
755
|
+
item.evidence = evidence;
|
|
756
|
+
const stepId = trimStringOrUndefined(record.step_id);
|
|
757
|
+
if (stepId)
|
|
758
|
+
item.step_id = stepId;
|
|
759
|
+
out.push(item);
|
|
760
|
+
}
|
|
761
|
+
return out.length > 0 ? out : undefined;
|
|
762
|
+
}
|
|
763
|
+
function normalizePlanDiscoveries(value) {
|
|
764
|
+
if (!Array.isArray(value))
|
|
765
|
+
return undefined;
|
|
766
|
+
const out = [];
|
|
767
|
+
for (const entry of value) {
|
|
768
|
+
if (entry === null || typeof entry !== "object")
|
|
769
|
+
continue;
|
|
770
|
+
const record = entry;
|
|
771
|
+
const ts = typeof record.ts === "string" ? record.ts : "";
|
|
772
|
+
const author = typeof record.author === "string" ? record.author : "";
|
|
773
|
+
const text = trimStringOrUndefined(record.text);
|
|
774
|
+
if (!ts || !author || !text)
|
|
775
|
+
continue;
|
|
776
|
+
const item = { ts, author, text };
|
|
777
|
+
const stepId = trimStringOrUndefined(record.step_id);
|
|
778
|
+
if (stepId)
|
|
779
|
+
item.step_id = stepId;
|
|
780
|
+
out.push(item);
|
|
781
|
+
}
|
|
782
|
+
return out.length > 0 ? out : undefined;
|
|
783
|
+
}
|
|
784
|
+
function normalizePlanValidation(value) {
|
|
785
|
+
if (!Array.isArray(value))
|
|
786
|
+
return undefined;
|
|
787
|
+
const out = [];
|
|
788
|
+
for (const entry of value) {
|
|
789
|
+
if (entry === null || typeof entry !== "object")
|
|
790
|
+
continue;
|
|
791
|
+
const record = entry;
|
|
792
|
+
const text = trimStringOrUndefined(record.text);
|
|
793
|
+
if (!text)
|
|
794
|
+
continue;
|
|
795
|
+
const item = { text };
|
|
796
|
+
const command = trimStringOrUndefined(record.command);
|
|
797
|
+
if (command)
|
|
798
|
+
item.command = command;
|
|
799
|
+
const expected = trimStringOrUndefined(record.expected);
|
|
800
|
+
if (expected)
|
|
801
|
+
item.expected = expected;
|
|
802
|
+
out.push(item);
|
|
803
|
+
}
|
|
804
|
+
return out.length > 0 ? out : undefined;
|
|
805
|
+
}
|
|
576
806
|
function normalizeTypeOptions(values) {
|
|
577
807
|
if (!values) {
|
|
578
808
|
return undefined;
|
|
@@ -683,6 +913,14 @@ export function normalizeFrontMatter(frontMatter, options = {}) {
|
|
|
683
913
|
regression: frontMatter.regression,
|
|
684
914
|
customer_impact: frontMatter.customer_impact?.trim() || undefined,
|
|
685
915
|
close_reason: frontMatter.close_reason || undefined,
|
|
916
|
+
plan_mode: trimStringOrUndefined(frontMatter.plan_mode),
|
|
917
|
+
plan_scope: trimStringOrUndefined(frontMatter.plan_scope),
|
|
918
|
+
plan_harness: trimStringOrUndefined(frontMatter.plan_harness),
|
|
919
|
+
plan_resume_context: trimStringOrUndefined(frontMatter.plan_resume_context),
|
|
920
|
+
plan_steps: normalizePlanSteps(frontMatter.plan_steps),
|
|
921
|
+
plan_decisions: normalizePlanDecisions(frontMatter.plan_decisions),
|
|
922
|
+
plan_discoveries: normalizePlanDiscoveries(frontMatter.plan_discoveries),
|
|
923
|
+
plan_validation: normalizePlanValidation(frontMatter.plan_validation),
|
|
686
924
|
};
|
|
687
925
|
const sourceRecord = frontMatter;
|
|
688
926
|
for (const [key, value] of Object.entries(sourceRecord)) {
|
|
@@ -887,4 +1125,5 @@ export function canonicalDocument(document, options = {}) {
|
|
|
887
1125
|
body: normalizeBody(document.body ?? ""),
|
|
888
1126
|
};
|
|
889
1127
|
}
|
|
890
|
-
//# sourceMappingURL=item-format.js.map
|
|
1128
|
+
//# sourceMappingURL=item-format.js.map
|
|
1129
|
+
//# debugId=db4086f4-7818-5cc1-a6c0-67949132208c
|