@jonit-dev/night-watch-cli 1.5.8 → 1.6.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/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +39 -11
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +23 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/slice.d.ts +26 -0
- package/dist/commands/slice.d.ts.map +1 -0
- package/dist/commands/slice.js +175 -0
- package/dist/commands/slice.js.map +1 -0
- package/dist/commands/state.d.ts +8 -0
- package/dist/commands/state.d.ts.map +1 -0
- package/dist/commands/state.js +56 -0
- package/dist/commands/state.js.map +1 -0
- package/dist/commands/uninstall.js +2 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +11 -13
- package/dist/server/index.js.map +1 -1
- package/dist/storage/json-state-migrator.d.ts +24 -0
- package/dist/storage/json-state-migrator.d.ts.map +1 -0
- package/dist/storage/json-state-migrator.js +197 -0
- package/dist/storage/json-state-migrator.js.map +1 -0
- package/dist/storage/repositories/index.d.ts +23 -0
- package/dist/storage/repositories/index.d.ts.map +1 -0
- package/dist/storage/repositories/index.js +37 -0
- package/dist/storage/repositories/index.js.map +1 -0
- package/dist/storage/repositories/interfaces.d.ts +37 -0
- package/dist/storage/repositories/interfaces.d.ts.map +1 -0
- package/dist/storage/repositories/interfaces.js +6 -0
- package/dist/storage/repositories/interfaces.js.map +1 -0
- package/dist/storage/repositories/sqlite/execution-history-repository.d.ts +21 -0
- package/dist/storage/repositories/sqlite/execution-history-repository.d.ts.map +1 -0
- package/dist/storage/repositories/sqlite/execution-history-repository.js +94 -0
- package/dist/storage/repositories/sqlite/execution-history-repository.js.map +1 -0
- package/dist/storage/repositories/sqlite/prd-state-repository.d.ts +17 -0
- package/dist/storage/repositories/sqlite/prd-state-repository.d.ts.map +1 -0
- package/dist/storage/repositories/sqlite/prd-state-repository.js +74 -0
- package/dist/storage/repositories/sqlite/prd-state-repository.js.map +1 -0
- package/dist/storage/repositories/sqlite/project-registry-repository.d.ts +16 -0
- package/dist/storage/repositories/sqlite/project-registry-repository.d.ts.map +1 -0
- package/dist/storage/repositories/sqlite/project-registry-repository.js +34 -0
- package/dist/storage/repositories/sqlite/project-registry-repository.js.map +1 -0
- package/dist/storage/repositories/sqlite/roadmap-state-repository.d.ts +14 -0
- package/dist/storage/repositories/sqlite/roadmap-state-repository.d.ts.map +1 -0
- package/dist/storage/repositories/sqlite/roadmap-state-repository.js +47 -0
- package/dist/storage/repositories/sqlite/roadmap-state-repository.js.map +1 -0
- package/dist/storage/sqlite/client.d.ts +23 -0
- package/dist/storage/sqlite/client.d.ts.map +1 -0
- package/dist/storage/sqlite/client.js +47 -0
- package/dist/storage/sqlite/client.js.map +1 -0
- package/dist/storage/sqlite/migrations.d.ts +11 -0
- package/dist/storage/sqlite/migrations.d.ts.map +1 -0
- package/dist/storage/sqlite/migrations.js +57 -0
- package/dist/storage/sqlite/migrations.js.map +1 -0
- package/dist/templates/slicer-prompt.d.ts +54 -0
- package/dist/templates/slicer-prompt.d.ts.map +1 -0
- package/dist/templates/slicer-prompt.js +163 -0
- package/dist/templates/slicer-prompt.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/execution-history.d.ts +11 -5
- package/dist/utils/execution-history.d.ts.map +1 -1
- package/dist/utils/execution-history.js +27 -130
- package/dist/utils/execution-history.js.map +1 -1
- package/dist/utils/prd-states.d.ts +1 -2
- package/dist/utils/prd-states.d.ts.map +1 -1
- package/dist/utils/prd-states.js +10 -42
- package/dist/utils/prd-states.js.map +1 -1
- package/dist/utils/registry.d.ts +9 -4
- package/dist/utils/registry.d.ts.map +1 -1
- package/dist/utils/registry.js +21 -33
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/roadmap-scanner.d.ts +34 -2
- package/dist/utils/roadmap-scanner.d.ts.map +1 -1
- package/dist/utils/roadmap-scanner.js +218 -105
- package/dist/utils/roadmap-scanner.js.map +1 -1
- package/dist/utils/roadmap-state.d.ts +13 -6
- package/dist/utils/roadmap-state.d.ts.map +1 -1
- package/dist/utils/roadmap-state.js +50 -27
- package/dist/utils/roadmap-state.js.map +1 -1
- package/package.json +6 -1
- package/scripts/night-watch-cron.sh +65 -24
- package/scripts/night-watch-slicer-cron.sh +90 -0
- package/templates/night-watch-slicer.md +219 -0
- package/templates/night-watch.config.json +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite implementation of IRoadmapStateRepository.
|
|
3
|
+
* Persists roadmap state in the `roadmap_states` table, keyed by prd_dir.
|
|
4
|
+
*/
|
|
5
|
+
export class SqliteRoadmapStateRepository {
|
|
6
|
+
_db;
|
|
7
|
+
constructor(db) {
|
|
8
|
+
this._db = db;
|
|
9
|
+
}
|
|
10
|
+
load(prdDir) {
|
|
11
|
+
const row = this._db
|
|
12
|
+
.prepare(`SELECT version, last_scan, items_json
|
|
13
|
+
FROM roadmap_states
|
|
14
|
+
WHERE prd_dir = ?`)
|
|
15
|
+
.get(prdDir);
|
|
16
|
+
if (!row) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
let items = {};
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(row.items_json);
|
|
22
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
23
|
+
items = parsed;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
items = {};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
version: row.version,
|
|
31
|
+
lastScan: row.last_scan,
|
|
32
|
+
items,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
save(prdDir, state) {
|
|
36
|
+
const itemsJson = JSON.stringify(state.items);
|
|
37
|
+
this._db
|
|
38
|
+
.prepare(`INSERT INTO roadmap_states (prd_dir, version, last_scan, items_json)
|
|
39
|
+
VALUES (?, ?, ?, ?)
|
|
40
|
+
ON CONFLICT(prd_dir)
|
|
41
|
+
DO UPDATE SET version = excluded.version,
|
|
42
|
+
last_scan = excluded.last_scan,
|
|
43
|
+
items_json = excluded.items_json`)
|
|
44
|
+
.run(prdDir, state.version, state.lastScan, itemsJson);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=roadmap-state-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roadmap-state-repository.js","sourceRoot":"","sources":["../../../../src/storage/repositories/sqlite/roadmap-state-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,OAAO,4BAA4B;IACtB,GAAG,CAAoB;IAExC,YAAY,EAAqB;QAC/B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,MAAc;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG;aACjB,OAAO,CACN;;2BAEmB,CACpB;aACA,GAAG,CAAC,MAAM,CAAC,CAAC;QAEf,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,KAAK,GAA2B,EAAE,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBAClD,KAAK,GAAG,MAAgC,CAAC;YAC3C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,KAAK,GAAG,EAAE,CAAC;QACb,CAAC;QAED,OAAO;YACL,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,QAAQ,EAAE,GAAG,CAAC,SAAS;YACvB,KAAK;SACN,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAc,EAAE,KAAoB;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE9C,IAAI,CAAC,GAAG;aACL,OAAO,CACN;;;;;wDAKgD,CACjD;aACA,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database client for Night Watch CLI
|
|
3
|
+
* Opens (or creates) the database at ${NIGHT_WATCH_HOME}/state.db
|
|
4
|
+
* Applies WAL journal mode and busy_timeout pragmas on open.
|
|
5
|
+
*/
|
|
6
|
+
import Database from "better-sqlite3";
|
|
7
|
+
/**
|
|
8
|
+
* Get the path to the SQLite database file.
|
|
9
|
+
* Mirrors the same pattern used by getRegistryPath() and getHistoryPath().
|
|
10
|
+
*/
|
|
11
|
+
export declare function getDbPath(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Return the singleton Database instance, creating it on first call.
|
|
14
|
+
* The database directory is created if it does not exist.
|
|
15
|
+
* Pragmas applied: journal_mode = WAL, busy_timeout = 5000.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDb(): Database.Database;
|
|
18
|
+
/**
|
|
19
|
+
* Close the current singleton database connection and reset it.
|
|
20
|
+
* Primarily useful in tests to allow re-opening against a different path.
|
|
21
|
+
*/
|
|
22
|
+
export declare function closeDb(): void;
|
|
23
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/storage/sqlite/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAezC;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAK9B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database client for Night Watch CLI
|
|
3
|
+
* Opens (or creates) the database at ${NIGHT_WATCH_HOME}/state.db
|
|
4
|
+
* Applies WAL journal mode and busy_timeout pragmas on open.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import * as os from "os";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import Database from "better-sqlite3";
|
|
10
|
+
import { GLOBAL_CONFIG_DIR, STATE_DB_FILE_NAME } from "../../constants.js";
|
|
11
|
+
let _db = null;
|
|
12
|
+
/**
|
|
13
|
+
* Get the path to the SQLite database file.
|
|
14
|
+
* Mirrors the same pattern used by getRegistryPath() and getHistoryPath().
|
|
15
|
+
*/
|
|
16
|
+
export function getDbPath() {
|
|
17
|
+
const base = process.env.NIGHT_WATCH_HOME || path.join(os.homedir(), GLOBAL_CONFIG_DIR);
|
|
18
|
+
return path.join(base, STATE_DB_FILE_NAME);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Return the singleton Database instance, creating it on first call.
|
|
22
|
+
* The database directory is created if it does not exist.
|
|
23
|
+
* Pragmas applied: journal_mode = WAL, busy_timeout = 5000.
|
|
24
|
+
*/
|
|
25
|
+
export function getDb() {
|
|
26
|
+
if (_db) {
|
|
27
|
+
return _db;
|
|
28
|
+
}
|
|
29
|
+
const dbPath = getDbPath();
|
|
30
|
+
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
|
|
31
|
+
const db = new Database(dbPath);
|
|
32
|
+
db.pragma("journal_mode = WAL");
|
|
33
|
+
db.pragma("busy_timeout = 5000");
|
|
34
|
+
_db = db;
|
|
35
|
+
return _db;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Close the current singleton database connection and reset it.
|
|
39
|
+
* Primarily useful in tests to allow re-opening against a different path.
|
|
40
|
+
*/
|
|
41
|
+
export function closeDb() {
|
|
42
|
+
if (_db) {
|
|
43
|
+
_db.close();
|
|
44
|
+
_db = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/storage/sqlite/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,IAAI,GAAG,GAA6B,IAAI,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,IAAI,GACR,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK;IACnB,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAChC,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEjC,GAAG,GAAG,EAAE,CAAC;IACT,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO;IACrB,IAAI,GAAG,EAAE,CAAC;QACR,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,GAAG,GAAG,IAAI,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite schema migrations for Night Watch CLI.
|
|
3
|
+
* Creates all required tables if they do not already exist (idempotent).
|
|
4
|
+
*/
|
|
5
|
+
import Database from "better-sqlite3";
|
|
6
|
+
/**
|
|
7
|
+
* Run all migrations against the provided database instance.
|
|
8
|
+
* Safe to call multiple times — all DDL statements use IF NOT EXISTS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runMigrations(db: Database.Database): void;
|
|
11
|
+
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/storage/sqlite/migrations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAKtC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAgDzD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite schema migrations for Night Watch CLI.
|
|
3
|
+
* Creates all required tables if they do not already exist (idempotent).
|
|
4
|
+
*/
|
|
5
|
+
/** Current schema version */
|
|
6
|
+
const SCHEMA_VERSION = "1";
|
|
7
|
+
/**
|
|
8
|
+
* Run all migrations against the provided database instance.
|
|
9
|
+
* Safe to call multiple times — all DDL statements use IF NOT EXISTS.
|
|
10
|
+
*/
|
|
11
|
+
export function runMigrations(db) {
|
|
12
|
+
db.exec(`
|
|
13
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
14
|
+
id INTEGER PRIMARY KEY,
|
|
15
|
+
name TEXT NOT NULL,
|
|
16
|
+
path TEXT NOT NULL UNIQUE,
|
|
17
|
+
created_at INTEGER NOT NULL
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE TABLE IF NOT EXISTS execution_history (
|
|
21
|
+
id INTEGER PRIMARY KEY,
|
|
22
|
+
project_path TEXT NOT NULL,
|
|
23
|
+
prd_file TEXT NOT NULL,
|
|
24
|
+
timestamp INTEGER NOT NULL,
|
|
25
|
+
outcome TEXT NOT NULL,
|
|
26
|
+
exit_code INTEGER NOT NULL,
|
|
27
|
+
attempt INTEGER NOT NULL
|
|
28
|
+
);
|
|
29
|
+
CREATE INDEX IF NOT EXISTS idx_history_lookup
|
|
30
|
+
ON execution_history(project_path, prd_file, timestamp DESC);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE IF NOT EXISTS prd_states (
|
|
33
|
+
project_path TEXT NOT NULL,
|
|
34
|
+
prd_name TEXT NOT NULL,
|
|
35
|
+
status TEXT NOT NULL,
|
|
36
|
+
branch TEXT NOT NULL,
|
|
37
|
+
timestamp INTEGER NOT NULL,
|
|
38
|
+
PRIMARY KEY(project_path, prd_name)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
CREATE TABLE IF NOT EXISTS roadmap_states (
|
|
42
|
+
prd_dir TEXT PRIMARY KEY,
|
|
43
|
+
version INTEGER NOT NULL,
|
|
44
|
+
last_scan TEXT NOT NULL,
|
|
45
|
+
items_json TEXT NOT NULL
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
CREATE TABLE IF NOT EXISTS schema_meta (
|
|
49
|
+
key TEXT PRIMARY KEY,
|
|
50
|
+
value TEXT NOT NULL
|
|
51
|
+
);
|
|
52
|
+
`);
|
|
53
|
+
// Upsert the current schema version into schema_meta
|
|
54
|
+
db.prepare(`INSERT INTO schema_meta (key, value) VALUES ('schema_version', ?)
|
|
55
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run(SCHEMA_VERSION);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../../src/storage/sqlite/migrations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,6BAA6B;AAC7B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAAqB;IACjD,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCP,CAAC,CAAC;IAEH,qDAAqD;IACrD,EAAE,CAAC,OAAO,CACR;2DACuD,CACxD,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slicer Prompt Template
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to render the AI prompt for generating PRDs from roadmap items.
|
|
5
|
+
* The template is loaded from templates/night-watch-slicer.md and interpolated with
|
|
6
|
+
* runtime values from the roadmap item being processed.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Variables needed to render the slicer prompt
|
|
10
|
+
*/
|
|
11
|
+
export interface ISlicerPromptVars {
|
|
12
|
+
/** The title of the roadmap item */
|
|
13
|
+
title: string;
|
|
14
|
+
/** The section/category of the roadmap item */
|
|
15
|
+
section: string;
|
|
16
|
+
/** The description of the roadmap item */
|
|
17
|
+
description: string;
|
|
18
|
+
/** The full path where the PRD should be written */
|
|
19
|
+
outputFilePath: string;
|
|
20
|
+
/** The directory containing PRDs */
|
|
21
|
+
prdDir: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load the slicer prompt template from the templates directory.
|
|
25
|
+
* Falls back to the default template if the file cannot be read.
|
|
26
|
+
*
|
|
27
|
+
* @param templateDir - Optional custom template directory
|
|
28
|
+
* @returns The template string
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadSlicerTemplate(templateDir?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Clear the cached template (useful for testing)
|
|
33
|
+
*/
|
|
34
|
+
export declare function clearTemplateCache(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Render the slicer prompt by interpolating the template with the provided variables.
|
|
37
|
+
*
|
|
38
|
+
* @param vars - The variables to interpolate into the template
|
|
39
|
+
* @param customTemplate - Optional custom template to use instead of the default
|
|
40
|
+
* @returns The rendered prompt string
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderSlicerPrompt(vars: ISlicerPromptVars, customTemplate?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Create slicer prompt variables from a roadmap item.
|
|
45
|
+
*
|
|
46
|
+
* @param item - The roadmap item title
|
|
47
|
+
* @param section - The roadmap item section
|
|
48
|
+
* @param description - The roadmap item description
|
|
49
|
+
* @param prdDir - The PRD directory path
|
|
50
|
+
* @param prdFilename - The filename for the new PRD
|
|
51
|
+
* @returns The slicer prompt variables
|
|
52
|
+
*/
|
|
53
|
+
export declare function createSlicerPromptVars(title: string, section: string, description: string, prdDir: string, prdFilename: string): ISlicerPromptVars;
|
|
54
|
+
//# sourceMappingURL=slicer-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slicer-prompt.d.ts","sourceRoot":"","sources":["../../src/templates/slicer-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB;AAyFD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAoB/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CAaR;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAQnB"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slicer Prompt Template
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to render the AI prompt for generating PRDs from roadmap items.
|
|
5
|
+
* The template is loaded from templates/night-watch-slicer.md and interpolated with
|
|
6
|
+
* runtime values from the roadmap item being processed.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
/**
|
|
11
|
+
* The default slicer prompt template.
|
|
12
|
+
* This is used if the template file cannot be read.
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_SLICER_TEMPLATE = `You are a **PRD Creator Agent**. Your job: analyze the codebase and write a complete Product Requirements Document (PRD) for a feature.
|
|
15
|
+
|
|
16
|
+
When this activates: \`PRD Creator: Initializing\`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Input
|
|
21
|
+
|
|
22
|
+
You are creating a PRD for the following roadmap item:
|
|
23
|
+
|
|
24
|
+
**Section:** {{SECTION}}
|
|
25
|
+
**Title:** {{TITLE}}
|
|
26
|
+
**Description:** {{DESCRIPTION}}
|
|
27
|
+
|
|
28
|
+
The PRD must be written to this exact file path:
|
|
29
|
+
**Output File:** \`{{OUTPUT_FILE_PATH}}\`
|
|
30
|
+
|
|
31
|
+
The PRD directory is: \`{{PRD_DIR}}\`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Your Task
|
|
36
|
+
|
|
37
|
+
1. **Explore the Codebase** - Read relevant existing files to understand the project structure, patterns, and conventions.
|
|
38
|
+
|
|
39
|
+
2. **Assess Complexity** - Score the complexity using the rubric and determine whether this is LOW, MEDIUM, or HIGH complexity.
|
|
40
|
+
|
|
41
|
+
3. **Write a Complete PRD** - Create a full PRD following the prd-creator template structure with Context, Solution, Phases, Tests, and Acceptance Criteria.
|
|
42
|
+
|
|
43
|
+
4. **Write the PRD File** - Use the Write tool to create the PRD file at the exact path specified in \`{{OUTPUT_FILE_PATH}}\`.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Complexity Scoring
|
|
48
|
+
|
|
49
|
+
\`\`\`
|
|
50
|
+
COMPLEXITY SCORE (sum all that apply):
|
|
51
|
+
+1 Touches 1-5 files
|
|
52
|
+
+2 Touches 6-10 files
|
|
53
|
+
+3 Touches 10+ files
|
|
54
|
+
+2 New system/module from scratch
|
|
55
|
+
+2 Complex state logic / concurrency
|
|
56
|
+
+2 Multi-package changes
|
|
57
|
+
+1 Database schema changes
|
|
58
|
+
+1 External API integration
|
|
59
|
+
|
|
60
|
+
| Score | Level | Template Mode |
|
|
61
|
+
| ----- | ------ | ----------------------------------------------- |
|
|
62
|
+
| 1-3 | LOW | Minimal (skip sections marked with MEDIUM/HIGH) |
|
|
63
|
+
| 4-6 | MEDIUM | Standard (all sections) |
|
|
64
|
+
| 7+ | HIGH | Full + mandatory checkpoints every phase |
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## PRD Template Structure
|
|
70
|
+
|
|
71
|
+
Your PRD MUST follow this exact structure with these sections:
|
|
72
|
+
1. **Context** - Problem, files analyzed, current behavior, integration points
|
|
73
|
+
2. **Solution** - Approach, architecture diagram, key decisions, data changes
|
|
74
|
+
3. **Sequence Flow** (MEDIUM/HIGH) - Mermaid sequence diagram
|
|
75
|
+
4. **Execution Phases** - Concrete phases with files, implementation steps, and tests
|
|
76
|
+
5. **Acceptance Criteria** - Checklist of completion requirements
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Critical Instructions
|
|
81
|
+
|
|
82
|
+
1. **Read all relevant existing files BEFORE writing any code**
|
|
83
|
+
2. **Follow existing patterns in the codebase**
|
|
84
|
+
3. **Write the PRD with concrete file paths and implementation details**
|
|
85
|
+
4. **Include specific test names and assertions**
|
|
86
|
+
5. **Use the Write tool to create the PRD file at \`{{OUTPUT_FILE_PATH}}\`**
|
|
87
|
+
6. **The PRD must be complete and actionable - no TODO placeholders**
|
|
88
|
+
|
|
89
|
+
DO NOT leave placeholder text like "[Name]" or "[description]" in the final PRD.
|
|
90
|
+
DO NOT skip any sections.
|
|
91
|
+
DO NOT forget to write the file.
|
|
92
|
+
`;
|
|
93
|
+
// Cache for the loaded template
|
|
94
|
+
let cachedTemplate = null;
|
|
95
|
+
/**
|
|
96
|
+
* Load the slicer prompt template from the templates directory.
|
|
97
|
+
* Falls back to the default template if the file cannot be read.
|
|
98
|
+
*
|
|
99
|
+
* @param templateDir - Optional custom template directory
|
|
100
|
+
* @returns The template string
|
|
101
|
+
*/
|
|
102
|
+
export function loadSlicerTemplate(templateDir) {
|
|
103
|
+
if (cachedTemplate) {
|
|
104
|
+
return cachedTemplate;
|
|
105
|
+
}
|
|
106
|
+
// Determine the template file path
|
|
107
|
+
const templatePath = templateDir
|
|
108
|
+
? path.join(templateDir, "night-watch-slicer.md")
|
|
109
|
+
: path.resolve(__dirname, "..", "..", "templates", "night-watch-slicer.md");
|
|
110
|
+
try {
|
|
111
|
+
cachedTemplate = fs.readFileSync(templatePath, "utf-8");
|
|
112
|
+
return cachedTemplate;
|
|
113
|
+
}
|
|
114
|
+
catch (_error) {
|
|
115
|
+
// Fall back to the default template
|
|
116
|
+
console.warn(`Warning: Could not load slicer template from ${templatePath}, using default`);
|
|
117
|
+
return DEFAULT_SLICER_TEMPLATE;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Clear the cached template (useful for testing)
|
|
122
|
+
*/
|
|
123
|
+
export function clearTemplateCache() {
|
|
124
|
+
cachedTemplate = null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Render the slicer prompt by interpolating the template with the provided variables.
|
|
128
|
+
*
|
|
129
|
+
* @param vars - The variables to interpolate into the template
|
|
130
|
+
* @param customTemplate - Optional custom template to use instead of the default
|
|
131
|
+
* @returns The rendered prompt string
|
|
132
|
+
*/
|
|
133
|
+
export function renderSlicerPrompt(vars, customTemplate) {
|
|
134
|
+
const template = customTemplate ?? loadSlicerTemplate();
|
|
135
|
+
let result = template;
|
|
136
|
+
// Replace all placeholders with their values
|
|
137
|
+
result = result.replace(/\{\{TITLE\}\}/g, vars.title);
|
|
138
|
+
result = result.replace(/\{\{SECTION\}\}/g, vars.section);
|
|
139
|
+
result = result.replace(/\{\{DESCRIPTION\}\}/g, vars.description);
|
|
140
|
+
result = result.replace(/\{\{OUTPUT_FILE_PATH\}\}/g, vars.outputFilePath);
|
|
141
|
+
result = result.replace(/\{\{PRD_DIR\}\}/g, vars.prdDir);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create slicer prompt variables from a roadmap item.
|
|
146
|
+
*
|
|
147
|
+
* @param item - The roadmap item title
|
|
148
|
+
* @param section - The roadmap item section
|
|
149
|
+
* @param description - The roadmap item description
|
|
150
|
+
* @param prdDir - The PRD directory path
|
|
151
|
+
* @param prdFilename - The filename for the new PRD
|
|
152
|
+
* @returns The slicer prompt variables
|
|
153
|
+
*/
|
|
154
|
+
export function createSlicerPromptVars(title, section, description, prdDir, prdFilename) {
|
|
155
|
+
return {
|
|
156
|
+
title,
|
|
157
|
+
section,
|
|
158
|
+
description: description || "(No description provided)",
|
|
159
|
+
outputFilePath: path.join(prdDir, prdFilename),
|
|
160
|
+
prdDir,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=slicer-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slicer-prompt.js","sourceRoot":"","sources":["../../src/templates/slicer-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAkB7B;;;GAGG;AACH,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8E/B,CAAC;AAEF,gCAAgC;AAChC,IAAI,cAAc,GAAkB,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAoB;IACrD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,mCAAmC;IACnC,MAAM,YAAY,GAAG,WAAW;QAC9B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;QACjD,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,CAAC,CAAC;IAE9E,IAAI,CAAC;QACH,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,cAAc,CAAC;IACxB,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,oCAAoC;QACpC,OAAO,CAAC,IAAI,CACV,gDAAgD,YAAY,iBAAiB,CAC9E,CAAC;QACF,OAAO,uBAAuB,CAAC;IACjC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAuB,EACvB,cAAuB;IAEvB,MAAM,QAAQ,GAAG,cAAc,IAAI,kBAAkB,EAAE,CAAC;IAExD,IAAI,MAAM,GAAG,QAAQ,CAAC;IAEtB,6CAA6C;IAC7C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1E,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,OAAe,EACf,WAAmB,EACnB,MAAc,EACd,WAAmB;IAEnB,OAAO;QACL,KAAK;QACL,OAAO;QACP,WAAW,EAAE,WAAW,IAAI,2BAA2B;QACvD,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC;QAC9C,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface INightWatchConfig {
|
|
|
45
45
|
prdPriority: string[];
|
|
46
46
|
/** Roadmap scanner configuration */
|
|
47
47
|
roadmapScanner: IRoadmapScannerConfig;
|
|
48
|
+
/** Directory containing custom template overrides (relative to project root) */
|
|
49
|
+
templatesDir: string;
|
|
48
50
|
}
|
|
49
51
|
export type WebhookType = "slack" | "discord" | "telegram";
|
|
50
52
|
export type NotificationEvent = "run_started" | "run_succeeded" | "run_failed" | "run_timeout" | "review_completed";
|
|
@@ -68,5 +70,9 @@ export interface IRoadmapScannerConfig {
|
|
|
68
70
|
roadmapPath: string;
|
|
69
71
|
/** Interval in seconds between automatic scans */
|
|
70
72
|
autoScanInterval: number;
|
|
73
|
+
/** Cron schedule for the slicer (AI-powered PRD generation from roadmap items) */
|
|
74
|
+
slicerSchedule: string;
|
|
75
|
+
/** Maximum runtime in seconds for the slicer */
|
|
76
|
+
slicerMaxRuntime: number;
|
|
71
77
|
}
|
|
72
78
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAGhC,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IAEtB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IAEnB,iDAAiD;IACjD,kBAAkB,EAAE,MAAM,CAAC;IAE3B,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IAErB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IAEvB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IAInB,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IAEzB,sGAAsG;IACtG,kBAAkB,EAAE,MAAM,CAAC;IAE3B,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IAInB,uCAAuC;IACvC,QAAQ,EAAE,QAAQ,CAAC;IAEnB,sCAAsC;IACtC,eAAe,EAAE,OAAO,CAAC;IAEzB,yFAAyF;IACzF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,yCAAyC;IACzC,aAAa,EAAE,mBAAmB,CAAC;IAEnC,qEAAqE;IACrE,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,oCAAoC;IACpC,cAAc,EAAE,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAGhC,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IAEtB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IAEnB,iDAAiD;IACjD,kBAAkB,EAAE,MAAM,CAAC;IAE3B,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IAErB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IAEvB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IAInB,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IAEzB,sGAAsG;IACtG,kBAAkB,EAAE,MAAM,CAAC;IAE3B,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IAInB,uCAAuC;IACvC,QAAQ,EAAE,QAAQ,CAAC;IAEnB,sCAAsC;IACtC,eAAe,EAAE,OAAO,CAAC;IAEzB,yFAAyF;IACzF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,yCAAyC;IACzC,aAAa,EAAE,mBAAmB,CAAC;IAEnC,qEAAqE;IACrE,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,oCAAoC;IACpC,cAAc,EAAE,qBAAqB,CAAC;IAEtC,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAEpH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IAEjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IAEpB,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,CAAC;IAEzB,kFAAkF;IAClF,cAAc,EAAE,MAAM,CAAC;IAEvB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Execution history ledger for Night Watch CLI
|
|
3
|
-
* Stores PRD execution records in
|
|
3
|
+
* Stores PRD execution records in the SQLite repository layer.
|
|
4
4
|
* Decoupled from PRD file paths — keyed by project directory + PRD filename.
|
|
5
5
|
*/
|
|
6
|
+
import { resetRepositories } from "../storage/repositories/index.js";
|
|
7
|
+
import { closeDb } from "../storage/sqlite/client.js";
|
|
6
8
|
export type ExecutionOutcome = "success" | "failure" | "timeout" | "rate_limited";
|
|
7
9
|
export interface IExecutionRecord {
|
|
8
10
|
timestamp: number;
|
|
@@ -18,15 +20,19 @@ interface IPrdHistory {
|
|
|
18
20
|
*/
|
|
19
21
|
export type IExecutionHistory = Record<string, Record<string, IPrdHistory>>;
|
|
20
22
|
/**
|
|
21
|
-
* Get the path to the history file
|
|
23
|
+
* Get the path to the history file.
|
|
24
|
+
* Kept for backward compatibility.
|
|
22
25
|
*/
|
|
23
26
|
export declare function getHistoryPath(): string;
|
|
24
27
|
/**
|
|
25
|
-
* Load execution history from
|
|
28
|
+
* Load execution history from the SQLite repository.
|
|
29
|
+
* Returns the full IExecutionHistory structure reconstructed from the DB.
|
|
26
30
|
*/
|
|
27
31
|
export declare function loadHistory(): IExecutionHistory;
|
|
28
32
|
/**
|
|
29
|
-
* Save execution history to
|
|
33
|
+
* Save execution history to the repository.
|
|
34
|
+
* Full replace: clears all existing records then inserts all records from the
|
|
35
|
+
* provided IExecutionHistory structure in a single transaction.
|
|
30
36
|
*/
|
|
31
37
|
export declare function saveHistory(history: IExecutionHistory): void;
|
|
32
38
|
/**
|
|
@@ -44,5 +50,5 @@ export declare function getLastExecution(projectDir: string, prdFile: string): I
|
|
|
44
50
|
* Returns true if the PRD should be skipped.
|
|
45
51
|
*/
|
|
46
52
|
export declare function isInCooldown(projectDir: string, prdFile: string, cooldownPeriod: number): boolean;
|
|
47
|
-
export {};
|
|
53
|
+
export { closeDb, resetRepositories };
|
|
48
54
|
//# sourceMappingURL=execution-history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-history.d.ts","sourceRoot":"","sources":["../../src/utils/execution-history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"execution-history.d.ts","sourceRoot":"","sources":["../../src/utils/execution-history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAmB,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;AAElF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAG/C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAG5D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,MAAU,GAClB,IAAI,CAaN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,gBAAgB,GAAG,IAAI,CAKzB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,OAAO,CAYT;AAED,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|