@aipt/cli 0.1.16 → 0.1.18

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.
@@ -41,7 +41,7 @@ ${r}`;if(n===0){let l=e.source.replace(/\n*$/g,"");return`${l}${l.length===0?"":
41
41
  `),await c.sync()}finally{await c.close()}return await Ui(`${o}.tmp`,o),await this.resymbolicate(t.releaseId),s}async resymbolicate(t){let r=await Bf(we.join(this.releases(),t)).catch(()=>[]),n=[];for(let a of r)try{n.push(JSON.parse(await ta(we.join(this.releases(),t,a),"utf8")))}catch{}for(let a of(await this.all()).filter(i=>i.releaseId===t&&i.state==="map-missing")){let i=!1,o=a.error.frames.map(l=>{let p=n.find(f=>new URL(l.file,"http://local").pathname.endsWith(`/${f.registration.asset}`));if(!p||l.line===void 0||l.column===void 0)return l;try{let f=zf(new Ff(p.map),{line:l.line,column:Math.max(0,l.column-1)});return f.source===null||f.line===null||f.column===null?l:(i=!0,{...l,source:f.source.replace(/^file:\/\//,""),sourceLine:f.line,sourceColumn:f.column+1})}catch{return l}});if(!i)continue;let s={...a,error:{...a.error,frames:o},state:"symbolicated"},c=we.join(this.directory(),`${a.eventId}.json`),d=await qi(`${c}.tmp`,"w",384);try{await d.writeFile(`${E(s)}
42
42
  `),await d.sync()}finally{await d.close()}await Ui(`${c}.tmp`,c)}}};var Ue=(e,t,r,n,a)=>({code:e,severity:t,fact:r,message:n,...a===void 0?{}:{action:a}});async function na(e){if(e.lock.capabilities.length===0||e.lock.capabilities.some(r=>r.evidenceIds.length===0))return[Ue("EVIDENCE_INVALID","critical","evidence","\u5DF2\u9A8C\u8BC1\u9501\u7F3A\u5C11\u5B8C\u6574\u8BC1\u636E\u5F15\u7528\u3002","\u91CD\u65B0\u8FD0\u884C\u9A8C\u8BC1\uFF1B\u82E5\u4E8B\u52A1\u672A\u5B8C\u6210\uFF0C\u5148\u6267\u884C\u5B89\u5168\u6062\u590D\u3002")];for(let r of e.lock.capabilities)for(let n of r.evidenceIds)try{let a=$n(JSON.parse(await Wf(Yc.join(e.projectRoot,".dyyto","evidence",`${n}.json`),"utf8")));if(a.evidenceId!==n||a.capabilityId!==r.capabilityId||a.capabilityVersion!==r.version||a.capabilityIntegrity!==r.integrity||a.projectStateDigest!==r.projectStateDigest||a.result!=="passed")return[Ue("EVIDENCE_INVALID","critical","evidence","\u91C7\u7528\u8BC1\u636E\u4E0E\u5DF2\u9A8C\u8BC1\u9501\u7684\u8EAB\u4EFD\u6216\u5DE5\u7A0B\u72B6\u6001\u4E0D\u4E00\u81F4\u3002","\u91CD\u65B0\u8FD0\u884C\u9A8C\u8BC1\uFF1B\u82E5\u73B0\u573A\u5DF2\u53D8\u5316\uFF0C\u5148\u68C0\u67E5\u5E76\u91CD\u65B0\u89C4\u5212\u3002")]}catch{return[Ue("EVIDENCE_INVALID","critical","evidence","\u91C7\u7528\u8BC1\u636E\u7F3A\u5931\u3001\u635F\u574F\u6216\u4E0D\u7B26\u5408\u5951\u7EA6\u3002","\u91CD\u65B0\u8FD0\u884C\u9A8C\u8BC1\uFF1B\u82E5\u4E8B\u52A1\u672A\u5B8C\u6210\uFF0C\u5148\u6267\u884C\u5B89\u5168\u6062\u590D\u3002")]}let t=e.lock.capabilities.reduce((r,n)=>r+n.evidenceIds.length,0);return[Ue("EVIDENCE_VALID","info","evidence",`\u5DF2\u6838\u9A8C ${e.lock.capabilities.length} \u9879\u80FD\u529B\u7684 ${t} \u6761\u91C7\u7528\u8BC1\u636E\u3002`)]}function Hc(e){return e==="adopted"?[]:e==="planned"?[Ue("ADOPTION_PLANNED","warning","lock","\u80FD\u529B\u91C7\u7528\u4ECD\u5904\u4E8E\u8BA1\u5212\u9636\u6BB5\u3002","\u5BA1\u9605\u5E76\u6279\u51C6\u7CBE\u786E Plan\u3002")]:e==="applied-unverified"?[Ue("VERIFICATION_REQUIRED","warning","evidence","\u53D8\u66F4\u5DF2\u5E94\u7528\u4F46\u5C1A\u672A\u5F62\u6210\u9A8C\u8BC1\u8BC1\u636E\u3002","\u8FD0\u884C\u9A8C\u8BC1\u5E76\u63D0\u4EA4\u91C7\u7528\u9501\u3002")]:e==="drifted"?[Ue("REPOSITORY_DRIFT","warning","repository","\u5DE5\u7A0B\u73B0\u573A\u4E0E\u5DF2\u9501\u5B9A\u4E8B\u5B9E\u4E0D\u4E00\u81F4\u3002","\u68C0\u67E5\u5DEE\u5F02\u5E76\u91CD\u65B0\u89C4\u5212\uFF0C\u5E73\u53F0\u4E0D\u4F1A\u8986\u76D6\u7528\u6237\u4FEE\u6539\u3002")]:e==="recovery-required"?[Ue("RECOVERY_REQUIRED","critical","recovery","\u68C0\u6D4B\u5230\u672A\u5B8C\u6210\u7684\u6301\u4E45\u5316\u4E8B\u52A1\u3002","\u5148\u6267\u884C\u5B89\u5168\u6062\u590D\uFF0C\u518D\u7EE7\u7EED\u5176\u4ED6\u64CD\u4F5C\u3002")]:[Ue("FACT_INVALID","critical","manifest","\u5DE5\u7A0B\u5355\u5143\u4E8B\u5B9E\u65E0\u6CD5\u5B89\u5168\u8BFB\u53D6\u3002","\u4FEE\u590D\u8BE5\u5355\u5143\u7684 Manifest \u6216\u5143\u6570\u636E\u540E\u91CD\u65B0\u8BCA\u65AD\u3002")]}async function Kf(e){try{let r=JSON.parse(await Wf(Yc.join(e.workspaceRoot,".dyyto","observability","config.json"),"utf8"));if(!Array.isArray(r.applications)||!r.applications.includes(e.applicationId))return[Ue("OBSERVABILITY_NOT_CONFIGURED","warning","repository","\u5F53\u524D Web \u5E94\u7528\u5C1A\u672A\u914D\u7F6E\u8FD0\u884C\u65F6\u9519\u8BEF\u91C7\u96C6\u3002","\u767B\u8BB0\u5E94\u7528 Origin\uFF0C\u5E76\u542F\u52A8\u672C\u5730\u91C7\u96C6\u7AEF\u3002")]}catch{return[Ue("OBSERVABILITY_NOT_CONFIGURED","warning","repository","\u5F53\u524D Web \u5E94\u7528\u5C1A\u672A\u914D\u7F6E\u8FD0\u884C\u65F6\u9519\u8BEF\u91C7\u96C6\u3002","\u767B\u8BB0\u5E94\u7528 Origin\uFF0C\u5E76\u542F\u52A8\u672C\u5730\u91C7\u96C6\u7AEF\u3002")]}await new yr(e.workspaceRoot).list({applicationId:e.applicationId});let t=(await fE(Yc.join(e.workspaceRoot,".dyyto","observability","quarantine")).catch(()=>[])).length;return t>0?[Ue("OBSERVABILITY_STORE_DAMAGED","critical","repository",`\u8FD0\u884C\u65F6\u9519\u8BEF\u672C\u5730\u5B58\u50A8\u5DF2\u9694\u79BB ${t} \u6761\u635F\u574F\u8BB0\u5F55\uFF0C\u5065\u5EB7\u4E8B\u4EF6\u4ECD\u53EF\u67E5\u8BE2\u3002`,"\u68C0\u67E5\u672C\u673A\u78C1\u76D8\u72B6\u6001\uFF0C\u5E76\u663E\u5F0F\u5904\u7406\u9694\u79BB\u8BB0\u5F55\u3002")]:[Ue("OBSERVABILITY_CONFIGURED","info","repository","\u8FD0\u884C\u65F6\u9519\u8BEF\u91C7\u96C6\u914D\u7F6E\u4E0E\u672C\u5730\u5B58\u50A8\u53EF\u8BFB\u53D6\u3002")]}function Yf(e){let t=e.units.map(n=>{let a=n.findings.some(i=>i.severity==="critical")?"blocked":n.findings.some(i=>i.severity==="warning")?"attention":"healthy";return{...n,status:a}}),r={total:t.length,healthy:t.filter(n=>n.status==="healthy").length,attention:t.filter(n=>n.status==="attention").length,blocked:t.filter(n=>n.status==="blocked").length};return{schemaVersion:1,workspace:e.workspace,generatedAt:e.generatedAt,status:r.blocked>0?"blocked":r.attention>0?"attention":"healthy",summary:r,units:t}}import{readFile as aa,realpath as Hf}from"node:fs/promises";import wr from"node:path";var ne=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Xf(e){let t=await Hf(wr.resolve(e.projectRoot)),r=K(e.manifest),n=e.release.release,a=e.currentLock.capabilities.find(f=>f.capabilityId===n.capabilityId&&f.version===n.version);if(!a||a.packageAdoption!==void 0)throw new ne("CAPABILITY_RELEASE_VERSION_UNSUPPORTED","Asset-only removal requires an adopted Capability without package ownership");let i=K({...r,capabilities:r.capabilities.filter(f=>f.capabilityId!==n.capabilityId)}),o=Buffer.from(`${JSON.stringify(i,null,2)}
43
43
  `),s=await ia(t,"project-capabilities.json");if(!s.exists||s.digest===void 0)throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","Project manifest is unavailable");let c=[{path:"project-capabilities.json",kind:"replace",ownership:"owned-file",baseDigest:s.digest,desiredDigest:v(o)},...a.assets.map(f=>({path:f.path,kind:"remove",ownership:f.ownership??"owned-file",baseDigest:f.digest}))],d=await Promise.all(c.map(f=>ia(t,f.path))),l={schemaVersion:1,capabilityId:n.capabilityId,version:n.version,integrity:n.integrity,assets:a.assets.map(f=>({path:f.path,ownership:f.ownership??"owned-file",desiredDigest:f.digest})),verifiers:n.verifiers.map(f=>({id:f.id,kind:"file-digest"}))};return{plan:Oe({action:"remove",capability:l,changes:c,observedAssets:d,generatedAt:e.generatedAt,expiresAt:e.expiresAt}),manifest:i,desiredContents:new Map([["project-capabilities.json",o]]),transactionRoot:t,removedSources:[]}}async function ia(e,t){try{let r=await aa(wr.join(e,...t.split("/")));return{path:t,exists:!0,digest:v(r)}}catch(r){if(r.code==="ENOENT")return{path:t,exists:!1};throw r}}async function Xc(e){if(e.release.release.schemaVersion===2&&e.release.release.packageSources.length>0&&e.packageSource===void 0)throw new ne("CAPABILITY_RELEASE_VERSION_UNSUPPORTED","Capability Release v2 requires verified package source facts");let t=await Hf(wr.resolve(e.projectRoot)),r=K(e.manifest),n=e.release.release,a=e.packageSource?.topology,i=a?.transactionRoot??t,o=k=>a?.mode==="pnpm-shared-lockfile"?`${a.unitRelativeRoot}/${k}`:k;if(n.kind!=="engineering-feature"||n.consumerProfile!=="any-project")throw new ne("CAPABILITY_KIND_UNSUPPORTED","Only an addable engineering feature can use this lifecycle");if(r.capabilities.some(k=>k.capabilityId===n.capabilityId))throw new ne("CAPABILITY_ALREADY_SELECTED","The capability is already selected by this project");let s=r.profile?.id,c=s==="typescript-library"?"blank-typescript-library":s,d=n.dependencies?.profiles??[],l=e.currentLock.capabilities.find(k=>k.consumerProfile===c);if(c===void 0||!d.includes(c)||l===void 0)throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","The project profile does not satisfy this capability dependency");if((n.dependencies?.capabilities??[]).some(k=>!r.capabilities.some(S=>S.capabilityId===k)||!e.currentLock.capabilities.some(S=>S.capabilityId===k)))throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","A required project capability is not adopted and verified");let f=K({...r,capabilities:[...r.capabilities,{capabilityId:n.capabilityId,version:n.version}]}),u=o("project-capabilities.json"),m=Buffer.from(`${JSON.stringify(f,null,2)}
44
- `),g=await ia(i,u);if(!g.exists||g.digest===void 0)throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","The project manifest is unavailable");let h=[{path:u,kind:"replace",ownership:"owned-file",baseDigest:g.digest,desiredDigest:v(m)}],w=new Map([[u,m]]),_;if(n.schemaVersion===2&&n.packageSources.length>0){if(e.packageSource===void 0)throw new ne("CAPABILITY_RELEASE_VERSION_UNSUPPORTED","Capability Release v2 requires verified package source facts");let k;try{k=await aa(wr.join(t,"package.json"))}catch{throw new ne("CAPABILITY_PACKAGE_SOURCE_INVALID","\u9879\u76EE package.json \u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u5305\u91C7\u7528\u8BA1\u5212")}try{let S=e.packageSource.currentLockfile??await aa(wr.join(t,"pnpm-lock.yaml")).catch(re=>re.code==="ENOENT"?void 0:Promise.reject(re)),O=e.packageSource.topology??{schemaVersion:1,mode:"standalone",transactionRoot:t,unitRoot:t,unitRelativeRoot:".",unitImporterId:".",lockfilePath:"pnpm-lock.yaml"},ae=O.mode==="pnpm-shared-lockfile",$={mode:O.mode,unitRelativeRoot:O.unitRelativeRoot,unitImporterId:O.unitImporterId,lockfilePath:O.lockfilePath,...O.workspaceManifestPath?{workspaceManifestPath:O.workspaceManifestPath,workspaceManifestDigest:O.workspaceManifestDigest}:{}},P={registryConfigs:e.packageSource.registryConfigs,endpointBindings:e.packageSource.endpointBindings,receipts:e.packageSource.receipts,inspections:e.packageSource.inspections};if(ae&&(!e.packageSource.resolutionEvidence||!e.packageSource.resolutionWorkerReleaseId))throw new Y("PACKAGE_SOURCE_POLICY_VIOLATION");let W=ae?(e.packageChannel==="development"?Di:Ni)({release:n,...P,consumerProfile:c,packageJson:k,currentLockfile:S,generatedAt:e.generatedAt,expiresAt:e.expiresAt,topology:$,preservedImporterDigests:e.packageSource.preservedImporterDigests??[],resolutionEvidence:e.packageSource.resolutionEvidence,resolutionWorkerReleaseId:e.packageSource.resolutionWorkerReleaseId}):(e.packageChannel==="development"?Pi:Ri)({release:n,...P,lockResolution:e.packageSource.lockResolution,consumerProfile:c,packageJson:k,...S===void 0?{}:{currentLockfile:S},generatedAt:e.generatedAt,expiresAt:e.expiresAt});_=_i(W),h.push({path:o("package.json"),kind:"replace",ownership:"owned-file",baseDigest:W.packageJsonPreimageDigest,desiredDigest:W.desiredPackageJsonDigest}),w.set(o("package.json"),W.desiredPackageJson),h.push({path:O.lockfilePath,kind:S===void 0?"create":"replace",ownership:"owned-file",...S===void 0?{}:{baseDigest:v(S)},desiredDigest:W.desiredLockfileDigest}),w.set(O.lockfilePath,W.desiredLockfile)}catch(S){throw S instanceof Y?new ne("CAPABILITY_PACKAGE_SOURCE_INVALID",S.code):S}}for(let k of n.assets){let S=e.release.contents.get(k.path);if(S===void 0)throw new ne("CAPABILITY_KIND_UNSUPPORTED","Capability asset content is unavailable");let O=k.renderer==="application-config-contract-v1"?Si(r):k.renderer==="application-config-binding-v1"?ji(r):S;if(k.ownership==="managed-region"){if(k.regionId===void 0)throw new ne("CAPABILITY_KIND_UNSUPPORTED","Managed region identity is unavailable");let ae;try{ae=await aa(wr.join(t,...k.path.split("/")))}catch{throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","The managed shared file is unavailable")}let $=Buffer.from(hu({source:ae.toString("utf8"),regionId:k.regionId,content:Buffer.from(O).toString("utf8")}));h.push({path:o(k.path),kind:"merge",ownership:"managed-region",regionId:k.regionId,baseDigest:v(ae),desiredDigest:v($)}),w.set(o(k.path),$)}else{let ae=await ia(t,k.path);if(k.ownership==="seed-file"&&ae.exists){let $=await aa(wr.join(t,...k.path.split("/")));h.push({path:o(k.path),kind:"create",ownership:"seed-file",desiredDigest:v($)}),w.set(o(k.path),$)}else h.push({path:o(k.path),kind:"create",ownership:k.ownership,desiredDigest:v(O)}),w.set(o(k.path),O)}}let I=await Promise.all(h.map(k=>ia(i,k.path))),A={schemaVersion:1,capabilityId:n.capabilityId,version:n.version,integrity:n.integrity,assets:h.filter(k=>k.path!==u&&k.path!==a?.lockfilePath).map(k=>({path:a?.mode==="pnpm-shared-lockfile"?k.path.slice(a.unitRelativeRoot.length+1):k.path,ownership:k.ownership,desiredDigest:k.desiredDigest})),verifiers:n.verifiers.map(k=>({id:k.id,kind:"file-digest"}))};return{plan:Oe({action:"adopt",capability:A,changes:h,observedAssets:I,generatedAt:e.generatedAt,expiresAt:e.expiresAt,..._===void 0?{}:{packageAdoption:_}}),manifest:f,desiredContents:w,transactionRoot:i,dependency:{profile:c,satisfied:!0}}}var Zf=Ir(tr(),1);var mE={$id:"https://schemas.dyyto.dev/platform/solution-catalog-entry-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","solutionId","version","integrity","title","summary","maturity","members","integration","exit"],properties:{schemaVersion:{const:1},solutionId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},maturity:{enum:["guided","automated"]},members:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","role","required"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},role:{type:"string",minLength:1,maxLength:80},required:{type:"boolean"}}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","steps","verification","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},steps:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["label","command"],properties:{label:{type:"string",minLength:1,maxLength:80},command:{type:"string",minLength:1,maxLength:2e3}}}},verification:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:1e3}},result:{type:"string",minLength:1,maxLength:400}}},exit:{type:"object",additionalProperties:!1,required:["summary"],properties:{summary:{type:"string",minLength:1,maxLength:400}}}}},ZN=new Zf.Ajv2020({allErrors:!0,strict:!0}).compile(mE);var nm=Ir(tr(),1);import{readFile as gE,realpath as hE}from"node:fs/promises";import Qf from"node:path";var em="^[a-z0-9]+(?:[.-][a-z0-9]+)*$",tm="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)[^\\u0000]+$",yE={$id:"https://schemas.dyyto.dev/platform/example-recipe-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","recipeId","version","integrity","title","locale","rootProfile","capabilities","expectedEntrypoint","verifiers","manualAcceptance","cleanup"],properties:{schemaVersion:{const:1},recipeId:{type:"string",pattern:em},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},locale:{const:"zh-CN"},rootProfile:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128}}},capabilities:{type:"array",minItems:1,maxItems:16,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","channel"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},channel:{const:"development"}}}},expectedEntrypoint:{type:"string",pattern:tm,maxLength:240},verifiers:{type:"array",minItems:1,maxItems:16,uniqueItems:!0,items:{type:"string",pattern:em}},manualAcceptance:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:240}},cleanup:{type:"object",additionalProperties:!1,required:["ownedStateDirectories"],properties:{ownedStateDirectories:{type:"array",maxItems:8,uniqueItems:!0,items:{type:"string",pattern:tm,maxLength:240}}}}}},rm=new nm.Ajv2020({allErrors:!0,strict:!0}).compile(yE),vr=class extends Error{code;issues;constructor(t,r=[]){super(t),this.code=t,this.issues=r}};function wE(e){return v(E(e))}function vE(e){if(!rm(e))throw new vr("EXAMPLE_RECIPE_INVALID",rm.errors??[]);let t=e,r=[t.rootProfile.capabilityId,...t.capabilities.map(n=>n.capabilityId)];if(new Set(r).size!==r.length||t.capabilities.some(n=>n.version.includes("workspace:")||n.capabilityId.includes("ai-education-poc")))throw new vr("EXAMPLE_RECIPE_INVALID");return t}async function am(e){let t=await hE(Qf.resolve(e)),r;try{r=vE(JSON.parse(await gE(Qf.join(t,"recipe.json"),"utf8")))}catch(i){throw i instanceof vr?i:new vr("EXAMPLE_RECIPE_INVALID")}let{integrity:n,...a}=r;if(wE(a)!==n)throw new vr("EXAMPLE_RECIPE_INTEGRITY_MISMATCH");return r}var sm=Ir(tr(),1);import{readFile as IE,realpath as bE}from"node:fs/promises";import im from"node:path";var kE={$id:"https://schemas.dyyto.dev/platform/engineering-template-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","templateId","version","integrity","title","summary","status","profile","parameters","commands","technology","support","integration","metrics"],properties:{schemaVersion:{const:1},templateId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},status:{enum:["candidate","recommended","deprecated"]},profile:{type:"object",additionalProperties:!1,required:["id","capability"],properties:{id:{type:"string",pattern:H},capability:{type:"string",pattern:`${H.slice(1,-1)}@[0-9]+\\.[0-9]+\\.[0-9]+$`}}},parameters:{type:"array",minItems:0,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","required","description"],properties:{id:{type:"string",pattern:"^[a-z][A-Za-z0-9]*$"},required:{type:"boolean"},description:{type:"string",minLength:1,maxLength:160}}}},commands:{type:"object",minProperties:1,additionalProperties:!1,properties:{dev:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},build:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},test:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},package:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"}}},technology:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","version","policy","verifiedAt","rationale","alternative","exit"],properties:{id:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:64},policy:{enum:["recommended","allowed"]},verifiedAt:{type:"string",format:"date"},rationale:{type:"string",minLength:1,maxLength:240},alternative:{type:"string",minLength:1,maxLength:160},exit:{type:"string",minLength:1,maxLength:240}}}},support:{type:"object",additionalProperties:!1,required:["owner","tier","supportedFrom","supportedUntil","upgradeCadence","eolNoticeDays"],properties:{owner:{type:"string",pattern:H},tier:{const:"production"},supportedFrom:{type:"string",format:"date"},supportedUntil:{type:"string",format:"date"},upgradeCadence:{type:"string",minLength:1,maxLength:80},eolNoticeDays:{type:"integer",minimum:30,maximum:730}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","createCommand","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},createCommand:{type:"string",minLength:1,maxLength:2e3},result:{type:"string",minLength:1,maxLength:400}}},metrics:{type:"array",minItems:1,uniqueItems:!0,items:{enum:["time-to-green-build","time-to-first-business-commit","manual-engineering-edits","upgrade-conflicts"]}}}},om=new sm.Ajv2020({allErrors:!0,strict:!0,formats:{date:/^\d{4}-\d{2}-\d{2}$/}}).compile(kE),Et=class extends Error{code;issues;constructor(t,r=[]){super(t),this.code=t,this.issues=r}};function _E(e){return v(E(e))}function EE(e){if(!om(e))throw new Et("TEMPLATE_INVALID",om.errors??[]);let t=e;if(new Set(t.parameters.map(r=>r.id)).size!==t.parameters.length||new Set(t.technology.map(r=>r.id)).size!==t.technology.length)throw new Et("TEMPLATE_INVALID");if(Date.parse(t.support.supportedUntil)<=Date.parse(t.support.supportedFrom))throw new Et("TEMPLATE_INVALID");return t}async function oa(e,t=new Date){let r=await bE(im.resolve(e)),n;try{n=EE(JSON.parse(await IE(im.join(r,"template.json"),"utf8")))}catch(o){throw o instanceof Et?o:new Et("TEMPLATE_INVALID")}let{integrity:a,...i}=n;if(_E(i)!==a)throw new Et("TEMPLATE_INTEGRITY_MISMATCH");if(n.status==="recommended"&&Date.parse(n.support.supportedUntil)<t.getTime())throw new Et("TEMPLATE_SUPPORT_EXPIRED");return n}import{readFile as cm}from"node:fs/promises";import lm from"node:path";var AE=/^[A-Z][A-Z0-9_]*$/u,RE=/(?:API_KEY|ACCESS_KEY|SECRET|TOKEN|PASSWORD|PRIVATE_KEY|DATABASE_URL|POSTGRES_URL)$/u;function PE(e){let t=new Map;for(let r of e.split(/\r?\n/u)){let n=/^([A-Z][A-Z0-9_]*)=(.*)$/u.exec(r.trim());if(!n||!AE.test(n[1]))continue;let a=n[1],i=n[2].trim();t.set(a,{name:a,requirement:i.length===0?"conditional":"optional",secret:RE.test(a),configured:!1,source:".env.example",configuredSource:null})}return[...t.values()]}async function dm(e){let t=await cm(lm.join(e.projectRoot,".env.example"),"utf8").then(()=>".env.example").catch(()=>null),r=t?await cm(lm.join(e.projectRoot,t),"utf8"):"",n=await $i({projectRoot:e.projectRoot}).catch(()=>null);return{commands:["dev","build","test","package"].flatMap(i=>e.commands[i]?[{id:i,script:e.commands[i],mode:i==="dev"?"managed-process":"foreground-task"}]:[]),environment:n?n.entries.map(i=>({name:i.name,requirement:i.required?"conditional":"optional",secret:i.kind!=="value",configured:i.configured,source:"application-config-contract",configuredSource:"APP_CONFIG_DIR",display:i.display,...i.fingerprint?{fingerprint:i.fingerprint}:{}})):PE(r),environmentExample:t,productionValidation:{contract:!0,live:["provider-read","oss-write-read-delete"]}}}var pm={change:new Set(["plan","apply","upgrade","recover","baseline-next","add-package","add-application","add-feature"]),quality:new Set(["inspect","verify","doctor","maintenance","test","build"]),delivery:new Set(["package","delivery-plan","delivery-apply","delivery-inspect"])},um=new Set(["queued","running","succeeded","failed","outcome-unknown","cancelled"]);function fm(e,t){if(!pm[t.plane]||t.state&&!um.has(t.state)||t.limit!==void 0&&(!Number.isSafeInteger(t.limit)||t.limit<1||t.limit>200))throw new Error("OPERATION_FILTER_INVALID");let r=pm[t.plane],n=t.from?Date.parse(t.from):null,a=t.to?Date.parse(t.to):null;if(n!==null&&Number.isNaN(n)||a!==null&&Number.isNaN(a)||n!==null&&a!==null&&n>a)throw new Error("OPERATION_FILTER_INVALID");let i=e.filter(d=>r.has(d.operation)),o=[...new Map(i.map(d=>[d.projectId,{id:d.projectId,name:d.projectName}])).values()].sort((d,l)=>d.name.localeCompare(l.name)),s=i.filter(d=>(!t.projectId||d.projectId===t.projectId)&&(!t.state||d.state===t.state)&&(!t.kind||d.operation===t.kind)&&(n===null||Date.parse(d.createdAt)>=n)&&(a===null||Date.parse(d.createdAt)<=a)).sort((d,l)=>l.updatedAt.localeCompare(d.updatedAt)),c={total:s.length,running:s.filter(d=>d.state==="running"||d.state==="queued").length,succeeded:s.filter(d=>d.state==="succeeded").length,attention:s.filter(d=>d.state==="failed"||d.state==="outcome-unknown").length};return Object.freeze({schemaVersion:1,plane:t.plane,summary:Object.freeze(c),facets:Object.freeze({projects:Object.freeze(o),states:Object.freeze([...um]),kinds:Object.freeze([...r])}),items:Object.freeze(s.slice(0,t.limit??50).map(Object.freeze)),hasMore:s.length>(t.limit??50)})}var sa=class extends Error{code;constructor(t,r){super(r),this.code=t}},Qc=/^sha256:[a-f0-9]{64}$/u,NE=/^sha512-[A-Za-z0-9+/]{86}==$/u,DE=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u,SE=/^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$/u,jE=/[\u0000-\u001f\u007f]/u;function Xr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function Zr(e,t){let r=Object.keys(e).sort(),n=[...t].sort();return r.length===n.length&&r.every((a,i)=>a===n[i])}function At(e,t=500){return typeof e=="string"&&e.length>0&&e.length<=t&&!jE.test(e)}function Zc(e){return At(e,500)&&!e.startsWith("/")&&!e.startsWith("../")&&!e.includes("/../")&&!e.includes("\\")}function mm(e,t=128){return Array.isArray(e)&&e.length<=t&&e.every(r=>At(r,500))&&e.every((r,n)=>n===0||e[n-1]<r)}function $E(e){return e===null?!0:!Xr(e)||!Zr(e,["fileName","digest","integrity","fileCount","unpackedBytes"])?!1:Zc(e.fileName)&&Qc.test(String(e.digest))&&NE.test(String(e.integrity))&&Number.isSafeInteger(e.fileCount)&&Number(e.fileCount)>0&&Number.isSafeInteger(e.unpackedBytes)&&Number(e.unpackedBytes)>0}function OE(e){if(!Xr(e)||!Zr(e,["schemaVersion","kind","packageName","version","title","summary","maturity","source","artifact","compatibility","exports","documentation","consumerEvidence"])||e.schemaVersion!==1||e.kind!=="PackageRelease"||!DE.test(e.packageName)||!SE.test(e.version)||!At(e.title,120)||!At(e.summary,1e3)||!["candidate","stable","deprecated"].includes(e.maturity)||!Xr(e.source)||!Zr(e.source,["repository","path","revision","treeDigest"])||!At(e.source.repository)||!Zc(e.source.path)||!At(e.source.revision,200)||!Qc.test(String(e.source.treeDigest))||!$E(e.artifact)||!Xr(e.compatibility)||!Zr(e.compatibility,["node","packageManager"])||!At(e.compatibility.node,100)||!At(e.compatibility.packageManager,100)||!mm(e.exports)||!mm(e.consumerEvidence)||!Xr(e.documentation))return!1;let t=e.documentation.knowledgeRef===void 0?["readme"]:["readme","knowledgeRef"];return!Zr(e.documentation,t)||!Zc(e.documentation.readme)||e.documentation.knowledgeRef!==void 0&&!At(e.documentation.knowledgeRef,500)?!1:e.artifact!==null||e.maturity!=="stable"}function CE(e){let t={schemaVersion:1,kind:"PackageRelease",...e,source:Object.freeze({...e.source}),artifact:e.artifact===null?null:Object.freeze({...e.artifact}),compatibility:Object.freeze({...e.compatibility}),exports:Object.freeze([...e.exports]),documentation:Object.freeze({...e.documentation}),consumerEvidence:Object.freeze([...e.consumerEvidence])};if(!OE(t))throw new sa("PACKAGE_RELEASE_INVALID","PackageRelease \u5185\u5BB9\u65E0\u6548");return Object.freeze({...t,releaseDigest:v(E(t))})}function gm(e){if(!Xr(e)||!Zr(e,["schemaVersion","kind","packageName","version","title","summary","maturity","source","artifact","compatibility","exports","documentation","consumerEvidence","releaseDigest"])||!Qc.test(String(e.releaseDigest)))throw new sa("PACKAGE_RELEASE_INVALID","PackageRelease \u7ED3\u6784\u65E0\u6548");let{releaseDigest:t,schemaVersion:r,kind:n,...a}=e,i=CE(a);if(i.releaseDigest!==t)throw new sa("PACKAGE_RELEASE_MODIFIED","PackageRelease \u5DF2\u88AB\u4FEE\u6539");return i}import{lstat as TE,readFile as xE,realpath as LE}from"node:fs/promises";import hm from"node:path";async function ym(e){let t=await LE(hm.resolve(e.projectRoot)),r=new Set(e.excludeCapabilityIds??[]),n=new Map,a=[...e.lock.capabilities].sort((o,s)=>o.committedAt.localeCompare(s.committedAt)||o.capabilityId.localeCompare(s.capabilityId));for(let o of a)if(!r.has(o.capabilityId))for(let s of o.assets){let c=s.ownership??"owned-file",d=`${s.path}\0`;if(c==="managed-region")n.delete(d);else for(let p of n.keys())p.startsWith(d)&&n.delete(p);let l=c==="managed-region"?`${d}${s.regionId??""}`:d;n.set(l,{capabilityId:o.capabilityId,path:s.path,digest:s.digest,ownership:c,...s.regionId===void 0?{}:{regionId:s.regionId}})}let i=[];for(let o of[...n.values()].sort((s,c)=>s.path.localeCompare(c.path)||(s.regionId??"").localeCompare(c.regionId??"")||s.capabilityId.localeCompare(c.capabilityId))){let s=hm.join(t,...o.path.split("/")),d=await TE(s).then(async l=>{if(!l.isFile()||l.isSymbolicLink())return;let p=await xE(s);if(o.ownership!=="managed-region")return v(p);if(o.regionId!==void 0)try{return v(Xa(p.toString("utf8"),o.regionId))}catch{return}}).catch(l=>l.code==="ENOENT"?void 0:Promise.reject(l))===o.digest;i.push({capabilityId:o.capabilityId,path:o.path,kind:"create",ownership:o.ownership,...o.regionId===void 0?{}:{regionId:o.regionId},desiredDigest:o.digest,disposition:d?"noop":"conflict",...d?{}:{conflictCode:"BASE_DIGEST_MISMATCH"}})}return i}var el="0.1.16",ca={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},VE=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function wm(e,t){return typeof e=="string"&&e.length>0&&e.length<=t&&!VE.test(e)}function ME(e){let t={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:ca[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},r=qE(t);if(r===null)throw new TypeError("CLI domain error input is invalid");return r}function qE(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let t=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(t).some(s=>typeof s=="symbol"))return null;let r=Object.keys(t).sort(),n="nextStep"in t?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(r.length!==n.length||r.some((s,c)=>s!==n[c])||Object.values(t).some(s=>!("value"in s)))return null;let a=s=>t[s]?.value,i=a("code");if(a("schemaVersion")!==1||a("kind")!=="dyyto-cli-domain-error"||typeof i!="string"||!(i in ca)||a("exitCode")!==ca[i]||!wm(a("message"),500))return null;let o=a("nextStep");return o!==void 0&&!wm(o,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:i,message:a("message"),exitCode:4,...o===void 0?{}:{nextStep:o}})}catch{return null}}var Ce=class extends Error{code;exitCode;nextStep;domainError;constructor(t){super(t.message),this.name="CliError",this.code=t.code,this.exitCode=t.exitCode,this.nextStep=t.nextStep,this.domainError=t.code in ca&&t.exitCode===ca[t.code]?ME({code:t.code,message:t.message,...t.nextStep===void 0?{}:{nextStep:t.nextStep}}):void 0}};var vm=`Dyyto Engineering Platform CLI
44
+ `),g=await ia(i,u);if(!g.exists||g.digest===void 0)throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","The project manifest is unavailable");let h=[{path:u,kind:"replace",ownership:"owned-file",baseDigest:g.digest,desiredDigest:v(m)}],w=new Map([[u,m]]),_;if(n.schemaVersion===2&&n.packageSources.length>0){if(e.packageSource===void 0)throw new ne("CAPABILITY_RELEASE_VERSION_UNSUPPORTED","Capability Release v2 requires verified package source facts");let k;try{k=await aa(wr.join(t,"package.json"))}catch{throw new ne("CAPABILITY_PACKAGE_SOURCE_INVALID","\u9879\u76EE package.json \u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u5305\u91C7\u7528\u8BA1\u5212")}try{let S=e.packageSource.currentLockfile??await aa(wr.join(t,"pnpm-lock.yaml")).catch(re=>re.code==="ENOENT"?void 0:Promise.reject(re)),O=e.packageSource.topology??{schemaVersion:1,mode:"standalone",transactionRoot:t,unitRoot:t,unitRelativeRoot:".",unitImporterId:".",lockfilePath:"pnpm-lock.yaml"},ae=O.mode==="pnpm-shared-lockfile",$={mode:O.mode,unitRelativeRoot:O.unitRelativeRoot,unitImporterId:O.unitImporterId,lockfilePath:O.lockfilePath,...O.workspaceManifestPath?{workspaceManifestPath:O.workspaceManifestPath,workspaceManifestDigest:O.workspaceManifestDigest}:{}},P={registryConfigs:e.packageSource.registryConfigs,endpointBindings:e.packageSource.endpointBindings,receipts:e.packageSource.receipts,inspections:e.packageSource.inspections};if(ae&&(!e.packageSource.resolutionEvidence||!e.packageSource.resolutionWorkerReleaseId))throw new Y("PACKAGE_SOURCE_POLICY_VIOLATION");let W=ae?(e.packageChannel==="development"?Di:Ni)({release:n,...P,consumerProfile:c,packageJson:k,currentLockfile:S,generatedAt:e.generatedAt,expiresAt:e.expiresAt,topology:$,preservedImporterDigests:e.packageSource.preservedImporterDigests??[],resolutionEvidence:e.packageSource.resolutionEvidence,resolutionWorkerReleaseId:e.packageSource.resolutionWorkerReleaseId}):(e.packageChannel==="development"?Pi:Ri)({release:n,...P,lockResolution:e.packageSource.lockResolution,consumerProfile:c,packageJson:k,...S===void 0?{}:{currentLockfile:S},generatedAt:e.generatedAt,expiresAt:e.expiresAt});_=_i(W),h.push({path:o("package.json"),kind:"replace",ownership:"owned-file",baseDigest:W.packageJsonPreimageDigest,desiredDigest:W.desiredPackageJsonDigest}),w.set(o("package.json"),W.desiredPackageJson),h.push({path:O.lockfilePath,kind:S===void 0?"create":"replace",ownership:"owned-file",...S===void 0?{}:{baseDigest:v(S)},desiredDigest:W.desiredLockfileDigest}),w.set(O.lockfilePath,W.desiredLockfile)}catch(S){throw S instanceof Y?new ne("CAPABILITY_PACKAGE_SOURCE_INVALID",S.code):S}}for(let k of n.assets){let S=e.release.contents.get(k.path);if(S===void 0)throw new ne("CAPABILITY_KIND_UNSUPPORTED","Capability asset content is unavailable");let O=k.renderer==="application-config-contract-v1"?Si(r):k.renderer==="application-config-binding-v1"?ji(r):S;if(k.ownership==="managed-region"){if(k.regionId===void 0)throw new ne("CAPABILITY_KIND_UNSUPPORTED","Managed region identity is unavailable");let ae;try{ae=await aa(wr.join(t,...k.path.split("/")))}catch{throw new ne("CAPABILITY_DEPENDENCY_UNSATISFIED","The managed shared file is unavailable")}let $=Buffer.from(hu({source:ae.toString("utf8"),regionId:k.regionId,content:Buffer.from(O).toString("utf8")}));h.push({path:o(k.path),kind:"merge",ownership:"managed-region",regionId:k.regionId,baseDigest:v(ae),desiredDigest:v($)}),w.set(o(k.path),$)}else{let ae=await ia(t,k.path);if(k.ownership==="seed-file"&&ae.exists){let $=await aa(wr.join(t,...k.path.split("/")));h.push({path:o(k.path),kind:"create",ownership:"seed-file",desiredDigest:v($)}),w.set(o(k.path),$)}else h.push({path:o(k.path),kind:"create",ownership:k.ownership,desiredDigest:v(O)}),w.set(o(k.path),O)}}let I=await Promise.all(h.map(k=>ia(i,k.path))),A={schemaVersion:1,capabilityId:n.capabilityId,version:n.version,integrity:n.integrity,assets:h.filter(k=>k.path!==u&&k.path!==a?.lockfilePath).map(k=>({path:a?.mode==="pnpm-shared-lockfile"?k.path.slice(a.unitRelativeRoot.length+1):k.path,ownership:k.ownership,desiredDigest:k.desiredDigest})),verifiers:n.verifiers.map(k=>({id:k.id,kind:"file-digest"}))};return{plan:Oe({action:"adopt",capability:A,changes:h,observedAssets:I,generatedAt:e.generatedAt,expiresAt:e.expiresAt,..._===void 0?{}:{packageAdoption:_}}),manifest:f,desiredContents:w,transactionRoot:i,dependency:{profile:c,satisfied:!0}}}var Zf=Ir(tr(),1);var mE={$id:"https://schemas.dyyto.dev/platform/solution-catalog-entry-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","solutionId","version","integrity","title","summary","maturity","members","integration","exit"],properties:{schemaVersion:{const:1},solutionId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},maturity:{enum:["guided","automated"]},members:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","role","required"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},role:{type:"string",minLength:1,maxLength:80},required:{type:"boolean"}}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","steps","verification","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},steps:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["label","command"],properties:{label:{type:"string",minLength:1,maxLength:80},command:{type:"string",minLength:1,maxLength:2e3}}}},verification:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:1e3}},result:{type:"string",minLength:1,maxLength:400}}},exit:{type:"object",additionalProperties:!1,required:["summary"],properties:{summary:{type:"string",minLength:1,maxLength:400}}}}},ZN=new Zf.Ajv2020({allErrors:!0,strict:!0}).compile(mE);var nm=Ir(tr(),1);import{readFile as gE,realpath as hE}from"node:fs/promises";import Qf from"node:path";var em="^[a-z0-9]+(?:[.-][a-z0-9]+)*$",tm="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)[^\\u0000]+$",yE={$id:"https://schemas.dyyto.dev/platform/example-recipe-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","recipeId","version","integrity","title","locale","rootProfile","capabilities","expectedEntrypoint","verifiers","manualAcceptance","cleanup"],properties:{schemaVersion:{const:1},recipeId:{type:"string",pattern:em},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},locale:{const:"zh-CN"},rootProfile:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128}}},capabilities:{type:"array",minItems:1,maxItems:16,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","channel"],properties:{capabilityId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},channel:{const:"development"}}}},expectedEntrypoint:{type:"string",pattern:tm,maxLength:240},verifiers:{type:"array",minItems:1,maxItems:16,uniqueItems:!0,items:{type:"string",pattern:em}},manualAcceptance:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:240}},cleanup:{type:"object",additionalProperties:!1,required:["ownedStateDirectories"],properties:{ownedStateDirectories:{type:"array",maxItems:8,uniqueItems:!0,items:{type:"string",pattern:tm,maxLength:240}}}}}},rm=new nm.Ajv2020({allErrors:!0,strict:!0}).compile(yE),vr=class extends Error{code;issues;constructor(t,r=[]){super(t),this.code=t,this.issues=r}};function wE(e){return v(E(e))}function vE(e){if(!rm(e))throw new vr("EXAMPLE_RECIPE_INVALID",rm.errors??[]);let t=e,r=[t.rootProfile.capabilityId,...t.capabilities.map(n=>n.capabilityId)];if(new Set(r).size!==r.length||t.capabilities.some(n=>n.version.includes("workspace:")||n.capabilityId.includes("ai-education-poc")))throw new vr("EXAMPLE_RECIPE_INVALID");return t}async function am(e){let t=await hE(Qf.resolve(e)),r;try{r=vE(JSON.parse(await gE(Qf.join(t,"recipe.json"),"utf8")))}catch(i){throw i instanceof vr?i:new vr("EXAMPLE_RECIPE_INVALID")}let{integrity:n,...a}=r;if(wE(a)!==n)throw new vr("EXAMPLE_RECIPE_INTEGRITY_MISMATCH");return r}var sm=Ir(tr(),1);import{readFile as IE,realpath as bE}from"node:fs/promises";import im from"node:path";var kE={$id:"https://schemas.dyyto.dev/platform/engineering-template-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","templateId","version","integrity","title","summary","status","profile","parameters","commands","technology","support","integration","metrics"],properties:{schemaVersion:{const:1},templateId:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:dt},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},status:{enum:["candidate","recommended","deprecated"]},profile:{type:"object",additionalProperties:!1,required:["id","capability"],properties:{id:{type:"string",pattern:H},capability:{type:"string",pattern:`${H.slice(1,-1)}@[0-9]+\\.[0-9]+\\.[0-9]+$`}}},parameters:{type:"array",minItems:0,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","required","description"],properties:{id:{type:"string",pattern:"^[a-z][A-Za-z0-9]*$"},required:{type:"boolean"},description:{type:"string",minLength:1,maxLength:160}}}},commands:{type:"object",minProperties:1,additionalProperties:!1,properties:{dev:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},build:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},test:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},package:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"}}},technology:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","version","policy","verifiedAt","rationale","alternative","exit"],properties:{id:{type:"string",pattern:H},version:{type:"string",minLength:1,maxLength:64},policy:{enum:["recommended","allowed"]},verifiedAt:{type:"string",format:"date"},rationale:{type:"string",minLength:1,maxLength:240},alternative:{type:"string",minLength:1,maxLength:160},exit:{type:"string",minLength:1,maxLength:240}}}},support:{type:"object",additionalProperties:!1,required:["owner","tier","supportedFrom","supportedUntil","upgradeCadence","eolNoticeDays"],properties:{owner:{type:"string",pattern:H},tier:{const:"production"},supportedFrom:{type:"string",format:"date"},supportedUntil:{type:"string",format:"date"},upgradeCadence:{type:"string",minLength:1,maxLength:80},eolNoticeDays:{type:"integer",minimum:30,maximum:730}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","createCommand","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},createCommand:{type:"string",minLength:1,maxLength:2e3},result:{type:"string",minLength:1,maxLength:400}}},metrics:{type:"array",minItems:1,uniqueItems:!0,items:{enum:["time-to-green-build","time-to-first-business-commit","manual-engineering-edits","upgrade-conflicts"]}}}},om=new sm.Ajv2020({allErrors:!0,strict:!0,formats:{date:/^\d{4}-\d{2}-\d{2}$/}}).compile(kE),Et=class extends Error{code;issues;constructor(t,r=[]){super(t),this.code=t,this.issues=r}};function _E(e){return v(E(e))}function EE(e){if(!om(e))throw new Et("TEMPLATE_INVALID",om.errors??[]);let t=e;if(new Set(t.parameters.map(r=>r.id)).size!==t.parameters.length||new Set(t.technology.map(r=>r.id)).size!==t.technology.length)throw new Et("TEMPLATE_INVALID");if(Date.parse(t.support.supportedUntil)<=Date.parse(t.support.supportedFrom))throw new Et("TEMPLATE_INVALID");return t}async function oa(e,t=new Date){let r=await bE(im.resolve(e)),n;try{n=EE(JSON.parse(await IE(im.join(r,"template.json"),"utf8")))}catch(o){throw o instanceof Et?o:new Et("TEMPLATE_INVALID")}let{integrity:a,...i}=n;if(_E(i)!==a)throw new Et("TEMPLATE_INTEGRITY_MISMATCH");if(n.status==="recommended"&&Date.parse(n.support.supportedUntil)<t.getTime())throw new Et("TEMPLATE_SUPPORT_EXPIRED");return n}import{readFile as cm}from"node:fs/promises";import lm from"node:path";var AE=/^[A-Z][A-Z0-9_]*$/u,RE=/(?:API_KEY|ACCESS_KEY|SECRET|TOKEN|PASSWORD|PRIVATE_KEY|DATABASE_URL|POSTGRES_URL)$/u;function PE(e){let t=new Map;for(let r of e.split(/\r?\n/u)){let n=/^([A-Z][A-Z0-9_]*)=(.*)$/u.exec(r.trim());if(!n||!AE.test(n[1]))continue;let a=n[1],i=n[2].trim();t.set(a,{name:a,requirement:i.length===0?"conditional":"optional",secret:RE.test(a),configured:!1,source:".env.example",configuredSource:null})}return[...t.values()]}async function dm(e){let t=await cm(lm.join(e.projectRoot,".env.example"),"utf8").then(()=>".env.example").catch(()=>null),r=t?await cm(lm.join(e.projectRoot,t),"utf8"):"",n=await $i({projectRoot:e.projectRoot}).catch(()=>null);return{commands:["dev","build","test","package"].flatMap(i=>e.commands[i]?[{id:i,script:e.commands[i],mode:i==="dev"?"managed-process":"foreground-task"}]:[]),environment:n?n.entries.map(i=>({name:i.name,requirement:i.required?"conditional":"optional",secret:i.kind!=="value",configured:i.configured,source:"application-config-contract",configuredSource:"APP_CONFIG_DIR",display:i.display,...i.fingerprint?{fingerprint:i.fingerprint}:{}})):PE(r),environmentExample:t,productionValidation:{contract:!0,live:["provider-read","oss-write-read-delete"]}}}var pm={change:new Set(["plan","apply","upgrade","recover","baseline-next","add-package","add-application","add-feature"]),quality:new Set(["inspect","verify","doctor","maintenance","test","build"]),delivery:new Set(["package","delivery-plan","delivery-apply","delivery-inspect"])},um=new Set(["queued","running","succeeded","failed","outcome-unknown","cancelled"]);function fm(e,t){if(!pm[t.plane]||t.state&&!um.has(t.state)||t.limit!==void 0&&(!Number.isSafeInteger(t.limit)||t.limit<1||t.limit>200))throw new Error("OPERATION_FILTER_INVALID");let r=pm[t.plane],n=t.from?Date.parse(t.from):null,a=t.to?Date.parse(t.to):null;if(n!==null&&Number.isNaN(n)||a!==null&&Number.isNaN(a)||n!==null&&a!==null&&n>a)throw new Error("OPERATION_FILTER_INVALID");let i=e.filter(d=>r.has(d.operation)),o=[...new Map(i.map(d=>[d.projectId,{id:d.projectId,name:d.projectName}])).values()].sort((d,l)=>d.name.localeCompare(l.name)),s=i.filter(d=>(!t.projectId||d.projectId===t.projectId)&&(!t.state||d.state===t.state)&&(!t.kind||d.operation===t.kind)&&(n===null||Date.parse(d.createdAt)>=n)&&(a===null||Date.parse(d.createdAt)<=a)).sort((d,l)=>l.updatedAt.localeCompare(d.updatedAt)),c={total:s.length,running:s.filter(d=>d.state==="running"||d.state==="queued").length,succeeded:s.filter(d=>d.state==="succeeded").length,attention:s.filter(d=>d.state==="failed"||d.state==="outcome-unknown").length};return Object.freeze({schemaVersion:1,plane:t.plane,summary:Object.freeze(c),facets:Object.freeze({projects:Object.freeze(o),states:Object.freeze([...um]),kinds:Object.freeze([...r])}),items:Object.freeze(s.slice(0,t.limit??50).map(Object.freeze)),hasMore:s.length>(t.limit??50)})}var sa=class extends Error{code;constructor(t,r){super(r),this.code=t}},Qc=/^sha256:[a-f0-9]{64}$/u,NE=/^sha512-[A-Za-z0-9+/]{86}==$/u,DE=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u,SE=/^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$/u,jE=/[\u0000-\u001f\u007f]/u;function Xr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function Zr(e,t){let r=Object.keys(e).sort(),n=[...t].sort();return r.length===n.length&&r.every((a,i)=>a===n[i])}function At(e,t=500){return typeof e=="string"&&e.length>0&&e.length<=t&&!jE.test(e)}function Zc(e){return At(e,500)&&!e.startsWith("/")&&!e.startsWith("../")&&!e.includes("/../")&&!e.includes("\\")}function mm(e,t=128){return Array.isArray(e)&&e.length<=t&&e.every(r=>At(r,500))&&e.every((r,n)=>n===0||e[n-1]<r)}function $E(e){return e===null?!0:!Xr(e)||!Zr(e,["fileName","digest","integrity","fileCount","unpackedBytes"])?!1:Zc(e.fileName)&&Qc.test(String(e.digest))&&NE.test(String(e.integrity))&&Number.isSafeInteger(e.fileCount)&&Number(e.fileCount)>0&&Number.isSafeInteger(e.unpackedBytes)&&Number(e.unpackedBytes)>0}function OE(e){if(!Xr(e)||!Zr(e,["schemaVersion","kind","packageName","version","title","summary","maturity","source","artifact","compatibility","exports","documentation","consumerEvidence"])||e.schemaVersion!==1||e.kind!=="PackageRelease"||!DE.test(e.packageName)||!SE.test(e.version)||!At(e.title,120)||!At(e.summary,1e3)||!["candidate","stable","deprecated"].includes(e.maturity)||!Xr(e.source)||!Zr(e.source,["repository","path","revision","treeDigest"])||!At(e.source.repository)||!Zc(e.source.path)||!At(e.source.revision,200)||!Qc.test(String(e.source.treeDigest))||!$E(e.artifact)||!Xr(e.compatibility)||!Zr(e.compatibility,["node","packageManager"])||!At(e.compatibility.node,100)||!At(e.compatibility.packageManager,100)||!mm(e.exports)||!mm(e.consumerEvidence)||!Xr(e.documentation))return!1;let t=e.documentation.knowledgeRef===void 0?["readme"]:["readme","knowledgeRef"];return!Zr(e.documentation,t)||!Zc(e.documentation.readme)||e.documentation.knowledgeRef!==void 0&&!At(e.documentation.knowledgeRef,500)?!1:e.artifact!==null||e.maturity!=="stable"}function CE(e){let t={schemaVersion:1,kind:"PackageRelease",...e,source:Object.freeze({...e.source}),artifact:e.artifact===null?null:Object.freeze({...e.artifact}),compatibility:Object.freeze({...e.compatibility}),exports:Object.freeze([...e.exports]),documentation:Object.freeze({...e.documentation}),consumerEvidence:Object.freeze([...e.consumerEvidence])};if(!OE(t))throw new sa("PACKAGE_RELEASE_INVALID","PackageRelease \u5185\u5BB9\u65E0\u6548");return Object.freeze({...t,releaseDigest:v(E(t))})}function gm(e){if(!Xr(e)||!Zr(e,["schemaVersion","kind","packageName","version","title","summary","maturity","source","artifact","compatibility","exports","documentation","consumerEvidence","releaseDigest"])||!Qc.test(String(e.releaseDigest)))throw new sa("PACKAGE_RELEASE_INVALID","PackageRelease \u7ED3\u6784\u65E0\u6548");let{releaseDigest:t,schemaVersion:r,kind:n,...a}=e,i=CE(a);if(i.releaseDigest!==t)throw new sa("PACKAGE_RELEASE_MODIFIED","PackageRelease \u5DF2\u88AB\u4FEE\u6539");return i}import{lstat as TE,readFile as xE,realpath as LE}from"node:fs/promises";import hm from"node:path";async function ym(e){let t=await LE(hm.resolve(e.projectRoot)),r=new Set(e.excludeCapabilityIds??[]),n=new Map,a=[...e.lock.capabilities].sort((o,s)=>o.committedAt.localeCompare(s.committedAt)||o.capabilityId.localeCompare(s.capabilityId));for(let o of a)if(!r.has(o.capabilityId))for(let s of o.assets){let c=s.ownership??"owned-file",d=`${s.path}\0`;if(c==="managed-region")n.delete(d);else for(let p of n.keys())p.startsWith(d)&&n.delete(p);let l=c==="managed-region"?`${d}${s.regionId??""}`:d;n.set(l,{capabilityId:o.capabilityId,path:s.path,digest:s.digest,ownership:c,...s.regionId===void 0?{}:{regionId:s.regionId}})}let i=[];for(let o of[...n.values()].sort((s,c)=>s.path.localeCompare(c.path)||(s.regionId??"").localeCompare(c.regionId??"")||s.capabilityId.localeCompare(c.capabilityId))){let s=hm.join(t,...o.path.split("/")),d=await TE(s).then(async l=>{if(!l.isFile()||l.isSymbolicLink())return;let p=await xE(s);if(o.ownership!=="managed-region")return v(p);if(o.regionId!==void 0)try{return v(Xa(p.toString("utf8"),o.regionId))}catch{return}}).catch(l=>l.code==="ENOENT"?void 0:Promise.reject(l))===o.digest;i.push({capabilityId:o.capabilityId,path:o.path,kind:"create",ownership:o.ownership,...o.regionId===void 0?{}:{regionId:o.regionId},desiredDigest:o.digest,disposition:d?"noop":"conflict",...d?{}:{conflictCode:"BASE_DIGEST_MISMATCH"}})}return i}var el="0.1.18",ca={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},VE=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function wm(e,t){return typeof e=="string"&&e.length>0&&e.length<=t&&!VE.test(e)}function ME(e){let t={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:ca[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},r=qE(t);if(r===null)throw new TypeError("CLI domain error input is invalid");return r}function qE(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let t=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(t).some(s=>typeof s=="symbol"))return null;let r=Object.keys(t).sort(),n="nextStep"in t?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(r.length!==n.length||r.some((s,c)=>s!==n[c])||Object.values(t).some(s=>!("value"in s)))return null;let a=s=>t[s]?.value,i=a("code");if(a("schemaVersion")!==1||a("kind")!=="dyyto-cli-domain-error"||typeof i!="string"||!(i in ca)||a("exitCode")!==ca[i]||!wm(a("message"),500))return null;let o=a("nextStep");return o!==void 0&&!wm(o,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:i,message:a("message"),exitCode:4,...o===void 0?{}:{nextStep:o}})}catch{return null}}var Ce=class extends Error{code;exitCode;nextStep;domainError;constructor(t){super(t.message),this.name="CliError",this.code=t.code,this.exitCode=t.exitCode,this.nextStep=t.nextStep,this.domainError=t.code in ca&&t.exitCode===ca[t.code]?ME({code:t.code,message:t.message,...t.nextStep===void 0?{}:{nextStep:t.nextStep}}):void 0}};var vm=`Dyyto Engineering Platform CLI
45
45
 
46
46
  Usage:
47
47
  dyyto <command> [options]
@@ -50,6 +50,7 @@ Commands:
50
50
  dyyto bootstrap --project DIR [--apply] \u521D\u59CB\u5316\u5E76\u9501\u5B9AVibe Coding\u5DE5\u7A0B\u4E0A\u4E0B\u6587
51
51
  dyyto context --project DIR \u8F93\u51FA\u9762\u5411Agent\u7684\u7CBE\u7B80\u5DE5\u7A0B\u4E0A\u4E0B\u6587
52
52
  dyyto agents sync --project DIR [--apply] \u540C\u6B65\u591A\u7F16\u7801Agent\u9002\u914D\u5668
53
+ dyyto agents remove --project DIR [--apply] \u5B89\u5168\u79FB\u9664\u53D7\u7BA1Agent\u9002\u914D\u5668
53
54
  dyyto docs show --id ID \u8BFB\u53D6npm\u5305\u5185\u7A33\u5B9A\u6587\u6863
54
55
  dyyto create Initialize a project manifest and plan
55
56
  dyyto scaffold example Plan or apply a Catalog-driven example under .examples
package/dist/chunk.js CHANGED
@@ -1,4 +1,4 @@
1
- var h=Object.create;var y=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var R=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var v=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of C(n))!b.call(e,o)&&o!==t&&y(e,o,{get:()=>n[o],enumerable:!(r=w(n,o))||r.enumerable});return e};var N=(e,n,t)=>(t=e!=null?h(E(e)):{},v(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e));var F="0.1.16",c={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},S=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function f(e,n){return typeof e=="string"&&e.length>0&&e.length<=n&&!S.test(e)}function D(e){let n={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:c[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},t=m(n);if(t===null)throw new TypeError("CLI domain error input is invalid");return t}function m(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(i=>typeof i=="symbol"))return null;let t=Object.keys(n).sort(),r="nextStep"in n?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(t.length!==r.length||t.some((i,k)=>i!==r[k])||Object.values(n).some(i=>!("value"in i)))return null;let o=i=>n[i]?.value,a=o("code");if(o("schemaVersion")!==1||o("kind")!=="dyyto-cli-domain-error"||typeof a!="string"||!(a in c)||o("exitCode")!==c[a]||!f(o("message"),500))return null;let d=o("nextStep");return d!==void 0&&!f(d,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:a,message:o("message"),exitCode:4,...d===void 0?{}:{nextStep:d}})}catch{return null}}function T(e){if(e instanceof l&&e.domainError!==void 0)return e.domainError;try{if(typeof e!="object"||e===null)return null;let n=Object.getOwnPropertyDescriptor(e,"domainError");return n!==void 0&&"value"in n?m(n.value):null}catch{return null}}var l=class extends Error{code;exitCode;nextStep;domainError;constructor(n){super(n.message),this.name="CliError",this.code=n.code,this.exitCode=n.exitCode,this.nextStep=n.nextStep,this.domainError=n.code in c&&n.exitCode===c[n.code]?D({code:n.code,message:n.message,...n.nextStep===void 0?{}:{nextStep:n.nextStep}}):void 0}};var _=`Dyyto Engineering Platform CLI
1
+ var h=Object.create;var y=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var O=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var v=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of C(n))!b.call(e,o)&&o!==t&&y(e,o,{get:()=>n[o],enumerable:!(r=w(n,o))||r.enumerable});return e};var N=(e,n,t)=>(t=e!=null?h(E(e)):{},v(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e));var F="0.1.18",c={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},S=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function f(e,n){return typeof e=="string"&&e.length>0&&e.length<=n&&!S.test(e)}function D(e){let n={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:c[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},t=m(n);if(t===null)throw new TypeError("CLI domain error input is invalid");return t}function m(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(i=>typeof i=="symbol"))return null;let t=Object.keys(n).sort(),r="nextStep"in n?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(t.length!==r.length||t.some((i,k)=>i!==r[k])||Object.values(n).some(i=>!("value"in i)))return null;let o=i=>n[i]?.value,a=o("code");if(o("schemaVersion")!==1||o("kind")!=="dyyto-cli-domain-error"||typeof a!="string"||!(a in c)||o("exitCode")!==c[a]||!f(o("message"),500))return null;let d=o("nextStep");return d!==void 0&&!f(d,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:a,message:o("message"),exitCode:4,...d===void 0?{}:{nextStep:d}})}catch{return null}}function T(e){if(e instanceof l&&e.domainError!==void 0)return e.domainError;try{if(typeof e!="object"||e===null)return null;let n=Object.getOwnPropertyDescriptor(e,"domainError");return n!==void 0&&"value"in n?m(n.value):null}catch{return null}}var l=class extends Error{code;exitCode;nextStep;domainError;constructor(n){super(n.message),this.name="CliError",this.code=n.code,this.exitCode=n.exitCode,this.nextStep=n.nextStep,this.domainError=n.code in c&&n.exitCode===c[n.code]?D({code:n.code,message:n.message,...n.nextStep===void 0?{}:{nextStep:n.nextStep}}):void 0}};var _=`Dyyto Engineering Platform CLI
2
2
 
