artifact-contracts 0.34.2 → 0.34.4
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/cli-contract.yaml +1 -1
- package/dist/artifact-contracts.bundle.mjs +7 -7
- package/dist/artifact-contracts.bundle.mjs.map +2 -2
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +2 -2
- package/dist/generated/contract.js.map +1 -1
- package/dist/generated/program.js +1 -1
- package/dist/generated/program.js.map +1 -1
- package/docs/cli-reference.md +19 -19
- package/package.json +3 -3
package/cli-contract.yaml
CHANGED
|
@@ -1222,7 +1222,7 @@ cli_contracts: 0.1.0
|
|
|
1222
1222
|
|
|
1223
1223
|
info:
|
|
1224
1224
|
title: artifact-contracts CLI
|
|
1225
|
-
version: 0.
|
|
1225
|
+
version: 0.34.4
|
|
1226
1226
|
description: >-
|
|
1227
1227
|
Declarative artifact registry \u2014 define file properties, resolve
|
|
1228
1228
|
paths to artifact IDs, and detect definition overlaps.
|
|
@@ -1920,7 +1920,7 @@ components:
|
|
|
1920
1920
|
"cli_contracts": "0.1.0",
|
|
1921
1921
|
"info": {
|
|
1922
1922
|
"title": "artifact-contracts CLI",
|
|
1923
|
-
"version": "0.
|
|
1923
|
+
"version": "0.34.4",
|
|
1924
1924
|
"description": "Declarative artifact registry \u2014 define file properties, resolve paths to artifact IDs, and detect definition overlaps. stdout is reserved for primary output (JSON/YAML/text result); all diagnostics and progress messages go to stderr.",
|
|
1925
1925
|
"license": {
|
|
1926
1926
|
"name": "MIT"
|
|
@@ -2993,11 +2993,11 @@ components:
|
|
|
2993
2993
|
}
|
|
2994
2994
|
}`;function nC(t,e){let r=new XD;return r.name("artifact-contracts").version(e,"-V, --version").description("Artifact registry CLI \u2014 validate definitions, resolve artifacts, list registered entries, and explain file properties."),r.option("--introspect","Output derived policy as JSON without executing the command"),r.command("validate").description("Validate artifact-contracts definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--check-files","Scan repository files to detect path_patterns overlaps that static glob analysis cannot fully determine. When enabled, reads all files from git ls-files or glob.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("validate",i);console.log(JSON.stringify(o,null,2));return}await t.validate(i,a)}),r.command("resolve").description("Output fully-resolved artifact definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--format <value>","Output format (default: yaml)").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("resolve",i);console.log(JSON.stringify(o,null,2));return}await t.resolve(i,a)}),r.command("list").description("List registered artifacts").option("--config <path>","Path to artifact-contracts.config.yaml").option("--authority <value>","Filter by authority type").option("--path <file>","Reverse-lookup \u2014 show artifact IDs matching this file path. For full governance details, use the explain command.").option("--format <value>","Output format (default: text)").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("list",i);console.log(JSON.stringify(o,null,2));return}await t.list(i,a)}),r.command("explain").description("Explain artifact properties for a file path").argument("<path>","File path to explain").option("--config <path>","Path to artifact-contracts.config.yaml").option("--format <value>","Output format (default: text)").action(async(i,n,a)=>{let o=a.optsWithGlobals();if(o.introspect){let s=ls("explain",n);console.log(JSON.stringify(s,null,2));return}await t.explain(i,n,o)}),r.command("audit").description("LLM-based semantic audit of artifact definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--adapter <value>","LLM adapter to use").option("--model <value>","Model name to pass to the adapter").option("--show-prompt","Output the constructed prompt without calling the LLM API").option("-n, --dry-run","Alias for --show-prompt (output prompt without LLM call)").option("--fail-on <value>","Minimum severity that causes exit 10. Ordering: critical > error > warning > info. For example, --fail-on warning exits 10 on warning, error, or critical.").option("-o, --output <file>","Write result to a file instead of stdout").option("--report-format <value>","Output format for the report (default: text). LLM commands use --report-format; deterministic commands use --format.").option("-l, --log-file <value>","Write agent progress log to this file path.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("audit",i);console.log(JSON.stringify(o,null,2));return}if(i.showPrompt){let o=await t.audit(i,a);typeof o=="string"&&process.stdout.write(o+`
|
|
2995
2995
|
`);return}await t.audit(i,a)}),r.command("discover").description("LLM-based artifact discovery from project file structure").option("--adapter <value>","LLM adapter to use").option("--model <value>","Model name to pass to the adapter").option("--show-prompt","Output the constructed prompt without calling the LLM API").option("-n, --dry-run","Alias for --show-prompt (output prompt without LLM call)").option("-w, --write","Write the generated YAML directly to artifact-contracts.yaml").option("-o, --output <file>","Write result to a specific file path instead of stdout").option("--report-format <value>","Output format (default: yaml)").option("-l, --log-file <value>","Write agent progress log to this file path.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("discover",i);console.log(JSON.stringify(o,null,2));return}if(i.showPrompt){let o=await t.discover(i,a);typeof o=="string"&&process.stdout.write(o+`
|
|
2996
|
-
`);return}await t.discover(i,a)}),r.command("agents").description("Output the full resolved agent DSL as structured data.").option("-F, --format <value>","Output format.","yaml").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("agents",i);console.log(JSON.stringify(o,null,2));return}await t.agents(i,a)}),r.command("extract").description("Extract contract specification for this CLI tool.").argument("[commands...]","Command IDs to extract. Use dot notation.").option("-a, --all","Extract all commands.",!1).option("--include-meta","Include extraction metadata.",!0).option("-F, --format <format>","Output format (yaml or json).","yaml").action(async(i,n
|
|
2997
|
-
`),process.exit(2));let
|
|
2998
|
-
`)}else{let
|
|
2996
|
+
`);return}await t.discover(i,a)}),r.command("agents").description("Output the full resolved agent DSL as structured data.").option("-F, --format <value>","Output format.","yaml").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("agents",i);console.log(JSON.stringify(o,null,2));return}await t.agents(i,a)}),r.command("extract").description("Extract contract specification for this CLI tool.").argument("[commands...]","Command IDs to extract. Use dot notation.").option("-a, --all","Extract all commands.",!1).option("--include-meta","Include extraction metadata.",!0).option("-F, --format <format>","Output format (yaml or json).","yaml").action(async(i,n)=>{i.length===0&&!n.all&&(process.stderr.write(JSON.stringify({code:"INVALID_ARGS",message:"Specify command IDs or use --all"})+`
|
|
2997
|
+
`),process.exit(2));let a=n.format||"yaml",o=JSON.parse(rC),s=n.all?[]:i;if(s.length===0)if(a==="json"){let l={};n.includeMeta&&(l._meta={source:"embedded",type:"cli-contracts/extract",extractedAt:new Date().toISOString(),specVersion:o.cli_contracts??"0.1.0",commands:["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"]}),Object.assign(l,o),process.stdout.write(JSON.stringify(l,null,2)+`
|
|
2998
|
+
`)}else{let l=[];if(l.push("# artifact-contracts extract"),l.push("# source: embedded"),l.push("# type: cli-contracts/command-extract"),n.includeMeta){l.push("---"),l.push("source: embedded"),l.push("type: cli-contracts/command-extract"),l.push("extractedAt: "+new Date().toISOString()),l.push("spec_version: "+(o.cli_contracts??"0.1.0")),l.push("commands:");for(let u of["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"])l.push(" - "+u)}l.push("---"),l.push(tC),process.stdout.write(l.join(`
|
|
2999
2999
|
`)+`
|
|
3000
|
-
`)}else{let
|
|
3000
|
+
`)}else{let l={cli_contracts:o.cli_contracts,info:o.info,command_sets:{}},u=l.command_sets;for(let[d,c]of Object.entries(o.command_sets??{})){let p=c.commands;if(!p)continue;let f={};for(let[m,h]of Object.entries(p)){let g=d+"."+m;s.some(y=>y===m||y===g||m.startsWith(y+"."))&&(f[m]=h)}if(Object.keys(f).length>0){let m={...c};m.commands=f,u[d]=m}}o.components&&(l.components=o.components),process.stdout.write(JSON.stringify(l,null,2)+`
|
|
3001
3001
|
`)}process.exit(0)}),r}rp();var p1=/^[a-z0-9]+(-[a-z0-9]+)*$/,nj=Ve.enum(["canonical","derived","generated","control"]),ij=Ve.enum(["allowed","discouraged","forbidden"]),aj=Ve.enum(["none","approval-required","regeneration-required"]),oj=Ve.enum(["public","internal","private"]),sj=Ve.object({type:Ve.string().min(1),description:Ve.string().optional(),authority:nj,path_patterns:Ve.array(Ve.string().min(1)).min(1),exclude_patterns:Ve.array(Ve.string().min(1)).optional(),manual_edit:ij.optional(),change_control:aj.optional(),visibility:oj.optional(),states:Ve.array(Ve.string()).optional()}).passthrough(),uj=Ve.object({id:Ve.string().min(1),name:Ve.string().optional()}),lj=Ve.enum(["operationId","ast","naming","codegen"]),cj=Ve.object({id:Ve.string().min(1),from:Ve.string().min(1),to:Ve.string().min(1),resolver:lj,description:Ve.string().optional()}).passthrough(),dj=Ve.object({links:Ve.array(cj).min(1)}),np=Ve.object({artifact_contracts:Ve.string().min(1),system:uj,artifacts:Ve.record(Ve.string(),sj),trace:dj.optional()}),ple=Ve.record(Ve.string(),Ve.union([Ve.string(),Ve.array(Ve.string())])),U9=Ve.object({input:Ve.object({files:Ve.array(Ve.string()).default(["artifact-contracts.yaml"])}).optional(),variables:ple.optional()}),fle={canonical:{manual_edit:"allowed",change_control:"none"},derived:{manual_edit:"forbidden",change_control:"regeneration-required"},generated:{manual_edit:"forbidden",change_control:"regeneration-required"},control:{manual_edit:"allowed",change_control:"approval-required"}};function q9(t){let e=fle[t.authority];return{...t,manual_edit:t.manual_edit??e.manual_edit,change_control:t.change_control??e.change_control,visibility:t.visibility??"internal"}}var dg=ta(Ia(),1);import{readFileSync as x7}from"node:fs";import{resolve as $7,dirname as eB}from"node:path";function tB(t){let e=t?[t]:["artifact-contracts.config.yaml","artifact-contracts.config.yml"];for(let r of e)try{let i=x7(r,"utf-8"),n=(0,dg.parse)(i);return U9.parse(n)}catch{if(t)throw new Error(`Config file not found: ${t}`)}return null}function ja(t){let e=tB(t),r=t?eB($7(t)):process.cwd(),i=e?.input?.files??["artifact-contracts.yaml"],n=$7(r,i[0]),a;try{a=x7(n,"utf-8")}catch{throw new Error(`Artifact contracts file not found: ${n}`)}let o=(0,dg.parse)(a),s=k7(o,e?.variables??{}),l=zfe(s,eB(n));return{document:np.parse(l),config:e,configDir:r}}function zfe(t,e){if(t===null||typeof t!="object"||Array.isArray(t))return t;let r=t,i=r.artifacts;if(i===null||typeof i!="object"||Array.isArray(i))return t;let n=i;if(!("$refs"in n))return t;let a=n.$refs;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))throw new Error("artifacts.$refs must be an array of strings");let o={};for(let l of a){let u=$7(e,l),d;try{d=x7(u,"utf-8")}catch{throw new Error(`Referenced artifacts file not found: ${u}`)}let c=(0,dg.parse)(d);if(c===null||typeof c!="object"||Array.isArray(c))throw new Error(`Referenced artifacts file must be a plain object: ${u}`);let p=c;if("$refs"in p)throw new Error(`Nested $refs are not supported: ${u}`);for(let[f,m]of Object.entries(p)){if(f in o)throw new Error(`Duplicate artifact ID "${f}": found in ${o[f].source} and ${u}`);o[f]={def:m,source:u}}}for(let[l,u]of Object.entries(n))if(l!=="$refs"){if(l in o)throw new Error(`Duplicate artifact ID "${l}": found in inline artifacts and ${o[l].source}`);o[l]={def:u,source:"inline"}}let s={};for(let[l,{def:u}]of Object.entries(o))s[l]=u;return{...r,artifacts:s}}function k7(t,e){if(typeof t=="string"){let r=t.match(/^\$\{vars\.(\w+)\}$/);if(r){let i=r[1],n=e[i];if(n===void 0)throw new Error(`Undefined variable: vars.${i}`);return n}return t.replace(/\$\{vars\.(\w+)\}/g,(i,n)=>{let a=e[n];if(a===void 0)throw new Error(`Undefined variable: vars.${n}`);if(Array.isArray(a))throw new Error(`Array variable vars.${n} cannot be used in string interpolation`);return a})}if(Array.isArray(t)){let r=[];for(let i of t){let n=k7(i,e);Array.isArray(n)?r.push(...n):r.push(n)}return r}if(t!==null&&typeof t=="object"){let r={};for(let[i,n]of Object.entries(t))r[i]=k7(n,e);return r}return t}function Na(t){let{document:e}=t,r={};for(let[n,a]of Object.entries(e.artifacts))r[n]=q9(a);let i={artifact_contracts:e.artifact_contracts,system:e.system,artifacts:r};return e.trace&&(i.trace=e.trace),i}Co();function T7(t,e){let r=t.replace(/\\/g,"/");return!(!e.path_patterns.some(n=>yn(r,n,{dot:!0}))||e.exclude_patterns&&e.exclude_patterns.some(a=>yn(r,a,{dot:!0})))}function uc(t,e){let r=[];for(let[i,n]of Object.entries(e))T7(t,n)&&r.push({id:i,artifact:n});return r}function B7(t,e){let r=[];for(let i of t){let n=uc(i,e);n.length>1&&r.push({path:i,matching_artifacts:n.map(a=>a.id)})}return r}import{execSync as Ihe}from"node:child_process";async function lw(t,e={}){let r=[],{document:i}=t,n=np.safeParse(i);if(!n.success){for(let o of n.error.issues)r.push({path:o.path.join("."),message:o.message,severity:"error"});return{valid:!1,diagnostics:r,overlaps:[]}}for(let o of Object.keys(i.artifacts))p1.test(o)||r.push({path:`artifacts.${o}`,message:`Artifact ID "${o}" does not match naming convention: [a-z0-9-]+ (kebab-case)`,severity:"error"}),o.includes(".")&&r.push({path:`artifacts.${o}`,message:`Artifact ID "${o}" contains dots \u2014 reserved for future namespace extension`,severity:"error"});for(let[o,s]of Object.entries(i.artifacts))(!s.path_patterns||s.path_patterns.length===0)&&r.push({path:`artifacts.${o}.path_patterns`,message:`Artifact "${o}" has empty path_patterns`,severity:"error"});if(i.trace){let o=new Set;for(let s=0;s<i.trace.links.length;s++){let l=i.trace.links[s],u=`trace.links[${s}]`;p1.test(l.id)||r.push({path:`${u}.id`,message:`Trace link ID "${l.id}" does not match naming convention: [a-z0-9-]+ (kebab-case)`,severity:"error"}),o.has(l.id)&&r.push({path:`${u}.id`,message:`Duplicate trace link ID "${l.id}"`,severity:"error"}),o.add(l.id),i.artifacts[l.from]||r.push({path:`${u}.from`,message:`Trace link "${l.id}" references unknown artifact "from": ${l.from}`,severity:"error"}),i.artifacts[l.to]||r.push({path:`${u}.to`,message:`Trace link "${l.id}" references unknown artifact "to": ${l.to}`,severity:"error"}),l.from===l.to&&r.push({path:u,message:`Trace link "${l.id}" cannot link an artifact to itself`,severity:"error"})}}let a=[];if(e.checkFiles){a=await jhe(t);for(let o of a)r.push({path:o.path,message:`File "${o.path}" matches multiple artifacts: ${o.matching_artifacts.join(", ")}`,severity:"error"})}return{valid:r.filter(o=>o.severity==="error").length===0,diagnostics:r,overlaps:a}}async function jhe(t){let e=Na(t),r;try{r=Ihe("git ls-files",{encoding:"utf-8",cwd:t.configDir}).trim().split(`
|
|
3002
3002
|
`).filter(Boolean)}catch{try{let{globSync:i}=await Promise.resolve().then(()=>(uw(),sw));r=i("**/*",{cwd:t.configDir,dot:!0,nodir:!0})}catch{return[]}}return B7(r,e.artifacts)}async function nR(t){let e;try{e=ja(t.config)}catch(i){process.stderr.write(`Error: ${i.message}
|
|
3003
3003
|
`),process.exit(3)}let r=await lw(e,{checkFiles:t.checkFiles});if(r.valid)process.stderr.write(`\u2713 Validation passed
|
|
@@ -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.
|
|
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.4"},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:
|