@skillre/dsh-plugin-work-dashboard 0.6.0 → 0.10.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.en.md +12 -6
- package/README.md +32 -8
- package/compatibility.json +44 -4
- package/docs/DESIGN-1.0-/344/274/230/345/214/226/346/226/271/346/241/210.md +212 -0
- package/docs/DESIGN-/344/274/232/350/257/235/344/272/214-SuperAgent/344/270/216/344/273/223/345/272/223/346/224/271/351/200/240.md +275 -0
- package/docs/LEDGER-REQUIREMENTS-v3.1.md +367 -0
- package/docs/PLAN-0.7-0.9.md +230 -0
- package/docs/PLAN-v3.1-adaptation.md +237 -0
- package/docs/TARGET-/345/217/260/350/264/246/344/273/223/345/272/223v3.1.md +500 -0
- package/docs//350/200/201Mac-SuperAgent/346/224/271/351/200/240/350/256/260/345/275/225-/347/254/254/344/272/214/346/255/245.md +233 -0
- package/lib/blockers.d.ts +45 -0
- package/lib/blockers.js +160 -0
- package/lib/client/api.d.ts +8 -1
- package/lib/client/api.js +1 -0
- package/lib/client/css/base.d.ts +1 -1
- package/lib/client/css/base.js +39 -0
- package/lib/client/css/blockers.d.ts +18 -0
- package/lib/client/css/blockers.js +196 -0
- package/lib/client/css/detail.d.ts +1 -1
- package/lib/client/css/detail.js +107 -4
- package/lib/client/css/overview.d.ts +5 -4
- package/lib/client/css/overview.js +23 -34
- package/lib/client/css/summary.d.ts +13 -0
- package/lib/client/css/summary.js +187 -0
- package/lib/client/format.d.ts +57 -0
- package/lib/client/format.js +96 -0
- package/lib/client/styles.js +3 -1
- package/lib/client/text.js +284 -44
- package/lib/client/view-contract.d.ts +9 -1
- package/lib/client.js +4836 -968
- package/lib/form.d.ts +278 -0
- package/lib/form.js +1153 -0
- package/lib/gap.d.ts +26 -8
- package/lib/gap.js +88 -17
- package/lib/index.js +29 -0
- package/lib/repo.d.ts +60 -0
- package/lib/repo.js +99 -0
- package/lib/rules.d.ts +105 -0
- package/lib/rules.js +227 -0
- package/lib/signals.d.ts +126 -0
- package/lib/signals.js +238 -0
- package/lib/store.d.ts +16 -1
- package/lib/store.js +92 -11
- package/lib/transport.d.ts +7 -1
- package/lib/transport.js +10 -0
- package/lib/types.d.ts +218 -15
- package/lib/types.js +21 -0
- package/package.json +1 -1
package/lib/store.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import YAML from 'yaml';
|
|
18
18
|
import { daysSince, lastProgressDate, latestProgress, normalizeStage, numberOrNull, readDimensions, scanGaps, text, } from './gap.js';
|
|
19
|
+
import { parseRules } from './rules.js';
|
|
20
|
+
import { parseHealthConfig, parseSignals } from './signals.js';
|
|
21
|
+
import { buildBlockerBoard } from './blockers.js';
|
|
19
22
|
import { RepoError } from './repo.js';
|
|
20
23
|
/** The Host-side view model builder. */
|
|
21
24
|
export class PocStore {
|
|
@@ -74,6 +77,16 @@ export class PocStore {
|
|
|
74
77
|
}
|
|
75
78
|
return { records, warnings };
|
|
76
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The rules in force, read from the ledger's `config/rules.yaml`.
|
|
82
|
+
*
|
|
83
|
+
* A missing file is reported through `RulesBundle.source === 'fallback'`, not
|
|
84
|
+
* thrown: an older cache must still render, it just must not pretend its
|
|
85
|
+
* thresholds are the ledger's.
|
|
86
|
+
*/
|
|
87
|
+
async rules() {
|
|
88
|
+
return parseRules(await this.cache.readRules());
|
|
89
|
+
}
|
|
77
90
|
/** The overview snapshot; never throws for a missing cache, it reports it. */
|
|
78
91
|
async snapshot() {
|
|
79
92
|
const cacheReady = await this.cache.isReady();
|
|
@@ -88,15 +101,29 @@ export class PocStore {
|
|
|
88
101
|
stats: emptyStats(),
|
|
89
102
|
gaps: [],
|
|
90
103
|
analysis: emptyAnalysis(),
|
|
104
|
+
blockers: buildBlockerBoard([], { now: this.options.now(), stallDays: this.options.stallDays }),
|
|
105
|
+
rules: {
|
|
106
|
+
source: 'fallback',
|
|
107
|
+
rulesVersion: '',
|
|
108
|
+
schemaVersion: '',
|
|
109
|
+
schemaCurrent: false,
|
|
110
|
+
healthSource: 'fallback',
|
|
111
|
+
},
|
|
91
112
|
warnings: [],
|
|
92
113
|
};
|
|
93
114
|
}
|
|
94
115
|
const { records, warnings } = await this.load();
|
|
95
116
|
const now = this.options.now();
|
|
96
|
-
|
|
117
|
+
// The ledger owns the thresholds, so its rules file wins over the configured
|
|
118
|
+
// `stallDays`. The fallback keeps a stale cache renderable while flagging it.
|
|
119
|
+
const rules = await this.rules();
|
|
120
|
+
const health = parseHealthConfig(await this.cache.readHealth());
|
|
121
|
+
const signals = parseSignals(await this.cache.signalFiles());
|
|
122
|
+
const scanOptions = { now, stallDays: rules.thresholds.stallDays, rules };
|
|
123
|
+
const projects = records.map((record) => summarize(record, now, scanOptions));
|
|
97
124
|
const gaps = [];
|
|
98
125
|
for (const record of records) {
|
|
99
|
-
gaps.push(...scanGaps(record,
|
|
126
|
+
gaps.push(...scanGaps(record, scanOptions));
|
|
100
127
|
}
|
|
101
128
|
gaps.sort(compareGaps);
|
|
102
129
|
const sorted = projects.sort(compareProjects);
|
|
@@ -109,7 +136,15 @@ export class PocStore {
|
|
|
109
136
|
stats: computeStats(sorted),
|
|
110
137
|
gaps,
|
|
111
138
|
analysis: analyse(sorted, gaps),
|
|
112
|
-
|
|
139
|
+
blockers: buildBlockerBoard(records, scanOptions),
|
|
140
|
+
rules: {
|
|
141
|
+
source: rules.source,
|
|
142
|
+
rulesVersion: rules.rulesVersion,
|
|
143
|
+
schemaVersion: schemaVersionOf(records),
|
|
144
|
+
schemaCurrent: records.some((record) => text(record.schema_version) === '3.1'),
|
|
145
|
+
healthSource: health.source,
|
|
146
|
+
},
|
|
147
|
+
warnings: [...warnings, ...rules.warnings, ...health.warnings, ...signals.warnings],
|
|
113
148
|
};
|
|
114
149
|
}
|
|
115
150
|
/** One project's full record; `null` when no file declares that id. */
|
|
@@ -121,7 +156,9 @@ export class PocStore {
|
|
|
121
156
|
if (record === undefined)
|
|
122
157
|
return null;
|
|
123
158
|
const now = this.options.now();
|
|
124
|
-
const
|
|
159
|
+
const rules = await this.rules();
|
|
160
|
+
const scanOptions = { now, stallDays: rules.thresholds.stallDays, rules };
|
|
161
|
+
const summary = summarize(record, now, scanOptions);
|
|
125
162
|
const gate0 = record.gate0 ?? {};
|
|
126
163
|
const plan = record.plan ?? {};
|
|
127
164
|
const outcome = record.outcome ?? {};
|
|
@@ -157,12 +194,21 @@ export class PocStore {
|
|
|
157
194
|
customerPain: text(plan.customer_pain),
|
|
158
195
|
expectedRecognition: text(plan.expected_recognition),
|
|
159
196
|
criteria: (plan.criteria ?? []).map((item) => ({
|
|
197
|
+
id: text(item?.id),
|
|
160
198
|
name: text(item?.name),
|
|
161
199
|
metric: text(item?.metric),
|
|
162
200
|
baseline: text(item?.baseline),
|
|
163
201
|
target: text(item?.target),
|
|
202
|
+
status: text(item?.status),
|
|
203
|
+
})),
|
|
204
|
+
scenarios: (plan.scenarios ?? []).map((item) => ({
|
|
205
|
+
id: text(item?.id),
|
|
206
|
+
name: text(item?.name),
|
|
207
|
+
goal: text(item?.goal),
|
|
208
|
+
status: text(item?.status),
|
|
209
|
+
evidenceCount: numberOrNull(item?.evidence_count) ?? 0,
|
|
210
|
+
recognition: text(item?.recognition),
|
|
164
211
|
})),
|
|
165
|
-
scenarios: (plan.scenarios ?? []).map(text).filter((item) => item !== ''),
|
|
166
212
|
ourEdge: text(plan.our_edge),
|
|
167
213
|
timelineStart: text(plan.timeline?.start),
|
|
168
214
|
timelineEnd: text(plan.timeline?.end),
|
|
@@ -179,8 +225,10 @@ export class PocStore {
|
|
|
179
225
|
seq: numberOrNull(entry?.seq),
|
|
180
226
|
date: text(entry?.date),
|
|
181
227
|
type: text(entry?.type),
|
|
228
|
+
change: text(entry?.change),
|
|
182
229
|
goal: text(entry?.goal),
|
|
183
|
-
|
|
230
|
+
scenarioIds: (entry?.scenario_ids ?? []).map(text).filter((item) => item !== ''),
|
|
231
|
+
criteriaIds: (entry?.criteria_ids ?? []).map(text).filter((item) => item !== ''),
|
|
184
232
|
actual: text(entry?.actual),
|
|
185
233
|
completion: text(entry?.completion),
|
|
186
234
|
evidence: (entry?.evidence ?? []).map((item) => ({
|
|
@@ -216,10 +264,35 @@ export class PocStore {
|
|
|
216
264
|
overall: text(outcome.overall),
|
|
217
265
|
reviewedAt: text(outcome.reviewed_at),
|
|
218
266
|
},
|
|
219
|
-
gaps: scanGaps(record,
|
|
267
|
+
gaps: scanGaps(record, scanOptions),
|
|
220
268
|
};
|
|
221
269
|
}
|
|
222
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* The most common declared `schema_version` across the records.
|
|
273
|
+
*
|
|
274
|
+
* The ledger states one shape version for the whole repository, so a mixed set
|
|
275
|
+
* means the cache is mid-migration. Reporting the majority keeps the UI honest
|
|
276
|
+
* without claiming uniformity it cannot prove.
|
|
277
|
+
*/
|
|
278
|
+
function schemaVersionOf(records) {
|
|
279
|
+
const counts = new Map();
|
|
280
|
+
for (const record of records) {
|
|
281
|
+
const version = text(record.schema_version);
|
|
282
|
+
if (version === '')
|
|
283
|
+
continue;
|
|
284
|
+
counts.set(version, (counts.get(version) ?? 0) + 1);
|
|
285
|
+
}
|
|
286
|
+
let best = '';
|
|
287
|
+
let bestCount = 0;
|
|
288
|
+
for (const [version, count] of counts) {
|
|
289
|
+
if (count > bestCount || (count === bestCount && version > best)) {
|
|
290
|
+
best = version;
|
|
291
|
+
bestCount = count;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return best;
|
|
295
|
+
}
|
|
223
296
|
/** File name without its directory, for warning text. */
|
|
224
297
|
function basename(path) {
|
|
225
298
|
const index = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
|
|
@@ -243,10 +316,10 @@ function progressSummary(poc) {
|
|
|
243
316
|
return parts.join(' · ');
|
|
244
317
|
}
|
|
245
318
|
/** Collapse one record into the table row the overview renders. */
|
|
246
|
-
function summarize(record, now,
|
|
319
|
+
function summarize(record, now, scanOptions) {
|
|
247
320
|
const dimensions = readDimensions(record);
|
|
248
321
|
const { stage, closed } = normalizeStage(record.stage);
|
|
249
|
-
const gaps = scanGaps(record,
|
|
322
|
+
const gaps = scanGaps(record, scanOptions);
|
|
250
323
|
const gate0 = record.gate0 ?? {};
|
|
251
324
|
const activity = lastProgressDate(record);
|
|
252
325
|
const stageSince = text(record.stage_since);
|
|
@@ -294,6 +367,12 @@ function summarize(record, now, stallDays) {
|
|
|
294
367
|
daysSinceProgress: daysSince(activity, now),
|
|
295
368
|
outcomeAchievement: text((record.outcome ?? {}).achievement),
|
|
296
369
|
outcomeRecognition: text((record.outcome ?? {}).customer_recognition),
|
|
370
|
+
// Read from the NEWEST progress entry, not from `outcome`: the outcome block
|
|
371
|
+
// is written later by hand, and "waiting on the customer" is a statement
|
|
372
|
+
// about the last round that actually happened.
|
|
373
|
+
lastRecognition: last === null
|
|
374
|
+
? ''
|
|
375
|
+
: text(last.customer?.recognition),
|
|
297
376
|
};
|
|
298
377
|
}
|
|
299
378
|
/**
|
|
@@ -304,7 +383,6 @@ function summarize(record, now, stallDays) {
|
|
|
304
383
|
*/
|
|
305
384
|
function computeStats(projects) {
|
|
306
385
|
let amountTotalWan = 0;
|
|
307
|
-
let awaitingCustomer = 0;
|
|
308
386
|
for (const project of projects) {
|
|
309
387
|
amountTotalWan += project.amountWan;
|
|
310
388
|
}
|
|
@@ -314,7 +392,10 @@ function computeStats(projects) {
|
|
|
314
392
|
inProgress: projects.filter((project) => project.status === '进行中').length,
|
|
315
393
|
amountTotalWan,
|
|
316
394
|
g0Complete: projects.filter((project) => project.g0Complete).length,
|
|
317
|
-
|
|
395
|
+
// "Awaiting customer" = the newest progress entry says the customer has not
|
|
396
|
+
// signed off yet. It used to be a `let` that was never incremented, so the
|
|
397
|
+
// counter was hard-wired to 0 while the KPI strip displayed it.
|
|
398
|
+
awaitingCustomer: projects.filter((project) => project.lastRecognition === '待确认' || project.lastRecognition === '部分认可').length,
|
|
318
399
|
succeeded: projects.filter((project) => project.outcomeAchievement === '达成' && project.outcomeRecognition === '认可').length,
|
|
319
400
|
stopped: projects.filter((project) => project.status === '暂停' || project.status === '已关闭' || project.status === '已取消').length,
|
|
320
401
|
};
|
package/lib/transport.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `{ type: 'server-response', rpcId, result: { ok: true, value } | { ok: false, error } }`
|
|
12
12
|
* out. A non-owner Peer is rejected by Connection before this handler runs.
|
|
13
13
|
*/
|
|
14
|
-
import type { GlobalTimeline, ProjectDetail, RefreshOutcome, RiskBoard, Snapshot } from './types.js';
|
|
14
|
+
import type { ExportFormResult, GlobalTimeline, ProjectDetail, RefreshOutcome, RiskBoard, Snapshot } from './types.js';
|
|
15
15
|
/** Path of the exact route, under the shared `/api` channel. */
|
|
16
16
|
export declare const EXECUTE_PATH = "/api/skillre-work-dashboard/execute";
|
|
17
17
|
/** One buffered exact Fetch route as the Connection registry accepts it. */
|
|
@@ -42,6 +42,12 @@ export interface ConsoleActions {
|
|
|
42
42
|
risks(): Promise<RiskBoard>;
|
|
43
43
|
/** Every project's rounds, newest first. */
|
|
44
44
|
timeline(): Promise<GlobalTimeline>;
|
|
45
|
+
/**
|
|
46
|
+
* Build the collection form for one batch.
|
|
47
|
+
*
|
|
48
|
+
* `blank` ignores `pocIds` and returns the new-project form.
|
|
49
|
+
*/
|
|
50
|
+
exportForm(mode: 'fill' | 'blank', pocIds: readonly string[]): Promise<ExportFormResult>;
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Build the exact route Connection registers; every failure stays inside the
|
package/lib/transport.js
CHANGED
|
@@ -30,6 +30,14 @@ const requestSchema = z.discriminatedUnion('action', [
|
|
|
30
30
|
z.object({ action: z.literal('detail'), pocId: pocIdSchema }).strict(),
|
|
31
31
|
z.object({ action: z.literal('risks') }).strict(),
|
|
32
32
|
z.object({ action: z.literal('timeline') }).strict(),
|
|
33
|
+
z.object({
|
|
34
|
+
action: z.literal('export-form'),
|
|
35
|
+
mode: z.union([z.literal('fill'), z.literal('blank')]),
|
|
36
|
+
// Bounded: a form is meant for a batch a colleague will actually fill in,
|
|
37
|
+
// and an unbounded list would let one request build a thousands-project
|
|
38
|
+
// document on the Host.
|
|
39
|
+
pocIds: z.array(pocIdSchema).max(200),
|
|
40
|
+
}).strict(),
|
|
33
41
|
]);
|
|
34
42
|
/** A JSON response with no-store caching; the board is always live state. */
|
|
35
43
|
function json(body, status = 200) {
|
|
@@ -68,6 +76,8 @@ async function dispatch(actions, request, signal) {
|
|
|
68
76
|
return actions.risks();
|
|
69
77
|
case 'timeline':
|
|
70
78
|
return actions.timeline();
|
|
79
|
+
case 'export-form':
|
|
80
|
+
return actions.exportForm(request.mode, request.pocIds);
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
83
|
export function createExecuteRoute(ready, options = {}) {
|
package/lib/types.d.ts
CHANGED
|
@@ -51,22 +51,73 @@ export type SortKey = (typeof SORT_KEYS)[number];
|
|
|
51
51
|
export declare const VIEW_MODE_KEY = "work-dashboard.viewMode";
|
|
52
52
|
export declare const SORT_KEY_KEY = "work-dashboard.sortKey";
|
|
53
53
|
/** Every gap rule id this plugin knows. */
|
|
54
|
-
export declare const GAP_RULES: readonly ["R1-gate0-missing", "R2-large-amount-no-g0", "R3-g0-passed-no-plan", "R4-criteria-count", "R5-scenarios-count", "R6-risks-overflow", "R7-g2-not-ready", "R8-progress-no-evidence", "R9-evidence-no-recognition", "R10-g3-1-without-g3-2", "R11-no-next-milestone", "R12-stage-stalled"];
|
|
54
|
+
export declare const GAP_RULES: readonly ["R1-gate0-missing", "R2-large-amount-no-g0", "R3-g0-passed-no-plan", "R4-criteria-count", "R5-scenarios-count", "R6-risks-overflow", "R7-g2-not-ready", "R8-progress-no-evidence", "R9-evidence-no-recognition", "R10-g3-1-without-g3-2", "R11-no-next-milestone", "R12-stage-stalled", "R13-scenario-no-evidence", "R14-scenario-awaiting-customer", "R15-criteria-unverified", "R16-scenario-not-started"];
|
|
55
55
|
export type GapRule = (typeof GAP_RULES)[number];
|
|
56
|
-
/**
|
|
57
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Severity a gap carries.
|
|
58
|
+
*
|
|
59
|
+
* `high` sorts first and paints red, `medium` is amber, and `info` is the
|
|
60
|
+
* deliberate "this is true but not urgent" tier the ledger introduced for R14: a
|
|
61
|
+
* scenario waiting on the customer is a status, not a fault. Collapsing it into
|
|
62
|
+
* `medium` would put a normal state on the same list as missed evidence.
|
|
63
|
+
*/
|
|
64
|
+
export type GapLevel = 'high' | 'medium' | 'info';
|
|
58
65
|
/** One evidence artefact attached to a progress entry. */
|
|
59
66
|
export interface EvidenceRecord {
|
|
60
67
|
title?: string | null;
|
|
61
68
|
link?: string | null;
|
|
62
69
|
type?: string | null;
|
|
63
70
|
}
|
|
64
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* One success criterion (`plan.criteria[]`).
|
|
73
|
+
*
|
|
74
|
+
* v3.1 gives every criterion a stable `id` and a derived `status`. The id is what
|
|
75
|
+
* a progress entry cites in `criteria_ids`; the status is written by the ledger's
|
|
76
|
+
* `tools/derive.mjs`, so it is read here, never computed.
|
|
77
|
+
*/
|
|
65
78
|
export interface CriterionRecord {
|
|
79
|
+
id?: string | null;
|
|
66
80
|
name?: string | null;
|
|
67
81
|
metric?: string | null;
|
|
68
82
|
baseline?: string | number | null;
|
|
69
83
|
target?: string | number | null;
|
|
84
|
+
/** Derived by the ledger: 已达成 / 部分达成 / 未达成 / 未验证. */
|
|
85
|
+
status?: string | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* One test scenario (`plan.scenarios[]`).
|
|
89
|
+
*
|
|
90
|
+
* v3.1 promoted this from a bare string to an object with a stable `id`, because
|
|
91
|
+
* evidence is attached by id: renaming a scenario must not orphan its proof. The
|
|
92
|
+
* three derived fields are written by the ledger, not by this plugin.
|
|
93
|
+
*/
|
|
94
|
+
export interface ScenarioRecord {
|
|
95
|
+
/** Stable `scn-NN`; unique within the project and never reused. */
|
|
96
|
+
id?: string | null;
|
|
97
|
+
name?: string | null;
|
|
98
|
+
goal?: string | null;
|
|
99
|
+
/** Derived by the ledger: 已证明 / 待客户确认 / 无证据 / 未开始. */
|
|
100
|
+
status?: string | null;
|
|
101
|
+
/** Derived by the ledger: total evidence items across citing progress entries. */
|
|
102
|
+
evidence_count?: number | null;
|
|
103
|
+
/** Derived by the ledger: the recognition recorded by the deciding round. */
|
|
104
|
+
recognition?: string | null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* One gate transition (`gate_decisions[]`).
|
|
108
|
+
*
|
|
109
|
+
* Without it a promotion is just `stage` becoming a different string: months
|
|
110
|
+
* later nobody can say who decided, or on what basis.
|
|
111
|
+
*/
|
|
112
|
+
export interface GateDecisionRecord {
|
|
113
|
+
from?: string | null;
|
|
114
|
+
to?: string | null;
|
|
115
|
+
decided_at?: string | null;
|
|
116
|
+
decided_by?: string | null;
|
|
117
|
+
/** `human` or `agent-suggested`. */
|
|
118
|
+
basis?: string | null;
|
|
119
|
+
signals_ref?: string | null;
|
|
120
|
+
note?: string | null;
|
|
70
121
|
}
|
|
71
122
|
/** One tracked risk (`plan.risks[]`). */
|
|
72
123
|
export interface RiskRecord {
|
|
@@ -74,13 +125,26 @@ export interface RiskRecord {
|
|
|
74
125
|
level?: string | null;
|
|
75
126
|
mitigation?: string | null;
|
|
76
127
|
}
|
|
77
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* One progress entry (`progress[]`) — the centre of the v3 model.
|
|
130
|
+
*
|
|
131
|
+
* v3.1 shape. `items` is gone: a progress entry cites scenarios and criteria by
|
|
132
|
+
* id, and carries a mandatory `change` naming what moved since the previous
|
|
133
|
+
* entry. A file still using `items` is a schema error in the ledger, not a
|
|
134
|
+
* variant to tolerate here — reading it as "no scenario links" would silently
|
|
135
|
+
* demote every scenario from 已证明 back to 未开始.
|
|
136
|
+
*/
|
|
78
137
|
export interface ProgressRecord {
|
|
79
138
|
seq?: number | null;
|
|
80
139
|
date?: string | null;
|
|
81
140
|
type?: string | null;
|
|
141
|
+
/** Mandatory in v3.1: what changed compared to the previous entry. */
|
|
142
|
+
change?: string | null;
|
|
82
143
|
goal?: string | null;
|
|
83
|
-
|
|
144
|
+
/** `scn-NN` ids. Names are not accepted by the ledger. */
|
|
145
|
+
scenario_ids?: (string | null)[] | null;
|
|
146
|
+
/** `cri-NN` ids; independent of `scenario_ids`. */
|
|
147
|
+
criteria_ids?: (string | null)[] | null;
|
|
84
148
|
actual?: string | null;
|
|
85
149
|
completion?: string | null;
|
|
86
150
|
evidence?: EvidenceRecord[] | null;
|
|
@@ -118,7 +182,8 @@ export interface PlanRecord {
|
|
|
118
182
|
customer_pain?: string | null;
|
|
119
183
|
expected_recognition?: string | null;
|
|
120
184
|
criteria?: CriterionRecord[] | null;
|
|
121
|
-
|
|
185
|
+
/** v3.1: objects with stable ids, not bare strings. */
|
|
186
|
+
scenarios?: ScenarioRecord[] | null;
|
|
122
187
|
our_edge?: string | null;
|
|
123
188
|
timeline?: {
|
|
124
189
|
start?: string | null;
|
|
@@ -170,6 +235,11 @@ export interface OrgRecord {
|
|
|
170
235
|
* absence into a finding.
|
|
171
236
|
*/
|
|
172
237
|
export interface PocRecord {
|
|
238
|
+
/**
|
|
239
|
+
* The data-shape version, fixed `"3.1"`. A file without it is a v3.0 record
|
|
240
|
+
* and is handled as a degraded, read-only shape.
|
|
241
|
+
*/
|
|
242
|
+
schema_version?: string | null;
|
|
173
243
|
poc_id?: string | null;
|
|
174
244
|
name?: string | null;
|
|
175
245
|
org?: OrgRecord | null;
|
|
@@ -183,6 +253,8 @@ export interface PocRecord {
|
|
|
183
253
|
stage?: string | null;
|
|
184
254
|
status?: string | null;
|
|
185
255
|
stage_since?: string | null;
|
|
256
|
+
/** v3.1: the audit trail of every gate promotion. */
|
|
257
|
+
gate_decisions?: GateDecisionRecord[] | null;
|
|
186
258
|
gate0?: Gate0Record | null;
|
|
187
259
|
plan?: PlanRecord | null;
|
|
188
260
|
progress?: ProgressRecord[] | null;
|
|
@@ -257,6 +329,15 @@ export interface ProjectSummary {
|
|
|
257
329
|
outcomeAchievement: string;
|
|
258
330
|
/** Raw `outcome.customer_recognition`; `''` when unset. */
|
|
259
331
|
outcomeRecognition: string;
|
|
332
|
+
/**
|
|
333
|
+
* The newest progress entry's `customer.recognition`, or `''`.
|
|
334
|
+
*
|
|
335
|
+
* Distinct from {@link outcomeRecognition}: `outcome` is often filled in later
|
|
336
|
+
* by hand, while this is what the customer said in the last recorded round.
|
|
337
|
+
* "Waiting on the customer" is a statement about the newest round, so the
|
|
338
|
+
* counter reads this one.
|
|
339
|
+
*/
|
|
340
|
+
lastRecognition: string;
|
|
260
341
|
}
|
|
261
342
|
/** One gap finding, addressed to a project and a rule. */
|
|
262
343
|
export interface GapItem {
|
|
@@ -391,16 +472,52 @@ export interface Snapshot {
|
|
|
391
472
|
gaps: GapItem[];
|
|
392
473
|
/** Aggregated portfolio view; empty buckets when there are no projects. */
|
|
393
474
|
analysis: PortfolioAnalysis;
|
|
475
|
+
/**
|
|
476
|
+
* Every reason a project is stuck, merged from the five sources.
|
|
477
|
+
*
|
|
478
|
+
* Shipped WITH the snapshot rather than behind its own endpoint: the board is
|
|
479
|
+
* derived from the same records the list shows, so two requests could
|
|
480
|
+
* disagree after a refresh, and the Client already holds the whole snapshot.
|
|
481
|
+
*/
|
|
482
|
+
blockers: BlockerBoard;
|
|
483
|
+
/**
|
|
484
|
+
* Which judgement the findings in this snapshot were computed under.
|
|
485
|
+
*
|
|
486
|
+
* `source: 'fallback'` means the cache carried no `config/rules.yaml`, so the
|
|
487
|
+
* thresholds are this plugin's built-in copy rather than the ledger's. That is
|
|
488
|
+
* a usable state but not a trustworthy one: the ledger may have tuned a
|
|
489
|
+
* threshold, and reporting "no findings" under the wrong thresholds is exactly
|
|
490
|
+
* the silent drift the ledger's single-source rule exists to prevent.
|
|
491
|
+
*/
|
|
492
|
+
rules: RulesProvenance;
|
|
394
493
|
/** Non-fatal findings: unreadable files, unparsable YAML, duplicates. */
|
|
395
494
|
warnings: string[];
|
|
396
495
|
}
|
|
496
|
+
/** Where this snapshot's thresholds and judgement came from. */
|
|
497
|
+
export interface RulesProvenance {
|
|
498
|
+
/** `ledger` when `config/rules.yaml` was read, `fallback` when it was absent. */
|
|
499
|
+
source: 'ledger' | 'fallback';
|
|
500
|
+
/** `config/rules.yaml#version`, or empty under fallback. */
|
|
501
|
+
rulesVersion: string;
|
|
502
|
+
/** The data-shape version from `config/enums`/projects, when known. */
|
|
503
|
+
schemaVersion: string;
|
|
504
|
+
/** `true` when at least one project file declares `schema_version: "3.1"`. */
|
|
505
|
+
schemaCurrent: boolean;
|
|
506
|
+
/** The staleness limits in force, from `config/health.yaml`. */
|
|
507
|
+
healthSource: 'ledger' | 'fallback';
|
|
508
|
+
}
|
|
397
509
|
/** One progress entry as the detail page receives it: every field present. */
|
|
398
510
|
export interface ProgressView {
|
|
399
511
|
seq: number | null;
|
|
400
512
|
date: string;
|
|
401
513
|
type: string;
|
|
514
|
+
/** v3.1: what moved compared to the previous entry. */
|
|
515
|
+
change: string;
|
|
402
516
|
goal: string;
|
|
403
|
-
|
|
517
|
+
/** `scn-NN` ids, as written in the ledger. */
|
|
518
|
+
scenarioIds: string[];
|
|
519
|
+
/** `cri-NN` ids, independent of `scenarioIds`. */
|
|
520
|
+
criteriaIds: string[];
|
|
404
521
|
actual: string;
|
|
405
522
|
completion: string;
|
|
406
523
|
evidence: Array<{
|
|
@@ -468,16 +585,30 @@ export interface Gate0View {
|
|
|
468
585
|
checklist: Gate0CheckItem[];
|
|
469
586
|
}
|
|
470
587
|
/** The plan block as the detail page receives it. */
|
|
588
|
+
/** One criterion as the client renders it, carrying the ledger's derived status. */
|
|
589
|
+
export interface CriterionView {
|
|
590
|
+
id: string;
|
|
591
|
+
name: string;
|
|
592
|
+
metric: string;
|
|
593
|
+
baseline: string;
|
|
594
|
+
target: string;
|
|
595
|
+
status: string;
|
|
596
|
+
}
|
|
597
|
+
/** One scenario as the client renders it, carrying the ledger's derived state. */
|
|
598
|
+
export interface ScenarioView {
|
|
599
|
+
id: string;
|
|
600
|
+
name: string;
|
|
601
|
+
goal: string;
|
|
602
|
+
/** 已证明 / 待客户确认 / 无证据 / 未开始; empty when the ledger did not derive it. */
|
|
603
|
+
status: string;
|
|
604
|
+
evidenceCount: number;
|
|
605
|
+
recognition: string;
|
|
606
|
+
}
|
|
471
607
|
export interface PlanView {
|
|
472
608
|
customerPain: string;
|
|
473
609
|
expectedRecognition: string;
|
|
474
|
-
criteria:
|
|
475
|
-
|
|
476
|
-
metric: string;
|
|
477
|
-
baseline: string;
|
|
478
|
-
target: string;
|
|
479
|
-
}>;
|
|
480
|
-
scenarios: string[];
|
|
610
|
+
criteria: CriterionView[];
|
|
611
|
+
scenarios: ScenarioView[];
|
|
481
612
|
ourEdge: string;
|
|
482
613
|
timelineStart: string;
|
|
483
614
|
timelineEnd: string;
|
|
@@ -526,7 +657,79 @@ export type PocRequest = {
|
|
|
526
657
|
action: 'risks';
|
|
527
658
|
} | {
|
|
528
659
|
action: 'timeline';
|
|
660
|
+
} | {
|
|
661
|
+
action: 'export-form';
|
|
662
|
+
mode: 'fill' | 'blank';
|
|
663
|
+
pocIds: string[];
|
|
529
664
|
};
|
|
665
|
+
/**
|
|
666
|
+
* One generated collection form, ready for the browser to save.
|
|
667
|
+
*
|
|
668
|
+
* The HTML is generated on the Host rather than in the Client because the
|
|
669
|
+
* generator needs the YAML serializer, and bundling `yaml` into the browser
|
|
670
|
+
* module would add ~100 KiB to a page that never otherwise parses YAML.
|
|
671
|
+
*/
|
|
672
|
+
export interface ExportFormResult {
|
|
673
|
+
/** The whole self-contained document. */
|
|
674
|
+
html: string;
|
|
675
|
+
/** The suggested download name. */
|
|
676
|
+
fileName: string;
|
|
677
|
+
/** How many projects the form covers; `0` for a blank form. */
|
|
678
|
+
projectCount: number;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Where a blocker comes from.
|
|
682
|
+
*
|
|
683
|
+
* The five sources are one user-facing idea — "where is this stuck" — but they
|
|
684
|
+
* are NOT the same kind of finding: a gap is a judgement about the ledger's
|
|
685
|
+
* content, while a missing amount is a data-completeness issue. Keeping the
|
|
686
|
+
* source on the row is what lets the UI filter and explain them without the
|
|
687
|
+
* reader having to know which subsystem produced them.
|
|
688
|
+
*/
|
|
689
|
+
export declare const BLOCKER_SOURCES: readonly ["gap", "stalled", "missing-amount", "no-progress", "no-stage-since"];
|
|
690
|
+
export type BlockerSource = (typeof BLOCKER_SOURCES)[number];
|
|
691
|
+
/** One blocker row: a project, a reason, and a source. */
|
|
692
|
+
export interface BlockerRow {
|
|
693
|
+
/** Which subsystem found it. */
|
|
694
|
+
source: BlockerSource;
|
|
695
|
+
/** `high` blocks progress, `medium` is a warning. */
|
|
696
|
+
level: GapLevel;
|
|
697
|
+
/** Sort weight: higher is more urgent. */
|
|
698
|
+
priority: number;
|
|
699
|
+
pocId: string;
|
|
700
|
+
pocName: string;
|
|
701
|
+
/** The state the project is in, for context: `G0-立项`, `closed`, or `''`. */
|
|
702
|
+
stageLabel: string;
|
|
703
|
+
/**
|
|
704
|
+
* The gap rule that produced this row, when `source === 'gap'`.
|
|
705
|
+
*
|
|
706
|
+
* `null` for the four non-gap sources: they are not rules, and pretending
|
|
707
|
+
* they are would make the rule-numbered badge lie.
|
|
708
|
+
*/
|
|
709
|
+
rule: GapRule | null;
|
|
710
|
+
/** Rule number, or `0` for a non-gap source. */
|
|
711
|
+
ruleNo: number;
|
|
712
|
+
/** Rule-specific values the Client interpolates into its copy. */
|
|
713
|
+
params: Record<string, number | string>;
|
|
714
|
+
}
|
|
715
|
+
/** The unified blocker list plus its per-source counts. */
|
|
716
|
+
export interface BlockerBoard {
|
|
717
|
+
/** Every blocker, most urgent first. */
|
|
718
|
+
rows: BlockerRow[];
|
|
719
|
+
/** Per-source totals, so the UI can offer a count per filter chip. */
|
|
720
|
+
counts: Record<BlockerSource, number>;
|
|
721
|
+
/** Projects carrying at least one blocker. */
|
|
722
|
+
projectsBlocked: number;
|
|
723
|
+
/** Projects scanned, so the board can say "3 of 30". */
|
|
724
|
+
projectsTotal: number;
|
|
725
|
+
}
|
|
726
|
+
/** The five G0 prerequisites, as the worklist names them. */
|
|
727
|
+
export interface Gate0WorkItem {
|
|
728
|
+
/** The YAML field name. */
|
|
729
|
+
field: string;
|
|
730
|
+
/** `true` when the field carries content. */
|
|
731
|
+
present: boolean;
|
|
732
|
+
}
|
|
530
733
|
/** One risk row on the risk board. */
|
|
531
734
|
export interface RiskRow {
|
|
532
735
|
pocId: string;
|
package/lib/types.js
CHANGED
|
@@ -59,4 +59,25 @@ export const GAP_RULES = Object.freeze([
|
|
|
59
59
|
'R10-g3-1-without-g3-2',
|
|
60
60
|
'R11-no-next-milestone',
|
|
61
61
|
'R12-stage-stalled',
|
|
62
|
+
// v3.1 state rules: a plan that is the right shape but unexecuted.
|
|
63
|
+
'R13-scenario-no-evidence',
|
|
64
|
+
'R14-scenario-awaiting-customer',
|
|
65
|
+
'R15-criteria-unverified',
|
|
66
|
+
'R16-scenario-not-started',
|
|
67
|
+
]);
|
|
68
|
+
/**
|
|
69
|
+
* Where a blocker comes from.
|
|
70
|
+
*
|
|
71
|
+
* The five sources are one user-facing idea — "where is this stuck" — but they
|
|
72
|
+
* are NOT the same kind of finding: a gap is a judgement about the ledger's
|
|
73
|
+
* content, while a missing amount is a data-completeness issue. Keeping the
|
|
74
|
+
* source on the row is what lets the UI filter and explain them without the
|
|
75
|
+
* reader having to know which subsystem produced them.
|
|
76
|
+
*/
|
|
77
|
+
export const BLOCKER_SOURCES = Object.freeze([
|
|
78
|
+
'gap',
|
|
79
|
+
'stalled',
|
|
80
|
+
'missing-amount',
|
|
81
|
+
'no-progress',
|
|
82
|
+
'no-stage-since',
|
|
62
83
|
]);
|