document360-writer 0.4.0 → 0.4.1

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 (87) hide show
  1. package/LICENSE +10 -16
  2. package/README.md +1 -1
  3. package/dist/cli.js +63 -123
  4. package/dist/commands/doctor.d.ts +13 -0
  5. package/dist/commands/index.d.ts +5 -1
  6. package/dist/commands/init.d.ts +7 -0
  7. package/dist/commands/login.d.ts +4 -0
  8. package/dist/commands/model.d.ts +16 -0
  9. package/dist/commands/profile.d.ts +3 -0
  10. package/dist/commands/publish.d.ts +12 -1
  11. package/dist/commands/scope.d.ts +9 -0
  12. package/dist/commands/sync.d.ts +8 -0
  13. package/dist/d360/authCli.d.ts +3 -0
  14. package/dist/lib/colors.d.ts +2 -0
  15. package/dist/lib/commandSuggest.d.ts +7 -0
  16. package/dist/lib/diffRender.d.ts +8 -0
  17. package/dist/lib/hyperlink.d.ts +5 -0
  18. package/dist/lib/inputLayout.d.ts +19 -0
  19. package/dist/lib/mascot.d.ts +5 -0
  20. package/dist/lib/modelChoices.d.ts +14 -0
  21. package/dist/lib/paste.d.ts +19 -0
  22. package/dist/lib/syncRender.d.ts +6 -0
  23. package/dist/lib/toolFormat.d.ts +6 -2
  24. package/dist/repl.d.ts +2 -0
  25. package/dist/tui/App.d.ts +1 -1
  26. package/dist/tui/catalog.d.ts +4 -0
  27. package/dist/tui/itemRender.d.ts +14 -0
  28. package/package.json +5 -4
  29. package/dist/cli.js.map +0 -1
  30. package/dist/commands/allowProd.js +0 -18
  31. package/dist/commands/allowProd.js.map +0 -1
  32. package/dist/commands/audit.js +0 -12
  33. package/dist/commands/audit.js.map +0 -1
  34. package/dist/commands/clear.js +0 -14
  35. package/dist/commands/clear.js.map +0 -1
  36. package/dist/commands/exit.js +0 -4
  37. package/dist/commands/exit.js.map +0 -1
  38. package/dist/commands/help.js +0 -30
  39. package/dist/commands/help.js.map +0 -1
  40. package/dist/commands/index.js +0 -44
  41. package/dist/commands/index.js.map +0 -1
  42. package/dist/commands/init.js +0 -83
  43. package/dist/commands/init.js.map +0 -1
  44. package/dist/commands/logsCli.js +0 -31
  45. package/dist/commands/logsCli.js.map +0 -1
  46. package/dist/commands/mcp.js +0 -103
  47. package/dist/commands/mcp.js.map +0 -1
  48. package/dist/commands/profile.js +0 -16
  49. package/dist/commands/profile.js.map +0 -1
  50. package/dist/commands/publish.js +0 -19
  51. package/dist/commands/publish.js.map +0 -1
  52. package/dist/commands/rename.js +0 -22
  53. package/dist/commands/rename.js.map +0 -1
  54. package/dist/commands/resume.js +0 -58
  55. package/dist/commands/resume.js.map +0 -1
  56. package/dist/commands/screenshot.js +0 -20
  57. package/dist/commands/screenshot.js.map +0 -1
  58. package/dist/commands/workspace.js +0 -8
  59. package/dist/commands/workspace.js.map +0 -1
  60. package/dist/d360/authCli.js +0 -106
  61. package/dist/d360/authCli.js.map +0 -1
  62. package/dist/d360/portalLink.js +0 -43
  63. package/dist/d360/portalLink.js.map +0 -1
  64. package/dist/d360/profileCli.js +0 -54
  65. package/dist/d360/profileCli.js.map +0 -1
  66. package/dist/d360/workspaceCli.js +0 -72
  67. package/dist/d360/workspaceCli.js.map +0 -1
  68. package/dist/lib/colors.js +0 -10
  69. package/dist/lib/colors.js.map +0 -1
  70. package/dist/lib/mdRender.js +0 -172
  71. package/dist/lib/mdRender.js.map +0 -1
  72. package/dist/lib/streaming.js +0 -51
  73. package/dist/lib/streaming.js.map +0 -1
  74. package/dist/lib/toolFormat.js +0 -115
  75. package/dist/lib/toolFormat.js.map +0 -1
  76. package/dist/oneShot.js +0 -96
  77. package/dist/oneShot.js.map +0 -1
  78. package/dist/repl.js +0 -287
  79. package/dist/repl.js.map +0 -1
  80. package/dist/tui/App.js +0 -607
  81. package/dist/tui/App.js.map +0 -1
  82. package/dist/tui/catalog.js +0 -22
  83. package/dist/tui/catalog.js.map +0 -1
  84. package/dist/tui/index.js +0 -24
  85. package/dist/tui/index.js.map +0 -1
  86. package/dist/tui/itemRender.js +0 -72
  87. package/dist/tui/itemRender.js.map +0 -1
