@unbrained/pm-cli 2026.11.26 → 2026.11.27

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 (112) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli-bundle/bundle-manifest.json +1 -1
  3. package/dist/cli-bundle/chunks/{chunk-LNZKNVMT.js → chunk-5CMR4R5V.js} +2 -2
  4. package/dist/cli-bundle/chunks/{chunk-7F3UFYZA.js → chunk-5M7UTO2G.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-B2GM6KOM.js → chunk-63AVXDZS.js} +2 -2
  6. package/dist/cli-bundle/chunks/{chunk-NDS4MXZX.js → chunk-66TNCHHG.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-5AAIRHNE.js → chunk-6NJ3BONB.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-HTGN24XM.js → chunk-AVHRMUXJ.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-KCRRTJ4X.js → chunk-HTT52JL3.js} +37 -37
  10. package/dist/cli-bundle/chunks/{chunk-GQXK4KKH.js → chunk-J25DZRYJ.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-QMM46SJM.js → chunk-J6TFG34A.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-IGW3RVJC.js → chunk-JX475QVU.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-MNFCJNQA.js → chunk-KP75JTTO.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-T3GJPXIZ.js → chunk-KS47NGMQ.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-PQSEEVOA.js → chunk-O23KTJL6.js} +5 -5
  16. package/dist/cli-bundle/chunks/{chunk-KES4VHU4.js → chunk-OFX2VA5Z.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-HOLQZ56F.js → chunk-QVDEZBSV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-BITDGTAX.js → chunk-SIRZ4VMT.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-XRCE4QNL.js → chunk-VC4BJIA7.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-FWBR3OW7.js → chunk-W7SPEGSP.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-WY7467RY.js +3 -0
  22. package/dist/cli-bundle/chunks/{chunk-5FY2VHRF.js → chunk-X6TE47CS.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-5BPDT7G2.js → chunk-XB6QEVUK.js} +2 -2
  24. package/dist/cli-bundle/chunks/chunk-XYX4CXFR.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-ZDL45VTB.js → chunk-Y5U7QCNX.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-CBBKXTJG.js → chunk-YGK6SA7P.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-DYL2N3OC.js → chunk-ZGV4ZXDS.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-WZOJSHJT.js → chunk-ZILIHDDY.js} +41 -41
  29. package/dist/cli-bundle/chunks/{field-option-collisions-CGRJEAPQ.js → field-option-collisions-UL6BIPAK.js} +2 -2
  30. package/dist/cli-bundle/chunks/{item-revision-FGDR5NSF.js → item-revision-WNUDY5DM.js} +2 -2
  31. package/dist/cli-bundle/chunks/item-transaction-ER3OWOPV.js +2 -0
  32. package/dist/cli-bundle/chunks/{mutation-actor-HGG47KXV.js → mutation-actor-SFYTD2ZB.js} +2 -2
  33. package/dist/cli-bundle/chunks/{mutation-admission-LLHIRY6O.js → mutation-admission-AVOOT3KH.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-list-query-EKSCZWEZ.js → register-list-query-Q7UW2EPV.js} +2 -2
  35. package/dist/cli-bundle/chunks/{register-mutation-ZIAOKKUJ.js → register-mutation-YNW7E3T4.js} +2 -2
  36. package/dist/cli-bundle/chunks/{register-operations-ECVBZ5FM.js → register-operations-DAUTQCIO.js} +2 -2
  37. package/dist/cli-bundle/chunks/{register-setup-3QYD5H4H.js → register-setup-VSURGF7V.js} +2 -2
  38. package/dist/cli-bundle/chunks/{stage-RSCSUYEJ.js → stage-N5GDBS5A.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-AAB3ZR7Z.js → chunk-24W63UPP.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-AVLB4L7M.js → chunk-2XGHBYDA.js} +5 -5
  41. package/dist/cli-bundle/focused-chunks/{chunk-JUG3BAZZ.js → chunk-3QRMY6KF.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-RDELKGLS.js → chunk-4HLZOOZI.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-52PHSTGP.js +27 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-QNWNUQSJ.js → chunk-7FKGIJEB.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-QSRXF6XS.js → chunk-7GZMOLQY.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-GQBWI4KA.js → chunk-AL47ODFZ.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-KEZ4VXYD.js → chunk-AN4NFFLL.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-FW5Q26HA.js → chunk-B2HJI6KA.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-YNRW2FWB.js → chunk-C2HW7BSE.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-IWEGGRRD.js → chunk-GISZWMBS.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-3GQRWIT5.js → chunk-GUAT4OAC.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-3BR5NWQI.js → chunk-H4JBS477.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-NSFS3VWP.js → chunk-HGJ4MILN.js} +37 -37
  54. package/dist/cli-bundle/focused-chunks/{chunk-NXUFVQ33.js → chunk-HSWL6L2O.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-RMJKVQYE.js → chunk-I4GY7HAP.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-UA2JNKMY.js → chunk-KMG4O2IU.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-YSZZSV6M.js → chunk-N7ZAMULP.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-TNVLDU7Z.js → chunk-REORRDPH.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-WHHFPATO.js → chunk-SXWUKNTY.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-FQWKESMI.js → chunk-UGQ2EXTU.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/chunk-YPOATPTX.js +3 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-VV2QF5IE.js → chunk-ZZYJS74B.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{field-option-collisions-WV6GPYYP.js → field-option-collisions-BP7ILGQK.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{item-revision-RPTXN7WW.js → item-revision-NOHVIOQQ.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{item-transaction-A6MVNPT7.js → item-transaction-O26COBOJ.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{mutation-actor-6ZVW6OME.js → mutation-actor-HVJV5S76.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/{mutation-admission-2DA4CINP.js → mutation-admission-JRICEVYN.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{stage-RG3PKST7.js → stage-NSX6ASBZ.js} +2 -2
  69. package/dist/cli-bundle/main.js +2 -2
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +1 -1
  72. package/dist/cli-bundle/sdk-core.js +1 -1
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +51 -51
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +1 -1
  80. package/dist/core/extensions/index.js +1 -1
  81. package/dist/core/shared/command-line.d.ts +2 -2
  82. package/dist/core/shared/command-line.js +1 -1
  83. package/dist/core/shared/secret-rules.js +5 -5
  84. package/docs/CONFIGURATION.md +1 -1
  85. package/docs/MUTATION_INTEGRITY.md +47 -0
  86. package/docs/SDK.md +3 -1
  87. package/marketplace.json +1 -1
  88. package/package.json +1 -1
  89. package/packages/pm-beads/package.json +1 -1
  90. package/packages/pm-calendar/package.json +1 -1
  91. package/packages/pm-command-kit/package.json +1 -1
  92. package/packages/pm-digital-twin/package.json +1 -1
  93. package/packages/pm-governance-audit/package.json +1 -1
  94. package/packages/pm-guide-shell/package.json +1 -1
  95. package/packages/pm-kanban/package.json +1 -1
  96. package/packages/pm-lifecycle-hooks/package.json +1 -1
  97. package/packages/pm-linked-test-adapters/package.json +1 -1
  98. package/packages/pm-search-advanced/package.json +1 -1
  99. package/packages/pm-templates/package.json +1 -1
  100. package/packages/pm-todos/package.json +1 -1
  101. package/packages/pm-vcs/package.json +1 -1
  102. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  103. package/plugins/pm-claude/package.json +1 -1
  104. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  105. package/plugins/pm-codex/package.json +1 -1
  106. package/plugins/pm-codex/plugin.json +1 -1
  107. package/runtime-dependencies.json +1 -1
  108. package/dist/cli-bundle/chunks/chunk-DUJSME77.js +0 -3
  109. package/dist/cli-bundle/chunks/chunk-RFK3ERYX.js +0 -2
  110. package/dist/cli-bundle/chunks/item-transaction-C3KAMEYO.js +0 -2
  111. package/dist/cli-bundle/focused-chunks/chunk-R6QFPHWW.js +0 -3
  112. package/dist/cli-bundle/focused-chunks/chunk-RFJ3MEFP.js +0 -27
@@ -1,4 +1,4 @@
1
- import{b as ne}from"./chunk-NDS4MXZX.js";import{Va as K,Xa as Q,Za as Z,_a as ee}from"./chunk-KCRRTJ4X.js";import{I as te,v as Y}from"./chunk-XRCE4QNL.js";import{Ag as X,Dc as G,Dh as J,Hc as H,Nb as z,Ng as W,Pf as j,Rf as V,Sf as B,V as $,ab as F,ba as D,hh as q,sc as P,ta as U}from"./chunk-WZOJSHJT.js";import{O as L,Q as y}from"./chunk-DUJSME77.js";import{A as c,C as u,E as k,G as E,K as C}from"./chunk-6OIHST4I.js";function ft(t,e){let n=H(t),r=t.length>0?t[t.length-1].after_hash:B(),i=e===void 0||n.item_hash_version===void 0?void 0:V(e,n.item_hash_version,F(t.at(-1)?.hash_algorithm)),a=e===void 0?void 0:i===void 0?j(e):i[Math.max(0,i.indexOf(r))],o=a===void 0?void 0:a===r,s=[...n.errors];return o===!1&&s.push("verify_failed:current_item_hash_mismatch"),{ok:s.length===0,entries:t.length,errors:s,latest_after_hash:t.length>0?t[t.length-1].after_hash:void 0,current_item_hash:a,current_matches_latest:o}}async function _t(t,e,n={}){let r=D(n.cwd??process.cwd(),n.pmRoot);await te(r);let i=await Y(r),a=$(i,J()),o=await ne(r,t,i,a.type_to_folder),s=await P(o.historyPath,o.id);if(s.length===0)throw new u(`No history exists for ${o.id}; point-in-time reads are unavailable.`,c.NOT_FOUND);let p=Q(e,s),x=ee(Z(s,p.historyIndex),p),f=G(x,{schema:i.schema});if(f.metadata.id!==o.id)throw new u(`History target resolved to item ${f.metadata.id}, expected ${o.id}.`,c.GENERIC_FAILURE);let _=s[p.historyIndex],m=K(s,!0);return{document:f,reconstructed:!0,as_of_version:m===null?null:m+p.historyIndex+1,as_of_timestamp:_.ts,target:p,history_length:s.length}}import re from"node:fs/promises";import S from"node:path";function ie(t){return[...new Set(t.map(e=>e.trim()).filter(e=>e.length>0))].sort((e,n)=>e.localeCompare(n))}function l(t){return t.trim().toLowerCase()}function Dt(t){let e=t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-"),n=0;for(;e[n]==="-";)n+=1;let r=e.length;for(;r>n&&e[r-1]==="-";)r-=1;let i=e.slice(n,r);if(i.length===0)throw new u("Extension manifest name must resolve to a non-empty directory name.",c.USAGE);if(i==="."||i==="..")throw new u('Extension manifest name must not resolve to "." or "..".',c.USAGE);return i}function ye(t){return W(t)}async function ge(t){try{let e=JSON.parse(await re.readFile(S.join(t,"package.json"),"utf8")),n=typeof e.name=="string"&&/^(?:@[a-z0-9._~-]+\/)?[a-z0-9._~-]+$/iu.test(e.name)?e.name:void 0;return{...n?{package_name:n}:{},has_build_script:["build","prepare","prepack"].some(r=>typeof e.scripts?.[r]=="string")}}catch{return{has_build_script:!1}}}async function Ee(t,e,n){if(n.source_kind!=="github"||typeof n.source_root!="string")return new u(`Extension entry file is missing at "${e}".`,c.USAGE);let r=await ge(n.source_root),i=r.package_name?`pm package install npm:${r.package_name}`:void 0,a=n.source_input??n.source_root;return new u(`Extension entry "${t.entry}" is absent from GitHub source "${a}". pm package install copies GitHub repositories without running package scripts${r.has_build_script?", and this package declares a build or publish script":""}. ${i?`Try "${i}" if the package is published, or install a locally built directory.`:"Build the source locally and install that directory, or use its published npm: package."}`,c.USAGE,{code:"github_source_entry_unbuilt",required:"Use a GitHub tree with committed runtime output, a published npm artifact, or a locally built source directory.",why:"GitHub installation is a source copy and never executes untrusted package build scripts.",examples:i?[i,`pm package install ${n.source_root}`]:[`pm package install ${n.source_root}`],nextSteps:i?[`Retry with ${i}.`,"Or build the repository locally, then install its directory."]:["Build the repository locally, then install its directory.","If it is published, retry with pm package install npm:<package-name>."],recovery:{attempted_command:`pm install ${a}`,normalized_args:["install",a],...i?{next_best_command:i}:{}}})}async function Ut(t,e={}){let n=S.join(t,"manifest.json");if(!await k(n))throw new u(`Extension manifest is missing at "${n}".`,c.USAGE);let r;try{r=JSON.parse(await re.readFile(n,"utf8"))}catch(o){throw new u(`Failed to parse extension manifest at "${n}": ${ve(o)}`,c.USAGE)}let i=ye(r);if(!i)throw new u(`Extension manifest at "${n}" is invalid.`,c.USAGE);let a=S.resolve(t,i.entry);if(!U(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory "${t}".`,c.USAGE);if(!await k(a))throw await Ee(i,a,e);if(!await q(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory after symlink resolution.`,c.USAGE);return{directory:t,manifest_path:n,entry_path:a,manifest:i}}function ve(t){return t instanceof Error?t.message:String(t)}import A from"node:fs/promises";import be from"node:path";var we=".managed-extensions.json",v=1;function b(t){return be.join(t,we)}function xe(){return{version:v,updated_at:y(),entries:[]}}function M(t){return[...t].sort((e,n)=>{let r=e.scope.localeCompare(n.scope);if(r!==0)return r;let i=e.name.localeCompare(n.name);return i!==0?i:e.directory.localeCompare(n.directory)})}function Xt(t,e){return t.kind!==e.kind||t.input!==e.input||t.location!==e.location?!1:t.kind==="npm"&&e.kind==="npm"?t.package===e.package&&t.version===e.version:t.kind==="github"&&e.kind==="github"?t.repository===e.repository&&t.ref===e.ref&&t.subpath===e.subpath&&t.commit===e.commit:t.kind==="builtin"&&e.kind==="builtin"?t.name===e.name:!0}function d(t){return typeof t=="string"?t:void 0}var ke=/^(?:npm_registry|github_remote)_lookup_timed_out$/u;function Se(t,e){let n=d(e);return n===void 0||t.kind!=="github"||n.trim().length===0||/^[a-z0-9_]+$/u.test(n.trim())?n:"github_remote_lookup_failed"}function ae(t){return typeof t=="string"&&ke.test(t.trim())}function Ae(t,e){return ae(t)&&typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{update_check_timeout_ms:e}:{}}function Me(t){return typeof t.name=="string"&&t.name.trim().length>0&&typeof t.directory=="string"&&t.directory.trim().length>0&&(t.scope==="project"||t.scope==="global")&&typeof t.manifest_version=="string"&&typeof t.manifest_entry=="string"&&Array.isArray(t.capabilities)&&t.capabilities.every(e=>typeof e=="string")&&typeof t.installed_at=="string"&&typeof t.updated_at=="string"}function Ie(t){if(typeof t!="object"||t===null)return null;let e=t;return e.kind!=="local"&&e.kind!=="github"&&e.kind!=="npm"&&e.kind!=="builtin"||typeof e.input!="string"||typeof e.location!="string"?null:{kind:e.kind,input:e.input,location:e.location,name:d(e.name),package:d(e.package),version:d(e.version),repository:d(e.repository),owner:d(e.owner),repo:d(e.repo),ref:d(e.ref),subpath:d(e.subpath),commit:d(e.commit)}}function Ne(t){if(typeof t!="object"||t===null)return null;let e=t;if(!Me(e))return null;let n=Ie(e.source);if(!n)return null;let r=X(e.contributions);return r===null?null:{name:e.name.trim(),directory:e.directory.trim(),scope:e.scope,manifest_version:e.manifest_version,manifest_entry:e.manifest_entry,capabilities:ie(e.capabilities),contributions:r,installed_at:e.installed_at,updated_at:e.updated_at,source:n,last_update_check_at:d(e.last_update_check_at),last_update_remote_commit:d(e.last_update_remote_commit),last_update_remote_version:d(e.last_update_remote_version),update_available:ae(e.update_error)?null:typeof e.update_available=="boolean"||e.update_available===null?e.update_available:void 0,update_error:Se(n,e.update_error),...Ae(e.update_error,e.update_check_timeout_ms)}}function I(t){if(typeof t!="object"||t===null)return null;let e=t;if(e.version!==v||!Array.isArray(e.entries))return null;let n=[];for(let r of e.entries){let i=Ne(r);i&&n.push(i)}return{version:v,updated_at:d(e.updated_at)??y(),entries:M(n)}}async function Wt(t){let e=b(t),n=xe();try{let r=await A.readFile(e,"utf8"),i=JSON.parse(r),a=I(i);if(!a)throw new u(`Managed extension state file "${e}" has an invalid schema. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE);return{path:e,state:a,warnings:[]}}catch(r){if(r instanceof u)throw r;if(typeof r=="object"&&r!==null&&"code"in r&&E(r))return{path:e,state:n,warnings:[]};throw new u(`Managed extension state file "${e}" could not be read. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE)}}async function Oe(t,e){let n=b(t),r={version:v,updated_at:y(),entries:M(e.entries)};await A.mkdir(t,{recursive:!0}),await A.writeFile(n,`${JSON.stringify(r,null,2)}
1
+ import{b as ne}from"./chunk-66TNCHHG.js";import{Va as K,Xa as Q,Za as Z,_a as ee}from"./chunk-HTT52JL3.js";import{I as te,v as Y}from"./chunk-VC4BJIA7.js";import{Ag as X,Dc as G,Dh as J,Hc as H,Nb as z,Ng as W,Pf as j,Rf as V,Sf as B,V as $,ab as F,ba as D,hh as q,sc as P,ta as U}from"./chunk-ZILIHDDY.js";import{O as L,Q as y}from"./chunk-WY7467RY.js";import{A as c,C as u,E as k,G as E,K as C}from"./chunk-6OIHST4I.js";function ft(t,e){let n=H(t),r=t.length>0?t[t.length-1].after_hash:B(),i=e===void 0||n.item_hash_version===void 0?void 0:V(e,n.item_hash_version,F(t.at(-1)?.hash_algorithm)),a=e===void 0?void 0:i===void 0?j(e):i[Math.max(0,i.indexOf(r))],o=a===void 0?void 0:a===r,s=[...n.errors];return o===!1&&s.push("verify_failed:current_item_hash_mismatch"),{ok:s.length===0,entries:t.length,errors:s,latest_after_hash:t.length>0?t[t.length-1].after_hash:void 0,current_item_hash:a,current_matches_latest:o}}async function _t(t,e,n={}){let r=D(n.cwd??process.cwd(),n.pmRoot);await te(r);let i=await Y(r),a=$(i,J()),o=await ne(r,t,i,a.type_to_folder),s=await P(o.historyPath,o.id);if(s.length===0)throw new u(`No history exists for ${o.id}; point-in-time reads are unavailable.`,c.NOT_FOUND);let p=Q(e,s),x=ee(Z(s,p.historyIndex),p),f=G(x,{schema:i.schema});if(f.metadata.id!==o.id)throw new u(`History target resolved to item ${f.metadata.id}, expected ${o.id}.`,c.GENERIC_FAILURE);let _=s[p.historyIndex],m=K(s,!0);return{document:f,reconstructed:!0,as_of_version:m===null?null:m+p.historyIndex+1,as_of_timestamp:_.ts,target:p,history_length:s.length}}import re from"node:fs/promises";import S from"node:path";function ie(t){return[...new Set(t.map(e=>e.trim()).filter(e=>e.length>0))].sort((e,n)=>e.localeCompare(n))}function l(t){return t.trim().toLowerCase()}function Dt(t){let e=t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-"),n=0;for(;e[n]==="-";)n+=1;let r=e.length;for(;r>n&&e[r-1]==="-";)r-=1;let i=e.slice(n,r);if(i.length===0)throw new u("Extension manifest name must resolve to a non-empty directory name.",c.USAGE);if(i==="."||i==="..")throw new u('Extension manifest name must not resolve to "." or "..".',c.USAGE);return i}function ye(t){return W(t)}async function ge(t){try{let e=JSON.parse(await re.readFile(S.join(t,"package.json"),"utf8")),n=typeof e.name=="string"&&/^(?:@[a-z0-9._~-]+\/)?[a-z0-9._~-]+$/iu.test(e.name)?e.name:void 0;return{...n?{package_name:n}:{},has_build_script:["build","prepare","prepack"].some(r=>typeof e.scripts?.[r]=="string")}}catch{return{has_build_script:!1}}}async function Ee(t,e,n){if(n.source_kind!=="github"||typeof n.source_root!="string")return new u(`Extension entry file is missing at "${e}".`,c.USAGE);let r=await ge(n.source_root),i=r.package_name?`pm package install npm:${r.package_name}`:void 0,a=n.source_input??n.source_root;return new u(`Extension entry "${t.entry}" is absent from GitHub source "${a}". pm package install copies GitHub repositories without running package scripts${r.has_build_script?", and this package declares a build or publish script":""}. ${i?`Try "${i}" if the package is published, or install a locally built directory.`:"Build the source locally and install that directory, or use its published npm: package."}`,c.USAGE,{code:"github_source_entry_unbuilt",required:"Use a GitHub tree with committed runtime output, a published npm artifact, or a locally built source directory.",why:"GitHub installation is a source copy and never executes untrusted package build scripts.",examples:i?[i,`pm package install ${n.source_root}`]:[`pm package install ${n.source_root}`],nextSteps:i?[`Retry with ${i}.`,"Or build the repository locally, then install its directory."]:["Build the repository locally, then install its directory.","If it is published, retry with pm package install npm:<package-name>."],recovery:{attempted_command:`pm install ${a}`,normalized_args:["install",a],...i?{next_best_command:i}:{}}})}async function Ut(t,e={}){let n=S.join(t,"manifest.json");if(!await k(n))throw new u(`Extension manifest is missing at "${n}".`,c.USAGE);let r;try{r=JSON.parse(await re.readFile(n,"utf8"))}catch(o){throw new u(`Failed to parse extension manifest at "${n}": ${ve(o)}`,c.USAGE)}let i=ye(r);if(!i)throw new u(`Extension manifest at "${n}" is invalid.`,c.USAGE);let a=S.resolve(t,i.entry);if(!U(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory "${t}".`,c.USAGE);if(!await k(a))throw await Ee(i,a,e);if(!await q(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory after symlink resolution.`,c.USAGE);return{directory:t,manifest_path:n,entry_path:a,manifest:i}}function ve(t){return t instanceof Error?t.message:String(t)}import A from"node:fs/promises";import be from"node:path";var we=".managed-extensions.json",v=1;function b(t){return be.join(t,we)}function xe(){return{version:v,updated_at:y(),entries:[]}}function M(t){return[...t].sort((e,n)=>{let r=e.scope.localeCompare(n.scope);if(r!==0)return r;let i=e.name.localeCompare(n.name);return i!==0?i:e.directory.localeCompare(n.directory)})}function Xt(t,e){return t.kind!==e.kind||t.input!==e.input||t.location!==e.location?!1:t.kind==="npm"&&e.kind==="npm"?t.package===e.package&&t.version===e.version:t.kind==="github"&&e.kind==="github"?t.repository===e.repository&&t.ref===e.ref&&t.subpath===e.subpath&&t.commit===e.commit:t.kind==="builtin"&&e.kind==="builtin"?t.name===e.name:!0}function d(t){return typeof t=="string"?t:void 0}var ke=/^(?:npm_registry|github_remote)_lookup_timed_out$/u;function Se(t,e){let n=d(e);return n===void 0||t.kind!=="github"||n.trim().length===0||/^[a-z0-9_]+$/u.test(n.trim())?n:"github_remote_lookup_failed"}function ae(t){return typeof t=="string"&&ke.test(t.trim())}function Ae(t,e){return ae(t)&&typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{update_check_timeout_ms:e}:{}}function Me(t){return typeof t.name=="string"&&t.name.trim().length>0&&typeof t.directory=="string"&&t.directory.trim().length>0&&(t.scope==="project"||t.scope==="global")&&typeof t.manifest_version=="string"&&typeof t.manifest_entry=="string"&&Array.isArray(t.capabilities)&&t.capabilities.every(e=>typeof e=="string")&&typeof t.installed_at=="string"&&typeof t.updated_at=="string"}function Ie(t){if(typeof t!="object"||t===null)return null;let e=t;return e.kind!=="local"&&e.kind!=="github"&&e.kind!=="npm"&&e.kind!=="builtin"||typeof e.input!="string"||typeof e.location!="string"?null:{kind:e.kind,input:e.input,location:e.location,name:d(e.name),package:d(e.package),version:d(e.version),repository:d(e.repository),owner:d(e.owner),repo:d(e.repo),ref:d(e.ref),subpath:d(e.subpath),commit:d(e.commit)}}function Ne(t){if(typeof t!="object"||t===null)return null;let e=t;if(!Me(e))return null;let n=Ie(e.source);if(!n)return null;let r=X(e.contributions);return r===null?null:{name:e.name.trim(),directory:e.directory.trim(),scope:e.scope,manifest_version:e.manifest_version,manifest_entry:e.manifest_entry,capabilities:ie(e.capabilities),contributions:r,installed_at:e.installed_at,updated_at:e.updated_at,source:n,last_update_check_at:d(e.last_update_check_at),last_update_remote_commit:d(e.last_update_remote_commit),last_update_remote_version:d(e.last_update_remote_version),update_available:ae(e.update_error)?null:typeof e.update_available=="boolean"||e.update_available===null?e.update_available:void 0,update_error:Se(n,e.update_error),...Ae(e.update_error,e.update_check_timeout_ms)}}function I(t){if(typeof t!="object"||t===null)return null;let e=t;if(e.version!==v||!Array.isArray(e.entries))return null;let n=[];for(let r of e.entries){let i=Ne(r);i&&n.push(i)}return{version:v,updated_at:d(e.updated_at)??y(),entries:M(n)}}async function Wt(t){let e=b(t),n=xe();try{let r=await A.readFile(e,"utf8"),i=JSON.parse(r),a=I(i);if(!a)throw new u(`Managed extension state file "${e}" has an invalid schema. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE);return{path:e,state:a,warnings:[]}}catch(r){if(r instanceof u)throw r;if(typeof r=="object"&&r!==null&&"code"in r&&E(r))return{path:e,state:n,warnings:[]};throw new u(`Managed extension state file "${e}" could not be read. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE)}}async function Oe(t,e){let n=b(t),r={version:v,updated_at:y(),entries:M(e.entries)};await A.mkdir(t,{recursive:!0}),await A.writeFile(n,`${JSON.stringify(r,null,2)}
2
2
  `,"utf8")}function Te(t,e){let n=t.entries.filter(r=>l(r.name)!==l(e.name)&&l(r.directory)!==l(e.directory));return n.push(e),{...t,updated_at:y(),entries:M(n)}}async function qt(t,e,n,r){let i=e.entries.find(o=>l(o.name)===l(n));if(!i)return e;let a=Te(e,{...i,contributions:r});return await Oe(t,a),a}import oe from"npm-package-arg";import N from"semver";var Re=new Set(["tag","version","range"]);function Ce(t){try{let e=oe(t),n=e.subSpec;return e.type==="alias"?n?.type:e.type}catch{return}}function O(t){if(t.kind!=="npm")return!1;let e=t.input.startsWith("npm:")?t.input.slice(4).trim():t.input.trim(),n=Ce(e);return n!==void 0&&Re.has(n)}function T(t){try{return oe.resolve("pm-version-probe",t).type==="version"}catch{return!1}}function se(t,e){let n=N.parse(t,{loose:!0}),r=N.parse(e,{loose:!0});return n===null||r===null?t!==e:N.gt(n,r)}import{constants as ce}from"node:fs";import w from"node:fs/promises";import h from"node:path";var $e="extension-update-observations.json",de=1,De=64*1024,Ue=16*1024*1024,le=1024*1024,Le=300*1e3,ue=2e3;function pe(t){return h.join(t,"runtime",$e)}var me=256;function g(t,e){let n=t[e];return typeof n=="string"&&n.length>0&&n.length<=me?n:void 0}function Fe(t){let e=Date.parse(t);return Number.isFinite(e)&&e<=Date.now()+Le}function ze(t){return t.remote_version===void 0||t.remote_version===null?null:g(t,"remote_version")}function Pe(t){if(typeof t!="object"||t===null||Array.isArray(t))return;let e=t,n=g(e,"name"),r=g(e,"installed_version"),i=g(e,"installed_updated_at"),a=g(e,"checked_at"),o=ze(e);if(!(n===void 0||r===void 0||i===void 0||o===void 0)&&!(a===void 0||!Fe(a)||typeof e.update_available!="boolean"))return{name:n,installed_version:r,installed_updated_at:i,remote_version:o,update_available:e.update_available,checked_at:a}}var Ge=".stale-cleanup",He=64*1024;async function je(t){try{let e=await w.lstat(t);return!e.isFile()||e.size>He}catch{return!1}}async function fe(t){try{return!(await w.lstat(t)).isDirectory()}catch{return!1}}async function Ve(t){let e=pe(t);try{if(await fe(h.dirname(e)))return[];let n=await _e(e,le);if(n===void 0)return[];let r=JSON.parse(n),i=typeof r=="object"&&r!==null?r:{};return(i.version===de&&Array.isArray(i.observations)?i.observations:[]).flatMap(o=>Pe(o)??[])}catch{return[]}}function Be(t=ce,e=!1){return t.O_RDONLY|(e?0:t.O_NOFOLLOW??0)|(t.O_NONBLOCK??0)}async function _e(t,e,n={}){if(n.followLinks!==!0&&!(await w.lstat(t)).isFile())return;let r=await w.open(t,Be(ce,n.followLinks===!0));try{if(!(await r.stat()).isFile())return;let i=Buffer.alloc(Math.min(De,e+1)),a=[],o=0;for(;o<=e;){let{bytesRead:s}=await r.read(i,0,Math.min(i.length,e+1-o),o);if(s===0)break;a.push(Buffer.from(i.subarray(0,s))),o+=s}return o>e?void 0:Buffer.concat(a,o).toString("utf8")}finally{await r.close()}}function Xe(t){return t.flatMap(e=>typeof e.last_update_check_at=="string"&&e.update_error===void 0&&typeof e.update_available=="boolean"&&(e.source.kind==="github"||O(e.source))&&[e.name,e.manifest_version,e.updated_at,e.last_update_remote_version??""].every(n=>n.length<=me)?[{name:e.name,installed_version:e.manifest_version,installed_updated_at:e.updated_at,remote_version:e.last_update_remote_version??e.last_update_remote_commit?.slice(0,12)??null,update_available:e.update_available,checked_at:e.last_update_check_at}]:[]).sort((e,n)=>e.name.localeCompare(n.name))}async function We(t){let e;try{e=await _e(b(t),Ue,{followLinks:!0})}catch(n){return E(n)?[]:void 0}if(e!==void 0)try{let n=JSON.parse(e),r=I(n),i=n.entries;return r!==null&&Array.isArray(i)&&i.length===r.entries.length?r.entries:void 0}catch{return}}function R(t){let e=new Map;for(let n of t){let r=`${l(n.name)}\0${n.installed_version}\0${n.installed_updated_at}`,i=e.get(r);(i===void 0||Date.parse(i.checked_at)<=Date.parse(n.checked_at))&&e.set(r,n)}return[...e.values()]}function qe(t,e){return l(t.name)===l(e.name)&&t.installed_version===e.manifest_version&&t.installed_updated_at===e.updated_at}async function Je(t,e,n){if(n.length===0)return;let r=pe(t),i=async()=>{if(await fe(h.dirname(r)))throw new Error(`${h.dirname(r)} is not a directory`)};await i();let a=h.join(t,"locks","extension-update-observations.lock");for(let s of[a,h.join(`${a}${Ge}`,"owner.json")])if(await je(s))throw new Error("update observation lock metadata is not a small regular file");let o=await z(t,"extension-update-observations",30,"pm package manage",!1,!1,ue,{maxWaitMs:ue});try{await i();let s=[...await Ve(t),...n],p=await We(e),x=(p===void 0?R(s):p.flatMap(_=>R(s.filter(m=>qe(m,_)&&he(m,_.source))))).sort((_,m)=>_.name.localeCompare(m.name)),f=`${JSON.stringify({version:de,observations:x},null,2)}
3
3
  `;if(Buffer.byteLength(f,"utf8")>le)throw new Error("update observation record exceeds its size limit");await o.fence(()=>C(r,f))}finally{await o.release()}}async function dn(t,e,n,r){if(!(r||L()))try{await Je(t,e,Xe(n));return}catch(i){let a=i?.context?.code;return typeof a=="string"&&a.length>0?`extension_update_observation_write_failed:${a}`:"extension_update_observation_write_failed"}}function ln(t,e){if(typeof e.version!="string"||e.updated_at===void 0)return;let n=l(e.name);return R(t.filter(r=>l(r.name)===n&&r.installed_version===e.version&&r.installed_updated_at===e.updated_at&&he(r,e.source)))[0]}function Ye(t,e){let n=e?.trim().toLowerCase(),r=t.remote_version?.toLowerCase();return!n||r===void 0||!/^[0-9a-f]{7,40}$/u.test(r)?!1:n.startsWith(r)!==t.update_available}function he(t,e){return e===void 0?!0:e.kind==="github"?Ye(t,e.commit):O(e)?typeof e.version=="string"&&T(e.version)&&t.remote_version!==null&&T(t.remote_version)&&se(t.remote_version,e.version)===t.update_available:t.update_available===!1}function pn(t){return t?.update_available===!0?t.remote_version??"available":null}export{ft as a,_t as b,ie as c,l as d,Dt as e,ye as f,Ut as g,b as h,M as i,Xt as j,I as k,Wt as l,Oe as m,Te as n,qt as o,O as p,se as q,Ve as r,_e as s,We as t,dn as u,ln as v,pn as w};
4
- //# sourceMappingURL=chunk-QMM46SJM.js.map
4
+ //# sourceMappingURL=chunk-J6TFG34A.js.map
@@ -1,3 +1,3 @@
1
- import{F as S,nb as T}from"./chunk-B2GM6KOM.js";import{X as c,Y as E,ba as w,ca as C}from"./chunk-DUJSME77.js";import{E as r,I as k,Q as h,e as g,f as _}from"./chunk-SX76UGEY.js";import{A as p,C as u,m as a}from"./chunk-6OIHST4I.js";var q=new Set(g),j=new Set(_),d=new Set([...a.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),U=["create","update"];function I(e){if(typeof e!="string")return"";let n=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return n.startsWith("--")?n.slice(2):n}function v(e){return e.replaceAll("_","-")}function z(e,n){let i=new Set;for(let t of e){let o=I(t);o.length>0&&o!==n&&i.add(o)}return[...i].sort((t,o)=>t.localeCompare(o))}function P(e){let n=new Set;for(let i of e??[]){let t=i.trim();t.length>0&&n.add(t)}return[...n].sort((i,t)=>i.localeCompare(t))}function Y(e){let n=new Set,i=[];for(let t of e??[]){let o=t.trim().toLowerCase();if(o.length!==0){if(!j.has(o))throw new Error(`Invalid field command "${t}". Allowed: ${_.join(", ")}.`);n.has(o)||(n.add(o),i.push(o))}}return e===void 0||i.length===0?[...U]:i}function oe(e){let n=r(e.key);if(n.length===0)throw new Error("Field key must not be empty.");if(n.includes(","))throw new Error(`Field key "${n}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(d.has(n))throw new Error(`Cannot define custom field "${n}": custom schema field "${n}" collides with built-in item metadata "${n}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...d].sort((N,R)=>N.localeCompare(R)).join(", ")}.`);let i=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!q.has(i))throw new Error(`Invalid field type "${e.type}". Allowed: ${g.join(", ")}.`);let t=i,o=Y(e.commands),l=I(e.cliFlag),s=l.length>0&&l!==v(n)?l:void 0,f=s??v(n),b=z(e.aliases??[],f),m=e.description?.trim();return{key:n,type:t,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:b,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:P(e.requiredTypes)}}function B(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let n=e;if(Array.isArray(n.fields))return n.fields;if(Array.isArray(n.definitions))return n.definitions}function K(e){let n=B(e);if(!n)return[];let i=[];for(let t of n){if(typeof t!="object"||t===null||Array.isArray(t))continue;let o=t;typeof o.key!="string"||o.key.trim().length===0||i.push(o)}return i}function le(e){if(e==null||e.trim().length===0)return{fields:[]};let n;try{n=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:K(n)}}function se(e){return`${JSON.stringify({fields:e.fields},null,2)}
1
+ import{F as S,nb as T}from"./chunk-63AVXDZS.js";import{X as c,Y as E,ba as w,ca as C}from"./chunk-WY7467RY.js";import{E as r,I as k,Q as h,e as g,f as _}from"./chunk-SX76UGEY.js";import{A as p,C as u,m as a}from"./chunk-6OIHST4I.js";var q=new Set(g),j=new Set(_),d=new Set([...a.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),U=["create","update"];function I(e){if(typeof e!="string")return"";let n=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return n.startsWith("--")?n.slice(2):n}function v(e){return e.replaceAll("_","-")}function z(e,n){let i=new Set;for(let t of e){let o=I(t);o.length>0&&o!==n&&i.add(o)}return[...i].sort((t,o)=>t.localeCompare(o))}function P(e){let n=new Set;for(let i of e??[]){let t=i.trim();t.length>0&&n.add(t)}return[...n].sort((i,t)=>i.localeCompare(t))}function Y(e){let n=new Set,i=[];for(let t of e??[]){let o=t.trim().toLowerCase();if(o.length!==0){if(!j.has(o))throw new Error(`Invalid field command "${t}". Allowed: ${_.join(", ")}.`);n.has(o)||(n.add(o),i.push(o))}}return e===void 0||i.length===0?[...U]:i}function oe(e){let n=r(e.key);if(n.length===0)throw new Error("Field key must not be empty.");if(n.includes(","))throw new Error(`Field key "${n}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(d.has(n))throw new Error(`Cannot define custom field "${n}": custom schema field "${n}" collides with built-in item metadata "${n}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...d].sort((N,R)=>N.localeCompare(R)).join(", ")}.`);let i=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!q.has(i))throw new Error(`Invalid field type "${e.type}". Allowed: ${g.join(", ")}.`);let t=i,o=Y(e.commands),l=I(e.cliFlag),s=l.length>0&&l!==v(n)?l:void 0,f=s??v(n),b=z(e.aliases??[],f),m=e.description?.trim();return{key:n,type:t,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:b,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:P(e.requiredTypes)}}function B(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let n=e;if(Array.isArray(n.fields))return n.fields;if(Array.isArray(n.definitions))return n.definitions}function K(e){let n=B(e);if(!n)return[];let i=[];for(let t of n){if(typeof t!="object"||t===null||Array.isArray(t))continue;let o=t;typeof o.key!="string"||o.key.trim().length===0||i.push(o)}return i}function le(e){if(e==null||e.trim().length===0)return{fields:[]};let n;try{n=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:K(n)}}function se(e){return`${JSON.stringify({fields:e.fields},null,2)}
2
2
  `}function re(e,n){let i=e.fields.find(s=>r(s.key)===n.key),t=i!==void 0,o=e.fields.filter(s=>r(s.key)!==n.key),l={...i,key:n.key,type:n.type,commands:[...n.commands]};return O(l,"description",n.description),O(l,"cli_flag",n.cliFlag),n.cliAliases.length>0?l.cli_aliases=[...n.cliAliases]:delete l.cli_aliases,x(l,"required",n.required),x(l,"required_on_create",n.requiredOnCreate),n.allowUnset===!1?l.allow_unset=!1:delete l.allow_unset,n.requiredTypes.length>0?l.required_types=[...n.requiredTypes]:delete l.required_types,o.push(l),o.sort((s,f)=>r(s.key).localeCompare(r(f.key))),{file:{fields:o},definition:l,replaced:t}}function ae(e,n){let i=r(n);if(i.length===0)throw new Error("Field key must not be empty.");let t=[],o=e.fields.filter(l=>r(l.key)===i?(t.push(l),!1):!0);return t.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:t[0]}}function O(e,n,i){let t=e;i!==void 0&&i.length>0?t[n]=i:delete t[n]}function x(e,n,i){let t=e;i?t[n]=!0:delete t[n]}function $(e){return e.trim().toLowerCase().replace(/^-+/u,"")}function L(e){let n=$(e),i=C({key:n,cli_flag:n,cli_aliases:[]});return[...new Set([...i,w(n)])]}var G=new Set(a.filter(e=>!d.has(e))),J={flag:"--help",short:"-h"},D=new Map;function V(e){let n=D.get(e);if(n===void 0){let i=new Map,t=new Map;for(let o of[...T(e),...S,J]){for(let l of[o.flag,...o.aliases??[]].flatMap(L))i.has(l)||i.set(l,o.flag);o.short!==void 0&&!t.has(o.short)&&t.set(o.short,o.flag)}n={long:i,short:t},D.set(e,n)}return n}function H(e,n){return c(e)?n.short.get(e.trim()):L(e).map(i=>n.long.get(i)).find(i=>i!==void 0)}function F(e){let n=[];for(let i of e){let t=[...new Set([i.cli_flag,...i.cli_aliases,i.key].map(o=>c(o)?o.trim():$(o)))];for(let o of i.commands)n.push(...W(i.key,t,o.replaceAll("_","-")))}return n.sort((i,t)=>i.field.localeCompare(t.field)||i.command.localeCompare(t.command)||i.option.localeCompare(t.option))}function W(e,n,i){let t=V(i),o=new Map;for(let l of n){if(G.has(e)&&l.replaceAll("-","_")===e)continue;let s=H(l,t);s===void 0||o.has(s)||o.set(s,{field:e,command:i,field_flag:c(l)?l:`--${l.replaceAll("_","-")}`,option:s})}return[...o.values()]}function X(e){return F([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases,commands:e.commands}])}function A(e){return e.flatMap(n=>[...new Set([n.cli_flag,...n.cli_aliases])].flatMap(i=>{let t=E(i);return t===void 0?[]:[{field:n.key,spelling:i,reason:t}]}))}function Q(e){return A([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases}])}function Z(e){return`${JSON.stringify(e.spelling)} ${e.reason}`}function ee(e){return`${e.field_flag} shadows built-in ${e.option} on pm ${e.command}`}function ye(e,n){let i=h(e).definitions,t=F(i),o=A(i),l=o.length===0?{details:{},warnings:[]}:{details:{schema_field_flag_invalid_count:o.length,schema_field_flag_invalid:o.slice(0,n),schema_field_flag_invalid_truncated:o.length>n,schema_field_flag_invalid_fix_hint:"Re-register the field with one flag and one spelling per alias: pm schema add-field <key> --cli-flag <flag> --alias <alias>. A short alias is one dash and one character. Edit a field defined inline in settings.json there."},warnings:[`validate_schema_field_flag_invalid:${o.length}`]};return t.length===0?l:{details:{...l.details,schema_field_option_collision_count:t.length,schema_field_option_collisions:t.slice(0,n),schema_field_option_collisions_truncated:t.length>n,schema_field_option_collision_fix_hint:"Rename a file-backed field without losing item values: pm schema rename-field <key> --to <new-key>. For a colliding flag, alias or command list, re-register the same key: pm schema add-field <key> --cli-flag <flag> --commands <commands>. Edit a field defined inline in settings.json there."},warnings:[...l.warnings,`validate_schema_field_option_collision:${t.length}`]}}function Fe(e){y(e.key,Q(e)),M(e.key,e.commands,X(e))}function Ae(e){let n=[e.cli_flag,...Array.isArray(e.cli_aliases)?e.cli_aliases:[]].filter(t=>typeof t=="string");y(e.key,n.filter(t=>k(t).length===0).map(t=>({field:e.key,spelling:t,reason:"is empty"})));let i=h({fields:[e]}).definitions;y(e.key,A(i)),M(e.key,i.flatMap(t=>t.commands),F(i))}function y(e,n){if(n.length!==0)throw new u(`Cannot define custom field "${e}": flag ${n.map(Z).join("; ")}. The command it is registered for could not register it as one option.`,p.USAGE,{code:"schema_field_flag_invalid",field:e,flag:n[0].spelling,required:"Each custom field flag and alias must be one option spelling: a long name without spaces, pipes, commas, '=' or brackets, or a short flag of one dash and one character.",nextSteps:[`Pass one spelling per --alias, for example pm schema add-field ${e} --alias <first> --alias <second>.`]})}function M(e,n,i){if(i.length===0)return;let t={key:e,commands:n},o=new Set(i.map(s=>s.command)),l=t.commands.filter(s=>!o.has(s.replaceAll("_","-")));throw new u(`Cannot define custom field "${t.key}": ${i.map(ee).join("; ")}. The built-in option would stop working for that command.`,p.USAGE,{code:"schema_field_option_collision",field:t.key,flag:i[0].option,required:"A custom field's key, flag and aliases must differ from every built-in option of each command it is registered for.",nextSteps:[`Rename the field with a project-specific prefix, for example pm schema add-field project_${t.key}.`,...l.length>0?[`Or register "${t.key}" only where its option is free: --commands ${l.join(",")}.`]:[]]})}export{oe as a,le as b,se as c,re as d,ae as e,F as f,X as g,A as h,Q as i,Z as j,ee as k,ye as l,Fe as m,Ae as n};
3
- //# sourceMappingURL=chunk-IGW3RVJC.js.map
3
+ //# sourceMappingURL=chunk-JX475QVU.js.map