document360-writer 0.5.86 → 0.5.89

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 (78) hide show
  1. package/dist/cli.js +103 -103
  2. package/package.json +3 -3
  3. package/dist/cli.d.ts +0 -2
  4. package/dist/commands/allowProd.d.ts +0 -3
  5. package/dist/commands/audit.d.ts +0 -2
  6. package/dist/commands/capture-setup.d.ts +0 -12
  7. package/dist/commands/catchup.d.ts +0 -63
  8. package/dist/commands/clear.d.ts +0 -3
  9. package/dist/commands/convert.d.ts +0 -35
  10. package/dist/commands/devhints.d.ts +0 -125
  11. package/dist/commands/doctor.d.ts +0 -13
  12. package/dist/commands/document.d.ts +0 -19
  13. package/dist/commands/draft.d.ts +0 -27
  14. package/dist/commands/exit.d.ts +0 -2
  15. package/dist/commands/genre.d.ts +0 -3
  16. package/dist/commands/help.d.ts +0 -2
  17. package/dist/commands/inbox.d.ts +0 -11
  18. package/dist/commands/index.d.ts +0 -28
  19. package/dist/commands/init.d.ts +0 -9
  20. package/dist/commands/lint.d.ts +0 -8
  21. package/dist/commands/login.d.ts +0 -4
  22. package/dist/commands/logout.d.ts +0 -5
  23. package/dist/commands/logsCli.d.ts +0 -2
  24. package/dist/commands/mcp.d.ts +0 -2
  25. package/dist/commands/model.d.ts +0 -17
  26. package/dist/commands/profile.d.ts +0 -6
  27. package/dist/commands/project.d.ts +0 -3
  28. package/dist/commands/publish.d.ts +0 -57
  29. package/dist/commands/pull.d.ts +0 -45
  30. package/dist/commands/rename.d.ts +0 -5
  31. package/dist/commands/reorder.d.ts +0 -8
  32. package/dist/commands/reset.d.ts +0 -31
  33. package/dist/commands/resume.d.ts +0 -3
  34. package/dist/commands/review.d.ts +0 -9
  35. package/dist/commands/roadmap.d.ts +0 -10
  36. package/dist/commands/scope.d.ts +0 -9
  37. package/dist/commands/screenshot.d.ts +0 -44
  38. package/dist/commands/structure.d.ts +0 -6
  39. package/dist/commands/update.d.ts +0 -18
  40. package/dist/commands/workspace.d.ts +0 -3
  41. package/dist/commands/write.d.ts +0 -73
  42. package/dist/d360/authCli.d.ts +0 -13
  43. package/dist/d360/portalLink.d.ts +0 -18
  44. package/dist/d360/profileCli.d.ts +0 -3
  45. package/dist/d360/projectCli.d.ts +0 -17
  46. package/dist/d360/workspaceCli.d.ts +0 -17
  47. package/dist/lib/authPreflight.d.ts +0 -14
  48. package/dist/lib/categoryChoices.d.ts +0 -32
  49. package/dist/lib/checklist.d.ts +0 -30
  50. package/dist/lib/clipboard.d.ts +0 -1
  51. package/dist/lib/colors.d.ts +0 -10
  52. package/dist/lib/commandSuggest.d.ts +0 -7
  53. package/dist/lib/crashHandler.d.ts +0 -2
  54. package/dist/lib/diffRender.d.ts +0 -8
  55. package/dist/lib/hyperlink.d.ts +0 -5
  56. package/dist/lib/inputLayout.d.ts +0 -19
  57. package/dist/lib/mascot.d.ts +0 -5
  58. package/dist/lib/mdRender.d.ts +0 -7
  59. package/dist/lib/modelChoices.d.ts +0 -14
  60. package/dist/lib/nextActions.d.ts +0 -104
  61. package/dist/lib/paste.d.ts +0 -19
  62. package/dist/lib/pickOptions.d.ts +0 -18
  63. package/dist/lib/quickOptions.d.ts +0 -24
  64. package/dist/lib/readyState.d.ts +0 -19
  65. package/dist/lib/streaming.d.ts +0 -23
  66. package/dist/lib/syncRender.d.ts +0 -10
  67. package/dist/lib/toolFormat.d.ts +0 -30
  68. package/dist/lib/upgradeTable.d.ts +0 -5
  69. package/dist/oneShot.d.ts +0 -7
  70. package/dist/repl.d.ts +0 -18
  71. package/dist/tui/App.d.ts +0 -9
  72. package/dist/tui/HelpModal.d.ts +0 -7
  73. package/dist/tui/catalog.d.ts +0 -17
  74. package/dist/tui/helpContent.d.ts +0 -35
  75. package/dist/tui/index.d.ts +0 -3
  76. package/dist/tui/itemRender.d.ts +0 -79
  77. package/dist/tui/termTitle.d.ts +0 -28
  78. package/dist/tui/transcriptStore.d.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.5.86",
