@maind-dev/cli 0.187.0 → 0.187.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -282,7 +282,7 @@ maind: and re-run \`maind launch claude\`. (Or launch without routing: \`maind l
|
|
|
282
282
|
`,stderr:""}}let n=["maind: dry-run \u2014 nothing installed, written, or spawned.",`maind: config ${e.configPath} (${e.configSource})`,`maind: switchyard detected: ${e.switchyardDetected?"yes":"no"}`,`maind: would run: ${e.argv.join(" ")}`].join(`
|
|
283
283
|
`);return{stdout:e.toml??`(using existing config: ${e.configPath})
|
|
284
284
|
`,stderr:n+`
|
|
285
|
-
`}}a(nC,"renderDryRun");import{createRequire as wz}from"node:module";function vz(){return"0.187.
|
|
285
|
+
`}}a(nC,"renderDryRun");import{createRequire as wz}from"node:module";function vz(){return"0.187.1";try{return wz(import.meta.url)("../package.json").version}catch{return"0.0.0-unknown"}}a(vz,"resolveVersion");var me=vz();var Oz=5e3;function At(e){process.stderr.write(`maind: ${e}
|
|
286
286
|
`)}a(At,"err");function Iz(e){return e instanceof Error?e.message:String(e)}a(Iz,"msg");var Nz=new Set(["--config","--route","--mcp-url"]);function oC(e){let t=a(o=>{let i=e.indexOf(o);if(!(i===-1||i+1>=e.length))return e[i+1]},"get"),n=a(o=>e.includes(o),"has"),r=null;for(let o=0;o<e.length;o++){let i=e[o];if(i.startsWith("-")){Nz.has(i)&&o++;continue}r=i;break}return{agent:r,dryRun:n("--dry-run"),config:t("--config")??null,route:t("--route")??GT,direct:n("--direct"),noFallback:n("--no-fallback"),noInstall:n("--no-install"),json:n("--json"),mcpUrl:t("--mcp-url")??null}}a(oC,"parseLaunchArgs");var Dz={probe(e,t){let n=rC(e,t,{stdio:["ignore","pipe","pipe"],encoding:"utf8",timeout:1e4}),r=n.status===0&&!n.error,o=typeof n.stdout=="string"?n.stdout.trim():"";return{ok:r,stdout:o.length>0?o:null}},install(e){return rC("uv",[...e],{stdio:["ignore","inherit","inherit"]}).status},spawnInteractive(e){let t=Date.now();return new Promise(n=>{let r=!1,o=xz(e[0],e.slice(1),{stdio:"inherit",env:process.env}),i=a(()=>{},"onSigint"),s=a(d=>()=>{try{o.kill(d)}catch{}},"makeForward"),l=s("SIGTERM"),c=s("SIGHUP");process.on("SIGINT",i),process.on("SIGTERM",l),process.on("SIGHUP",c);let u=a(()=>{process.removeListener("SIGINT",i),process.removeListener("SIGTERM",l),process.removeListener("SIGHUP",c)},"cleanup");o.on("error",d=>{r||(r=!0,u(),n({code:null,signal:null,elapsedMs:Date.now()-t,spawnError:d.message}))}),o.on("exit",(d,f)=>{r||(r=!0,u(),n({code:d,signal:f,elapsedMs:Date.now()-t,spawnError:null}))})})},async fetchTemplate(e,t){let n;try{n=Ee()}catch(r){if(r instanceof Pe)return null;throw r}try{let r=new Oe({apiKey:n.apiKey,deviceId:n.deviceId,clientVersion:me,mcpUrl:e??void 0,projectKey:t}),o=new Promise(s=>{setTimeout(()=>s(null),Oz).unref()}),i=r.callTool("get_template",{template_id:KT}).then(s=>typeof s.template_body=="string"&&s.template_body.trim().length>0?s.template_body:null).catch(()=>null);return await Promise.race([i,o])}catch{return null}},writeConfig(e,t){let n=Cz(e);n&&n!=="."&&Ez(n,{recursive:!0}),$z(e,t,"utf8")},readFile(e){try{return Az(e,"utf8")}catch{return null}},fileExists(e){return Rz(e)},repoRoot(){try{let e=Sz("git",["rev-parse","--show-toplevel"],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3}).trim();return e.length>0?e:null}catch{return null}},projectKey(){return ot().projectKey},userConfigDir(){return fi()},homeDir(){return Tz()},env:process.env,platform:process.platform};function Mz(e,t){return e!==null?xb(e,".maind",hb):xb(t,hb)}a(Mz,"resolveRoutesPath");async function iC(e,t=Dz){let n=WT(e.agent);if(n.kind==="unknown")return At(`usage: maind launch <agent> [--dry-run] [--config <path>] [--route <name>] [--direct] [--no-fallback] [--no-install] \u2014 supported: ${gb.join(", ")}`),2;if(n.kind==="planned")return At(`agent '${n.agent}' is planned but not yet supported \u2014 v1 supports: ${gb.join(", ")}.`),2;if(e.json&&!e.dryRun)return At("--json is only valid together with --dry-run (stdout belongs to the agent session)."),2;let r=n.agent;if(e.direct)return At(tC()),sC(t,_b(r));let o=qT(t.env);o.warning!==null&&At(o.warning);let i,s,l;if(e.config!==null){if(!t.fileExists(e.config))return At(`config not found: ${e.config}`),2;let f=t.readFile(e.config);if(f===null||zT(f,e.route)===null)return At(`config ${e.config} is not valid routes TOML with a [routes.${e.route}] entry.`),2;i=e.config,s=null,l="flag"}else{let f=await t.fetchTemplate(e.mcpUrl,t.projectKey()),p=f===null?null:YT(f,e.route);if(s=VT(e.route,o,p),p!==null)l="template";else{l="builtin";let m=f===null?"no curated template (offline, unauthenticated, or not published)":`curated template unusable (missing route '${e.route}', or it pins its own targets)`;At(`using builtin routing policy (${m}).`)}i=Mz(t.repoRoot(),t.userConfigDir())}let c=hd,u=t.probe(hd,["--version"]).ok;if(e.dryRun){let f={agent:r,configPath:i,configSource:l,toml:s,argv:kb(c,r,e.route,i),backendKind:o.kind,switchyardDetected:u},p=nC(f,e.json);return p.stderr.length>0&&process.stderr.write(p.stderr),process.stdout.write(p.stdout),0}if(!u){if(e.noInstall)return At(`switchyard not found (--no-install). Install it with:
|
|
287
287
|
maind: ${gd}`),1;if(!t.probe("uv",["--version"]).ok)return At(ZT()),1;if(At(JT()),t.install(HT),t.probe(hd,["--version"]).ok)u=!0;else{let f=xb(t.homeDir(),".local","bin",t.platform==="win32"?"switchyard.exe":"switchyard");t.probe(f,["--version"]).ok&&(c=f,u=!0)}if(!u)return vb(t,e,r,QT())}if(l!=="flag"&&s!==null)try{t.writeConfig(i,s)}catch(f){return At(`could not write ${i}: ${Iz(f)}`),1}let d=await t.spawnInteractive(kb(c,r,e.route,i));return d.spawnError!==null?vb(t,e,r,`could not start switchyard (${d.spawnError})`):XT(d.code,d.signal,d.elapsedMs)==="fallback-eligible"?vb(t,e,r,`switchyard exited with code ${d.code} after ${(d.elapsedMs/1e3).toFixed(1)}s`):wb(d.code,d.signal)}a(iC,"runLaunch");async function vb(e,t,n,r){return t.noFallback?(At(`${r} (--no-fallback set \u2014 not degrading to a direct spawn).`),1):(process.stderr.write(eC(r)+`
|
|
288
288
|
`),sC(e,_b(n)))}a(vb,"degradeOrFail");async function sC(e,t){let n=await e.spawnInteractive(t);return n.spawnError!==null?(At(`'${t[0]}' not found on PATH \u2014 install the agent CLI first (${n.spawnError}).`),1):wb(n.code,n.signal)}a(sC,"spawnAndPropagate");var Sb="tests:";function yd(e){if(!e)return null;let t=e.indexOf("=");if(t<=0)return null;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();return!n||!r?null:{gate:n,object:r}}a(yd,"parseOverride");function jz(e){return e==="open"||e==="warn"}a(jz,"objectCarriesOverride");async function bd(e,t,n){let r=[];for(let i of e)!t.has(i.gate)&&!i.gate.startsWith(Sb)&&r.push(`--override ${i.gate}: not a gate declared in .maind/gates.json \u2014 only declared gates and test suites (tests:<dir>) take an override`+(t.size>0?` (declared: ${[...t].join(", ")})`:""));let o=new Map;for(let i of new Set(e.map(s=>s.object))){let s=null;try{s=await n(i)}catch{s=null}let l=s?.key??i;s===null?r.push(`--override \u2026=${i}: the object could not be resolved \u2014 no override without proof that it is open`):jz(s.status)?o.set(i,s):r.push(`--override \u2026=${l}: the object is ${s.status} \u2014 it no longer tracks a red gate`)}return r.length>0?{kind:"refused",lines:r}:{kind:"ok",resolved:o}}a(bd,"checkOverrides");function aC(e,t,n){let r=new Map(t.map(c=>[c.gate,c])),o=[],i=e.map(c=>{let u=r.get(c.id);if(!u)return c;let d=n.get(u.object);return!d||c.verdict!=="fail"||!c.blocking?c:(o.push({gate:c.id,object:d}),{...c,blocking:!1,note:`red, accepted \u2014 tracked by ${d.key??d.id}`})}),s=new Set(o.map(c=>c.gate)),l=t.filter(c=>!s.has(c.gate)).map(c=>({gate:c.gate,verdict:e.find(u=>u.id===c.gate)?.verdict??"absent"}));return{results:i,used:o,unused:l}}a(aC,"applyOverrides");function lC(e){return e.map(t=>t.verdict==="absent"?`--override ${t.gate}: the gate did not run \u2014 nothing was accepted`:`--override ${t.gate}: the gate is ${t.verdict==="pass"?"green":t.verdict}, not red \u2014 nothing was accepted, nothing recorded`)}a(lC,"unusedOverrideLines");var kd=["squash","merge","rebase"];function _d(e){return typeof e=="string"&&kd.includes(e)}a(_d,"isMergeMethod");function cC(e){if(typeof e!="object"||e===null)return null;let t=e,n=[[t.allow_squash_merge,"squash"],[t.allow_merge_commit,"merge"],[t.allow_rebase_merge,"rebase"]];return n.some(([r])=>typeof r!="boolean")?null:{allowed:n.filter(([r])=>r===!0).map(([,r])=>r),preferred:null}}a(cC,"githubMergeMethods");function uC(e){if(typeof e!="object"||e===null)return null;let t=e,n=t.merge_method,r=t.squash_option;if(n!=="merge"&&n!=="rebase_merge"&&n!=="ff")return null;let o=n==="ff"?"rebase":"merge";switch(r){case"always":return{allowed:["squash"],preferred:"squash"};case"never":return{allowed:[o],preferred:o};case"default_on":return{allowed:["squash",o],preferred:"squash"};case"default_off":return{allowed:["squash",o],preferred:o};default:return null}}a(uC,"gitlabMergeMethods");function Rb(e){let{flag:t,configured:n,forge:r}=e,o=t??n;if(o){let s=t?"flag":"config";return r&&!r.allowed.includes(o)?{kind:"not-allowed",method:o,source:s,allowed:r.allowed}:{kind:"ok",method:o,source:s}}if(r?.preferred&&r.allowed.includes(r.preferred))return{kind:"ok",method:r.preferred,source:"forge"};let i=r?kd.find(s=>r.allowed.includes(s)):void 0;return i&&i!=="squash"?{kind:"ok",method:i,source:"forge"}:{kind:"ok",method:"squash",source:"default"}}a(Rb,"chooseMergeMethod");var Pz={squash:"squash",merge:"merge commit",rebase:"rebase"};function Wi(e){return Pz[e]}a(Wi,"methodLabel");function Eb(e){let t={flag:"--merge-method",config:"mergeMethod in .maind/feature.json",forge:"the forge's setting for this repository",default:"the default"};return`merges with ${Wi(e.method)} (${t[e.source]})`}a(Eb,"methodLine");function Ab(e){let t=e.source==="flag"?"--merge-method":"mergeMethod in .maind/feature.json",n=e.allowed.length>0?e.allowed.map(Wi).join(", "):"none";return[`${t} asks for ${Wi(e.method)}, and this repository's forge does not allow it (allowed: ${n}).`,"Nothing ran and nothing was merged."]}a(Ab,"notAllowedLines");function wd(e){let t=e.merges.map(n=>n.slice(0,9)).join(", ");return[`a rebase merge replays every commit of ${e.branch} onto ${e.baseRef}, and ${e.branch} carries merge commits since ${e.baseRef} (${t})`+(e.ownBaseMerge?` \u2014 one of them is promote bringing ${e.baseRef} in before it assigns a number.`:"."),"How the forge rebases a merge commit is not documented, so promote does not hand it one. Nothing was pushed or merged.",` merge with --merge-method squash or --merge-method merge, or rebase ${e.branch} onto ${e.baseRef} yourself and push (the new head needs a new approval).`]}a(wd,"rebaseMergeCommitLines");import{readFileSync as IC}from"node:fs";import{join as NC}from"node:path";import{spawn as Lz,spawnSync as Fz}from"node:child_process";function $b(e){return e==="work"||e==="always"||e==="off"}a($b,"isStayAwakeSetting");function Bz(e,t){if(e.CI||e.NODE_TEST_CONTEXT)return"off";let n=e.MAIND_STAY_AWAKE?.trim().toLowerCase();return $b(n)?n:t??"work"}a(Bz,"resolveStayAwake");function Uz(e,t,n,r){return e==="darwin"?r("caffeinate")?{cmd:"caffeinate",args:["-i","-w",String(t)]}:null:e==="linux"&&r("systemd-inhibit")&&r("tail")?{cmd:"systemd-inhibit",args:["--what=idle","--who=maind",`--why=${n}`,"--mode=block","tail",`--pid=${t}`,"-f","/dev/null"]}:null}a(Uz,"inhibitCommand");function Hz(e,t,n){let r=null,o=a(()=>{if(e==="off"||r!==null)return;let s=Uz(n.platform,n.pid,t,n.has);s!==null&&(r=n.start(s.cmd,s.args))},"hold"),i=a(()=>{if(r!==null){try{r()}catch{}r=null}},"release");return{work:o,waiting:a(()=>{e!=="always"&&i()},"waiting"),end:i,holding:a(()=>r!==null,"holding")}}a(Hz,"makeAwake");function Gz(e){try{return Fz("sh",["-c",`command -v ${e}`],{stdio:"ignore",timeout:5e3}).status===0}catch{return!1}}a(Gz,"hasBinary");var Kz={platform:process.platform,pid:process.pid,has:Gz,start:a((e,t)=>{try{let n=Lz(e,[...t],{stdio:"ignore"});return n.on("error",()=>{}),n.unref(),typeof n.pid=="number"?()=>n.kill():null}catch{return null}},"start")},Fo=null;function vd(e,t,n={}){let r=Fo===null;return r&&(Fo=Hz(Bz(n.env??process.env,e),t,n.deps??Kz)),Fo.work(),{end:a(()=>{r&&(Fo?.end(),Fo=null)},"end")}}a(vd,"beginAwake");function Tb(){Fo?.work()}a(Tb,"awakeWork");function dC(){Fo?.waiting()}a(dC,"awakeWaiting");import{execFileSync as Jz}from"node:child_process";import{realpathSync as Zz}from"node:fs";function xd(e,t){if(!e.ok)return{kind:"unchecked",reason:e.reason};let n=t.toLowerCase(),r=e.refs.find(o=>o.unresolved!==!0&&o.id?.toLowerCase()===n);return r===void 0?{kind:"unchecked",reason:"the server did not resolve the bound object"}:typeof r.hasPlan!="boolean"?{kind:"unchecked",reason:"the server does not report has_plan"}:r.hasPlan?{kind:"attached"}:{kind:"absent"}}a(xd,"serverPlanAnswer");var Va="MAIND_GATE_OBJECT_REASON",Wz=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function qz(e){if(e===null)return!1;let t=e.trim();return t.length<4?!1:!["1","true","yes","on","skip"].includes(t.toLowerCase())}a(qz,"isReason");function Sd(e){let t=Vz(e);return t.kind!=="linked"&&qz(e.overrideReason)?{kind:"overridden",reason:e.overrideReason.trim()}:t}a(Sd,"classifyWorkObject");function Vz(e){if(e.branch===null)return{kind:"detached"};let t=e.objectId?.trim()??"";return t.length===0?{kind:"missing",branch:e.branch}:Wz.test(t)?{kind:"linked",objectId:t,objectKey:e.objectKey?.trim()||null,planRevision:e.planRevision?.trim()||null}:{kind:"malformed",branch:e.branch,value:t}}a(Vz,"judge");function Rd(e){return e.kind==="linked"||e.kind==="overridden"}a(Rd,"workObjectPasses");function fC(e,t,n){let r=a(o=>[" Link it, or say why not:",` git config branch.${o}.maindObject <object-uuid>`,` ${t}="<reason>" maind gate`],"fix");switch(e.kind){case"linked":{let o=`work object: ${e.objectKey?`${e.objectKey} \u2014 `:""}${e.objectId}`;if(e.planRevision)return[o,` plan attached (rev ${e.planRevision})`];let i=` maind object plan --object ${e.objectId} --file <plan.md>`,s=n??{kind:"unchecked",reason:"the server was not asked"};switch(s.kind){case"attached":return[o," plan attached (server)"];case"absent":return[o," no plan attached \u2014 advisory, never a failure. Attach the accepted plan:",i];case"unchecked":return[o,` plan not checked (${s.reason}) \u2014 no local marker; advisory, never a failure. If none is attached:`,i]}}case"overridden":return[`work object check overridden \u2014 reason: ${e.reason}`];case"missing":return[`branch ${e.branch} has no linked work object.`,...r(e.branch)];case"malformed":return[`branch ${e.branch}: "${e.value}" is not an object id.`," The check reads the id, never the display key \u2014 a key can be renamed, an id cannot.",...r(e.branch)];case"detached":return["detached HEAD \u2014 this check needs a branch to read the link from."]}}a(fC,"workObjectLines");function Cb(e){return`${e.dir}\0${e.check??""}`}a(Cb,"checkKey");function pC(e){return`${e.replace(/[/\\]+$/,"")}-apply`}a(pC,"applyCheckoutPath");function mC(e){return[...new Set(e.filter(t=>t.command!==null).map(t=>t.trigger))].sort()}a(mC,"applyTriggers");function at(e){return/^[A-Za-z0-9_./-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}a(at,"shellQuote");function Yz(e,t){let n=t.replace(/^\/+|\/+$/g,"");return n.length===0?e:`${e.replace(/\/+$/,"")}/${n}`}a(Yz,"joinAbs");function zz(e){return e.endsWith("/")?e:`${e}/`}a(zz,"withPrefix");function Xz(e){let t=new Set;for(let r of e){let o=/^((?:[^/]+\/)*?)supabase\/(?:migrations|functions)\//.exec(r);o&&t.add(o[1])}let n=[];for(let r of[...t].sort()){let o=r.replace(/\/$/,"");n.push({when:`${r}supabase/migrations/`,run:"supabase db push",check:"supabase migration list",cwd:o}),n.push({when:`${r}supabase/functions/`,run:"supabase functions deploy {name}",check:"supabase functions list",cwd:o,each:"dir"})}return n}a(Xz,"defaultPostMergeSteps");function Ob(e,t,n){let r=e.map(s=>s.trim()).filter(s=>s.length>0),o=t??Xz(r),i=[];for(let s of o){let l=zz(s.when),c=r.filter(h=>h.startsWith(l));if(c.length===0)continue;let u=Yz(n,s.cwd??""),d=`cd ${at(u)} && `,f=a((h,g)=>h===void 0?void 0:h.split("{name}").join(g),"fill");if(s.each!=="dir"){i.push({reason:`${c.length} file(s) under ${l}`+(s.note?` \u2014 ${s.note}`:""),command:s.run?d+s.run:null,trigger:l,dir:u,check:s.run&&s.check?s.check:null});continue}let p=[...new Set(c.map(h=>h.slice(l.length).split("/")[0]).filter(h=>h.length>0))].sort();for(let h of p.filter(g=>!g.startsWith("_"))){let g=f(s.note,h),b=f(s.run,h),k=f(s.check,h);i.push({reason:`${l}${h}/ changed`+(g?` \u2014 ${g}`:""),command:b?d+b:null,trigger:l,dir:u,check:b&&k?k:null})}let m=p.filter(h=>h.startsWith("_"));m.length>0&&i.push({reason:`${m.map(h=>`${l}${h}/`).join(", ")} changed \u2014 shared code, no target of its own: redeploy what imports it`,command:null,trigger:l,dir:u,check:null})}return i}a(Ob,"postMergeActions");function hC(e,t,n={}){if(e.length===0)return[];let r=[],o=n.target??{kind:"main"},i=n.mainRoot??"the main checkout",s=n.ref??t;o.kind==="prepared"?(r.push(`the main checkout (${i}) does not hold the merged ${o.stale.join(", ")} \u2014 it is behind ${s} or changed locally, so the steps run in ${o.path} (detached at ${s}${o.reused?", reused":""}${o.provisioned>0?`, ${o.provisioned} declared path(s) provisioned from .maind/worktree-requirements`:""}).`),o.installFailed&&r.push(" postCreate failed there \u2014 a command that needs the install will fail until it runs."),r.push(` remove it when done: git -C ${at(i)} worktree remove ${at(o.path)}`)):o.kind==="unavailable"&&(r.push(`the main checkout (${i}) does not hold the merged ${o.stale.join(", ")}, and no apply checkout could be prepared at ${o.path}: ${o.reason}.`),r.push(` the commands below run against a stale tree until it is at ${s} \u2014 bring it there first.`)),r.push(`the merge on ${t} needs steps it did not run \u2014 they are yours (nothing was executed):`);for(let l of e){if(r.push(` \u2022 ${l.reason}`),!l.command)continue;let c=l.check?n.checks?.get(Cb(l)):void 0;if(c&&!c.ok){r.push(` \u2716 check failed (${c.exit===null?"did not finish":`exit ${c.exit}`}): ${l.check}`);for(let u of c.tail)r.push(` | ${u}`);r.push(" the command fails the same way until that is fixed \u2014 then:")}else c&&r.push(` \u2713 checked: ${l.check}`);r.push(` ${l.command}`)}return r}a(hC,"postMergeLines");function Ya(e,t){let n=e!==null&&e.trim().length>0;return t==="closes"?{kind:"decided",completes:!0}:t==="progress"?{kind:"decided",completes:!1}:n?{kind:"missing",objectId:e.trim()}:{kind:"decided",completes:!1}}a(Ya,"decideCompletion");function gC(e,t){return[`${e} is bound to work object ${t}, and the merge will be reported there.`,"Does this pull request FINISH that object? Say so \u2014 neither answer is assumed:"," --closes-object it does: the merge is reported as completion"," --progress-only one step of several: the merge is logged, the object stays open","Nothing was merged."]}a(gC,"missingCompletionLines");function Ib(e){if(!e.required)return null;let t=Sd({branch:e.branch,objectId:e.boundObject,objectKey:null,overrideReason:e.overrideReason,planRevision:null});return Rd(t)?null:[`${e.branch} has no linked work object, and this repository's gates require one (requireWorkObject, ADR-286).`,"The gate would refuse it at the very end \u2014 so it was not started. Either:"," bind it: maind object bind --object <uuid>",` or say why not: ${qi}="<reason>" ${e.promoteCommand} --yes`,"Nothing was merged."]}a(Ib,"unboundObjectLines");var qi=Va;function an(e,t){let n=e.replace(/\/+$/,""),r=t.replace(/\/+$/,"");return n===r||n.startsWith(`${r}/`)}a(an,"cwdInside");function $t(e,t){return`cd ${at(e)} && ${t}`}a($t,"cleanupCommand");function yC(e){let t=[`PR #${e.prNumber} is already merged${e.mergedOn?` (${e.mergedOn})`:""} \u2014 nothing to promote.`];return e.leftover&&t.push("the worktree or local branch is still there \u2014 clean up:",` ${e.cleanup}`),t}a(yC,"alreadyMergedLines");function bC(e){return[`this process runs inside ${e.worktree} \u2014 removing it would pull the directory out from under the calling shell. Nothing was removed. Run it from the main checkout:`,` ${e.cleanup}`]}a(bC,"doneInsideLines");function kC(e){return[`the worktree stays for now \u2014 this process runs inside ${e.worktree}. A background run removes it once nothing stands in it any more (at the latest when this session ends), after the same checks as done (merge proven, no local changes). Its log: ${e.log}`]}a(kC,"deferredCleanupLines");function _C(e){return[`the worktree was kept \u2014 this process runs inside ${e.worktree}, and removing it would pull the directory out from under the calling shell. Clean up from the main checkout:`,` ${$t(e.mainRoot,e.doneCommand)}`,` or, later, for every merged worktree at once: ${$t(e.mainRoot,"maind feature done --merged")}`]}a(_C,"keptWorktreeLines");async function Nb(e,t){if(e!==null&&e.trim().length>0)return{kind:"bound",objectId:e.trim()};let n=t.prNumber(),r=t.slug();if(n===null||r===null)return{kind:"unbound"};let o=t.ref(r,n),i=null;try{i=await t.lookup(o)}catch{i=null}return i===null?{kind:"unbound"}:(t.write(i.id,i.key),{kind:"recovered",objectId:i.id,key:i.key,ref:o})}a(Nb,"recoverBinding");async function za(e,t){let n=t.prNumber(),r=t.slug();if(n===null||r===null)return{kind:"no-pr"};let o=t.ref(r,n),i=null;try{i=await t.lookup(o)}catch{i=null}if(i!==null)return i.id===e?{kind:"already",ref:o}:{kind:"mismatch",ref:o,other:i};await t.link(e,o);let s=null;try{s=await t.lookup(o)}catch{s=null}return s!==null&&s.id!==e?{kind:"mismatch",ref:o,other:s}:{kind:"link-attempted",ref:o}}a(za,"ensurePrLinked");function Vi(e){let t=e.bound.key??e.bound.id,n=e.other.key??e.other.id,r=e.prNumber!==null?`PR #${e.prNumber}`:e.ref;return[`${e.branch} is bound to ${t}, but ${r} is linked to ${n} \u2014 the merge would be reported against the wrong object.`,e.phase==="ship"?"the branch is pushed and the pull request is open; promote will refuse it until this is settled.":"Nothing was merged.",` if the work belongs to ${n}: maind object bind --object ${e.other.id}`,` if it belongs to ${t}: the link is wrong \u2014 a person removes it on ${n}'s object page (the connector does not re-create a removed link), then ship again to link ${t}; retitle the pull request if its title names ${n}.`]}a(Vi,"linkMismatchLines");function wC(e,t){let n=t?.trim().toUpperCase()??null;return e.filter(r=>r.toUpperCase()!==n)}a(wC,"fanOutKeys");function vC(e,t){let n=at(t.mainRoot);switch(e.kind){case"done":{let r=e.cleared??[];return r.length===0?{suffix:`, ${t.base} fast-forwarded`,extra:[]}:{suffix:`, ${t.base} fast-forwarded`,extra:[` ${r.length} uncommitted file(s) in the main checkout already held exactly what the merge brings (${Cu(r,5)}) \u2014 they stood in the way of the pull and now come from ${t.ref}. Nothing was lost.`]}}case"not-on-base":return{suffix:`, ${t.base} NOT fast-forwarded \u2014 the main checkout is on ${e.branch??"a detached HEAD"}, and promote does not switch it`,extra:[]};case"blocked":return{suffix:`, ${t.base} NOT fast-forwarded \u2014 uncommitted work in the main checkout overlaps ${e.files.length} file(s) of the merge`,extra:[` ${Cu(e.files,5)}`,` usually a parallel session's work \u2014 theirs to commit or set aside, not promote's. Until then read the merged state with: git -C ${n} show ${t.ref}:<path> \u2014 the pull goes through once nothing overlaps.`,` ${e.landed!==void 0&&e.landed>0?`${e.landed} of them already hold exactly what the merge brings; the rest differ. `:""}What is left over rather than in progress: cd ${n} && maind feature unblock-main \u2014 it lists each file and changes nothing; with --yes it parks them in a backup ref and pulls.`]};case"failed":return{suffix:`, ${t.base} NOT fast-forwarded \u2014 git pull --ff-only refused in the main checkout (git -C ${n} status shows why)`,extra:[]}}}a(vC,"fastForwardLines");function Qz(e){let t=[],n=null,r="";for(let o of e.split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maind-dev/cli",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.1",
|
|
4
4
|
"description": "Headless maind CLI — pull stack-relevant lessons into CI runners, report CI outcomes, brief agents on local git state (branch, PRs, peers), and launch coding agents behind a local NVIDIA NeMo Switchyard routing proxy. No device flow; authenticates from MAIND_API_KEY.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|