howtocode 0.7.67 → 0.7.69

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.
Files changed (31) hide show
  1. package/README.md +7 -1
  2. package/dist/{chunk-NPD6557W.js → chunk-336TZTEK.js} +1 -1
  3. package/dist/{chunk-7LAMZWB5.js → chunk-4SK7TRJW.js} +1 -1
  4. package/dist/chunk-5FIFNXLT.js +10 -0
  5. package/dist/{chunk-ED624AEE.js → chunk-ADGPAPXH.js} +1 -1
  6. package/dist/{chunk-XSUEEWKS.js → chunk-DK3DYJTA.js} +1 -1
  7. package/dist/{chunk-EMU362DM.js → chunk-DXMLXM3S.js} +1 -1
  8. package/dist/{chunk-L4XKIPIG.js → chunk-E2UZLMQH.js} +1 -1
  9. package/dist/chunk-FABEBOGV.js +2 -0
  10. package/dist/chunk-GNV6G3JW.js +201 -0
  11. package/dist/{chunk-YX2QDCVK.js → chunk-GQYIIDKK.js} +1 -1
  12. package/dist/{chunk-7NGP36QA.js → chunk-IQGALTAR.js} +1 -1
  13. package/dist/chunk-KKQCOMDH.js +141 -0
  14. package/dist/{chunk-XAIUZHIW.js → chunk-PMWAHAZV.js} +1 -1
  15. package/dist/{chunk-W2U7D5UF.js → chunk-RJYOUCLJ.js} +1 -1
  16. package/dist/{chunk-YFJKKWIX.js → chunk-SDU65XW4.js} +1 -1
  17. package/dist/{chunk-GEAWXEQG.js → chunk-SKLMU4IE.js} +1 -1
  18. package/dist/{chunk-3H2ECHBB.js → chunk-ULXYWUXZ.js} +1 -1
  19. package/dist/{chunk-K4ONXZQE.js → chunk-VZZPQZDI.js} +1 -1
  20. package/dist/{chunk-NFVGCV56.js → chunk-W34I6VMP.js} +1 -1
  21. package/dist/{chunk-R5LA6DL2.js → chunk-W7C4PWUR.js} +1 -1
  22. package/dist/{chunk-7OR4XA5B.js → chunk-ZEBSTTKL.js} +1 -1
  23. package/dist/{chunk-SVONBXW3.js → chunk-ZJL4OEXX.js} +3 -3
  24. package/dist/{chunk-IYKHXISM.js → cli-auth.js} +1 -1
  25. package/dist/main-app.js +7 -7
  26. package/dist/main.js +10 -0
  27. package/package.json +1 -1
  28. package/dist/chunk-465RG5I6.js +0 -10
  29. package/dist/chunk-OFKOOEKB.js +0 -140
  30. package/dist/chunk-U3GZBLTM.js +0 -2
  31. package/dist/chunk-VDUY46W2.js +0 -198
package/README.md CHANGED
@@ -37,7 +37,7 @@ the whole setup:
37
37
  **1. Create the account** — open <https://howtofix.id> and sign up. Sign in with
38
38
  Google works (a `@gmail.com` address).
39
39
 
40
- **2. Create a token** — open <https://howtofix.id/console/token> and make one. It
40
+ **2. Create a token** — open <https://howtofix.id/keys> and make one. It
41
41
  starts with `sk-`. Treat it like a password: it is the credential this CLI uses,
42
42
  and it is the only thing you have to copy.
43
43
 
@@ -179,6 +179,7 @@ Everything lives in `~/.howtocode/agent`:
179
179
 
180
180
  - `models.json` — providers and model catalog
181
181
  - `auth.json` — stored credentials
182
+ - `vault.json` — encrypted secret store (`/vault init`, then `/vault unlock`)
182
183
  - `settings.json` — defaults
183
184
  - `sessions/` — transcripts
184
185
  - `agents/` — parked background agent runs (`*.json`) and your subagent definitions (`*.md`)
@@ -188,6 +189,11 @@ Set `HOWTOCODE_CODING_AGENT_DIR` to use a different root. The underlying SDK is
188
189
 
189
190
  If no key is stored, the CLI says so and tells you to run `/connect`.
190
191
 
192
+ If you use `/connect <email>:<password>` instead of pasting a token, the account
193
+ credential goes into the vault when one is unlocked; unlocking an existing vault
194
+ also moves any older plaintext `account-credential.json` into it. Without a
195
+ vault the fallback file is mode `0600`.
196
+
191
197
  ## Flags
192
198
 
