artifact-contracts 0.34.2 → 0.34.3

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.
@@ -3028,7 +3028,7 @@ components:
3028
3028
  `).filter(Boolean)}catch{try{let{globSync:r}=await Promise.resolve().then(()=>(uw(),sw));e=r("**/*",{cwd:t,dot:!0,nodir:!0,ignore:["node_modules/**",".git/**"]})}catch(r){throw new Error(`Failed to enumerate repository files: ${r.message}`)}}return eAe(e)}function eAe(t){let e={};for(let i of t.sort()){let n=i.split("/"),a=n.length>1?n.slice(0,-1).join("/"):".";e[a]||(e[a]=[]),e[a].push(i)}let r=[];for(let i of Object.keys(e).sort()){r.push(`${i}/`);for(let n of e[i])r.push(` ${n}`);r.push("")}return r.join(`
3029
3029
  `)}function tAe(){let t=Dx("package.json");if(!tQ(t))return"No package.json found.";try{let e=JSON.parse(rQ(t,"utf-8"));return[`name: ${e.name??"unknown"}`,e.description?`description: ${e.description}`:"",e.version?`version: ${e.version}`:"",e.keywords?.length?`keywords: ${e.keywords.join(", ")}`:"",e.repository?.url?`repository: ${e.repository.url}`:""].filter(Boolean).join(`
3030
3030
  `)}catch{return"package.json exists but could not be parsed."}}function rAe(t){let{mode:e,fileTree:r,existingContent:i,metadata:n}=t,a=["# Artifact Discovery","",`## Mode: ${e}`,e==="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","",n,"","## Repository File Tree","",r];return e==="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(`
3031
- `)}function nAe(t,e,r){if(t.status==="error"){let a=t.errorMessage??"Unknown error";return r==="json"?JSON.stringify({error:a},null,2):r==="yaml"?(0,nQ.stringify)({error:a}):`Error: ${a}`}let i=t.data;if(r==="json"){let a={mode:e,artifact_contracts_yaml:i?.artifact_contracts_yaml??eQ(t.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let n=i?.artifact_contracts_yaml??eQ(t.raw);return n}function eQ(t){if(!t)return"";try{let r=JSON.parse(t);if(r.artifact_contracts_yaml)return r.artifact_contracts_yaml}catch{}let e=t.match(/```ya?ml\n([\s\S]*?)```/);return e?e[1].trim():t.includes("artifact_contracts:")?t.trim():t}rp();var ORe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),PRe=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()}),IRe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),jRe=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()});cw();var iAe={version:"0.34.2"},aAe={validate:async t=>{await nR(t)},resolve:async t=>{await aR(t)},list:async t=>{await sR(t)},explain:async(t,e)=>{t||(console.error("Error: <path> argument is required"),process.exit(1)),await lR(t,e)},audit:async t=>{await JX(t)},discover:async t=>{await iQ(t)},agents:async t=>{let e=await Promise.resolve().then(()=>ta(Ia(),1)),r=t.format??"yaml";try{console.log(r==="json"?JSON.stringify(mc,null,2):e.stringify(mc,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};nC(aAe,iAe.version).parse();
3031
+ `)}function nAe(t,e,r){if(t.status==="error"){let a=t.errorMessage??"Unknown error";return r==="json"?JSON.stringify({error:a},null,2):r==="yaml"?(0,nQ.stringify)({error:a}):`Error: ${a}`}let i=t.data;if(r==="json"){let a={mode:e,artifact_contracts_yaml:i?.artifact_contracts_yaml??eQ(t.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let n=i?.artifact_contracts_yaml??eQ(t.raw);return n}function eQ(t){if(!t)return"";try{let r=JSON.parse(t);if(r.artifact_contracts_yaml)return r.artifact_contracts_yaml}catch{}let e=t.match(/```ya?ml\n([\s\S]*?)```/);return e?e[1].trim():t.includes("artifact_contracts:")?t.trim():t}rp();var ORe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),PRe=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()}),IRe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),jRe=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()});cw();var iAe={version:"0.34.3"},aAe={validate:async t=>{await nR(t)},resolve:async t=>{await aR(t)},list:async t=>{await sR(t)},explain:async(t,e)=>{t||(console.error("Error: <path> argument is required"),process.exit(1)),await lR(t,e)},audit:async t=>{await JX(t)},discover:async t=>{await iQ(t)},agents:async t=>{let e=await Promise.resolve().then(()=>ta(Ia(),1)),r=t.format??"yaml";try{console.log(r==="json"?JSON.stringify(mc,null,2):e.stringify(mc,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};nC(aAe,iAe.version).parse();
3032
3032
  /*! Bundled license information:
3033
3033
 
3034
3034
  agent-contracts/dist/index.js: