document360-writer 0.3.1 → 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 (82) hide show
  1. package/LICENSE +10 -16
  2. package/README.md +1 -1
  3. package/dist/cli.js +63 -118
  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/logsCli.d.ts +2 -0
  9. package/dist/commands/model.d.ts +16 -0
  10. package/dist/commands/profile.d.ts +3 -0
  11. package/dist/commands/publish.d.ts +12 -1
  12. package/dist/commands/scope.d.ts +9 -0
  13. package/dist/commands/sync.d.ts +8 -0
  14. package/dist/d360/authCli.d.ts +3 -0
  15. package/dist/d360/portalLink.d.ts +18 -0
  16. package/dist/lib/colors.d.ts +2 -0
  17. package/dist/lib/commandSuggest.d.ts +7 -0
  18. package/dist/lib/diffRender.d.ts +8 -0
  19. package/dist/lib/hyperlink.d.ts +5 -0
  20. package/dist/lib/inputLayout.d.ts +19 -0
  21. package/dist/lib/mascot.d.ts +5 -0
  22. package/dist/lib/mdRender.d.ts +7 -0
  23. package/dist/lib/modelChoices.d.ts +14 -0
  24. package/dist/lib/paste.d.ts +19 -0
  25. package/dist/lib/streaming.d.ts +23 -0
  26. package/dist/lib/syncRender.d.ts +6 -0
  27. package/dist/lib/toolFormat.d.ts +30 -0
  28. package/dist/repl.d.ts +2 -0
  29. package/dist/tui/App.d.ts +1 -1
  30. package/dist/tui/catalog.d.ts +4 -0
  31. package/dist/tui/itemRender.d.ts +70 -0
  32. package/package.json +8 -5
  33. package/dist/cli.js.map +0 -1
  34. package/dist/commands/allowProd.js +0 -18
  35. package/dist/commands/allowProd.js.map +0 -1
  36. package/dist/commands/audit.js +0 -12
  37. package/dist/commands/audit.js.map +0 -1
  38. package/dist/commands/clear.js +0 -14
  39. package/dist/commands/clear.js.map +0 -1
  40. package/dist/commands/exit.js +0 -4
  41. package/dist/commands/exit.js.map +0 -1
  42. package/dist/commands/help.js +0 -30
  43. package/dist/commands/help.js.map +0 -1
  44. package/dist/commands/index.js +0 -44
  45. package/dist/commands/index.js.map +0 -1
  46. package/dist/commands/init.js +0 -83
  47. package/dist/commands/init.js.map +0 -1
  48. package/dist/commands/mcp.js +0 -103
  49. package/dist/commands/mcp.js.map +0 -1
  50. package/dist/commands/profile.js +0 -16
  51. package/dist/commands/profile.js.map +0 -1
  52. package/dist/commands/publish.js +0 -19
  53. package/dist/commands/publish.js.map +0 -1
  54. package/dist/commands/rename.js +0 -22
  55. package/dist/commands/rename.js.map +0 -1
  56. package/dist/commands/resume.js +0 -58
  57. package/dist/commands/resume.js.map +0 -1
  58. package/dist/commands/screenshot.js +0 -20
  59. package/dist/commands/screenshot.js.map +0 -1
  60. package/dist/commands/workspace.js +0 -8
  61. package/dist/commands/workspace.js.map +0 -1
  62. package/dist/d360/authCli.js +0 -106
  63. package/dist/d360/authCli.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/oneShot.js +0 -96
  71. package/dist/oneShot.js.map +0 -1
  72. package/dist/repl.js +0 -244
  73. package/dist/repl.js.map +0 -1
  74. package/dist/tui/App.js +0 -439
  75. package/dist/tui/App.js.map +0 -1
  76. package/dist/tui/catalog.js +0 -21
  77. package/dist/tui/catalog.js.map +0 -1
  78. package/dist/tui/index.js +0 -24
  79. package/dist/tui/index.js.map +0 -1
  80. package/dist/tui/markdown.d.ts +0 -4
  81. package/dist/tui/markdown.js +0 -139
  82. package/dist/tui/markdown.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>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Deep links into the Document360 author portal, surfaced after the agent creates or
