document360-writer 0.5.66 → 0.5.67

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/dist/cli.js CHANGED
@@ -85,6 +85,15 @@ Prose: what you built and the gotchas a code diff would miss \u2014 e.g. "the bu
85
85
  - Leave \`status: open\`; the docs agent flips it to consumed.
86
86
  - Keep the body about user-facing intent, not implementation.
87
87
 
88
+ **Surface every hint \u2014 never silently.** When you drop a hint, say so in your reply: name the file and the
89
+ one-line surface (e.g. \`\u{1F4E8} Handed off to the docs agent: .d360-writer/hints/<file> \u2014 "<surface>"\`). The
90
+ human should be able to SEE the hand-off happened, not assume it.
91
+
92
+ **Stay in your lane \u2014 you hand off, you don't write the docs.** Your job ends at the hint + a current
93
+ architecture brief. Do NOT write, edit, or publish the user-facing articles yourself, even when you easily
94
+ could \u2014 that is the docs agent's job. (If you ghost-write the docs, the team loses the signal about what the
95
+ docs agent can and can't do.) Updating the architecture brief is yours; authoring the articles is not.
96
+
88
97
  That's it \u2014 drop the file and keep building. The docs agent picks it up on its next analysis run.
89
98
 
90
99
  ---
@@ -174,11 +183,11 @@ Anything only a human knows that would help document this product. For example:
174
183
 
175
184
  (Replace these examples with your notes, or leave the file as-is to skip \u2014 it's optional.)
176
185
  `}function It(e){Bn(Ri(e)),Bn(Di(e)),Bn(sr(e));for(let n of[Ri(e),sr(e)]){let o=gu(n,".gitkeep");Yn(o)||en(o,`# Keeps this document360-writer inbox tracked in git even when empty.
177
- `)}Yn(Ti(e))||en(Ti(e),ku()),en(Gn(e),Ai());let t=Oe(e);return Ni(e,new Date().toISOString()),t}async function Ei(e,t){for(let n of _t(It(t.cwd)))console.log(n);return{kind:"continue"}}function lt(){return[`This is document360-writer's dev hand-off setup (v${re}).`,'Connect this repository to document360-writer (its "docs agent" \u2014 a separate tool that writes this',"product's user documentation from your code, but needs your intent). This prompt is SAFE TO RUN MORE","THAN ONCE \u2014 paste it again whenever the product changes. At each step: create what is missing, reconcile","what already exists, and never duplicate, clobber a refined file, or delete human-written notes. In order:","","1. Read `.d360-writer/DEV-HINTS-GUIDE.md` \u2014 the full dev\u2192docs hand-off protocol (Parts 1\u20134). Follow it.","2. Architecture brief in `.d360-writer/architecture/` (per the guide). First read"," `.d360-writer/architecture/CREATOR-NOTES.md` and treat it as authoritative (it may be empty; never"," modify it). Then:"," \u2022 If no brief exists yet, write it now \u2014 a USER-DOC-enabling brief: product intent, user-facing"," surfaces, features and why a user reaches for each, roles/permission gating, core workflows,"," terminology \u2014 every claim citing the source file(s) that prove it. Skip internals (services, data"," access, infra, build/CI, tests)."," \u2022 If a brief already exists, UPDATE it to match the current code: add new surfaces/features, correct"," what changed, remove what was deleted \u2014 but preserve accurate existing content and any human edits."," Do NOT rewrite it from scratch. If nothing changed, leave it as is.","3. Persist the ongoing rule so teammates' agents inherit it: this repo's agent-memory file (CLAUDE.md,"," or AGENTS.md \u2014 whichever this repo already uses; create CLAUDE.md if neither exists) should contain a",' short "Documentation hand-off" section saying: on every user-facing change, drop a hint file in'," `.d360-writer/hints/` and keep `.d360-writer/architecture/` current; AND each session, check"," `.d360-writer/messages/` for open questions from the docs agent and answer them \u2014 all per"," `.d360-writer/DEV-HINTS-GUIDE.md`. If that section is already there, leave it (refine in place only if"," wrong) \u2014 do NOT add a duplicate. Then commit `.d360-writer/` and the memory-file change ONLY if"," something actually changed.","4. Two-way messages (Part 3): check `.d360-writer/messages/` for open questions addressed to you"," (`from: docs`, `status: open`). Answer each \u2014 fold durable facts into the architecture brief and/or drop"," a reply (`from: dev`, `kind: answer`, `re: <id>`) \u2014 then set the question's frontmatter `status: done`."," If there are none, continue.","5. Then STOP and ask me for tribal knowledge \u2014 present it as a clearly-marked, standalone prompt on its"," own line (NOT buried in prose) and WAIT for my reply before doing anything else. Use this shape:",' "\u23F8 YOUR INPUT NEEDED \u2014 Any tribal knowledge that would help document this product? (folder map,',` terminology, what to prioritize or skip, gotchas.) Type it below, or reply 'none' / 'carry on' to skip."`," If I give you anything, phrase it clearly and append it to `.d360-writer/architecture/CREATOR-NOTES.md`"," (keep the existing header comment and every note already there; only add). If I say 'none'/'carry on', continue.",`6. Record completion: write/merge \`.d360-writer/devhints-state.json\` with {"completedVersion": ${re},`,' "completedAt": "<UTC now>", "completedCommit": "<current HEAD short sha>"} (preserve any other keys'," already in the file, e.g. emittedAt). Include this file in the commit from step 3.","7. When everything is done, print the completion line, THEN the next command as its own copy-paste"," block so it is unmistakable. Pick the matching first line:",' \u2022 first-time setup: "\u2705 Setup complete. Now switch to the document360-writer terminal and paste this:"',' \u2022 a refresh (brief/notes already existed): "\u2705 Hand-off refreshed. Back in the document360-writer terminal, paste this:"'," Then, on its OWN line, fenced as a code block so it copies cleanly:"," ```"," write the docs for this repo"," ```"].join(`
186
+ `)}Yn(Ti(e))||en(Ti(e),ku()),en(Gn(e),Ai());let t=Oe(e);return Ni(e,new Date().toISOString()),t}async function Ei(e,t){for(let n of _t(It(t.cwd)))console.log(n);return{kind:"continue"}}function lt(){return[`This is document360-writer's dev hand-off setup (v${re}).`,'Connect this repository to document360-writer (its "docs agent" \u2014 a separate tool that writes this',"product's user documentation from your code, but needs your intent). This prompt is SAFE TO RUN MORE","THAN ONCE \u2014 paste it again whenever the product changes. At each step: create what is missing, reconcile","what already exists, and never duplicate, clobber a refined file, or delete human-written notes. In order:","","1. Read `.d360-writer/DEV-HINTS-GUIDE.md` \u2014 the full dev\u2192docs hand-off protocol (Parts 1\u20134). Follow it.","2. Architecture brief in `.d360-writer/architecture/` (per the guide). First read"," `.d360-writer/architecture/CREATOR-NOTES.md` and treat it as authoritative (it may be empty; never"," modify it). Then:"," \u2022 If no brief exists yet, write it now \u2014 a USER-DOC-enabling brief: product intent, user-facing"," surfaces, features and why a user reaches for each, roles/permission gating, core workflows,"," terminology \u2014 every claim citing the source file(s) that prove it. Skip internals (services, data"," access, infra, build/CI, tests)."," \u2022 If a brief already exists, UPDATE it to match the current code: add new surfaces/features, correct"," what changed, remove what was deleted \u2014 but preserve accurate existing content and any human edits."," Do NOT rewrite it from scratch. If nothing changed, leave it as is.","3. Persist the ongoing rule so teammates' agents inherit it: this repo's agent-memory file (CLAUDE.md,"," or AGENTS.md \u2014 whichever this repo already uses; create CLAUDE.md if neither exists) should contain a",' short "Documentation hand-off" section saying: on every user-facing change, drop a hint file in'," `.d360-writer/hints/` and keep `.d360-writer/architecture/` current \u2014 and SURFACE each hint drop in"," your reply (name the file + the one-line surface), never silently; NEVER write or publish the"," user-facing articles yourself (that is the docs agent's job \u2014 you only hand off); AND each session,"," check `.d360-writer/messages/` for open questions from the docs agent and answer them \u2014 all per"," `.d360-writer/DEV-HINTS-GUIDE.md`. If that section is already there, leave it (refine in place only if"," wrong) \u2014 do NOT add a duplicate. Then commit `.d360-writer/` and the memory-file change ONLY if"," something actually changed.","4. Two-way messages (Part 3): check `.d360-writer/messages/` for open questions addressed to you"," (`from: docs`, `status: open`). Answer each \u2014 fold durable facts into the architecture brief and/or drop"," a reply (`from: dev`, `kind: answer`, `re: <id>`) \u2014 then set the question's frontmatter `status: done`."," If there are none, continue.","5. Then STOP and ask me for tribal knowledge \u2014 present it as a clearly-marked, standalone prompt on its"," own line (NOT buried in prose) and WAIT for my reply before doing anything else. Use this shape:",' "\u23F8 YOUR INPUT NEEDED \u2014 Any tribal knowledge that would help document this product? (folder map,',` terminology, what to prioritize or skip, gotchas.) Type it below, or reply 'none' / 'carry on' to skip."`," If I give you anything, phrase it clearly and append it to `.d360-writer/architecture/CREATOR-NOTES.md`"," (keep the existing header comment and every note already there; only add). If I say 'none'/'carry on', continue.",`6. Record completion: write/merge \`.d360-writer/devhints-state.json\` with {"completedVersion": ${re},`,' "completedAt": "<UTC now>", "completedCommit": "<current HEAD short sha>"} (preserve any other keys'," already in the file, e.g. emittedAt). Include this file in the commit from step 3.","7. When everything is done, print the completion line, THEN the next command as its own copy-paste"," block so it is unmistakable. Pick the matching first line:",' \u2022 first-time setup: "\u2705 Setup complete. Now switch to the document360-writer terminal and paste this:"',' \u2022 a refresh (brief/notes already existed): "\u2705 Hand-off refreshed. Back in the document360-writer terminal, paste this:"'," Then, on its OWN line, fenced as a code block so it copies cleanly:"," ```"," write the docs for this repo"," ```"].join(`
178
187
  `)}function ir(e){try{let t=mu(ji(e),"utf8"),n=JSON.parse(t);return n&&typeof n=="object"?n:null}catch{return null}}function Ni(e,t){let o={...ir(e)??{},emittedVersion:re,emittedAt:t};en(ji(e),`${JSON.stringify(o,null,2)}
179
188
  `)}function tn(e){try{return hu(Di(e)).some(t=>/\.md$/i.test(t)&&t.toLowerCase()!=="creator-notes.md")}catch{return!1}}function Oe(e){let n=ir(e)?.completedVersion;return typeof n!="number"?{status:"unset"}:{status:n<re?"stale":"current",completedVersion:n}}function Vn(e,t=new Date().toISOString()){let n={guideRefreshed:!1,notifiedBuilder:!1,toVersion:re};try{if(!Yn(Gn(e)))return n;let o=ir(e),r=o?.emittedVersion??0;n.completedVersion=o?.completedVersion;let s=o?.completedVersion??0;re>r&&(Bn(sr(e)),en(Gn(e),Ai()),Ni(e,t),n.guideRefreshed=!0),re>s&&(yu(e).some(p=>p.kind==="request"&&p.subject.startsWith(Si))||(wu(e,{id:`onb${re}`,created:t,from:"docs",kind:"request",re:"",sources:[],subject:`${Si}${re})`,status:"open",body:[`The dev\u2194docs onboarding protocol moved to v${re}${s?` (you last completed v${s})`:""}.`,"Re-run the hand-off so the docs agent and this repo stay in step \u2014 run this prompt here:","",lt()].join(`
180
189
  `)}),n.notifiedBuilder=!0))}catch{}return n}function zn(e){if(!Yn(Gn(e)))return[];let t=Oe(e);return t.status==="current"?[]:[`\u{1F514} Your builder agent ${t.completedVersion?`is on v${t.completedVersion}`:"hasn't completed the hand-off yet"} \u2014 d360-writer's dev\u2194docs protocol is now v${re}.`,"Please run this prompt in your repository's coding agent (Claude Code / Codex / Cursor) for:",` ${e}`,Nt,lt(),Nt,"(Also saved in .d360-writer/messages/ \u2014 or run /devhints to re-show. This stops once your builder runs it.)"]}function ar(){return['document360-writer (its "docs agent") has been removed from this repository. Please undo its dev\u2192docs',"hand-off setup and restore this repo to how it was before \u2014 in order:","","1. In this repo's agent-memory file (CLAUDE.md, or AGENTS.md \u2014 whichever it edited), REMOVE the",' "Documentation hand-off" section that was added (the rule about dropping hint files in'," `.d360-writer/hints/`, keeping `.d360-writer/architecture/` current, and checking"," `.d360-writer/messages/`). Leave everything else in that file untouched.","2. The `.d360-writer/` folder is already deleted on disk. If it was committed, remove it from version"," control too \u2014 `git rm -r --cached .d360-writer` (if it still resolves) \u2014 and commit the deletions.","3. Do NOT recreate any of those files or follow the hand-off protocol anymore.","","That's it \u2014 this repo is back to its pre-docs-agent state."].join(`
181
- `)}function Xn(){return['\u{1F9F9} One leftover: your builder still has the "Documentation hand-off" rule in its CLAUDE.md / AGENTS.md'," (reset only clears d360-writer's own .d360-writer/ folder \u2014 never your repo's files)."," To restore it, paste this prompt into your repo's coding agent (Claude Code / Codex / Cursor):",Nt,ar(),Nt]}function _t(e){return[...e?.status==="stale"?[`\u26A0 Your builder last completed devhints v${e.completedVersion}; this hand-off is v${re}.`," Have them run the prompt below again \u2014 it now sets up two-way messages + on-demand docs.",""]:[],"\u2713 Wrote .d360-writer/DEV-HINTS-GUIDE.md + the .d360-writer/architecture/ (brief), .d360-writer/hints/, and .d360-writer/messages/ inboxes.","","\u{1F4CB} Copy this one prompt and run it in your repo's coding agent (Claude Code / Codex / Cursor):",Nt,lt(),Nt,"","That one run writes the architecture brief, adds the ongoing rule to your agent memory (CLAUDE.md / AGENTS.md)","and commits it so teammates inherit it, answers any open questions the writer left, and asks you for tribal","knowledge \u2014 no manual file edits. It also sets up the two-way channel: the writer can ask you questions","(`/inbox` on its side), and you can ask it to document a session on demand (Part 4 of the guide).","","When it finishes, come back to THIS terminal and run:"," write the docs for this repo"]}var Nt,re,Si,ct=In(()=>{"use strict";Nt="-".repeat(64),re=5;Si="Re-run dev\u2194docs onboarding (protocol v"});var qi={};ai(qi,{initCommand:()=>cr,scaffoldInit:()=>lr});import{input as nn,confirm as bu}from"@inquirer/prompts";import{basename as Ii,join as Kn}from"node:path";import{existsSync as Ot,readFileSync as xu,readdirSync as $u,writeFileSync as vu}from"node:fs";import{writeProjectConfig as _i,readProjectConfig as Cu,projectConfigPath as Oi,writerDir as Pu,DEFAULT_DOCS_DIR as Li,DEFAULT_CAPTURE_DIR as Mi,DEFAULT_OUTPUT_DIR as Ui}from"document360-engine";function lr(e,t="berlin"){let n=Oi(e);if(Ot(n))return{created:!1,path:n,profileName:""};let o={projectId:Fi(e)??Ii(e),docsDir:Li,captureDir:Mi,outputDir:Ui,profiles:{[t]:{connection:{environment:t},production:!1}},defaultProfile:t,authoritativeSourceFiles:Hi(e)};return _i(o,e),Wi(e),{created:!0,path:n,profileName:t}}function Wi(e){let t=Kn(Pu(e),".gitignore");Ot(t)||vu(t,["# Local/transient \u2014 the config files here ARE meant to be committed.",".sessions/","cache/",""].join(`
190
+ `)}function Xn(){return['\u{1F9F9} One leftover: your builder still has the "Documentation hand-off" rule in its CLAUDE.md / AGENTS.md'," (reset only clears d360-writer's own .d360-writer/ folder \u2014 never your repo's files)."," To restore it, paste this prompt into your repo's coding agent (Claude Code / Codex / Cursor):",Nt,ar(),Nt]}function _t(e){return[...e?.status==="stale"?[`\u26A0 Your builder last completed devhints v${e.completedVersion}; this hand-off is v${re}.`," Have them run the prompt below again \u2014 it now sets up two-way messages + on-demand docs.",""]:[],"\u2713 Wrote .d360-writer/DEV-HINTS-GUIDE.md + the .d360-writer/architecture/ (brief), .d360-writer/hints/, and .d360-writer/messages/ inboxes.","","\u{1F4CB} Copy this one prompt and run it in your repo's coding agent (Claude Code / Codex / Cursor):",Nt,lt(),Nt,"","That one run writes the architecture brief, adds the ongoing rule to your agent memory (CLAUDE.md / AGENTS.md)","and commits it so teammates inherit it, answers any open questions the writer left, and asks you for tribal","knowledge \u2014 no manual file edits. It also sets up the two-way channel: the writer can ask you questions","(`/inbox` on its side), and you can ask it to document a session on demand (Part 4 of the guide).","","When it finishes, come back to THIS terminal and run:"," write the docs for this repo"]}var Nt,re,Si,ct=In(()=>{"use strict";Nt="-".repeat(64),re=6;Si="Re-run dev\u2194docs onboarding (protocol v"});var qi={};ai(qi,{initCommand:()=>cr,scaffoldInit:()=>lr});import{input as nn,confirm as bu}from"@inquirer/prompts";import{basename as Ii,join as Kn}from"node:path";import{existsSync as Ot,readFileSync as xu,readdirSync as $u,writeFileSync as vu}from"node:fs";import{writeProjectConfig as _i,readProjectConfig as Cu,projectConfigPath as Oi,writerDir as Pu,DEFAULT_DOCS_DIR as Li,DEFAULT_CAPTURE_DIR as Mi,DEFAULT_OUTPUT_DIR as Ui}from"document360-engine";function lr(e,t="berlin"){let n=Oi(e);if(Ot(n))return{created:!1,path:n,profileName:""};let o={projectId:Fi(e)??Ii(e),docsDir:Li,captureDir:Mi,outputDir:Ui,profiles:{[t]:{connection:{environment:t},production:!1}},defaultProfile:t,authoritativeSourceFiles:Hi(e)};return _i(o,e),Wi(e),{created:!0,path:n,profileName:t}}function Wi(e){let t=Kn(Pu(e),".gitignore");Ot(t)||vu(t,["# Local/transient \u2014 the config files here ARE meant to be committed.",".sessions/","cache/",""].join(`
182
191
  `),"utf8")}async function cr(){let e=process.cwd(),t=Oi(e);if(Ot(t)&&!await bu({message:`${t} already exists. Overwrite?`,default:!1}))return console.log(f("init cancelled.")),{kind:"continue"};let n=Fi(e)??Ii(e),o=await nn({message:"Project ID (used to scope sessions, screenshots, etc.):",default:n}),r=await nn({message:"Capture directory (where document360-capture .spec.ts files live):",default:Mi}),s=await nn({message:"Screenshot output directory:",default:Ui}),l=await nn({message:"Default connection profile name:",default:"berlin"}),p=await nn({message:"Document360 environment for this profile (baked preset):",default:"berlin"}),h={projectId:o,docsDir:Li,captureDir:r,outputDir:s,profiles:{[l]:{connection:{environment:p},production:!1}},defaultProfile:l,authoritativeSourceFiles:Hi(e)},b=Cu(e);b?.terminologyGlossary&&(h.terminologyGlossary=b.terminologyGlossary),_i(h,e),Wi(e);let x=It(e);console.log(""),console.log(A(`\u2713 Wrote ${t}`)),console.log(""),console.log(`Next: ${_(`d360-writer login --profile ${l}`)} ${f("(sign in; project & workspace auto-selected)")}`),console.log("");for(let D of _t(x))console.log(D);return console.log(""),console.log(`${f("Then ask:")} ${_('"write the user docs for this repo"')}`),console.log(""),{kind:"continue"}}function Fi(e){let t=Kn(e,"package.json");if(!Ot(t))return null;try{return JSON.parse(xu(t,"utf8")).name??null}catch{return null}}function Hi(e){let t=[];for(let n of["README.md","ARCHITECTURE.md","CLAUDE.md"])Ot(Kn(e,n))&&t.push(n);for(let n of["src","api","docs"]){let o=Kn(e,n);Ot(o)&&!Ru(o)&&t.push(n)}return t}function Ru(e){try{return $u(e,{withFileTypes:!0}).filter(n=>n.isDirectory()&&!n.name.startsWith(".")).length>6}catch{return!1}}var Qn=In(()=>{"use strict";W();ct()});var Ua={};ai(Ua,{doctorCommand:()=>un,renderDoctorChecks:()=>Ma,runDoctorChecks:()=>La});import{existsSync as tp}from"node:fs";import{d360GetAll as np,getAccessToken as op,isExpired as es,loadProfileMap as rp,loadTokens as sp,packageSkillsDir as _a,projectConfigPath as ip,readProjectConfig as ap,DEFAULT_DOCS_DIR as lp,fetchManifestSummary as cp,resolveActiveProfile as up,classifyClaudeAuth as dp,CLAUDE_CODE_SETUP_HINT as Oa,resolveModelSetting as pp,probeModel as fp,D360AuthError as mp}from"document360-engine";async function La(e){let t=[],n=Number(process.versions.node.split(".")[0]);t.push(n>=20?{level:"ok",label:`Node ${process.versions.node}`}:{level:"fail",label:`Node ${process.versions.node} \u2014 20+ required`,fix:"Install Node 20 or later (nodejs.org)"});let o=dp();o.state==="ready"?t.push({level:"ok",label:`Claude auth: ${o.kind==="api"?"API key":"subscription (Claude Code login found)"}`}):o.state==="maybe"?t.push({level:"warn",label:"Claude: no Claude Code login found (may be in the macOS Keychain)",fix:`If a docs turn ends with no output, sign in to Claude Code. ${Oa}`}):t.push({level:"fail",label:"Claude: not signed in \u2014 the agent cannot run (no Claude Code credentials on this machine)",fix:Oa});let r=pp(e);if(t.push({level:"ok",label:`Model: ${r.model??"Claude Code default"} (${r.source})`}),o.state==="ready"){let k=await fp(e,r.model??void 0);k.ok?t.push({level:"ok",label:`Model reachable \u2014 replied in ${(k.latencyMs/1e3).toFixed(1)}s`}):k.timedOut?t.push({level:"fail",label:"Model unreachable \u2014 no response in 30s (a docs turn will hang, then end with 0 tokens / no output)",fix:`Usually a corporate proxy/firewall or org policy blocking the Claude model API. Check this machine's network access to the Claude endpoint; confirm with: claude -p "say hi"`}):t.push({level:"fail",label:`Model call failed \u2014 ${k.error??"no output"} (a docs turn will end with 0 tokens / no output)`,fix:'Check sign-in, the selected model (/model), and network access to the Claude endpoint; confirm with: claude -p "say hi"'})}let s=ap(e);if(!s)return t.push({level:"fail",label:`No ${ip(e)}`,fix:"Run: /init (or d360-writer init)"}),t;t.push({level:"ok",label:`Project config: ${s.projectId}`});let l=(s.docsDir??lp).replace(/\/+$/,"");t.push(s.mode==="engineer"?{level:"warn",label:"Mode: engineer \u2014 agent may modify any source file (dogfooding)",fix:'Remove "mode" from .d360-writer/config.json for the writer-mode boundary'}:{level:"ok",label:`Mode: writer \u2014 edits limited to ${l}/ and .d360-writer/ (docs, capture specs, config); product source is read-only`});let p=s.authoritativeSourceFiles??[];t.push(p.length>0?{level:"ok",label:`Sources: docs grounded in ${p.length} path(s) (${p.slice(0,3).join(", ")}${p.length>3?", \u2026":""})`}:{level:"warn",label:"Sources: not set \u2014 docs are grounded in the whole repo",fix:"Run: /scope to choose which files/folders the docs are written from"});let h;try{h=up(e),t.push({level:"ok",label:`Profile: ${h.name} (${h.connection.name})${h.production?" \u26A0 PRODUCTION":""}`})}catch(k){return t.push({level:"fail",label:`Profile config: ${k.message.split(".")[0]}`,fix:"Run: /init to scaffold the profiles map"}),t}let b=sp(h.name);b?es(b)&&!b.refreshToken?t.push({level:"fail",label:"Document360: session expired (no refresh token)",fix:"/login"}):es(b)?t.push({level:"warn",label:"Document360: token expired \u2014 will auto-refresh on next call"}):t.push({level:"ok",label:`Document360: logged in (until ${new Date(b.expiresAt).toLocaleString()})`}):t.push({level:"fail",label:"Document360: not logged in",fix:`Run: /login (or d360-writer login --profile ${h.name})`}),t.push(h.project.workspaceId?{level:"ok",label:`Workspace: ${h.project.workspaceName??h.project.workspaceId}`}:{level:"warn",label:"No workspace selected",fix:"Run: /workspace"});let x=rp(e,h.name);x?x.projectId&&h.project.projectId&&x.projectId!==h.project.projectId?t.push({level:"fail",label:`Category map projectId (${x.projectId}) \u2260 profile projectId (${h.project.projectId})`,fix:"The map section belongs to a different project \u2014 fix .d360-writer/config.json or the map before publishing"}):t.push({level:"ok",label:`Category map: ${Object.keys(x.articles).length} articles, ${Object.keys(x.categories).length} categories`}):t.push({level:"ok",label:`Category map: none yet for "${h.name}" (created on first /publish)`}),t.push(tp(_a())?{level:"ok",label:"Skills bundle present"}:{level:"fail",label:`Skills folder missing at ${_a()}`,fix:"Reinstall document360-writer (broken install)"});let D=Oe(e);if(D.status==="current"?t.push({level:"ok",label:`Dev hand-off: builder up to date (devhints v${re})`}):D.status==="stale"&&t.push({level:"warn",label:`Dev hand-off: builder on devhints v${D.completedVersion}, current is v${re}`,fix:"Run /devhints and have the repo's coding agent re-run the prompt (adds two-way messages + on-demand docs)"}),b&&(!es(b)||b.refreshToken)){let k={profile:h.name,connection:h.connection};try{await op(k);let C=await np(k,"/v3/projects");t.push({level:"ok",label:`API reachable (${h.connection.apiUrl}) \u2014 ${C.length} project(s) visible`})}catch(C){t.push({level:"fail",label:`API call failed: ${C.message.slice(0,120)}`,fix:"/login if auth-related; otherwise check the apiUrl/network"})}let T=x?.projectId??h.project.projectId;if(T&&h.project.workspaceId)try{let C=await cp(k,T,h.project.workspaceId);if(C){let N=(C.workspace_hash??"").replace(/^sha256:/,"").slice(0,12);t.push({level:"ok",label:`Workspace sync manifest: available on ${h.connection.name} (${C.languages?.length??0} language${(C.languages?.length??0)===1?"":"s"}) \xB7 hash ${N||"(none)"}`})}else t.push({level:"warn",label:`Workspace sync manifest: not live on ${h.connection.name} yet`,fix:"No action needed \u2014 sync uses the per-article path until the manifest ships on this environment"})}catch(C){C instanceof mp||/scoped to a (?:specific|different) project|cannot access the requested project/i.test(C.message)?t.push({level:"fail",label:`Project scope: your Document360 session is signed into a different project than this repo expects (${h.project.projectName??T})`,fix:"Run /login and pick this repo's project \u2014 your token is scoped to another project"}):t.push({level:"warn",label:`Workspace sync manifest: probe failed (${C.message.slice(0,80)})`})}}return t}function Ma(e){let t=[""];for(let r of e){let s=r.level==="ok"?A("\u2713"):r.level==="warn"?O("\u26A0"):$("\u2717");t.push(` ${s} ${r.label}${r.detail?f(` \u2014 ${r.detail}`):""}`),r.fix&&t.push(` ${f("fix:")} ${_(r.fix)}`)}let n=e.filter(r=>r.level==="fail").length,o=e.filter(r=>r.level==="warn").length;return t.push(""),t.push(n===0?A(`\u2713 ${o===0?"All checks passed":`Healthy (${o} warning${o===1?"":"s"})`}`):$(`\u2717 ${n} problem${n===1?"":"s"} found`)),t.push(""),t}async function un(e,t){console.log(f("Running checks\u2026"));for(let n of Ma(await La(t.cwd)))console.log(n);return{kind:"continue"}}var ao=In(()=>{"use strict";ct();W()});import{Command as oh}from"commander";import{createRequire as rh}from"node:module";import{AUTH_MODES as sh}from"document360-engine";import{input as Bc}from"@inquirer/prompts";import{loginPkce as Yc,refreshTokens as Gc,toStoredTokens as mi,clearTokens as Vc,decodeJwtClaims as fi,isExpired as zc,loadTokens as Xc,saveTokens as hi,resolveActiveProfile as Mn,setProfileProject as Kc,readProjectConfig as Qc}from"document360-engine";W();import{select as Ac}from"@inquirer/prompts";import{resolveActiveProfile as Ec,setProfileProject as Nc,resolveProjectId as Ic,listWorkspaces as _c}from"document360-engine";async function Jt(e,t){let n=Ec(e,t),o={profile:n.name,connection:n.connection},r=n.project.projectId??Ic(o);return{workspaces:await _c(o,r),projectId:r,projectName:n.project.projectName,profile:n.name,environment:n.connection.name,current:n.project.workspaceId}}var ci=e=>`${e.name??e.id}${e.workspace_type?` \xB7 ${e.workspace_type}`:""}`;function er(e,t){let n=t.toLowerCase();return e.find(o=>(o.name??"").toLowerCase()===n)??e.find(o=>(o.name??"").toLowerCase().startsWith(n))??e.find(o=>o.id.startsWith(t))}function _n(e,t,n,o,r){Nc(e,t,{projectId:n,workspaceId:o,workspaceName:r})}async function ui(e,t,n){let o;try{o=await Jt(e,n)}catch(s){return console.log($(`Could not list workspaces: ${s.message}`)),1}let r=er(o.workspaces,t);return r?(_n(e,o.profile,o.projectId,r.id,r.name),console.log(A(`\u2713 Workspace set to "${r.name??r.id}" for profile "${o.profile}".`)),0):(console.log($(`No workspace matches "${t}". Available: ${o.workspaces.map(s=>s.name??s.id).join(", ")}`)),1)}async function Et(e,t){let n;try{n=await Jt(e,t)}catch(b){console.log($(`Could not list workspaces: ${b.message}`));return}let{workspaces:o,projectId:r,profile:s,current:l}=n;if(o.length===0){console.log(f("No workspaces found in this project."));return}if(!process.stdin.isTTY){console.log("");for(let b of o)console.log(` ${b.id===l?_("\u25CF"):" "} ${ci(b)} ${f(b.id)}`);console.log(f("Run: d360-writer workspace use <name>"));return}let p=await Ac({message:"Select the Document360 workspace for this repo:",choices:o.map(b=>({name:`${ci(b)}${b.id===l?" (current)":""}`,value:b.id}))}),h=o.find(b=>b.id===p);_n(e,s,r,p,h?.name),console.log(A(`\u2713 Workspace set to "${h?.name??p}" for profile "${s}".`))}W();import{select as Oc}from"@inquirer/prompts";import{resolveActiveProfile as Lc,setProfileProject as Mc,listProjects as Uc}from"document360-engine";async function Ye(e,t){let n=Lc(e,t),o={profile:n.name,connection:n.connection};return{projects:await Uc(o),profile:n.name,environment:n.connection.name,current:n.project.projectId}}var di=e=>`${e.name??e.id}${e.sub_domain?` \xB7 ${e.sub_domain}`:""}`;function tr(e,t){let n=t.toLowerCase();return e.find(o=>(o.name??"").toLowerCase()===n)??e.find(o=>(o.name??"").toLowerCase().startsWith(n))??e.find(o=>o.id.startsWith(t))}function On(e,t,n,o){Mc(e,t,{projectId:n,projectName:o,workspaceId:void 0,workspaceName:void 0})}async function pi(e,t,n){let o;try{o=await Ye(e,n)}catch(s){return console.log($(`Could not list projects: ${s.message}`)),1}let r=tr(o.projects,t);return r?(On(e,o.profile,r.id,r.name),console.log(A(`\u2713 Project set to "${r.name??r.id}" for profile "${o.profile}". Next: pick a workspace (d360-writer workspace).`)),0):(console.log($(`No project matches "${t}". Available: ${o.projects.map(s=>s.name??s.id).join(", ")}`)),1)}async function Ln(e,t){let n;try{n=await Ye(e,t)}catch(h){console.log($(`Could not list projects: ${h.message}`));return}let{projects:o,profile:r,current:s}=n;if(o.length===0){console.log(f("No projects found for this identity."));return}if(!process.stdin.isTTY){console.log("");for(let h of o)console.log(` ${h.id===s?_("\u25CF"):" "} ${di(h)} ${f(h.id)}`);console.log(f("Run: d360-writer project use <name>"));return}let l=await Oc({message:"Select the Document360 project for this repo:",choices:o.map(h=>({name:`${di(h)}${h.id===s?" (current)":""}`,value:h.id}))}),p=o.find(h=>h.id===l);On(e,r,l,p?.name),console.log(A(`\u2713 Project set to "${p?.name??l}" for profile "${r}". Next: pick a workspace.`))}W();import Wc from"picocolors";function Fc(e=process.env){return e.FORCE_HYPERLINK==="0"||!Wc.isColorSupported?!1:e.FORCE_HYPERLINK?!0:!!(e.WT_SESSION||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="WezTerm"||e.TERM_PROGRAM==="ghostty"||e.VTE_VERSION||e.KONSOLE_VERSION)}function Hc(e,t=e,n){return Fc(n)?`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`:t}var qc=/https?:\/\/[^\s\x1b]+/g;function Zt(e,t){return e.replace(qc,n=>Hc(n,n,t))}function gi(e){return{...fi(e.idToken)??{},...fi(e.accessToken)??{}}}function Un(e){let t=gi(e),n=t.email??t.preferred_username??t.sub??"unknown",o=t.doc360_project_id?` \xB7 project ${t.doc360_project_id}`:"";return`${n}${o}`}async function Wn(e){let t=Mn(process.cwd(),e.profile),n=t.connection;console.log(f(`Profile "${t.name}" \u2192 ${n.name} (${n.apiUrl})${t.production?" \u26A0 PRODUCTION":""}`));let o=await Yc(n,{manual:e.manual,promptForRedirect:s=>Bc({message:s})},s=>console.log(Zt(s))),r=mi(t.name,o);if(hi(r),await nr(r,t.name,s=>console.log(f(s))),console.log(""),console.log(A(`\u2713 Logged in to "${t.name}" as ${Un(r)}`)),console.log(f(` access token expires: ${r.expiresAt}`)),console.log(f(` refresh token: ${r.refreshToken?"yes":"NO \u2014 session ends at expiry"}`)),process.stdin.isTTY)try{Qc(process.cwd())?.profiles?.[t.name]&&(console.log(""),await Et(process.cwd(),t.name))}catch{}}async function nr(e,t,n){let r=gi(e).doc360_project_id;if(!(typeof r!="string"||!r))try{if(Mn(process.cwd(),t).project.projectId)return;let l;try{let{projects:p}=await Ye(process.cwd(),t);l=p.find(h=>h.id===r)?.name}catch{}Kc(process.cwd(),t,{projectId:r,projectName:l}),n(` Project "${l??r}" written to profile "${t}".`)}catch{}}async function wi(e){let t=Mn(process.cwd(),e.profile),n=t.connection,o=Xc(t.name);if(!o){console.log($(`Not logged in to Document360 (profile "${t.name}").`)),console.log(f(`Run: d360-writer login --profile ${t.name}`)),process.exitCode=1;return}if(console.log(`Profile ${_(t.name)}${t.production?" \u26A0 PRODUCTION":""}: ${Un(o)}`),zc(o))if(o.refreshToken)try{let r=mi(t.name,await Gc(n,o.refreshToken));hi(r),console.log(A(`\u2713 Session refreshed \u2014 expires ${r.expiresAt}`))}catch(r){console.log(O(`Session expired and refresh failed (${r.message.slice(0,120)})`)),console.log(f(`Run: d360-writer login --profile ${t.name}`)),process.exitCode=1}else console.log(O("Session expired (no refresh token).")),console.log(f(`Run: d360-writer login --profile ${t.name}`)),process.exitCode=1;else console.log(f(` expires: ${o.expiresAt}`))}async function yi(e){let t=Mn(process.cwd(),e.profile);Vc(t.name)?console.log(A(`\u2713 Logged out of Document360 (profile "${t.name}").`)):console.log(f(`No Document360 session for profile "${t.name}" \u2014 nothing to do.`))}W();import{readProjectConfig as ki,writeProjectConfig as Jc,resolveActiveProfile as Zc,loadTokens as eu,isExpired as tu}from"document360-engine";function Fn(e){let t=ki(e);if(!t?.profiles||Object.keys(t.profiles).length===0){console.log($("No profiles in .d360-writer/config.json. Run: d360-writer init")),process.exitCode=1;return}console.log("");for(let[n,o]of Object.entries(t.profiles)){let r=n===t.defaultProfile?_("\u25CF "):" ",s=o.production?O(" \u26A0 PRODUCTION"):"",l=o.connection.environment??"(inline)",p=eu(n),h=p?tu(p)&&!p.refreshToken?O("expired"):f("logged in"):f("not logged in");console.log(`${r}${_(n)} \u2192 ${l}${s} [${h}]`)}console.log(""),console.log(f("\u25CF = default. Switch with: d360-writer profile use <name>")),console.log("")}function Hn(e,t){let n=ki(e);if(!n?.profiles?.[t]){let r=n?.profiles?Object.keys(n.profiles).join(", "):"(none \u2014 run init)";console.log($(`Unknown profile "${t}". Available: ${r}`)),process.exitCode=1;return}n.defaultProfile=t,Jc(n,e);let o=n.profiles[t].production?O(" \u26A0 PRODUCTION"):"";console.log(A(`\u2713 Default profile is now "${t}"${o}`))}function qn(e,t){try{let n=Zc(e,t);console.log(""),console.log(`Profile ${_(n.name)}${n.production?O(" \u26A0 PRODUCTION"):""}`),console.log(f(` api: ${n.connection.apiUrl}`)),console.log(f(` identity: ${n.connection.authorizationUrl}`)),console.log(f(` clientId: ${n.connection.clientId}`)),console.log(f(` scopes: ${n.connection.scopes.join(" ")}`)),console.log(f(` project: ${n.project.projectId??"(set at login)"}`)),console.log(f(` workspace:${n.project.workspaceId?" "+n.project.workspaceId:" (none)"}`)),console.log("")}catch(n){console.log($(n.message)),process.exitCode=1}}W();import{existsSync as nu,readdirSync as ou,statSync as bi}from"node:fs";import{join as xi}from"node:path";import{apiLogDir as ru}from"document360-engine";function $i(){let e=ru();if(console.log(""),console.log(`Document360 API logs: ${_(e)}`),!nu(e)){console.log(f(" No logs yet \u2014 they appear after the first Document360 API call.")),console.log("");return}let t=ou(e),n=t.filter(r=>r.endsWith(".jsonl")).sort().reverse(),o=t.filter(r=>/^crash-\d{4}-\d{2}-\d{2}\.log$/.test(r)).sort().reverse();n.length===0&&o.length===0&&console.log(f(" No logs yet \u2014 they appear after the first Document360 API call."));for(let r of n.slice(0,14)){let s=(bi(xi(e,r)).size/1024).toFixed(1);console.log(` ${r} ${f(`${s} KB`)}`)}if(o.length>0){console.log(""),console.log(`Crash logs ${f("(send these if d360-writer crashed or a run died)")}:`);for(let r of o.slice(0,14)){let s=(bi(xi(e,r)).size/1024).toFixed(1);console.log(` ${$(r)} ${f(`${s} KB`)}`)}}console.log(""),console.log(f("Failed calls include request/response bodies (tokens redacted, 4 KB cap).")),console.log(f("Set D360_LOG_BODIES=1 to also log bodies for successful calls.")),console.log("")}W();import{createSession as su,resolveAuth as iu,findByName as au,slugify as lu,touchSession as cu,upsertSession as uu,resolveActiveProfile as du}from"document360-engine";async function vi(e,t,n,o,r,s){let l=iu(n);l.kind==="none"&&(console.error(""),console.error($("ANTHROPIC_API_KEY is not set (required for --auth api).")),console.error(`Get a key at ${_("https://console.anthropic.com/settings/keys")}`),console.error(`Or use your Claude subscription instead: ${_("d360-writer --auth subscription")}`),process.exit(2)),l.kind==="subscription"&&console.error(f("Using your Claude subscription (no API key set)."));let p=null;try{p=du(e,r)}catch(k){console.error($(`Document360 profile error: ${k.message}`)),process.exit(2)}p.production&&(console.error(O(`\u26A0 Profile "${p.name}" is PRODUCTION.`)),s||(console.error($("Refusing to run against a production profile without --yes.")),process.exit(2)),console.error(f(" --yes given \u2014 proceeding against production.")));let h;if(o){let k=au(e,o);k||(console.error($(`No saved session matches "${o}" in this repo.`)),console.error(f("List sessions inside the REPL with /resume.")),process.exit(2)),h=k.uuid,console.error(f(`Resuming "${k.name}"`))}let b=su({cwd:e,resume:h,profileName:r,allowProdWrites:s===!0}),x=h??null,D=1;for await(let k of b.send(t))switch(k.type){case"session":if(!x){x=k.sessionId;let T=new Date().toISOString();uu({uuid:x,name:lu(t),renamed:!1,titled:!1,cwd:e,firstPrompt:t,createdAt:T,updatedAt:T})}break;case"text":process.stdout.write(k.delta);break;case"tool":console.error(ie(` \u2699 ${k.name}`));break;case"result":D=k.ok?0:1,console.error(f(`(${k.inputTokens}\u2192${k.outputTokens} tokens`+(k.costUsd>0?`, $${k.costUsd<.01?k.costUsd.toFixed(4):k.costUsd.toFixed(2)}`:"")+")")),k.ok||console.error($("agent finished with an error result"));break;case"error":console.error(""),console.error($(`agent error: ${k.message}`)),process.exit(1)}x&&cu(x),process.stdout.write(`
183
192
  `),process.exit(D)}import{createInterface as bf}from"node:readline/promises";import{createSession as $s,resolveAuth as xf,getSession as $f,setTitle as vf,slugify as Cf,touchSession as gl,upsertSession as Pf,generateTitle as Rf,resolveActiveProfile as wl,resolveModelSetting as Tf,readProjectConfig as Sf,decodeJwtClaims as ml,isExpired as Df,loadTokens as jf}from"document360-engine";var Te=[{key:"start",label:"Getting Started",rows:[{t:"text",s:"D360-Writer reads your codebase, generates end-user documentation, and publishes it to Document360."},{t:"text",s:"It needs Claude access \u2014 a Claude subscription (default) or an ANTHROPIC_API_KEY."},{t:"gap"},{t:"sub",s:"Quick start"},{t:"step",n:1,s:"Run /init \u2014 pick your environment, sign in, choose your project & workspace. It ends by printing a one-paste hand-off prompt."},{t:"step",n:2,s:"Paste that prompt into your repo's coding agent (Claude Code / Codex / Cursor). Let it finish, then follow its closing line. (Re-show it: /devhints)"},{t:"step",n:3,s:"Run /doctor to confirm every check is green."},{t:"step",n:4,s:'Type "write the docs for this repository" and follow the prompts.'},{t:"gap"},{t:"dim",s:"That's it \u2014 D360-Writer drafts your docs without you writing a line."},{t:"gap"},{t:"sub",s:"Tips"},{t:"text",s:"Just talk to it \u2014 anything not starting with / goes to the agent."},{t:"dim",s:"/ browses commands \xB7 \u2191 recalls history \xB7 esc interrupts a run \xB7 ctrl+c exits"}]},{key:"agentic",label:"Agentic",rows:[{t:"text",s:"Agentic Mode is designed for applications built using AI coding agents. D360-Writer works alongside your coding agent to continuously create and maintain your user documentation. Think of it as hiring a Technical Writer dedicated to your project."},{t:"gap"},{t:"text",s:"As your coding agent ships new features, it leaves documentation notes for D360-Writer. All you need to do is run the documentation loop."},{t:"gap"},{t:"sub",s:"Every few days"},{t:"cmd",name:"/catch-up --publish",s:"Analyze the latest code changes, read the notes left by your coding agent, update the documentation, and publish the changes."},{t:"dim",s:" (or run /catch-up to review drafts first, then /publish when you're ready)"},{t:"gap"},{t:"sub",s:"Whenever you need"},{t:"cmd",name:"/audit",s:"Preview what has changed and identify missing documentation, without writing or publishing anything."},{t:"cmd",name:"/pull",s:"Bring Document360 down \u2014 pull edits made in the portal and import any new portal articles."},{t:"cmd",name:"/inbox",s:"Review and act on messages left by your coding agent."}]},{key:"assistant",label:"Assistant",rows:[{t:"text",s:"D360-Writer is your writing assistant \u2014 it does the writing, you decide what gets written and when."},{t:"text",s:"Best for large or complex monorepos: focus it on one feature, component, or set of source folders."},{t:"gap"},{t:"sub",s:"Just ask"},{t:"good",s:'"Write the documentation for the Multiple JWT feature we shipped in the latest release."'},{t:"gap"},{t:"sub",s:"Or use the pipeline"},{t:"cmd",name:"/scope",s:"Focus D360-Writer on specific source folders (monorepos)."},{t:"cmd",name:"/draft <feature>",s:"Plan a feature's articles from its PRDs in .d360-writer/input/ + the code."},{t:"cmd",name:"/write",s:"Write the planned articles (--preview shows the plan + cost first)."},{t:"cmd",name:"/publish",s:"Publish the articles to Document360."}]},{key:"shots",label:"Screenshots",rows:[{t:"text",s:"Documenting a web app? D360-Writer marks where an image helps with a <!-- SCREENSHOT --> placeholder."},{t:"text",s:"The companion CLI d360-capture turns those into real, annotated screenshots by driving your app in a browser."},{t:"gap"},{t:"sub",s:"Flow"},{t:"step",n:1,s:"Write your docs as usual \u2014 placeholders are added where visuals help."},{t:"step",n:2,s:"Run /screenshot --all to author capture specs and refresh the capture checklist (data + test-ids the shots need)."},{t:"step",n:3,s:"Stage what the checklist asks for, then run d360-capture in your app's repo \u2014 it signs in, navigates, captures, annotates."},{t:"step",n:4,s:"Re-run /publish so the images go live on Document360."},{t:"gap"},{t:"sub",s:"Helpers"},{t:"cmd",name:"/screenshot --list",s:"See capture status \u2014 which specs exist and which are done."},{t:"cmd",name:"/capture-setup",s:"Re-show the data-staging + test-id checklist (auto-runs after /screenshot --all)."},{t:"gap"},{t:"dim",s:"d360-capture is a separate Playwright CLI \u2014 run it in the app's repo (needs its URL + a login)."}]},{key:"cmds",label:"Commands",rows:[{t:"dim",s:"Grouped by job. Type any command, or just talk to the agent."},{t:"gap"},{t:"sub",s:"Getting started"},{t:"cmd",name:"/init",s:"Set up Document360 (environment, sign-in, project, hand-off prompt)."},{t:"cmd",name:"/login",s:"Sign in to Document360."},{t:"cmd",name:"/project",s:"Choose the Document360 project."},{t:"cmd",name:"/workspace",s:"Switch the workspace."},{t:"cmd",name:"/scope",s:"Choose which repo folders back the docs (monorepos)."},{t:"cmd",name:"/devhints",s:"Re-show the builder hand-off prompt."},{t:"gap"},{t:"sub",s:"Agentic \u2014 keep docs in sync"},{t:"cmd",name:"/catch-up",s:"Do all pending work \u2192 drafts (--publish goes live)."},{t:"cmd",name:"/publish",s:"Publish to Document360 (--all or a path)."},{t:"cmd",name:"/audit",s:"Preview what changed / what's missing."},{t:"cmd",name:"/pull",s:"Pull portal edits + new articles (--status: report only)."},{t:"cmd",name:"/inbox",s:"Act on your coding agent's messages."},{t:"gap"},{t:"sub",s:"Assistant \u2014 directed writing"},{t:"cmd",name:"/draft <feature>",s:"Plan a feature's articles from PRDs + code."},{t:"cmd",name:"/write",s:"Write the planned articles (--preview first)."},{t:"cmd",name:"/preview",s:"Render an article locally."},{t:"gap"},{t:"sub",s:"Screenshots"},{t:"cmd",name:"/screenshot",s:"Author capture specs (--all / --list)."},{t:"gap"},{t:"sub",s:"Setup & health"},{t:"cmd",name:"/model",s:"Set the Claude model."},{t:"cmd",name:"/profile",s:"Switch/create a Document360 connection."},{t:"cmd",name:"/mcp",s:"Connect MCP servers (Notion, Linear, \u2026)."},{t:"cmd",name:"/allow-prod",s:"Authorize writes to a production profile."},{t:"cmd",name:"/doctor",s:"Health check: auth, profile, workspace, API."},{t:"cmd",name:"/update",s:"Update D360-Writer."},{t:"cmd",name:"/reset",s:"Delete all D360-Writer files (confirms first)."},{t:"gap"},{t:"sub",s:"Session"},{t:"cmd",name:"/resume",s:"Resume a saved session."},{t:"cmd",name:"/rename",s:"Name the session."},{t:"cmd",name:"/clear",s:"Reset the conversation (resumable)."},{t:"cmd",name:"/help",s:"Show this help."},{t:"cmd",name:"/exit",s:"Quit."}]}];function pu(e){switch(e.t){case"head":return e.s;case"text":return` ${e.s}`;case"dim":return` ${e.s}`;case"sub":return e.s;case"good":return` ${e.s}`;case"step":return` ${e.n}. ${e.s}`;case"cmd":return` ${e.name.padEnd(20)} ${e.s}`;case"gap":return""}}function Ci(){let e=["document360-writer \u2014 help",""];for(let t of Te){e.push(`\u2500\u2500 ${t.label} \u2500\u2500`,"");for(let n of t.rows)e.push(pu(n));e.push("")}return e.push("Tip: anything not starting with / goes to the agent."),e}async function or(){console.log("");for(let e of Ci())console.log(e);return console.log(""),console.log("Reporting a problem? Run `d360-writer logs` for the API log files."),console.log(""),{kind:"continue"}}W();import{getSession as fu}from"document360-engine";async function Pi(e,t){let n=t.currentUuid(),o=n?fu(n):void 0;return console.log(o?f(`
184
193
  (conversation reset \u2014 "${o.name}" is still available via /resume)
@@ -9,8 +9,12 @@ import type { ReplContext } from '../repl.js';
9
9
  * v3 → two-way messages (Part 3) + on-demand hand-off (Part 4) + version trace.
10
10
  * v4 → the writer can send the builder a `request` (not just a question), e.g. an auto "re-run
11
11
  * onboarding" note when this protocol version moves ahead of what the builder last completed.
12
+ * v5 → (reserved — shipped intermediate refinements).
13
+ * v6 → make the hand-off VISIBLE + state the boundary: the builder surfaces every hint drop in its
14
+ * reply (never silently) and NEVER writes/publishes the user docs itself — that's the docs agent's
15
+ * job. Keeps the dogfood/limitation signal honest and lets a human verify the hand-off happens.
12
16
  */
13
- export declare const DEVHINTS_VERSION = 5;
17
+ export declare const DEVHINTS_VERSION = 6;
14
18
  /**
15
19
  * The committed protocol guide the SOURCE repo's coding agent follows. Self-contained because that
16
20
  * agent has none of d360-writer's context. Two parts: (1) a ONE-TIME architecture brief that onboards
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.5.66",
3
+ "version": "0.5.67",
4
4
  "description": "Standalone documentation agent CLI. Reads your code, writes your docs. Specialized for Document360 publishing.",
5
5
  "type": "module",
6
6
  "bin": {