@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.
Files changed (48) hide show
  1. package/README.en.md +12 -6
  2. package/README.md +32 -8
  3. package/compatibility.json +44 -4
  4. package/docs/DESIGN-1.0-/344/274/230/345/214/226/346/226/271/346/241/210.md +212 -0
  5. 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
  6. package/docs/LEDGER-REQUIREMENTS-v3.1.md +367 -0
  7. package/docs/PLAN-0.7-0.9.md +230 -0
  8. package/docs/PLAN-v3.1-adaptation.md +237 -0
  9. package/docs/TARGET-/345/217/260/350/264/246/344/273/223/345/272/223v3.1.md +500 -0
  10. 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
  11. package/lib/blockers.d.ts +45 -0
  12. package/lib/blockers.js +160 -0
  13. package/lib/client/api.d.ts +8 -1
  14. package/lib/client/api.js +1 -0
  15. package/lib/client/css/base.d.ts +1 -1
  16. package/lib/client/css/base.js +39 -0
  17. package/lib/client/css/blockers.d.ts +18 -0
  18. package/lib/client/css/blockers.js +196 -0
  19. package/lib/client/css/detail.d.ts +1 -1
  20. package/lib/client/css/detail.js +107 -4
  21. package/lib/client/css/overview.d.ts +5 -4
  22. package/lib/client/css/overview.js +23 -34
  23. package/lib/client/css/summary.d.ts +13 -0
  24. package/lib/client/css/summary.js +187 -0
  25. package/lib/client/format.d.ts +57 -0
  26. package/lib/client/format.js +96 -0
  27. package/lib/client/styles.js +3 -1
  28. package/lib/client/text.js +284 -44
  29. package/lib/client/view-contract.d.ts +9 -1
  30. package/lib/client.js +4836 -968
  31. package/lib/form.d.ts +278 -0
  32. package/lib/form.js +1153 -0
  33. package/lib/gap.d.ts +26 -8
  34. package/lib/gap.js +88 -17
  35. package/lib/index.js +29 -0
  36. package/lib/repo.d.ts +60 -0
  37. package/lib/repo.js +99 -0
  38. package/lib/rules.d.ts +105 -0
  39. package/lib/rules.js +227 -0
  40. package/lib/signals.d.ts +126 -0
  41. package/lib/signals.js +238 -0
  42. package/lib/store.d.ts +16 -1
  43. package/lib/store.js +92 -11
  44. package/lib/transport.d.ts +7 -1
  45. package/lib/transport.js +10 -0
  46. package/lib/types.d.ts +218 -15
  47. package/lib/types.js +21 -0
  48. package/package.json +1 -1