3
+ * updates an article so the real rendered outcome is one click away.
4
+ *
5
+ * NOTE: the editor path shape (`/{projectId}/document/v1/{lang}/{articleId}`) is a
6
+ * best-effort guess pending verification against the berlin portal during dogfood —
7
+ * if it 404s, fix it HERE (single source) or override the base via the profile's
8
+ * `connection.portalUrl` / `D360_PORTAL_URL`.
9
+ */
10
+ /** Portal editor URL for a draft article. */
11
+ export declare function articleEditorUrl(portalUrl: string, projectId: string, articleId: string, languageCode?: string): string;
12
+ /**
13
+ * Pull the article id out of a write-tool exchange: update/fork/publish carry it in
14
+ * the input; create returns it in the result (bulk-create → array with one item).
15
+ */
16
+ export declare function extractArticleId(input: Record<string, unknown>, output: string): string | null;
17
+ /** Public KB URL from a tool result, if the API returned one (live after publish). */
18
+ export declare function extractPublicUrl(output: string): string | null;
@@ -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,7 @@
1
+ /** Render inline **bold**, *italic*, `code` as ANSI-styled spans. */
2
+ export declare function inlineMd(text: string): string;
3
+ /**
4
+ * Render finalized markdown to an ANSI string. Blocks are joined with one blank line
5
+ * (uniform spacing — source blocks are blank-line separated, so render them so).
6
+ */
7
+ export declare function renderMarkdown(md: string, width: number): 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,23 @@
1
+ /**
2
+ * Streaming-markdown flush support. While the agent streams, completed paragraphs are
3
+ * flushed into the static (markdown-rendered) transcript so what scrolls out of the
4
+ * viewport is already pretty — Ink can only repaint what's still on screen, so raw
5
+ * streamed text left in scrollback stays raw forever (Claude Code flushes the same way).
6
+ */
7
+ /**
8
+ * Cut position after the last blank line that lies outside any ``` fence, or 0 when
9
+ * there's no safe cut yet. Text before the cut is a complete run of markdown blocks
10
+ * (a fence keeps code blocks intact; tables/lists have no internal blank lines).
11
+ */
12
+ /**
13
+ * Tail of the live streaming buffer, capped to ~maxRows visual rows so the dynamic
14
+ * region can never outgrow the viewport — Ink erases the live area by line count, and
15
+ * anything that scrolls off-screen leaves un-repaintable raw frames in scrollback.
16
+ * Row usage is estimated as ceil(len/width) per source line (Ink word-wraps, so this
17
+ * is approximate — callers should leave headroom when picking maxRows).
18
+ */
19
+ export declare function liveTail(text: string, maxRows: number, width: number): {
20
+ text: string;
21
+ truncated: boolean;
22
+ };
23
+ export declare function streamCut(text: string): number;
@@ -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[];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Claude Code-style formatting of tool calls and results for terminal display.
3
+ * Pure functions — shared by the Ink TUI and the plain REPL renderer.
4
+ *
5
+ * ● Bash(npm run build)
6
+ * ⎿ first lines of output…
7
+ * … +12 lines
8
+ */
9
+ /** `sep` goes between title and `(arg)`: built-ins are tight (`Bash(…)`, Claude Code
10
+ * style); MCP titles read as words, so they get a space (`Document360: get article (…)`). */
11
+ export type ToolHeader = {
12
+ title: string;
13
+ sep: '' | ' ';
14
+ arg: string | null;
15
+ };
16
+ export type ToolResultView = {
17
+ lines: string[];
18
+ hidden: number;
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;
23
+ /**
24
+ * Header line for a tool call: display title + inline argument summary.
25
+ * Returns null for internal tools that should stay hidden.
26
+ */
27
+ export declare function formatToolUse(name: string, input: Record<string, unknown>): ToolHeader | null;
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;
@@ -0,0 +1,70 @@
1
+ export type BannerInfo = {
2
+ version: string;
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;
8
+ who: string | null;
9
+ /** Session-health parenthetical shown after `who` (expiry / refreshing note). */
10
+ sessionHint: string | null;
11
+ profile: string;
12
+ apiUrl: string;
13
+ project: string;
14
+ cwd: string;
15
+ prod: boolean;
16
+ loggedOut: boolean;
17
+ /** Writer-mode boundary line, e.g. 'writer · edits limited to user-docs/ + config'. */
18
+ mode: string;
19
+ };
20
+ export type Item = {
21
+ kind: 'banner';
22
+ info: BannerInfo;
23
+ } | {
24
+ kind: 'user';
25
+ text: string;
26
+ } | {
27
+ kind: 'assistant';
28
+ text: string;
29
+ } | {
30
+ kind: 'tool';
31
+ title: string;
32
+ sep: string;
33
+ arg: string | null;
34
+ } | {
35
+ kind: 'tool-result';
36
+ lines: string[];
37
+ hidden: number;
38
+ isError: boolean;
39
+ } | {
40
+ kind: 'diff';
41
+ added: number;
42
+ removed: number;
43
+ lines: string[];
44
+ hidden: number;
45
+ } | {
46
+ kind: 'link';
47
+ lines: string[];
48
+ } | {
49
+ kind: 'preview';
50
+ name: string;
51
+ text: string;
52
+ } | {
53
+ kind: 'note';
54
+ text: string;
55
+ tone: 'info' | 'warn' | 'error' | 'ok';
56
+ } | {
57
+ kind: 'done';
58
+ seconds: number;
59
+ tokens: number;
60
+ ok: boolean;
61
+ };
62
+ export declare function formatDuration(seconds: number): string;
63
+ /**
64
+ * Render one item to an ANSI string. Each item owns the single blank line ABOVE
65
+ * itself (leading \n) — except tool-result/link, which attach directly under their
66
+ * tool header, and the banner, which is always first.
67
+ */
68
+ export declare function renderItem(item: Item, width: number): string;
69
+ /** Re-render the whole transcript (resize replay). */
70
+ export declare function renderTranscript(items: Item[], width: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document360-writer",
3
- "version": "0.3.1",
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,10 +33,13 @@
33
33
  "dependencies": {
34
34
  "@inquirer/prompts": "^8.4.3",
35
35
  "commander": "^14.0.3",
36
- "document360-engine": "^0.1.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
- "react": "^18.3.1"
40
+ "react": "^18.3.1",
41
+ "string-width": "^7.2.0",
42
+ "wrap-ansi": "^9.0.2"
40
43
  },
41
44
  "devDependencies": {
42
45
  "@types/node": "^22.10.0",
@@ -53,5 +56,5 @@
53
56
  "claude",
54
57
  "mcp"
55
58
  ],
56
- "license": "MIT"
59
+ "license": "SEE LICENSE IN LICENSE"
57
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,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM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nE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAgB,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACjG,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QAC7F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,2EAA2E;IAC3E,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzC,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAgB,EAAE,IAAI,CAAC,OAAO,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,KAAK,MAAM,CAAC,WAAW,CAAC,6BAA6B,GAAG,CAAC,6BAA6B,CAAC,EAAE;QACzF,KAAK,MAAM,CAAC,oBAAoB,CAAC,oBAAoB,GAAG,CAAC,0BAA0B,CAAC,EAAE;QACtF,KAAK,MAAM,CAAC,yBAAyB,CAAC,eAAe,GAAG,CAAC,oCAAoC,CAAC,EAAE;QAChG,KAAK,MAAM,CAAC,QAAQ,CAAC,gCAAgC,GAAG,CAAC,uCAAuC,CAAC,EAAE;QACnG,KAAK,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,GAAG,CAAC,4CAA4C,CAAC,EAAE;QACxG,KAAK,MAAM,CAAC,gBAAgB,CAAC,wBAAwB,GAAG,CAAC,8CAA8C,CAAC,EAAE;QAC1G,KAAK,MAAM,CAAC,gBAAgB,CAAC,wBAAwB,GAAG,CAAC,0BAA0B,CAAC,EAAE;QACtF,KAAK,MAAM,CAAC,iBAAiB,CAAC,uBAAuB,GAAG,CAAC,0CAA0C,CAAC,EAAE;QACtG,KAAK,MAAM,CAAC,mBAAmB,CAAC,qBAAqB,GAAG,CAAC,0CAA0C,CAAC,EAAE;QACtG,KAAK,MAAM,CAAC,aAAa,CAAC,2BAA2B,GAAG,CAAC,yDAAyD,CAAC,EAAE;QACrH,KAAK,MAAM,CAAC,QAAQ,CAAC,gCAAgC,GAAG,CAAC,oBAAoB,CAAC,EAAE;QAChF,KAAK,MAAM,CAAC,OAAO,CAAC,iCAAiC,GAAG,CAAC,MAAM,CAAC,EAAE;QAClE,EAAE;QACF,GAAG,CAAC,oDAAoD,CAAC;QACzD,EAAE;KACH,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9B,CAAC"}
@@ -1,44 +0,0 @@
1
- import { helpCommand } from './help.js';
2
- import { clearCommand } from './clear.js';
3
- import { exitCommand } from './exit.js';
4
- 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,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAapD,MAAM,CAAC,MAAM,aAAa,GAAiC;IACzD,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,gBAAgB;IAC9B,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,EAAE,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
-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