@skillre/dsh-plugin-work-dashboard 0.0.0-stage → 0.9.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/LICENSE +21 -0
- package/README.en.md +259 -0
- package/README.md +371 -2
- package/UNINSTALL.md +7 -0
- package/compatibility.json +195 -0
- package/cordis.patch.yml +24 -0
- package/docs/DESIGN-0.3.md +122 -0
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/PLAN-0.7-0.9.md +230 -0
- package/docs/preview.svg +254 -0
- package/docs/preview.zh.svg +254 -0
- package/icon.svg +17 -0
- package/lib/blockers.d.ts +45 -0
- package/lib/blockers.js +160 -0
- package/lib/client/api.d.ts +42 -0
- package/lib/client/api.js +45 -0
- package/lib/client/contracts.d.ts +94 -0
- package/lib/client/contracts.js +21 -0
- package/lib/client/css/base.d.ts +31 -0
- package/lib/client/css/base.js +461 -0
- package/lib/client/css/blockers.d.ts +18 -0
- package/lib/client/css/blockers.js +196 -0
- package/lib/client/css/charts.d.ts +14 -0
- package/lib/client/css/charts.js +191 -0
- package/lib/client/css/detail.d.ts +21 -0
- package/lib/client/css/detail.js +423 -0
- package/lib/client/css/insights.d.ts +27 -0
- package/lib/client/css/insights.js +660 -0
- package/lib/client/css/overview.d.ts +23 -0
- package/lib/client/css/overview.js +327 -0
- 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/preferences.d.ts +56 -0
- package/lib/client/preferences.js +118 -0
- package/lib/client/styles.d.ts +17 -0
- package/lib/client/styles.js +24 -0
- package/lib/client/text.d.ts +32 -0
- package/lib/client/text.js +1112 -0
- package/lib/client/view-contract.d.ts +118 -0
- package/lib/client/view-contract.js +28 -0
- package/lib/client.js +6599 -0
- package/lib/config.d.ts +61 -0
- package/lib/config.js +67 -0
- package/lib/form.d.ts +218 -0
- package/lib/form.js +1075 -0
- package/lib/gap.d.ts +60 -0
- package/lib/gap.js +227 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +159 -0
- package/lib/repo.d.ts +124 -0
- package/lib/repo.js +407 -0
- package/lib/risks.d.ts +24 -0
- package/lib/risks.js +85 -0
- package/lib/skill.d.ts +94 -0
- package/lib/skill.js +220 -0
- package/lib/store.d.ts +63 -0
- package/lib/store.js +505 -0
- package/lib/timeline.d.ts +23 -0
- package/lib/timeline.js +93 -0
- package/lib/transport.d.ts +67 -0
- package/lib/transport.js +131 -0
- package/lib/types.d.ts +701 -0
- package/lib/types.js +78 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +117 -4
- package/skills/poc-export/SKILL.md +81 -0
- package/skills/poc-export/scripts/export-form.mjs +654 -0
- package/skills/poc-ledger/SKILL.md +171 -0
- package/skills/poc-submit/SKILL.md +186 -0
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin configuration.
|
|
3
|
+
*
|
|
4
|
+
* Schemastery is the loader-facing schema: DSH resolves a row's `config`
|
|
5
|
+
* through it before `apply` runs, so every tunable value has a declared
|
|
6
|
+
* default and an out-of-range value fails loudly at mount time instead of
|
|
7
|
+
* silently cloning into the wrong directory.
|
|
8
|
+
*/
|
|
9
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
10
|
+
/** Effective plugin configuration after schema resolution. */
|
|
11
|
+
export interface WorkDashboardConfig {
|
|
12
|
+
/** Data source, as `owner/name` on GitHub. */
|
|
13
|
+
repository: string;
|
|
14
|
+
/**
|
|
15
|
+
* Clone URL override.
|
|
16
|
+
*
|
|
17
|
+
* Empty means the canonical `https://github.com/<repository>.git`. It exists
|
|
18
|
+
* for three real cases: a GitHub Enterprise host, a mirror, and a local test
|
|
19
|
+
* remote (which is how the submission path is verified without pushing to
|
|
20
|
+
* anyone's real repository).
|
|
21
|
+
*/
|
|
22
|
+
remoteUrl: string;
|
|
23
|
+
/** Cache root wiped at mount and recreated on demand. `~` is expanded. */
|
|
24
|
+
cacheRoot: string;
|
|
25
|
+
/** Branch tracked by the clone. */
|
|
26
|
+
defaultBranch: string;
|
|
27
|
+
/**
|
|
28
|
+
* Hard ceiling for one `git clone`, in milliseconds.
|
|
29
|
+
*
|
|
30
|
+
* Measured on this network: a normal clone of the ledger takes ~1.5s, but a
|
|
31
|
+
* congested one has taken 68s. The default is therefore generous; a timeout
|
|
32
|
+
* still fails with a clear reason and a retry button.
|
|
33
|
+
*/
|
|
34
|
+
cloneTimeoutMs: number;
|
|
35
|
+
/** Hard ceiling for one `git fetch` + `reset --hard`, in milliseconds. */
|
|
36
|
+
fetchTimeoutMs: number;
|
|
37
|
+
/** Days in one stage after which rule 12 reports the project as stalled. */
|
|
38
|
+
stallDays: number;
|
|
39
|
+
}
|
|
40
|
+
/** Default cache root, under the DSH home so a system cleaner never eats it. */
|
|
41
|
+
export declare const DEFAULT_CACHE_ROOT = "~/.dsh/cache/work-dashboard";
|
|
42
|
+
/** The schema DSH resolves a `skillre-work-dashboard` row's config through. */
|
|
43
|
+
export declare const Config: Schema<WorkDashboardConfig>;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve raw row config, keeping the declared defaults authoritative.
|
|
46
|
+
*
|
|
47
|
+
* The shape checks that Schemastery cannot express (a repository is
|
|
48
|
+
* `owner/name`, a branch has no ref-spec metacharacters) run here so a typo
|
|
49
|
+
* fails at mount with a readable message instead of as a git exit code later.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveConfig(raw?: unknown): WorkDashboardConfig;
|
|
52
|
+
/**
|
|
53
|
+
* Expand a leading `~` to the current user's home directory.
|
|
54
|
+
*
|
|
55
|
+
* Kept out of {@link resolveConfig} so the resolved config stays a faithful
|
|
56
|
+
* echo of what the profile declared, and every filesystem use expands at the
|
|
57
|
+
* point of use instead.
|
|
58
|
+
*/
|
|
59
|
+
/** The clone URL for the configured source, honoring the `remoteUrl` override. */
|
|
60
|
+
export declare function remoteUrlFor(config: WorkDashboardConfig): string;
|
|
61
|
+
export declare function expandHome(path: string, home: string): string;
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin configuration.
|
|
3
|
+
*
|
|
4
|
+
* Schemastery is the loader-facing schema: DSH resolves a row's `config`
|
|
5
|
+
* through it before `apply` runs, so every tunable value has a declared
|
|
6
|
+
* default and an out-of-range value fails loudly at mount time instead of
|
|
7
|
+
* silently cloning into the wrong directory.
|
|
8
|
+
*/
|
|
9
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
10
|
+
/** Default cache root, under the DSH home so a system cleaner never eats it. */
|
|
11
|
+
export const DEFAULT_CACHE_ROOT = '~/.dsh/cache/work-dashboard';
|
|
12
|
+
/** The schema DSH resolves a `skillre-work-dashboard` row's config through. */
|
|
13
|
+
export const Config = Schema.object({
|
|
14
|
+
repository: Schema.string().default('skillre/workbranch'),
|
|
15
|
+
remoteUrl: Schema.string().default(''),
|
|
16
|
+
cacheRoot: Schema.string().default(DEFAULT_CACHE_ROOT),
|
|
17
|
+
defaultBranch: Schema.string().default('main'),
|
|
18
|
+
cloneTimeoutMs: Schema.number().min(5_000).max(600_000).step(1).default(120_000),
|
|
19
|
+
fetchTimeoutMs: Schema.number().min(5_000).max(600_000).step(1).default(60_000),
|
|
20
|
+
stallDays: Schema.number().min(1).max(365).step(1).default(45),
|
|
21
|
+
});
|
|
22
|
+
/** `owner/name` on GitHub; the only repository shape the clone command accepts. */
|
|
23
|
+
const REPOSITORY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/[A-Za-z0-9._-]{1,100}$/;
|
|
24
|
+
/** Branch names git accepts, minus the ref-spec metacharacters. */
|
|
25
|
+
const BRANCH_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$/;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve raw row config, keeping the declared defaults authoritative.
|
|
28
|
+
*
|
|
29
|
+
* The shape checks that Schemastery cannot express (a repository is
|
|
30
|
+
* `owner/name`, a branch has no ref-spec metacharacters) run here so a typo
|
|
31
|
+
* fails at mount with a readable message instead of as a git exit code later.
|
|
32
|
+
*/
|
|
33
|
+
export function resolveConfig(raw = {}) {
|
|
34
|
+
const resolved = Config(raw);
|
|
35
|
+
if (!REPOSITORY_PATTERN.test(resolved.repository)) {
|
|
36
|
+
throw new Error(`work dashboard: repository must be "owner/name" on GitHub, received ${JSON.stringify(resolved.repository)}.`);
|
|
37
|
+
}
|
|
38
|
+
if (!BRANCH_PATTERN.test(resolved.defaultBranch) || resolved.defaultBranch.includes('..')) {
|
|
39
|
+
throw new Error(`work dashboard: defaultBranch is not a valid git branch name: ${JSON.stringify(resolved.defaultBranch)}.`);
|
|
40
|
+
}
|
|
41
|
+
if (resolved.cacheRoot.trim() === '')
|
|
42
|
+
throw new Error('work dashboard: cacheRoot must not be empty.');
|
|
43
|
+
const remote = resolved.remoteUrl.trim();
|
|
44
|
+
if (remote !== '' && !/^(?:https:\/\/[^\s]+|git@[^\s:]+:.+|file:\/\/[^\s]+|\/[^\s]+)$/.test(remote)) {
|
|
45
|
+
throw new Error(`work dashboard: remoteUrl is not a supported git URL: ${JSON.stringify(remote)}.`);
|
|
46
|
+
}
|
|
47
|
+
return resolved;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Expand a leading `~` to the current user's home directory.
|
|
51
|
+
*
|
|
52
|
+
* Kept out of {@link resolveConfig} so the resolved config stays a faithful
|
|
53
|
+
* echo of what the profile declared, and every filesystem use expands at the
|
|
54
|
+
* point of use instead.
|
|
55
|
+
*/
|
|
56
|
+
/** The clone URL for the configured source, honoring the `remoteUrl` override. */
|
|
57
|
+
export function remoteUrlFor(config) {
|
|
58
|
+
const override = config.remoteUrl.trim();
|
|
59
|
+
return override === '' ? `https://github.com/${config.repository}.git` : override;
|
|
60
|
+
}
|
|
61
|
+
export function expandHome(path, home) {
|
|
62
|
+
if (path === '~')
|
|
63
|
+
return home;
|
|
64
|
+
if (path.startsWith('~/'))
|
|
65
|
+
return `${home}/${path.slice(2)}`;
|
|
66
|
+
return path;
|
|
67
|
+
}
|
package/lib/form.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
name: string;
|
|
44
|
+
metric: string;
|
|
45
|
+
baseline: string;
|
|
46
|
+
target: string;
|
|
47
|
+
}
|
|
48
|
+
/** One plan risk. */
|
|
49
|
+
export interface FormRisk {
|
|
50
|
+
name: string;
|
|
51
|
+
level: string;
|
|
52
|
+
mitigation: string;
|
|
53
|
+
}
|
|
54
|
+
/** One progress entry the form can append. */
|
|
55
|
+
export interface FormProgress {
|
|
56
|
+
seq: number | null;
|
|
57
|
+
date: string;
|
|
58
|
+
type: string;
|
|
59
|
+
goal: string;
|
|
60
|
+
items: string[];
|
|
61
|
+
actual: string;
|
|
62
|
+
completion: string;
|
|
63
|
+
evidence: Array<{
|
|
64
|
+
title: string;
|
|
65
|
+
link: string;
|
|
66
|
+
type: string;
|
|
67
|
+
}>;
|
|
68
|
+
customer: {
|
|
69
|
+
synced_with: string;
|
|
70
|
+
feedback: string;
|
|
71
|
+
recognition: string;
|
|
72
|
+
};
|
|
73
|
+
gate3_1: string;
|
|
74
|
+
gate3_2: string;
|
|
75
|
+
next: {
|
|
76
|
+
goal: string;
|
|
77
|
+
owner: string;
|
|
78
|
+
deadline: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The project shape the form edits.
|
|
83
|
+
*
|
|
84
|
+
* A flat, all-strings view of one `PocRecord` plus its pending progress entry.
|
|
85
|
+
* Flat because the generated page is plain JS with no schema awareness: the Host
|
|
86
|
+
* normalizes once here instead of repeating the walk in the browser.
|
|
87
|
+
*/
|
|
88
|
+
export interface FormProject {
|
|
89
|
+
pocId: string;
|
|
90
|
+
name: string;
|
|
91
|
+
system: string;
|
|
92
|
+
company: string;
|
|
93
|
+
department: string;
|
|
94
|
+
amountWan: string;
|
|
95
|
+
pocType: string;
|
|
96
|
+
owner: string;
|
|
97
|
+
sales: string;
|
|
98
|
+
techOwner: string;
|
|
99
|
+
execSponsor: string;
|
|
100
|
+
stage: string;
|
|
101
|
+
status: string;
|
|
102
|
+
stageSince: string;
|
|
103
|
+
gate0: {
|
|
104
|
+
why_customer: string;
|
|
105
|
+
why_us: string;
|
|
106
|
+
decision_chain: string;
|
|
107
|
+
post_poc_decision: string;
|
|
108
|
+
competitor: string;
|
|
109
|
+
conclusion: string;
|
|
110
|
+
reviewer: string;
|
|
111
|
+
reviewed_at: string;
|
|
112
|
+
};
|
|
113
|
+
plan: {
|
|
114
|
+
customer_pain: string;
|
|
115
|
+
expected_recognition: string;
|
|
116
|
+
our_edge: string;
|
|
117
|
+
criteria: FormCriterion[];
|
|
118
|
+
scenarios: string[];
|
|
119
|
+
risks: FormRisk[];
|
|
120
|
+
timeline_start: string;
|
|
121
|
+
timeline_end: string;
|
|
122
|
+
gate1_conclusion: string;
|
|
123
|
+
gate2_ready: string;
|
|
124
|
+
};
|
|
125
|
+
/** The entry this form adds; `null` in a blank form until the user fills it. */
|
|
126
|
+
progress: FormProgress;
|
|
127
|
+
/** How many entries the project already has (so `seq` can continue). */
|
|
128
|
+
existingProgressCount: number;
|
|
129
|
+
}
|
|
130
|
+
/** Options for one generation run. */
|
|
131
|
+
export interface FormOptions {
|
|
132
|
+
/** `fill` pre-fills from the ledger; `blank` is an empty new-project form. */
|
|
133
|
+
mode: 'fill' | 'blank';
|
|
134
|
+
/** Projects to include; one blank project for `blank` mode. */
|
|
135
|
+
projects: FormProject[];
|
|
136
|
+
/** Clock injection so the generated header and default dates are testable. */
|
|
137
|
+
now?: Date;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Convert one ledger record into the form's project shape.
|
|
141
|
+
*
|
|
142
|
+
* Every field becomes a string or a list of strings. A missing block becomes an
|
|
143
|
+
* empty one rather than `undefined`, so the generated script never has to guard.
|
|
144
|
+
*/
|
|
145
|
+
export declare function projectForForm(record: PocRecord): FormProject;
|
|
146
|
+
/** One empty progress entry, with `seq` continuing the existing count. */
|
|
147
|
+
export declare function blankProgress(existingCount: number): FormProgress;
|
|
148
|
+
/** The blank project a `blank`-mode form edits. */
|
|
149
|
+
export declare function blankProject(): FormProject;
|
|
150
|
+
/**
|
|
151
|
+
* Build the stable draft key.
|
|
152
|
+
*
|
|
153
|
+
* Sorting the ids makes the key independent of selection order, so the same set
|
|
154
|
+
* of projects always resumes the same draft — even if the user regenerates the
|
|
155
|
+
* form later. A blank form gets a constant key so its draft survives too.
|
|
156
|
+
*/
|
|
157
|
+
export declare function draftKeyFor(mode: 'fill' | 'blank', pocIds: readonly string[]): string;
|
|
158
|
+
/**
|
|
159
|
+
* Serialize one project back to the v3 YAML shape.
|
|
160
|
+
*
|
|
161
|
+
* `yaml`'s own stringifier rather than concatenation: a value containing `: `,
|
|
162
|
+
* `#`, quotes or a newline must be quoted correctly, which hand-built strings
|
|
163
|
+
* get wrong (`name: 某某:试点` produced invalid YAML in the reference tool).
|
|
164
|
+
*
|
|
165
|
+
* Empty plan/progress blocks are emitted as empty collections, not omitted: the
|
|
166
|
+
* ledger's parser tolerates absence, but a colleague reopening the file should
|
|
167
|
+
* see the shape they are expected to fill.
|
|
168
|
+
*/
|
|
169
|
+
export declare function projectToYaml(project: FormProject): string;
|
|
170
|
+
/** The enums, mirrored from `schemas/enums.yaml`. */
|
|
171
|
+
declare const ENUMS: {
|
|
172
|
+
pocType: string[];
|
|
173
|
+
stage: string[];
|
|
174
|
+
status: string[];
|
|
175
|
+
g0Conclusion: string[];
|
|
176
|
+
g1Conclusion: string[];
|
|
177
|
+
g2Ready: string[];
|
|
178
|
+
recognition: string[];
|
|
179
|
+
progressType: string[];
|
|
180
|
+
completion: string[];
|
|
181
|
+
riskLevel: string[];
|
|
182
|
+
gate3_1: string[];
|
|
183
|
+
gate3_2: string[];
|
|
184
|
+
evidenceType: string[];
|
|
185
|
+
system: string[];
|
|
186
|
+
};
|
|
187
|
+
/** The state the generated page boots from. */
|
|
188
|
+
export interface FormPayload {
|
|
189
|
+
mode: 'fill' | 'blank';
|
|
190
|
+
generatedAt: string;
|
|
191
|
+
today: string;
|
|
192
|
+
projects: FormProject[];
|
|
193
|
+
draftKey: string;
|
|
194
|
+
enums: typeof ENUMS;
|
|
195
|
+
/** The G0 fields, in schema order, with their prompt text. */
|
|
196
|
+
g0Fields: Array<{
|
|
197
|
+
key: string;
|
|
198
|
+
label: string;
|
|
199
|
+
hint: string;
|
|
200
|
+
}>;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Generate the complete HTML form.
|
|
204
|
+
*
|
|
205
|
+
* The returned string is the whole document: no external stylesheet, script,
|
|
206
|
+
* font or image reference.
|
|
207
|
+
*/
|
|
208
|
+
export declare function buildFormHtml(options: FormOptions): string;
|
|
209
|
+
/** A file name for the generated form. */
|
|
210
|
+
export declare function formFileName(options: {
|
|
211
|
+
mode: 'fill' | 'blank';
|
|
212
|
+
pocIds: readonly string[];
|
|
213
|
+
now?: Date;
|
|
214
|
+
}): string;
|
|
215
|
+
/** The file name a colleague should save one project's YAML under. */
|
|
216
|
+
export declare function yamlFileName(project: FormProject, now?: Date): string;
|
|
217
|
+
/** Re-export the YAML library's parse for the round-trip test. */
|
|
218
|
+
export { YAML };
|