@@ -1,7 +1,10 @@
1
+ import { type StoredTokens } from 'document360-engine';
2
+ export declare function identityLine(tokens: StoredTokens): string;
1
3
  export declare function runLogin(opts: {
2
4
  profile?: string;
3
5
  manual?: boolean;
4
6
  }): Promise<void>;
7
+ export declare function maybePersistProject(tokens: StoredTokens, profileName: string, note: (line: string) => void): void;
5
8
  export declare function runWhoami(opts: {
6
9
  profile?: string;
7
10
  }): Promise<void>;
@@ -1,3 +1,5 @@
1
+ /** Document360 brand purple — single source of truth for the app's primary color. */
2
+ export declare const BRAND_HEX = "#7f56d9";
1
3
  export declare const banner: (s: string) => string;
2
4
  export declare const dim: (s: string) => string;
3
5
  export declare const error: (s: string) => string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Quick-run options: when an agent turn ends by suggesting slash commands (e.g. the
3
+ * gap-analysis trust gate offering `/sync pull <path>` vs `/publish <path>`), the TUI
4
+ * lets the user press 1-N to fill the command instead of retyping it. Only standalone
5
+ * command lines count — a command mentioned mid-sentence is prose, not an option.
6
+ */
7
+ export declare function extractCommandSuggestions(text: string, knownNames: string[], max?: number): string[];
@@ -0,0 +1,8 @@
1
+ export type DiffView = {
2
+ added: number;
3
+ removed: number;
4
+ lines: string[];
5
+ hidden: number;
6
+ };
7
+ /** Render old→new content as a Claude Code-style diff. Returns null when identical. */
8
+ export declare function renderArticleDiff(oldContent: string, newContent: string, width: number): DiffView | null;
@@ -0,0 +1,5 @@
1
+ /** Conservative allowlist of terminals known to handle OSC 8 (à la supports-hyperlinks). */
2
+ export declare function supportsHyperlinks(env?: NodeJS.ProcessEnv): boolean;
3
+ export declare function hyperlink(url: string, text?: string, env?: NodeJS.ProcessEnv): string;
4
+ /** Wrap every URL in a string as its own OSC 8 hyperlink (text shown unchanged). */
5
+ export declare function linkifyUrls(s: string, env?: NodeJS.ProcessEnv): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Input-editor layout math (SNAG-0057): the input box renders multi-line text as
3
+ * hard-wrapped visual lines with the caret positioned IN the text (it used to be
4
+ * a sibling element stranded after the wrapped block). Pure functions — the same
5
+ * layout drives rendering and arrow/home/end caret movement, so they can't drift.
6
+ */
7
+ export type VisualLine = {
8
+ start: number;
9
+ end: number;
10
+ };
11
+ /** Split on real newlines, then hard-wrap each segment at `width` columns. */
12
+ export declare function layoutInput(text: string, width: number): VisualLine[];
13
+ /** Visual line containing the caret. At a wrap boundary (pos == end == next.start)
14
+ the caret belongs to the NEXT line (column 0) — standard editor behavior. */
15
+ export declare function caretLineIndex(lines: VisualLine[], pos: number): number;
16
+ /** Move the caret one visual line up/down, preserving the column (clamped). */
17
+ export declare function moveCaretVertically(lines: VisualLine[], pos: number, delta: 1 | -1): number;
18
+ /** Home/End within the caret's visual line. */
19
+ export declare function caretLineEdge(lines: VisualLine[], pos: number, edge: 'start' | 'end'): number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Render the mascot as ANSI lines (one per two pixel rows), or [] when colors are
3
+ * off (NO_COLOR / non-TTY) — a colorless silhouette loses the face, so skip it.
4
+ */
5
+ export declare function mascotLines(): string[];
@@ -0,0 +1,14 @@
1
+ /** The /model picker's curated list (mirrors Claude Code's /model dialog).
2
+ Class aliases ('opus'/'sonnet'/'haiku') stay evergreen — the runtime resolves
3
+ them to the latest model in class; Fable needs its exact id. */
4
+ import type { ResolvedModel } from 'document360-engine';
5
+ export type ModelChoice = {
6
+ /** Value written to the personal config; null = clear the override (runtime default). */
7
+ value: string | null;
8
+ label: string;
9
+ desc: string;
10
+ };
11
+ export declare const MODEL_CHOICES: ModelChoice[];
12
+ /** Index of the choice matching the resolved model (for the ✓ marker / initial cursor).
13
+ Personal/team/env overrides match by value or label; no override → Default. */
14
+ export declare function currentChoiceIndex(resolved: ResolvedModel): number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Claude Code-style paste collapsing for the TUI input box. Large or multiline
3
+ * pastes are held aside and represented inline by a marker like
4
+ * `[Pasted text #1 +12 lines]`; markers expand back to the full text at submit.
5
+ * Pure logic — the TUI owns the marker→text map (session lifetime, so history
6
+ * recall of a collapsed prompt still expands).
7
+ */
8
+ export declare function normalizePaste(raw: string): string;
9
+ /** Collapse multiline pastes (the input box is one line) and long single-line ones. */
10
+ export declare function shouldCollapse(text: string): boolean;
11
+ export declare function makeMarker(id: number, text: string): string;
12
+ /** Replace every intact marker that has a stored paste; unknown markers pass through. */
13
+ export declare function expandPastes(text: string, pastes: ReadonlyMap<string, string>): string;
14
+ /**
15
+ * Backspace treats a marker as atomic (Claude Code behavior): if the input ends
16
+ * with one, remove it whole; otherwise remove the last character. Returns null
17
+ * when the input does not end with a marker.
18
+ */
19
+ export declare function stripTrailingMarker(input: string): string | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * git-status-style rendering of a SyncStatusReport. Pure ANSI-string lines —
3
+ * the REPL console.logs them; the TUI pushes them as one note (Ink-safe).
4
+ */
5
+ import type { SyncStatusReport } from 'document360-engine';
6
+ export declare function renderSyncReport(report: SyncStatusReport): string[];
@@ -17,10 +17,14 @@ export type ToolResultView = {
17
17
  lines: string[];
18
18
  hidden: number;
19
19
  };
