@sun-asterisk/sungen 3.2.2-beta.6 → 3.2.2-beta.7
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/commands/journey.d.ts.map +1 -1
- package/dist/cli/commands/journey.js +5 -1
- package/dist/cli/commands/journey.js.map +1 -1
- package/dist/harness/journey.d.ts +14 -1
- package/dist/harness/journey.d.ts.map +1 -1
- package/dist/harness/journey.js +80 -5
- package/dist/harness/journey.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/commands/journey.ts +6 -2
- package/src/harness/journey.ts +87 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/journey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/journey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsC7D"}
|
|
@@ -54,6 +54,8 @@ function registerJourneyCommand(program) {
|
|
|
54
54
|
.command('journey')
|
|
55
55
|
.description('Durable "you are here" board (#381): obligations + what-to-review + next, synthesised read-only from the audit report + ledger already on disk.')
|
|
56
56
|
.option('-s, --screen <name>', 'Screen / flow / api unit name')
|
|
57
|
+
.option('--waive <obligation>', 'Waive an obligation (e.g. OB-coverage) — requires --reason')
|
|
58
|
+
.option('--reason <text>', 'The reason a waived obligation is acceptable (mandatory with --waive)')
|
|
57
59
|
.option('--json', 'Output the raw JSON report')
|
|
58
60
|
.action((options) => {
|
|
59
61
|
try {
|
|
@@ -62,7 +64,9 @@ function registerJourneyCommand(program) {
|
|
|
62
64
|
throw new Error('Provide --screen <name>');
|
|
63
65
|
if (!findScreenDir(name))
|
|
64
66
|
throw new Error(`Not found: qa/screens/${name}, qa/flows/${name}, or qa/api/${name}`);
|
|
65
|
-
const report =
|
|
67
|
+
const report = options.waive
|
|
68
|
+
? (0, journey_1.waive)(process.cwd(), name, options.waive, options.reason || '')
|
|
69
|
+
: (0, journey_1.runJourney)(process.cwd(), name);
|
|
66
70
|
const outDir = path.join(process.cwd(), '.sungen', 'journey');
|
|
67
71
|
fs.mkdirSync(outDir, { recursive: true });
|
|
68
72
|
const slug = (0, unit_paths_1.reportSlug)(name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../../src/cli/commands/journey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,
|
|
1
|
+
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../../src/cli/commands/journey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wDAsCC;AArDD,2CAA6B;AAC7B,uCAAyB;AACzB,mDAA8E;AAC9E,yDAAsD;AAEtD,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC;KAC5C,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,UAAU;QAAE,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,S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E,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAC9F,MAAM,KAAK,GAAG,IAAA,4BAAkB,EAAC,MAAM,CAAC,CAAC;YACzC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAExE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACnB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC/F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export type ObStatus = 'satisfied' | 'needs-work' | 'pending';
|
|
1
|
+
export type ObStatus = 'satisfied' | 'needs-work' | 'pending' | 'waived';
|
|
2
2
|
export interface Obligation {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
status: ObStatus;
|
|
6
6
|
detail: string;
|
|
7
|
+
waivedReason?: string;
|
|
7
8
|
}
|
|
8
9
|
export interface JourneyReport {
|
|
9
10
|
unit: string;
|
|
@@ -16,6 +17,18 @@ export interface JourneyReport {
|
|
|
16
17
|
needsYou: string[];
|
|
17
18
|
nextSuggested: string;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The public entry: compute fresh, then RECONCILE with the persisted state —
|
|
22
|
+
* - auto-close is automatic (fresh recompute reflects the current artifacts);
|
|
23
|
+
* - an active waiver (evidence unchanged) sets status='waived' (carries the reason);
|
|
24
|
+
* - a STALE waiver (audit changed since it was waived) is re-surfaced for re-decision (anti-amnesia).
|
|
25
|
+
* Then persist the current evidence cursor.
|
|
26
|
+
*/
|
|
19
27
|
export declare function runJourney(projectRoot: string, unit: string): JourneyReport;
|
|
28
|
+
/**
|
|
29
|
+
* Waive an obligation — REQUIRES a reason (anti-amnesia: a waiver leaves a recorded "why").
|
|
30
|
+
* Records the current evidence cursor so reconcile can invalidate it if the audit changes.
|
|
31
|
+
*/
|
|
32
|
+
export declare function waive(projectRoot: string, unit: string, obId: string, reason: string): JourneyReport;
|
|
20
33
|
export declare function renderJourneyBoard(r: JourneyReport): string;
|
|
21
34
|
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/harness/journey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/harness/journey.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AA0HD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAqB3E;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAepG;AAID,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAkB3D"}
|
package/dist/harness/journey.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.runJourney = runJourney;
|
|
37
|
+
exports.waive = waive;
|
|
37
38
|
exports.renderJourneyBoard = renderJourneyBoard;
|
|
38
39
|
/**
|
|
39
40
|
* Journey board (epic #381, story S1) — the durable, read-only "you are here" view.
|
|
@@ -44,12 +45,14 @@ exports.renderJourneyBoard = renderJourneyBoard;
|
|
|
44
45
|
* the phase history ("you are here"). The output answers the three QA questions — what's next /
|
|
45
46
|
* what to review / what's doubtful — and persists `.sungen/journey/<slug>.{json,board.md}`.
|
|
46
47
|
*
|
|
47
|
-
* S1
|
|
48
|
-
* (
|
|
49
|
-
*
|
|
48
|
+
* S1 = the read-only synthesis. S2 (this file) adds the **writable lifecycle**: persisted
|
|
49
|
+
* waivers (reason-required, anti-amnesia), reconcile (auto-close satisfied; re-surface a waiver
|
|
50
|
+
* when its evidence changed), via `runJourney` + `waive`. Gate-bound predicates + inter-phase
|
|
51
|
+
* gates are S3. Pure-deterministic, no AI.
|
|
50
52
|
*/
|
|
51
53
|
const fs = __importStar(require("fs"));
|
|
52
54
|
const path = __importStar(require("path"));
|
|
55
|
+
const crypto = __importStar(require("crypto"));
|
|
53
56
|
const unit_paths_1 = require("./unit-paths");
|
|
54
57
|
function readJSON(p) {
|
|
55
58
|
try {
|
|
@@ -80,7 +83,7 @@ function isHumanFinding(f) {
|
|
|
80
83
|
return /@manual|MANUAL-|DEPTH-DEFERRED|UNSOURCEABLE|CAPABILITY-SUGGESTION|judgment|oracle|review/i.test(f);
|
|
81
84
|
}
|
|
82
85
|
const SAT = 0.8; // axis at/above this = satisfied (below = needs-work)
|
|
83
|
-
function
|
|
86
|
+
function computeFresh(projectRoot, unit) {
|
|
84
87
|
const slug = (0, unit_paths_1.reportSlug)(unit);
|
|
85
88
|
const audit = readJSON(path.join(projectRoot, '.sungen', 'reports', `${slug}-audit.json`));
|
|
86
89
|
const phases = readLedgerPhases(path.join(projectRoot, '.sungen', 'ledger', `${slug}.jsonl`));
|
|
@@ -148,7 +151,79 @@ function runJourney(projectRoot, unit) {
|
|
|
148
151
|
obligations, needsYou, nextSuggested,
|
|
149
152
|
};
|
|
150
153
|
}
|
|
151
|
-
|
|
154
|
+
function statePath(projectRoot, slug) {
|
|
155
|
+
return path.join(projectRoot, '.sungen', 'journey', `${slug}.state.json`);
|
|
156
|
+
}
|
|
157
|
+
/** Evidence cursor: the audit report's content hash. A waiver is invalidated when this changes. */
|
|
158
|
+
function auditHashOf(projectRoot, slug) {
|
|
159
|
+
const p = path.join(projectRoot, '.sungen', 'reports', `${slug}-audit.json`);
|
|
160
|
+
return fs.existsSync(p) ? crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex') : '';
|
|
161
|
+
}
|
|
162
|
+
function loadState(p) { return readJSON(p); }
|
|
163
|
+
function saveState(p, s) {
|
|
164
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
165
|
+
fs.writeFileSync(p, JSON.stringify(s, null, 2), 'utf-8');
|
|
166
|
+
}
|
|
167
|
+
/** Recompute nextSuggested AFTER waivers are applied (a waived obligation is not a gap). */
|
|
168
|
+
function computeNext(r, unit) {
|
|
169
|
+
const gap = r.obligations.find((o) => o.status !== 'satisfied' && o.status !== 'waived' && o.id !== 'OB-signoff');
|
|
170
|
+
if (gap)
|
|
171
|
+
return `Repair "${gap.title}" (${gap.detail}).`;
|
|
172
|
+
if (!r.phasesDone.some((s) => s === 'run' || s.startsWith('run')))
|
|
173
|
+
return `Quality satisfied — run \`/sungen:run-test ${unit}\`.`;
|
|
174
|
+
return `All obligations satisfied/waived — review the ${r.needsYou.length} queued item(s), then sign off & deliver.`;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The public entry: compute fresh, then RECONCILE with the persisted state —
|
|
178
|
+
* - auto-close is automatic (fresh recompute reflects the current artifacts);
|
|
179
|
+
* - an active waiver (evidence unchanged) sets status='waived' (carries the reason);
|
|
180
|
+
* - a STALE waiver (audit changed since it was waived) is re-surfaced for re-decision (anti-amnesia).
|
|
181
|
+
* Then persist the current evidence cursor.
|
|
182
|
+
*/
|
|
183
|
+
function runJourney(projectRoot, unit) {
|
|
184
|
+
const slug = (0, unit_paths_1.reportSlug)(unit);
|
|
185
|
+
const report = computeFresh(projectRoot, unit);
|
|
186
|
+
const sp = statePath(projectRoot, slug);
|
|
187
|
+
const state = loadState(sp) || { unit, auditHash: '', waivers: {} };
|
|
188
|
+
const curHash = auditHashOf(projectRoot, slug);
|
|
189
|
+
for (const ob of report.obligations) {
|
|
190
|
+
const w = state.waivers[ob.id];
|
|
191
|
+
if (!w)
|
|
192
|
+
continue;
|
|
193
|
+
if (w.auditHashAtWaive === curHash) {
|
|
194
|
+
ob.status = 'waived';
|
|
195
|
+
ob.waivedReason = w.reason;
|
|
196
|
+
ob.detail = `waived — ${w.reason}`;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
report.needsYou.unshift(`⚠️ Waiver on "${ob.title}" is STALE (evidence changed since ${w.at}) — re-decide. Was: ${w.reason}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
report.nextSuggested = computeNext(report, unit);
|
|
203
|
+
saveState(sp, { unit, auditHash: curHash, waivers: state.waivers });
|
|
204
|
+
return report;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Waive an obligation — REQUIRES a reason (anti-amnesia: a waiver leaves a recorded "why").
|
|
208
|
+
* Records the current evidence cursor so reconcile can invalidate it if the audit changes.
|
|
209
|
+
*/
|
|
210
|
+
function waive(projectRoot, unit, obId, reason) {
|
|
211
|
+
if (!reason || !reason.trim()) {
|
|
212
|
+
throw new Error('A reason is required to waive (anti-amnesia: a waiver must record WHY). Use --reason "...".');
|
|
213
|
+
}
|
|
214
|
+
const slug = (0, unit_paths_1.reportSlug)(unit);
|
|
215
|
+
const fresh = computeFresh(projectRoot, unit);
|
|
216
|
+
const valid = fresh.obligations.map((o) => o.id);
|
|
217
|
+
if (!valid.includes(obId)) {
|
|
218
|
+
throw new Error(`Unknown obligation "${obId}". Valid: ${valid.join(', ')}`);
|
|
219
|
+
}
|
|
220
|
+
const sp = statePath(projectRoot, slug);
|
|
221
|
+
const state = loadState(sp) || { unit, auditHash: '', waivers: {} };
|
|
222
|
+
state.waivers[obId] = { reason: reason.trim(), at: new Date().toISOString(), auditHashAtWaive: auditHashOf(projectRoot, slug) };
|
|
223
|
+
saveState(sp, state);
|
|
224
|
+
return runJourney(projectRoot, unit);
|
|
225
|
+
}
|
|
226
|
+
const ICON = { satisfied: '✅', 'needs-work': '⚠️ ', pending: '⏳', waived: '🚫' };
|
|
152
227
|
function renderJourneyBoard(r) {
|
|
153
228
|
const L = [];
|
|
154
229
|
L.push(`# Journey — ${r.unit}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/harness/journey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/harness/journey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,gCAqBC;AAMD,sBAeC;AAID,gDAkBC;AAxOD;;;;;;;;;;;;;GAaG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AACjC,6CAA0C;AAwB1C,SAAS,QAAQ,CAAC,CAAS;IACzB,IAAI,CAAC;QAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC1G,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAS;IACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAS;QAC3B,IAAI,CAAC;YAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAAC,IAAI,CAAC,CAAC,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAA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,8BAA8B,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM;QAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;;QAC5E,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAClC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sun-asterisk/sungen",
|
|
3
|
-
"version": "3.2.2-beta.
|
|
3
|
+
"version": "3.2.2-beta.7",
|
|
4
4
|
"description": "Deterministic E2E Test Compiler - Gherkin + Selectors → Playwright tests",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=18.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@sungen/driver-ui": "3.2.2-beta.
|
|
36
|
+
"@sungen/driver-ui": "3.2.2-beta.7",
|
|
37
37
|
"@anthropic-ai/sdk": "^0.71.0",
|
|
38
38
|
"@babel/parser": "^7.28.5",
|
|
39
39
|
"@babel/traverse": "^7.28.5",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { runJourney, renderJourneyBoard } from '../../harness/journey';
|
|
4
|
+
import { runJourney, waive, renderJourneyBoard } from '../../harness/journey';
|
|
5
5
|
import { reportSlug } from '../../harness/unit-paths';
|
|
6
6
|
|
|
7
7
|
function findScreenDir(name: string): string | null {
|
|
@@ -19,6 +19,8 @@ export function registerJourneyCommand(program: Command): void {
|
|
|
19
19
|
.command('journey')
|
|
20
20
|
.description('Durable "you are here" board (#381): obligations + what-to-review + next, synthesised read-only from the audit report + ledger already on disk.')
|
|
21
21
|
.option('-s, --screen <name>', 'Screen / flow / api unit name')
|
|
22
|
+
.option('--waive <obligation>', 'Waive an obligation (e.g. OB-coverage) — requires --reason')
|
|
23
|
+
.option('--reason <text>', 'The reason a waived obligation is acceptable (mandatory with --waive)')
|
|
22
24
|
.option('--json', 'Output the raw JSON report')
|
|
23
25
|
.action((options) => {
|
|
24
26
|
try {
|
|
@@ -26,7 +28,9 @@ export function registerJourneyCommand(program: Command): void {
|
|
|
26
28
|
if (!name) throw new Error('Provide --screen <name>');
|
|
27
29
|
if (!findScreenDir(name)) throw new Error(`Not found: qa/screens/${name}, qa/flows/${name}, or qa/api/${name}`);
|
|
28
30
|
|
|
29
|
-
const report =
|
|
31
|
+
const report = options.waive
|
|
32
|
+
? waive(process.cwd(), name, options.waive, options.reason || '')
|
|
33
|
+
: runJourney(process.cwd(), name);
|
|
30
34
|
|
|
31
35
|
const outDir = path.join(process.cwd(), '.sungen', 'journey');
|
|
32
36
|
fs.mkdirSync(outDir, { recursive: true });
|
package/src/harness/journey.ts
CHANGED
|
@@ -7,21 +7,24 @@
|
|
|
7
7
|
* the phase history ("you are here"). The output answers the three QA questions — what's next /
|
|
8
8
|
* what to review / what's doubtful — and persists `.sungen/journey/<slug>.{json,board.md}`.
|
|
9
9
|
*
|
|
10
|
-
* S1
|
|
11
|
-
* (
|
|
12
|
-
*
|
|
10
|
+
* S1 = the read-only synthesis. S2 (this file) adds the **writable lifecycle**: persisted
|
|
11
|
+
* waivers (reason-required, anti-amnesia), reconcile (auto-close satisfied; re-surface a waiver
|
|
12
|
+
* when its evidence changed), via `runJourney` + `waive`. Gate-bound predicates + inter-phase
|
|
13
|
+
* gates are S3. Pure-deterministic, no AI.
|
|
13
14
|
*/
|
|
14
15
|
import * as fs from 'fs';
|
|
15
16
|
import * as path from 'path';
|
|
17
|
+
import * as crypto from 'crypto';
|
|
16
18
|
import { reportSlug } from './unit-paths';
|
|
17
19
|
|
|
18
|
-
export type ObStatus = 'satisfied' | 'needs-work' | 'pending';
|
|
20
|
+
export type ObStatus = 'satisfied' | 'needs-work' | 'pending' | 'waived';
|
|
19
21
|
|
|
20
22
|
export interface Obligation {
|
|
21
23
|
id: string;
|
|
22
24
|
title: string;
|
|
23
25
|
status: ObStatus;
|
|
24
26
|
detail: string;
|
|
27
|
+
waivedReason?: string; // S2 — set when the QA explicitly waived this obligation
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export interface JourneyReport {
|
|
@@ -57,7 +60,7 @@ function isHumanFinding(f: string): boolean {
|
|
|
57
60
|
|
|
58
61
|
const SAT = 0.8; // axis at/above this = satisfied (below = needs-work)
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
function computeFresh(projectRoot: string, unit: string): JourneyReport {
|
|
61
64
|
const slug = reportSlug(unit);
|
|
62
65
|
const audit = readJSON(path.join(projectRoot, '.sungen', 'reports', `${slug}-audit.json`));
|
|
63
66
|
const phases = readLedgerPhases(path.join(projectRoot, '.sungen', 'ledger', `${slug}.jsonl`));
|
|
@@ -129,7 +132,85 @@ export function runJourney(projectRoot: string, unit: string): JourneyReport {
|
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
|
|
132
|
-
|
|
135
|
+
// ---------------- S2: writable lifecycle — persisted waivers + reconcile ----------------
|
|
136
|
+
|
|
137
|
+
interface Waiver { reason: string; at: string; auditHashAtWaive: string; }
|
|
138
|
+
interface JourneyState { unit: string; auditHash: string; waivers: Record<string, Waiver>; }
|
|
139
|
+
|
|
140
|
+
function statePath(projectRoot: string, slug: string): string {
|
|
141
|
+
return path.join(projectRoot, '.sungen', 'journey', `${slug}.state.json`);
|
|
142
|
+
}
|
|
143
|
+
/** Evidence cursor: the audit report's content hash. A waiver is invalidated when this changes. */
|
|
144
|
+
function auditHashOf(projectRoot: string, slug: string): string {
|
|
145
|
+
const p = path.join(projectRoot, '.sungen', 'reports', `${slug}-audit.json`);
|
|
146
|
+
return fs.existsSync(p) ? crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex') : '';
|
|
147
|
+
}
|
|
148
|
+
function loadState(p: string): JourneyState | null { return readJSON(p); }
|
|
149
|
+
function saveState(p: string, s: JourneyState): void {
|
|
150
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
151
|
+
fs.writeFileSync(p, JSON.stringify(s, null, 2), 'utf-8');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Recompute nextSuggested AFTER waivers are applied (a waived obligation is not a gap). */
|
|
155
|
+
function computeNext(r: JourneyReport, unit: string): string {
|
|
156
|
+
const gap = r.obligations.find((o) => o.status !== 'satisfied' && o.status !== 'waived' && o.id !== 'OB-signoff');
|
|
157
|
+
if (gap) return `Repair "${gap.title}" (${gap.detail}).`;
|
|
158
|
+
if (!r.phasesDone.some((s) => s === 'run' || s.startsWith('run'))) return `Quality satisfied — run \`/sungen:run-test ${unit}\`.`;
|
|
159
|
+
return `All obligations satisfied/waived — review the ${r.needsYou.length} queued item(s), then sign off & deliver.`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The public entry: compute fresh, then RECONCILE with the persisted state —
|
|
164
|
+
* - auto-close is automatic (fresh recompute reflects the current artifacts);
|
|
165
|
+
* - an active waiver (evidence unchanged) sets status='waived' (carries the reason);
|
|
166
|
+
* - a STALE waiver (audit changed since it was waived) is re-surfaced for re-decision (anti-amnesia).
|
|
167
|
+
* Then persist the current evidence cursor.
|
|
168
|
+
*/
|
|
169
|
+
export function runJourney(projectRoot: string, unit: string): JourneyReport {
|
|
170
|
+
const slug = reportSlug(unit);
|
|
171
|
+
const report = computeFresh(projectRoot, unit);
|
|
172
|
+
const sp = statePath(projectRoot, slug);
|
|
173
|
+
const state = loadState(sp) || { unit, auditHash: '', waivers: {} };
|
|
174
|
+
const curHash = auditHashOf(projectRoot, slug);
|
|
175
|
+
|
|
176
|
+
for (const ob of report.obligations) {
|
|
177
|
+
const w = state.waivers[ob.id];
|
|
178
|
+
if (!w) continue;
|
|
179
|
+
if (w.auditHashAtWaive === curHash) {
|
|
180
|
+
ob.status = 'waived';
|
|
181
|
+
ob.waivedReason = w.reason;
|
|
182
|
+
ob.detail = `waived — ${w.reason}`;
|
|
183
|
+
} else {
|
|
184
|
+
report.needsYou.unshift(`⚠️ Waiver on "${ob.title}" is STALE (evidence changed since ${w.at}) — re-decide. Was: ${w.reason}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
report.nextSuggested = computeNext(report, unit);
|
|
188
|
+
saveState(sp, { unit, auditHash: curHash, waivers: state.waivers });
|
|
189
|
+
return report;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Waive an obligation — REQUIRES a reason (anti-amnesia: a waiver leaves a recorded "why").
|
|
194
|
+
* Records the current evidence cursor so reconcile can invalidate it if the audit changes.
|
|
195
|
+
*/
|
|
196
|
+
export function waive(projectRoot: string, unit: string, obId: string, reason: string): JourneyReport {
|
|
197
|
+
if (!reason || !reason.trim()) {
|
|
198
|
+
throw new Error('A reason is required to waive (anti-amnesia: a waiver must record WHY). Use --reason "...".');
|
|
199
|
+
}
|
|
200
|
+
const slug = reportSlug(unit);
|
|
201
|
+
const fresh = computeFresh(projectRoot, unit);
|
|
202
|
+
const valid = fresh.obligations.map((o) => o.id);
|
|
203
|
+
if (!valid.includes(obId)) {
|
|
204
|
+
throw new Error(`Unknown obligation "${obId}". Valid: ${valid.join(', ')}`);
|
|
205
|
+
}
|
|
206
|
+
const sp = statePath(projectRoot, slug);
|
|
207
|
+
const state = loadState(sp) || { unit, auditHash: '', waivers: {} };
|
|
208
|
+
state.waivers[obId] = { reason: reason.trim(), at: new Date().toISOString(), auditHashAtWaive: auditHashOf(projectRoot, slug) };
|
|
209
|
+
saveState(sp, state);
|
|
210
|
+
return runJourney(projectRoot, unit);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const ICON: Record<ObStatus, string> = { satisfied: '✅', 'needs-work': '⚠️ ', pending: '⏳', waived: '🚫' };
|
|
133
214
|
|
|
134
215
|
export function renderJourneyBoard(r: JourneyReport): string {
|
|
135
216
|
const L: string[] = [];
|