3
3
  Usage:
4
4
  dyyto <command> [options]
@@ -7,6 +7,7 @@ Commands:
7
7
  dyyto bootstrap --project DIR [--apply] \u521D\u59CB\u5316\u5E76\u9501\u5B9AVibe Coding\u5DE5\u7A0B\u4E0A\u4E0B\u6587
8
8
  dyyto context --project DIR \u8F93\u51FA\u9762\u5411Agent\u7684\u7CBE\u7B80\u5DE5\u7A0B\u4E0A\u4E0B\u6587
9
9
  dyyto agents sync --project DIR [--apply] \u540C\u6B65\u591A\u7F16\u7801Agent\u9002\u914D\u5668
10
+ dyyto agents remove --project DIR [--apply] \u5B89\u5168\u79FB\u9664\u53D7\u7BA1Agent\u9002\u914D\u5668
10
11
  dyyto docs show --id ID \u8BFB\u53D6npm\u5305\u5185\u7A33\u5B9A\u6587\u6863
11
12
  dyyto create Initialize a project manifest and plan
12
13
  dyyto scaffold example Plan or apply a Catalog-driven example under .examples
@@ -50,4 +51,4 @@ Options:
50
51
  --json Emit one machine-readable JSON object
51
52
  --help Show help
52
53
  --version Show version
