artifact-contracts 0.34.0 → 0.34.1

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __banner_createRequire } from 'module';
3
3
  const require = __banner_createRequire(import.meta.url);
4
- var vte=Object.create;var yy=Object.defineProperty;var yte=Object.getOwnPropertyDescriptor;var _te=Object.getOwnPropertyNames;var bte=Object.getPrototypeOf,wte=Object.prototype.hasOwnProperty;var ao=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var tt=(e,t)=>()=>(e&&(t=e(e=0)),t);var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kn=(e,t)=>{for(var n in t)yy(e,n,{get:t[n],enumerable:!0})},Ete=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _te(t))!wte.call(e,r)&&r!==n&&yy(e,r,{get:()=>t[r],enumerable:!(i=yte(t,r))||i.enumerable});return e};var Ia=(e,t,n)=>(n=e!=null?vte(bte(e)):{},Ete(t||!e||!e.__esModule?yy(n,"default",{value:e,enumerable:!0}):n,e));var Ic=gt(by=>{var Em=class extends Error{constructor(t,n,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},_y=class extends Em{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};by.CommanderError=Em;by.InvalidArgumentError=_y});var Sm=gt(Ey=>{var{InvalidArgumentError:Ste}=Ic(),wy=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,i)=>{if(!this.argChoices.includes(n))throw new Ste(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,i):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function $te(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}Ey.Argument=wy;Ey.humanReadableArgName=$te});var ky=gt($y=>{var{humanReadableArgName:kte}=Sm(),Sy=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(r=>!r._hidden),i=t._getHelpCommand();return i&&!i._hidden&&n.push(i),this.sortSubcommands&&n.sort((r,a)=>r.name().localeCompare(a.name())),n}compareOptions(t,n){let i=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return i(t).localeCompare(i(n))}visibleOptions(t){let n=t.options.filter(r=>!r.hidden),i=t._getHelpOption();if(i&&!i.hidden){let r=i.short&&t._findOption(i.short),a=i.long&&t._findOption(i.long);!r&&!a?n.push(i):i.long&&!a?n.push(t.createOption(i.long,i.description)):i.short&&!r&&n.push(t.createOption(i.short,i.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let i=t.parent;i;i=i.parent){let r=i.options.filter(a=>!a.hidden);n.push(...r)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(i=>kte(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(r)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleOptionTerm(n.optionTerm(r)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleOptionTerm(n.optionTerm(r)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(r)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let i="";for(let r=t.parent;r;r=r.parent)i=r.name()+" "+i;return i+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let i=`(${n.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let i=`(${n.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,n,i){return n.length===0?[]:[i.styleTitle(t),...n,""]}groupItems(t,n,i){let r=new Map;return t.forEach(a=>{let o=i(a);r.has(o)||r.set(o,[])}),n.forEach(a=>{let o=i(a);r.has(o)||r.set(o,[]),r.get(o).push(a)}),r}formatHelp(t,n){let i=n.padWidth(t,n),r=n.helpWidth??80;function a(d,p){return n.formatItem(d,i,p,n)}let o=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(t))}`,""],s=n.commandDescription(t);s.length>0&&(o=o.concat([n.boxWrap(n.styleCommandDescription(s),r),""]));let l=n.visibleArguments(t).map(d=>a(n.styleArgumentTerm(n.argumentTerm(d)),n.styleArgumentDescription(n.argumentDescription(d))));if(o=o.concat(this.formatItemList("Arguments:",l,n)),this.groupItems(t.options,n.visibleOptions(t),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let f=d.map(m=>a(n.styleOptionTerm(n.optionTerm(m)),n.styleOptionDescription(n.optionDescription(m))));o=o.concat(this.formatItemList(p,f,n))}),n.showGlobalOptions){let d=n.visibleGlobalOptions(t).map(p=>a(n.styleOptionTerm(n.optionTerm(p)),n.styleOptionDescription(n.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",d,n))}return this.groupItems(t.commands,n.visibleCommands(t),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let f=d.map(m=>a(n.styleSubcommandTerm(n.subcommandTerm(m)),n.styleSubcommandDescription(n.subcommandDescription(m))));o=o.concat(this.formatItemList(p,f,n))}),o.join(`
4
+ var vte=Object.create;var yy=Object.defineProperty;var yte=Object.getOwnPropertyDescriptor;var _te=Object.getOwnPropertyNames;var bte=Object.getPrototypeOf,wte=Object.prototype.hasOwnProperty;var ao=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var tt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=[i],i}};var gt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},kn=(e,t)=>{for(var n in t)yy(e,n,{get:t[n],enumerable:!0})},Ete=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _te(t))!wte.call(e,r)&&r!==n&&yy(e,r,{get:()=>t[r],enumerable:!(i=yte(t,r))||i.enumerable});return e};var Ia=(e,t,n)=>(n=e!=null?vte(bte(e)):{},Ete(t||!e||!e.__esModule?yy(n,"default",{value:e,enumerable:!0}):n,e));var Ic=gt(by=>{var Em=class extends Error{constructor(t,n,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},_y=class extends Em{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};by.CommanderError=Em;by.InvalidArgumentError=_y});var Sm=gt(Ey=>{var{InvalidArgumentError:Ste}=Ic(),wy=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,i)=>{if(!this.argChoices.includes(n))throw new Ste(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,i):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function $te(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}Ey.Argument=wy;Ey.humanReadableArgName=$te});var ky=gt($y=>{var{humanReadableArgName:kte}=Sm(),Sy=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(r=>!r._hidden),i=t._getHelpCommand();return i&&!i._hidden&&n.push(i),this.sortSubcommands&&n.sort((r,a)=>r.name().localeCompare(a.name())),n}compareOptions(t,n){let i=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return i(t).localeCompare(i(n))}visibleOptions(t){let n=t.options.filter(r=>!r.hidden),i=t._getHelpOption();if(i&&!i.hidden){let r=i.short&&t._findOption(i.short),a=i.long&&t._findOption(i.long);!r&&!a?n.push(i):i.long&&!a?n.push(t.createOption(i.long,i.description)):i.short&&!r&&n.push(t.createOption(i.short,i.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let i=t.parent;i;i=i.parent){let r=i.options.filter(a=>!a.hidden);n.push(...r)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(i=>kte(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(r)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleOptionTerm(n.optionTerm(r)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleOptionTerm(n.optionTerm(r)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((i,r)=>Math.max(i,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(r)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let i="";for(let r=t.parent;r;r=r.parent)i=r.name()+" "+i;return i+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let i=`(${n.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let i=`(${n.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,n,i){return n.length===0?[]:[i.styleTitle(t),...n,""]}groupItems(t,n,i){let r=new Map;return t.forEach(a=>{let o=i(a);r.has(o)||r.set(o,[])}),n.forEach(a=>{let o=i(a);r.has(o)||r.set(o,[]),r.get(o).push(a)}),r}formatHelp(t,n){let i=n.padWidth(t,n),r=n.helpWidth??80;function a(d,p){return n.formatItem(d,i,p,n)}let o=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(t))}`,""],s=n.commandDescription(t);s.length>0&&(o=o.concat([n.boxWrap(n.styleCommandDescription(s),r),""]));let l=n.visibleArguments(t).map(d=>a(n.styleArgumentTerm(n.argumentTerm(d)),n.styleArgumentDescription(n.argumentDescription(d))));if(o=o.concat(this.formatItemList("Arguments:",l,n)),this.groupItems(t.options,n.visibleOptions(t),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let f=d.map(m=>a(n.styleOptionTerm(n.optionTerm(m)),n.styleOptionDescription(n.optionDescription(m))));o=o.concat(this.formatItemList(p,f,n))}),n.showGlobalOptions){let d=n.visibleGlobalOptions(t).map(p=>a(n.styleOptionTerm(n.optionTerm(p)),n.styleOptionDescription(n.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",d,n))}return this.groupItems(t.commands,n.visibleCommands(t),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let f=d.map(m=>a(n.styleSubcommandTerm(n.subcommandTerm(m)),n.styleSubcommandDescription(n.subcommandDescription(m))));o=o.concat(this.formatItemList(p,f,n))}),o.join(`
5
5
  `)}displayWidth(t){return Qk(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,n){return Math.max(n.longestOptionTermLength(t,n),n.longestGlobalOptionTermLength(t,n),n.longestSubcommandTermLength(t,n),n.longestArgumentTermLength(t,n))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,n,i,r){let o=" ".repeat(2);if(!i)return o+t;let s=t.padEnd(n+t.length-r.displayWidth(t)),l=2,c=(this.helpWidth??80)-n-l-2,d;return c<this.minWidthToWrap||r.preformatted(i)?d=i:d=r.boxWrap(i,c).replace(/\n/g,`
6
6
  `+" ".repeat(n+l)),o+s+" ".repeat(l)+d.replace(/\n/g,`
7
7
  ${o}`)}boxWrap(t,n){if(n<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,a=[];return i.forEach(o=>{let s=o.match(r);if(s===null){a.push("");return}let l=[s.shift()],u=this.displayWidth(l[0]);s.forEach(c=>{let d=this.displayWidth(c);if(u+d<=n){l.push(c),u+=d;return}a.push(l.join(""));let p=c.trimStart();l=[p],u=this.displayWidth(p)}),a.push(l.join(""))}),a.join(`
@@ -3000,7 +3000,7 @@ components:
3000
3000
  `).filter(Boolean)}catch{try{let{globSync:n}=await Promise.resolve().then(()=>(g8(),h8));t=n("**/*",{cwd:e,dot:!0,nodir:!0,ignore:["node_modules/**",".git/**"]})}catch(n){throw new Error(`Failed to enumerate repository files: ${n.message}`)}}return p8e(t)}function p8e(e){let t={};for(let i of e.sort()){let r=i.split("/"),a=r.length>1?r.slice(0,-1).join("/"):".";t[a]||(t[a]=[]),t[a].push(i)}let n=[];for(let i of Object.keys(t).sort()){n.push(`${i}/`);for(let r of t[i])n.push(` ${r}`);n.push("")}return n.join(`
3001
3001
  `)}function f8e(){let e=US("package.json");if(!yK(e))return"No package.json found.";try{let t=JSON.parse(_K(e,"utf-8"));return[`name: ${t.name??"unknown"}`,t.description?`description: ${t.description}`:"",t.version?`version: ${t.version}`:"",t.keywords?.length?`keywords: ${t.keywords.join(", ")}`:"",t.repository?.url?`repository: ${t.repository.url}`:""].filter(Boolean).join(`
3002
3002
  `)}catch{return"package.json exists but could not be parsed."}}function m8e(e){let{mode:t,fileTree:n,existingContent:i,metadata:r}=e,a=["# Artifact Discovery","",`## Mode: ${t}`,t==="init"?"Create a new artifact-contracts.yaml from scratch based on the project file structure.":"Update the existing artifact-contracts.yaml by adding definitions for uncovered files. Preserve all existing artifact definitions.","","## Project Metadata","",r,"","## Repository File Tree","",n];return t==="update"&&i&&a.push("## Existing artifact-contracts.yaml","","```yaml",i,"```",""),a.push("## artifact-contracts.yaml Schema Reference","","The generated YAML must conform to this schema:","","```yaml",'artifact_contracts: "2026A" # or latest schema version',"","system:"," id: <kebab-case-system-id>"," name: <human-readable name>","","artifacts:"," <artifact-id>: # kebab-case IDs"," type: <artifact-type> # e.g. source, config, generated-code, generated-doc"," description: <optional description>"," authority: canonical | derived | generated | control"," manual_edit: allowed | discouraged | forbidden # optional, defaults by authority"," change_control: none | approval-required | regeneration-required # optional"," visibility: public | internal | private # optional"," path_patterns: # required, at least one pattern",' - "glob/pattern/**"'," exclude_patterns: # optional",' - "glob/pattern/to/exclude/**"',"","trace:"," links:"," - id: <kebab-case-link-id>"," from: <source-artifact-id>"," to: <target-artifact-id>"," resolver: operationId | ast | naming | codegen"," description: <optional description>","```","","### Authority Guidelines","","- canonical: hand-written source of truth (source code, configs)","- derived: generated from canonical sources but may need review (docs)","- generated: auto-generated, should not be manually edited","- control: governance/control files (CI, hooks)","","### Type Guidelines","","- source: application/library source code","- config: configuration files (YAML, JSON configs)","- generated-code: auto-generated code","- generated-doc: auto-generated documentation","","### Path Pattern Rules","",'- Use specific glob patterns, not overly broad ones like "**/*"',"- Group logically related files into single artifacts","- Use exclude_patterns to omit test files, generated subdirs, etc.","- Artifact IDs must be kebab-case","","### Trace Link Guidelines","","- Detect relationships between config/DSL artifacts and their generated outputs","- Use resolver: codegen for build-time generation relationships","- Use resolver: naming for convention-based relationships","- Use resolver: ast for code-level references","- Use resolver: operationId for API operation references","","## Instructions","","1. Analyze the file tree and group files into logical artifacts","2. Assign appropriate type, authority, and path_patterns to each artifact","3. Detect trace link relationships (especially config/DSL \u2192 generated code)","4. In update mode, preserve ALL existing artifact definitions unchanged","5. Add new artifacts only for files not covered by existing patterns","6. Generate complete, valid artifact-contracts.yaml content","","## Output Format","","Respond with a JSON object matching the artifact-discovery-result handoff schema:","","```json","{",' "artifact_contracts_yaml": "<complete YAML string for artifact-contracts.yaml>",',' "decisions": [',' { "artifact_id": "<id>", "reasoning": "<why this grouping>" }'," ],",' "trace_decisions": [',' { "link_id": "<id>", "reasoning": "<why this trace link>" }'," ],",' "uncategorized_files": ["<files that could not be categorized>"],',' "suggestions": ["<improvement suggestions>"]',"}","```","","The artifact_contracts_yaml field must contain the complete, valid YAML document.",""),a.join(`
3003
- `)}function h8e(e,t,n){if(e.status==="error"){let a=e.errorMessage??"Unknown error";return n==="json"?JSON.stringify({error:a},null,2):n==="yaml"?(0,bK.stringify)({error:a}):`Error: ${a}`}let i=e.data;if(n==="json"){let a={mode:t,artifact_contracts_yaml:i?.artifact_contracts_yaml??vK(e.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let r=i?.artifact_contracts_yaml??vK(e.raw);return r}function vK(e){if(!e)return"";try{let n=JSON.parse(e);if(n.artifact_contracts_yaml)return n.artifact_contracts_yaml}catch{}let t=e.match(/```ya?ml\n([\s\S]*?)```/);return t?t[1].trim():e.includes("artifact_contracts:")?e.trim():e}vd();var XDe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),QDe=Ve.object({artifact_contracts_yaml:Ve.string(),decisions:Ve.array(Ve.object({artifact_id:Ve.string(),reasoning:Ve.string()})).optional(),trace_decisions:Ve.array(Ve.object({link_id:Ve.string(),reasoning:Ve.string()})).optional(),uncategorized_files:Ve.array(Ve.string()).optional(),suggestions:Ve.array(Ve.string()).optional()}),eCe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),tCe=Ve.object({summary:Ve.string(),risk_level:Ve.enum(["none","low","medium","high","critical"]),findings:Ve.array(Ve.object({id:Ve.string(),severity:Ve.enum(["critical","error","warning","info"]),category:Ve.string(),title:Ve.string(),description:Ve.string(),target:Ve.string().optional(),recommendation:Ve.string().optional(),evidence:Ve.array(Ve.object({kind:Ve.enum(["schema","code","config","runtime","doc"]),target:Ve.string().optional(),location:Ve.string().optional(),excerpt:Ve.string().optional(),reasoning:Ve.string().optional()})).optional()})),recommended_actions:Ve.array(Ve.object({action:Ve.string(),priority:Ve.enum(["high","medium","low"]),description:Ve.string().optional()})),metadata:Ve.object({total_artifacts:Ve.number().int().optional(),analyzed_artifacts:Ve.number().int().optional(),analysis_scope:Ve.string().optional()}).optional()});y8();var g8e={version:"0.34.0"},v8e={validate:async e=>{await vN(e)},resolve:async e=>{await _N(e)},list:async e=>{await wN(e)},explain:async(e,t)=>{e||(console.error("Error: <path> argument is required"),process.exit(1)),await SN(e,t)},audit:async e=>{await fK(e)},discover:async e=>{await wK(e)},agents:async e=>{let t=await Promise.resolve().then(()=>Ia(La(),1)),n=e.format??"yaml";try{console.log(n==="json"?JSON.stringify(zl,null,2):t.stringify(zl,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};vx(v8e,g8e.version).parse();
3003
+ `)}function h8e(e,t,n){if(e.status==="error"){let a=e.errorMessage??"Unknown error";return n==="json"?JSON.stringify({error:a},null,2):n==="yaml"?(0,bK.stringify)({error:a}):`Error: ${a}`}let i=e.data;if(n==="json"){let a={mode:t,artifact_contracts_yaml:i?.artifact_contracts_yaml??vK(e.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let r=i?.artifact_contracts_yaml??vK(e.raw);return r}function vK(e){if(!e)return"";try{let n=JSON.parse(e);if(n.artifact_contracts_yaml)return n.artifact_contracts_yaml}catch{}let t=e.match(/```ya?ml\n([\s\S]*?)```/);return t?t[1].trim():e.includes("artifact_contracts:")?e.trim():e}vd();var XDe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),QDe=Ve.object({artifact_contracts_yaml:Ve.string(),decisions:Ve.array(Ve.object({artifact_id:Ve.string(),reasoning:Ve.string()})).optional(),trace_decisions:Ve.array(Ve.object({link_id:Ve.string(),reasoning:Ve.string()})).optional(),uncategorized_files:Ve.array(Ve.string()).optional(),suggestions:Ve.array(Ve.string()).optional()}),eCe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),tCe=Ve.object({summary:Ve.string(),risk_level:Ve.enum(["none","low","medium","high","critical"]),findings:Ve.array(Ve.object({id:Ve.string(),severity:Ve.enum(["critical","error","warning","info"]),category:Ve.string(),title:Ve.string(),description:Ve.string(),target:Ve.string().optional(),recommendation:Ve.string().optional(),evidence:Ve.array(Ve.object({kind:Ve.enum(["schema","code","config","runtime","doc"]),target:Ve.string().optional(),location:Ve.string().optional(),excerpt:Ve.string().optional(),reasoning:Ve.string().optional()})).optional()})),recommended_actions:Ve.array(Ve.object({action:Ve.string(),priority:Ve.enum(["high","medium","low"]),description:Ve.string().optional()})),metadata:Ve.object({total_artifacts:Ve.number().int().optional(),analyzed_artifacts:Ve.number().int().optional(),analysis_scope:Ve.string().optional()}).optional()});y8();var g8e={version:"0.34.1"},v8e={validate:async e=>{await vN(e)},resolve:async e=>{await _N(e)},list:async e=>{await wN(e)},explain:async(e,t)=>{e||(console.error("Error: <path> argument is required"),process.exit(1)),await SN(e,t)},audit:async e=>{await fK(e)},discover:async e=>{await wK(e)},agents:async e=>{let t=await Promise.resolve().then(()=>Ia(La(),1)),n=e.format??"yaml";try{console.log(n==="json"?JSON.stringify(zl,null,2):t.stringify(zl,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};vx(v8e,g8e.version).parse();
3004
3004
  /*! Bundled license information:
3005
3005
 
3006
3006
  agent-contracts/dist/index.js: