document360-writer 0.5.10 → 0.5.12

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.
@@ -1,13 +1,22 @@
1
1
  import { type CostEstimate, type DocsPlanEntry, type Partition, type PartitionResult, type TargetFile } from 'document360-engine';
2
2
  import type { ReplContext } from '../repl.js';
3
3
  import type { SlashCommandResult } from './index.js';
4
- /** Partitions running at once local-only work (no D360 rate limit), so higher than /convert. */
5
- export declare const WRITE_CONCURRENCY = 5;
6
- /** Parse /write args: `--run`/`--yes`, `--scope <cat>` (or `--scope=…`), `--all`, or a bare `<path>`. */
4
+ /** Partitions running at once. Each is a heavy Claude Code subprocess; on a dev laptop 5 at once
5
+ starved memory and aborted a worker hard (SNAG-0223 → SNAG-0222 cascade), so the default is a
6
+ safer 3. Override per-run with `--concurrency N` (capped at MAX_WRITE_CONCURRENCY). */
7
+ export declare const WRITE_CONCURRENCY = 3;
8
+ export declare const MAX_WRITE_CONCURRENCY = 8;
9
+ /** Clamp a requested concurrency to [1, MAX]; non-numeric/absent → the default. */
10
+ export declare function resolveConcurrency(requested?: number): number;
11
+ /** Parse /write args. The default ACTION is to write — `/write` starts immediately. `--preview` asks
12
+ for the plan + cost estimate only (no spend). `--scope <cat>` (or `--scope=…`) narrows, `--concurrency
13
+ <n>` tunes parallelism, a bare `<path>` writes one article. `--run`/`--all`/`--yes` are accepted as
14
+ legacy no-ops (writing is the default now) so old quick-options / muscle memory don't error. */
7
15
  export declare function parseWriteArgs(args: string[]): {
8
16
  scope?: string;
9
17
  path?: string;
10
- run: boolean;
18
+ preview: boolean;
19
+ concurrency?: number;
11
20
  };
12
21
  /** Drop a leading `<docsDir>/` so a path given repo-relative matches the docsDir-relative plan keys. */
13
22
  export declare function toPlanRelative(p: string, docsDir: string): string;
