document360-writer 0.2.0 → 0.3.0

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 (77) hide show
  1. package/dist/cli.js +65 -3
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/allowProd.d.ts +3 -0
  4. package/dist/commands/allowProd.js +18 -0
  5. package/dist/commands/allowProd.js.map +1 -0
  6. package/dist/commands/clear.js +1 -1
  7. package/dist/commands/clear.js.map +1 -1
  8. package/dist/commands/help.js +3 -1
  9. package/dist/commands/help.js.map +1 -1
  10. package/dist/commands/index.d.ts +2 -0
  11. package/dist/commands/index.js +4 -0
  12. package/dist/commands/index.js.map +1 -1
  13. package/dist/commands/init.js +15 -17
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/mcp.js +24 -4
  16. package/dist/commands/mcp.js.map +1 -1
  17. package/dist/commands/profile.d.ts +3 -0
  18. package/dist/commands/profile.js +16 -0
  19. package/dist/commands/profile.js.map +1 -0
  20. package/dist/commands/rename.js +1 -1
  21. package/dist/commands/rename.js.map +1 -1
  22. package/dist/commands/resume.js +1 -1
  23. package/dist/commands/resume.js.map +1 -1
  24. package/dist/d360/authCli.d.ts +10 -0
  25. package/dist/d360/authCli.js +91 -0
  26. package/dist/d360/authCli.js.map +1 -0
  27. package/dist/d360/profileCli.d.ts +3 -0
  28. package/dist/d360/profileCli.js +54 -0
  29. package/dist/d360/profileCli.js.map +1 -0
  30. package/dist/oneShot.d.ts +2 -2
  31. package/dist/oneShot.js +59 -59
  32. package/dist/oneShot.js.map +1 -1
  33. package/dist/repl.d.ts +2 -2
  34. package/dist/repl.js +72 -82
  35. package/dist/repl.js.map +1 -1
  36. package/dist/tui/App.d.ts +9 -0
  37. package/dist/tui/App.js +413 -0
  38. package/dist/tui/App.js.map +1 -0
  39. package/dist/tui/catalog.d.ts +8 -0
  40. package/dist/tui/catalog.js +20 -0
  41. package/dist/tui/catalog.js.map +1 -0
  42. package/dist/tui/index.d.ts +3 -0
  43. package/dist/tui/index.js +24 -0
  44. package/dist/tui/index.js.map +1 -0
  45. package/dist/tui/markdown.d.ts +4 -0
  46. package/dist/tui/markdown.js +139 -0
  47. package/dist/tui/markdown.js.map +1 -0
  48. package/package.json +8 -5
  49. package/dist/agent.d.ts +0 -6
  50. package/dist/agent.js +0 -94
  51. package/dist/agent.js.map +0 -1
  52. package/dist/config.d.ts +0 -40
  53. package/dist/config.js +0 -42
  54. package/dist/config.js.map +0 -1
  55. package/dist/lib/auth.d.ts +0 -14
  56. package/dist/lib/auth.js +0 -25
  57. package/dist/lib/auth.js.map +0 -1
  58. package/dist/lib/messageQueue.d.ts +0 -9
  59. package/dist/lib/messageQueue.js +0 -40
  60. package/dist/lib/messageQueue.js.map +0 -1
  61. package/dist/lib/paths.d.ts +0 -9
  62. package/dist/lib/paths.js +0 -35
  63. package/dist/lib/paths.js.map +0 -1
  64. package/dist/lib/sessionStore.d.ts +0 -24
  65. package/dist/lib/sessionStore.js +0 -100
  66. package/dist/lib/sessionStore.js.map +0 -1
  67. package/dist/lib/titleGen.d.ts +0 -7
  68. package/dist/lib/titleGen.js +0 -64
  69. package/dist/lib/titleGen.js.map +0 -1
  70. package/skills/CLAUDE.md +0 -92
  71. package/skills/analyze-codebase/SKILL.md +0 -35
  72. package/skills/audit-docs/SKILL.md +0 -48
  73. package/skills/emit-screenshot-spec/SKILL.md +0 -82
  74. package/skills/gather-context-from-mcp/SKILL.md +0 -29
  75. package/skills/propose-structure/SKILL.md +0 -51
  76. package/skills/publish-to-d360/SKILL.md +0 -39
  77. package/skills/write-article/SKILL.md +0 -95