package/lib/form.d.ts ADDED
@@ -0,0 +1,278 @@
1
+ /**
2
+ * The v3 collection form: a self-contained HTML file a colleague can fill in.
3
+ *
4
+ * ## What changed from the v1 form
5
+ *
6
+ * The v1 generator modelled `why_customer_test` / `success_criteria` /
7
+ * `result` / `timeline` — all removed by v3. Shipping it would have handed
8
+ * colleagues a file the ledger can no longer read, so it was held back while
9
+ * this replacement was written, and then deleted.
10
+ *
11
+ * v3 is **progress-centred**: `gate0` says whether the project is worth doing,
12
+ * `plan` says how to win, and `progress[]` is the append-only history. The form
13
+ * therefore asks for exactly those three, and nothing else:
14
+ *
15
+ * 1. **G0** — the five prerequisites (four here; `tech_owner` is identity, which
16
+ * the blank form asks for too), each with a "why this matters" hint.
17
+ * 2. **Plan** — pain, expected recognition, 2–3 criteria, 3–5 scenarios, ≤3
18
+ * risks, edge. The counts are validated live because the gap rules enforce
19
+ * them and a colleague cannot know that.
20
+ * 3. **Progress** — one new entry, appended. The form never rewrites history.
21
+ *
22
+ * ## What is kept from v1 because it was hard-won
23
+ *
24
+ * - **One file, no server, no CDN.** Everything inlined, works offline.
25
+ * - **Autosave keyed by the project set**, not by a timestamp: regenerating the
26
+ * form for the same projects must find the same draft.
27
+ * - **Real YAML out**, via `yaml`'s own stringifier, so `name: 某某:试点` stays
28
+ * valid.
29
+ * - **One file per project** on download, so two colleagues never clobber a
30
+ * shared file.
31
+ *
32
+ * ## What it deliberately does NOT do
33
+ *
34
+ * It does not write to the ledger. The output is a `.yaml` the owner reviews and
35
+ * commits; submission stays a human-merged PR, which is the ledger's design.
36
+ */
37
+ import YAML from 'yaml';
38
+ import type { PocRecord } from './types.js';
39
+ /** The four G0 prerequisites that live under `gate0` (the fifth is identity). */
40
+ export declare const G0_FIELDS: readonly ["why_customer", "why_us", "decision_chain", "post_poc_decision"];
41
+ /** One plan criterion, as the form edits it. */
42
+ export interface FormCriterion {
43
+ /** `cri-NN`; carried through so a returned form never renumbers the plan. */
44
+ id: string;
45
+ name: string;
46
+ metric: string;
47
+ baseline: string;
48
+ target: string;
49
+ }
50
+ /**
51
+ * One plan scenario.
52
+ *
53
+ * v3.1 made this an object with a stable id, because evidence attaches by id:
54
+ * a form that renumbered scenarios would silently orphan every proof it had.
55
+ * `id` is therefore carried through untouched and is not user-editable.
56
+ */
57
+ export interface FormScenario {
58
+ /** `scn-NN`; stable for the life of the project. */
59
+ id: string;
60
+ name: string;
61
+ goal: string;
62
+ }
63
+ /** One plan risk. */
64
+ export interface FormRisk {
65
+ name: string;
66
+ level: string;
67
+ mitigation: string;
68
+ }
69
+ /** One progress entry the form can append. */
70
+ export interface FormProgress {
71
+ seq: number | null;
72
+ date: string;
73
+ type: string;
74
+ /** v3.1: what moved compared to the previous round. Required. */
75
+ change: string;
76
+ goal: string;
77
+ /** `scn-NN` ids picked from the plan's scenarios. */
78
+ scenarioIds: string[];
79
+ /** `cri-NN` ids picked from the plan's criteria; independent of scenarios. */
80
+ criteriaIds: string[];
81
+ actual: string;
82
+ completion: string;
83
+ evidence: Array<{
84
+ title: string;
85
+ link: string;
86
+ type: string;
87
+ }>;
88
+ customer: {
89
+ synced_with: string;
90
+ feedback: string;
91
+ recognition: string;
92
+ };
93
+ gate3_1: string;
94
+ gate3_2: string;
95
+ next: {
96
+ goal: string;
97
+ owner: string;
98
+ deadline: string;
99
+ };
100
+ }
101
+ /**
102
+ * The project shape the form edits.
103
+ *
104
+ * A flat, all-strings view of one `PocRecord` plus its pending progress entry.
105
+ * Flat because the generated page is plain JS with no schema awareness: the Host
106
+ * normalizes once here instead of repeating the walk in the browser.
107
+ */
108
+ export interface FormProject {
109
+ pocId: string;
110
+ name: string;
111
+ system: string;
112
+ company: string;
113
+ department: string;
114
+ amountWan: string;
115
+ pocType: string;
116
+ owner: string;
117
+ sales: string;
118
+ techOwner: string;
119
+ execSponsor: string;
120
+ stage: string;
121
+ status: string;
122
+ stageSince: string;
123
+ gate0: {
124
+ why_customer: string;
125
+ why_us: string;
126
+ decision_chain: string;
127
+ post_poc_decision: string;
128
+ competitor: string;
129
+ conclusion: string;
130
+ reviewer: string;
131
+ reviewed_at: string;
132
+ };
133
+ plan: {
134
+ customer_pain: string;
135
+ expected_recognition: string;
136
+ our_edge: string;
137
+ criteria: FormCriterion[];
138
+ scenarios: FormScenario[];
139
+ risks: FormRisk[];
140
+ timeline_start: string;
141
+ timeline_end: string;
142
+ gate1_conclusion: string;
143
+ gate2_ready: string;
144
+ };
145
+ /** The entry this form adds; `null` in a blank form until the user fills it. */
146
+ progress: FormProgress;
147
+ /** How many entries the project already has (so `seq` can continue). */
148
+ existingProgressCount: number;
149
+ }
150
+ /** Options for one generation run. */
151
+ export interface FormOptions {
152
+ /** `fill` pre-fills from the ledger; `blank` is an empty new-project form. */
153
+ mode: 'fill' | 'blank';
154
+ /** Projects to include; one blank project for `blank` mode. */
155
+ projects: FormProject[];
156
+ /** Clock injection so the generated header and default dates are testable. */
157
+ now?: Date;
158
+ }
159
+ /**
160
+ * Convert one ledger record into the form's project shape.
161
+ *
162
+ * Every field becomes a string or a list of strings. A missing block becomes an
163
+ * empty one rather than `undefined`, so the generated script never has to guard.
164
+ */
165
+ export declare function projectForForm(record: PocRecord): FormProject;
166
+ /** One empty progress entry, with `seq` continuing the existing count. */
167
+ export declare function blankProgress(existingCount: number): FormProgress;
168
+ /** The blank project a `blank`-mode form edits. */
169
+ export declare function blankProject(): FormProject;
170
+ /**
171
+ * Build the stable draft key.
172
+ *
173
+ * Sorting the ids makes the key independent of selection order, so the same set
174
+ * of projects always resumes the same draft — even if the user regenerates the
175
+ * form later. A blank form gets a constant key so its draft survives too.
176
+ */
177
+ export declare function draftKeyFor(mode: 'fill' | 'blank', pocIds: readonly string[]): string;
178
+ /**
179
+ * Serialize one project back to the v3 YAML shape.
180
+ *
181
+ * `yaml`'s own stringifier rather than concatenation: a value containing `: `,
182
+ * `#`, quotes or a newline must be quoted correctly, which hand-built strings
183
+ * get wrong (`name: 某某:试点` produced invalid YAML in the reference tool).
184
+ *
185
+ * Empty plan/progress blocks are emitted as empty collections, not omitted: the
186
+ * ledger's parser tolerates absence, but a colleague reopening the file should
187
+ * see the shape they are expected to fill.
188
+ */
189
+ export declare function projectToYaml(project: FormProject): string;
190
+ /** The enums, mirrored from `schemas/enums.yaml`. */
191
+ declare const ENUMS: {
192
+ pocType: string[];
193
+ stage: string[];
194
+ status: string[];
195
+ g0Conclusion: string[];
196
+ g1Conclusion: string[];
197
+ g2Ready: string[];
198
+ recognition: string[];
199
+ progressType: string[];
200
+ progressChange: string[];
201
+ completion: string[];
202
+ riskLevel: string[];
203
+ gate3_1: string[];
204
+ gate3_2: string[];
205
+ evidenceType: string[];
206
+ system: string[];
207
+ };
208
+ /**
209
+ * The schema generation this form emits.
210
+ *
211
+ * Stamped into every generated page so a returned form can be checked against
212
+ * the schema that will read it. A v3.0 form uses `items` and string scenarios;
213
+ * importing it as v3.1 would silently drop every scenario and criterion
214
+ * reference, which is exactly the failure this constant exists to catch.
215
+ */
216
+ export declare const FORM_SCHEMA_VERSION = "3.1";
217
+ /** The schema generation a v3.0 form emitted; recognised only to reject it. */
218
+ export declare const LEGACY_FORM_SCHEMA_VERSION = "3.0";
219
+ /** The state the generated page boots from. */
220
+ export interface FormPayload {
221
+ mode: 'fill' | 'blank';
222
+ /** The schema this page writes. Absent means a pre-v3.1 form. */
223
+ schemaVersion: string;
224
+ generatedAt: string;
225
+ today: string;
226
+ projects: FormProject[];
227
+ draftKey: string;
228
+ enums: typeof ENUMS;
229
+ /** The G0 fields, in schema order, with their prompt text. */
230
+ g0Fields: Array<{
231
+ key: string;
232
+ label: string;
233
+ hint: string;
234
+ }>;
235
+ }
236
+ /**
237
+ * Generate the complete HTML form.
238
+ *
239
+ * The returned string is the whole document: no external stylesheet, script,
240
+ * font or image reference.
241
+ */
242
+ export declare function buildFormHtml(options: FormOptions): string;
243
+ /** A file name for the generated form. */
244
+ export declare function formFileName(options: {
245
+ mode: 'fill' | 'blank';
246
+ pocIds: readonly string[];
247
+ now?: Date;
248
+ }): string;
249
+ /** The file name a colleague should save one project's YAML under. */
250
+ export declare function yamlFileName(project: FormProject, now?: Date): string;
251
+ /** Re-export the YAML library's parse for the round-trip test. */
252
+ export { YAML };
253
+ /**
254
+ * Whether a returned form was generated by this schema generation.
255
+ *
256
+ * `poc-export` produces a standalone HTML file that colleagues fill in offline,
257
+ * so **old copies keep circulating** long after the schema moves. The v3.0 form
258
+ * carries `progress[].items` and a string array of scenarios; reading it as v3.1
259
+ * would drop every scenario and criterion reference without an error, and the
260
+ * ledger's whole proof chain hangs off those ids.
261
+ *
262
+ * So this is a hard gate rather than a tolerant reader: a stale form is refused
263
+ * with an explanation, not silently half-imported.
264
+ */
265
+ export interface FormCompatibility {
266
+ compatible: boolean;
267
+ /** The schema the file declares, or empty when it predates the stamp. */
268
+ declared: string;
269
+ /** A message safe to show the person who just filled the form in. */
270
+ reason: string;
271
+ }
272
+ /**
273
+ * Check a parsed form payload against {@link FORM_SCHEMA_VERSION}.
274
+ *
275
+ * Accepts the raw parsed object rather than a typed payload, because the whole
276
+ * point is to inspect a document whose shape may be from an older generation.
277
+ */
278
+ export declare function checkFormCompatibility(payload: unknown): FormCompatibility;