@unbrained/pm-cli 2026.9.21 → 2026.9.23
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 +2 -2
- package/CHANGELOG.md +27 -1
- package/dist/cli/commander-usage.d.ts +5 -1
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/commands/annotations/comments.d.ts +2 -0
- package/dist/cli/commands/{comments.js → annotations/comments.js} +1 -1
- package/dist/cli/commands/{docs.d.ts → annotations/docs.d.ts} +2 -2
- package/dist/cli/commands/{docs.js → annotations/docs.js} +1 -1
- package/dist/cli/commands/{files.d.ts → annotations/files.d.ts} +2 -2
- package/dist/cli/commands/{files.js → annotations/files.js} +1 -1
- package/dist/cli/commands/annotations/learnings.d.ts +2 -0
- package/dist/cli/commands/{learnings.js → annotations/learnings.js} +1 -1
- package/dist/cli/commands/annotations/notes.d.ts +2 -0
- package/dist/cli/commands/{notes.js → annotations/notes.js} +1 -1
- package/dist/cli/commands/extension/extension.d.ts +6 -0
- package/dist/cli/commands/{extension.js → extension/extension.js} +1 -1
- package/dist/cli/commands/{gc.d.ts → governance/gc.d.ts} +2 -2
- package/dist/cli/commands/{gc.js → governance/gc.js} +1 -1
- package/dist/cli/commands/governance/health.d.ts +6 -0
- package/dist/cli/commands/{deps.js → governance/health.js} +2 -2
- package/dist/cli/commands/governance/telemetry.d.ts +6 -0
- package/dist/cli/commands/{telemetry.js → governance/telemetry.js} +1 -1
- package/dist/cli/commands/governance/validate.d.ts +9 -0
- package/dist/cli/commands/governance/validate.js +2 -0
- package/dist/cli/commands/history/activity.d.ts +6 -0
- package/dist/cli/commands/{activity.js → history/activity.js} +1 -1
- package/dist/cli/commands/history/history-compact.d.ts +7 -0
- package/dist/cli/commands/{history-compact.js → history/history-compact.js} +1 -1
- package/dist/cli/commands/{history-redact.d.ts → history/history-redact.d.ts} +2 -2
- package/dist/cli/commands/history/history-redact.js +2 -0
- package/dist/cli/commands/{history-repair.d.ts → history/history-repair.d.ts} +2 -2
- package/dist/cli/commands/{history-repair.js → history/history-repair.js} +1 -1
- package/dist/cli/commands/history/history.d.ts +2 -0
- package/dist/cli/commands/{history.js → history/history.js} +1 -1
- package/dist/cli/commands/history/restore.d.ts +6 -0
- package/dist/cli/commands/history/restore.js +2 -0
- package/dist/cli/commands/lifecycle/append.d.ts +2 -0
- package/dist/cli/commands/{append.js → lifecycle/append.js} +1 -1
- package/dist/cli/commands/lifecycle/claim.d.ts +2 -0
- package/dist/cli/commands/{claim.js → lifecycle/claim.js} +1 -1
- package/dist/cli/commands/lifecycle/close-many.d.ts +2 -0
- package/dist/cli/commands/{close-many.js → lifecycle/close-many.js} +1 -1
- package/dist/cli/commands/lifecycle/close.d.ts +6 -0
- package/dist/cli/commands/lifecycle/close.js +2 -0
- package/dist/cli/commands/lifecycle/copy.d.ts +6 -0
- package/dist/cli/commands/lifecycle/copy.js +2 -0
- package/dist/cli/commands/lifecycle/create.d.ts +6 -0
- package/dist/cli/commands/{create.js → lifecycle/create.js} +1 -1
- package/dist/cli/commands/lifecycle/delete.d.ts +6 -0
- package/dist/cli/commands/{delete.js → lifecycle/delete.js} +1 -1
- package/dist/cli/commands/lifecycle/focus.d.ts +6 -0
- package/dist/cli/commands/lifecycle/focus.js +2 -0
- package/dist/cli/commands/lifecycle/plan.d.ts +6 -0
- package/dist/cli/commands/{plan.js → lifecycle/plan.js} +1 -1
- package/dist/cli/commands/lifecycle/update-many.d.ts +2 -0
- package/dist/cli/commands/lifecycle/update-many.js +2 -0
- package/dist/cli/commands/lifecycle/update.d.ts +6 -0
- package/dist/cli/commands/{copy.js → lifecycle/update.js} +2 -2
- package/dist/cli/commands/query/aggregate.d.ts +2 -0
- package/dist/cli/commands/{aggregate.js → query/aggregate.js} +1 -1
- package/dist/cli/commands/query/context.d.ts +6 -0
- package/dist/cli/commands/{focus.js → query/context.js} +2 -2
- package/dist/cli/commands/{deps.d.ts → query/deps.d.ts} +2 -2
- package/dist/cli/commands/query/deps.js +2 -0
- package/dist/cli/commands/query/duplicates.d.ts +6 -0
- package/dist/cli/commands/{duplicates.js → query/duplicates.js} +1 -1
- package/dist/cli/commands/{eval.d.ts → query/eval.d.ts} +2 -2
- package/dist/cli/commands/{eval.js → query/eval.js} +1 -1
- package/dist/cli/commands/query/get.d.ts +6 -0
- package/dist/cli/commands/{get.js → query/get.js} +1 -1
- package/dist/cli/commands/{graph.d.ts → query/graph.d.ts} +2 -2
- package/dist/cli/commands/{graph.js → query/graph.js} +1 -1
- package/dist/cli/commands/{list.d.ts → query/list.d.ts} +2 -2
- package/dist/cli/commands/{list.js → query/list.js} +1 -1
- package/dist/cli/commands/{next.d.ts → query/next.d.ts} +2 -2
- package/dist/cli/commands/{next.js → query/next.js} +1 -1
- package/dist/cli/commands/query/search.d.ts +6 -0
- package/dist/cli/commands/{search.js → query/search.js} +1 -1
- package/dist/cli/commands/query/stats.d.ts +6 -0
- package/dist/cli/commands/{stats.js → query/stats.js} +1 -1
- package/dist/cli/commands/{test-all.d.ts → test/test-all.d.ts} +2 -2
- package/dist/cli/commands/{test-all.js → test/test-all.js} +1 -1
- package/dist/cli/commands/{test-runs.d.ts → test/test-runs.d.ts} +2 -2
- package/dist/cli/commands/{test-runs.js → test/test-runs.js} +1 -1
- package/dist/cli/commands/{test.d.ts → test/test.d.ts} +2 -2
- package/dist/cli/commands/{test.js → test/test.js} +1 -1
- package/dist/cli/commands/{config.d.ts → workspace/config.d.ts} +2 -2
- package/dist/cli/commands/{config.js → workspace/config.js} +1 -1
- package/dist/cli/commands/workspace/contracts.d.ts +2 -0
- package/dist/cli/commands/{contracts.js → workspace/contracts.js} +1 -1
- package/dist/cli/commands/{init.d.ts → workspace/init.d.ts} +2 -2
- package/dist/cli/commands/{update.js → workspace/init.js} +2 -2
- package/dist/cli/commands/workspace/merge.d.ts +8 -0
- package/dist/cli/commands/workspace/merge.js +2 -0
- package/dist/cli/commands/{profile.d.ts → workspace/profile.d.ts} +2 -2
- package/dist/cli/commands/{profile.js → workspace/profile.js} +1 -1
- package/dist/cli/commands/workspace/schema.d.ts +7 -0
- package/dist/cli/commands/workspace/schema.js +2 -0
- package/dist/cli/commands/workspace/upgrade.d.ts +2 -0
- package/dist/cli/commands/{update-many.js → workspace/upgrade.js} +2 -2
- package/dist/cli/register-annotations.js +1 -1
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli/register-history-maintenance.js +1 -1
- package/dist/cli/register-list-query.js +1 -1
- package/dist/cli/register-mutation.js +1 -1
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/schema/registration.js +1 -1
- package/dist/cli/stats-analytics-json.d.ts +1 -1
- package/dist/cli/stats-analytics-json.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +154 -154
- package/dist/cli-bundle/chunks/{chunk-2QLXN6HZ.js → chunk-6WBR6GMW.js} +26 -26
- package/dist/cli-bundle/chunks/{chunk-JBJUOOJI.js → chunk-7IABMUB6.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-7YUYLYJQ.js → chunk-E6ZES2X7.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-2UNYUB4A.js → chunk-KOUT5SAA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NHRB3L5T.js → chunk-NBGSRFZE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-K7RWRJLT.js → chunk-OBTHQ6UX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GRHSNUQO.js → chunk-PFWCAI4X.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-HAFSMFJK.js → chunk-SXRMM72R.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-SDLBF4PY.js → chunk-VO7DHENB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QZTS23BV.js → chunk-WBB5B7G5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FBWAECBI.js → chunk-ZSVINTXT.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-4SI67A2F.js → chunk-ZWSWR2GX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-5V43MYPN.js → register-list-query-IFPQ4YRD.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-C3O7OSXW.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-LJU5H2CU.js → register-operations-LGO7DBZ7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HJUNGYBB.js → register-setup-4EW2PPZD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UIS5FVHH.js → chunk-3JAEZ7WI.js} +49 -49
- package/dist/cli-bundle/focused-chunks/{chunk-6MNKQKT6.js → chunk-6CWR2QFM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HYPK5OPA.js → chunk-BKXYQQDT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-N6KI3LWF.js → chunk-BQSKFRL2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PC6ZZVNP.js → chunk-BULUJEOL.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-L6L4XCLY.js → chunk-E5AOEXF5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3XPBKIV6.js → chunk-FIQYVDLL.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-FXAZPSU6.js → chunk-HJA6OHWT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DPBTIFW7.js → chunk-KMNH4G6Y.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RQL5WLNZ.js → chunk-L554BKFH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ISEOBALS.js → chunk-LZOEUNHR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U2SB2BMM.js → chunk-N2JYYEHM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5BLRMUMK.js → chunk-PIHQNL32.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-IA5CCSBB.js → chunk-QREDJ77O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DRNXMOSV.js → chunk-S5JYIFFS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K5ZCBC6Y.js → chunk-YE6F5HGF.js} +2 -2
- package/dist/cli-bundle/main.js +18 -18
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +3 -3
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +38 -38
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/core/config/positional-value.d.ts +0 -2
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/history/history-diff.js +1 -1
- package/dist/core/schema/type-workflows.d.ts +1 -1
- package/dist/core/schema/type-workflows.js +1 -1
- package/dist/core/search/eval.d.ts +1 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/shared/item-metadata-contract.d.ts +0 -4
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.d.ts +11 -11
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/extension/shared.d.ts +2 -2
- package/dist/sdk/extension/shared.js +1 -1
- package/dist/sdk/governance/upgrade.d.ts +2 -0
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/search-contracts.d.ts +0 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/schema.d.ts +8 -4
- package/dist/sdk/schema.js +1 -1
- package/docs/ARCHITECTURE.md +31 -4
- package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +50 -1
- package/docs/COMMANDS.md +1 -1
- package/docs/EXTENSIONS.md +1 -1
- package/docs/QUALITY_EVIDENCE.md +70 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +1 -1
- package/docs/RELEASING.md +7 -1
- package/docs/SDK_CONTEXT_INTEGRITY_PRIMITIVES.md +1 -1
- package/docs/TESTING.md +8 -0
- package/marketplace.json +2 -2
- package/package.json +12 -5
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/build-lease.mjs +27 -0
- package/dist/cli/commands/activity.d.ts +0 -6
- package/dist/cli/commands/aggregate.d.ts +0 -2
- package/dist/cli/commands/append.d.ts +0 -2
- package/dist/cli/commands/claim.d.ts +0 -2
- package/dist/cli/commands/close-many.d.ts +0 -2
- package/dist/cli/commands/close.d.ts +0 -6
- package/dist/cli/commands/close.js +0 -2
- package/dist/cli/commands/comments.d.ts +0 -2
- package/dist/cli/commands/context.d.ts +0 -6
- package/dist/cli/commands/context.js +0 -2
- package/dist/cli/commands/contracts.d.ts +0 -2
- package/dist/cli/commands/copy.d.ts +0 -6
- package/dist/cli/commands/create.d.ts +0 -6
- package/dist/cli/commands/delete.d.ts +0 -6
- package/dist/cli/commands/duplicates.d.ts +0 -6
- package/dist/cli/commands/extension.d.ts +0 -6
- package/dist/cli/commands/focus.d.ts +0 -6
- package/dist/cli/commands/get.d.ts +0 -6
- package/dist/cli/commands/health.d.ts +0 -6
- package/dist/cli/commands/health.js +0 -2
- package/dist/cli/commands/history-compact.d.ts +0 -7
- package/dist/cli/commands/history-redact.js +0 -2
- package/dist/cli/commands/history.d.ts +0 -2
- package/dist/cli/commands/index.d.ts +0 -55
- package/dist/cli/commands/index.js +0 -2
- package/dist/cli/commands/init-agent-guidance.d.ts +0 -6
- package/dist/cli/commands/init-agent-guidance.js +0 -2
- package/dist/cli/commands/init.js +0 -2
- package/dist/cli/commands/learnings.d.ts +0 -2
- package/dist/cli/commands/lifecycle-transitions.d.ts +0 -2
- package/dist/cli/commands/lifecycle-transitions.js +0 -2
- package/dist/cli/commands/merge.d.ts +0 -8
- package/dist/cli/commands/merge.js +0 -2
- package/dist/cli/commands/notes.d.ts +0 -2
- package/dist/cli/commands/plan.d.ts +0 -6
- package/dist/cli/commands/restore.d.ts +0 -6
- package/dist/cli/commands/restore.js +0 -2
- package/dist/cli/commands/scheduling-shortcuts.d.ts +0 -6
- package/dist/cli/commands/scheduling-shortcuts.js +0 -2
- package/dist/cli/commands/schema.d.ts +0 -7
- package/dist/cli/commands/schema.js +0 -2
- package/dist/cli/commands/search.d.ts +0 -6
- package/dist/cli/commands/stats.d.ts +0 -6
- package/dist/cli/commands/telemetry.d.ts +0 -6
- package/dist/cli/commands/update-many.d.ts +0 -2
- package/dist/cli/commands/update.d.ts +0 -6
- package/dist/cli/commands/upgrade.d.ts +0 -2
- package/dist/cli/commands/upgrade.js +0 -2
- package/dist/cli/commands/validate.d.ts +0 -9
- package/dist/cli/commands/validate.js +0 -2
- package/dist/cli-bundle/chunks/chunk-T3AMFUCN.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-DXES37MA.js +0 -20
|
@@ -62,6 +62,8 @@ export interface UpgradeCliResult {
|
|
|
62
62
|
target: string;
|
|
63
63
|
/** Value that configures or reports command for this contract. */
|
|
64
64
|
command: string[];
|
|
65
|
+
/** Package-owned command migrations relevant to this CLI upgrade plan or outcome. */
|
|
66
|
+
migration_guidance?: string[];
|
|
65
67
|
/** Value that configures or reports before version for this contract. */
|
|
66
68
|
before_version?: string;
|
|
67
69
|
/** Value that configures or reports after version for this contract. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!(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]="
|
|
2
|
-
${message}`,EXIT_CODE.GENERIC_FAILURE)}}
|
|
1
|
+
!(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]="4bc28901-e70b-5a76-80bb-762ed8227e5f")}catch(e2){}})();import{execFile}from"node:child_process";import path from"node:path";import{promisify}from"node:util";import{renderPmCommand}from"../command-line.js";import{readManagedExtensionState,runExtension}from"../extension.js";import{resolveExtensionRoots,pathExists,EXIT_CODE,PmCliError,resolvePmRoot,resolvePmCliVersion}from"../runtime-primitives.js";const execFileAsync=promisify(execFile);const DEFAULT_CLI_PACKAGE="@unbrained/pm-cli";const DEFAULT_TAG="latest";const PACKAGE_UPGRADE_RETRY_SCOPE_FLAGS={global:["--global"],project:[]};const _testOnly={defaultCommandRunner,isLocalNpmSpec,normalizeTarget,packageRecordMatchesTarget,resolveCliPackage,resolvePackageInstallSource,resolveRunnablePackageSource,resolveScope,resolveTag,packageCommandFor,summarize};function resolveScope(options){const projectLike=options.project===true||options.local===true||options.scope==="project";const global2=options.global===true||options.scope==="global";if(projectLike&&global2){throw new PmCliError('Options "--project/--local" and "--global" are mutually exclusive.',EXIT_CODE.USAGE)}return global2?"global":"project"}function normalizeTarget(value){return value.trim().toLowerCase()}function packageRecordMatchesTarget(record,target){const normalizedTarget=normalizeTarget(target);const values=[record.name,record.directory,record.source.input,record.source.location,record.source.package,record.source.repository,record.source.owner&&record.source.repo?`${record.source.owner}/${record.source.repo}`:void 0];return values.some(value=>typeof value==="string"&&normalizeTarget(value)===normalizedTarget)}function resolveRoots(scope,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);const roots=resolveExtensionRoots(pmRoot,process.cwd());return{selected_root:scope==="global"?roots.global:roots.project}}async function defaultCommandRunner(command,args,options){try{const result=await execFileAsync(command,args,{cwd:options?.cwd,encoding:"utf8"});return{stdout:result.stdout,stderr:result.stderr}}catch(error){const stderr=typeof error==="object"&&error!==null&&"stderr"in error?String(error.stderr??""):"";const message=stderr.trim().length>0?stderr.trim():error instanceof Error?error.message:String(error);throw new PmCliError(`Command failed: ${command} ${args.join(" ")}
|
|
2
|
+
${message}`,EXIT_CODE.GENERIC_FAILURE)}}function resolveTag(options){return typeof options.tag==="string"&&options.tag.trim().length>0?options.tag.trim():DEFAULT_TAG}function resolveCliPackage(options){return typeof options.packageName==="string"&&options.packageName.trim().length>0?options.packageName.trim():DEFAULT_CLI_PACKAGE}async function upgradeCli(options,dryRun){const runner=options.commandRunner??defaultCommandRunner;const packageName=resolveCliPackage(options);const tag=resolveTag(options);const target=`${packageName}@${tag}`;const command=["npm","install","-g",target];if(options.repair===true){command.push("--force")}const beforeVersion=resolvePmCliVersion(import.meta.url,["../../.."]);const planned={requested:true,status:"planned",package:packageName,target,command,before_version:beforeVersion,...packageName===DEFAULT_CLI_PACKAGE?{migration_guidance:["Calendar scheduling commands are package-owned. If calendar is absent, run pm package install calendar --project; use pm calendar meet, pm calendar event, or pm calendar remind."]}:{},repair:options.repair===true};if(dryRun){return planned}try{await runner(command[0],command.slice(1));const verified=await runner("pm",["--version"]);return{...planned,status:"updated",after_version:verified.stdout.trim()||void 0}}catch(error){return{...planned,status:"failed",error:error instanceof Error?error.message:String(error)}}}function isLocalNpmSpec(spec){return path.isAbsolute(spec)||spec.startsWith(".")||spec.startsWith("..")||spec.startsWith("file:")}function resolvePackageInstallSource(source,tag){if(source.kind==="npm"){const rawSpec=source.input.startsWith("npm:")?source.input.slice("npm:".length).trim():source.input.trim();if(!isLocalNpmSpec(rawSpec)&&source.package&&source.package.trim().length>0){return`npm:${source.package.trim()}@${tag}`}return source.input.startsWith("npm:")?source.input:`npm:${source.input}`}return source.input}async function resolveRunnablePackageSource(source,tag){const installSource=resolvePackageInstallSource(source,tag);if(source.kind!=="local"){return installSource}if(await pathExists(installSource)){return installSource}if(await pathExists(source.location)){return source.location}return installSource}function packageCommandFor(source,installSource,scope,ref){const command=["pm","package","install",installSource,scope==="global"?"--global":"--project"];if(source.kind==="github"&&ref&&ref.trim().length>0){command.push("--ref",ref.trim())}return command}async function readManagedRecords(scope,global2){const roots=resolveRoots(scope,global2);const managedState=await readManagedExtensionState(roots.selected_root);return managedState.state.entries.filter(entry=>entry.scope===scope)}async function refreshManagedRecord(scope,global2,record){const records=await readManagedRecords(scope,global2);return records.find(candidate=>packageRecordMatchesTarget(candidate,record.name))??records.find(candidate=>normalizeTarget(candidate.directory)===normalizeTarget(record.directory))}async function upgradePackageRecord(record,options,global2,scope,dryRun){const tag=resolveTag(options);const installSource=await resolveRunnablePackageSource(record.source,tag);const command=packageCommandFor(record.source,installSource,scope,record.source.ref);const planned={name:record.name,directory:record.directory,scope,source:record.source,status:"planned",command,previous_version:record.manifest_version};if(dryRun){return planned}try{await runExtension(installSource,{install:true,project:scope==="project",global:scope==="global",ref:record.source.kind==="github"?record.source.ref:void 0},global2);const refreshed=await refreshManagedRecord(scope,global2,record);return{...planned,status:"updated",installed_version:refreshed?.manifest_version}}catch(error){return{...planned,status:"failed",error:error instanceof Error?error.message:String(error)}}}function summarize(cli,packages,includeCli,includePackages){const statuses=[includeCli?cli.status:void 0,...packages.map(entry=>entry.status)].filter(value=>typeof value==="string");return{requested_cli:includeCli,requested_packages:includePackages,planned:statuses.filter(status=>status==="planned").length,updated:statuses.filter(status=>status==="updated").length,skipped:statuses.filter(status=>status==="skipped").length,failed:statuses.filter(status=>status==="failed").length}}async function runUpgrade(target,options,global2){const normalizedTarget=typeof target==="string"&&target.trim().length>0?target.trim():void 0;if(options.cliOnly===true&&options.packagesOnly===true){const suggestedRetryArguments=["package","upgrade",...normalizedTarget?[normalizedTarget]:[],"--packages-only","--dry-run",...PACKAGE_UPGRADE_RETRY_SCOPE_FLAGS[resolveScope(options)]];throw new PmCliError('Options "--cli-only" and "--packages-only" are mutually exclusive.',EXIT_CODE.USAGE,{code:"package_upgrade_modes_mutually_exclusive",recovery:{suggested_retry:renderPmCommand(suggestedRetryArguments),suggested_retry_args:suggestedRetryArguments}})}const scope=resolveScope(options);const dryRun=options.dryRun===true;if(options.cliOnly===true&&normalizedTarget){throw new PmCliError('A package target cannot be used with "--cli-only".',EXIT_CODE.USAGE)}const includeCli=options.packagesOnly===true||normalizedTarget?false:true;const includePackages=options.cliOnly===true?false:true;const cli=includeCli?await upgradeCli(options,dryRun):{requested:false,status:"skipped",package:resolveCliPackage(options),target:`${resolveCliPackage(options)}@${resolveTag(options)}`,command:["npm","install","-g",`${resolveCliPackage(options)}@${resolveTag(options)}`],repair:options.repair===true,reason:"not_requested"};let packageRecords=includePackages?await readManagedRecords(scope,global2):[];if(normalizedTarget){packageRecords=packageRecords.filter(entry=>packageRecordMatchesTarget(entry,normalizedTarget));if(packageRecords.length===0){throw new PmCliError(`Managed package "${normalizedTarget}" was not found in ${scope} scope.`,EXIT_CODE.NOT_FOUND)}}const packages=[];for(const record of packageRecords){packages.push(await upgradePackageRecord(record,options,global2,scope,dryRun))}const summary=summarize(cli,packages,includeCli,includePackages);return{ok:summary.failed===0,action:"upgrade",dry_run:dryRun,scope,target:normalizedTarget,cli,packages,summary}}export{_testOnly,runUpgrade};
|
|
3
3
|
//# sourceMappingURL=upgrade.js.map
|
package/dist/sdk/pagination.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(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]="
|
|
1
|
+
!(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]="4b085328-0791-58f5-872a-f796f9087ab4")}catch(e2){}})();import{createHash}from"node:crypto";import{PmCliError}from"../core/shared/errors.js";import{EXIT_CODE}from"../core/shared/constants.js";import{stableStringify}from"../core/shared/serialization.js";const QUERY_CURSOR_VERSION=1;const MAX_CURSOR_LENGTH=4096;const BASE64URL_PATTERN=/^[A-Za-z0-9_-]+$/;function optionKeyForFlag(flag){return flag.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(_,character)=>character.toUpperCase())}function selectCursorSemanticOptions(options,contracts){const presentationKeys=new Set;for(const contract of contracts){if(contract.cursor_semantics==="presentation"){presentationKeys.add(optionKeyForFlag(contract.flag));for(const alias of contract.aliases??[]){presentationKeys.add(optionKeyForFlag(alias))}}}return Object.fromEntries(Object.entries(options).filter(([key])=>!presentationKeys.has(key)))}function createQueryFingerprint(command,contract){return createHash("sha256").update(command).update("\0").update(stableStringify(contract)).digest("hex").slice(0,24)}function encodeQueryCursor(fingerprint,afterId,afterIndex,snapshot){return Buffer.from(JSON.stringify({version:QUERY_CURSOR_VERSION,fingerprint,after_id:afterId,...afterIndex===void 0?{}:{after_index:afterIndex},...snapshot===void 0?{}:{snapshot}})).toString("base64url")}function invalidCursor(message){return new PmCliError(message,EXIT_CODE.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function isQueryCursorEnvelope(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return false}const envelope=value;return envelope.version===QUERY_CURSOR_VERSION&&typeof envelope.fingerprint==="string"&&typeof envelope.after_id==="string"&&envelope.after_id.length>0&&(envelope.after_index===void 0||Number.isSafeInteger(envelope.after_index)&&envelope.after_index>=0)&&(envelope.snapshot===void 0||typeof envelope.snapshot==="string"&&envelope.snapshot.length>0)}function decodeQueryCursorEnvelope(cursor){if(typeof cursor!=="string"){throw invalidCursor("Query cursor is malformed.")}const normalized=cursor.trim();if(normalized.length===0||normalized.length>MAX_CURSOR_LENGTH||!BASE64URL_PATTERN.test(normalized)){throw invalidCursor("Query cursor is malformed.")}let parsed;try{parsed=JSON.parse(Buffer.from(normalized,"base64url").toString("utf8"))}catch{throw invalidCursor("Query cursor is malformed.")}if(!isQueryCursorEnvelope(parsed)){throw invalidCursor("Query cursor version or payload is unsupported.")}return parsed}function decodeQueryCursorState(cursor,expectedFingerprint){const envelope=decodeQueryCursorEnvelope(cursor);if(envelope.fingerprint!==expectedFingerprint){throw invalidCursor(`Query cursor does not match the current filters, sort, or query (${envelope.fingerprint} != ${expectedFingerprint}).`)}return{after_id:envelope.after_id,...envelope.after_index===void 0?{}:{after_index:envelope.after_index},...envelope.snapshot===void 0?{}:{snapshot:envelope.snapshot}}}function decodeQueryCursor(cursor,expectedFingerprint){return decodeQueryCursorState(cursor,expectedFingerprint).after_id}function resolveQueryCursorStart(rows,cursor,fingerprint,readId){if(cursor===void 0){return 0}const state=decodeQueryCursorState(cursor,fingerprint);const index=rows.findIndex(row=>readId(row)===state.after_id);if(index<0){if(state.after_index!==void 0){return Math.min(state.after_index,rows.length)}throw invalidCursor(`Query cursor item ${state.after_id} is no longer present in this result set.`)}return index+1}function paginateQueryRows(rows,options){if(options.cursor!==void 0&&decodeQueryCursorState(options.cursor,options.fingerprint).snapshot!==options.snapshot)throw invalidCursor("Query cursor does not match the requested snapshot.");const pageStart=resolveQueryCursorStart(rows,options.cursor,options.fingerprint,options.readId);const pageRows=rows.slice(pageStart,pageStart+options.limit);const hasMore=pageRows.length>0&&pageStart+pageRows.length<rows.length;const lastRow=pageRows.at(-1);return{rows:pageRows,has_more:hasMore,...hasMore&&lastRow!==void 0?{next_cursor:encodeQueryCursor(options.fingerprint,options.readId(lastRow),pageStart+pageRows.length-1,options.snapshot)}:{}}}const QUERY_CURSOR_CONTRACT=Object.freeze({version:QUERY_CURSOR_VERSION,max_length:MAX_CURSOR_LENGTH});export{QUERY_CURSOR_CONTRACT,createQueryFingerprint,decodeQueryCursor,decodeQueryCursorEnvelope,decodeQueryCursorState,encodeQueryCursor,paginateQueryRows,resolveQueryCursorStart,selectCursorSemanticOptions};
|
|
2
2
|
//# sourceMappingURL=pagination.js.map
|