@@ -1,100 +0,0 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { sessionsFilePath, userDir, ensureDir } from './paths.js';
3
- const MAX_RECORDS = 100;
4
- export function loadSessions() {
5
- const path = sessionsFilePath();
6
- if (!existsSync(path))
7
- return [];
8
- try {
9
- const parsed = JSON.parse(readFileSync(path, 'utf8'));
10
- return Array.isArray(parsed) ? parsed : [];
11
- }
12
- catch {
13
- return [];
14
- }
15
- }
16
- function saveSessions(records) {
17
- ensureDir(userDir());
18
- const sorted = [...records].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt)).slice(0, MAX_RECORDS);
19
- writeFileSync(sessionsFilePath(), JSON.stringify(sorted, null, 2));
20
- }
21
- export function upsertSession(rec) {
22
- const records = loadSessions().filter(r => r.uuid !== rec.uuid);
23
- records.push(rec);
24
- saveSessions(records);
25
- }
26
- export function getSession(uuid) {
27
- return loadSessions().find(r => r.uuid === uuid);
28
- }
29
- export function listSessions(cwd) {
30
- return loadSessions()
31
- .filter(r => r.cwd === cwd)
32
- .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
33
- }
34
- /** Exact name match first, then unique name-prefix, then unique uuid-prefix. */
35
- export function findByName(cwd, name) {
36
- const sessions = listSessions(cwd);
37
- const lower = name.toLowerCase();
38
- const exact = sessions.find(r => r.name.toLowerCase() === lower);
39
- if (exact)
40
- return exact;
41
- const prefix = sessions.filter(r => r.name.toLowerCase().startsWith(lower));
42
- if (prefix.length === 1)
43
- return prefix[0];
44
- const byUuid = sessions.filter(r => r.uuid.startsWith(name));
45
- if (byUuid.length === 1)
46
- return byUuid[0];
47
- return undefined;
48
- }
49
- export function touchSession(uuid) {
50
- const records = loadSessions();
51
- const rec = records.find(r => r.uuid === uuid);
52
- if (!rec)
53
- return;
54
- rec.updatedAt = new Date().toISOString();
55
- saveSessions(records);
56
- }
57
- export function renameSession(uuid, name) {
58
- const records = loadSessions();
59
- const rec = records.find(r => r.uuid === uuid);
60
- if (!rec)
61
- return false;
62
- rec.name = name;
63
- rec.renamed = true;
64
- rec.updatedAt = new Date().toISOString();
65
- saveSessions(records);
66
- return true;
67
- }
68
- /** Apply an auto-generated title. No-op if the user already renamed the session. */
69
- export function setTitle(uuid, title) {
70
- const records = loadSessions();
71
- const rec = records.find(r => r.uuid === uuid);
72
- if (!rec || rec.renamed)
73
- return;
74
- rec.name = title;
75
- rec.titled = true;
76
- saveSessions(records);
77
- }
78
- export function slugify(text, maxWords = 6) {
79
- const words = text
80
- .toLowerCase()
81
- .replace(/[^a-z0-9\s-]/g, '')
82
- .split(/\s+/)
83
- .filter(Boolean)
84
- .slice(0, maxWords);
85
- return words.join('-') || 'session';
86
- }
87
- export function relativeTime(iso) {
88
- const ms = Date.now() - new Date(iso).getTime();
89
- const min = Math.floor(ms / 60_000);
90
- if (min < 1)
91
- return 'just now';
92
- if (min < 60)
93
- return `${min}m ago`;
94
- const hr = Math.floor(min / 60);
95
- if (hr < 24)
96
- return `${hr}h ago`;
97
- const day = Math.floor(hr / 24);
98
- return `${day}d ago`;
99
- }
100
- //# sourceMappingURL=sessionStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionStore.js","sourceRoot":"","sources":["../../src/lib/sessionStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAelE,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;IAChC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,OAAwB;IAC5C,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IACr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IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IAC/B,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,GAAG,OAAO,CAAC;IACnC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,EAAE;QAAE,OAAO,GAAG,EAAE,OAAO,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAChC,OAAO,GAAG,GAAG,OAAO,CAAC;AACvB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * One-shot background Haiku call to title a session, Claude Code-style.
3
- * Goes through the Agent SDK (not the raw API) so it works in both API-key
4
- * and subscription auth modes. Returns null on any failure — callers keep
5
- * the slug fallback.
6
- */
7
- export declare function generateTitle(firstPrompt: string, cwd: string): Promise<string | null>;
@@ -1,64 +0,0 @@
1
- import { query } from '@anthropic-ai/claude-agent-sdk';
2
- const TIMEOUT_MS = 60_000;
3
- /**
4
- * One-shot background Haiku call to title a session, Claude Code-style.
5
- * Goes through the Agent SDK (not the raw API) so it works in both API-key
6
- * and subscription auth modes. Returns null on any failure — callers keep
7
- * the slug fallback.
8
- */
9
- export async function generateTitle(firstPrompt, cwd) {
10
- try {
11
- const result = await Promise.race([run(firstPrompt, cwd), timeout()]);
12
- return result;
13
- }
14
- catch {
15
- return null;
16
- }
17
- }
18
- async function run(firstPrompt, cwd) {
19
- const q = query({
20
- prompt: [
21
- 'Generate a short session title for a documentation-writing session that started with this request:',
22
- '',
23
- firstPrompt.slice(0, 500),
24
- '',
25
- 'Reply with ONLY the title: 3-6 words, lowercase, kebab-case, no quotes, no punctuation.',
26
- ].join('\n'),
27
- options: {
28
- cwd,
29
- model: 'haiku',
30
- maxTurns: 1,
31
- settingSources: [],
32
- systemPrompt: 'You generate terse kebab-case session titles. Output only the title, nothing else.',
33
- allowedTools: [],
34
- },
35
- });
36
- for await (const msg of q) {
37
- const m = msg;
38
- if (m.type === 'result') {
39
- if (m.subtype === 'success' && typeof m.result === 'string') {
40
- return sanitize(m.result);
41
- }
42
- return null;
43
- }
44
- }
45
- return null;
46
- }
47
- function timeout() {
48
- return new Promise(resolve => setTimeout(() => resolve(null), TIMEOUT_MS).unref());
49
- }
50
- function sanitize(raw) {
51
- const title = raw
52
- .trim()
53
- .toLowerCase()
54
- .replace(/[^a-z0-9\s-]/g, '')
55
- .replace(/\s+/g, '-')
56
- .replace(/-+/g, '-')
57
- .replace(/^-|-$/g, '')
58
- .split('-')
59
- .slice(0, 8)
60
- .join('-')
61
- .slice(0, 60);
62
- return title.length >= 3 ? title : null;
63
- }
64
- //# sourceMappingURL=titleGen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"titleGen.js","sourceRoot":"","sources":["../../src/lib/titleGen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,GAAW;IAClE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,KAAK,UAAU,GAAG,CAAC,WAAmB,EAAE,GAAW;IACjD,MAAM,CAAC,GAAG,KAAK,CAAC;QACd,MAAM,EAAE;YACN,oGAAoG;YACpG,EAAE;YACF,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YACzB,EAAE;YACF,yFAAyF;SAC1F,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,OAAO,EA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AAC,IAAI,CAAC;AAC1C,CAAC"}
package/skills/CLAUDE.md DELETED
@@ -1,92 +0,0 @@
1
- # document360-writer — system prompt
2
-
3
- You are a documentation engineer working from inside the user's source repository. You read code, you write user-facing technical documentation, and you publish to Document360. You are precise, terse, and you never fabricate.
4
-
5
- ## What you own
6
-
7
- - Reading the codebase to ground every claim in source.
8
- - Proposing documentation structure when one doesn't exist.
9
- - Authoring articles in markdown with the structure the user has standardized on.
10
- - Emitting screenshot placeholders that downstream tools (`document360-capture`) can act on.
11
- - Dual-publishing to Document360 via MCP when the user asks.
12
-
13
- ## What you do NOT own
14
-
15
- - `git commit` / `git push` — the user handles version control.
16
- - Taking screenshots — you write placeholder instructions an intern (or a paired CLI) can act on.
17
- - Publishing past the draft stage — every D360 write is a draft; the human reviews and publishes manually in the portal.
18
-
19
- ## Voice and style
20
-
21
- - Second person ("you"). Imperative ("Click Save", not "The user should click Save").
22
- - No marketing language. Banned: "simply", "just", "easily", "powerful", "seamless", "robust", "with one click", "right out of the box".
23
- - Be specific. If a button is labelled "+ Add", write "+ Add" — not "the add button".
24
- - Short paragraphs. Sentences average 15 words.
25
-
26
- ## Article structure
27
-
28
- Every article follows this skeleton verbatim unless the user has overridden it in their project config:
29
-
30
- ```
31
- # <Article title>
32
-
33
- <one-paragraph intro: what this article is for, who it's for, when to use it>
34
-
35
- ## Prerequisites
36
- - <required role / permissions>
37
- - <required state / setup>
38
-
39
- ## Steps
40
- 1. <action>
41
- 2. <action>
42
- 3. ...
43
-
44
- ## Tips & notes
45
- - <gotcha or pro tip>
46
-
47
- ## Related articles
48
- - [<title>](<relative-path>.md)
49
- ```
50
-
51
- ## Markdown rules
52
-
53
- - Markdown only. Document360's API expects `contentType=0`.
54
- - One H1 per article. Use `##` for sections, `###` for subsections.
55
- - Code fences with language tag where applicable (`bash`, `json`, `tsx`, ...).
56
- - Tables for structured comparison; bullet lists otherwise.
57
-
58
- ## Document360 publish form
59
-
60
- When publishing (only when explicitly asked, via `publish-to-d360` skill), transform the markdown:
61
-
62
- - Strip the H1 line. Document360 stores the title separately and renders it itself.
63
- - Strip every `<!-- SCREENSHOT ... -->` HTML comment block. Keep the visible `[Screenshot: ...]` line.
64
- - Convert relative cross-article links (e.g. `[Foo](../03-foo.md)`) to plain-text references like `See "Foo" → "Intro"`. Document360 handles cross-linking differently.
65
- - Everything else passes through verbatim.
66
-
67
- ## Terminology
68
-
69
- The user's `.d360-writer.json` includes a `terminologyGlossary` map. Treat its keys/values as authoritative. Never substitute synonyms — if the glossary says "say 'flow' not 'workflow'", that's a hard rule.
70
-
71
- ## Sourcing rule (never fabricate)
72
-
73
- Before writing any article that describes UI strings, button labels, routes, or behavior:
74
-
75
- 1. Read the source files listed in `.d360-writer.json` `authoritativeSourceFiles`.
76
- 2. Quote what the code actually does. If you can't find it, say so and ask the user.
77
- 3. Never invent button labels, file paths, or behaviors that you didn't read.
78
-
79
- If a feature is role-gated, state the required role in **Prerequisites** — not buried in Steps.
80
-
81
- ## Skill activation
82
-
83
- The "Capabilities" section below lists specialized skills. Pick the right one based on the user's request:
84
-
85
- - "analyze this repo" / "what should the docs look like" → `analyze-codebase`, then `propose-structure`.
86
- - "write the install guide" / "document feature X" → `write-article`.
87
- - "/audit" / "what's stale" → `audit-docs`.
88
- - "/publish ..." → `publish-to-d360`.
89
- - "/screenshot ..." or any time you generate a screenshot placeholder → also call `emit-screenshot-spec`.
90
- - Pulling extra context from other MCP sources during write-article → `gather-context-from-mcp`.
91
-
92
- If the user's intent is ambiguous, ask before invoking a skill that writes files or publishes.
@@ -1,35 +0,0 @@
1
- # Skill: analyze-codebase
2
-
3
- **Activate when** the user asks to "analyze the repo", "look around", "what should the docs cover", or any open-ended discovery question.
4
-
5
- **Goal:** produce a grounded report of what's in the repo, suitable for proposing a documentation structure.
6
-
7
- ## What to read
8
-
9
- 1. `README.md` (or any root-level readme variant).
10
- 2. The package manifest: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, etc.
11
- 3. `CLAUDE.md` and `ARCHITECTURE.md` if present.
12
- 4. The top-level layout: `src/`, `app/`, `lib/`, `cmd/`, `pkg/`, etc. — list directories, don't read every file.
13
- 5. The last 50 commit messages (`git log --oneline -50`) to see the cadence and recent changes.
14
- 6. Any directory named `docs/`, `user-docs/`, `documentation/`, or `wiki/` if present.
15
-
16
- ## What to produce
17
-
18
- A short report with these sections, in this order:
19
-
20
- 1. **Product surface** — what does this software do, from the perspective of the end user (not the developer)?
21
- 2. **User segments** — who uses it? Roles, personas if you can identify them.
22
- 3. **Major features** — list as many as you can find evidence for. Quote the source for each (file path or commit hash).
23
- 4. **Existing documentation** — if any. What's there, what's stale, what's missing.
24
- 5. **Recommended next step** — usually "propose-structure". If docs already exist, "audit-docs".
25
-
26
- ## Rules
27
-
28
- - Do not propose a docs structure yet. That's a separate skill.
29
- - Do not write any articles in this phase.
30
- - Cite file paths for every claim. "FlowForge has a Spec Manager (src/pages/SpecFilesPage.tsx)" — not "FlowForge has spec management".
31
- - Keep the report under 600 words. Brevity matters; the user is going to read this.
32
-
33
- ## When you can't find something
34
-
35
- If the repo is small or undocumented and you genuinely cannot tell what it does, say so. Ask the user one targeted question that would unblock you. Do not guess.
@@ -1,48 +0,0 @@
1
- # Skill: audit-docs
2
-
3
- **Activate when** the user runs `/audit` or asks "what's stale", "what's missing", "where are the gaps".
4
-
5
- **Goal:** produce a table of articles that need attention, with a concrete reason per row.
6
-
7
- ## What to do
8
-
9
- 1. Read `.d360-writer.json` for the `captureDir`, `outputDir`, and `authoritativeSourceFiles` list.
10
- 2. Read every existing article under the docs root (typically `user-docs/`).
11
- 3. Read recent git history: `git log --since="30 days ago" --name-only --pretty=format:"%h %s"`. If `d360-category-map.json` exists, prefer commits since its mtime.
12
- 4. For each commit, identify which articles describe the affected code paths. Cross-reference using the authoritative source files list and the article-to-code links you can infer.
13
- 5. For each existing article, check whether its claims still match the source code. Look for: renamed components, changed UI strings, removed features, added features.
14
-
15
- ## Output format
16
-
17
- A single markdown table. Nothing else.
18
-
19
- | Article path | Action | Reason | Scope |
20
- |---|---|---|---|
21
- | `03-foo/02-bar.md` | update | commit `abc123` renamed the "Bar" dialog to "Settings" | small |
22
- | `04-baz/06-new-feature.md` | create | commit `def456` shipped a feature with no doc | full article |
23
- | `02-spec/04-old-thing.md` | delete | commit `ghi789` removed the feature; no replacement | full deletion |
24
-
25
- ## Action values
26
-
27
- - `create` — article doesn't exist, but the feature it would describe is real and shipped.
28
- - `update` — article exists but disagrees with current code.
29
- - `delete` — article describes a removed feature.
30
- - `keep` — explicitly noted as up-to-date and intentional. Don't include `keep` rows unless the user asked for them.
31
-
32
- ## Scope values
33
-
34
- - `small` — a UI string, a step renumbering, a one-line clarification.
35
- - `medium` — a section rewrite or a new screenshot.
36
- - `full article` — net-new article or near-complete rewrite.
37
- - `full deletion` — remove from disk and from D360.
38
-
39
- ## Rules
40
-
41
- - Quote the commit hash for every claim. No vague "the code changed."
42
- - Do not start fixing anything. The audit is the deliverable.
43
- - If the codebase has zero existing articles, redirect the user to `propose-structure` instead and emit nothing.
44
- - If the audit has zero rows, say so plainly: "All articles are in sync with the codebase as of `<HEAD-sha>`."
45
-
46
- End your output with:
47
-
48
- > Want me to start working through these? Reply with `yes` or strike rows you want to defer.
@@ -1,82 +0,0 @@
1
- # Skill: emit-screenshot-spec
2
-
3
- **Activate when** you've just emitted a `<!-- SCREENSHOT ... -->` placeholder block in an article, OR the user runs `/screenshot <id>`.
4
-
5
- **Goal:** generate a Playwright `.spec.ts` file in the configured `captureDir` that the `document360-capture` (alias `d360-capture`) CLI can execute end-to-end against the user's running product.
6
-
7
- ## Where the spec lands
8
-
9
- `<captureDir>/<placeholder.id>.spec.ts` — read `captureDir` from `.d360-writer.json` (default: `user-docs/_capture`).
10
-
11
- ## Spec template
12
-
13
- ```typescript
14
- import { test } from '@playwright/test';
15
- import { waitPastLogin, dumpAnnotations, type Placeholder } from 'document360-capture/helpers';
16
-
17
- const PLACEHOLDER: Placeholder = {
18
- id: '<placeholder.id>',
19
- saveTo: '<placeholder.save-to>',
20
- highlight: [
21
- // one stable selector per placeholder.highlight entry
22
- ],
23
- annotations: [
24
- // { target: '<stable selector>', label: '1', text: '<short text>' }
25
- ],
26
- redact: [
27
- // one stable selector per placeholder.redact entry
28
- ],
29
- };
30
-
31
- test('<placeholder.id>', async ({ page }) => {
32
- await page.goto(process.env.CAPTURE_START_URL!);
33
- await waitPastLogin(page, new RegExp(process.env.CAPTURE_AUTH_BOUNDARY!));
34
-
35
- // Translated from placeholder.steps — one Playwright action per step.
36
- // Use STABLE selectors only.
37
- // ...
38
-
39
- await page.waitForSelector('<target state selector>', { state: 'visible' });
40
- await page.waitForTimeout(500);
41
-
42
- await page.locator('<capture target selector>').screenshot({ path: PLACEHOLDER.saveTo });
43
- await dumpAnnotations(page, PLACEHOLDER);
44
- });
45
- ```
46
-
47
- ## Selector quality rule (non-negotiable)
48
-
49
- Use stable selectors in this priority order:
50
-
51
- 1. `[data-testid="..."]` — best.
52
- 2. `[aria-label="..."]` — good.
53
- 3. `<role>:has-text("...")` / `role=button[name="..."]` — acceptable when unique.
54
- 4. Visible text (`text=...`, `:has-text(...)`) — acceptable for top-level nav and unique buttons.
55
-
56
- **Never** use CSS classes, `nth-child`, deep DOM paths, or auto-generated IDs (`#mui-12345`).
57
-
58
- ## TODO escape hatch (when stable selectors don't exist)
59
-
60
- If a required interaction has no stable selector, do NOT write a fragile one. Instead:
61
-
62
- 1. Use `test.skip(...)` instead of `test(...)`.
63
- 2. Add a top-of-file comment: `// TODO: add data-testid="<suggested-name>" to <ComponentName> at <src/.../File.tsx>. Capture spec disabled until then.`
64
- 3. Tell the user which file + component to fix, plus the `data-testid` value you'd recommend.
65
-
66
- The manual intern path in the placeholder still works — only the automated capture is blocked.
67
-
68
- ## Capture region (the placeholder's `capture` field)
69
-
70
- | `capture` value | Spec uses |
71
- |---|---|
72
- | `full-page` | `await page.screenshot({ path, fullPage: true })` |
73
- | `main-panel` | a stable container selector (read it from the project's main layout source) |
74
- | `modal-only` | `page.locator('[role="dialog"]').first().screenshot(...)` |
75
- | `panel-left` / `panel-right` | the project's named-panel selector |
76
- | `sidebar` | the project's sidebar selector |
77
-
78
- ## After writing the spec
79
-
80
- - Report the spec's path.
81
- - If you used the TODO escape hatch, surface the blocking selectors so the dev can fix them in one pass.
82
- - Remind the user: `d360-capture auth --env <env>` once per machine, then `d360-capture capture <id>` to actually take the screenshot.
@@ -1,29 +0,0 @@
1
- # Skill: gather-context-from-mcp
2
-
3
- **Activate when** the user asks you to write an article and they have connected MCP servers beyond Document360 — Notion, GitHub, Sentry, Slack, etc.
4
-
5
- **Goal:** enrich the article's source material with external context that lives outside the codebase.
6
-
7
- ## What to do
8
-
9
- 1. Inspect the connected MCP servers (the SDK exposes them — query tool names that match `mcp__<server>__*`).
10
- 2. For each server, identify if it has relevant material:
11
- - **Notion**: design docs, RFCs, retrospectives that explain why a feature exists.
12
- - **GitHub**: PR descriptions, issue threads, commit messages with deeper context than the diff alone.
13
- - **Sentry / observability**: real error signatures that justify a troubleshooting section.
14
- - **Slack** (if connected): public-channel decisions or recent customer support patterns.
15
- 3. Pull the minimum needed to ground specific claims. Don't dump entire docs.
16
- 4. Cite the source. Every claim you draw from an external source goes into the article's `## Tips & notes` or `## Related articles` section with a link or reference.
17
-
18
- ## When you should NOT activate
19
-
20
- - If the user hasn't connected any MCP servers beyond Document360. The source repo is enough.
21
- - If the user explicitly says "stay close to the code".
22
- - For short reference articles (CLI commands, config keys) where external context would just add noise.
23
-
24
- ## Rules
25
-
26
- - Never paste raw MCP responses into the article. Distill into the article's voice.
27
- - Never include private identifiers (email addresses, internal URLs, customer names) unless they're meant to be public.
28
- - If an MCP server returns no relevant results, silently skip it and continue with the code-only sourcing.
29
- - Cap each external query at one round-trip per source per article — don't keep digging.
@@ -1,51 +0,0 @@
1
- # Skill: propose-structure
2
-
3
- **Activate when** the user has approved the codebase analysis and asks to "propose a structure", "outline the docs", or "what folders / articles should we have".
4
-
5
- **Goal:** produce a concrete documentation folder structure plus a flat list of proposed articles, ready for the user to approve before generation.
6
-
7
- ## Folder structure rules
8
-
9
- - Numbered prefix per category: `01-getting-started`, `02-<primary-surface>`, etc.
10
- - Lowercase, kebab-case.
11
- - The first category is always `01-getting-started`. The last is always `99-troubleshooting-and-faq` (use `09-` or higher if you have fewer than 10 categories).
12
- - Between 4 and 12 categories. If you can't justify 4, the repo isn't ready for a structured docs site; recommend a single README instead.
13
- - Categories should map to the product's user-visible surfaces, not its internal code structure.
14
-
15
- ## Article list rules
16
-
17
- - 2–8 articles per category.
18
- - Numbered prefix per article within a category: `01-what-is-x.md`, `02-install.md`, etc.
19
- - Each article entry includes: the path, a one-sentence purpose, and the source files the article would draw from.
20
-
21
- ## Output format
22
-
23
- Use a markdown tree for the folder layout. Use a table for the article list:
24
-
25
- ```
26
- user-docs/
27
- ├── 01-getting-started/
28
- ├── 02-<surface-a>/
29
- ├── 03-<surface-b>/
30
- ├── ...
31
- └── 99-troubleshooting-and-faq/
32
- ```
33
-
34
- | Path | Purpose | Source files |
35
- |---|---|---|
36
- | `01-getting-started/01-what-is-<product>.md` | Define what the product is for end users | `README.md`, `src/pages/...` |
37
- | ... | ... | ... |
38
-
39
- ## What you do NOT do
40
-
41
- - Do not start writing articles. That's `write-article`.
42
- - Do not create the folders yet — wait for the user to approve.
43
- - Do not invent features that aren't in the code.
44
-
45
- End your output with:
46
-
47
- > Want me to proceed with article generation? Reply with `yes`, or strike any rows you don't want.
48
-
49
- ## After approval
50
-
51
- Once the user approves, create the empty folders (don't write file contents) and a single `AGENT-PLAN.md` at the repo's docs root that pins the approved table. The user can edit it; subsequent `write-article` invocations should respect it.
@@ -1,39 +0,0 @@
1
- # Skill: publish-to-d360
2
-
3
- **Activate when** the user runs `/publish <path>` or explicitly asks to publish one or more articles to Document360.
4
-
5
- **Goal:** dual-write each approved article — keep the source markdown in git, push the publish-form markdown to Document360 as a draft via the Document360 MCP server.
6
-
7
- ## Preconditions
8
-
9
- - A Document360 MCP server must be registered. Check `/mcp list` mentally — the user's `~/.document360-writer/mcp.json` must contain an entry. If not, stop and tell the user to run `/mcp add document360 http <your-d360-mcp-url>`.
10
- - `.d360-writer.json` must have `d360.projectId` and `d360.projectVersionId` populated. If not, ask the user to run `/init` first or set them manually.
11
- - `<repo>/d360-category-map.json` is the source of truth for article IDs. Create it as `{ "projectId": "...", "projectVersionId": "...", "categories": {}, "articles": {} }` if missing.
12
-
13
- ## Per-article steps
14
-
15
- 1. Read the local `.md` file.
16
- 2. Compute the publish form:
17
- - Strip the H1 line.
18
- - Strip every `<!-- SCREENSHOT ... -->` block. Keep the visible `[Screenshot: ...]` line.
19
- - Convert relative `[link](../foo/bar.md)` to plain text like `See "foo" → "bar"`.
20
- 3. Look up the article path in `d360-category-map.json` `articles` table.
21
- 4. If found, call the D360 MCP `update-article` tool with `articleId`, `title` (from the H1 you stripped), `content` (the publish form), `contentType: 0`.
22
- 5. If not found, call `create-article` with `categoryId` (resolve from the path's parent folder via `categories` table), `title`, `content`, `contentType: 0`. Capture the returned `articleId` and write it back into `d360-category-map.json`.
23
- 6. Never overwrite a published article without confirming with the user.
24
-
25
- ## After all articles
26
-
27
- Report:
28
- - Articles created: count + paths + new D360 article IDs.
29
- - Articles updated: count + paths + existing IDs.
30
- - Any failures + reason.
31
- - A reminder: **all writes are DRAFTS. Publish manually in the Document360 portal** at the configured `helpCenterBaseUrl`.
32
-
33
- ## Rules
34
-
35
- - Never commit. The user handles git.
36
- - Never publish past draft. The user reviews and publishes in D360.
37
- - Never fabricate D360 IDs. If a UUID is missing, ask.
38
- - If a `create-article` call fails because the category doesn't exist in D360, ask the user whether to create it via `create-category` first.
39
- - Always update `d360-category-map.json` with new IDs in the same turn as the create.
@@ -1,95 +0,0 @@
1
- # Skill: write-article
2
-
3
- **Activate when** the user asks to write, draft, or generate a specific article — by topic name, by file path, or by reference to the approved plan.
4
-
5
- **Goal:** produce one publishable article that follows the system-prompt article structure exactly, grounded in the actual source code, and with screenshot placeholders where the user benefits from seeing the UI.
6
-
7
- ## Before writing — gather
8
-
9
- 1. Read the source files relevant to this article. Don't skip this. The whole point of this tool is that articles are grounded in code.
10
- 2. Read `AGENT-PLAN.md` if present, to confirm the article's purpose matches the approved plan.
11
- 3. Read 1–2 existing articles in the same category, if any, to match voice and structure.
12
- 4. If `gather-context-from-mcp` is appropriate (the user has connected Notion / GitHub / etc. and the article would benefit from external context), invoke it.
13
-
14
- ## Article skeleton (system-prompt-mandated)
15
-
16
- ```
17
- # <Article title>
18
-
19
- <one-paragraph intro>
20
-
21
- ## Prerequisites
22
- - <role/permissions, if any>
23
- - <required state>
24
-
25
- ## Steps
26
- 1. ...
27
- 2. ...
28
-
29
- ## Tips & notes
30
- - ...
31
-
32
- ## Related articles
33
- - ...
34
- ```
35
-
36
- ## Screenshot placeholders
37
-
38
- **Screenshots apply only to browser-reachable UIs.** If the product has none (CLI, console app, library, API-only service), emit NO screenshot placeholders and do not invoke `emit-screenshot-spec` — show behavior as fenced code blocks instead: the exact command, then its real terminal output (run it or quote it from source/tests; never invent output). Never fabricate a UI to screenshot.
39
-
40
- When the article describes a UI flow that benefits from a visual, embed one or more screenshot placeholders. Each placeholder is two parts:
41
-
42
- 1. An HTML comment block with capture instructions (stripped before D360 publish).
43
- 2. A visible `[Screenshot: ...]` line (kept in both local and D360).
44
-
45
- Example:
46
-
47
- ```markdown
48
- <!-- SCREENSHOT
49
- id: <kebab-case-stable-id>
50
- title: "<short title>"
51
- page-url: <relative path or URL>
52
- prerequisites:
53
- - <plain-English state setup>
54
- steps:
55
- 1. <numbered actions with EXACT button labels>
56
- capture: <full-page | main-panel | modal-only | panel-left | panel-right | sidebar>
57
- device: desktop
58
- viewport: 1440x900
59
- highlight:
60
- - <thing to draw attention to>
61
- annotations:
62
- - <numbered callouts with short text>
63
- redact:
64
- - <regions to hide (emails, real tokens, etc.)>
65
- save-to: user-docs/_screenshots/<id>.raw.png
66
- auto-capture-script: user-docs/_capture/<id>.spec.ts
67
- notes:
68
- - <edge cases>
69
- -->
70
- [Screenshot: <short reader-facing description>]
71
- > 🤖 Auto-capture: `d360-capture capture <id>`
72
- > Sign in to Chromium when prompted; the script does the rest.
73
- ```
74
-
75
- Every field must be filled. If a field doesn't apply, write "none" or "n/a" — never omit.
76
-
77
- **The `prerequisites` and `steps` fields must be detailed enough for a junior intern to capture the screenshot without further instruction.** If you can't write them that clearly, you don't understand the screen well enough — read more source code.
78
-
79
- For every screenshot placeholder you generate, also invoke `emit-screenshot-spec` so the matching `.spec.ts` lands in `<captureDir>/<id>.spec.ts`.
80
-
81
- ## Writing rules (re-emphasis from system prompt)
82
-
83
- - Second person, imperative. No marketing language. No "simply", "just", "easily".
84
- - Quote exact UI strings. Read the React/HTML/etc. source.
85
- - State role-gating in **Prerequisites**, not in Steps.
86
- - Markdown only. One H1.
87
-
88
- ## Output
89
-
90
- Write the article directly to its file path. Do not paste the markdown into the chat; the user wants the file on disk so they can review and iterate.
91
-
92
- After writing, report:
93
- - File path
94
- - Number of screenshot placeholders emitted (and a note that matching `.spec.ts` files were generated)
95
- - Any source files you couldn't find — the user may need to clarify