document360-writer 0.5.44 → 0.5.45

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 (2) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -255,7 +255,7 @@ Articles:
255
255
  `),console.log(`${j("\u25CF")} ${ve(s.title)}${s.arg!==null?se(`${s.sep}(${s.arg})`):""}`),r.set(e.id,{name:e.name,input:e.input}));break}case"article_diff":{let s=lt(e.oldContent,e.newContent,Math.max(40,(process.stdout.columns??80)-1));if(!s)break;let u=p=>p===1?"":"s";console.log(se(` \u23BF Added ${s.added} line${u(s.added)}, removed ${s.removed} line${u(s.removed)}`));for(let p of s.lines)console.log(p);s.hidden>0&&console.log(f(` \u2026 +${s.hidden} more diff lines`));break}case"tool_result":{let s=r.get(e.id);if(!s)break;r.delete(e.id);let u=ro(e.output,4,e.isError?void 0:s.name,s.input),p=e.isError?$:se;u.lines.forEach((h,y)=>console.log(p((y===0?" \u23BF ":" ")+h))),u.hidden>0&&console.log(f(` \u2026 +${u.hidden} lines`)),e.isError||Zp(s.name,s.input,e.output,n);break}case"result":process.stdout.write(`
256
256
  `),console.log(f(` (${e.inputTokens}\u2192${e.outputTokens} tokens`+(e.costUsd>0?`, $${e.costUsd<.01?e.costUsd.toFixed(4):e.costUsd.toFixed(2)}`:"")+")")),console.log(""),t.uuid&&(Xa(t.uuid),t.titleFired||rf(t,n));break;case"error":console.error(""),console.error($(`agent error: ${e.message}`)),o.kind==="subscription"&&e.kind==="auth"&&nf();break}}import{render as km}from"ink";import{resolveAuth as bm}from"document360-engine";import{useCallback as Y,useEffect as Pe,useMemo as gs,useRef as J,useState as H}from"react";import{Box as oe,Text as T,useApp as vf,useInput as Cf,useStdout as Pf}from"ink";import{existsSync as Ye,readFileSync as ws,readdirSync as xo}from"node:fs";import{spawnSync as Rf}from"node:child_process";import{basename as cn,isAbsolute as Tf,join as dt}from"node:path";import{createSession as Cl,classifyClaudeAuth as xs,CLAUDE_CODE_SETUP_HINT as Sf,loginPkce as Df,toStoredTokens as jf,saveTokens as Af,getAccessToken as Ef,resolveActiveProfile as ue,resolveProjectId as If,getArticle as Nf,decodeJwtClaims as Ot,isExpired as Le,loadTokens as Ve,clearTokens as _f,clearProfileProject as Mf,setTitle as Lf,slugify as Of,touchSession as ys,upsertSession as Uf,generateTitle as Pl,findByName as Wf,listSessions as Ff,renameSession as Hf,suggestNextAction as qf,readProjectConfig as ee,writeProjectConfig as Rl,resolveModelSetting as $s,loadProfileMap as bo,applyPull as Bf,computeSyncStatus as Tl,countLocalAhead as Gf,lintDocs as Sl,compareRemoteSources as Yf,planPull as Vf,establishBaselines as zf,rebaselineServerMeta as Xf,inventoryRepo as Kf,knownEnvironments as Jf,resolveEnvironment as Qf,planPartitions as ks,partitionEvenly as Zf,screenshotPlaceholderIds as em,trackedArticlePaths as tm,runPartitioned as wo,estimateBulkCost as Dl,resolveModelForOperation as yo,readDocsPlan as jl,checkForUpdate as nm,detectInstallKind as om,isSelfUpdatable as rm,devHintsGuidePath as vs,toolFeedbackPath as sm,reconcileToolFeedback as im,DEFAULT_DOCS_DIR as un,setProfileProject as am,writeCrashLog as lm}from"document360-engine";at();import{spawn as Qa}from"node:child_process";function af(){return process.platform==="win32"?[["clip",[]]]:process.platform==="darwin"?[["pbcopy",[]]]:[["wl-copy",[]],["xclip",["-selection","clipboard"]],["xsel",["--clipboard","--input"]]]}function lf(e,t,n){return new Promise(o=>{try{let r=process.platform==="win32"?Qa([e,...t].join(" "),{stdio:["pipe","ignore","ignore"],shell:!0}):Qa(e,t,{stdio:["pipe","ignore","ignore"]});r.on("error",()=>o(!1)),r.on("close",u=>o(u===0)),r.stdin?.on("error",()=>o(!1));let s=process.platform==="win32"?Buffer.from("\uFEFF"+n,"utf16le"):Buffer.from(n,"utf8");r.stdin?.end(s)}catch{o(!1)}})}async function Za(e){for(let[t,n]of af())if(await lf(t,n,e))return!0;return!1}var cf=/\breply with (the |a )?number\b|\bpick one\b|\bpress the number\b/i;function ds(e,t){if(t.closed)return e;let n=e.split(`
257
257
  `),o=!1;for(let r=0;r<n.length&&!t.closed;r++){let s=n[r];if(!t.cueSeen){cf.test(s)&&(t.cueSeen=!0);continue}let u=/^(\s{0,3})[-*•]\s+(.*)$/.exec(s);u?(n[r]=`${u[1]}${++t.num}. ${u[2]}`,o=!0):o&&s.trim()!==""&&/^\S/.test(s)&&(t.closed=!0)}return n.join(`
258
- `)}import{existsSync as uf,mkdirSync as df,readFileSync as pf,writeFileSync as ff}from"node:fs";import{join as el}from"node:path";import{writerDir as mf}from"document360-engine";function tl(e){return el(mf(e),".sessions")}function nl(e,t){return el(tl(e),`${t}.json`)}function ol(e,t,n){try{df(tl(e),{recursive:!0});let o=n.filter(r=>r.kind!=="banner");ff(nl(e,t),JSON.stringify({v:1,items:o}),"utf8")}catch{}}function ps(e,t){try{let n=nl(e,t);if(!uf(n))return[];let o=JSON.parse(pf(n,"utf8"));return Array.isArray(o.items)?o.items:[]}catch{return[]}}var hf=e=>`\x1B]0;${e}\x07`,gf=e=>`\x1B]9;4;${e};${e===1?100:0}\x07`;function rl(e){process.stdout.isTTY&&process.stdout.write(e)}function Lt(e){rl(hf(e))}function lo(e){rl(gf(e))}var co=["\xB7 "," \xB7"],uo="\u{1F7E3}";Kn();var po=[{name:"init",usage:"/init",desc:"Pick an environment, scaffold .d360-writer.json, and set up the builder hand-off (prints the one-paste prompt)",group:"start"},{name:"login",usage:"/login",desc:"Sign in to Document360 (browser)",group:"start"},{name:"project",usage:"/project [name]",desc:"Choose the Document360 project (picker; lists all you can access)",group:"start"},{name:"devhints",usage:"/devhints",desc:"Re-show/refresh the builder hand-off prompt (set up by /init; run anytime to hand your repo agent the latest)",group:"start"},{name:"scope",usage:"/scope",desc:"Choose which repo folders back the docs (monorepos)",group:"start"},{name:"mcp",usage:"/mcp [list|add|remove]",desc:"Connect MCP servers (Notion, Linear, \u2026)",group:"start"},{name:"draft",usage:"/draft [<feature>]",desc:"Draft a feature's articles from its PRDs/specs in .d360-writer/input/ + the code",group:"docs"},{name:"document",usage:"/document [<what>] [--publish]",desc:"Document a shipped change \u2014 the agent picks the action (new section/article/update); bare: act on builder requests",group:"docs"},{name:"write",usage:"/write [--preview|--scope <cat>|<path>] [--rewrite] [--concurrency N]",desc:"Write the planned articles in parallel (starts immediately; --preview shows plan + cost first; --rewrite regenerates already-written articles; --concurrency default 3)",group:"docs"},{name:"screenshot",usage:"/screenshot [--list|id|--all|path]",desc:"--list: status; else author capture specs (bulk also refreshes the capture checklist; --no-setup skips)",group:"docs"},{name:"capture-setup",usage:"/capture-setup",desc:"Re-run the data-staging checklist + dev test-id requests (auto-runs after /screenshot --all)",group:"docs"},{name:"preview",usage:"/preview [path|id]",desc:"Render an article (no arg: pick from tracked)",group:"docs"},{name:"publish",usage:"/publish [path|--all]",desc:"Publish to Document360 (no arg: pick; --all: every candidate)",group:"publish"},{name:"check",usage:"/check [--fix]",desc:"Check docs for leaked internals, invented commands, and stale facts (deterministic, no tokens). --fix has the agent correct the findings in place",group:"docs"},{name:"review",usage:"/review [<category|path>] [--fix]",desc:"Independent senior-editor review: style guide, terminology/voice, grammar/clarity, structure. Reports issues; --fix applies the corrections in place",group:"docs"},{name:"audit",usage:"/audit [--auto on|off]",desc:"Gap analysis: code vs docs vs Document360 (what changed); --auto runs it at launch when code changed",group:"publish"},{name:"inbox",usage:"/inbox",desc:"Act on messages from the repo's coding agent (requests to document, answers to your questions)",group:"publish"},{name:"catch-up",usage:"/catch-up [--publish]",desc:"Process ALL pending work (hints + requests + drift) \u2192 write \u2192 push to Document360 (bare = drafts; --publish goes live)",group:"publish"},{name:"pull",usage:"/pull [<path> | --status | --baseline]",desc:"Bring Document360 down: pull portal edits + import NEW portal articles. --status: drift report only \xB7 --baseline: set a sync base \xB7 <path>: one article / resolve a conflict",group:"publish"},{name:"convert",usage:"/convert [--scope <folder>] [--run]",desc:"Convert tracked articles to DFM (one-off legacy migration)",group:"publish"},{name:"profile",usage:"/profile [name|add <name> [env]]",desc:"Switch/create a Document360 connection (picker; s = session)",group:"setup"},{name:"workspace",usage:"/workspace [name]",desc:"Switch the Document360 workspace (picker)",group:"setup"},{name:"model",usage:"/model [name|default]",desc:"Set the Claude model for d360-writer",group:"setup"},{name:"logout",usage:"/logout",desc:"Sign out + clear project/workspace selection (then /login to re-pick)",group:"setup"},{name:"allow-prod",usage:"/allow-prod",desc:"Authorize writes to a production profile",group:"setup"},{name:"doctor",usage:"/doctor",desc:"Health-check: auth, profile, workspace, map, API",group:"setup"},{name:"update",usage:"/update",desc:"Update d360-writer to the latest version (then relaunch)",group:"setup"},{name:"reset",usage:"/reset",desc:"[DANGER] Delete all d360-writer files (docs, config, screenshots); types repo name to confirm",group:"setup"},{name:"resume",usage:"/resume [name]",desc:"Resume a session (no arg lists them)",group:"session"},{name:"rename",usage:"/rename [name]",desc:"Name the session (no arg: suggest one)",group:"session"},{name:"clear",usage:"/clear",desc:"Reset the conversation (resumable)",group:"session"},{name:"help",usage:"/help",desc:"Show this help",group:"session"},{name:"exit",usage:"/exit",desc:"Quit",group:"session"}],sl={"/catch-up":"write up everything your builder flagged","/audit":"check the code for anything new or missing in the docs","/pull":"pull edits + new articles from Document360","/publish":"publish your drafts to Document360","/write":"author the planned articles","/draft":"plan articles from PRDs + the code","/login":"sign in to Document360","/workspace":"choose the Document360 workspace","/project":"choose the Document360 project","/scope":"choose which folders back the docs","/init":"set up this repo","/screenshot":"generate screenshots","/doctor":"run a health check"};function il(e){let t=e.trim().replace(/^\//,"").split(/\s+/)[0]??"",n=`/${t}`;if(sl[n])return sl[n];let o=po.find(r=>r.name===t);return o?o.desc:""}function al(e){if(!e.startsWith("/"))return[];let t=e.slice(1).toLowerCase().split(/\s/)[0]??"";return po.filter(n=>n.name.startsWith(t))}function ll(e){return/<[^>]+>/.test(e.replace(/\[[^\]]*\]/g,""))}W();import{Box as cl,Text as ie}from"ink";import{jsx as le,jsxs as fo}from"react/jsx-runtime";function wf({row:e}){switch(e.t){case"head":return le(ie,{color:F,bold:!0,children:e.s});case"text":return le(ie,{children:e.s});case"dim":return le(ie,{dimColor:!0,children:e.s});case"sub":return le(ie,{bold:!0,dimColor:!0,children:e.s});case"good":return le(ie,{color:"green",children:e.s});case"step":return fo(ie,{children:[le(ie,{color:F,children:`${e.n}. `}),e.s]});case"cmd":return fo(ie,{children:[" ",le(ie,{color:F,children:e.name.padEnd(20)}),le(ie,{dimColor:!0,children:e.s})]});case"gap":return le(ie,{children:" "})}}function ul({tab:e,width:t}){let n=Ce[e]??Ce[0],o=6+Ce.reduce((s,u)=>s+u.label.length+4,0),r="\u2500".repeat(Math.min(o,Math.max(t-1,20)));return fo(cl,{flexDirection:"column",paddingX:1,children:[fo(ie,{children:[le(ie,{color:F,bold:!0,children:"Help "}),Ce.map((s,u)=>u===e?le(ie,{color:"white",backgroundColor:F,bold:!0,children:` ${s.label} `},s.key):le(ie,{dimColor:!0,children:` ${s.label} `},s.key))]}),le(ie,{color:F,children:r}),le(cl,{flexDirection:"column",marginTop:1,children:n.rows.map((s,u)=>le(wf,{row:s},u))}),le(ie,{dimColor:!0,children:`
258
+ `)}import{existsSync as uf,mkdirSync as df,readFileSync as pf,writeFileSync as ff}from"node:fs";import{join as el}from"node:path";import{writerDir as mf}from"document360-engine";function tl(e){return el(mf(e),".sessions")}function nl(e,t){return el(tl(e),`${t}.json`)}function ol(e,t,n){try{df(tl(e),{recursive:!0});let o=n.filter(r=>r.kind!=="banner");ff(nl(e,t),JSON.stringify({v:1,items:o}),"utf8")}catch{}}function ps(e,t){try{let n=nl(e,t);if(!uf(n))return[];let o=JSON.parse(pf(n,"utf8"));return Array.isArray(o.items)?o.items:[]}catch{return[]}}var hf=e=>`\x1B]0;${e}\x07`,gf=e=>`\x1B]9;4;${e};${e===1?100:0}\x07`;function rl(e){process.stdout.isTTY&&process.stdout.write(e)}function Lt(e){rl(hf(e))}function lo(e){rl(gf(e))}var co=["\xB7 "," \xB7"],uo="\u{1F7E3}";Kn();var po=[{name:"init",usage:"/init",desc:"Pick an environment, scaffold .d360-writer.json, and set up the builder hand-off (prints the one-paste prompt)",group:"start"},{name:"login",usage:"/login",desc:"Sign in to Document360 (browser)",group:"start"},{name:"project",usage:"/project [name]",desc:"Choose the Document360 project (picker; lists all you can access)",group:"start"},{name:"devhints",usage:"/devhints",desc:"Re-show/refresh the builder hand-off prompt (set up by /init; run anytime to hand your repo agent the latest)",group:"start"},{name:"scope",usage:"/scope",desc:"Choose which repo folders back the docs (monorepos)",group:"start"},{name:"mcp",usage:"/mcp [list|add|remove]",desc:"Connect MCP servers (Notion, Linear, \u2026)",group:"start"},{name:"draft",usage:"/draft [<feature>]",desc:"Draft a feature's articles from its PRDs/specs in .d360-writer/input/ + the code",group:"docs"},{name:"document",usage:"/document [<what>] [--publish]",desc:"Document a shipped change \u2014 the agent picks the action (new section/article/update); bare: act on builder requests",group:"docs"},{name:"write",usage:"/write [--preview|--scope <cat>|<path>] [--rewrite] [--concurrency N]",desc:"Write the planned articles in parallel (starts immediately; --preview shows plan + cost first; --rewrite regenerates already-written articles; --concurrency default 3)",group:"docs"},{name:"screenshot",usage:"/screenshot [--list|id|--all|path]",desc:"--list: status; else author capture specs (bulk also refreshes the capture checklist; --no-setup skips)",group:"docs"},{name:"capture-setup",usage:"/capture-setup",desc:"Re-run the data-staging checklist + dev test-id requests (auto-runs after /screenshot --all)",group:"docs"},{name:"preview",usage:"/preview [path|id]",desc:"Render an article (no arg: pick from tracked)",group:"docs"},{name:"publish",usage:"/publish [path|--all]",desc:"Publish to Document360 (no arg: pick; --all: every candidate)",group:"publish"},{name:"check",usage:"/check [--fix]",desc:"Check docs for leaked internals, invented commands, and stale facts (deterministic, no tokens). --fix has the agent correct the findings in place",group:"docs"},{name:"review",usage:"/review [<category|path>] [--fix]",desc:"Independent senior-editor review: style guide, terminology/voice, grammar/clarity, structure, improvement suggestions. Reports issues; --fix applies the corrections in place",group:"docs"},{name:"audit",usage:"/audit [--auto on|off]",desc:"Gap analysis: code vs docs vs Document360 (what changed); --auto runs it at launch when code changed",group:"publish"},{name:"inbox",usage:"/inbox",desc:"Act on messages from the repo's coding agent (requests to document, answers to your questions)",group:"publish"},{name:"catch-up",usage:"/catch-up [--publish]",desc:"Process ALL pending work (hints + requests + drift) \u2192 write \u2192 push to Document360 (bare = drafts; --publish goes live)",group:"publish"},{name:"pull",usage:"/pull [<path> | --status | --baseline]",desc:"Bring Document360 down: pull portal edits + import NEW portal articles. --status: drift report only \xB7 --baseline: set a sync base \xB7 <path>: one article / resolve a conflict",group:"publish"},{name:"convert",usage:"/convert [--scope <folder>] [--run]",desc:"Convert tracked articles to DFM (one-off legacy migration)",group:"publish"},{name:"profile",usage:"/profile [name|add <name> [env]]",desc:"Switch/create a Document360 connection (picker; s = session)",group:"setup"},{name:"workspace",usage:"/workspace [name]",desc:"Switch the Document360 workspace (picker)",group:"setup"},{name:"model",usage:"/model [name|default]",desc:"Set the Claude model for d360-writer",group:"setup"},{name:"logout",usage:"/logout",desc:"Sign out + clear project/workspace selection (then /login to re-pick)",group:"setup"},{name:"allow-prod",usage:"/allow-prod",desc:"Authorize writes to a production profile",group:"setup"},{name:"doctor",usage:"/doctor",desc:"Health-check: auth, profile, workspace, map, API",group:"setup"},{name:"update",usage:"/update",desc:"Update d360-writer to the latest version (then relaunch)",group:"setup"},{name:"reset",usage:"/reset",desc:"[DANGER] Delete all d360-writer files (docs, config, screenshots); types repo name to confirm",group:"setup"},{name:"resume",usage:"/resume [name]",desc:"Resume a session (no arg lists them)",group:"session"},{name:"rename",usage:"/rename [name]",desc:"Name the session (no arg: suggest one)",group:"session"},{name:"clear",usage:"/clear",desc:"Reset the conversation (resumable)",group:"session"},{name:"help",usage:"/help",desc:"Show this help",group:"session"},{name:"exit",usage:"/exit",desc:"Quit",group:"session"}],sl={"/catch-up":"write up everything your builder flagged","/audit":"check the code for anything new or missing in the docs","/pull":"pull edits + new articles from Document360","/publish":"publish your drafts to Document360","/write":"author the planned articles","/draft":"plan articles from PRDs + the code","/login":"sign in to Document360","/workspace":"choose the Document360 workspace","/project":"choose the Document360 project","/scope":"choose which folders back the docs","/init":"set up this repo","/screenshot":"generate screenshots","/doctor":"run a health check"};function il(e){let t=e.trim().replace(/^\//,"").split(/\s+/)[0]??"",n=`/${t}`;if(sl[n])return sl[n];let o=po.find(r=>r.name===t);return o?o.desc:""}function al(e){if(!e.startsWith("/"))return[];let t=e.slice(1).toLowerCase().split(/\s/)[0]??"";return po.filter(n=>n.name.startsWith(t))}function ll(e){return/<[^>]+>/.test(e.replace(/\[[^\]]*\]/g,""))}W();import{Box as cl,Text as ie}from"ink";import{jsx as le,jsxs as fo}from"react/jsx-runtime";function wf({row:e}){switch(e.t){case"head":return le(ie,{color:F,bold:!0,children:e.s});case"text":return le(ie,{children:e.s});case"dim":return le(ie,{dimColor:!0,children:e.s});case"sub":return le(ie,{bold:!0,dimColor:!0,children:e.s});case"good":return le(ie,{color:"green",children:e.s});case"step":return fo(ie,{children:[le(ie,{color:F,children:`${e.n}. `}),e.s]});case"cmd":return fo(ie,{children:[" ",le(ie,{color:F,children:e.name.padEnd(20)}),le(ie,{dimColor:!0,children:e.s})]});case"gap":return le(ie,{children:" "})}}function ul({tab:e,width:t}){let n=Ce[e]??Ce[0],o=6+Ce.reduce((s,u)=>s+u.label.length+4,0),r="\u2500".repeat(Math.min(o,Math.max(t-1,20)));return fo(cl,{flexDirection:"column",paddingX:1,children:[fo(ie,{children:[le(ie,{color:F,bold:!0,children:"Help "}),Ce.map((s,u)=>u===e?le(ie,{color:"white",backgroundColor:F,bold:!0,children:` ${s.label} `},s.key):le(ie,{dimColor:!0,children:` ${s.label} `},s.key))]}),le(ie,{color:F,children:r}),le(cl,{flexDirection:"column",marginTop:1,children:n.rows.map((s,u)=>le(wf,{row:s},u))}),le(ie,{dimColor:!0,children:`
259
259
  \u2190/\u2192 or tab switch \xB7 1-5 jump \xB7 esc close`})]})}var yf=/^(?:\d+[.)]|[-*•])\s+/;function dl(e,t,n=4){let o=new Set(t.map(s=>s.toLowerCase())),r=[];for(let s of e.split(`
