document360-writer 0.4.65 → 0.4.67
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.
- package/dist/cli.js +163 -102
- package/dist/commands/catchup.d.ts +22 -0
- package/dist/commands/devhints.d.ts +52 -3
- package/dist/commands/document.d.ts +19 -0
- package/dist/commands/inbox.d.ts +11 -0
- package/dist/commands/reset.d.ts +3 -2
- package/dist/commands/update.d.ts +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReplContext } from '../repl.js';
|
|
2
|
+
import type { SlashCommandResult } from './index.js';
|
|
3
|
+
export type PendingSummary = {
|
|
4
|
+
hints: number;
|
|
5
|
+
requests: number;
|
|
6
|
+
answers: number;
|
|
7
|
+
};
|
|
8
|
+
/** Deterministic local counts of queued work (hints + builder messages). Drift is network and is
|
|
9
|
+
checked by the agent via d360_sync_status inside the prompt, not here. */
|
|
10
|
+
export declare function pendingSummary(cwd: string): PendingSummary;
|
|
11
|
+
/** A short human phrase for a pending summary, or null when nothing local is queued. */
|
|
12
|
+
export declare function pendingLine(s: PendingSummary): string | null;
|
|
13
|
+
export declare function parseCatchUpArgs(args: string[]): {
|
|
14
|
+
publish: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** The consolidated staged prompt: trust → gather → decide → estimate/gate → write → close-loop → push. */
|
|
17
|
+
export declare function buildCatchUpPrompt({ publish }: {
|
|
18
|
+
publish: boolean;
|
|
19
|
+
}): string;
|
|
20
|
+
/** Classic-REPL `/catch-up`. Always forwards (it's the double-check) — even with no local queue it still
|
|
21
|
+
runs the sync/gap check to catch code changes the builder didn't hint. */
|
|
22
|
+
export declare function catchupCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { SlashCommandResult } from './index.js';
|
|
2
2
|
import type { ReplContext } from '../repl.js';
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The version of the WHOLE devhints script — the committed guide AND the copy-run prompt, which evolve
|
|
5
|
+
* as one unit. Bump on any change to either. Embedded in the guide header, the run prompt, and the
|
|
6
|
+
* on-disk handshake trace (devhints-state.json) so a future change is detectable: when the code version
|
|
7
|
+
* is ahead of what the builder last completed, /devhints + /doctor tell the user to re-paste.
|
|
8
|
+
* v1 → original one-way hints. v2 → re-run-safe single-prompt onboarding.
|
|
9
|
+
* v3 → two-way messages (Part 3) + on-demand hand-off (Part 4) + version trace.
|
|
10
|
+
* v4 → the writer can send the builder a `request` (not just a question), e.g. an auto "re-run
|
|
11
|
+
* onboarding" note when this protocol version moves ahead of what the builder last completed.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEVHINTS_VERSION = 4;
|
|
5
14
|
/**
|
|
6
15
|
* The committed protocol guide the SOURCE repo's coding agent follows. Self-contained because that
|
|
7
16
|
* agent has none of d360-writer's context. Two parts: (1) a ONE-TIME architecture brief that onboards
|
|
@@ -33,8 +42,48 @@ export declare function devhintsCommand(_args: string[], ctx: ReplContext): Prom
|
|
|
33
42
|
* was a first-time setup or a refresh.
|
|
34
43
|
*/
|
|
35
44
|
export declare function devHintsRunPrompt(): string;
|
|
45
|
+
/** The devhints handshake trace (`.d360-writer/devhints-state.json`). `emitted*` = what d360-writer
|
|
46
|
+
last handed the builder; `completed*` = what the builder's agent last ran (stamped by the run prompt,
|
|
47
|
+
step 6). The gap between completedVersion and DEVHINTS_VERSION is what staleness detection reads. */
|
|
48
|
+
export type DevhintsState = {
|
|
49
|
+
emittedVersion?: number;
|
|
50
|
+
emittedAt?: string;
|
|
51
|
+
completedVersion?: number;
|
|
52
|
+
completedAt?: string;
|
|
53
|
+
completedCommit?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Read the handshake trace; null if absent or unparseable (treated as "never set up"). */
|
|
56
|
+
export declare function readDevhintsState(cwd: string): DevhintsState | null;
|
|
57
|
+
/** Record that /devhints just emitted the current version, preserving the builder's completion fields. */
|
|
58
|
+
export declare function writeDevhintsEmitted(cwd: string, now: string): void;
|
|
59
|
+
export type DevhintsStaleness = {
|
|
60
|
+
status: 'unset' | 'stale' | 'current';
|
|
61
|
+
completedVersion?: number;
|
|
62
|
+
};
|
|
63
|
+
/** Compare what the builder completed against the current script version. `unset` = the builder hasn't
|
|
64
|
+
run the hand-off (no completion stamp); `stale` = ran an older version; `current` = up to date. */
|
|
65
|
+
export declare function devhintsStaleness(cwd: string): DevhintsStaleness;
|
|
66
|
+
/** Subject prefix that marks the auto "re-run onboarding" request, so we never queue a duplicate. */
|
|
67
|
+
export declare const ONBOARDING_REQUEST_MARKER = "Re-run dev\u2194docs onboarding (protocol v";
|
|
68
|
+
export type DevhintsReconcileResult = {
|
|
69
|
+
guideRefreshed: boolean;
|
|
70
|
+
notifiedBuilder: boolean;
|
|
71
|
+
toVersion: number;
|
|
72
|
+
completedVersion?: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Keep the dev↔docs onboarding protocol self-healing, with no human re-paste. Runs at launch when a
|
|
76
|
+
* guide already exists (devhints is in use):
|
|
77
|
+
* - if the package's DEVHINTS_VERSION is ahead of what we last EMITTED → rewrite the committed guide +
|
|
78
|
+
* re-stamp `emitted` (the new protocol lands on disk on its own);
|
|
79
|
+
* - if it's ahead of what the builder COMPLETED → leave ONE `from: docs, kind: request` message in the
|
|
80
|
+
* mailbox with the run prompt embedded (idempotent: skip if an open onboarding request already exists),
|
|
81
|
+
* so the builder re-onboards on their next session.
|
|
82
|
+
* Pure file ops, never throws; returns what it did so the wrapper can surface a one-line note.
|
|
83
|
+
*/
|
|
84
|
+
export declare function reconcileDevhints(cwd: string, now?: string): DevhintsReconcileResult;
|
|
36
85
|
/**
|
|
37
86
|
* The `/devhints` screen: confirms what was scaffolded, then shows the single copy-run prompt
|
|
38
87
|
* (devHintsRunPrompt) and the closing "come back and run" guidance. One prompt, zero manual file edits.
|
|
39
88
|
*/
|
|
40
|
-
export declare function renderDevHintsHandoff(): string[];
|
|
89
|
+
export declare function renderDevHintsHandoff(stale?: DevhintsStaleness): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReplContext } from '../repl.js';
|
|
2
|
+
import type { SlashCommandResult } from './index.js';
|
|
3
|
+
/** Open `request` messages (the builder's explicit "please document X") awaiting the docs agent. */
|
|
4
|
+
export declare function openRequestCount(cwd: string): number;
|
|
5
|
+
/** Split `--publish` off the args; the rest is the free-text description of what changed. */
|
|
6
|
+
export declare function parseDocumentArgs(args: string[]): {
|
|
7
|
+
publish: boolean;
|
|
8
|
+
what: string;
|
|
9
|
+
};
|
|
10
|
+
/** The prompt driving the document-handoff skill. `what` is the builder's description (empty → act on
|
|
11
|
+
the open request messages in the inbox). `publish` appends a draft-then-publish instruction. */
|
|
12
|
+
export declare function buildDocumentPrompt(what: string, publish?: boolean): string;
|
|
13
|
+
declare const NO_REQUESTS_HINT = "Nothing to document yet. Say what changed: /document <what you shipped> \u2014 or have the builder drop a request via their /devhints hand-off.";
|
|
14
|
+
/**
|
|
15
|
+
* Classic-REPL `/document`: with text → document it; bare with open requests → process them; bare with
|
|
16
|
+
* nothing → tell the user how to describe the work.
|
|
17
|
+
*/
|
|
18
|
+
export declare function documentCommand(args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
|
|
19
|
+
export { NO_REQUESTS_HINT };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReplContext } from '../repl.js';
|
|
2
|
+
import type { SlashCommandResult } from './index.js';
|
|
3
|
+
/** Count of open builder messages addressed to the docs agent — drives the ambient nudge + bare /inbox. */
|
|
4
|
+
export declare function openForDocsCount(cwd: string): number;
|
|
5
|
+
/** The prompt that drives inbox processing. Generic over the action so it composes with the
|
|
6
|
+
document-handoff skill (Phase B) for requests and gap-analysis's update logic for answers. */
|
|
7
|
+
export declare function buildInboxPrompt(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Classic-REPL `/inbox`: if there are open messages, forward the processing prompt; otherwise say so.
|
|
10
|
+
*/
|
|
11
|
+
export declare function inboxCommand(_args: string[], ctx?: ReplContext): Promise<SlashCommandResult>;
|
package/dist/commands/reset.d.ts
CHANGED
|
@@ -20,9 +20,10 @@ export declare function performReset(cwd: string, targets: string[]): {
|
|
|
20
20
|
error: string;
|
|
21
21
|
}[];
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
reset with no git copy to restore. Read-only git call; 0 on any error (no git, etc.). */
|
|
23
|
+
/** Uncommitted doc hints (`.d360-writer/hints/`) that a reset would destroy. */
|
|
25
24
|
export declare function uncommittedHintCount(cwd: string): number;
|
|
25
|
+
/** Uncommitted two-way messages (`.d360-writer/messages/`) that a reset would destroy. */
|
|
26
|
+
export declare function uncommittedMessageCount(cwd: string): number;
|
|
26
27
|
/** The destructive preview shown before the typed-name confirmation. */
|
|
27
28
|
export declare function resetPreviewLines(cwd: string, targets: string[]): string[];
|
|
28
29
|
/** `/reset` [DANGER] — classic REPL: preview → typed-name confirmation → delete. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SlashCommandResult } from './index.js';
|
|
2
|
+
export declare const SELF_UPDATE_PKG = "document360-writer";
|
|
3
|
+
export declare const SELF_UPDATE_HINT = "npm i -g document360-writer@latest";
|
|
4
|
+
/** Run the global install. Best-effort: resolves {ok,output}, never throws. Windows resolves npm.cmd
|
|
5
|
+
via shell:true. */
|
|
6
|
+
export declare function runSelfUpdate(): Promise<{
|
|
7
|
+
ok: boolean;
|
|
8
|
+
output: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** Classic-REPL `/update`: install, then tell the user to relaunch. */
|
|
11
|
+
export declare function updateCommand(): Promise<SlashCommandResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document360-writer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.67",
|
|
4
4
|
"description": "Standalone documentation agent CLI. Reads your code, writes your docs. Specialized for Document360 publishing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@inquirer/prompts": "^8.4.3",
|
|
35
35
|
"commander": "^14.0.3",
|
|
36
36
|
"diff": "^8.0.4",
|
|
37
|
-
"document360-engine": "^0.2.
|
|
37
|
+
"document360-engine": "^0.2.39",
|
|
38
38
|
"ink": "^5.2.1",
|
|
39
39
|
"picocolors": "^1.1.1",
|
|
40
40
|
"react": "^18.3.1",
|