3
+ "version": "0.5.89",
4
4
  "description": "Standalone documentation agent CLI. Reads your code, writes your docs. Specialized for Document360 publishing.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  "d360-writer": "./dist/cli.js"
9
9
  },
10
10
  "files": [
11
- "dist",
11
+ "dist/**/*.js",
12
12
  "README.md",
13
13
  "LICENSE"
14
14
  ],
@@ -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.106",
37
+ "document360-engine": "^0.2.107",
38
38
  "ink": "^5.2.1",
39
39
  "picocolors": "^1.1.1",
40
40
  "react": "^18.3.1",
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,3 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- export declare function allowProdCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,2 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- export declare function auditCommand(): Promise<SlashCommandResult>;
@@ -1,12 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- /** `/capture-setup` — synthesize the "stage this data" checklist from every article's
3
- SCREENSHOT prerequisites. Forwards to the agent's capture-setup-checklist skill. */
4
- export declare function captureSetupCommand(): Promise<SlashCommandResult>;
5
- /**
6
- * After capture-setup writes `CAPTURE-TESTID-REQUESTS.json`, build a paste-ready hand-off the user
7
- * runs in THEIR OWN code repo (a different terminal) — d360-writer never edits product source, so
8
- * the test-ids are *requested*, not added. The prompt body is bracketed by `---` rules so the user
9
- * can copy exactly the part to paste into Claude Code. Returns null when there are no requests
10
- * (nothing to hand off) or the file is missing/unreadable.
11
- */
12
- export declare function renderTestidHandoff(cwd: string): string[] | null;
@@ -1,63 +0,0 @@
1
- import { computeSyncStatus, planPull, applyPull, planImport, applyImport } from 'document360-engine';
2
- import type { ReplContext } from '../repl.js';
3
- import type { SlashCommandResult } from './index.js';
4
- export type PendingSummary = {
5
- hints: number;
6
- requests: number;
7
- answers: number;
8
- directives: number;
9
- };
10
- /** Deterministic local counts of queued work (hints + builder messages + owner directives). Drift is
11
- network and is checked by the agent via d360_sync_status inside the prompt, not here. */
12
- export declare function pendingSummary(cwd: string): PendingSummary;
13
- /** A short human phrase for a pending summary, or null when nothing local is queued. */
14
- export declare function pendingLine(s: PendingSummary): string | null;
15
- export declare function parseCatchUpArgs(args: string[]): {
16
- publish: boolean;
17
- };
18
- /** The consolidated staged prompt: trust → gather → decide → estimate/gate → write → close-loop → push. */
19
- export declare function buildCatchUpPrompt({ publish }: {
20
- publish: boolean;
21
- }): string;
22
- /** Outcome of the Phase-0 portal reconcile (catch-up brings the portal fully down BEFORE the agent writes). */
23
- export type PortalReconcileResult = {
24
- /** Repo-relative paths whose clean portal edits were pulled into local (lossless — local was unchanged). */
25
- pulled: string[];
26
- /** Repo-relative paths of NEW portal articles imported into local drafts (were untracked-remote). */
27
- imported: string[];
28
- /** Paths changed in BOTH places — left untouched for the user to resolve. */
29
- conflicts: string[];
30
- /** Per-article pull/import failures (left for /pull). */
31
- failed: {
32
- path: string;
33
- error: string;
34
- }[];
35
- /** Set when the status check itself failed — catch-up still proceeds (the agent re-checks). */
36
- error?: string;
37
- };
38
- /** Injectable seam (tests). Defaults to the real engine sync primitives. */
39
- export type ReconcileDeps = {
40
- status: typeof computeSyncStatus;
41
- plan: typeof planPull;
42
- apply: typeof applyPull;
43
- planImport: typeof planImport;
44
- applyImport: typeof applyImport;
45
- };
46
- /**
47
- * Phase 0 of /catch-up — bring the portal FULLY down before the agent works, so "/catch-up" is the one
48
- * command a returning user needs (pull + process). Auto-pull clean `remote-ahead` (lossless — local
49
- * unchanged) AND import `untracked-remote` (new portal-authored articles → local drafts), the same way
50
- * bare /pull does; `conflict` is surfaced + skipped (never overwrite a copy we can't trust). Best-effort:
51
- * a status failure returns `{ error }` and catch-up proceeds (the agent's own d360_sync_status still gates).
52
- * The hidden feedback category is excluded upstream (computeSyncStatus), so its articles never import here.
53
- */
54
- export declare function reconcilePortal(opts: {
55
- cwd: string;
56
- profileName?: string;
57
- }, deps?: ReconcileDeps): Promise<PortalReconcileResult>;
58
- /** Human summary of the reconcile, each line tagged for tone (✓ ok · ℹ info · ⚠ warn). Empty when the
59
- portal was already in sync (nothing to report). */
60
- export declare function reconcileSummaryLines(r: PortalReconcileResult): string[];
61
- /** Classic-REPL `/catch-up`. Reconciles the portal first (Phase 0), then forwards the queued-work prompt
62
- (the double-check) — even with no local queue it still runs, to catch code changes the builder didn't hint. */
63
- export declare function catchupCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
@@ -1,3 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- export declare function clearCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,35 +0,0 @@
1
- import { type CostEstimate, type Partition, type PartitionResult } from 'document360-engine';
2
- import type { ReplContext } from '../repl.js';
3
- import type { SlashCommandResult } from './index.js';
4
- /** Parse /convert args: `--run`/`--yes` and `--scope <folder|path>` (or `--scope=…`). */
5
- export declare function parseConvertArgs(args: string[]): {
6
- scope?: string;
7
- run: boolean;
8
- };
9
- /** Keep only paths under `scope` (a folder prefix or an exact .md path). No scope → all. */
10
- export declare function applyScope(paths: string[], scope?: string): string[];
11
- /** Stat each repo-relative path for the estimator (missing files report 0 bytes → skipped). */
12
- export declare function sizeTargets(cwd: string, paths: string[]): {
13
- path: string;
14
- bytes: number;
15
- }[];
16
- /** The agent prompt for one partition. Mechanical + scoped + efficient — keep the agent from
17
- over-exploring (the main driver of slow convert runs): no source reads, no re-verification. */
18
- export declare function buildConvertPrompt(partition: Partition): string;
19
- /** Preview lines for bare `/convert`: the partition plan + the cost band, before any spend. */
20
- export declare function previewLines(partitions: Partition[], estimate: CostEstimate, concurrency: number): string[];
21
- /**
22
- * Final summary after a run — a bookend to the opening "Converting N articles across M
23
- * partitions…" line: total articles + partitions completed, then the run's usage. Usage shows
24
- * dollars in API mode but OUTPUT TOKENS on a Claude subscription, where per-token cost is
25
- * meaningless to the user. `partitions` is the run plan, used to map each result back to its
26
- * article count (results carry only an index).
27
- */
28
- export declare function summaryLines(results: PartitionResult[], partitions: Partition[], usage: 'api' | 'subscription'): string[];
29
- /**
30
- * Classic-REPL `/convert` — parity with the TUI handler (App.tsx): bare `/convert` previews
31
- * (plan + cost band, no spend); `/convert --run` fans the tracked articles out across parallel
32
- * agents and prints compact per-partition status + a summary. Mid-run abort is TUI-only (Esc);
33
- * in the classic REPL, Ctrl+C exits the process.
34
- */
35
- export declare function convertCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,125 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- /**
4
- * The version of the WHOLE devhints script — the committed guide AND the copy-run prompt, which evolve
5
- * as one unit. Bump on any change to either. Embedded in the guide header, the run prompt, and the
6
- * on-disk handshake trace (devhints-state.json) so a future change is detectable: when the code version
7
- * is ahead of what the builder last completed, /devhints + /doctor tell the user to re-paste.
8
- * v1 → original one-way hints. v2 → re-run-safe single-prompt onboarding.
9
- * v3 → two-way messages (Part 3) + on-demand hand-off (Part 4) + version trace.
10
- * v4 → the writer can send the builder a `request` (not just a question), e.g. an auto "re-run
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.
16
- * v7 → owner→docs directives channel: when the human types `@d360-writer <directive>` in the builder's
17
- * session (a proactive doc ask like "document /review"), the builder APPENDS it as an `## [open]`
18
- * block to `.d360-writer/directives.md` (create if absent) and commits — it does NOT action it
19
- * (writing docs is the docs agent's job; it picks it up on its next /catch-up). The third comms
20
- * channel, alongside builder hints/messages and portal feedback.
21
- */
22
- export declare const DEVHINTS_VERSION = 7;
23
- /**
24
- * The committed protocol guide the SOURCE repo's coding agent follows. Self-contained because that
25
- * agent has none of d360-writer's context. Two parts: (1) a ONE-TIME architecture brief that onboards
26
- * the docs agent — the builder, who holds the full intent, hands over what code alone can't tell a
27
- * writer; (2) ONGOING per-change doc hints. The /devhints command writes this to
28
- * `.d360-writer/DEV-HINTS-GUIDE.md`; the paste block points the source agent at it.
29
- */
30
- export declare function devHintsGuide(): string;
31
- /** The human-owned creator-notes template (scaffolded once, never overwritten). The builder reads it
32
- first as authoritative; the docs agent reads it as authoritative intent. */
33
- export declare function creatorNotesTemplate(): string;
34
- /** `/devhints` — scaffold the dev→docs hand-off: write the committed guide + the architecture inbox
35
- (with a human creator-notes template) + the hints inbox, then show ONE copy-run prompt the SOURCE
36
- repo's coding agent executes to onboard the docs agent (writes the brief, persists the ongoing rule
37
- into CLAUDE.md/AGENTS.md + commits, solicits tribal knowledge) — no manual file edits by the user. */
38
- /**
39
- * Scaffold the dev→docs hand-off artifacts (ongoing-hints inbox, architecture brief home + human
40
- * CREATOR-NOTES, two-way message mailbox, the committed guide, the version trace). Idempotent and
41
- * silent — it writes files and returns the builder's staleness so the caller can render the hand-off.
42
- * Shared by `/devhints`, `/init` (which now folds this in so there's no separate onboarding step),
43
- * and the TUI wizard finale.
44
- */
45
- export declare function scaffoldDevhints(cwd: string): DevhintsStaleness;
46
- export declare function devhintsCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
47
- /**
48
- * The ONE prompt the user copies and runs in their SOURCE repo's coding agent (Claude Code / Codex /
49
- * Cursor). It is self-acting: the agent does everything in one run — writes the architecture brief,
50
- * persists the ongoing-hints rule into the repo's agent-memory file + commits (so teammates inherit it),
51
- * and interactively asks the human for tribal knowledge → CREATOR-NOTES.md. Replaces the old "paste this
52
- * block into CLAUDE.md, commit, then tell your agent to follow it" three-step chain with a single copy-run
53
- * (Saravana, 2026-06-19 — remove every user step). The deep rubric stays in the committed guide, which
54
- * the prompt points the agent at, so the prompt stays short and the guide can improve without re-copying.
55
- *
56
- * RE-RUN SAFE (Saravana, 2026-06-19): the same prompt is pasted again whenever the product evolves, so it
57
- * is explicitly idempotent — each step CREATES if absent, RECONCILES if present, and never clobbers a
58
- * refined brief, duplicates the memory section, or deletes human notes. The final line reflects whether it
59
- * was a first-time setup or a refresh.
60
- */
61
- export declare function devHintsRunPrompt(): string;
62
- /** The devhints handshake trace (`.d360-writer/devhints-state.json`). `emitted*` = what d360-writer
63
- last handed the builder; `completed*` = what the builder's agent last ran (stamped by the run prompt,
64
- step 6). The gap between completedVersion and DEVHINTS_VERSION is what staleness detection reads. */
65
- export type DevhintsState = {
66
- emittedVersion?: number;
67
- emittedAt?: string;
68
- completedVersion?: number;
69
- completedAt?: string;
70
- completedCommit?: string;
71
- };
72
- /** Read the handshake trace; null if absent or unparseable (treated as "never set up"). */
73
- export declare function readDevhintsState(cwd: string): DevhintsState | null;
74
- /** Record that /devhints just emitted the current version, preserving the builder's completion fields. */
75
- export declare function writeDevhintsEmitted(cwd: string, now: string): void;
76
- /** True once the builder has written its architecture brief — a non-CREATOR-NOTES `.md` in
77
- `.d360-writer/architecture/`. Lets the wait-heartbeat distinguish "not started yet" from "working". */
78
- export declare function builderHasStarted(cwd: string): boolean;
79
- export type DevhintsStaleness = {
80
- status: 'unset' | 'stale' | 'current';
81
- completedVersion?: number;
82
- };
83
- /** Compare what the builder completed against the current script version. `unset` = the builder hasn't
84
- run the hand-off (no completion stamp); `stale` = ran an older version; `current` = up to date. */
85
- export declare function devhintsStaleness(cwd: string): DevhintsStaleness;
86
- /** Subject prefix that marks the auto "re-run onboarding" request, so we never queue a duplicate. */
87
- export declare const ONBOARDING_REQUEST_MARKER = "Re-run dev\u2194docs onboarding (protocol v";
88
- export type DevhintsReconcileResult = {
89
- guideRefreshed: boolean;
90
- notifiedBuilder: boolean;
91
- toVersion: number;
92
- completedVersion?: number;
93
- };
94
- /**
95
- * Keep the dev↔docs onboarding protocol self-healing, with no human re-paste. Runs at launch when a
96
- * guide already exists (devhints is in use):
97
- * - if the package's DEVHINTS_VERSION is ahead of what we last EMITTED → rewrite the committed guide +
98
- * re-stamp `emitted` (the new protocol lands on disk on its own);
99
- * - if it's ahead of what the builder COMPLETED → leave ONE `from: docs, kind: request` message in the
100
- * mailbox with the run prompt embedded (idempotent: skip if an open onboarding request already exists),
101
- * so the builder re-onboards on their next session.
102
- * Pure file ops, never throws; returns what it did so the wrapper can surface a one-line note.
103
- */
104
- export declare function reconcileDevhints(cwd: string, now?: string): DevhintsReconcileResult;
105
- /**
106
- * The RECURRING launch nudge to the human (e.g. Suprej): while the builder agent (John) is behind the
107
- * current protocol, show — on EVERY launch — a clear, actionable note that names THIS repo's path and
108
- * embeds the exact prompt to paste into the repo's coding agent. Returns [] when devhints isn't in use
109
- * here, or once the builder has caught up (so it self-stops). `cwd` is the repo path shown to the user.
110
- */
111
- export declare function renderBuilderUpdateNote(cwd: string): string[];
112
- /**
113
- * The INVERSE of devHintsRunPrompt: the copy-run prompt the user pastes into their builder after a
114
- * `/reset`, to undo the dev→docs hand-off and restore the repo to its pre-docs-agent state (the
115
- * `.d360-writer/` brief is already gone; this removes the rule the builder added to its agent memory).
116
- */
117
- export declare function devHintsCleanupPrompt(): string;
118
- /** The `/reset` builder-cleanup block: explains the leftover (the builder's agent-memory edit, which
119
- reset deliberately can't touch) and shows the copy-run cleanup prompt. */
120
- export declare function renderResetCleanup(): string[];
121
- /**
122
- * The `/devhints` screen: confirms what was scaffolded, then shows the single copy-run prompt
123
- * (devHintsRunPrompt) and the closing "come back and run" guidance. One prompt, zero manual file edits.
124
- */
125
- export declare function renderDevHintsHandoff(stale?: DevhintsStaleness): string[];
@@ -1,13 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- export type DoctorCheck = {
4
- level: 'ok' | 'warn' | 'fail';
5
- label: string;
6
- detail?: string;
7
- fix?: string;
8
- };
9
- /** Health checks with the exact fix command per failure — the writer analog of
10
- capture's doctor. Shared by the `doctor` CLI subcommand and /doctor. */
11
- export declare function runDoctorChecks(cwd: string): Promise<DoctorCheck[]>;
12
- export declare function renderDoctorChecks(checks: DoctorCheck[]): string[];
13
- export declare function doctorCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,19 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /** Open `request` messages (the builder's explicit "please document X") awaiting the docs agent. */
4
- export declare function openRequestCount(cwd: string): number;
5
- /** Split `--publish` off the args; the rest is the free-text description of what changed. */
6
- export declare function parseDocumentArgs(args: string[]): {
7
- publish: boolean;
8
- what: string;
9
- };
10
- /** The prompt driving the document-handoff skill. `what` is the builder's description (empty → act on
11
- the open request messages in the inbox). `publish` appends a draft-then-publish instruction. */
12
- export declare function buildDocumentPrompt(what: string, publish?: boolean): string;
13
- declare const NO_REQUESTS_HINT = "Nothing to document yet. Say what changed: /document <what you shipped> \u2014 or have the builder drop a request via their /devhints hand-off.";
14
- /**
15
- * Classic-REPL `/document`: with text → document it; bare with open requests → process them; bare with
16
- * nothing → tell the user how to describe the work.
17
- */
18
- export declare function documentCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
19
- export { NO_REQUESTS_HINT };
@@ -1,27 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /** A feature available to draft: a subfolder of `.d360-writer/input/` holding ≥1 input doc. */
4
- export type DraftFeature = {
5
- name: string;
6
- docCount: number;
7
- };
8
- /** List the feature subfolders under `.d360-writer/input/` (each with ≥1 PRD/spec doc). Sorted.
9
- Loose docs directly in input/ (no subfolder) surface as the synthetic feature "" (root). */
10
- export declare function listInputFeatures(cwd: string): {
11
- features: DraftFeature[];
12
- looseDocs: number;
13
- };
14
- /** Resolve a `/draft <selector>` to a feature subfolder: exact → prefix → fuzzy (substring), case-
15
- insensitive. Returns the matched feature name, or null when nothing matches (caller treats the
16
- selector as a free-text hint instead). */
17
- export declare function matchFeature(features: DraftFeature[], selector: string): string | null;
18
- /** The prompt that drives the draft-from-prd skill for a resolved scope. `feature` is the subfolder
19
- (or '' for loose root docs); `hint` is the user's free-text framing when no subfolder matched. */
20
- export declare function buildDraftPrompt(feature: string, hint?: string): string;
21
- declare const EMPTY_INPUT_HINT = "No input docs found. Drop this feature's PRDs/specs in .d360-writer/input/<feature>/ (.md or .pdf), then run /draft.";
22
- /**
23
- * Classic-REPL `/draft`: resolve the feature, then forward the draft-from-prd prompt to the agent.
24
- * Multiple features + no selector → list them and ask (the TUI shows a picker; classic prints the list).
25
- */
26
- export declare function draftCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
27
- export { EMPTY_INPUT_HINT };
@@ -1,2 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- export declare function exitCommand(): Promise<SlashCommandResult>;
@@ -1,3 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- export declare function genreCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,2 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- export declare function helpCommand(): Promise<SlashCommandResult>;
@@ -1,11 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /** Count of open builder messages addressed to the docs agent — drives the ambient nudge + bare /inbox. */
4
- export declare function openForDocsCount(cwd: string): number;
5
- /** The prompt that drives inbox processing. Generic over the action so it composes with the
6
- document-handoff skill (Phase B) for requests and gap-analysis's update logic for answers. */
7
- export declare function buildInboxPrompt(): string;
8
- /**
9
- * Classic-REPL `/inbox`: if there are open messages, forward the processing prompt; otherwise say so.
10
- */
11
- export declare function inboxCommand(_args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
@@ -1,28 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- export type SlashCommandResult = {
3
- kind: 'continue';
4
- } | {
5
- kind: 'exit';
6
- } | {
7
- kind: 'clear';
8
- } | {
9
- kind: 'resume';
10
- uuid: string;
11
- name: string;
12
- } | {
13
- kind: 'allow-prod';
14
- }
15
- /** `display` is the effective command line (e.g. "/publish --all") — transcripts
16
- and session titles show it instead of the expanded prompt template (CC-style). */
17
- | {
18
- kind: 'forward-to-agent';
19
- prompt: string;
20
- display?: string;
21
- };
22
- export type SlashCommand = (args: string[], ctx: ReplContext) => Promise<SlashCommandResult>;
23
- export declare const slashCommands: Record<string, SlashCommand>;
24
- export declare function isSlashCommand(line: string): boolean;
25
- export declare function parseSlash(line: string): {
26
- name: string;
27
- args: string[];
28
- } | null;
@@ -1,9 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- /** Non-interactive scaffold with sensible defaults — the TUI path (inquirer can't
3
- share stdin with Ink). The classic REPL/CLI keeps the interactive flow below. */
4
- export declare function scaffoldInit(cwd: string, env?: string): {
5
- created: boolean;
6
- path: string;
7
- profileName: string;
8
- };
9
- export declare function initCommand(): Promise<SlashCommandResult>;
@@ -1,8 +0,0 @@
1
- import { type LintFinding } from 'document360-engine';
2
- import type { ReplContext } from '../repl.js';
3
- import type { SlashCommandResult } from './index.js';
4
- /** Group findings by article into printable lines (shared by classic + TUI). */
5
- export declare function lintReportLines(findings: LintFinding[]): string[];
6
- /** The agent prompt for `/check --fix`: correct each finding in place, grounded in source, no new issues. */
7
- export declare function buildLintFixPrompt(findings: LintFinding[]): string;
8
- export declare function lintCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,4 +0,0 @@
1
- import type { SlashCommand } from './index.js';
2
- /** /login — browser OAuth without leaving the REPL. Tokens are re-read from the
3
- store on every API call, so the running agent session heals in place. */
4
- export declare const loginCommand: SlashCommand;
@@ -1,5 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- /** `/logout` — sign out of the active profile and clear its project/workspace selection, so the
4
- next /login starts project selection from scratch (Claude Code parity + the "start over" lever). */
5
- export declare function logoutCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,2 +0,0 @@
1
- /** `d360-writer logs` — the one command to give a customer reporting a problem. */
2
- export declare function runLogs(): void;
@@ -1,2 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- export declare function mcpCommand(args: string[]): Promise<SlashCommandResult>;
@@ -1,17 +0,0 @@
1
- import { type ResolvedModel } from 'document360-engine';
2
- import type { ReplContext } from '../repl.js';
3
- import type { SlashCommandResult } from './index.js';
4
- export declare function describeModelSource(r: ResolvedModel): string;
5
- /** Set or clear the personal (user-config) model. Returns the status lines plus
6
- the `effective` model to push into the LIVE session via setModel() — always
7
- concrete now (auto resolves to the docs-right Sonnet default; the dev
8
- environment's Claude Code settings model never leaks in — SNAG-0262).
9
- Shared by the REPL command and the TUI case. */
10
- export declare function applyModelChange(cwd: string, arg: string): {
11
- lines: string[];
12
- changed: boolean;
13
- effective: string | undefined;
14
- };
15
- /** /model — interactive picker (TTY) or status display; /model <name> sets the
16
- personal (user-config) model; /model default clears it. Mirrors Claude Code's /model. */
17
- export declare function modelCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,6 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- /** Create a profile from a known environment preset. Returns null on success,
4
- or the error line. Shared by the REPL command and the TUI case. */
5
- export declare function addProfile(cwd: string, name?: string, env?: string): string | null;
6
- export declare function profileCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,3 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- export declare function projectCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,57 +0,0 @@
1
- import { type Partition, type PartitionResult, type SyncEntryState } from 'document360-engine';
2
- import type { ReplContext } from '../repl.js';
3
- import type { SlashCommandResult } from './index.js';
4
- /** Partitions publishing at once. D360 API rate limits → low, same as /convert. */
5
- export declare const PUBLISH_CONCURRENCY = 3;
6
- export declare function buildPublishPrompt(path: string): string;
7
- /** Publish-picker rows: articles the sync state says are worth pushing. */
8
- export declare const PUBLISH_CANDIDATE_LABEL: Partial<Record<SyncEntryState['status'], string>>;
9
- export declare function publishCandidates(entries: SyncEntryState[]): {
10
- path: string;
11
- label: string;
12
- }[];
13
- /** Count of files that already exist on Document360 but aren't linked (link candidates), so the /publish
14
- flows can tell the user why they were left out instead of silently dropping them. */
15
- export declare function linkCandidateCount(entries: SyncEntryState[]): number;
16
- /** A one-line post-publish note about relative cross-article links whose target isn't published yet — they
17
- render as plain text until then (by design) and resolve to live links once the target publishes. Returns
18
- null when there are none. Reassures the operator that plain-text links aren't broken (dogfood s-205). */
19
- export declare function crossLinkPendingLine(cwd: string, profileName?: string): string | null;
20
- /** A row in the grouped /publish picker: "all", a category (publishes all its candidates), or one
21
- article. `paths` is what gets published when the row is chosen (one for an article, many otherwise). */
22
- export type PublishRow = {
23
- kind: 'all' | 'category' | 'article';
24
- label: string;
25
- paths: string[];
26
- /** Article rows render indented under their category; gray status note (new/modified) sits beside. */
27
- indent: boolean;
28
- note?: string;
29
- };
30
- /**
31
- * Build the grouped publish picker: a "publish all" row, then each category (sorted) as a selectable
32
- * parent that publishes ALL its candidate articles, with its articles listed beneath as indented,
33
- * individually-selectable rows. Both categories and articles are pickable (SNAG-0135).
34
- */
35
- export declare function buildPublishRows(candidates: {
36
- path: string;
37
- label: string;
38
- }[]): PublishRow[];
39
- /** The publish prompt for ONE partition (a category's worth of articles). The bulk `/publish --all`
40
- fans these out across parallel agents (engine runPartitioned) so no single agent context carries
41
- the whole repo — the SNAG-0128 crash (a 38-article single turn OOM'd the SDK subprocess). */
42
- export declare function buildBulkPublishPrompt(paths: string[]): string;
43
- /** Final summary after a partitioned publish run — bookends the opening line. Usage shows dollars in
44
- API mode but OUTPUT TOKENS on a Claude subscription (per-token cost is meaningless there). */
45
- export declare function publishSummaryLines(results: PartitionResult[], partitions: Partition[], usage: 'api' | 'subscription'): string[];
46
- /**
47
- * Classic-REPL bulk publish: fan the candidate articles out across parallel agents (partitioned by
48
- * category), printing compact per-partition status + a summary. Mirrors convertCommand. Mid-run abort
49
- * is TUI-only (Esc); Ctrl+C exits the REPL here. Resumable: each article's publish is recorded as it
50
- * completes, so a re-run skips what's already in sync.
51
- */
52
- export declare function runBulkPublishClassic(ctx: ReplContext, paths: string[]): Promise<SlashCommandResult>;
53
- /** Repo-relative paths of `articlePath`'s related articles that aren't published yet — its
54
- `## Related articles` targets intersected with the current publish candidates. Deterministic, so
55
- the post-publish offer lists ALL of them (the agent's prose only listed some — SNAG-0136). */
56
- export declare function unpublishedRelated(cwd: string, profileName: string | undefined, articlePath: string): Promise<string[]>;
57
- export declare function publishCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
@@ -1,45 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /**
4
- * /pull — bring Document360 down into the local docs. ONE verb, ONE direction (push stays /publish).
5
- * /pull pull every clean portal edit + import every NEW portal article, then report drift
6
- * /pull <path> pull (or conflict-resolve) one article after a reviewed diff
7
- * /pull --status read-only drift report (no writes)
8
- * /pull --baseline set a sync baseline for tracked-but-not-yet-compared articles
9
- * /pull --compare (diagnostic) check the manifest sees the same articles as the per-article path
10
- * No agent turn, no tokens — direct engine calls.
11
- */
12
- export declare function pullCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
13
- /** Result of a bare /pull — the down-direction reconcile (shared by the classic REPL + the TUI). */
14
- export type PullDownResult = {
15
- /** Repo-relative paths whose clean portal edits were pulled into local. */
16
- pulled: string[];
17
- /** NEW portal articles imported into local files. */
18
- imported: {
19
- title: string;
20
- path: string;
21
- }[];
22
- /** Paths changed in BOTH places — left untouched for the user to resolve. */
23
- conflicts: string[];
24
- /** Count of local-only changes (local-ahead + new-here) that go UP via /publish. */
25
- toPublish: number;
26
- /** Per-item failures (a pull or import that threw). */
27
- failed: {
28
- ref: string;
29
- error: string;
30
- }[];
31
- };
32
- /**
33
- * Bare /pull: bring Document360 down. Auto-pull every clean `remote-ahead` (lossless — local unchanged),
34
- * import every `untracked-remote` new portal article into a local draft, and tally what's left (conflicts
35
- * to resolve, local changes to /publish). Pure orchestration over the engine sync primitives — no UI.
36
- */
37
- export declare function pullDown(opts: {
38
- cwd: string;
39
- profileName?: string;
40
- }): Promise<PullDownResult>;
41
- /** Human summary of a bare /pull, each line tagged for tone. Always returns ≥1 line. */
42
- export declare function pullDownLines(r: PullDownResult): {
43
- text: string;
44
- tone: 'ok' | 'info' | 'warn';
45
- }[];
@@ -1,5 +0,0 @@
1
- import type { SlashCommandResult } from './index.js';
2
- import type { ReplContext } from '../repl.js';
3
- /** Drop one layer of matching wrapping quotes — `/rename "my name"` shouldn't store the quotes. */
4
- export declare function stripWrappingQuotes(s: string): string;
5
- export declare function renameCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,8 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /** Build the /reorder prompt + display, or null when the repo isn't configured. */
4
- export declare function buildReorder(cwd: string, args: string[]): {
5
- prompt: string;
6
- display: string;
7
- } | null;
8
- export declare function reorderCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -1,31 +0,0 @@
1
- import type { ReplContext } from '../repl.js';
2
- import type { SlashCommandResult } from './index.js';
3
- /**
4
- * Hard gate on what /reset may delete. d360-writer owns ONLY `.d360-writer/` (+ pre-consolidation root
5
- * dot-files), so anything outside `.d360-writer/` (except our own dot-files) is refused — no matter what
6
- * the config says or how a target was computed. Cheap insurance against a bad config pointing the docs
7
- * dir at a real repo folder and nuking it. (No "gold set" anymore — see CLAUDE.md; the guard stays
8
- * because refusing to rm a repo-root folder is just good hygiene.)
9
- */
10
- export declare function isResettable(rel: string): boolean;
11
- /** Repo-relative paths that exist and would be removed by /reset — strictly within `.d360-writer/`
12
- (+ legacy root dot-files). NEVER a repo-root docs folder (refused by isResettable, no matter the config). */
13
- export declare function resetTargets(cwd: string): string[];
14
- /** Delete each target (recursive, force) — but re-check isResettable on every path as a final
15
- safety net, so a non-resettable path (e.g. any repo-root folder) can never be deleted even if
16
- it somehow reached this list. Returns what was removed, refused, and what failed. */
17
- export declare function performReset(cwd: string, targets: string[]): {
18
- removed: string[];
19
- failed: {
20
- path: string;
21
- error: string;
22
- }[];
23
- };
24
- /** Uncommitted doc hints (`.d360-writer/hints/`) that a reset would destroy. */
25
- export declare function uncommittedHintCount(cwd: string): number;
26
- /** Uncommitted two-way messages (`.d360-writer/messages/`) that a reset would destroy. */
27
- export declare function uncommittedMessageCount(cwd: string): number;
28
- /** The destructive preview shown before the typed-name confirmation. */
29
- export declare function resetPreviewLines(cwd: string, targets: string[]): string[];
30
- /** `/reset` [DANGER] — classic REPL: preview → typed-name confirmation → delete. */
31
- export declare function resetCommand(_args: string[], ctx: ReplContext): Promise<SlashCommandResult>;