@unbrained/pm-cli 2026.10.5 → 2026.10.6
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 +26 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/runtime/projection-retry.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +158 -158
- package/dist/cli-bundle/chunks/{chunk-Z66DWDAU.js → chunk-25EW53VO.js} +39 -38
- package/dist/cli-bundle/chunks/{chunk-YVBRASXO.js → chunk-3CCVTV6Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5MNOWZPN.js → chunk-3REXBTST.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-4WB55TBC.js +80 -0
- package/dist/cli-bundle/chunks/{chunk-OOLYASYJ.js → chunk-6STTPXOC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AJ7H6XUF.js → chunk-ATB4ZZBQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N4YGSG6F.js → chunk-D4G43LBV.js} +38 -38
- package/dist/cli-bundle/chunks/{chunk-HRJ6G6ZG.js → chunk-K6D6DMRT.js} +28 -28
- package/dist/cli-bundle/chunks/chunk-KIRHWPZB.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O67BH435.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-3CYOBJUK.js → chunk-RJHLD64E.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WFZ4UEOB.js → chunk-TUKO5NF7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VZ63DEVJ.js → chunk-XJD47LUH.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-75QXHIFH.js → register-list-query-53WYLNZT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-YS54SCHG.js → register-mutation-34XXUBVI.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-6KHZQSYJ.js → register-operations-WANO6EIM.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-WT37UPBQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GITOYRUW.js → chunk-6KFKQD2D.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UDYRVBOZ.js → chunk-FOHRPFIT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DDRN42PB.js → chunk-GRQXL5G5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ABV67XCC.js → chunk-JZ4WGUVH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B5RSLVE6.js → chunk-NM3PM6O6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OT7HK7SG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2CVX3KR3.js → chunk-PCLU34KB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5C3IDDW7.js → chunk-QQIE4L42.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RPUNVKXK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LE4JUCRR.js → chunk-RXSVJPZ7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SPN5QTZ3.js +30 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CLDPTMQY.js → chunk-SUZJNPGB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YMU42COG.js → chunk-W4BG5HHS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C224METM.js → chunk-Y5HXFDTZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ECBOPEJE.js → chunk-ZK5SOOPC.js} +61 -61
- package/dist/cli-bundle/focused-chunks/chunk-ZQK2XUSS.js +12 -0
- package/dist/cli-bundle/main.js +21 -21
- 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 +31 -30
- 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 +42 -42
- 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 +2 -2
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +5 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/extension/managed-state.d.ts +2 -0
- package/dist/sdk/extension/managed-state.js +1 -1
- package/dist/sdk/extension/managed-update-status.d.ts +3 -0
- package/dist/sdk/extension/managed-update-status.js +2 -0
- package/dist/sdk/extension/source-resolution.d.ts +2 -6
- package/dist/sdk/extension/source-resolution.js +1 -1
- package/dist/sdk/extension/update-check.d.ts +10 -0
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -1
- package/dist/sdk/extension.d.ts +4 -0
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/test/execution.d.ts +2 -1
- package/dist/sdk/test/execution.js +3 -3
- package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +36 -0
- package/docs/GET_READ_EVIDENCE.md +17 -1
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +23 -0
- package/docs/PR_REVIEW_LOOP.md +21 -4
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +18 -0
- package/docs/SDK_CONFIGURATION_SAFETY.md +123 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- package/package.json +3 -3
- 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-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-D332RXZ7.js +0 -80
- package/dist/cli-bundle/chunks/chunk-KRVI56QE.js +0 -6
- package/dist/cli-bundle/chunks/chunk-TGMONGWX.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-RTATEN2M.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-DOVTUKJQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GUIF3WVC.js +0 -30
- package/dist/cli-bundle/focused-chunks/chunk-RHIH6XIW.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-XV5RV4ZT.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as D,s as q}from"./chunk-
|
|
1
|
+
import{r as D,s as q}from"./chunk-FOHRPFIT.js";import{Yb as N,cc as z,ec as _}from"./chunk-6KFKQD2D.js";import{ed as C,ee as x,hd as L,ka as k,kd as j,pa as m,sb as O,ua as b,xa as S}from"./chunk-SPN5QTZ3.js";import{constants as p}from"node:fs";import{lstat as M,mkdir as $,open as F}from"node:fs/promises";import h from"node:path";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function E(r,e){if(typeof r!="string"||r.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return r.trim()}function I(r,e){let t=e.require(r.kind),i=t.direction==="undirected"?[r.source,r.target].sort().join("\0"):`${r.source}\0${r.target}`;return`${t.kind}\0${i}`}function H(r){return Object.freeze({...r,...r.payload===void 0?{}:{payload:Object.freeze(structuredClone(r.payload))}})}function J(r,e,t,i){let n=t.require(r.kind),o=i.outgoingOne.get(`${n.kind}\0${r.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${n.kind}`);let s=i.incomingOne.get(`${n.kind}\0${r.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${n.kind}`);let c=I(r,t),a=i.identities.get(c);if(a!==void 0&&a!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function K(r){let e=new Map;for(let t of r)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function G(r,e,t){if(r.expectedVersion!==void 0&&r.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${r.expectedVersion}, current ${e}`);let i=E(r.eventId,"eventId");if(t.has(i))throw new TypeError(`Relationship event already exists: ${i}`);if(r.action!=="add"&&r.action!=="remove"&&r.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${r.action}`);if(!Number.isFinite(Date.parse(r.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:i,relationshipId:E(r.relationshipId,"relationshipId"),author:E(r.author,"author"),timestamp:new Date(r.timestamp).toISOString()}}function Q(r,e,t,i,n,o){let s=t.has(e);if(r.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(r.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(r.action==="remove")return;if(!r.edge)throw new TypeError(`Relationship ${r.action} event requires an edge`);let c=typeof r.edge.source=="string"?r.edge.source.trim():"",a=typeof r.edge.target=="string"?r.edge.target.trim():"";if(!i.has(c)||!i.has(a))throw new TypeError(`Relationship endpoint not found: ${c} -> ${a}`);let d=new m([c,a],[r.edge],n).edges()[0];return J(d,e,n,o),H(d)}var T=class{#t;#i;#r=[];#o=new Set;#e=new Map;#n={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#i=t.registry??k()}get version(){return this.#r.length}events(){return Object.freeze([...this.#r])}*stream(e={}){let t=e.fromVersion??1,i=e.toVersion??this.version,n=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${i}`);if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>i+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<i;o+=n)yield Object.freeze(this.#r.slice(o,Math.min(o+n,i)))}project(e,t,i={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let n=e,o=0,s;for(let c of this.stream({...i,batchSize:256}))for(let a of c)n=t(n,a),o+=1,s=a;return Object.freeze({state:n,version:s?.sequence??Math.max(0,(i.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let i=this.#i.require(t.kind);this.#n.identities.set(I(t,this.#i),e),i.outgoing==="one"&&this.#n.outgoingOne.set(`${i.kind}\0${t.source}`,e),i.incoming==="one"&&this.#n.incomingOne.set(`${i.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#n.identities.delete(I(e,this.#i)),t.outgoing==="one"&&this.#n.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#n.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=G(e,this.version,this.#o),i=this.#e.get(t.relationshipId),n=Q(e,t.relationshipId,this.#e,this.#t,this.#i,this.#n),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...n===void 0?{}:{edge:n},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#r.push(o),this.#o.add(t.eventId),i&&this.#a(i),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,n),this.#s(t.relationshipId,n)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#r.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#r.slice(0,o)}let i=K(t),n=new m(this.#t,i.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:n.edges(),graph:n})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=C("relationship-events",{order:"append-sequence"}),i=e.cursor===void 0?this.version:Number(L(e.cursor,t).snapshot);if(!Number.isSafeInteger(i)||i<0||i>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let n=j(this.#r.slice(0,i),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(i)});return{version:i,events:n.rows,hasMore:n.has_more,...n.next_cursor?{nextCursor:n.next_cursor}:{}}}},Y="relationship-event-store",A=p.O_NOFOLLOW;function g(r){return x(r,Y,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(r,e="relationships/events.jsonl"){let t=h.resolve(r),i=h.resolve(t,e),n=h.relative(t,i);if(n.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(n===".."||n.startsWith(`..${h.sep}`)||h.isAbsolute(n))throw new TypeError("Relationship event path must stay within the tracker root");if(await $(t,{recursive:!0}),(await M(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=t;for(let s of n.split(h.sep)){o=h.join(o,s);try{if((await M(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(b(c))break;throw c}}return i}async function w(r,e,t){let i=new T(e,{registry:t}),n,o;try{o=await F(r,p.O_RDONLY|A),n=await o.readFile("utf8")}catch(c){if(b(c))return{log:i,raw:""};throw c}finally{await o?.close()}let s=n.split(`
|
|
2
2
|
`);for(let c=0;c<s.length;c+=1){let a=s[c].trim();if(!a)continue;let d;try{d=JSON.parse(a)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(d.sequence!==i.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);i.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:i.version})}return{log:i,raw:n}}function U(r,e,t,i){let n=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new m(t,[e.edge],i).edges()[0]),r.eventId===e.eventId.trim()&&r.relationshipId===e.relationshipId.trim()&&r.action===e.action&&r.author===e.author.trim()&&Number.isFinite(n)&&r.timestamp===new Date(n).toISOString()&&r.reason===(e.reason?.trim()||void 0)&&O(r.edge)===O(o)}var V=class r{#t;#i;#r;#o;#e;constructor(e,t,i,n){this.#t=e.pmRoot,this.#i=t,this.#r=e.registry,this.#o=i,this.#e=n}static async open(e){let t=Object.freeze([...e.nodes]),i=await f(e.pmRoot,e.relativePath),n=await g(e.pmRoot);try{await f(e.pmRoot,i);let{log:o}=await w(i,t,e.registry);return new r(e,t,i,o)}finally{await n()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#n(),this.#e.version}async append(e){let t=await g(this.#t);try{let i=await f(this.#t,this.#o),{log:n}=await w(i,this.#i,this.#r),o=n.append(e);await $(h.dirname(i),{recursive:!0}),await f(this.#t,i);let s=await F(i,p.O_APPEND|p.O_CREAT|p.O_WRONLY|A);try{await s.appendFile(`${JSON.stringify(o)}
|
|
3
3
|
`,"utf8")}finally{await s.close()}return this.#e=n,o}finally{await t()}}async appendBatch(e,t={}){let i=await g(this.#t);try{let n=await f(this.#t,this.#o),{log:o,raw:s}=await w(n,this.#i,this.#r),c=o.version,a=new Map(o.events().map(l=>[l.eventId,l])),d=[],R=[];for(let l of e){let u=l.eventId.trim(),v=a.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&U(v,l,this.#i,this.#r)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let y=o.append(l);a.set(y.eventId,y),d.push(y)}if(d.length>0){let l=s.length===0||s.endsWith(`
|
|
4
4
|
`)?s:`${s}
|
|
5
5
|
`;await $(h.dirname(n),{recursive:!0}),await f(this.#t,n),await S(n,`${l}${d.map(u=>JSON.stringify(u)).join(`
|
|
6
6
|
`)}
|
|
7
7
|
`)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(d),skipped_event_ids:Object.freeze(R)})}finally{await i()}}async snapshot(e={}){return this.#e=await this.#n(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#n(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#n(),yield*this.#e.stream(e)}async project(e,t,i={}){return this.#e=await this.#n(),this.#e.project(e,t,i)}async#n(){let e=await g(this.#t);try{let t=await f(this.#t,this.#o);return(await w(t,this.#i,this.#r)).log}finally{await e()}}};(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="73852fdf-f072-51ab-9449-d7922712eeb4")}catch{}})();function P(r){return[...r].sort().join("\0")}function X(r,e,t){let i=r.successors.get(e);i?i.push(t):r.successors.set(e,[t]);let n=r.predecessors.get(t);n?n.push(e):r.predecessors.set(t,[e])}function W(r,e,t,i,n){let o=e.resolve(n);if(o?.ordering!==!0)return;let s=z(i),c=s===void 0?void 0:r.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let a=(o.precedence??"source_before_target")==="source_before_target";X(r,a?t:c,a?c:t)}function Z(r,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},i=r.filter(n=>typeof n?.id=="string"&&n.id.trim().length>0);for(let n of i){let o=n.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let n of i){let o=n.id.trim();W(t,e,o,n.blocked_by,"blocked_by");for(let s of n.dependencies??[])typeof s!="object"||s===null||W(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let n of[t.successors,t.predecessors])for(let o of n.values())o.sort();return t}function ee(r,e){let t=new Set([e]),i=[e];for(;i.length>0;){let n=i.pop();for(let o of[r.successors,r.predecessors])for(let s of o.get(n)??[])t.has(s)||(t.add(s),i.push(s))}return t}function te(r,e){let t=new Map;for(let i of e){let n=(r.successors.get(i)??[]).filter(o=>e.has(o));n.length>0&&t.set(i,n)}return t}function B(r,e,t){let i=Z(r,e),n=i.canonicalIds.get(t.trim().toLowerCase());if(n===void 0)return{cycles:[],successors:new Map,canonical:t};let o=te(i,ee(i,n));return{cycles:D(o).filter(s=>s.includes(n)),successors:o,canonical:n}}function ie(r,e,t){let i=new Set(e),n=i.has(t)?t:e[0];if(r.get(n)?.includes(n))return[n,n];for(let o of r.get(n)??[]){if(!i.has(o))continue;let s=re(r,i,n,o);if(s)return s}return[...e,e[0]]}function re(r,e,t,i){let n=[[i]],o=new Set([t,i]);for(;n.length>0;){let s=n.shift(),c=s.at(-1);for(let a of r.get(c)??[]){if(a===t)return[t,...s,t];!e.has(a)||o.has(a)||(o.add(a),n.push([...s,a]))}}}function me(r,e,t){let i=N(),n=B(r,i,t),o=B(e,i,t),s=new Set(n.cycles.map(P)),c=new Set(_(r,void 0,i).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[..._(e,void 0,i).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${q(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(P(a))).map(a=>`ordering_cycle_created:${ie(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}export{T as a,V as b,me as c};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-GRQXL5G5.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-
|
|
1
|
+
import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-SUZJNPGB.js";import{M as H,a as $,b as D}from"./chunk-OT7HK7SG.js";import{c as u,f as M,g as z,i as q}from"./chunk-RXSVJPZ7.js";import{Va as F,q as L,t as R}from"./chunk-W4BG5HHS.js";import{e as f,h as K}from"./chunk-NM3PM6O6.js";import{Ha as k,a as N,e as O,f as A,g as x,h as C,o as P}from"./chunk-SPN5QTZ3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=A,Le=x;function G(e,t,n,r){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),o=n.has(s);return{long:t,...r?{short:r}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),r=[];for(let s of L(e.map(o=>({...o})))){r.push(G(s,s.flag,n,s.short));for(let o of s.aliases??[])r.push(G(s,o,n))}return r}var Re=Q(R,$),Fe=Q(F,D);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="59d16a38-d6df-5695-96e3-28b6e384f76b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
|
|
2
2
|
|
|
3
3
|
## I want
|
|
4
4
|
|
|
@@ -23,4 +23,4 @@ import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-CL
|
|
|
23
23
|
|
|
24
24
|
## Conclusion
|
|
25
25
|
`}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ne(e){if(e===void 0)return;let t=p(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(_.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${_.join(", ")}.`)}function qe(e){let t=ne(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${_.join(", ")}.`);return I[t]}function je(){return _.map(e=>I[e])}function p(e){return e.trim().toLowerCase().replaceAll("-","_")}function J(e){return e.map(t=>t.definition.name).join(", ")}function re(e=[]){let t=_.map(o=>({definition:I[o],source:"builtin"})),n=new Set(_.map(o=>p(o))),r=new Set(n),s=[];for(let o of e){let a=p(o.profile.name);if(n.has(a)){s.push(`Extension "${o.name}" profile "${o.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(r.has(a)){s.push(`Profile "${o.profile.name}" from extension "${o.name}" duplicates an already-registered profile and was ignored.`);continue}r.add(a),t.push({definition:o.profile,source:"extension",package:o.name})}return{profiles:t,warnings:s}}function Be(e,t=[]){let{profiles:n,warnings:r}=re(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let s=p(e),o=n.find(a=>p(a.definition.name)===s);if(o===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:o,warnings:r}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ab26bcb3-fb2a-5f2f-96e7-7965787b924e")}catch{}})();function se(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Ye(e){return{name:e.name,title:e.title,summary:e.summary,composition:se(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>h(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>y(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function S(e,t){try{return e()}catch{return t()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ae4f6da-17c5-5024-89a2-bb0a4be9a683")}catch{}})();var oe=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ae=new Map(oe.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function b(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ae.get(t)}function ie(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function le(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function ce(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function de(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function me(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function pe(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function v(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ie(e,t);if(e.kind==="string")return le(e,t,n);let r=ce(e,t,n);return r.ok?e.kind==="integer"?de(e,t,r.value):e.kind==="ratio"?me(e,t,r.value):pe(e,t,r.value):{ok:!1,error:r.error}}function V(e,t){let n=t.path.split("."),r=e;for(let s of n){if(typeof r!="object"||r===null)return null;let o=Object.getOwnPropertyDescriptor(r,s);if(!o||!Object.hasOwn(o,"value"))return null;r=o.value}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function Ge(e,t,n){let r=t.path.split(".");if(r.some(a=>a.length===0||["__proto__","constructor","prototype"].includes(a)))throw new Error("Unsafe settings path");let s=e;for(let a=0;a<r.length-1;a+=1){let i=r[a],c=Object.getOwnPropertyDescriptor(s,i)?.value;if(typeof c!="object"||c===null||Array.isArray(c)){let d={};Object.defineProperty(s,i,{value:d,writable:!0,enumerable:!0,configurable:!0}),s=d}else s=c}let o=r[r.length-1];return Object.getOwnPropertyDescriptor(s,o)?.value===n?!1:(Object.defineProperty(s,o,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b04624c-2096-55dc-9dde-b8c76ead72d6")}catch{}})();var it=["profile","types","statuses","fields","workflows","config","templates","packages"],lt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],ue=new Set(K.flatMap(e=>[f(e.id),...(e.aliases??[]).map(t=>f(t))]).filter(e=>e.length>0)),Z=new Set(P.map(e=>e.toLowerCase()));function ye(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==p(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${p(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function he(e,t){let n=new Set,r=new Set;for(let[s,o]of e.types.entries()){let a;try{a=u(o).name}catch(c){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof o.name=="string"?o.name:`#${s}`,message:k(c)});continue}let i=a.toLowerCase();if(r.has(i)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:a,message:`Item type "${a}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(i),n.add(i)}return n}function ge(e,t){let n=new Set,r=new Set;for(let[s,o]of e.statuses.entries()){let a;try{a=h(o)}catch(i){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof o.id=="string"?o.id:`#${s}`,message:k(i)});continue}if(r.has(a.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:a.id,message:`Status "${a.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(a.id),n.add(a.id);for(let i of a.aliases??[])n.add(f(i))}return n}function fe(e,t){let n=new Set;for(let[r,s]of e.fields.entries()){let o;try{o=y(s).key}catch(i){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof s.key=="string"?s.key:`#${r}`,message:k(i)});continue}if(n.has(o)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:o,message:`Field "${o}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(o);let a=H(o);a&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:o,message:`Field "${o}" collides with canonical MCP property "${a.property}" owned by ${a.owner}; callers must pass the custom value through ${a.nested_path}.`})}}function _e(e,t,n,r){let s=new Set;for(let[o,a]of e.workflows.entries()){let i=a.type.trim().toLowerCase();if(i.length===0){r.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${o}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let c=s.has(i);s.add(i),c?r.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:a.type,message:`Workflow type "${a.type}" is declared more than once; the later transition set wins.`}):!Z.has(i)&&!t.has(i)&&r.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:a.type,message:`Workflow governs type "${a.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let d=new Set;for(let l of a.allowed_transitions){let m=f(l[0]),T=f(l[1]);if(m.length===0||T.length===0){r.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:a.type,message:`Workflow "${a.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let g of[m,T])ue.has(g)||n.has(g)||d.has(g)||(d.add(g),r.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:g,message:`Workflow "${a.type}" references status "${g}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ke(e,t){let n=new Set;for(let r of e.config){let s=b(r.key);if(s===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:r.key,message:`Config knob "${r.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(s.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:s.key,message:`Config knob "${s.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(s.key);let o=v(s,r.value);o.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:r.key,message:o.error.message})}}function we(e,t,n){for(let r of e.templates){let s=r.options.type;if(typeof s!="string"||s.trim().length===0)continue;let o=s.trim().toLowerCase();!Z.has(o)&&!t.has(o)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:r.name,message:`Template "${r.name}" creates type "${s}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,r]of e.packages.entries())r.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function ct(e){let t=[];ye(e,t);let n=he(e,t),r=ge(e,t);fe(e,t),_e(e,n,r,t),ke(e,t),we(e,n,t),be(e,t);let s=t.filter(a=>a.severity==="error").length,o=t.length-s;return{profile:e.name,ok:s===0,findings:t,errorCount:s,warningCount:o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be2b507d-2797-570c-b211-46d950edcbde")}catch{}})();function E(e,t,n,r,s){let o=e,a=[];for(let i of t){let c=r(o),d=s(o,i),l=r(d.file);o=d.file;let m=c===l?"unchanged":d.replaced?"update":"add";a.push({key:n(i),status:m})}return{file:o,changes:a,changed:a.some(i=>i.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(s=>({...s})),r=[];for(let s of t){let o=n.findIndex(i=>i.type===s.type),a={type:s.type,allowed_transitions:s.allowed_transitions};o<0?(n.push(a),r.push({type:s.type,status:"add"})):ee(n[o].allowed_transitions)===ee(s.allowed_transitions)?r.push({type:s.type,status:"unchanged"}):(n[o]=a,r.push({type:s.type,status:"update"}))}return{changes:r,result:n,changed:r.some(s=>s.status!=="unchanged")}}function Ie(e,t){let n=[];for(let r of e.config){let s=b(r.key);if(s===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${r.key}".`);let o=v(s,r.value);if(!o.ok)throw new Error(`Profile "${e.name}" config ${r.key}: ${o.error.message}`);let a=V(t,s),i=a===null?"add":a===o.parsed.value?"unchanged":"update";n.push({key:s.key,path:s.path,value:o.parsed.value,status:i})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r));return JSON.stringify(t)}function Se(e,t){let n=[];for(let r of e.templates){let s=t.get(r.name),o;s===void 0?o="add":te(s)===te(r.options)?o="unchanged":o="update",n.push({name:r.name,options:r.options,status:o})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function ht(e,t){let n=E(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),r=E(X(t.statusesRaw),e.statuses,l=>h(l).id,W,(l,m)=>Y(l,h(m))),s=E(j(t.fieldsRaw),e.fields,l=>y(l).key,B,(l,m)=>U(l,y(m))),o=ve(t.workflows,e.workflows),a=Ie(e,t.settings),i=Se(e,t.templates),c=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),d=n.changed||r.changed||s.changed||o.changed||a.changed||i.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:r,fields:s,workflows:o,config:a,templates:i,packages:c,changed:d}}export{Ce as a,Pe as b,$e as c,De as d,Le as e,Q as f,Re as g,Fe as h,_ as i,I as j,ne as k,qe as l,je as m,re as n,Be as o,se as p,Ye as q,oe as r,b as s,v as t,V as u,Ge as v,it as w,lt as x,ct as y,ht as z};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-JZ4WGUVH.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as y,O as V,P as W,Pb as Y,Q as K,R as G,aa as _,q as C,r as x,s as $,sa as J,t as P,u as q,va as H}from"./chunk-GUIF3WVC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c6a57e5a-91ba-5c4e-afbc-772fd2f7a9bb")}catch{}})();var k=new Set(W),D=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,D))},[Symbol.iterator](){return k.values()}});function X(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function B(e){return typeof e!="string"?null:V(e)}function de(e){try{return structuredClone(e)}catch{return e}}function ue(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new _(`--field entries must use name=value syntax, received: ${e}`,y.USAGE);let s=t.slice(0,r).trim(),i=t.slice(r+1);return{key:s,value:i}}function ce(e){return`--${e.replaceAll("_","-")}`}function fe(e,t,r){try{let s=JSON.parse(e);if(r==="array"&&Array.isArray(s)||r==="object"&&typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}throw new _(`--field ${t}=... must be valid JSON ${r}`,y.USAGE)}function me(e,t,r){if(t==="string")return r;if(t==="number"){let s=r.trim();if(s.length===0)throw new _(`--field ${e}=... must be a number`,y.USAGE);let i=Number(s);if(!Number.isFinite(i))throw new _(`--field ${e}=... must be a number`,y.USAGE);return i}if(t==="boolean"){let s=r.trim().toLowerCase();if(s==="true"||s==="1"||s==="yes")return!0;if(s==="false"||s==="0"||s==="no")return!1;throw new _(`--field ${e}=... must be one of true|false|1|0|yes|no`,y.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(s=>s.trim()).filter(s=>s.length>0):fe(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let s of r.fields){let i=X(s.name),n=B(s.type);if(!i||!n)continue;let a=t.get(i);if(a&&a.type!==n)throw new _(`Extension item field "${i}" is declared with conflicting types: ${a.type}, ${n}`,y.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(i,{name:i,type:n})}return t}function Z(e){if(D.has(e))throw new _(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...D].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,y.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Ze(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function Qe(e,t){if(!e||e.length===0)return{};let r=U(t),s={};for(let i of e){let{key:n,value:a}=ue(i),l=r.get(n);if(!l){if(D.has(n)){let d=ce(n);throw new _(`--field ${n} is a core item field, not an extension field`,y.USAGE,{code:"core_item_field_requires_dedicated_flag",field:n,recovery:{provided_fields:[n],suggested_flags:[d]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${d} <value>`,`When closing an item, pm close <id> also accepts ${d} <value>.`]})}let o=[...r.keys()].sort((d,c)=>d.localeCompare(c));throw new _(`--field ${n} is not declared by an active extension item-field registration`,y.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Z(l.name),s[l.name]=me(l.name,l.type,a)}return s}function ye(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function _e(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function et(e,t,r={}){if(t){U(t);for(let s of t.item_fields)for(let i of s.fields){let n=X(i.name);if(!n)continue;Z(n),!(n in e)&&!r.skipDefaultFields?.has(n)&&Object.prototype.hasOwnProperty.call(i,"default")&&(e[n]=de(i.default));let a=e[n];if(a===void 0)continue;let l=B(i.type);if(l&&!ye(a,l))throw new TypeError(`Item field "${n}" must be of type ${l}`);let o=Array.isArray(i.values)?i.values:void 0;if(!_e(a,o))throw new TypeError(`Item field "${n}" must match one of the configured allowed values`)}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2075887b-6d4b-582f-9da2-bab13198f9a5")}catch{}})();var pe=2e3,z=new Map;function S(e){if(typeof e!="string")return"";let t=z.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return z.size>=pe&&Y(z),z.set(e,r),r}import ee from"node:path";import{link as we,mkdir as he,mkdtemp as ge,rm as Se,writeFile as Ae}from"node:fs/promises";import N from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="71c2fed9-81e1-5723-8e34-e6327c07a130")}catch{}})();async function Q(e,t){let r=N.dirname(e);await he(r,{recursive:!0});let s=await ge(N.join(r,".pm-seed-")),i=N.join(s,"value");try{await Ae(i,t,"utf8");try{return await we(i,e),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}}finally{await Se(s,{recursive:!0,force:!0})}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),se=G,L=K,be=["create","update"],Ee=new Set(x),ke=new Set($),Fe=new Set(P),ve=new Set(q),Te=new Set(["string","number","boolean","array","object"]),Ie=16;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var De=[e=>e.type===void 0||typeof e.type=="string"&&Te.has(e.type),e=>!Object.hasOwn(e,"const")||O(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>O(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||ie(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function O(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(s=>O(s,t)):Object.values(e).every(s=>O(s,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!ie(e)||t>Ie||r.has(e))return;r.add(e);let s=e,i=s.type,n=s.enum,a=s.one_of,l=s.properties,o=s.items,d=s.required,c=s.min_length,u=s.min_items,w=s.format,g=s.additional_properties;if(!De.every(f=>f(s))){r.delete(e);return}let A=l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([f,F])=>[f,R(F,t+1,r)])),b=o===void 0?void 0:R(o,t+1,r),E=a===void 0?void 0:a.map(f=>R(f,t+1,r));if([...Object.values(A??{}),...o===void 0?[]:[b],...E??[]].some(f=>f===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:i,const:Object.hasOwn(s,"const")?s.const:void 0,enum:n,min_length:c,min_items:u,format:w,properties:A,required:d===void 0?void 0:[...new Set(d)],additional_properties:g,items:b,one_of:E}).filter(([,f])=>f!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,s)=>r.localeCompare(s))}function m(e){if(typeof e!="string"||e.length===0)return;let t=S(e);return t.length>0?t:void 0}function ze(e){return e.startsWith("--")?e.slice(2):e}function te(e){return typeof e=="string"?ze(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function ne(e){return e.replaceAll("_","-")}function Re(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(i=>i.length>0).map(i=>i.toLowerCase());if(t.length===0)return e;let[r,...s]=t;return`${r}${s.map(i=>`${i.slice(0,1).toUpperCase()}${i.slice(1)}`).join("")}`}function M(e,t){let r=m(e.id);if(!r)return null;let s=[...new Set(T(e.aliases).map(S).filter(l=>l.length>0))].sort((l,o)=>l.localeCompare(o)),i=T(e.roles).filter(l=>Ee.has(l)),n=e.description?.trim(),a=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:s,roles:i,description:n&&n.length>0?n:void 0,order:a}}function Oe(e){return{draft_status:m(e?.draft_status),open_status:m(e?.open_status),in_progress_status:m(e?.in_progress_status),blocked_status:m(e?.blocked_status),close_status:m(e?.close_status),canceled_status:m(e?.canceled_status)}}function oe(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=S(t[0]),s=S(t[1]);r.length===0||s.length===0||e.pairs.some(i=>i[0]===r&&i[1]===s)||e.pairs.push([r,s])}function Ue(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let s of e.allowed_transitions)oe(r,s);return{typeKey:t.toLowerCase(),record:r}}function Ne(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let s of e){let i=Ue(s);if(i===null)continue;let n=t.get(i.typeKey)??i.record;n.denyAll||=i.record.denyAll;for(let a of i.record.pairs)oe(n,a);t.set(i.typeKey,n)}let r=[];for(let s of t.values())(s.pairs.length>0||s.denyAll)&&r.push({type:s.type,allowed_transitions:s.pairs});return r.sort((s,i)=>s.type.localeCompare(i.type)),r.length>0?r:void 0}function ae(e){let t=S(e.key??"");if(!t)return null;let r=S(e.metadata_key??e.front_matter_key??t),s=te(e.cli_flag??ne(t));if(!s)return null;let i=T(e.cli_aliases).map(u=>te(u)).filter(u=>u.length>0&&u!==s),n=typeof e.type=="string"?e.type.trim().toLowerCase():"string",a=ke.has(n)?n:"string",l=(()=>{let u=T(e.commands).filter(w=>Fe.has(w));return u.length>0?u:[...be]})(),o=e.description?.trim(),d=T(e.required_types),c=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&c===void 0?null:{key:t,metadata_key:r,cli_flag:s,cli_aliases:i,description:o&&o.length>0?o:void 0,type:a,commands:l,repeatable:[e.repeatable===!0,a==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:c}}function Me(e){let t=new Map;for(let[s,i]of e.entries()){let n=M(i,s);n&&t.set(n.id,n)}let r=re([...t.values()]);return r.length>0?r:re(L.map((s,i)=>M(s,i)).filter(s=>s!==null))}function re(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Le(e){let t=new Map;for(let r of e??[]){let s=ae(r);s&&t.set(s.key,s)}return[...t.values()].sort((r,s)=>r.key.localeCompare(s.key))}function je(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ce(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==ne(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function xe(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return ve.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:L,s=Me(r),i=Le(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:s.map(je),fields:i.map(Ce),workflow:{...se,...Oe(e?.workflow)},type_workflows:Ne(e?.type_workflows),unknown_field_policy:xe(e?.unknown_field_policy)}}function $e(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Pe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let s=t?.trim()||r;return ee.isAbsolute(s)?s:ee.join(e,s)}function mt(e,t){return h(e,t.files.types,p.types)}async function yt(e,t){let r=I(t),s=[{path:h(e,r.files.types,p.types),seed:{definitions:[]}},{path:h(e,r.files.statuses,p.statuses),seed:{statuses:L}},{path:h(e,r.files.fields,p.fields),seed:{fields:[]}},{path:h(e,r.files.workflows,p.workflows),seed:{workflow:se}}],i=[];for(let n of s)await J(n.path)||await Q(n.path,`${JSON.stringify(n.seed,null,2)}
|
|
1
|
+
import{$ as y,O as V,P as W,Q as K,Qb as Y,R as G,aa as _,q as C,r as x,s as $,sa as J,t as P,u as q,va as H}from"./chunk-SPN5QTZ3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c6a57e5a-91ba-5c4e-afbc-772fd2f7a9bb")}catch{}})();var k=new Set(W),D=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,D))},[Symbol.iterator](){return k.values()}});function X(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function B(e){return typeof e!="string"?null:V(e)}function de(e){try{return structuredClone(e)}catch{return e}}function ue(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new _(`--field entries must use name=value syntax, received: ${e}`,y.USAGE);let s=t.slice(0,r).trim(),i=t.slice(r+1);return{key:s,value:i}}function ce(e){return`--${e.replaceAll("_","-")}`}function fe(e,t,r){try{let s=JSON.parse(e);if(r==="array"&&Array.isArray(s)||r==="object"&&typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}throw new _(`--field ${t}=... must be valid JSON ${r}`,y.USAGE)}function me(e,t,r){if(t==="string")return r;if(t==="number"){let s=r.trim();if(s.length===0)throw new _(`--field ${e}=... must be a number`,y.USAGE);let i=Number(s);if(!Number.isFinite(i))throw new _(`--field ${e}=... must be a number`,y.USAGE);return i}if(t==="boolean"){let s=r.trim().toLowerCase();if(s==="true"||s==="1"||s==="yes")return!0;if(s==="false"||s==="0"||s==="no")return!1;throw new _(`--field ${e}=... must be one of true|false|1|0|yes|no`,y.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(s=>s.trim()).filter(s=>s.length>0):fe(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let s of r.fields){let i=X(s.name),n=B(s.type);if(!i||!n)continue;let a=t.get(i);if(a&&a.type!==n)throw new _(`Extension item field "${i}" is declared with conflicting types: ${a.type}, ${n}`,y.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(i,{name:i,type:n})}return t}function Z(e){if(D.has(e))throw new _(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...D].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,y.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Ze(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function Qe(e,t){if(!e||e.length===0)return{};let r=U(t),s={};for(let i of e){let{key:n,value:a}=ue(i),l=r.get(n);if(!l){if(D.has(n)){let d=ce(n);throw new _(`--field ${n} is a core item field, not an extension field`,y.USAGE,{code:"core_item_field_requires_dedicated_flag",field:n,recovery:{provided_fields:[n],suggested_flags:[d]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${d} <value>`,`When closing an item, pm close <id> also accepts ${d} <value>.`]})}let o=[...r.keys()].sort((d,c)=>d.localeCompare(c));throw new _(`--field ${n} is not declared by an active extension item-field registration`,y.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Z(l.name),s[l.name]=me(l.name,l.type,a)}return s}function ye(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function _e(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function et(e,t,r={}){if(t){U(t);for(let s of t.item_fields)for(let i of s.fields){let n=X(i.name);if(!n)continue;Z(n),!(n in e)&&!r.skipDefaultFields?.has(n)&&Object.prototype.hasOwnProperty.call(i,"default")&&(e[n]=de(i.default));let a=e[n];if(a===void 0)continue;let l=B(i.type);if(l&&!ye(a,l))throw new TypeError(`Item field "${n}" must be of type ${l}`);let o=Array.isArray(i.values)?i.values:void 0;if(!_e(a,o))throw new TypeError(`Item field "${n}" must match one of the configured allowed values`)}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2075887b-6d4b-582f-9da2-bab13198f9a5")}catch{}})();var pe=2e3,z=new Map;function S(e){if(typeof e!="string")return"";let t=z.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return z.size>=pe&&Y(z),z.set(e,r),r}import ee from"node:path";import{link as we,mkdir as he,mkdtemp as ge,rm as Se,writeFile as Ae}from"node:fs/promises";import N from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="71c2fed9-81e1-5723-8e34-e6327c07a130")}catch{}})();async function Q(e,t){let r=N.dirname(e);await he(r,{recursive:!0});let s=await ge(N.join(r,".pm-seed-")),i=N.join(s,"value");try{await Ae(i,t,"utf8");try{return await we(i,e),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}}finally{await Se(s,{recursive:!0,force:!0})}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),se=G,L=K,be=["create","update"],Ee=new Set(x),ke=new Set($),Fe=new Set(P),ve=new Set(q),Te=new Set(["string","number","boolean","array","object"]),Ie=16;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var De=[e=>e.type===void 0||typeof e.type=="string"&&Te.has(e.type),e=>!Object.hasOwn(e,"const")||O(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>O(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||ie(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function O(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(s=>O(s,t)):Object.values(e).every(s=>O(s,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!ie(e)||t>Ie||r.has(e))return;r.add(e);let s=e,i=s.type,n=s.enum,a=s.one_of,l=s.properties,o=s.items,d=s.required,c=s.min_length,u=s.min_items,w=s.format,g=s.additional_properties;if(!De.every(f=>f(s))){r.delete(e);return}let A=l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([f,F])=>[f,R(F,t+1,r)])),b=o===void 0?void 0:R(o,t+1,r),E=a===void 0?void 0:a.map(f=>R(f,t+1,r));if([...Object.values(A??{}),...o===void 0?[]:[b],...E??[]].some(f=>f===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:i,const:Object.hasOwn(s,"const")?s.const:void 0,enum:n,min_length:c,min_items:u,format:w,properties:A,required:d===void 0?void 0:[...new Set(d)],additional_properties:g,items:b,one_of:E}).filter(([,f])=>f!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,s)=>r.localeCompare(s))}function m(e){if(typeof e!="string"||e.length===0)return;let t=S(e);return t.length>0?t:void 0}function ze(e){return e.startsWith("--")?e.slice(2):e}function te(e){return typeof e=="string"?ze(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function ne(e){return e.replaceAll("_","-")}function Re(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(i=>i.length>0).map(i=>i.toLowerCase());if(t.length===0)return e;let[r,...s]=t;return`${r}${s.map(i=>`${i.slice(0,1).toUpperCase()}${i.slice(1)}`).join("")}`}function M(e,t){let r=m(e.id);if(!r)return null;let s=[...new Set(T(e.aliases).map(S).filter(l=>l.length>0))].sort((l,o)=>l.localeCompare(o)),i=T(e.roles).filter(l=>Ee.has(l)),n=e.description?.trim(),a=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:s,roles:i,description:n&&n.length>0?n:void 0,order:a}}function Oe(e){return{draft_status:m(e?.draft_status),open_status:m(e?.open_status),in_progress_status:m(e?.in_progress_status),blocked_status:m(e?.blocked_status),close_status:m(e?.close_status),canceled_status:m(e?.canceled_status)}}function oe(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=S(t[0]),s=S(t[1]);r.length===0||s.length===0||e.pairs.some(i=>i[0]===r&&i[1]===s)||e.pairs.push([r,s])}function Ue(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let s of e.allowed_transitions)oe(r,s);return{typeKey:t.toLowerCase(),record:r}}function Ne(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let s of e){let i=Ue(s);if(i===null)continue;let n=t.get(i.typeKey)??i.record;n.denyAll||=i.record.denyAll;for(let a of i.record.pairs)oe(n,a);t.set(i.typeKey,n)}let r=[];for(let s of t.values())(s.pairs.length>0||s.denyAll)&&r.push({type:s.type,allowed_transitions:s.pairs});return r.sort((s,i)=>s.type.localeCompare(i.type)),r.length>0?r:void 0}function ae(e){let t=S(e.key??"");if(!t)return null;let r=S(e.metadata_key??e.front_matter_key??t),s=te(e.cli_flag??ne(t));if(!s)return null;let i=T(e.cli_aliases).map(u=>te(u)).filter(u=>u.length>0&&u!==s),n=typeof e.type=="string"?e.type.trim().toLowerCase():"string",a=ke.has(n)?n:"string",l=(()=>{let u=T(e.commands).filter(w=>Fe.has(w));return u.length>0?u:[...be]})(),o=e.description?.trim(),d=T(e.required_types),c=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&c===void 0?null:{key:t,metadata_key:r,cli_flag:s,cli_aliases:i,description:o&&o.length>0?o:void 0,type:a,commands:l,repeatable:[e.repeatable===!0,a==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:c}}function Me(e){let t=new Map;for(let[s,i]of e.entries()){let n=M(i,s);n&&t.set(n.id,n)}let r=re([...t.values()]);return r.length>0?r:re(L.map((s,i)=>M(s,i)).filter(s=>s!==null))}function re(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Le(e){let t=new Map;for(let r of e??[]){let s=ae(r);s&&t.set(s.key,s)}return[...t.values()].sort((r,s)=>r.key.localeCompare(s.key))}function je(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ce(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==ne(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function xe(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return ve.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:L,s=Me(r),i=Le(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:s.map(je),fields:i.map(Ce),workflow:{...se,...Oe(e?.workflow)},type_workflows:Ne(e?.type_workflows),unknown_field_policy:xe(e?.unknown_field_policy)}}function $e(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Pe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let s=t?.trim()||r;return ee.isAbsolute(s)?s:ee.join(e,s)}function mt(e,t){return h(e,t.files.types,p.types)}async function yt(e,t){let r=I(t),s=[{path:h(e,r.files.types,p.types),seed:{definitions:[]}},{path:h(e,r.files.statuses,p.statuses),seed:{statuses:L}},{path:h(e,r.files.fields,p.fields),seed:{fields:[]}},{path:h(e,r.files.workflows,p.workflows),seed:{workflow:se}}],i=[];for(let n of s)await J(n.path)||await Q(n.path,`${JSON.stringify(n.seed,null,2)}
|
|
2
2
|
`)&&i.push(n.path);return{created_paths:i}}async function _t(e,t){let r=I(t),s=[],i=h(e,r.files.types,p.types),n=h(e,r.files.statuses,p.statuses),a=h(e,r.files.fields,p.fields),l=h(e,r.files.workflows,p.workflows),o,d,c,u,w,g=async(F,le)=>{let j=await H(F);if(j!==null)return $e(j,le,s)},A=await g(i,"runtime_schema_types_invalid_json");A!==void 0&&(o=Pe(A),o===void 0&&s.push("runtime_schema_types_invalid_shape"));let b=await g(n,"runtime_schema_statuses_invalid_json");b!==void 0&&(d=qe(b),d===void 0&&s.push("runtime_schema_statuses_invalid_shape"));let E=await g(a,"runtime_schema_fields_invalid_json");E!==void 0&&(c=Ve(E),c===void 0&&s.push("runtime_schema_fields_invalid_shape"));let f=await g(l,"runtime_schema_workflows_invalid_json");return f!==void 0&&(u=We(f),u===void 0&&s.push("runtime_schema_workflows_invalid_shape"),w=Ke(f)),{schema:I({...r,statuses:[...r.statuses,...d??[]],fields:[...r.fields,...c??[]],workflow:{...r.workflow,...u},type_workflows:[...r.type_workflows??[],...w??[]]}),type_definitions_from_file:o,warnings:s,created_paths:[]}}function v(e,t,r,s=!1){let i=r.map(a=>m(a)).filter(a=>typeof a=="string").find(a=>e.some(l=>l.id===a));if(s&&i!==void 0)return i;let n=e.find(a=>a.roles.includes(t));return n!==void 0?n.id:i??e[0]?.id}function Ge(e){let t=new Map,r=new Map;for(let s of e){r.set(s.id,s),t.set(s.id,s.id),t.set(s.id.replaceAll("_","-"),s.id),t.set(s.id.replaceAll("_"," "),s.id);for(let i of s.aliases)t.set(i,s.id),t.set(i.replaceAll("_","-"),s.id),t.set(i.replaceAll("_"," "),s.id)}return{aliasToId:t,byId:r}}function Je(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let s=new Set(r.roles);(s.has("terminal")||s.has("terminal_done")||s.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),s.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),s.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),s.has("active")&&t.activeStatuses.add(r.id),s.has("blocked")&&t.blockedStatuses.add(r.id),s.has("draft")&&t.draftStatuses.add(r.id)}return t}function pt(e){let t=I(e),r=t.statuses.map((f,F)=>M(f,F)).filter(f=>f!==null),{aliasToId:s,byId:i}=Ge(r),{activeStatuses:n,blockedStatuses:a,draftStatuses:l,terminalCanceledStatuses:o,terminalDoneStatuses:d,terminalStatuses:c}=Je(r),u=t.workflow,w=m(u.open_status)??v(r,"default_open",["open","in_progress",C[0]]),g=m(u.in_progress_status)??v(r,"active",["in_progress","in-progress",w],!0),A=m(u.blocked_status)??v(r,"blocked",["blocked"]),b=m(u.close_status)??v(r,"default_close",["closed","done","complete"]),E=m(u.canceled_status)??v(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:i,alias_to_id:s,terminal_statuses:c,terminal_done_statuses:d,terminal_canceled_statuses:o,active_statuses:n,blocked_statuses:a,draft_statuses:l,open_status:w,in_progress_status:g,blocked_status:A,close_status:b,canceled_status:E}}function He(e,t){let r=S(e);if(r)return t.alias_to_id.get(r)}function wt(e){let t=I(e),r=new Map,s=t.fields.map(o=>ae(o)).filter(o=>o!==null);for(let o of s)r.set(o.key,o);let i=[...r.values()].sort((o,d)=>o.key.localeCompare(d.key)),n=new Map,a=new Map,l=new Map;for(let o of i){n.set(o.key,o),a.set(o.cli_flag,o);for(let d of o.cli_aliases)a.set(d,o);for(let d of o.commands){let c=l.get(d)??[];c.push(o),l.set(d,c)}}for(let[o,d]of l.entries())d.sort((c,u)=>c.key.localeCompare(u.key)),l.set(o,d);return{definitions:i,by_key:n,by_cli_token:a,command_to_fields:l}}function ht(e){return Re(e.key)}function gt(e,t){let r=He(e,t);return r?t.terminal_statuses.has(r):!1}export{D as a,Ze as b,Qe as c,et as d,S as e,Q as f,p as g,L as h,I as i,h as j,mt as k,yt as l,_t as m,pt as n,He as o,wt as p,ht as q,gt as r};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-NM3PM6O6.js.map
|