@@ -21,7 +30,7 @@ export declare function sizeWriteTargets(cwd: string, entries: DocsPlanEntry[],
21
30
  /** The agent prompt for one partition: author each listed article from the plan. Each is
22
31
  independent; purpose + sources are looked up from the pinned plan, grounded in source. */
23
32
  export declare function buildWritePrompt(partition: Partition, docsDir: string): string;
24
- /** Preview lines for bare `/write`: the partition plan + the cost band, before any spend. */
33
+ /** Preview lines for `/write --preview`: the partition plan + the cost band, before any spend. */
25
34
  export declare function previewLines(partitions: Partition[], estimate: CostEstimate, concurrency: number): string[];
26
35
  /**
27
36
  * Final summary, a bookend to the opening "Writing N articles across M partitions…" line. Usage
@@ -43,9 +52,9 @@ export declare function selectWriteTargets(cwd: string, entries: DocsPlanEntry[]
43
52
  reason?: string;
44
53
  };
45
54
  /**
46
- * Classic-REPL `/write` — parity with the TUI handler (App.tsx): bare `/write [--scope x]` previews
47
- * (plan + cost band, no spend); `/write --run` fans the planned articles out across parallel agents.
48
- * A single `<path>` writes that article immediately. Mid-run abort is TUI-only (Esc); Ctrl+C exits
49
- * the REPL here.
55
+ * Classic-REPL `/write` — parity with the TUI handler (App.tsx): `/write [--scope x]` writes the
56
+ * planned articles across parallel agents immediately; `/write --preview` shows the plan + cost first
57
+ * (no spend). A single `<path>` writes that article immediately. Mid-run abort is TUI-only (Esc);
58
+ * Ctrl+C exits the REPL here.
50
59
  */
51
60
  export declare function writeCommand(args: string[], ctx: ReplContext): Promise<SlashCommandResult>;
@@ -0,0 +1,2 @@
1
+ /** Install once at startup. `label` names the running command in the log (e.g. 'd360-writer'). */
2
+ export declare function installCrashHandlers(label: string): void;
@@ -8,6 +8,10 @@ export type ReadyInputs = {
8
8
  tracked: number;
9
9
  /** `pendingLine(pendingSummary())` — e.g. "2 hints, 1 request", or null when nothing's queued. */
10
10
  pendingText: string | null;
11
+ /** Planned articles (plan.json) not yet written — missing/empty files. >0 after an interrupted /write
12
+ (e.g. a crash mid-run) or a freshly-pinned plan with bodies still to generate. Drives the "pick up
13
+ where you left off" → /write lead so a half-done generation isn't buried under /audit + /sync. */
14
+ pendingWrites: number;
11
15
  /** Commits on HEAD since the last `/audit` marker (0 when never audited or not a git repo). */
12
16
  behind: number;
13
17
  /** The user's `/audit --auto on` setting. */
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /** Interactive /help — a Claude-Code-style tabbed modal. Tab/←/→ (or 1-5) switch sections, esc closes.
3
+ Key routing + the `helpModal` state live in App.tsx (mirrors the other pickers). */
4
+ export declare function HelpModal({ tab, width }: {
5
+ tab: number;
6
+ width: number;
7
+ }): React.ReactElement;
@@ -6,12 +6,9 @@ export type CommandSpec = {
6
6
  group: CommandGroup;
7
7
  };
8
8
  export declare const COMMANDS: CommandSpec[];
9
- /** The /help text ONE source of truth for the TUI and the classic REPL. Organized by the two ways
10
- people actually use d360-writer (keep-docs-in-sync vs. write-specific-docs) rather than by command
11
- type, so a reader finds the handful of commands their situation needs instead of scanning a flat
12
- list. Plain strings (no ANSI) so the TUI can push it as a note without leaking escape codes.
13
- (The `/` palette still lists every command via COMMANDS/filterCommands — this is the teaching surface.) */
14
- export declare function renderGroupedHelp(): string[];
9
+ /** A one-line description for a quick-list option (full command line, e.g. "/publish --all"). Curated
10
+ map first, then the catalog `desc` by base command, else ''. */
11
+ export declare function describeQuickOption(cmdLine: string): string;
15
12
  /** Commands whose body filters as you type `/<prefix>`. */
16
13
  export declare function filterCommands(input: string): CommandSpec[];
17
14
  /** True when the usage has a REQUIRED argument (`<...>` outside optional `[...]`
@@ -0,0 +1,35 @@
1
+ export type HelpRow = {
2
+ t: 'head';
3
+ s: string;
4
+ } | {
5
+ t: 'text';
6
+ s: string;
7
+ } | {
8
+ t: 'dim';
9
+ s: string;
10
+ } | {
11
+ t: 'sub';
12
+ s: string;
13
+ } | {
14
+ t: 'good';
15
+ s: string;
16
+ } | {
17
+ t: 'step';
18
+ n: number;
19
+ s: string;
20
+ } | {
21
+ t: 'cmd';
22
+ name: string;
23
+ s: string;
24
+ } | {
25
+ t: 'gap';
26
+ };
27
+ export type HelpTab = {
28
+ key: string;
29
+ label: string;
30
+ rows: HelpRow[];
31
+ };
32
+ export declare const HELP_TABS: HelpTab[];
33
+ /** Flatten every tab to plain strings — the classic REPL has no modal, so it prints the
34
+ sections linearly under their headers. */
35
+ export declare function renderHelpPlain(): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.5.10",
3
+ "version": "0.5.12",
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.59",
37
+ "document360-engine": "^0.2.61",
38
38
  "ink": "^5.2.1",
39
39
  "picocolors": "^1.1.1",
40
40
  "react": "^18.3.1",