193
199
  ```
@@ -1 +1 @@
1
- import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h,P as i,Q as j}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{e as AGENTS_STORE_DIR,a as AGENT_DIR,j as IMAGES_DIR,g as REACHABLE_CACHE_PATH,f as USAGE_CACHE_PATH,b as USER_SKILLS_DIR,h as WORKFLOWS_DIR,d as additionalSkillPaths,i as pinAgentDir,c as projectSkillsDir};
1
+ import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h,P as i,Q as j}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{e as AGENTS_STORE_DIR,a as AGENT_DIR,j as IMAGES_DIR,g as REACHABLE_CACHE_PATH,f as USAGE_CACHE_PATH,b as USER_SKILLS_DIR,h as WORKFLOWS_DIR,d as additionalSkillPaths,i as pinAgentDir,c as projectSkillsDir};
@@ -1 +1 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s}from"./chunk-SVONBXW3.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as APPROVAL_LABELS,b as APPROVAL_MODES,f as MODE_MAX_TIER,e as TIER_RANK,s as createPermissionExtension,h as criticalCommand,p as decideToolCall,q as describeToolCall,r as formatApprovalPrompt,l as getApprovalMode,d as isApprovalMode,n as isDangerousBypass,a as isReadOnlyCommand,j as loadApprovalMode,g as resolveTier,k as saveApprovalMode,i as setApprovalMode,o as setApprovalPrompt,m as setDangerousBypass};
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s}from"./chunk-ZJL4OEXX.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as APPROVAL_LABELS,b as APPROVAL_MODES,f as MODE_MAX_TIER,e as TIER_RANK,s as createPermissionExtension,h as criticalCommand,p as decideToolCall,q as describeToolCall,r as formatApprovalPrompt,l as getApprovalMode,d as isApprovalMode,n as isDangerousBypass,a as isReadOnlyCommand,j as loadApprovalMode,g as resolveTier,k as saveApprovalMode,i as setApprovalMode,o as setApprovalPrompt,m as setDangerousBypass};
@@ -0,0 +1,10 @@
1
+ import{a as A}from"./chunk-UTYFLLSM.js";import{existsSync as E,readFileSync as D}from"node:fs";import{dirname as Le,join as de}from"node:path";import{fileURLToPath as Fe}from"node:url";import{cpSync as J,existsSync as T,readdirSync as je,readFileSync as ce,renameSync as He,statSync as N,writeFileSync as Ne}from"node:fs";import{homedir as ue}from"node:os";import{dirname as Te,join as p,resolve as De}from"node:path";import{cpSync as he,existsSync as S,mkdirSync as P,mkdtempSync as L,readdirSync as R,readFileSync as j,renameSync as be,rmSync as b,statSync as x,writeFileSync as M}from"node:fs";import{tmpdir as V}from"node:os";import{dirname as Q,isAbsolute as Se,join as u,relative as ke,resolve as C}from"node:path";import{fileURLToPath as ve}from"node:url";import{execFileSync as xe}from"node:child_process";import{createHash as Z}from"node:crypto";import{gunzipSync as me}from"node:zlib";var k=512;function O(e,t,r){let s=e.subarray(t,t+r),i=s.indexOf(0);return s.subarray(0,i===-1?s.length:i).toString("utf8").trim()}function W(e,t,r){let s=O(e,t,r);if(!s)return 0;let i=Number.parseInt(s,8);return Number.isFinite(i)?i:0}function ye(e){let t={},r=0;for(;r<e.length;){let s=e.indexOf(32,r);if(s===-1)break;let i=Number.parseInt(e.toString("utf8",r,s),10);if(!Number.isFinite(i)||i<=0)break;let n=e.toString("utf8",s+1,r+i-1),o=n.indexOf("=");o>0&&(t[n.slice(0,o)]=n.slice(o+1)),r+=i}return t}function K(e){let t=me(e),r=[],s=0,i,n={};for(;s+k<=t.length;){let o=t.subarray(s,s+k);if(o.every(ge=>ge===0))break;let a=O(o,0,100),c=O(o,345,155),l=W(o,124,12),f=W(o,100,8),m=String.fromCharCode(o[156]??48),w=O(o,157,100),v=l>0?t.subarray(s+k,s+k+l):Buffer.alloc(0);if(s+=k+Math.ceil(l/k)*k,m==="x"||m==="g"){n=ye(v);continue}if(m==="L"){i=v.toString("utf8").replace(/\0.*$/s,"").trim();continue}let y=n.path??i??(c?`${c}/${a}`:a);i=void 0,n={};let d=y.indexOf("/");if(d===-1||(y=y.slice(d+1),y=y.replace(/\/+$/,""),!y))continue;let h=m==="5"?"directory":m==="2"?"symlink":m==="0"||m==="\0"||m===""?"file":"other";r.push({path:y,kind:h,size:l,mode:f&511,...h==="file"?{data:Buffer.from(v)}:{},...h==="symlink"?{link:w}:{}})}return r}function U(e){if(!e||e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:/.test(e))return!1;let t=e.replace(/\/+$/,"");return t?t.split("/").every(s=>s!==""&&s!=="."&&s!==".."):!1}function X(e,t){let r=`${t.replace(/\/+$/,"")}/`,s=[];for(let i of e){if(!i.path.startsWith(r))continue;let n=i.path.slice(r.length);n&&s.push({...i,path:n})}return s}function we(){return u(g,"presets")}function Y(e){return u(e,".howtocode","presets")}function ee(e){return S(u(e,".disabled"))}function te(){return u(Q(ve(import.meta.url)),"presets")}function H(e){return[Y(e),we()]}var re=/^[a-z0-9][a-z0-9-]*$/,$e=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $(e,t){let r=ke(C(e),C(t));return r!==""&&!r.startsWith("..")&&!Se(r)}function ne(e,t){let r=[];if(!_(t))return["preset.json must be a JSON object"];let s=l=>{let f=t[l];return typeof f!="string"||f.trim()===""?(r.push(`${l} must be a non-empty string`),""):f.trim()},i=s("name");s("title"),s("description"),s("category");let n=s("version");i&&!re.test(i)&&r.push(`name "${i}" must be lowercase letters, digits and dashes`),n&&!$e.test(n)&&r.push(`version "${n}" is not a version like 1.0.0`);let o=t.skills;if(!Array.isArray(o)||o.length===0)r.push("skills must be a non-empty array of directory names");else for(let l of o){if(typeof l!="string"||l.trim()===""){r.push("every skills entry must be a non-empty string");continue}let f=u(e,"skills",l.trim());if(!$(u(e,"skills"),f)){r.push(`skill "${l}" escapes the preset directory`);continue}S(u(f,"SKILL.md"))||r.push(`skill "${l}" has no SKILL.md at ${u("skills",l)}`)}let a=t.prompt;if(a!==void 0)if(typeof a!="string"||a.trim()==="")r.push("prompt must be a non-empty string when present");else{let l=u(e,a.trim());$(e,l)?S(l)||r.push(`prompt file "${a}" does not exist`):r.push(`prompt "${a}" escapes the preset directory`)}let c=t.tags;return c!==void 0&&!Array.isArray(c)&&r.push("tags must be an array when present"),r.push(...q(t.mcp)),r}function se(e){let t=u(e,"preset.json");if(!S(t))return{problems:[`no preset.json in ${e}`]};let r;try{r=JSON.parse(j(t,"utf8"))}catch(o){return{problems:[`preset.json is not valid JSON: ${o instanceof Error?o.message:String(o)}`]}}let s=ne(e,r);if(s.length>0)return{problems:s};let i=r,n=Array.isArray(i.tags)?i.tags.filter(o=>typeof o=="string"):[];return{problems:[],manifest:{name:String(i.name),title:String(i.title),description:String(i.description),category:String(i.category),tags:n,version:String(i.version),skills:i.skills.map(o=>String(o)),prompt:typeof i.prompt=="string"?i.prompt:void 0,mcp:i.mcp&&typeof i.mcp=="object"&&!Array.isArray(i.mcp)?i.mcp:void 0,integrates:typeof i.integrates=="string"&&i.integrates.trim()!==""?i.integrates.trim():void 0}}}function F(e){return e.filter(t=>{try{return x(t).isDirectory()}catch{return!1}})}function I(e,t){let r=[],s=[],i=(o,a)=>{if(!S(u(o,"preset.json")))return;let{manifest:c,problems:l}=se(o);c?r.push({manifest:c,dir:o,source:t}):s.push(`${a}: ${l.join("; ")}`)},n;try{n=R(e).sort()}catch{return{entries:r,problems:s}}for(let o of n){if(o.startsWith("."))continue;let a=u(e,o);try{if(!x(a).isDirectory())continue}catch{continue}if(S(u(a,"preset.json"))){i(a,o);continue}let c;try{c=R(a).sort()}catch{continue}for(let l of c){if(l.startsWith("."))continue;let f=u(a,l);try{if(!x(f).isDirectory())continue}catch{continue}i(f,u(o,l))}}return{entries:r,problems:s}}function Ye(e){let t=I(te(),"bundled"),r=[...t.entries],s=[...t.problems],i=new Map(r.map(n=>[n.manifest.name,n]));for(let n of F(H(e))){let o=I(n,"installed");s.push(...o.problems);for(let a of o.entries){let c=i.get(a.manifest.name);if(c){let l=r.indexOf(c);l>=0&&(r[l]=a),i.set(a.manifest.name,a)}else r.push(a),i.set(a.manifest.name,a)}}return{entries:r,problems:s}}function et(e){return[...new Set(e.map(t=>t.manifest.category))].sort()}function tt(e,t){return e.filter(r=>r.manifest.category===t).sort((r,s)=>r.manifest.title.localeCompare(s.manifest.title))}function ie(e){let t=[];for(let r of F(H(e))){let{entries:s}=I(r,"installed");for(let i of s)ee(i.dir)||t.push(u(i.dir,"skills"))}return t}function rt(e){let t=[];for(let r of F(H(e))){let{entries:s}=I(r,"installed");for(let i of s){if(ee(i.dir))continue;let n=i.manifest.prompt;if(!n)continue;let o=u(i.dir,n);if($(i.dir,o))try{let a=j(o,"utf8").trim();a&&t.push({name:i.manifest.name,title:i.manifest.title,text:a})}catch{}}}return t}function nt(e,t){let r=0;for(let s of t.skills)try{r+=x(u(e,"skills",s,"SKILL.md")).size}catch{}return r}function Ee(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var Ae=".install.lock";function Oe(e,t){P(e,{recursive:!0});let r=u(e,Ae),s=Date.now()+6e4;for(;;)try{M(r,`${process.pid}
2
+ `,{flag:"wx"});break}catch(i){if(i.code!=="EEXIST")throw i;let n=!1;try{n=Date.now()-x(r).mtimeMs>12e4}catch{continue}if(n){b(r,{force:!0});continue}if(Date.now()>s)throw new Error(`another install is holding ${r}; remove it if no install is running`);Ee(100)}try{for(let i of R(e))i.startsWith(".staging-")&&b(u(e,i),{recursive:!0,force:!0});return t()}finally{b(r,{force:!0})}}function oe(e,t,r){let s=u(t,r.name);return Oe(t,()=>{P(t,{recursive:!0});let i=L(u(t,".staging-"));try{he(e,i,{recursive:!0}),b(s,{recursive:!0,force:!0}),be(i,s)}catch(n){throw b(i,{recursive:!0,force:!0}),n}return s})}function ae(e,t){if(!S(e))return{ok:!1,problems:[`no such directory: ${e}`]};let{manifest:r,problems:s}=se(e);if(!r)return{ok:!1,problems:s};let i=oe(e,t,r);return{ok:!0,name:r.name,target:i,problems:[]}}function Pe(e,t){let r=L(u(V(),"howtocode-preset-"));try{return xe("git",["clone","--depth","1","--quiet",e,r],{stdio:"pipe"}),ae(r,t)}catch(s){return{ok:!1,problems:[`git clone failed: ${(s instanceof Error?s.message:String(s)).split(`
3
+ `)[0]}`]}}finally{b(r,{recursive:!0,force:!0})}}function st(e,t){return/^(https?:\/\/|git@|git:\/\/)/.test(e)?Pe(e,t):ae(C(e),t)}function it(e,t){let r=[],s=[];if(!re.test(e))return{removed:r,problems:[`"${e}" is not a preset name`]};for(let i of H(t)){let n=u(i,e);if(S(n)){if(!$(i,n)){s.push(`refusing to remove ${n}: outside ${i}`);continue}b(n,{recursive:!0,force:!0}),r.push(n)}}return r.length===0&&s.push(`"${e}" is not installed`),{removed:r,problems:s}}function ot(e){return Y(e)}function Re(e){let t=[],r=(n,o)=>{for(let a of R(n,{withFileTypes:!0}).sort((c,l)=>c.name.localeCompare(l.name))){let c=u(n,a.name),l=o?`${o}/${a.name}`:a.name;a.isSymbolicLink()||(a.isDirectory()?r(c,l):a.isFile()&&t.push([l,Z("sha256").update(j(c)).digest("hex")]))}};r(e,"");let s=0;for(let[n]of t)s+=x(u(e,n)).size;let i=t.map(([n,o])=>`${o} ${n}`).join(`
4
+ `);return{digest:Z("sha256").update(i).digest("hex").slice(0,16),fileCount:t.length,bytes:s}}function at(){let e=u(te(),"hub.json");try{let t=j(e,"utf8"),r=JSON.parse(t),s=_(r)&&Array.isArray(r.entries)?r.entries:[],i=[];for(let n of s)_(n)&&(typeof n.name!="string"||typeof n.repo!="string"||typeof n.sha!="string"||typeof n.path!="string"||typeof n.category!="string"||i.push({name:n.name,title:typeof n.title=="string"?n.title:n.name,description:typeof n.description=="string"?n.description:"",category:n.category,skill:typeof n.skill=="string"?n.skill:n.name,path:n.path,repo:n.repo,sha:n.sha,license:typeof n.license=="string"?n.license:"unknown",stars:typeof n.stars=="number"?n.stars:0,sizeKb:typeof n.sizeKb=="number"?n.sizeKb:0,...typeof n.digest=="string"?{digest:n.digest}:{},...typeof n.fileCount=="number"?{fileCount:n.fileCount}:{},...typeof n.modelInvocable=="boolean"?{modelInvocable:n.modelInvocable}:{}}));return{entries:i,problems:[]}}catch(t){return t?.code==="ENOENT"?{entries:[],problems:[]}:{entries:[],problems:[`registry unreadable: ${t instanceof Error?t.message:String(t)}`]}}}function ct(e){return[...new Set(e.map(t=>t.category))].sort()}function lt(e,t){return e.filter(r=>r.category===t).sort((r,s)=>s.stars-r.stars||r.name.localeCompare(s.name))}function ut(e,t){return e.find(r=>r.name===t)}function Ie(e){return`https://codeload.github.com/${e.repo}/tar.gz/${e.sha}`}async function ft(e,t,r=12e4){let s=L(u(V(),"howtocode-hub-"));try{let i=await fetch(Ie(e),{signal:AbortSignal.timeout(r),redirect:"follow"});if(!i.ok)return{ok:!1,problems:[`${e.repo}: HTTP ${i.status} from codeload`]};let n=Buffer.from(await i.arrayBuffer()),o=K(n),a=X(o,e.path).filter(d=>d.kind==="file"||d.kind==="directory");if(!a.some(d=>d.path==="SKILL.md"))return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)} has no ${e.path}/SKILL.md`]};let c=u(s,"preset",e.name),l=u(c,"skills",e.skill),f=0;for(let d of a){if(!U(d.path))return{ok:!1,problems:[`refusing unsafe path in archive: ${d.path}`]};let h=u(l,d.path);if(!$(l,h))return{ok:!1,problems:[`refusing path outside the skill: ${d.path}`]};if(d.kind==="directory"){P(h,{recursive:!0});continue}P(Q(h),{recursive:!0}),M(h,d.data??Buffer.alloc(0)),f+=1}let m={name:e.name,title:e.title,description:e.description,category:e.category,version:"1.0.0",skills:[e.skill],source:`${e.repo}@${e.sha}`,license:e.license};if(M(u(c,"preset.json"),`${JSON.stringify(m,null,2)}
5
+ `),!e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: registry entry has no digest`,"refusing to install; content cannot be verified against what was reviewed"]};let w=Re(l);if(w.digest!==e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: content changed under a pinned commit`,`expected ${e.digest} (${e.fileCount??"?"} files), got ${w.digest} (${w.fileCount} files)`,"refusing to install; the registry needs regenerating"]};let v=ne(c,m);if(v.length>0)return{ok:!1,problems:v};let y=oe(c,t,m);return{ok:!0,name:e.name,target:y,problems:[],skill:e.skill,modelInvocable:e.modelInvocable}}catch(i){return{ok:!1,problems:[`download failed: ${(i instanceof Error?i.message:String(i)).split(`
6
+ `)[0]}`]}}finally{b(s,{recursive:!0,force:!0})}}function Me(){let e=(process.env.HOWTOCODE_HOME??process.env.HOWTOFIX_HOME??process.env.HOME??"").trim();return De(e||ue())}function fe(e,t){for(let r of je(e)){let s=p(e,r),i=p(t,r);if(!T(i)){try{J(s,i,{recursive:!0,force:!1})}catch{}continue}let n=!1;try{n=N(s).isDirectory()}catch{continue}if(n&&N(i).isDirectory()){fe(s,i);continue}try{let o=N(i).size,a=N(s).size;!n&&o<=2&&a>o&&J(s,i,{force:!0})}catch{}}}function Ce(e){let t=p(ue(),".howtofix");if(T(t)){if(!T(e))try{He(t,e),z(e);return}catch{try{J(t,e,{recursive:!0}),z(e);return}catch{return}}fe(t,e),z(e)}}function z(e){le(p(e,"agent","models.json"),"providers"),le(p(e,"agent","auth.json"),void 0)}function le(e,t){if(!T(e))return;let r;try{r=JSON.parse(ce(e,"utf8"))}catch{return}let s=t?r[t]:r;if(!s||typeof s!="object")return;let i=!1;for(let[n,o]of Object.entries(s)){let a=o,c=typeof a?.baseUrl=="string"?a.baseUrl:"";c&&!/^https?:\/\/(api\.)?howtofix\.id(?:\/|$)/i.test(c)&&(delete s[n],i=!0)}if(t===void 0){let n;try{let o=JSON.parse(ce(p(Te(e),"models.json"),"utf8"));o.providers&&typeof o.providers=="object"&&(n=new Set(Object.keys(o.providers)))}catch{}if(n&&n.size>0)for(let o of Object.keys(s))n.has(o)||n.has(o.replace(/^howtofix/,"howtocode"))||(delete s[o],i=!0)}for(let[n,o]of Object.entries(s)){let a=n==="howtofix"?"howtocode":n==="howtofix-free"?"howtocode-free":n;a===n||s[a]!==void 0||(s[a]=o,delete s[n],i=!0)}if(i)try{Ne(e,`${JSON.stringify(r,null,2)}
7
+ `)}catch{}}var g=process.env.HOWTOCODE_CODING_AGENT_DIR?.trim()||process.env.HOWTOFIX_CODING_AGENT_DIR?.trim()||(()=>{let e=p(Me(),".howtocode");return Ce(e),p(e,"agent")})(),ht=p(g,"skills");function _e(e){return p(e,".howtocode","skills")}function bt(e){let t=[_e(e)];return t.push(...ie(e)),t}var St=p(g,"agents"),kt=p(g,"usage-cache.json"),vt=p(g,"reachable-models.json"),xt=p(g,"workflows");function wt(){process.env.HXF_CODING_AGENT_DIR=g}var $t=p(g,"images");function B(e=g){return de(e,"mcp.json")}function q(e){let t=[];if(e===void 0)return t;if(typeof e!="object"||e===null||Array.isArray(e))return["mcp must be an object of server names"];for(let[r,s]of Object.entries(e)){if(!/^[A-Za-z0-9_-]+$/.test(r)){t.push(`mcp server "${r}" must use only letters, digits, _ and -`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){t.push(`mcp server "${r}" must be an object`);continue}let i=s,n=typeof i.command=="string"&&i.command.trim()!=="",o=typeof i.url=="string"&&i.url.trim()!=="";!n&&!o&&t.push(`mcp server "${r}" needs either a command or a url`),i.args!==void 0&&!Array.isArray(i.args)&&t.push(`mcp server "${r}": args must be an array`);for(let a of["env","headers"]){let c=i[a];if(c!==void 0){if(typeof c!="object"||c===null||Array.isArray(c)){t.push(`mcp server "${r}": ${a} must be an object of strings`);continue}for(let[l,f]of Object.entries(c))typeof f!="string"&&t.push(`mcp server "${r}": ${a}.${l} must be a string`)}}}return t}function G(e){if(!E(e))return{mcpServers:{}};try{let t=JSON.parse(D(e,"utf8"));if(!t||typeof t!="object"||Array.isArray(t))return{mcpServers:{}};let r=t.mcpServers;return!r||typeof r!="object"||Array.isArray(r)?{mcpServers:{}}:{mcpServers:r}}catch{return{mcpServers:{}}}}function jt(e,t=g){let r=Object.keys(e);if(r.length===0)return{added:[],skipped:[],problems:[]};let s=B(t),i=[];if(E(s))try{JSON.parse(D(s,"utf8"))}catch{return{added:[],skipped:[],problems:[`${s} is not valid JSON; leaving it alone`]}}let n=G(s),o=[],a=[];for(let c of r){if(n.mcpServers[c]!==void 0){a.push(c);continue}n.mcpServers[c]=e[c],o.push(c)}if(o.length>0)try{A(s,`${JSON.stringify(n,null,2)}
8
+ `)}catch(c){return{added:[],skipped:a,problems:[`could not write ${s}: ${c instanceof Error?c.message:String(c)}`]}}return{added:o,skipped:a,problems:i}}function Ht(e,t=new Set,r=g){let s=B(r),i=[];if(e.length===0||!E(s))return{removed:[],kept:[],problems:i};let n=G(s),o=[],a=[];for(let c of e)if(n.mcpServers[c]!==void 0){if(t.has(c)){a.push(c);continue}delete n.mcpServers[c],o.push(c)}if(o.length>0)try{A(s,`${JSON.stringify(n,null,2)}
9
+ `)}catch(c){return{removed:[],kept:a,problems:[`could not write ${s}: ${c instanceof Error?c.message:String(c)}`]}}return{removed:o,kept:a,problems:i}}var pe="@netrodev/howtocode-roblox-bridge";function Nt(e=g){let t=B(e);if(!E(t))return[];try{JSON.parse(D(t,"utf8"))}catch{return[]}let r=G(t),s=Object.keys(r.mcpServers).filter(i=>{let n=r.mcpServers[i];return[n.command,...Array.isArray(n.args)?n.args:[]].map(a=>String(a??"")).some(a=>a===pe||a.startsWith(`${pe}@`))});if(s.length===0)return[];for(let i of s)delete r.mcpServers[i];try{A(t,`${JSON.stringify(r,null,2)}
10
+ `)}catch{return[]}return s}function Tt(e){if(typeof e.url=="string"&&e.url)return`http: ${e.url}`;let t=typeof e.command=="string"?e.command:"",r=Array.isArray(e.args)?e.args.filter(s=>typeof s=="string"):[];return`stdio: ${[t,...r].join(" ")}`.trim()}function ze(){return de(Le(Fe(import.meta.url)),"presets","mcp-hub.json")}function Dt(e=ze()){let t=[];if(!E(e))return{entries:[],problems:[`no MCP catalogue at ${e}`]};let r;try{r=JSON.parse(D(e,"utf8"))}catch(n){return{entries:[],problems:[`${e} is not valid JSON: ${n instanceof Error?n.message:String(n)}`]}}let s=r?.entries;if(!Array.isArray(s))return{entries:[],problems:[`${e} has no entries array`]};let i=[];for(let n of s){if(typeof n!="object"||n===null||Array.isArray(n))continue;let o=n,a=typeof o.name=="string"?o.name.trim():"";if(!a){t.push("an entry has no name");continue}if(!/^[A-Za-z0-9_-]+$/.test(a)){t.push(`"${a}" is not a usable server name`);continue}let c=typeof o.command=="string"&&o.command.trim()!=="",l=typeof o.url=="string"&&o.url.trim()!=="";if(!c&&!l){t.push(`"${a}" has neither a command nor a url`);continue}i.push({name:a,title:typeof o.title=="string"?o.title:a,description:typeof o.description=="string"?o.description:"",category:typeof o.category=="string"?o.category:"other",preset:typeof o.preset=="string"?o.preset:void 0,command:typeof o.command=="string"?o.command:void 0,url:typeof o.url=="string"?o.url:void 0,args:Array.isArray(o.args)?o.args.filter(f=>typeof f=="string"):void 0,env:o.env&&typeof o.env=="object"&&!Array.isArray(o.env)?o.env:void 0,needs:Array.isArray(o.needs)?o.needs.filter(f=>typeof f=="string"):void 0,docs:typeof o.docs=="string"?o.docs:void 0})}return{entries:i,problems:t}}function Mt(e){return[...new Set(e.map(t=>t.category))].sort()}function Ct(e,t){return e.filter(r=>r.category===t).sort((r,s)=>r.title.localeCompare(s.title))}function _t(e,t){return e.find(r=>r.name===t)}function Lt(e){let t={};return e.command&&(t.command=e.command),e.url&&(t.url=e.url),e.args&&e.args.length>0&&(t.args=[...e.args]),e.env&&Object.keys(e.env).length>0&&(t.env={...e.env}),e.description&&(t.description=e.description),t}function Ft(e,t=process.env){return(e.needs??[]).filter(r=>!t[r])}export{B as a,q as b,jt as c,Ht as d,pe as e,Nt as f,Tt as g,ze as h,Dt as i,Mt as j,Ct as k,_t as l,Lt as m,Ft as n,ee as o,te as p,ne as q,se as r,Ye as s,et as t,tt as u,ie as v,rt as w,nt as x,ae as y,st as z,it as A,ot as B,at as C,ct as D,lt as E,ut as F,ft as G,g as H,ht as I,_e as J,bt as K,St as L,kt as M,vt as N,xt as O,wt as P,$t as Q};
@@ -1,4 +1,4 @@
1
- import{b as j}from"./chunk-MCAAX33K.js";import{H as m,N as A}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import{j as R}from"./chunk-MVVEYKN6.js";import{b as M,d as T,f as D}from"./chunk-TUXY64DT.js";import{a as I}from"./chunk-U3GZBLTM.js";import{a as b}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";import{spawnSync as J}from"node:child_process";import{existsSync as S,readdirSync as E,readFileSync as x,realpathSync as B,statSync as C,writeFileSync as F,unlinkSync as z}from"node:fs";import{dirname as N,join as p}from"node:path";var k=[22,19];async function W(t="https://api.howtofix.id/api/status"){let n=[],[s,e]=process.versions.node.split(".").map(Number),r=s>k[0]||s===k[0]&&e>=k[1];n.push({name:"node",ok:r,detail:`${process.versions.node} (needs >= ${k[0]}.${k[1]})`});let i=J("git",["--version"],{encoding:"utf8"});n.push({name:"git",ok:i.status===0,detail:i.status===0?i.stdout.trim():"not found on PATH"});let o=I();n.push({name:"sandbox",ok:!!o,detail:o??"no working bubblewrap (Linux) or sandbox-exec (macOS); --sandbox unavailable",optional:!0});let l=!1,c=m;try{let d=p(m,`.doctor-${process.pid}`);F(d,"ok"),z(d),l=!0}catch(d){c=`${m} is not writable: ${d instanceof Error?d.message:String(d)}`}n.push({name:"state dir",ok:l,detail:c});let a=p(m,"auth.json"),u="no auth.json \u2014 run `howtocode` and sign in",h=!1;try{let d=JSON.parse(x(a,"utf8")),f=Object.keys(d).length;h=f>0,u=h?`${f} provider credential${f===1?"":"s"}`:u}catch{}n.push({name:"auth",ok:h,detail:u,optional:!0});try{let d=Date.now(),f=await fetch(t,{signal:AbortSignal.timeout(5e3)});n.push({name:"gateway",ok:f.ok,detail:`${t} \u2192 ${f.status} in ${Date.now()-d}ms`,optional:!0})}catch(d){n.push({name:"gateway",ok:!1,detail:`${t} unreachable: ${d instanceof Error?d.message:String(d)}`,optional:!0})}return n.push(G()),n}function G(t=q()){if(t===void 0)return{name:"install",ok:!0,detail:"not an npm install; skipped",optional:!0};if(!S(t))return{name:"install",ok:!0,detail:"no bundled dependencies to check",optional:!0};let n=[],s=0;for(let e of["@netrodev"]){let r=p(t,e);if(S(r))for(let i of E(r)){let o=p(r,i,"dist");if(S(o))for(let l of _(o)){s+=1;let c=x(l,"utf8");for(let a of c.matchAll(/import\("(\.[^"]+)"\)/g)){let u=p(N(l),a[1]);S(u)||n.push(`${e}/${i}: ${u.slice(o.length+1)}`)}}}}return n.length>0?{name:"install",ok:!1,detail:`${n.length} module${n.length===1?"":"s"} missing (${n[0]}); reinstall with \`npm install -g howtocode@latest\``}:{name:"install",ok:!0,detail:`${s} lazy module${s===1?"":"s"} present`}}function q(){try{return p(N(N(B(process.argv[1]??""))),"node_modules")}catch{return}}function _(t,n=[]){let s;try{s=E(t)}catch{return n}for(let e of s){let r=p(t,e);if(e.endsWith(".lazy.js"))n.push(r);else if(!e.includes("."))try{C(r).isDirectory()&&_(r,n)}catch{}}return n}async function ie(){let t=await W(),n=Math.max(...t.map(e=>e.name.length));for(let e of t){let r=e.ok?"ok ":e.optional?"warn":"FAIL";console.log(` ${r} ${e.name.padEnd(n)} ${e.detail}`)}let s=t.filter(e=>!e.ok&&!e.optional);return s.length>0?(console.log(`
1
+ import{b as j}from"./chunk-MCAAX33K.js";import{a as b}from"./chunk-DK3DYJTA.js";import{H as m,N as A}from"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import{j as R}from"./chunk-MVVEYKN6.js";import{b as M,d as T,f as D}from"./chunk-TUXY64DT.js";import{a as I}from"./chunk-FABEBOGV.js";import"./chunk-WOT6VMZA.js";import{spawnSync as J}from"node:child_process";import{existsSync as S,readdirSync as E,readFileSync as x,realpathSync as B,statSync as C,writeFileSync as F,unlinkSync as z}from"node:fs";import{dirname as N,join as p}from"node:path";var k=[22,19];async function W(t="https://api.howtofix.id/api/status"){let n=[],[s,e]=process.versions.node.split(".").map(Number),r=s>k[0]||s===k[0]&&e>=k[1];n.push({name:"node",ok:r,detail:`${process.versions.node} (needs >= ${k[0]}.${k[1]})`});let i=J("git",["--version"],{encoding:"utf8"});n.push({name:"git",ok:i.status===0,detail:i.status===0?i.stdout.trim():"not found on PATH"});let o=I();n.push({name:"sandbox",ok:!!o,detail:o??"no working bubblewrap (Linux) or sandbox-exec (macOS); --sandbox unavailable",optional:!0});let l=!1,c=m;try{let d=p(m,`.doctor-${process.pid}`);F(d,"ok"),z(d),l=!0}catch(d){c=`${m} is not writable: ${d instanceof Error?d.message:String(d)}`}n.push({name:"state dir",ok:l,detail:c});let a=p(m,"auth.json"),u="no auth.json \u2014 run `howtocode` and sign in",h=!1;try{let d=JSON.parse(x(a,"utf8")),f=Object.keys(d).length;h=f>0,u=h?`${f} provider credential${f===1?"":"s"}`:u}catch{}n.push({name:"auth",ok:h,detail:u,optional:!0});try{let d=Date.now(),f=await fetch(t,{signal:AbortSignal.timeout(5e3)});n.push({name:"gateway",ok:f.ok,detail:`${t} \u2192 ${f.status} in ${Date.now()-d}ms`,optional:!0})}catch(d){n.push({name:"gateway",ok:!1,detail:`${t} unreachable: ${d instanceof Error?d.message:String(d)}`,optional:!0})}return n.push(G()),n}function G(t=q()){if(t===void 0)return{name:"install",ok:!0,detail:"not an npm install; skipped",optional:!0};if(!S(t))return{name:"install",ok:!0,detail:"no bundled dependencies to check",optional:!0};let n=[],s=0;for(let e of["@netrodev"]){let r=p(t,e);if(S(r))for(let i of E(r)){let o=p(r,i,"dist");if(S(o))for(let l of _(o)){s+=1;let c=x(l,"utf8");for(let a of c.matchAll(/import\("(\.[^"]+)"\)/g)){let u=p(N(l),a[1]);S(u)||n.push(`${e}/${i}: ${u.slice(o.length+1)}`)}}}}return n.length>0?{name:"install",ok:!1,detail:`${n.length} module${n.length===1?"":"s"} missing (${n[0]}); reinstall with \`npm install -g howtocode@latest\``}:{name:"install",ok:!0,detail:`${s} lazy module${s===1?"":"s"} present`}}function q(){try{return p(N(N(B(process.argv[1]??""))),"node_modules")}catch{return}}function _(t,n=[]){let s;try{s=E(t)}catch{return n}for(let e of s){let r=p(t,e);if(e.endsWith(".lazy.js"))n.push(r);else if(!e.includes("."))try{C(r).isDirectory()&&_(r,n)}catch{}}return n}async function ie(){let t=await W(),n=Math.max(...t.map(e=>e.name.length));for(let e of t){let r=e.ok?"ok ":e.optional?"warn":"FAIL";console.log(` ${r} ${e.name.padEnd(n)} ${e.detail}`)}let s=t.filter(e=>!e.ok&&!e.optional);return s.length>0?(console.log(`
2
2
  ${s.length} problem${s.length===1?"":"s"} must be fixed before a session will work.`),1):0}function ce(t=m){let n=p(t,"models.json"),s;try{s=x(n,"utf8")}catch(a){return a.code==="ENOENT"?console.log(` no models.json at ${n} \u2014 run \`howtocode /connect\` to pull the catalogue`):j(b,"models",a),1}let e;try{e=JSON.parse(s)}catch(a){return console.error(`${b}: models: ${n} is not valid JSON (${a instanceof Error?a.message:String(a)})`),console.error(" fix the file, or delete it and run `howtocode /connect` to write a new one"),1}let r=e.providers??{},i=D(A),o=i?new Set(i.ids):void 0,l=new Set,c=0;for(let[a,u]of Object.entries(r)){let h=u.models??[],d=h.map(f=>f.id).filter(Boolean);for(let f of d)l.add(f);c+=d.length,console.log(` ${a} (${d.length})`);for(let f of h){if(!f.id)continue;let O=T(m).get(f.id),$=M(O??[]),g=$?` ${$}`:"",w=o&&!o.has(f.id)?" \u2014 not on this account":"";console.log(` ${f.id}${g}${w}`)}}if(o){let a=[...l].filter(u=>!o.has(u)).length;console.log(`
3
3
  ${[...o].filter(u=>l.has(u)).length} of ${c} listed model(s) this account can call${a>0?`; ${a} cannot (kept for other plans)`:""}`)}else console.log("\n which of these this account can call is unknown: run `howtocode` once to record it");return c===0?(console.log(" no models configured"),1):0}function v(t=15,n=m){let s=p(n,"sessions"),e;try{e=E(s)}catch{return[]}let r=[];for(let i of e){let o=p(s,i),l;try{l=E(o)}catch{continue}for(let c of l){if(!c.endsWith(".jsonl"))continue;let a=p(o,c);try{let u=C(a);r.push({file:a,project:i,modified:u.mtimeMs,bytes:u.size})}catch{}}}return r.sort((i,o)=>o.modified-i.modified).slice(0,t)}function le(t){let n=t.indexOf("--search");if(n>=0){let o=t[n+1]?.trim();if(!o)return console.error(`${b}: sessions: --search needs a word or phrase`),2;let l=K(o);if(l.length===0)return console.log(` no session mentions "${o}"`),0;for(let c of l){let a=new Date(c.row.modified).toISOString().replace("T"," ").slice(0,16),u=`${c.matches} hit${c.matches===1?"":"s"}`;console.log(` ${a} ${c.row.project} (${u})`),console.log(` ${c.row.file}`),console.log(` ${c.snippet}`)}return 0}let s=t.indexOf("--limit"),e=s>=0&&Number(t[s+1])||15,r=v(e);if(r.length===0)return console.log(` no saved sessions under ${p(m,"sessions")}`),t.includes("--export")?1:0;let i=t.indexOf("--export");if(i>=0){let o=Number(t[i+1]);if(!Number.isInteger(o)||o<1||o>r.length)return console.error(`${b}: sessions: --export needs a number from the list (1-${r.length})`),2;let l=r[o-1];try{console.log(Q(l.file))}catch(c){return j(b,"sessions",c),1}return 0}return r.forEach((o,l)=>{let c=new Date(o.modified).toISOString().replace("T"," ").slice(0,16),a=Math.round(o.bytes/1024);console.log(` ${String(l+1).padStart(2)} ${c} ${String(a).padStart(6)}k ${o.project}`),console.log(` ${o.file}`)}),0}function H(t){let n=t;try{let s=JSON.parse(t),e=s.message?.content??s.content;if(typeof e=="string"&&e.trim())n=e;else if(Array.isArray(e)){let r=e.map(i=>i&&typeof i=="object"&&"text"in i?String(i.text):"").join(" ");r.trim()&&(n=r)}}catch{}return R(X(n).replace(/\s+/g," ").trim())}function X(t){return t.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007|\u001b[@-Z\\-_]/g,"")}function Z(t,n,s=80){let e=t.toLowerCase().indexOf(n);if(e<0)return t.slice(0,s*2).trim();let r=Math.max(0,e-s),i=Math.min(t.length,e+n.length+s);return`${r>0?"\u2026":""}${t.slice(r,i).trim()}${i<t.length?"\u2026":""}`}function K(t,n=10,s=m){let e=t.toLowerCase(),r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i"),i=[];for(let o of v(Number.MAX_SAFE_INTEGER,s)){let l;try{l=x(o.file,"utf8")}catch{continue}let c=0,a=0,u=0,h=0,d=!1,f="";for(let $ of l.split(`
4
4
  `)){let g=$.toLowerCase(),w=g.indexOf(e);if(w<0)continue;let y=0;for(;w>=0;)y++,w=g.indexOf(e,w+e.length);c+=y;let L=g.includes('"role":"user"'),P=g.includes('"role":"toolresult"')||g.includes('"role":"tool"');L?a+=y:P?h+=y:u+=y,r.test($)&&(d=!0),f||(f=Z(H($),e))}if(c===0)continue;let O=(a>0?100:0)+(u>0?10:0)+Math.min(h,5)+(d?5:0)+Math.min(c,10)/100;i.push({row:o,matches:c,score:O,snippet:f})}return i.sort((o,l)=>l.score-o.score||l.row.modified-o.row.modified).slice(0,n)}function Q(t){let n=[`# Session ${t.split(/[\\/]/).pop()??t}`,""];for(let s of x(t,"utf8").split(`
@@ -1,4 +1,4 @@
1
- var a="HowToCode",o="0.7.67",n=["You are HowToCode, a coding agent. The user wants the fix, not a tour of the problem.",'NEVER report a check you did not run. NEVER state a version, path, result or capability you have not verified \u2014 if you did not check it, say you are unsure. "Not found" is not "impossible": a tool missing from PATH is often installed anyway, and one that is truly absent can usually be installed. Exhaust the real options before calling anything unavailable; when you do report a limit, say plainly what you tried and what you could not do. Unexercised behaviour is not evidence.',"NEVER mention the underlying harness, its vendor or its project name to the user.","Every tool is `read`, `write` or `exec`, and each approval mode auto-approves every tier up to its own: `suggest` runs `read` only, `auto-edit` adds `write`, `full-auto` adds `exec`. A read-only shell command runs in every mode, so inspecting the tree asks nothing.","NEVER aim a command at the filesystem root, a block device or a system account file, and NEVER shut down the host: those are refused in EVERY mode, `full-auto` included, so proposing one wastes the turn. This is not a list of things to avoid \u2014 it is a list of things that will not run.","Lead with the diagnosis in one or two sentences, then change the code. SHOULD prefer the smallest correct change over a rewrite. Name the file and the reason in a short line; do not narrate tool calls.","Fix the problem that was asked for. NEVER add features, refactors, validation, error handling or dependencies nobody requested.","Something reported broken: reproduce it first, confirm the fix after. Cannot reproduce it? Say so \u2014 NEVER edit code and call it fixed.","Tests describe intended behaviour. A failing test means fix the code, not the test: NEVER delete, skip or loosen an assertion to get green, and NEVER re-pin an expected value to whatever the code happens to print.","Anything you cannot settle by reading \u2014 a page, a layout, a screenshot, a CLI, a service, a failure \u2014 run it and look at the result. For a visual task, find a browser the way a real one does: `$PUPPETEER_EXECUTABLE_PATH`, `$CHROME_PATH`, then `which` for google-chrome, chromium and chromium-browser, then /usr/bin, /snap/bin and /var/lib/flatpak, then the puppeteer and playwright caches under the home directory. Still empty? `npx -y puppeteer browsers install chrome`, or `npm i puppeteer-core` against a chrome the image already ships outside PATH. Then drive the real artifact \u2014 open it, read the DOM, click the controls, measure at the widths that matter \u2014 instead of describing what you assume it does.","Done means the requested behaviour works end to end and every stated requirement is met \u2014 not a scaffold, a narrowed test or a plausible subset. Genuinely out of reach? Finish everything else, then say exactly what is missing and what you tried.","SHOULD plan multi-step work with `todo` before starting it, and mark each step done as you finish. A plan the user can see is worth more than a narration of what you are about to do.","Genuinely ambiguous design: enter plan mode, write the plan to the plan file, then present it with `exit_plan_mode`. Use it when several reasonable approaches exist or when a restructuring would be hard to undo. In plan mode `edit` and `write` are refused for every path except the plan file itself \u2014 that limit is enforced, not advisory, so plan the work rather than starting it. Plan mode needs an interactive session in which the user can approve it; when there is no UI it is unavailable, so design the approach yourself instead of calling it.","Work that is independent and would flood this conversation belongs in `task` subagents. Give each a self-contained assignment, then verify the file it wrote rather than trusting its summary. When that work has a shape you can script \u2014 many items through the same stages, or fan-out whose results must be combined \u2014 `workflow` states the orchestration in one place and runs it deterministically; `task` is for the one-off you cannot describe in advance.","MUST give each subagent a self-contained assignment: a child starts with none of this conversation, so a brief that says 'the file we discussed' reaches it as nothing. Choose the agent by what the work is \u2014 scout looks something up, architect returns a plan, reviewer reports issues with file evidence, task changes files \u2014 and NEVER send work that needs an edit to scout or reviewer, because neither can make one.","SHOULD delegate only work that is genuinely parallel: a subagent costs its own session and its own requests on the same quota as this conversation. A single lookup, a file you can read yourself, or a step whose result decides the next step stays here. MUST keep one call to at most six agents and the session to twelve live or parked ones \u2014 a larger fan-out is refused, and the refusal is a limit rather than a failure to work around.","Record a decision, a file's role, or a fact you would otherwise re-derive with `context`: notes survive compaction and are visible to the other agents on the task.","Look it up instead of recalling it: `web_search` and `web_fetch` for anything outside this repo, `lsp` for a definition, reference or diagnostic. Name the source you checked.","Before calling changed code done, run `quality` and `slop` over it and act on what they report. A metric you did not measure is a claim you cannot make.","A command runs under a two-minute default timeout. MUST pass a longer timeout for anything that legitimately takes more than that \u2014 a recursive directory walk, a package install, a build, a network fetch \u2014 and SHOULD prefer a bounded command to an unbounded one: 'du -sh' with an explicit path beats the whole profile, and on Windows/MSYS a recursive 'du' over a profile directory takes minutes rather than seconds.","When a choice blocks the task, use `ask` instead of guessing; when you need to work something out, use `think`, whose text stays out of the transcript.","Above all: NEVER claim a check you did not run, and NEVER call done on a subset."].join(`
1
+ var a="HowToCode",o="0.7.69",n=["You are HowToCode, a coding agent. The user wants the fix, not a tour of the problem.",'NEVER report a check you did not run. NEVER state a version, path, result or capability you have not verified \u2014 if you did not check it, say you are unsure. "Not found" is not "impossible": a tool missing from PATH is often installed anyway, and one that is truly absent can usually be installed. Exhaust the real options before calling anything unavailable; when you do report a limit, say plainly what you tried and what you could not do. Unexercised behaviour is not evidence.',"NEVER mention the underlying harness, its vendor or its project name to the user.","Every tool is `read`, `write` or `exec`, and each approval mode auto-approves every tier up to its own: `suggest` runs `read` only, `auto-edit` adds `write`, `full-auto` adds `exec`. A read-only shell command runs in every mode, so inspecting the tree asks nothing.","NEVER aim a command at the filesystem root, a block device or a system account file, and NEVER shut down the host: those are refused in EVERY mode, `full-auto` included, so proposing one wastes the turn. This is not a list of things to avoid \u2014 it is a list of things that will not run.","Lead with the diagnosis in one or two sentences, then change the code. SHOULD prefer the smallest correct change over a rewrite. Name the file and the reason in a short line; do not narrate tool calls.","Fix the problem that was asked for. NEVER add features, refactors, validation, error handling or dependencies nobody requested.","Something reported broken: reproduce it first, confirm the fix after. Cannot reproduce it? Say so \u2014 NEVER edit code and call it fixed.","Tests describe intended behaviour. A failing test means fix the code, not the test: NEVER delete, skip or loosen an assertion to get green, and NEVER re-pin an expected value to whatever the code happens to print.","Anything you cannot settle by reading \u2014 a page, a layout, a screenshot, a CLI, a service, a failure \u2014 run it and look at the result. For a visual task, find a browser the way a real one does: `$PUPPETEER_EXECUTABLE_PATH`, `$CHROME_PATH`, then `which` for google-chrome, chromium and chromium-browser, then /usr/bin, /snap/bin and /var/lib/flatpak, then the puppeteer and playwright caches under the home directory. Still empty? `npx -y puppeteer browsers install chrome`, or `npm i puppeteer-core` against a chrome the image already ships outside PATH. Then drive the real artifact \u2014 open it, read the DOM, click the controls, measure at the widths that matter \u2014 instead of describing what you assume it does.","Done means the requested behaviour works end to end and every stated requirement is met \u2014 not a scaffold, a narrowed test or a plausible subset. Genuinely out of reach? Finish everything else, then say exactly what is missing and what you tried.","SHOULD plan multi-step work with `todo` before starting it, and mark each step done as you finish. A plan the user can see is worth more than a narration of what you are about to do.","Genuinely ambiguous design: enter plan mode, write the plan to the plan file, then present it with `exit_plan_mode`. Use it when several reasonable approaches exist or when a restructuring would be hard to undo. In plan mode `edit` and `write` are refused for every path except the plan file itself \u2014 that limit is enforced, not advisory, so plan the work rather than starting it. Plan mode needs an interactive session in which the user can approve it; when there is no UI it is unavailable, so design the approach yourself instead of calling it.","Work that is independent and would flood this conversation belongs in `task` subagents. Give each a self-contained assignment, then verify the file it wrote rather than trusting its summary. When that work has a shape you can script \u2014 many items through the same stages, or fan-out whose results must be combined \u2014 `workflow` states the orchestration in one place and runs it deterministically; `task` is for the one-off you cannot describe in advance.","MUST give each subagent a self-contained assignment: a child starts with none of this conversation, so a brief that says 'the file we discussed' reaches it as nothing. Choose the agent by what the work is \u2014 scout looks something up, architect returns a plan, reviewer reports issues with file evidence, task changes files \u2014 and NEVER send work that needs an edit to scout or reviewer, because neither can make one.","SHOULD delegate only work that is genuinely parallel: a subagent costs its own session and its own requests on the same quota as this conversation. A single lookup, a file you can read yourself, or a step whose result decides the next step stays here. MUST keep one call to at most six agents and the session to twelve live or parked ones \u2014 a larger fan-out is refused, and the refusal is a limit rather than a failure to work around.","Record a decision, a file's role, or a fact you would otherwise re-derive with `context`: notes survive compaction and are visible to the other agents on the task.","Look it up instead of recalling it: `web_search` and `web_fetch` for anything outside this repo, `lsp` for a definition, reference or diagnostic. Name the source you checked.","Before calling changed code done, run `quality` and `slop` over it and act on what they report. A metric you did not measure is a claim you cannot make.","A command runs under a two-minute default timeout. MUST pass a longer timeout for anything that legitimately takes more than that \u2014 a recursive directory walk, a package install, a build, a network fetch \u2014 and SHOULD prefer a bounded command to an unbounded one: 'du -sh' with an explicit path beats the whole profile, and on Windows/MSYS a recursive 'du' over a profile directory takes minutes rather than seconds.","When a choice blocks the task, use `ask` instead of guessing; when you need to work something out, use `think`, whose text stays out of the transcript.","Above all: NEVER claim a check you did not run, and NEVER call done on a subset."].join(`
2
2
  `);function s(e){return e===void 0?void 0:e.replace(/Use \/login to log into a provider[^\n]*/gi,"Connect a provider with /connect or /login:").replace(/^[ \t]*\S*hxf-coding-agent[\\/]docs[\\/][^\n]*$/gim,"").replace(/\bhxf-coding-agent\b/gi,"the harness").replace(/\n{3,}/g,`
3
3
 
4
4
  `).trim()}var i=["# Project notes","","## What this is","","## Commands","- build:","- test:","","## Conventions","-",""].join(`
@@ -1 +1 @@
1
- import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-GEAWXEQG.js";import"./chunk-7LA2AMZB.js";import"./chunk-UTYFLLSM.js";import"./chunk-NFVGCV56.js";import"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";export{g as CATALOG_CACHE_TTL_MS,m as DEFAULT_CONTEXT_WINDOW,a as HOWTOCODE_BASE_URL,b as HOWTOCODE_CONSOLE_URL,l as HOWTOCODE_MODEL_COMPAT,c as HOWTOCODE_PROVIDERS,j as HTTP_IDLE_TIMEOUT_MS,r as UNLIMITED_SENTINEL,w as applyCatalog,x as applyCompat,B as checkAccount,s as checkCreditPools,t as checkUsage,d as configuredProviderIds,y as countNewModels,k as ensureGatewaySettings,C as fetchGatewayPrices,A as findLiveModels,q as isHowtoCodeProvider,h as loadCatalog,o as looksLikeToken,n as maskToken,v as mergeModels,e as newProviderEntry,p as parseModelIds,z as probeModel,D as readProviderKey,f as repairGatewayModels,i as repairModelFacts,u as syncGatewayModelsOnStart};
1
+ import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-SKLMU4IE.js";import"./chunk-7LA2AMZB.js";import"./chunk-W34I6VMP.js";import"./chunk-DK3DYJTA.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{g as CATALOG_CACHE_TTL_MS,m as DEFAULT_CONTEXT_WINDOW,a as HOWTOCODE_BASE_URL,b as HOWTOCODE_CONSOLE_URL,l as HOWTOCODE_MODEL_COMPAT,c as HOWTOCODE_PROVIDERS,j as HTTP_IDLE_TIMEOUT_MS,r as UNLIMITED_SENTINEL,w as applyCatalog,x as applyCompat,B as checkAccount,s as checkCreditPools,t as checkUsage,d as configuredProviderIds,y as countNewModels,k as ensureGatewaySettings,C as fetchGatewayPrices,A as findLiveModels,q as isHowtoCodeProvider,h as loadCatalog,o as looksLikeToken,n as maskToken,v as mergeModels,e as newProviderEntry,p as parseModelIds,z as probeModel,D as readProviderKey,f as repairGatewayModels,i as repairModelFacts,u as syncGatewayModelsOnStart};
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-YFJKKWIX.js";import"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as formatSkillList,b as skillInvocation,a as skillSearchPaths};
1
+ import{a,b,c}from"./chunk-SDU65XW4.js";import"./chunk-5FIFNXLT.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as formatSkillList,b as skillInvocation,a as skillSearchPaths};
@@ -0,0 +1,2 @@
1
+ import{spawnSync as d}from"node:child_process";import{accessSync as b,constants as l}from"node:fs";import{join as c}from"node:path";function u(e){try{return b(e,l.X_OK),!0}catch{return!1}}function x(e=process.platform,r=process.env.PATH??""){let n=r.split(":").filter(Boolean),o=t=>n.map(i=>c(i,t)).find(u);if(e==="linux"){let t=o("bwrap");return t&&d(t,["--ro-bind","/","/","--","true"],{stdio:"ignore",timeout:3e3}).status===0?"bubblewrap":void 0}if(e==="darwin")return o("sandbox-exec")?"seatbelt":void 0}function a(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function s(e,r){return e==="bubblewrap"?["bwrap","--die-with-parent","--new-session","--ro-bind","/","/","--dev","/dev","--proc","/proc","--tmpfs","/tmp","--bind",r.cwd,r.cwd,"--bind",r.agentDir,r.agentDir,"--chdir",r.cwd,"--",...r.argv]:["sandbox-exec","-p",["(version 1)","(deny default)","(allow process*)","(allow signal)","(allow sysctl-read)","(allow mach-lookup)","(allow network*)","(allow file-read*)",`(allow file-write* (subpath "${a(r.cwd)}") (subpath "${a(r.agentDir)}") (subpath "/tmp") (subpath "/private/tmp") (subpath "/private/var/folders"))`,""].join(`
2
+ `),...r.argv]}function g(e){return e==="bubblewrap"?"sandbox: bubblewrap \u2014 project writable, rest of the filesystem read-only":"sandbox: seatbelt \u2014 project writable, rest of the filesystem read-only"}function m(e,r){let n=d(s(e,r)[0],s(e,r).slice(1),{stdio:"inherit",env:{...process.env,HOWTOCODE_SANDBOXED:"1"}});return n.error?(console.error(`sandbox: could not start ${e}: ${n.error.message}`),1):n.status??1}export{x as a,s as b,g as c,m as d};