260
260
  `)){let u=s.trim().replace(yf,""),p=u.match(/^`([^`]+)`$/);p&&(u=p[1].trim());let h=u.match(/^\/([a-z?][a-z0-9-]*)(?:\s+(\S.*?))?\s*$/i);if(!h||!o.has(h[1].toLowerCase()))continue;let y=`/${h[1].toLowerCase()}${h[2]?` ${h[2]}`:""}`;if(r.includes(y)||r.push(y),r.length>=n)break}return r}W();function ln(e){return e.map(t=>({label:t.label,items:t.paths.length,status:"pending"}))}function _e(e,t,n){return e.map(o=>o.label===t?{...o,status:n}:o)}function fs(e){return e.replace(/^[\w.-]+\//,"")}var mo=16,pl={pending:"\u25CB",active:"\u25A0",done:"\u2714",failed:"\u2717"};function ms(e){return e.trim().split(/\s+/).slice(1).join(" ")}function fl(e,t){let n=ms(t);return e.some(r=>r.trim()===t.trim()||!!n&&ms(r)===n)?e.filter(r=>r.trim()!==t.trim()&&!(n&&ms(r)===n)):[]}var kf='\u{1F4ED} No docs yet for this repo. Tell me "write the docs for this repo" and I\u2019ll read the code and draft a structure \u2014 or /audit to see what the docs should cover.';function bf(e,t){switch(e){case"/write":return"finish the planned articles that aren\u2019t written yet";case"/catch-up":return"write up everything your builder flagged";case"/audit":return t?"also scan the code for other changes":"check the code for anything new or missing in the docs";case"/pull":return"pull edits + new articles from Document360";case"/publish":return"push your local changes up to Document360";default:return""}}function Me(e){return e===1?"":"s"}function xf(e){switch(e){case"/write":return"it finishes the articles already planned";case"/catch-up":return"it clears everything your builder queued";case"/audit":return"it shows what the latest code changes touch";case"/pull":return"it reconciles anything changed on Document360";case"/publish":return"it pushes your local edits up to Document360";default:return"it\u2019s the most useful next step"}}function hs(e,t,n){let o=[];e.pendingWrites>0&&o.push(` \u2022 ${e.pendingWrites} planned article${Me(e.pendingWrites)} still unwritten`),e.localAhead>0&&o.push(` \u2022 ${e.localAhead} article${Me(e.localAhead)} changed locally \u2014 ready to publish`),e.pendingText&&o.push(` \u2022 your builder left ${e.pendingText}`),e.behind>0&&o.push(` \u2022 ${e.behind} code change${Me(e.behind)} since your last docs check`);let r=o.length>0?["Welcome back \u2014 where your docs stand:",...o,`I\u2019d start with ${t[0]} \u2014 ${xf(t[0])}.`]:[`Welcome back. Your ${e.tracked} tracked article${Me(e.tracked)} are all in sync.`];return r.push("",...t.map((s,u)=>` ${u+1} ${s.padEnd(9)} ${bf(s,n)}`),"Or just tell me what to write or update."),r.join(`
261
261
  `)}function ml(e){if(!e.ready)return{kind:"idle"};let t=!!e.pendingText;if(!e.hasDocs)return{kind:"noDocs",note:kf,ghost:"write the docs for this repo",title:t?`\u{1F4CB} Your builder left ${e.pendingText} for the docs:`:null,options:t?["/catch-up","/audit"]:["/audit"]};if(e.pendingWrites>0){let r=t?["/write","/catch-up"]:["/write","/audit"],s=`\u{1F4DD} ${e.pendingWrites} planned article${Me(e.pendingWrites)} not written yet \u2014 pick up where you left off:`;return{kind:"actions",note:hs(e,r,t),title:s,options:r}}if(e.localAhead>0){let r=t?["/publish","/catch-up"]:["/publish","/audit"],s=`\u{1F4E4} ${e.localAhead} article${Me(e.localAhead)} changed locally \u2014 ready to publish to Document360:`;return{kind:"actions",note:hs(e,r,t),title:s,options:r}}if(!t&&e.behind>0&&e.autoAudit&&e.allowAutoAudit)return{kind:"autoAudit",note:`\u{1F4CB} ${e.behind} code change${Me(e.behind)} since your last docs check \u2014 running /audit automatically (auto-audit is on)\u2026`};let n=t?["/catch-up","/audit"]:["/audit","/pull"],o=t?`\u{1F4CB} Your builder left ${e.pendingText} for the docs:`:e.behind>0?`\u{1F4CB} ${e.behind} code change${Me(e.behind)} since your last docs check \u2014 /audit to see what needs updating (or /audit --auto on to run it for you):`:`\u{1F4DA} ${e.tracked} article${Me(e.tracked)} tracked for "${e.profileName}". What next?`;return{kind:"actions",note:hs(e,n,t),title:o,options:n}}var $f=/\[Pasted text #\d+ \+\d+ lines?\]/g;function hl(e){return e.replace(/\r\n?/g,`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.5.44",
3
+ "version": "0.5.45",
4
4
  "description": "Standalone documentation agent CLI. Reads your code, writes your docs. Specialized for Document360 publishing.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "@inquirer/prompts": "^8.4.3",
35
35
  "commander": "^14.0.3",
36
36
  "diff": "^8.0.4",
37
- "document360-engine": "^0.2.81",
37
+ "document360-engine": "^0.2.82",
38
38
  "ink": "^5.2.1",
39
39
  "picocolors": "^1.1.1",
40
40
  "react": "^18.3.1",