53
- `;import{lstat as x,readFile as I,readdir as O}from"node:fs/promises";import p from"node:path";var g={"workspace-node-application":"foundation.workspace-node-application@1.1.0","workspace-web-application":"foundation.workspace-web-application@1.1.0","workspace-expo-application":"foundation.workspace-expo-application@1.0.0","nextjs-full-stack-application":"foundation.nextjs-full-stack-application@1.0.0"};function j(e,n="package"){let t=n==="fixture"?"fixtures":"packages";return new RegExp(`^${t}/[a-z0-9][a-z0-9._-]*$`).test(e)?void 0:`Package path must be exactly ${t}/<lowercase-slug>.`}function P(e,n,t){if(!(n in g))return"Add application requires a supported --profile.";let r=g[n];if(t!==r)return`Add application with profile ${n} requires --capability ${r}.`;if(!/^apps\/[a-z0-9][a-z0-9._-]*$/.test(e))return/^services\/[a-z0-9][a-z0-9._-]*$/.test(e)?n==="workspace-node-application"?void 0:"Service applications require profile workspace-node-application.":"Application path must be exactly apps/<lowercase-slug> or services/<lowercase-slug>."}function s(e,n){let t=e.indexOf(n);return t<0?void 0:e[t+1]}async function u(e,n,t){for(let r of await O(p.join(e,n),{withFileTypes:!0}).catch(()=>[]))if(!(!r.isDirectory()||r.isSymbolicLink()))try{if(JSON.parse(await I(p.join(e,n,r.name,"project-capabilities.json"),"utf8")).profile?.parameters?.name===t)return!0}catch(o){if(o.code!=="ENOENT")throw o}return!1}async function A(e,n){return await u(e,"apps",n)||await u(e,"services",n)}async function B(e){if(e[0]!=="add")return;let n=s(e,"--path");if(n===void 0)return;let t=s(e,"--workspace"),r=s(e,"--name");if(e[1]==="package"){let a=s(e,"--kind")==="fixture"?"fixture":"package",d=j(n,a);return d!==void 0||t===void 0||r===void 0?d:await x(p.join(t,"package.json")).then(i=>i.isFile()).catch(()=>!1)?await u(t,a==="fixture"?"fixtures":"packages",r)?"A workspace package already uses this npm name.":void 0:"Workspace root must be applied and free of drift before adding a package."}if(e[1]!=="application")return;let o=P(n,s(e,"--profile")??"workspace-node-application",s(e,"--capability"));return o!==void 0||t===void 0||r===void 0?o:await x(p.join(t,"package.json")).then(a=>a.isFile()).catch(()=>!1)?await A(t,r)?"A workspace application already uses this name.":void 0:"Workspace root must be applied and free of drift before adding an application."}export{R as a,N as b,F as c,T as d,l as e,_ as f,j as g,P as h,u as i,A as j,B as k};
54
+ `;import{lstat as x,readFile as I,readdir as R}from"node:fs/promises";import p from"node:path";var g={"workspace-node-application":"foundation.workspace-node-application@1.1.0","workspace-web-application":"foundation.workspace-web-application@1.1.0","workspace-expo-application":"foundation.workspace-expo-application@1.0.0","nextjs-full-stack-application":"foundation.nextjs-full-stack-application@1.0.0"};function j(e,n="package"){let t=n==="fixture"?"fixtures":"packages";return new RegExp(`^${t}/[a-z0-9][a-z0-9._-]*$`).test(e)?void 0:`Package path must be exactly ${t}/<lowercase-slug>.`}function P(e,n,t){if(!(n in g))return"Add application requires a supported --profile.";let r=g[n];if(t!==r)return`Add application with profile ${n} requires --capability ${r}.`;if(!/^apps\/[a-z0-9][a-z0-9._-]*$/.test(e))return/^services\/[a-z0-9][a-z0-9._-]*$/.test(e)?n==="workspace-node-application"?void 0:"Service applications require profile workspace-node-application.":"Application path must be exactly apps/<lowercase-slug> or services/<lowercase-slug>."}function s(e,n){let t=e.indexOf(n);return t<0?void 0:e[t+1]}async function u(e,n,t){for(let r of await R(p.join(e,n),{withFileTypes:!0}).catch(()=>[]))if(!(!r.isDirectory()||r.isSymbolicLink()))try{if(JSON.parse(await I(p.join(e,n,r.name,"project-capabilities.json"),"utf8")).profile?.parameters?.name===t)return!0}catch(o){if(o.code!=="ENOENT")throw o}return!1}async function A(e,n){return await u(e,"apps",n)||await u(e,"services",n)}async function B(e){if(e[0]!=="add")return;let n=s(e,"--path");if(n===void 0)return;let t=s(e,"--workspace"),r=s(e,"--name");if(e[1]==="package"){let a=s(e,"--kind")==="fixture"?"fixture":"package",d=j(n,a);return d!==void 0||t===void 0||r===void 0?d:await x(p.join(t,"package.json")).then(i=>i.isFile()).catch(()=>!1)?await u(t,a==="fixture"?"fixtures":"packages",r)?"A workspace package already uses this npm name.":void 0:"Workspace root must be applied and free of drift before adding a package."}if(e[1]!=="application")return;let o=P(n,s(e,"--profile")??"workspace-node-application",s(e,"--capability"));return o!==void 0||t===void 0||r===void 0?o:await x(p.join(t,"package.json")).then(a=>a.isFile()).catch(()=>!1)?await A(t,r)?"A workspace application already uses this name.":void 0:"Workspace root must be applied and free of drift before adding an application."}export{O as a,N as b,F as c,T as d,l as e,_ as f,j as g,P as h,u as i,A as j,B as k};
@@ -0,0 +1,29 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "PackageRelease",
4
+ "packageName": "@aipt/cli",
5
+ "version": "0.1.17",
6
+ "title": "Dyyto CLI",
7
+ "summary": "Dyyto 无服务工程能力目录、规划、应用与验证 CLI。",
8
+ "maturity": "candidate",
9
+ "source": {
10
+ "repository": "urn:idp:repository:dyyto",
11
+ "path": "apps/cli",
12
+ "revision": "working-tree",
13
+ "treeDigest": "sha256:711db24f9c9ed5101e64303b50f5fd5e6747545968e322348dc67b3b8aa440f9"
14
+ },
15
+ "artifact": null,
16
+ "compatibility": {
17
+ "node": ">=24.18.0 <25",
18
+ "packageManager": "pnpm@11.21.0"
19
+ },
20
+ "exports": [],
21
+ "documentation": {
22
+ "readme": "apps/cli/README.md",
23
+ "knowledgeRef": "tech://engineering-capabilities/dyyto/cli"
24
+ },
25
+ "consumerEvidence": [
26
+ "apps/cli/src/distribution.test.ts"
27
+ ],
28
+ "releaseDigest": "sha256:0a795c217110eaead861f7b21fb3ffbb4b9fa6dec467e1e1b1da934630cabef1"
29
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "PackageRelease",
4
+ "packageName": "@aipt/cli",
5
+ "version": "0.1.18",
6
+ "title": "Dyyto CLI",
7
+ "summary": "Dyyto 无服务工程能力目录、规划、应用与验证 CLI。",
8
+ "maturity": "candidate",
9
+ "source": {
10
+ "repository": "urn:idp:repository:dyyto",
11
+ "path": "apps/cli",
12
+ "revision": "working-tree",
13
+ "treeDigest": "sha256:02776c3a51081a9bd0f381224325ee4113abe3287903a17e4b4238fea02b9785"
14
+ },
15
+ "artifact": null,
16
+ "compatibility": {
17
+ "node": ">=24.18.0 <25",
18
+ "packageManager": "pnpm@11.21.0"
19
+ },
20
+ "exports": [],
21
+ "documentation": {
22
+ "readme": "apps/cli/README.md",
23
+ "knowledgeRef": "tech://engineering-capabilities/dyyto/cli"
24
+ },
25
+ "consumerEvidence": [
26
+ "apps/cli/src/distribution.test.ts"
27
+ ],
28
+ "releaseDigest": "sha256:fb7acfa15d09b0306b16dda3581a8cd446f70ef79f1fed6ba2f289706fe58432"
29
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@aipt/cli",
4
- "version": "0.1.16",
4
+ "version": "0.1.18",
5
5
  "documents": [
6
6
  { "id": "bootstrap", "path": "docs/bootstrap.md", "digest": "sha256:1e1ac4cbcabab7e6ae7a5a34337ea638951c16d5a66a33ab9218a9f441d6f3b4" },
7
7
  { "id": "agent-integration", "path": "docs/agent-integration.md", "digest": "sha256:6b3e9425bd5caf233971bc27dc2ef765bd1e9b92a049d3a394e075ed80c0863f" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipt/cli",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Dyyto 无服务工程能力目录、规划、应用与验证 CLI。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "esbuild": "0.28.2",
31
+ "@aipt/page-definition": "0.1.0",
31
32
  "@aipt/object-store": "0.1.0",
32
33
  "@aipt/page-host-gateway": "0.1.0",
33
- "@aipt/page-definition": "0.1.0",
34
34
  "@aipt/platform-kernel": "0.1.6"
35
35
  },
36
36
  "idpPackageRelease": {