20
+ /** "user-docs/99-troubleshooting/01-login.md" → "Troubleshooting" — the category
21
+ NAME derived locally from the article path (no API call; GUIDs are unreadable). */
22
+ export declare function prettyCategoryFromPath(localPath: unknown): string | null;
20
23
  /**
21
24
  * Header line for a tool call: display title + inline argument summary.
22
25
  * Returns null for internal tools that should stay hidden.
23
26
  */
24
27
  export declare function formatToolUse(name: string, input: Record<string, unknown>): ToolHeader | null;
25
- /** Preview of a tool result: first `maxLines` lines + how many were held back. */
26
- export declare function formatToolResult(output: string, maxLines?: number): ToolResultView;
28
+ /** Preview of a tool result: first `maxLines` lines + how many were held back.
29
+ `toolName`/`input` (the paired tool call) unlock curated per-tool summaries. */
30
+ export declare function formatToolResult(output: string, maxLines?: number, toolName?: string, input?: Record<string, unknown>): ToolResultView;
package/dist/repl.d.ts CHANGED
@@ -2,6 +2,8 @@ import { type AuthMode } from 'document360-engine';
2
2
  export type ReplContext = {
3
3
  cwd: string;
4
4
  restartAgent: () => void;
5
+ /** Switch the live session's model without restarting (conversation continues). */
6
+ setModel: (model?: string) => Promise<void>;
5
7
  /** UUID of the live session record, once the first exchange has registered it. */
6
8
  currentUuid: () => string | null;
7
9
  /** Pause the REPL's readline while another stdin consumer (e.g. the /resume picker) runs. */
package/dist/tui/App.d.ts CHANGED
@@ -6,4 +6,4 @@ export type AppProps = {
6
6
  profileName?: string;
7
7
  version: string;
8
8
  };
9
- export declare function App({ cwd, auth, profileName, version }: AppProps): React.ReactElement;
9
+ export declare function App({ cwd, auth, profileName: initialProfile, version }: AppProps): React.ReactElement;
@@ -6,3 +6,7 @@ export type CommandSpec = {
6
6
  export declare const COMMANDS: CommandSpec[];
7
7
  /** Commands whose body filters as you type `/<prefix>`. */
8
8
  export declare function filterCommands(input: string): CommandSpec[];
9
+ /** True when the usage has a REQUIRED argument (`<...>` outside optional `[...]`
10
+ brackets). "/rename <name>" requires one; "/sync [pull <path>|--all]" does not —
11
+ palette Enter must submit the latter bare instead of waiting for input forever. */
12
+ export declare function requiresArgument(usage: string): boolean;
@@ -1,13 +1,21 @@
1
1
  export type BannerInfo = {
2
2
  version: string;
3
3
  claude: string;
4
+ /** Resolved model name (alias or full id; 'Claude Code default' when no override). */
5
+ model: string;
6
+ /** Where the model came from, e.g. '.d360-writer.json', '/model setting', 'env'. */
7
+ modelSource: string;
4
8
  who: string | null;
9
+ /** Session-health parenthetical shown after `who` (expiry / refreshing note). */
10
+ sessionHint: string | null;
5
11
  profile: string;
6
12
  apiUrl: string;
7
13
  project: string;
8
14
  cwd: string;
9
15
  prod: boolean;
10
16
  loggedOut: boolean;
17
+ /** Writer-mode boundary line, e.g. 'writer · edits limited to user-docs/ + config'. */
18
+ mode: string;
11
19
  };
12
20
  export type Item = {
13
21
  kind: 'banner';
@@ -28,6 +36,12 @@ export type Item = {
28
36
  lines: string[];
29
37
  hidden: number;
30
38
  isError: boolean;
39
+ } | {
40
+ kind: 'diff';
41
+ added: number;
42
+ removed: number;
43
+ lines: string[];
44
+ hidden: number;
31
45
  } | {
32
46
  kind: 'link';
33
47
  lines: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Standalone documentation agent CLI. Reads your code, writes your docs. Specialized for Document360 publishing.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "scripts": {
16
- "build": "tsc -b",
16
+ "build": "rimraf dist tsconfig.tsbuildinfo && tsc -b && node ../../scripts/bundle.mjs",
17
17
  "clean": "rimraf dist",
18
18
  "prepublishOnly": "npm run build",
19
19
  "test": "vitest run --passWithNoTests"
@@ -33,7 +33,8 @@
33
33
  "dependencies": {
34
34
  "@inquirer/prompts": "^8.4.3",
35
35
  "commander": "^14.0.3",
36
- "document360-engine": "^0.2.0",
36
+ "diff": "^8.0.4",
37
+ "document360-engine": "^0.2.1",
37
38
  "ink": "^5.2.1",
38
39
  "picocolors": "^1.1.1",
39
40
  "react": "^18.3.1",
@@ -55,5 +56,5 @@
55
56
  "claude",
56
57
  "mcp"
57
58
  ],
58
- "license": "MIT"
59
+ "license": "SEE LICENSE IN LICENSE"
59
60
  }
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,E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EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAC3C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- import { resolveActiveProfile } from 'document360-engine';
2
- import { dim, warn } from '../lib/colors.js';
3
- export async function allowProdCommand(_args, ctx) {
4
- let production = false;
5
- try {
6
- production = resolveActiveProfile(ctx.cwd).production;
7
- }
8
- catch {
9
- /* no profile — nothing to allow */
10
- }
11
- if (!production) {
12
- console.log(dim('Current profile is not a production profile — writes are already allowed.'));
13
- return { kind: 'continue' };
14
- }
15
- console.log(warn('⚠ Authorizing writes to the PRODUCTION profile for this session.'));
16
- return { kind: 'allow-prod' };
17
- }
18
- //# sourceMappingURL=allowProd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"allowProd.js","sourceRoot":"","sources":["../../src/commands/allowProd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAe,EAAE,GAAgB;IACtE,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,mCAAmC;IACrC,CAAC;IACD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC,CAAC;QAC9F,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC,CAAC;IACtF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAChC,CAAC"}
@@ -1,12 +0,0 @@
1
- export async function auditCommand() {
2
- const prompt = [
3
- 'Run the audit-docs skill against this repo.',
4
- '',
5
- 'Produce a table with one row per article that needs attention:',
6
- '| Article path | Action (create | update | delete) | Reason | Scope (small | medium | full) |',
7
- '',
8
- 'Cross-reference recent commits (last 30 days or since the d360-category-map.json mtime) with the existing articles and the authoritativeSourceFiles list from .d360-writer.json. Do not start writing anything yet — just produce the audit.',
9
- ].join('\n');
10
- return { kind: 'forward-to-agent', prompt };
11
- }
12
- //# sourceMappingURL=audit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,MAAM,GAAG;QACb,6CAA6C;QAC7C,EAAE;QACF,gEAAgE;QAChE,+FAA+F;QAC/F,EAAE;QACF,8OAA8O;KAC/O,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;AAC9C,CAAC"}
@@ -1,14 +0,0 @@
1
- import { dim } from '../lib/colors.js';
2
- import { getSession } from 'document360-engine';
3
- export async function clearCommand(_args, ctx) {
4
- const uuid = ctx.currentUuid();
5
- const prev = uuid ? getSession(uuid) : undefined;
6
- if (prev) {
7
- console.log(dim(`\n(conversation reset — "${prev.name}" is still available via /resume)\n`));
8
- }
9
- else {
10
- console.log(dim('\n(conversation reset — agent will start fresh on the next prompt)\n'));
11
- }
12
- return { kind: 'clear' };
13
- }
14
- //# sourceMappingURL=clear.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAe,EAAE,GAAgB;IAClE,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,4BAA4B,IAAI,CAAC,IAAI,qCAAqC,CAAC,CAAC,CAAC;IAC/F,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,4 +0,0 @@
1
- export async function exitCommand() {
2
- return { kind: 'exit' };
3
- }
4
- //# sourceMappingURL=exit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exit.js","sourceRoot":"","sources":["../../src/commands/exit.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
@@ -1,30 +0,0 @@
1
- import { accent, bold, dim } from '../lib/colors.js';
2
- export async function helpCommand() {
3
- const lines = [
4
- '',
5
- bold('document360-writer — slash commands'),
6
- '',
7
- ` ${accent('/help')} ${dim('Show this help')}`,
8
- ` ${accent('/init')} ${dim('Scaffold .d360-writer.json in this repo')}`,
9
- ` ${accent('/mcp add <name> <type> <ref>')} ${dim('Register an MCP server (stdio|http|sse; -H key:value for auth)')}`,
10
- ` ${accent('/mcp list')} ${dim('Show registered MCP servers')}`,
11
- ` ${accent('/mcp remove <name>')} ${dim('Unregister an MCP server')}`,
12
- ` ${accent('/publish <article-path>')} ${dim('Publish one article to Document360')}`,
13
- ` ${accent('/audit')} ${dim('Diff code vs existing docs, flag gaps')}`,
14
- ` ${accent('/screenshot <id>')} ${dim('Emit a document360-capture-compatible spec')}`,
15
- ` ${accent('/resume [name]')} ${dim('Resume a session (no arg: searchable picker)')}`,
16
- ` ${accent('/rename <name>')} ${dim('Name the current session')}`,
17
- ` ${accent('/profile [name]')} ${dim('Show profiles, or switch + restart agent')}`,
18
- ` ${accent('/workspace [name]')} ${dim('List or switch the Document360 workspace')}`,
19
- ` ${accent('/allow-prod')} ${dim('Authorize writes to a production profile (this session)')}`,
20
- ` ${accent('/clear')} ${dim('Reset conversation')}`,
21
- ` ${accent('/exit')} ${dim('Quit')}`,
22
- '',
23
- dim('Anything not starting with / is sent to the agent.'),
24
- '',
25
- ];
26
- for (const l of lines)
27
- console.log(l);
28
- return { kind: 'continue' };
29
- }
30
- //# sourceMappingURL=help.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,KAAK,GAAG;QACZ,EAAE;QACF,IAAI,CAAC,qCAAqC,CAAC;QAC3C,EAAE;QACF,KAAK,MAAM,CAAC,OAAO,CAAC,iCAAiC,GAAG,CAAC,gBAAgB,CAAC,EAAE;QAC5E,KAAK,MAAM,CAAC,OAAO,CAAC,iCAAiC,GAAG,CAAC,yCAAyC,CAAC,EAAE;QACrG,KAAK,MAAM,CAAC,8BAA8B,CAAC,UAAU,GAAG,CAAC,gEAAgE,CAAC,EAAE;QAC5H,KA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
- import { initCommand } from './init.js';
5
- import { mcpCommand } from './mcp.js';
6
- import { publishCommand } from './publish.js';
7
- import { auditCommand } from './audit.js';
8
- import { resumeCommand } from './resume.js';
9
- import { renameCommand } from './rename.js';
10
- import { profileCommand } from './profile.js';
11
- import { workspaceCommand } from './workspace.js';
12
- import { allowProdCommand } from './allowProd.js';
13
- import { screenshotCommand } from './screenshot.js';
14
- export const slashCommands = {
15
- help: helpCommand,
16
- '?': helpCommand,
17
- clear: clearCommand,
18
- exit: exitCommand,
19
- quit: exitCommand,
20
- init: initCommand,
21
- mcp: mcpCommand,
22
- publish: publishCommand,
23
- audit: auditCommand,
24
- resume: resumeCommand,
25
- rename: renameCommand,
26
- profile: profileCommand,
27
- workspace: workspaceCommand,
28
- 'allow-prod': allowProdCommand,
29
- screenshot: screenshotCommand,
30
- };
31
- export function isSlashCommand(line) {
32
- return line.trim().startsWith('/');
33
- }
34
- export function parseSlash(line) {
35
- const trimmed = line.trim();
36
- if (!trimmed.startsWith('/'))
37
- return null;
38
- const parts = trimmed.slice(1).split(/\s+/);
39
- const name = (parts[0] ?? '').toLowerCase();
40
- if (!name)
41
- return null;
42
- return { name, args: parts.slice(1) };
43
- }
44
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAA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IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC"}
@@ -1,83 +0,0 @@
1
- import { input, confirm } from '@inquirer/prompts';
2
- import { basename, join } from 'node:path';
3
- import { existsSync, readFileSync } from 'node:fs';
4
- import { writeProjectConfig, readProjectConfig, projectConfigPath } from 'document360-engine';
5
- import { ok, dim, accent } from '../lib/colors.js';
6
- export async function initCommand() {
7
- const cwd = process.cwd();
8
- const path = projectConfigPath(cwd);
9
- if (existsSync(path)) {
10
- const overwrite = await confirm({
11
- message: `${path} already exists. Overwrite?`,
12
- default: false,
13
- });
14
- if (!overwrite) {
15
- console.log(dim('init cancelled.'));
16
- return { kind: 'continue' };
17
- }
18
- }
19
- const defaultProjectId = readPackageName(cwd) ?? basename(cwd);
20
- const projectId = await input({
21
- message: 'Project ID (used to scope sessions, screenshots, etc.):',
22
- default: defaultProjectId,
23
- });
24
- const captureDir = await input({
25
- message: 'Capture directory (where document360-capture .spec.ts files live):',
26
- default: 'user-docs/_capture',
27
- });
28
- const outputDir = await input({
29
- message: 'Screenshot output directory:',
30
- default: 'user-docs/_screenshots',
31
- });
32
- const profileName = await input({
33
- message: 'Default connection profile name:',
34
- default: 'berlin',
35
- });
36
- const environment = await input({
37
- message: 'Document360 environment for this profile (baked preset):',
38
- default: 'berlin',
39
- });
40
- const cfg = {
41
- projectId,
42
- captureDir,
43
- outputDir,
44
- profiles: {
45
- [profileName]: {
46
- connection: { environment },
47
- // project.projectId is auto-filled by `d360-writer login` (project_select).
48
- production: false,
49
- },
50
- },
51
- defaultProfile: profileName,
52
- authoritativeSourceFiles: defaultSourceFiles(cwd),
53
- };
54
- const existing = readProjectConfig(cwd);
55
- if (existing?.terminologyGlossary)
56
- cfg.terminologyGlossary = existing.terminologyGlossary;
57
- writeProjectConfig(cfg, cwd);
58
- console.log('');
59
- console.log(ok(`✓ Wrote ${path}`));
60
- console.log('');
61
- console.log('Next:');
62
- console.log(` ${accent(`d360-writer login --profile ${profileName}`)} ${dim('(sign in; pick the project)')}`);
63
- console.log(` Then ask the agent: "analyze this repo and propose a docs structure"`);
64
- console.log('');
65
- return { kind: 'continue' };
66
- }
67
- function readPackageName(cwd) {
68
- const path = join(cwd, 'package.json');
69
- if (!existsSync(path))
70
- return null;
71
- try {
72
- const pkg = JSON.parse(readFileSync(path, 'utf8'));
73
- return pkg.name ?? null;
74
- }
75
- catch {
76
- return null;
77
- }
78
- }
79
- function defaultSourceFiles(cwd) {
80
- const candidates = ['README.md', 'ARCHITECTURE.md', 'CLAUDE.md', 'src', 'api', 'docs'];
81
- return candidates.filter(c => existsSync(join(cwd, c)));
82
- }
83
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAsB,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAEpC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;YAC9B,OAAO,EAAE,GAAG,IAAI,6BAA6B;YAC7C,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,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AAC"}
@@ -1,31 +0,0 @@
1
- import { existsSync, readdirSync, statSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { apiLogDir } from 'document360-engine';
4
- import { accent, dim } from '../lib/colors.js';
5
- /** `d360-writer logs` — the one command to give a customer reporting a problem. */
6
- export function runLogs() {
7
- const dir = apiLogDir();
8
- console.log('');
9
- console.log(`Document360 API logs: ${accent(dir)}`);
10
- if (!existsSync(dir)) {
11
- console.log(dim(' No logs yet — they appear after the first Document360 API call.'));
12
- console.log('');
13
- return;
14
- }
15
- const files = readdirSync(dir)
16
- .filter(f => f.endsWith('.jsonl'))
17
- .sort()
18
- .reverse();
19
- if (files.length === 0) {
20
- console.log(dim(' No logs yet — they appear after the first Document360 API call.'));
21
- }
22
- for (const f of files.slice(0, 14)) {
23
- const kb = (statSync(join(dir, f)).size / 1024).toFixed(1);
24
- console.log(` ${f} ${dim(`${kb} KB`)}`);
25
- }
26
- console.log('');
27
- console.log(dim('Failed calls include request/response bodies (tokens redacted, 4 KB cap).'));
28
- console.log(dim('Set D360_LOG_BODIES=1 to also log bodies for successful calls.'));
29
- console.log('');
30
- }
31
- //# sourceMappingURL=logsCli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logsCli.js","sourceRoot":"","sources":["../../src/commands/logsCli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE/C,mFAAmF;AACnF,MAAM,UAAU,OAAO;IACrB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC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';
3
- export async function mcpCommand(args) {
4
- const sub = (args[0] ?? '').toLowerCase();
5
- if (sub === 'list' || !sub) {
6
- listServers();
7
- return { kind: 'continue' };
8
- }
9
- if (sub === 'add') {
10
- addServer(args.slice(1));
11
- return { kind: 'continue' };
12
- }
13
- if (sub === 'remove' || sub === 'rm') {
14
- removeServer(args.slice(1));
15
- return { kind: 'continue' };
16
- }
17
- console.log(error(`Unknown /mcp subcommand: ${sub}`));
18
- console.log(dim('Try: /mcp add <name> <stdio|http|sse> <command-or-url>, /mcp list, /mcp remove <name>'));
19
- return { kind: 'continue' };
20
- }
21
- function listServers() {
22
- const cfg = readMcpConfig();
23
- const names = Object.keys(cfg.servers);
24
- if (names.length === 0) {
25
- console.log(dim('\nNo MCP servers registered. Add one with /mcp add <name> <type> <ref>\n'));
26
- return;
27
- }
28
- console.log('');
29
- console.log('Registered MCP servers (~/.document360-writer/mcp.json):');
30
- for (const name of names) {
31
- const e = cfg.servers[name];
32
- if (e.type === 'stdio') {
33
- console.log(` ${accent(name)} ${dim('(stdio)')} ${e.command} ${(e.args ?? []).join(' ')}`);
34
- }
35
- else {
36
- const headerNames = Object.keys(e.headers ?? {});
37
- const headerNote = headerNames.length > 0 ? dim(` [headers: ${headerNames.join(', ')}]`) : '';
38
- console.log(` ${accent(name)} ${dim(`(${e.type})`)} ${e.url}${headerNote}`);
39
- }
40
- }
41
- console.log('');
42
- }
43
- function addServer(args) {
44
- const [name, type, ...rest] = args;
45
- if (!name || !type || rest.length === 0) {
46
- console.log(error('Usage: /mcp add <name> <stdio|http|sse> <command-or-url> [args...] [-H key:value ...]'));
47
- return;
48
- }
49
- if (type !== 'stdio' && type !== 'http' && type !== 'sse') {
50
- console.log(error(`Unknown transport: ${type}. Use stdio, http, or sse.`));
51
- return;
52
- }
53
- const cfg = readMcpConfig();
54
- let entry;
55
- if (type === 'stdio') {
56
- entry = { type: 'stdio', command: rest[0], args: rest.slice(1) };
57
- }
58
- else {
59
- // Headers: -H key:value (or key=value), repeatable. Must be a single token —
60
- // the REPL splits on whitespace, so no spaces around the separator.
61
- const headers = {};
62
- for (let i = 1; i < rest.length; i++) {
63
- if (rest[i] === '-H' || rest[i] === '--header') {
64
- const kv = rest[++i];
65
- const m = kv?.match(/^([^:=]+)[:=](.+)$/);
66
- if (!m) {
67
- console.log(error(`-H expects key:value (no spaces). Got: ${kv ?? '(nothing)'}`));
68
- return;
69
- }
70
- headers[m[1].trim()] = m[2].trim();
71
- }
72
- else {
73
- console.log(error(`Unexpected argument: ${rest[i]}. After the URL, only -H key:value is allowed.`));
74
- return;
75
- }
76
- }
77
- entry = { type, url: rest[0], headers: Object.keys(headers).length > 0 ? headers : undefined };
78
- }
79
- cfg.servers[name] = entry;
80
- writeMcpConfig(cfg);
81
- console.log('');
82
- console.log(ok(`✓ Registered "${name}" (${type})`));
83
- console.log(warn(' This server loads on your next prompt. The current agent session reads MCP config at startup.'));
84
- console.log(dim(' Run /clear if you want the next turn to reload immediately.'));
85
- console.log('');
86
- }
87
- function removeServer(args) {
88
- const name = args[0];
89
- if (!name) {
90
- console.log(error('Usage: /mcp remove <name>'));
91
- return;
92
- }
93
- const cfg = readMcpConfig();
94
- if (!cfg.servers[name]) {
95
- console.log(error(`No server named "${name}".`));
96
- return;
97
- }
98
- delete cfg.servers[name];
99
- writeMcpConfig(cfg);
100
- console.log(ok(`✓ Removed "${name}".`));
101
- console.log(dim(' Run /clear to drop it from the current session immediately.'));
102
- }
103
- //# sourceMappingURL=mcp.js.map