@s_s/harmonia 1.1.0 → 1.2.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.
- package/README.md +413 -205
- package/build/cli/setup.js +2 -3
- package/build/cli/setup.js.map +1 -1
- package/build/core/dispatch.d.ts +11 -11
- package/build/core/dispatch.js +33 -33
- package/build/core/dispatch.js.map +1 -1
- package/build/core/docs.d.ts +11 -11
- package/build/core/docs.js +19 -19
- package/build/core/docs.js.map +1 -1
- package/build/core/registry.d.ts +29 -6
- package/build/core/registry.js +50 -8
- package/build/core/registry.js.map +1 -1
- package/build/core/reviews.d.ts +8 -8
- package/build/core/reviews.js +20 -20
- package/build/core/reviews.js.map +1 -1
- package/build/core/state.d.ts +12 -12
- package/build/core/state.js +24 -23
- package/build/core/state.js.map +1 -1
- package/build/core/steps.d.ts +7 -7
- package/build/core/steps.js +19 -19
- package/build/core/steps.js.map +1 -1
- package/build/core/types.d.ts +2 -0
- package/build/index.js +30 -3
- package/build/index.js.map +1 -1
- package/build/setup/inject.d.ts +11 -3
- package/build/setup/inject.js +19 -12
- package/build/setup/inject.js.map +1 -1
- package/build/setup/templates.js +9 -2
- package/build/setup/templates.js.map +1 -1
- package/build/tools/approve-doc.js +31 -2
- package/build/tools/approve-doc.js.map +1 -1
- package/build/tools/dispatch-role.js +19 -4
- package/build/tools/dispatch-role.js.map +1 -1
- package/build/tools/doc-tools.js +59 -16
- package/build/tools/doc-tools.js.map +1 -1
- package/build/tools/get-project-status.js +61 -15
- package/build/tools/get-project-status.js.map +1 -1
- package/build/tools/iteration-start.d.ts +13 -0
- package/build/tools/iteration-start.js +98 -0
- package/build/tools/iteration-start.js.map +1 -0
- package/build/tools/project-init.d.ts +5 -1
- package/build/tools/project-init.js +30 -14
- package/build/tools/project-init.js.map +1 -1
- package/build/tools/report-dispatch.js +30 -15
- package/build/tools/report-dispatch.js.map +1 -1
- package/build/tools/set-scale.js +18 -3
- package/build/tools/set-scale.js.map +1 -1
- package/build/tools/update-phase.js +20 -5
- package/build/tools/update-phase.js.map +1 -1
- package/package.json +2 -2
package/build/cli/setup.js
CHANGED
|
@@ -40,12 +40,11 @@ export async function runSetup(opts) {
|
|
|
40
40
|
const projectDir = resolve(process.cwd());
|
|
41
41
|
console.log(`\nHarmonia Setup`);
|
|
42
42
|
console.log(`──────────────────────────────`);
|
|
43
|
-
console.log(` Dir: ${projectDir}`);
|
|
44
43
|
// 1. Detect agent
|
|
45
44
|
const agentType = opts.agent ?? (await detectHostAgent(projectDir));
|
|
46
45
|
console.log(` Agent: ${agentType}`);
|
|
47
|
-
// 2. Inject prompt (project-agnostic
|
|
48
|
-
const result = await injectPrompt(
|
|
46
|
+
// 2. Inject prompt (global scope — project-agnostic)
|
|
47
|
+
const result = await injectPrompt(agentType);
|
|
49
48
|
const action = result.created ? 'Created' : result.replaced ? 'Updated' : 'Appended to';
|
|
50
49
|
console.log(` [done] ${action} ${result.filePath}`);
|
|
51
50
|
// 3. Install hooks
|
package/build/cli/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAM/E,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,IAAc;IACzC,MAAM,IAAI,GAAiB,EAAE,CAAC;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,C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name>/dispatches.json
|
|
3
|
+
* <data_dir>/<project_name>/iter-<n>/sessions.json
|
|
4
|
+
* <data_dir>/<project_name>/iter-<n>/dispatches.json
|
|
5
5
|
*
|
|
6
6
|
* Sessions represent agent instances (can be reused across dispatches).
|
|
7
7
|
* Dispatches represent individual task assignments to a role.
|
|
8
8
|
* Relationship: Session 1:N Dispatch (a persistent session can receive multiple dispatches).
|
|
9
9
|
*/
|
|
10
10
|
import type { AgentType, SessionRecord, SessionStatus, DispatchRecord, DispatchStatus } from './types.js';
|
|
11
|
-
export declare function readSessions(projectName: string): Promise<SessionRecord[]>;
|
|
12
|
-
export declare function createSession(projectName: string, role: string, agentType?: AgentType, label?: string): Promise<SessionRecord>;
|
|
13
|
-
export declare function updateSession(projectName: string, sessionId: string, updates: {
|
|
11
|
+
export declare function readSessions(projectName: string, iteration: number): Promise<SessionRecord[]>;
|
|
12
|
+
export declare function createSession(projectName: string, iteration: number, role: string, agentType?: AgentType, label?: string): Promise<SessionRecord>;
|
|
13
|
+
export declare function updateSession(projectName: string, iteration: number, sessionId: string, updates: {
|
|
14
14
|
status?: SessionStatus;
|
|
15
15
|
agentSessionId?: string;
|
|
16
16
|
agentType?: AgentType;
|
|
@@ -20,14 +20,14 @@ export declare function updateSession(projectName: string, sessionId: string, up
|
|
|
20
20
|
* Find an idle session for a given role (for session reuse).
|
|
21
21
|
* Returns the most recently active idle session, or null if none found.
|
|
22
22
|
*/
|
|
23
|
-
export declare function findIdleSession(projectName: string, role: string): Promise<SessionRecord | null>;
|
|
23
|
+
export declare function findIdleSession(projectName: string, iteration: number, role: string): Promise<SessionRecord | null>;
|
|
24
24
|
/**
|
|
25
25
|
* Find a session by its agent session ID (for correlating external sessions).
|
|
26
26
|
*/
|
|
27
|
-
export declare function findSessionByAgentId(projectName: string, role: string, agentSessionId: string): Promise<SessionRecord | null>;
|
|
28
|
-
export declare function readDispatches(projectName: string): Promise<DispatchRecord[]>;
|
|
29
|
-
export declare function createDispatch(projectName: string, role: string, taskBrief: string, expectedOutputs: string[], sessionId?: string): Promise<DispatchRecord>;
|
|
30
|
-
export declare function updateDispatch(projectName: string, dispatchId: string, updates: {
|
|
27
|
+
export declare function findSessionByAgentId(projectName: string, iteration: number, role: string, agentSessionId: string): Promise<SessionRecord | null>;
|
|
28
|
+
export declare function readDispatches(projectName: string, iteration: number): Promise<DispatchRecord[]>;
|
|
29
|
+
export declare function createDispatch(projectName: string, iteration: number, role: string, taskBrief: string, expectedOutputs: string[], sessionId?: string): Promise<DispatchRecord>;
|
|
30
|
+
export declare function updateDispatch(projectName: string, iteration: number, dispatchId: string, updates: {
|
|
31
31
|
status?: DispatchStatus;
|
|
32
32
|
sessionId?: string;
|
|
33
33
|
note?: string;
|
|
@@ -35,7 +35,7 @@ export declare function updateDispatch(projectName: string, dispatchId: string,
|
|
|
35
35
|
/**
|
|
36
36
|
* Get a single dispatch record by ID.
|
|
37
37
|
*/
|
|
38
|
-
export declare function getDispatch(projectName: string, dispatchId: string): Promise<DispatchRecord | null>;
|
|
38
|
+
export declare function getDispatch(projectName: string, iteration: number, dispatchId: string): Promise<DispatchRecord | null>;
|
|
39
39
|
/** Valid state transitions for dispatch status. */
|
|
40
40
|
export declare const DISPATCH_TRANSITIONS: Record<DispatchStatus, DispatchStatus[]>;
|
|
41
41
|
/**
|
package/build/core/dispatch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dispatch & Session tracking — manages:
|
|
3
|
-
* <data_dir>/<project_name>/sessions.json
|
|
4
|
-
* <data_dir>/<project_name>/dispatches.json
|
|
3
|
+
* <data_dir>/<project_name>/iter-<n>/sessions.json
|
|
4
|
+
* <data_dir>/<project_name>/iter-<n>/dispatches.json
|
|
5
5
|
*
|
|
6
6
|
* Sessions represent agent instances (can be reused across dispatches).
|
|
7
7
|
* Dispatches represent individual task assignments to a role.
|
|
@@ -9,27 +9,27 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { join, dirname } from 'node:path';
|
|
12
|
-
import {
|
|
12
|
+
import { getIterationDir } from './registry.js';
|
|
13
13
|
const SESSIONS_FILE = 'sessions.json';
|
|
14
14
|
const DISPATCHES_FILE = 'dispatches.json';
|
|
15
|
-
function sessionsPath(projectName) {
|
|
16
|
-
return join(
|
|
15
|
+
function sessionsPath(projectName, iteration) {
|
|
16
|
+
return join(getIterationDir(projectName, iteration), SESSIONS_FILE);
|
|
17
17
|
}
|
|
18
|
-
function dispatchesPath(projectName) {
|
|
19
|
-
return join(
|
|
18
|
+
function dispatchesPath(projectName, iteration) {
|
|
19
|
+
return join(getIterationDir(projectName, iteration), DISPATCHES_FILE);
|
|
20
20
|
}
|
|
21
21
|
// ─── Session CRUD ───
|
|
22
|
-
export async function readSessions(projectName) {
|
|
22
|
+
export async function readSessions(projectName, iteration) {
|
|
23
23
|
try {
|
|
24
|
-
const content = await readFile(sessionsPath(projectName), 'utf-8');
|
|
24
|
+
const content = await readFile(sessionsPath(projectName, iteration), 'utf-8');
|
|
25
25
|
return JSON.parse(content);
|
|
26
26
|
}
|
|
27
27
|
catch {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
async function writeSessions(projectName, sessions) {
|
|
32
|
-
const filePath = sessionsPath(projectName);
|
|
31
|
+
async function writeSessions(projectName, iteration, sessions) {
|
|
32
|
+
const filePath = sessionsPath(projectName, iteration);
|
|
33
33
|
await mkdir(dirname(filePath), { recursive: true });
|
|
34
34
|
await writeFile(filePath, JSON.stringify(sessions, null, 2) + '\n', 'utf-8');
|
|
35
35
|
}
|
|
@@ -37,8 +37,8 @@ function nextSessionId(sessions) {
|
|
|
37
37
|
const num = sessions.length + 1;
|
|
38
38
|
return `ses-${String(num).padStart(3, '0')}`;
|
|
39
39
|
}
|
|
40
|
-
export async function createSession(projectName, role, agentType, label) {
|
|
41
|
-
const sessions = await readSessions(projectName);
|
|
40
|
+
export async function createSession(projectName, iteration, role, agentType, label) {
|
|
41
|
+
const sessions = await readSessions(projectName, iteration);
|
|
42
42
|
const now = new Date().toISOString();
|
|
43
43
|
const session = {
|
|
44
44
|
id: nextSessionId(sessions),
|
|
@@ -50,11 +50,11 @@ export async function createSession(projectName, role, agentType, label) {
|
|
|
50
50
|
lastActiveAt: now,
|
|
51
51
|
};
|
|
52
52
|
sessions.push(session);
|
|
53
|
-
await writeSessions(projectName, sessions);
|
|
53
|
+
await writeSessions(projectName, iteration, sessions);
|
|
54
54
|
return session;
|
|
55
55
|
}
|
|
56
|
-
export async function updateSession(projectName, sessionId, updates) {
|
|
57
|
-
const sessions = await readSessions(projectName);
|
|
56
|
+
export async function updateSession(projectName, iteration, sessionId, updates) {
|
|
57
|
+
const sessions = await readSessions(projectName, iteration);
|
|
58
58
|
const session = sessions.find((s) => s.id === sessionId);
|
|
59
59
|
if (!session) {
|
|
60
60
|
throw new Error(`Session "${sessionId}" not found in project "${projectName}"`);
|
|
@@ -68,15 +68,15 @@ export async function updateSession(projectName, sessionId, updates) {
|
|
|
68
68
|
if (updates.label !== undefined)
|
|
69
69
|
session.label = updates.label;
|
|
70
70
|
session.lastActiveAt = new Date().toISOString();
|
|
71
|
-
await writeSessions(projectName, sessions);
|
|
71
|
+
await writeSessions(projectName, iteration, sessions);
|
|
72
72
|
return session;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Find an idle session for a given role (for session reuse).
|
|
76
76
|
* Returns the most recently active idle session, or null if none found.
|
|
77
77
|
*/
|
|
78
|
-
export async function findIdleSession(projectName, role) {
|
|
79
|
-
const sessions = await readSessions(projectName);
|
|
78
|
+
export async function findIdleSession(projectName, iteration, role) {
|
|
79
|
+
const sessions = await readSessions(projectName, iteration);
|
|
80
80
|
const idle = sessions
|
|
81
81
|
.filter((s) => s.role === role && s.status === 'idle')
|
|
82
82
|
.sort((a, b) => b.lastActiveAt.localeCompare(a.lastActiveAt));
|
|
@@ -85,22 +85,22 @@ export async function findIdleSession(projectName, role) {
|
|
|
85
85
|
/**
|
|
86
86
|
* Find a session by its agent session ID (for correlating external sessions).
|
|
87
87
|
*/
|
|
88
|
-
export async function findSessionByAgentId(projectName, role, agentSessionId) {
|
|
89
|
-
const sessions = await readSessions(projectName);
|
|
88
|
+
export async function findSessionByAgentId(projectName, iteration, role, agentSessionId) {
|
|
89
|
+
const sessions = await readSessions(projectName, iteration);
|
|
90
90
|
return sessions.find((s) => s.role === role && s.agentSessionId === agentSessionId) ?? null;
|
|
91
91
|
}
|
|
92
92
|
// ─── Dispatch CRUD ───
|
|
93
|
-
export async function readDispatches(projectName) {
|
|
93
|
+
export async function readDispatches(projectName, iteration) {
|
|
94
94
|
try {
|
|
95
|
-
const content = await readFile(dispatchesPath(projectName), 'utf-8');
|
|
95
|
+
const content = await readFile(dispatchesPath(projectName, iteration), 'utf-8');
|
|
96
96
|
return JSON.parse(content);
|
|
97
97
|
}
|
|
98
98
|
catch {
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
async function writeDispatches(projectName, dispatches) {
|
|
103
|
-
const filePath = dispatchesPath(projectName);
|
|
102
|
+
async function writeDispatches(projectName, iteration, dispatches) {
|
|
103
|
+
const filePath = dispatchesPath(projectName, iteration);
|
|
104
104
|
await mkdir(dirname(filePath), { recursive: true });
|
|
105
105
|
await writeFile(filePath, JSON.stringify(dispatches, null, 2) + '\n', 'utf-8');
|
|
106
106
|
}
|
|
@@ -108,8 +108,8 @@ function nextDispatchId(dispatches) {
|
|
|
108
108
|
const num = dispatches.length + 1;
|
|
109
109
|
return `dispatch-${String(num).padStart(3, '0')}`;
|
|
110
110
|
}
|
|
111
|
-
export async function createDispatch(projectName, role, taskBrief, expectedOutputs, sessionId) {
|
|
112
|
-
const dispatches = await readDispatches(projectName);
|
|
111
|
+
export async function createDispatch(projectName, iteration, role, taskBrief, expectedOutputs, sessionId) {
|
|
112
|
+
const dispatches = await readDispatches(projectName, iteration);
|
|
113
113
|
const now = new Date().toISOString();
|
|
114
114
|
const dispatch = {
|
|
115
115
|
id: nextDispatchId(dispatches),
|
|
@@ -122,11 +122,11 @@ export async function createDispatch(projectName, role, taskBrief, expectedOutpu
|
|
|
122
122
|
...(sessionId ? { sessionId } : {}),
|
|
123
123
|
};
|
|
124
124
|
dispatches.push(dispatch);
|
|
125
|
-
await writeDispatches(projectName, dispatches);
|
|
125
|
+
await writeDispatches(projectName, iteration, dispatches);
|
|
126
126
|
return dispatch;
|
|
127
127
|
}
|
|
128
|
-
export async function updateDispatch(projectName, dispatchId, updates) {
|
|
129
|
-
const dispatches = await readDispatches(projectName);
|
|
128
|
+
export async function updateDispatch(projectName, iteration, dispatchId, updates) {
|
|
129
|
+
const dispatches = await readDispatches(projectName, iteration);
|
|
130
130
|
const dispatch = dispatches.find((d) => d.id === dispatchId);
|
|
131
131
|
if (!dispatch) {
|
|
132
132
|
throw new Error(`Dispatch "${dispatchId}" not found in project "${projectName}"`);
|
|
@@ -143,14 +143,14 @@ export async function updateDispatch(projectName, dispatchId, updates) {
|
|
|
143
143
|
if (updates.note !== undefined)
|
|
144
144
|
dispatch.note = updates.note;
|
|
145
145
|
dispatch.updatedAt = now;
|
|
146
|
-
await writeDispatches(projectName, dispatches);
|
|
146
|
+
await writeDispatches(projectName, iteration, dispatches);
|
|
147
147
|
return dispatch;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Get a single dispatch record by ID.
|
|
151
151
|
*/
|
|
152
|
-
export async function getDispatch(projectName, dispatchId) {
|
|
153
|
-
const dispatches = await readDispatches(projectName);
|
|
152
|
+
export async function getDispatch(projectName, iteration, dispatchId) {
|
|
153
|
+
const dispatches = await readDispatches(projectName, iteration);
|
|
154
154
|
return dispatches.find((d) => d.id === dispatchId) ?? null;
|
|
155
155
|
}
|
|
156
156
|
// ─── Dispatch State Machine ───
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/core/dispatch.ts"],"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AE,EAAE;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAoB,EAAE,EAAkB;IACtE,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAsB;IACnD,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACrD,CAAC"}
|
package/build/core/docs.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Document management — read/write files under <data_dir>/<project_name>/docs/
|
|
2
|
+
* Document management — read/write files under <data_dir>/<project_name>/iter-<n>/docs/
|
|
3
3
|
*
|
|
4
4
|
* Supports both .md and .html files based on doc format configuration.
|
|
5
5
|
* Also supports step artifact files for sequential mode (e.g. prd.requirements.json).
|
|
6
6
|
*/
|
|
7
7
|
import type { DocDefinition } from './types.js';
|
|
8
8
|
/**
|
|
9
|
-
* Write a document to <data_dir>/<project_name>/docs/<docId>.<ext>
|
|
9
|
+
* Write a document to <data_dir>/<project_name>/iter-<n>/docs/<docId>.<ext>
|
|
10
10
|
*/
|
|
11
|
-
export declare function writeDoc(projectName: string, docId: string, content: string, docDef?: DocDefinition): Promise<string>;
|
|
11
|
+
export declare function writeDoc(projectName: string, iteration: number, docId: string, content: string, docDef?: DocDefinition): Promise<string>;
|
|
12
12
|
/**
|
|
13
|
-
* Read a document from <data_dir>/<project_name>/docs/<docId>.<ext>
|
|
13
|
+
* Read a document from <data_dir>/<project_name>/iter-<n>/docs/<docId>.<ext>
|
|
14
14
|
* Tries both .md and .html extensions.
|
|
15
15
|
*/
|
|
16
|
-
export declare function readDoc(projectName: string, docId: string): Promise<string>;
|
|
16
|
+
export declare function readDoc(projectName: string, iteration: number, docId: string): Promise<string>;
|
|
17
17
|
/**
|
|
18
|
-
* List all documents in <data_dir>/<project_name>/docs/
|
|
18
|
+
* List all documents in <data_dir>/<project_name>/iter-<n>/docs/
|
|
19
19
|
*/
|
|
20
|
-
export declare function listDocs(projectName: string): Promise<string[]>;
|
|
20
|
+
export declare function listDocs(projectName: string, iteration: number): Promise<string[]>;
|
|
21
21
|
/**
|
|
22
|
-
* Write a step artifact to <data_dir>/<project_name>/docs/<docId>.<stepId>.<ext>
|
|
22
|
+
* Write a step artifact to <data_dir>/<project_name>/iter-<n>/docs/<docId>.<stepId>.<ext>
|
|
23
23
|
*
|
|
24
24
|
* @param format - "json" or "md" (determines file extension)
|
|
25
25
|
* @returns The file path written
|
|
26
26
|
*/
|
|
27
|
-
export declare function writeStepArtifact(projectName: string, docId: string, stepId: string, content: string, format: 'json' | 'md'): Promise<string>;
|
|
27
|
+
export declare function writeStepArtifact(projectName: string, iteration: number, docId: string, stepId: string, content: string, format: 'json' | 'md'): Promise<string>;
|
|
28
28
|
/**
|
|
29
|
-
* Read a step artifact from <data_dir>/<project_name>/docs/<docId>.<stepId>.<ext>
|
|
29
|
+
* Read a step artifact from <data_dir>/<project_name>/iter-<n>/docs/<docId>.<stepId>.<ext>
|
|
30
30
|
* Tries .json first, then .md.
|
|
31
31
|
*/
|
|
32
|
-
export declare function readStepArtifact(projectName: string, docId: string, stepId: string): Promise<string>;
|
|
32
|
+
export declare function readStepArtifact(projectName: string, iteration: number, docId: string, stepId: string): Promise<string>;
|
package/build/core/docs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Document management — read/write files under <data_dir>/<project_name>/docs/
|
|
2
|
+
* Document management — read/write files under <data_dir>/<project_name>/iter-<n>/docs/
|
|
3
3
|
*
|
|
4
4
|
* Supports both .md and .html files based on doc format configuration.
|
|
5
5
|
* Also supports step artifact files for sequential mode (e.g. prd.requirements.json).
|
|
6
6
|
*/
|
|
7
7
|
import { mkdir, readFile, writeFile, readdir } from 'node:fs/promises';
|
|
8
8
|
import { join } from 'node:path';
|
|
9
|
-
import {
|
|
10
|
-
function docsDir(projectName) {
|
|
11
|
-
return join(
|
|
9
|
+
import { getIterationDir } from './registry.js';
|
|
10
|
+
function docsDir(projectName, iteration) {
|
|
11
|
+
return join(getIterationDir(projectName, iteration), 'docs');
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Get file extension for a doc based on its definition.
|
|
@@ -17,10 +17,10 @@ function getDocExtension(docDef) {
|
|
|
17
17
|
return docDef?.format === 'html' ? '.html' : '.md';
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Write a document to <data_dir>/<project_name>/docs/<docId>.<ext>
|
|
20
|
+
* Write a document to <data_dir>/<project_name>/iter-<n>/docs/<docId>.<ext>
|
|
21
21
|
*/
|
|
22
|
-
export async function writeDoc(projectName, docId, content, docDef) {
|
|
23
|
-
const dir = docsDir(projectName);
|
|
22
|
+
export async function writeDoc(projectName, iteration, docId, content, docDef) {
|
|
23
|
+
const dir = docsDir(projectName, iteration);
|
|
24
24
|
await mkdir(dir, { recursive: true });
|
|
25
25
|
const ext = getDocExtension(docDef);
|
|
26
26
|
const filePath = join(dir, `${docId}${ext}`);
|
|
@@ -28,11 +28,11 @@ export async function writeDoc(projectName, docId, content, docDef) {
|
|
|
28
28
|
return filePath;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Read a document from <data_dir>/<project_name>/docs/<docId>.<ext>
|
|
31
|
+
* Read a document from <data_dir>/<project_name>/iter-<n>/docs/<docId>.<ext>
|
|
32
32
|
* Tries both .md and .html extensions.
|
|
33
33
|
*/
|
|
34
|
-
export async function readDoc(projectName, docId) {
|
|
35
|
-
const dir = docsDir(projectName);
|
|
34
|
+
export async function readDoc(projectName, iteration, docId) {
|
|
35
|
+
const dir = docsDir(projectName, iteration);
|
|
36
36
|
// Try .md first, then .html
|
|
37
37
|
for (const ext of ['.md', '.html']) {
|
|
38
38
|
try {
|
|
@@ -45,10 +45,10 @@ export async function readDoc(projectName, docId) {
|
|
|
45
45
|
throw new Error(`Document "${docId}" not found`);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* List all documents in <data_dir>/<project_name>/docs/
|
|
48
|
+
* List all documents in <data_dir>/<project_name>/iter-<n>/docs/
|
|
49
49
|
*/
|
|
50
|
-
export async function listDocs(projectName) {
|
|
51
|
-
const dir = docsDir(projectName);
|
|
50
|
+
export async function listDocs(projectName, iteration) {
|
|
51
|
+
const dir = docsDir(projectName, iteration);
|
|
52
52
|
try {
|
|
53
53
|
const files = await readdir(dir);
|
|
54
54
|
return files.filter((f) => f.endsWith('.md') || f.endsWith('.html')).map((f) => f.replace(/\.(md|html)$/, ''));
|
|
@@ -59,13 +59,13 @@ export async function listDocs(projectName) {
|
|
|
59
59
|
}
|
|
60
60
|
// ─── Step Artifact I/O ───
|
|
61
61
|
/**
|
|
62
|
-
* Write a step artifact to <data_dir>/<project_name>/docs/<docId>.<stepId>.<ext>
|
|
62
|
+
* Write a step artifact to <data_dir>/<project_name>/iter-<n>/docs/<docId>.<stepId>.<ext>
|
|
63
63
|
*
|
|
64
64
|
* @param format - "json" or "md" (determines file extension)
|
|
65
65
|
* @returns The file path written
|
|
66
66
|
*/
|
|
67
|
-
export async function writeStepArtifact(projectName, docId, stepId, content, format) {
|
|
68
|
-
const dir = docsDir(projectName);
|
|
67
|
+
export async function writeStepArtifact(projectName, iteration, docId, stepId, content, format) {
|
|
68
|
+
const dir = docsDir(projectName, iteration);
|
|
69
69
|
await mkdir(dir, { recursive: true });
|
|
70
70
|
const ext = format === 'json' ? '.json' : '.md';
|
|
71
71
|
const filePath = join(dir, `${docId}.${stepId}${ext}`);
|
|
@@ -73,11 +73,11 @@ export async function writeStepArtifact(projectName, docId, stepId, content, for
|
|
|
73
73
|
return filePath;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Read a step artifact from <data_dir>/<project_name>/docs/<docId>.<stepId>.<ext>
|
|
76
|
+
* Read a step artifact from <data_dir>/<project_name>/iter-<n>/docs/<docId>.<stepId>.<ext>
|
|
77
77
|
* Tries .json first, then .md.
|
|
78
78
|
*/
|
|
79
|
-
export async function readStepArtifact(projectName, docId, stepId) {
|
|
80
|
-
const dir = docsDir(projectName);
|
|
79
|
+
export async function readStepArtifact(projectName, iteration, docId, stepId) {
|
|
80
|
+
const dir = docsDir(projectName, iteration);
|
|
81
81
|
for (const ext of ['.json', '.md']) {
|
|
82
82
|
try {
|
|
83
83
|
return await readFile(join(dir, `${docId}.${stepId}${ext}`), 'utf-8');
|
package/build/core/docs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/core/docs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/core/docs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,SAAS,OAAO,CAAC,WAAmB,EAAE,SAAiB;IACnD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,MAAsB;IAC3C,OAAO,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC1B,WAAmB,EACnB,SA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OAAO,CAAC,CAAC;QAC1E,CAAC;QAAC,MAAM,CAAC;YACL,qBAAqB;QACzB,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;AACpE,CAAC"}
|
package/build/core/registry.d.ts
CHANGED
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
* ├── registry.json # { projects: { "my-app": { dir: "/path/to/src", ... } } }
|
|
13
13
|
* ├── overrides.json # global overrides (optional)
|
|
14
14
|
* ├── my-app/
|
|
15
|
-
* │ ├── state.json
|
|
16
|
-
* │ ├── docs/
|
|
17
|
-
* │ ├── reviews.json
|
|
18
15
|
* │ ├── overrides.json # project-level overrides (optional)
|
|
19
|
-
* │
|
|
16
|
+
* │ ├── iter-1/
|
|
17
|
+
* │ │ ├── state.json
|
|
18
|
+
* │ │ ├── docs/
|
|
19
|
+
* │ │ ├── reviews.json
|
|
20
|
+
* │ │ └── ...
|
|
21
|
+
* │ ├── iter-2/
|
|
22
|
+
* │ │ └── ...
|
|
20
23
|
* └── another-project/
|
|
21
24
|
* └── ...
|
|
22
25
|
*/
|
|
@@ -27,6 +30,10 @@ export interface ProjectEntry {
|
|
|
27
30
|
workflow: string;
|
|
28
31
|
/** When the project was registered */
|
|
29
32
|
createdAt: string;
|
|
33
|
+
/** Currently active iteration number (starts at 1, 0 means no iteration started yet) */
|
|
34
|
+
currentIteration: number;
|
|
35
|
+
/** Total number of iterations created so far */
|
|
36
|
+
totalIterations: number;
|
|
30
37
|
}
|
|
31
38
|
export interface Registry {
|
|
32
39
|
projects: Record<string, ProjectEntry>;
|
|
@@ -56,6 +63,8 @@ export declare function readRegistry(): Promise<Registry>;
|
|
|
56
63
|
export declare function writeRegistry(registry: Registry): Promise<void>;
|
|
57
64
|
/**
|
|
58
65
|
* Register a new project. Creates the project data directory.
|
|
66
|
+
* Note: Does NOT create iteration directories or state files.
|
|
67
|
+
* Use startIteration() after registration to begin the first iteration.
|
|
59
68
|
*/
|
|
60
69
|
export declare function registerProject(projectName: string, projectDir: string, workflow: string): Promise<void>;
|
|
61
70
|
/**
|
|
@@ -67,6 +76,20 @@ export declare function getProject(projectName: string): Promise<ProjectEntry |
|
|
|
67
76
|
*/
|
|
68
77
|
export declare function listProjects(): Promise<string[]>;
|
|
69
78
|
/**
|
|
70
|
-
* Remove a project from the registry
|
|
79
|
+
* Remove a project from the registry.
|
|
80
|
+
* By default, also deletes the project data directory.
|
|
81
|
+
* Pass keepData: true to only remove the registry entry.
|
|
71
82
|
*/
|
|
72
|
-
export declare function unregisterProject(projectName: string): Promise<void>;
|
|
83
|
+
export declare function unregisterProject(projectName: string, keepData?: boolean): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Get the iteration directory for a specific project iteration.
|
|
86
|
+
* Pure path concatenation — does NOT check if the directory exists.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getIterationDir(projectName: string, iteration: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Start a new iteration for a project.
|
|
91
|
+
* Creates the iteration directory (with docs/ subdirectory) and updates the registry.
|
|
92
|
+
*
|
|
93
|
+
* @returns The new iteration number
|
|
94
|
+
*/
|
|
95
|
+
export declare function startIteration(projectName: string): Promise<number>;
|
package/build/core/registry.js
CHANGED
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
* ├── registry.json # { projects: { "my-app": { dir: "/path/to/src", ... } } }
|
|
13
13
|
* ├── overrides.json # global overrides (optional)
|
|
14
14
|
* ├── my-app/
|
|
15
|
-
* │ ├── state.json
|
|
16
|
-
* │ ├── docs/
|
|
17
|
-
* │ ├── reviews.json
|
|
18
15
|
* │ ├── overrides.json # project-level overrides (optional)
|
|
19
|
-
* │
|
|
16
|
+
* │ ├── iter-1/
|
|
17
|
+
* │ │ ├── state.json
|
|
18
|
+
* │ │ ├── docs/
|
|
19
|
+
* │ │ ├── reviews.json
|
|
20
|
+
* │ │ └── ...
|
|
21
|
+
* │ ├── iter-2/
|
|
22
|
+
* │ │ └── ...
|
|
20
23
|
* └── another-project/
|
|
21
24
|
* └── ...
|
|
22
25
|
*/
|
|
@@ -67,6 +70,8 @@ export async function writeRegistry(registry) {
|
|
|
67
70
|
}
|
|
68
71
|
/**
|
|
69
72
|
* Register a new project. Creates the project data directory.
|
|
73
|
+
* Note: Does NOT create iteration directories or state files.
|
|
74
|
+
* Use startIteration() after registration to begin the first iteration.
|
|
70
75
|
*/
|
|
71
76
|
export async function registerProject(projectName, projectDir, workflow) {
|
|
72
77
|
const registry = await readRegistry();
|
|
@@ -77,10 +82,12 @@ export async function registerProject(projectName, projectDir, workflow) {
|
|
|
77
82
|
dir: projectDir,
|
|
78
83
|
workflow,
|
|
79
84
|
createdAt: new Date().toISOString(),
|
|
85
|
+
currentIteration: 0,
|
|
86
|
+
totalIterations: 0,
|
|
80
87
|
};
|
|
81
|
-
// Create project data directory
|
|
88
|
+
// Create project data directory under global dir
|
|
82
89
|
const dataDir = getProjectDataDir(projectName);
|
|
83
|
-
await mkdir(
|
|
90
|
+
await mkdir(dataDir, { recursive: true });
|
|
84
91
|
// Create the project source directory if it doesn't exist
|
|
85
92
|
await mkdir(projectDir, { recursive: true });
|
|
86
93
|
await writeRegistry(registry);
|
|
@@ -100,11 +107,46 @@ export async function listProjects() {
|
|
|
100
107
|
return Object.keys(registry.projects);
|
|
101
108
|
}
|
|
102
109
|
/**
|
|
103
|
-
* Remove a project from the registry
|
|
110
|
+
* Remove a project from the registry.
|
|
111
|
+
* By default, also deletes the project data directory.
|
|
112
|
+
* Pass keepData: true to only remove the registry entry.
|
|
104
113
|
*/
|
|
105
|
-
export async function unregisterProject(projectName) {
|
|
114
|
+
export async function unregisterProject(projectName, keepData = false) {
|
|
106
115
|
const registry = await readRegistry();
|
|
107
116
|
delete registry.projects[projectName];
|
|
108
117
|
await writeRegistry(registry);
|
|
118
|
+
if (!keepData) {
|
|
119
|
+
const { rm } = await import('node:fs/promises');
|
|
120
|
+
const dataDir = getProjectDataDir(projectName);
|
|
121
|
+
await rm(dataDir, { recursive: true, force: true });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the iteration directory for a specific project iteration.
|
|
126
|
+
* Pure path concatenation — does NOT check if the directory exists.
|
|
127
|
+
*/
|
|
128
|
+
export function getIterationDir(projectName, iteration) {
|
|
129
|
+
return join(getProjectDataDir(projectName), `iter-${iteration}`);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Start a new iteration for a project.
|
|
133
|
+
* Creates the iteration directory (with docs/ subdirectory) and updates the registry.
|
|
134
|
+
*
|
|
135
|
+
* @returns The new iteration number
|
|
136
|
+
*/
|
|
137
|
+
export async function startIteration(projectName) {
|
|
138
|
+
const registry = await readRegistry();
|
|
139
|
+
const entry = registry.projects[projectName];
|
|
140
|
+
if (!entry) {
|
|
141
|
+
throw new Error(`Project "${projectName}" not found in registry.`);
|
|
142
|
+
}
|
|
143
|
+
const newIteration = entry.totalIterations + 1;
|
|
144
|
+
entry.currentIteration = newIteration;
|
|
145
|
+
entry.totalIterations = newIteration;
|
|
146
|
+
// Create iteration directory with docs subdirectory
|
|
147
|
+
const iterDir = getIterationDir(projectName, newIteration);
|
|
148
|
+
await mkdir(join(iterDir, 'docs'), { recursive: true });
|
|
149
|
+
await writeRegistry(registry);
|
|
150
|
+
return newIteration;
|
|
109
151
|
}
|
|
110
152
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAA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
|
-
* Document review state management — <data_dir>/<project_name>/reviews.json
|
|
2
|
+
* Document review state management — <data_dir>/<project_name>/iter-<n>/reviews.json
|
|
3
3
|
*
|
|
4
4
|
* Tracks which documents are pending review, approved, or rejected.
|
|
5
5
|
*/
|
|
6
6
|
import type { DocReviewState } from './types.js';
|
|
7
7
|
/**
|
|
8
|
-
* Read the reviews state for a project.
|
|
8
|
+
* Read the reviews state for a project iteration.
|
|
9
9
|
*/
|
|
10
|
-
export declare function readReviews(projectName: string): Promise<Record<string, DocReviewState>>;
|
|
10
|
+
export declare function readReviews(projectName: string, iteration: number): Promise<Record<string, DocReviewState>>;
|
|
11
11
|
/**
|
|
12
12
|
* Submit a document for review. Sets status to "pending".
|
|
13
13
|
*/
|
|
14
|
-
export declare function submitForReview(projectName: string, docId: string): Promise<DocReviewState>;
|
|
14
|
+
export declare function submitForReview(projectName: string, iteration: number, docId: string): Promise<DocReviewState>;
|
|
15
15
|
/**
|
|
16
16
|
* Approve or reject a document review.
|
|
17
17
|
*/
|
|
18
|
-
export declare function resolveReview(projectName: string, docId: string, status: 'approved' | 'rejected', comment?: string): Promise<DocReviewState>;
|
|
18
|
+
export declare function resolveReview(projectName: string, iteration: number, docId: string, status: 'approved' | 'rejected', comment?: string): Promise<DocReviewState>;
|
|
19
19
|
/**
|
|
20
20
|
* Get the review state for a specific document.
|
|
21
21
|
*/
|
|
22
|
-
export declare function getDocReview(projectName: string, docId: string): Promise<DocReviewState | null>;
|
|
22
|
+
export declare function getDocReview(projectName: string, iteration: number, docId: string): Promise<DocReviewState | null>;
|
|
23
23
|
/**
|
|
24
|
-
* Get all pending reviews for a project.
|
|
24
|
+
* Get all pending reviews for a project iteration.
|
|
25
25
|
*/
|
|
26
|
-
export declare function getPendingReviews(projectName: string): Promise<DocReviewState[]>;
|
|
26
|
+
export declare function getPendingReviews(projectName: string, iteration: number): Promise<DocReviewState[]>;
|