@unbrained/pm-cli 2026.10.18 → 2026.10.20

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.
Files changed (186) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +43 -0
  3. package/dist/cli/error-guidance.d.ts +7 -0
  4. package/dist/cli/error-guidance.js +2 -2
  5. package/dist/cli/help-content.js +2 -2
  6. package/dist/cli/register-mutation.js +2 -2
  7. package/dist/cli/register-setup.js +1 -1
  8. package/dist/cli/register-structured-mutation.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +1 -1
  10. package/dist/cli-bundle/chunks/{chunk-PYRREEUB.js → chunk-2GGGOD7P.js} +28 -28
  11. package/dist/cli-bundle/chunks/chunk-7NHA5K77.js +126 -0
  12. package/dist/cli-bundle/chunks/chunk-7ZOIZ2AZ.js +8 -0
  13. package/dist/cli-bundle/chunks/{chunk-4GA4MUTE.js → chunk-GHJOMRSF.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-KU4Q3MSI.js +8 -0
  15. package/dist/cli-bundle/chunks/chunk-LS55VKRK.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-PNPE2OVJ.js +112 -0
  17. package/dist/cli-bundle/chunks/chunk-PTL3TBT6.js +20 -0
  18. package/dist/cli-bundle/chunks/chunk-QETMESEB.js +6 -0
  19. package/dist/cli-bundle/chunks/{chunk-7WIEAGDS.js → chunk-QMZ73FCW.js} +2 -2
  20. package/dist/cli-bundle/chunks/chunk-QQYCB2LO.js +2 -0
  21. package/dist/cli-bundle/chunks/chunk-RUKSEZE7.js +2 -0
  22. package/dist/cli-bundle/chunks/chunk-TZU6U5ZE.js +3 -0
  23. package/dist/cli-bundle/chunks/chunk-VLJLWZBO.js +70 -0
  24. package/dist/cli-bundle/chunks/chunk-VS565KBX.js +2 -0
  25. package/dist/cli-bundle/chunks/chunk-XAWE4EAK.js +2 -0
  26. package/dist/cli-bundle/chunks/chunk-YECCKB4E.js +3 -0
  27. package/dist/cli-bundle/chunks/{chunk-FIJOSX2C.js → chunk-YT2Z3JPC.js} +72 -66
  28. package/dist/cli-bundle/chunks/chunk-YTHI5DTH.js +2 -0
  29. package/dist/cli-bundle/chunks/{chunk-6VZKYJW7.js → chunk-YW6SIKYP.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-ZZED447K.js → chunk-ZA3XXHEE.js} +6 -6
  31. package/dist/cli-bundle/chunks/context-budget-recovery-L2WP5S26.js +2 -0
  32. package/dist/cli-bundle/chunks/indexed-receipt-blobs-U7VGKIYC.js +4 -0
  33. package/dist/cli-bundle/chunks/{register-list-query-PUCVYYBD.js → register-list-query-NNDV6F6I.js} +3 -3
  34. package/dist/cli-bundle/chunks/register-mutation-3GCBSNQS.js +20 -0
  35. package/dist/cli-bundle/chunks/register-operations-YKDGNKUL.js +2 -0
  36. package/dist/cli-bundle/chunks/register-setup-AOUZQQWB.js +2 -0
  37. package/dist/cli-bundle/chunks/settlement-hook-CLRGA6O7.js +7 -0
  38. package/dist/cli-bundle/chunks/stage-6QXYRMSU.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-37SU7BZI.js +3 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-6IU7BESB.js +65 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-AK2CI2GI.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-AS3MOBO3.js +25 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-AW35RDKA.js +78 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-E4II2D2B.js +3 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-A4ZHHTEX.js → chunk-F7FD25TG.js} +12 -12
  46. package/dist/cli-bundle/focused-chunks/chunk-FOA7XKWP.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-TB7F4FCR.js → chunk-GYHZ7W6O.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-H5Q2HUU6.js +8 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-HUZAXSIJ.js +3 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-J6EYUGAR.js +6 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-JEXZEIAX.js +91 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-BFEMT5U3.js → chunk-KDGUIIRU.js} +3 -3
  53. package/dist/cli-bundle/focused-chunks/{chunk-ZDBS2DCT.js → chunk-KKRFSI2N.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/chunk-LJPUJ2KK.js +2 -0
  55. package/dist/cli-bundle/focused-chunks/chunk-MQ42BFGX.js +2 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-IRVL4UXR.js → chunk-NI6NS44Q.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-VAYS754X.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-Z7YIFCNE.js → chunk-VLSER3XW.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-VS6VTWTZ.js +8 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-VVRXF4JO.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-ZGEK57KD.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/context-budget-recovery-5MKOCGY5.js +2 -0
  63. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-H2G6CCGO.js +4 -0
  64. package/dist/cli-bundle/focused-chunks/settlement-hook-5SNBBT7C.js +7 -0
  65. package/dist/cli-bundle/focused-chunks/stage-EMTISXR7.js +2 -0
  66. package/dist/cli-bundle/main.js +21 -21
  67. package/dist/cli-bundle/sdk-authoring.js +1 -1
  68. package/dist/cli-bundle/sdk-contracts.js +2 -2
  69. package/dist/cli-bundle/sdk-core.js +28 -22
  70. package/dist/cli-bundle/sdk-governance.js +1 -1
  71. package/dist/cli-bundle/sdk-graph.js +1 -1
  72. package/dist/cli-bundle/sdk-merge.js +66 -53
  73. package/dist/cli-bundle/sdk-query.js +1 -1
  74. package/dist/cli-bundle/sdk-runtime.js +1 -1
  75. package/dist/cli-bundle/sdk-testing.js +1 -1
  76. package/dist/cli-bundle/sdk.js +8 -8
  77. package/dist/core/fs/fs-utils.d.ts +2 -2
  78. package/dist/core/fs/fs-utils.js +1 -1
  79. package/dist/core/history/event-index.js +2 -2
  80. package/dist/core/output/output.d.ts +7 -2
  81. package/dist/core/output/output.js +5 -5
  82. package/dist/core/shared/errors.d.ts +48 -0
  83. package/dist/core/shared/errors.js +1 -1
  84. package/dist/core/store/settings.js +2 -2
  85. package/dist/mcp/server.js +1 -1
  86. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
  87. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  88. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  89. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +1 -0
  90. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  91. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  92. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  93. package/dist/sdk/core.d.ts +1 -1
  94. package/dist/sdk/core.js +1 -1
  95. package/dist/sdk/dependencies/context-budget-recovery.d.ts +21 -0
  96. package/dist/sdk/dependencies/context-budget-recovery.js +2 -0
  97. package/dist/sdk/dependencies.js +1 -1
  98. package/dist/sdk/errors.d.ts +4 -1
  99. package/dist/sdk/errors.js +1 -1
  100. package/dist/sdk/extension/install-sources.js +3 -3
  101. package/dist/sdk/extension/shared.js +1 -1
  102. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  103. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  104. package/dist/sdk/governance/health.js +1 -1
  105. package/dist/sdk/history-repair.js +1 -1
  106. package/dist/sdk/index.d.ts +1 -1
  107. package/dist/sdk/index.js +1 -1
  108. package/dist/sdk/item-transaction.d.ts +13 -0
  109. package/dist/sdk/item-transaction.js +1 -1
  110. package/dist/sdk/lifecycle/structured-mutation-plan.d.ts +14 -1
  111. package/dist/sdk/lifecycle/structured-mutation-plan.js +1 -1
  112. package/dist/sdk/merge/driver.js +7 -1
  113. package/dist/sdk/merge/indexed-receipt-blobs.d.ts +2 -0
  114. package/dist/sdk/merge/indexed-receipt-blobs.js +4 -0
  115. package/dist/sdk/merge/install.d.ts +8 -0
  116. package/dist/sdk/merge/install.js +3 -3
  117. package/dist/sdk/merge/receipts.d.ts +6 -0
  118. package/dist/sdk/merge/receipts.js +2 -2
  119. package/dist/sdk/merge/reconcile.d.ts +6 -0
  120. package/dist/sdk/merge/reconcile.js +1 -1
  121. package/dist/sdk/merge/settlement-hook.d.ts +12 -0
  122. package/dist/sdk/merge/settlement-hook.js +7 -0
  123. package/dist/sdk/merge/stage.d.ts +13 -0
  124. package/dist/sdk/merge/stage.js +2 -0
  125. package/dist/sdk/output/list-envelope.d.ts +7 -0
  126. package/dist/sdk/output/list-envelope.js +2 -0
  127. package/dist/sdk/output.d.ts +1 -0
  128. package/dist/sdk/output.js +2 -2
  129. package/dist/sdk/public-surface.json +1 -1
  130. package/dist/sdk/query/list.js +1 -1
  131. package/dist/sdk/relationship-context.d.ts +2 -0
  132. package/dist/sdk/relationship-context.js +1 -1
  133. package/dist/sdk/runtime-extended-actions.js +1 -1
  134. package/dist/sdk/structured-mutations.d.ts +2 -0
  135. package/dist/sdk/structured-mutations.js +1 -1
  136. package/docs/COMMANDS.md +27 -0
  137. package/docs/CONFIGURATION.md +14 -0
  138. package/docs/MERGE_SAFETY.md +88 -5
  139. package/docs/PR_REVIEW_LOOP.md +32 -12
  140. package/docs/SCRIPTING.md +10 -0
  141. package/docs/SDK.md +103 -0
  142. package/docs/TESTING.md +32 -1
  143. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  144. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
  145. package/marketplace.json +1 -1
  146. package/package.json +1 -1
  147. package/packages/pm-beads/package.json +1 -1
  148. package/packages/pm-calendar/package.json +1 -1
  149. package/packages/pm-command-kit/package.json +1 -1
  150. package/packages/pm-digital-twin/package.json +1 -1
  151. package/packages/pm-governance-audit/package.json +1 -1
  152. package/packages/pm-guide-shell/package.json +1 -1
  153. package/packages/pm-kanban/package.json +1 -1
  154. package/packages/pm-lifecycle-hooks/package.json +1 -1
  155. package/packages/pm-linked-test-adapters/package.json +1 -1
  156. package/packages/pm-search-advanced/package.json +1 -1
  157. package/packages/pm-templates/package.json +1 -1
  158. package/packages/pm-todos/package.json +1 -1
  159. package/packages/pm-vcs/package.json +1 -1
  160. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  161. package/plugins/pm-claude/package.json +1 -1
  162. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  163. package/plugins/pm-codex/package.json +1 -1
  164. package/plugins/pm-codex/plugin.json +1 -1
  165. package/runtime-dependencies.json +1 -1
  166. package/dist/cli-bundle/chunks/chunk-4V6ONLI6.js +0 -3
  167. package/dist/cli-bundle/chunks/chunk-7PATQWTH.js +0 -20
  168. package/dist/cli-bundle/chunks/chunk-AETP4JEM.js +0 -3
  169. package/dist/cli-bundle/chunks/chunk-LUKVNL72.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-OJ77ZQN3.js +0 -8
  171. package/dist/cli-bundle/chunks/chunk-RHQJ6VWC.js +0 -237
  172. package/dist/cli-bundle/chunks/chunk-RNABUEFB.js +0 -80
  173. package/dist/cli-bundle/chunks/chunk-TO6CIV4C.js +0 -2
  174. package/dist/cli-bundle/chunks/register-mutation-GGGVBXD5.js +0 -20
  175. package/dist/cli-bundle/chunks/register-operations-NRZ6Q4QE.js +0 -2
  176. package/dist/cli-bundle/chunks/register-setup-MV3P3YSF.js +0 -2
  177. package/dist/cli-bundle/focused-chunks/chunk-2MPQUMTF.js +0 -2
  178. package/dist/cli-bundle/focused-chunks/chunk-5UKCSZWT.js +0 -2
  179. package/dist/cli-bundle/focused-chunks/chunk-B4YLP5ZB.js +0 -3
  180. package/dist/cli-bundle/focused-chunks/chunk-FW7CSSKL.js +0 -75
  181. package/dist/cli-bundle/focused-chunks/chunk-HYPRPSYD.js +0 -3
  182. package/dist/cli-bundle/focused-chunks/chunk-L55KQ2KT.js +0 -2
  183. package/dist/cli-bundle/focused-chunks/chunk-MASIOFPG.js +0 -8
  184. package/dist/cli-bundle/focused-chunks/chunk-RJ3EIHDU.js +0 -26
  185. package/dist/cli-bundle/focused-chunks/chunk-SEL4Z2OO.js +0 -167
  186. package/dist/cli-bundle/focused-chunks/chunk-TZUIBG3P.js +0 -2
@@ -0,0 +1,7 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();import{execFile}from"node:child_process";import{chmod,lstat}from"node:fs/promises";import{promisify}from"node:util";import{isFileMissingError,writeFileAtomic}from"../../core/fs/fs-utils.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{readBoundedRegularFile}from"./receipt-file-boundary.js";import{gitWorkspaceEnvironment}from"./worktree-config.js";const execFileAsync=promisify(execFile),HOOK_HEADER=`#!/bin/sh
2
+ # pm-cli:lossless-merge-settlement:v1
3
+ `;async function prepareMergeSettlementHook(workspaceRoot,command){const hookPath=(await execFileAsync("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:workspaceRoot,env:gitWorkspaceEnvironment(),timeout:1e4})).stdout.trim();let content,executable=!1;try{content=await readBoundedRegularFile(hookPath,65536)??"",executable=process.platform==="win32"||((await lstat(hookPath)).mode&73)!==0}catch(error){if(!isFileMissingError(error))throw error}if(content!==void 0&&!content.startsWith(HOOK_HEADER))throw new PmCliError("The pre-commit hook already exists and is not owned by pm; it was preserved.",EXIT_CODE.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});const expected=`${HOOK_HEADER}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
4
+ [ -f "$merge_head" ] || exit 0
5
+ exec ${command} merge reconcile --stage
6
+ `;return{path:hookPath,changed:content!==expected||!executable,content:expected}}async function writeMergeSettlementHook(hook){hook.changed&&(await writeFileAtomic(hook.path,hook.content),await chmod(hook.path,493))}export{prepareMergeSettlementHook,writeMergeSettlementHook};
7
+ //# sourceMappingURL=settlement-hook.js.map
@@ -0,0 +1,13 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ import type { MergeReconcileResult } from "./reconcile.js";
3
+ /** Bind preview, proof verification and staging to one physical tracker location. */
4
+ export declare function resolveMergeSettlementGlobal(global:GlobalOptions):Promise<GlobalOptions & {
5
+ path:string;
6
+ }>;
7
+ /** Stage only the verified history and receipt paths, preserving all unrelated index entries. */
8
+ export declare function stageLosslessMergeReconciliation(params:{
9
+ preview:MergeReconcileResult;
10
+ dryRun:boolean;
11
+ global:GlobalOptions;
12
+ apply:() => Promise<MergeReconcileResult>;
13
+ }):Promise<MergeReconcileResult>;
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fe5937fc-def3-5ed4-9663-70a6e9d258a1")}catch{}})();import{execFile}from"node:child_process";import{realpath}from"node:fs/promises";import path from"node:path";import{promisify}from"node:util";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{resolvePmRoot}from"../../core/store/paths.js";import{findGitWorkspaceRoot}from"./install.js";import{gitWorkspaceEnvironment}from"./worktree-config.js";import{isPathOutsideRoot}from"../workspace.js";const execFileAsync=promisify(execFile);function stagingRefusal(reason){return new PmCliError(`Automatic merge settlement refused: ${reason}`,EXIT_CODE.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function assertNormalGitIndex(git){const indexOverride=process.env.GIT_INDEX_FILE;if(indexOverride===void 0)return;const indexPath=(await git(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(path.resolve(indexOverride)!==path.resolve(indexPath))throw stagingRefusal("an alternate Git index requires explicit manual settlement")}async function newReceiptPaths(git,receiptPaths){if(receiptPaths.length===0)return[];const pathspecs=receiptPaths.map(target=>`:(literal)${target}`),indexed=new Set((await git(["ls-files","--cached","-z","--",...pathspecs])).stdout.split("\0")),missing=receiptPaths.filter(target=>!indexed.has(target)).map(target=>`:(literal)${target}`);if(missing.length>0&&(await git(["diff","--cached","--name-only","--diff-filter=D","-z","--",...missing])).stdout.length>0)throw stagingRefusal("a receipt has a staged deletion that requires explicit review");return missing}async function applyAndStage(params){const{git,preview,paths,newReceiptPathspecs}=params;let preparedReceipts=!1;try{newReceiptPathspecs.length>0&&(await git(["add","--",...newReceiptPathspecs]),preparedReceipts=!0);const result=await params.apply();if(!result.ok||JSON.stringify(result.receipts.summaries)!==JSON.stringify(preview.receipts.summaries)||result.repair.streams.some(stream=>!preview.repair.streams.some(prior=>prior.id===stream.id)))throw stagingRefusal("reconciliation changed or did not finish; inspect the audit artifacts before staging");return paths.length>0&&await git(["add","--",...paths.map(target=>`:(literal)${target}`)]),{...result,staged_paths:paths,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(error){throw preparedReceipts&&await git(["reset","--quiet","--",...newReceiptPathspecs]),error}}function assertLosslessPreview(preview){if(preview.repair.totals.failed>0||preview.receipts.missing_history_references_after>0||preview.receipts.summaries.some(receipt=>receipt.conflict_fields.length>0)||preview.repair.streams.some(stream=>stream.merge_receipt_proof?.trusted!==!0)||preview.validation.checks.some(check=>check.name!=="history_drift"&&check.status!=="ok"))throw stagingRefusal("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function resolveMergeSettlementGlobal(global2){try{return{...global2,path:await realpath(resolvePmRoot(process.cwd(),global2.path))}}catch{throw stagingRefusal("the tracker root cannot be resolved")}}async function stageLosslessMergeReconciliation(params){const{preview}=params;assertLosslessPreview(preview);const{path:pmRoot}=await resolveMergeSettlementGlobal(params.global),workspaceRoot=await findGitWorkspaceRoot(pmRoot);if(workspaceRoot===null)throw stagingRefusal("a Git workspace is required");const git=args=>execFileAsync("git",args,{cwd:workspaceRoot,env:gitWorkspaceEnvironment(),timeout:1e4});if(await assertNormalGitIndex(git),(await git(["ls-files","--unmerged","-z"])).stdout.length>0)throw stagingRefusal("Git still has unresolved paths");const paths=[...new Set([...[...new Set([...preview.repair.streams.map(stream=>stream.id),...preview.receipts.summaries.map(receipt=>receipt.item_id)])].map(id=>path.join(pmRoot,"history",`${id}.jsonl`)),...preview.receipts.summaries.map(receipt=>path.join(pmRoot,"merge-receipts",`${receipt.receipt_id}.json`))])].map(target=>path.relative(workspaceRoot,target).replaceAll("\\","/"));if(paths.some(isPathOutsideRoot))throw stagingRefusal("reconciliation artifacts must belong to this Git workspace");const pathspecs=paths.map(target=>`:(literal)${target}`),receiptPaths=preview.receipts.summaries.map(receipt=>path.relative(workspaceRoot,path.join(pmRoot,"merge-receipts",`${receipt.receipt_id}.json`)).replaceAll("\\","/"));if(pathspecs.length>0)try{await git(["diff","--quiet","--",...pathspecs])}catch{throw stagingRefusal("reconciliation paths have unstaged edits or Git cannot verify their index state")}const newReceiptPathspecs=await newReceiptPaths(git,receiptPaths);return params.dryRun?{...preview,staged_paths:[]}:applyAndStage({...params,git,paths,newReceiptPathspecs})}export{resolveMergeSettlementGlobal,stageLosslessMergeReconciliation};
2
+ //# sourceMappingURL=stage.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Compact a standard brief-list envelope without mutating its typed SDK result.
3
+ * Full, custom, partial and inconsistent receipts pass through unchanged.
4
+ * Unchecked pages retain their explicit source status, including empty pages.
5
+ * JSON hosts should retain the original result when full receipts are required.
6
+ */
7
+ export declare function projectPmBriefListEnvelope(value:unknown):unknown;
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="20b84c6a-ac5f-515e-aba1-32be7a69981c")}catch{}})();import{BRIEF_LIST_FIELDS}from"../query/projection-contracts.js";function isRecord(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}function hasStandardBriefProjection(value){if(!isRecord(value))return!1;const fields=value.fields;return value.mode==="brief"&&Object.keys(value).length===2&&Array.isArray(fields)&&fields.length===BRIEF_LIST_FIELDS.length&&BRIEF_LIST_FIELDS.every((field,index)=>fields[index]===field)}function hasStandardPagination(value,count){return typeof value.has_more=="boolean"&&value.truncated===value.has_more&&value.count===count&&typeof value.total=="number"&&Number.isSafeInteger(value.total)&&(value.has_more?value.total>count&&typeof value.next_cursor=="string"&&value.next_cursor.length>0:value.total===count&&value.next_cursor==null)}function hasCompactibleSource(value){return isRecord(value)&&(value.status==="complete"||value.status==="unchecked")&&value.unreadable_item_count===0&&value.unreadable_directory_count===0}function hasDefaultOmissions(value){if(!isRecord(value)||!Array.isArray(value.omitted_field_groups))return!1;const groups=value.omitted_field_groups,group=groups[0];return value.has_omissions===!0&&value.omitted_field_group_count===1&&Object.keys(value).length===3&&groups.length===1&&isRecord(group)&&Object.keys(group).length===2&&group.name==="full_item_fields"&&group.restore_with==="--full"}function projectPmBriefListEnvelope(value){if(!isRecord(value)||!Array.isArray(value.items)||Object.hasOwn(value,"details")||!hasStandardBriefProjection(value.projection)||!hasCompactibleSource(value.completeness)||!hasStandardPagination(value,value.items.length)||!hasDefaultOmissions(value.omission_receipt))return value;const{total,has_more:hasMore,truncated:_truncated,next_cursor:nextCursor,completeness,projection:_projection,now:_now,omission_receipt:_omissions,sorting,...rest}=value,completed=completeness.status==="complete"&&!hasMore&&Object.keys(completeness).length===3,{unreadable_item_count:_items,unreadable_directory_count:_directories,...source}=completeness;return{...rest,...completed?{}:{total,has_more:hasMore,completeness:source},...hasMore?{next_cursor:nextCursor}:{},...isRecord(sorting)&&sorting.sort==="default"&&sorting.order==="asc"&&Object.keys(sorting).length===2?{}:{sorting},details:"--full"}}export{projectPmBriefListEnvelope};
2
+ //# sourceMappingURL=list-envelope.js.map
@@ -6,6 +6,7 @@
6
6
  */
7
7
  export { SUPPRESS_HOST_OUTPUT_MARKER,isHostOutputSuppressed,suppressHostOutput,type SuppressedHostOutput,} from "../core/output/output-control.js";
8
8
  export { encodePmTableRows,decodePmTableRows,type PmTableCellEncoding,type PmEncodedTableRows,} from "./output/table-rows.js";
9
+ export { projectPmBriefListEnvelope } from "./output/list-envelope.js";
9
10
  /**
10
11
  * Serialize object rows as newline-delimited JSON without adding a trailing
11
12
  * newline. CLI hosts can append their final newline while SDK consumers can
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1a6915d3-31fe-5269-b945-caef21172c86")}catch{}})();import{SUPPRESS_HOST_OUTPUT_MARKER,isHostOutputSuppressed,suppressHostOutput}from"../core/output/output-control.js";import{encodePmTableRows,decodePmTableRows}from"./output/table-rows.js";function serializeNdjsonRows(rows){return rows.map((row,index)=>{if(typeof row!="object"||row===null||Array.isArray(row))throw new TypeError(`NDJSON row ${index} must be a non-null object.`);const serialized=JSON.stringify(row);if(serialized===void 0)throw new TypeError(`NDJSON row ${index} must serialize to a non-null object.`);const projected=JSON.parse(serialized);if(typeof projected!="object"||projected===null||Array.isArray(projected))throw new TypeError(`NDJSON row ${index} must serialize to a non-null object.`);return serialized}).join(`
2
- `)}function serializeNdjsonStream(rows,trailer){if(trailer.count!==rows.length)throw new TypeError(`NDJSON trailer count ${trailer.count} does not match ${rows.length} ${rows.length===1?"row":"rows"}.`);for(const[index,row]of rows.entries())if(typeof row=="object"&&row!==null&&!Array.isArray(row)&&Reflect.get(row,"record_type")==="pm.stream.trailer")throw new TypeError(`NDJSON row ${index} uses reserved record_type pm.stream.trailer`);return serializeNdjsonRows([...rows,{...trailer,record_type:"pm.stream.trailer"}])}export{SUPPRESS_HOST_OUTPUT_MARKER,decodePmTableRows,encodePmTableRows,isHostOutputSuppressed,serializeNdjsonRows,serializeNdjsonStream,suppressHostOutput};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6279da21-92a5-57fe-bc0e-15a02111ab41")}catch{}})();import{SUPPRESS_HOST_OUTPUT_MARKER,isHostOutputSuppressed,suppressHostOutput}from"../core/output/output-control.js";import{encodePmTableRows,decodePmTableRows}from"./output/table-rows.js";import{projectPmBriefListEnvelope}from"./output/list-envelope.js";function serializeNdjsonRows(rows){return rows.map((row,index)=>{if(typeof row!="object"||row===null||Array.isArray(row))throw new TypeError(`NDJSON row ${index} must be a non-null object.`);const serialized=JSON.stringify(row);if(serialized===void 0)throw new TypeError(`NDJSON row ${index} must serialize to a non-null object.`);const projected=JSON.parse(serialized);if(typeof projected!="object"||projected===null||Array.isArray(projected))throw new TypeError(`NDJSON row ${index} must serialize to a non-null object.`);return serialized}).join(`
2
+ `)}function serializeNdjsonStream(rows,trailer){if(trailer.count!==rows.length)throw new TypeError(`NDJSON trailer count ${trailer.count} does not match ${rows.length} ${rows.length===1?"row":"rows"}.`);for(const[index,row]of rows.entries())if(typeof row=="object"&&row!==null&&!Array.isArray(row)&&Reflect.get(row,"record_type")==="pm.stream.trailer")throw new TypeError(`NDJSON row ${index} uses reserved record_type pm.stream.trailer`);return serializeNdjsonRows([...rows,{...trailer,record_type:"pm.stream.trailer"}])}export{SUPPRESS_HOST_OUTPUT_MARKER,decodePmTableRows,encodePmTableRows,isHostOutputSuppressed,projectPmBriefListEnvelope,serializeNdjsonRows,serializeNdjsonStream,suppressHostOutput};
3
3
  //# sourceMappingURL=output.js.map