@morning-start/dsh-code-toolkit 0.27.4 → 0.28.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/CHANGELOG.md +63 -0
- package/README.md +71 -10
- package/agents/audit/AGENT.md +171 -0
- package/agents/audit/examples/fake-capability.md +54 -0
- package/agents/audit/examples/wired-clean.md +66 -0
- package/agents/audit/references/audit-passes.md +118 -0
- package/agents/audit/references/capability-states.md +96 -0
- package/agents/audit/references/evidence.md +86 -0
- package/agents/audit/references/finding-the-chain.md +80 -0
- package/agents/audit/references/output.md +66 -0
- package/agents/caption/AGENT.md +12 -0
- package/agents/caption/references/evidence.md +46 -0
- package/agents/design/AGENT.md +214 -0
- package/agents/design/examples/one-page.md +55 -0
- package/agents/design/examples/overkill.md +56 -0
- package/agents/design/references/base-maps.md +110 -0
- package/agents/design/references/deliverables.md +71 -0
- package/agents/design/references/model-and-ports.md +73 -0
- package/agents/design/references/plan-and-batches.md +92 -0
- package/agents/design/references/scenario-cards.md +133 -0
- package/agents/design/references/self-check.md +73 -0
- package/agents/pua/AGENT.md +3 -0
- package/agents/review/AGENT.md +16 -0
- package/agents/scrub/AGENT.md +5 -1
- package/index.js +57 -1
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +5 -2
- package/src/command.js +14 -4
- package/src/design.js +70 -0
- package/src/i18n.js +46 -0
- package/src/report.js +112 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Scenario cards
|
|
2
|
+
|
|
3
|
+
Source: adapted from the local skill `scenario-driven-product-design`
|
|
4
|
+
(`references/scenario-cards.md`), user-authored, no upstream licence; condensed and
|
|
5
|
+
retargeted at this plugin's output.
|
|
6
|
+
|
|
7
|
+
A card describes one scenario. It is not a proposal: no solution, no estimate, no
|
|
8
|
+
file names to edit. If a solution appears on the card, the problem stops being
|
|
9
|
+
visible.
|
|
10
|
+
|
|
11
|
+
## Template
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
### S07 — <one-line goal>
|
|
15
|
+
- Role / entry / permission:
|
|
16
|
+
- Trigger: <user action or system event>
|
|
17
|
+
- Precondition: <the concrete state: draft | active | paused | archived | offline>
|
|
18
|
+
- Main path: step → where it lands (screen / interface / event)
|
|
19
|
+
- Branches: 空 重 并 权 断 慢 大 旧 — only the ones that apply, each one line
|
|
20
|
+
- Failure form: what the person sees · did the ledger record it · can it recover · who cleans up
|
|
21
|
+
- Current state: wired | half | fake | broken | missing — file:line
|
|
22
|
+
- Acceptance: Given … When … Then … (within <limit>)
|
|
23
|
+
- Must not change: <the negative assertion>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The negative assertion is not optional. "Saving a draft must not emit a run event"
|
|
27
|
+
catches a whole class of regressions that the positive acceptance never will,
|
|
28
|
+
because a positive test passes when the extra event is also emitted.
|
|
29
|
+
|
|
30
|
+
## Two filled cards
|
|
31
|
+
|
|
32
|
+
### S03 — resume a run after the app restarts
|
|
33
|
+
|
|
34
|
+
- Role: operator / entry: the run list / permission: read + retry
|
|
35
|
+
- Trigger: the app is started with an `in_progress` run in the ledger
|
|
36
|
+
- Precondition: `in_progress`, last heartbeat 4 hours old
|
|
37
|
+
- Main path: run list shows it as interrupted → "retry" resumes from the last
|
|
38
|
+
completed step → the ledger gets a new attempt row
|
|
39
|
+
- Branches: 断 (the child process is gone) · 旧 (a run from before the new field
|
|
40
|
+
exists) · 重 (retry clicked twice)
|
|
41
|
+
- Failure form: the row says "interrupted" with the reason and the last step; the
|
|
42
|
+
ledger has the attempt; retry is safe to press again; nobody cleans up manually
|
|
43
|
+
- Current state: `half` — `src/run/list.js:88` reads the state, no retry handler is
|
|
44
|
+
registered in the command table
|
|
45
|
+
- Acceptance: Given a ledger with a stale `in_progress` run, when the list is
|
|
46
|
+
opened, then the row reads "interrupted · step 3" within 2 s
|
|
47
|
+
- Must not change: opening the list must not write to the ledger
|
|
48
|
+
|
|
49
|
+
### S11 — approve a plan from another role
|
|
50
|
+
|
|
51
|
+
- Role: approver / entry: the pending list / permission: approve only
|
|
52
|
+
- Trigger: a plan arrives in state `submitted`
|
|
53
|
+
- Precondition: `submitted`, owner is a different role
|
|
54
|
+
- Main path: pending list → open → approve → state `approved` → owner is notified
|
|
55
|
+
- Branches: 权 (the approver is the author) · 并 (two approvers at once) · 断 (the
|
|
56
|
+
owner was deleted)
|
|
57
|
+
- Failure form: refusal names the exit ("ask another approver") and does not change
|
|
58
|
+
state; no notification is sent on refusal
|
|
59
|
+
- Current state: `fake` — `docs/approval.md` describes it; no route and no command
|
|
60
|
+
exists
|
|
61
|
+
- Acceptance: Given a plan owned by role A, when role A tries to approve it, then
|
|
62
|
+
the call returns a refusal naming another approver, and the state stays `submitted`
|
|
63
|
+
- Must not change: a refused approval must not emit an approval event
|
|
64
|
+
|
|
65
|
+
## The scenario list
|
|
66
|
+
|
|
67
|
+
The list is the index; the cards are the three that matter. Use these columns and
|
|
68
|
+
do not invent others, so two rounds can be diffed:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
| ID | Role | Stage | Intent | One-line goal | Current state | Frequency | Harm | Evidence |
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- **Stage** is one of enter / create / run / intervene / close / look back.
|
|
75
|
+
- **Current state** is the five-state token, or `unconfirmed`. It is filled from
|
|
76
|
+
`/code-audit` — never from reading a README.
|
|
77
|
+
- **Frequency** and **Harm** are the two sort keys; give them a scale and keep it
|
|
78
|
+
(per day / per task, and data loss > deadlock > misleading > friction).
|
|
79
|
+
- **Evidence** is `file:line` or the event that proves the row is real. A row with
|
|
80
|
+
no evidence is a wish and does not enter the list.
|
|
81
|
+
|
|
82
|
+
Coverage gate, checked before ranking: at least one row per baseline group, three
|
|
83
|
+
per role, one per stage, three failure rows, and every row cites an entry point or
|
|
84
|
+
an event. Counts, not impressions — write the numbers under the table.
|
|
85
|
+
|
|
86
|
+
## The eight baseline groups
|
|
87
|
+
|
|
88
|
+
Enumerate against these before brainstorming anything else. Each one asks a question
|
|
89
|
+
the product either answers or does not.
|
|
90
|
+
|
|
91
|
+
| Group | Question | A gap looks like |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| First use | Empty state: is the first useful result within three steps? | Onboarding that explains instead of producing |
|
|
94
|
+
| Daily path | The most frequent route — where does each step land? | A step that lands in no screen, no interface, no event |
|
|
95
|
+
| Stuck | It is not moving: how does the person find out, and locate why? | A spinner, or a status nobody can explain |
|
|
96
|
+
| Adjustment | Requirements, people, or priority change mid-flight: how to back out and resume? | Only "start over" |
|
|
97
|
+
| Paused | Do "stopped by the user" and "declared dead by the system" look different? | One grey badge for both |
|
|
98
|
+
| Switching | Across projects or teams, is context lost? | The previous project's data still on screen |
|
|
99
|
+
| Collaboration | Handoff, assignment, comment, approval — did the message actually arrive? | A notification nobody receives |
|
|
100
|
+
| Quota and cost | At the limit: does the person see why and what next, or just a number? | A number with no path |
|
|
101
|
+
|
|
102
|
+
Plus three failure classes, at least one scenario each: permission refused, upstream
|
|
103
|
+
cancelled or dependency gone, crash and recovery.
|
|
104
|
+
|
|
105
|
+
## The quality bar
|
|
106
|
+
|
|
107
|
+
A card is good enough when a stranger could implement it without asking what was
|
|
108
|
+
meant, and could tell whether you did. Concretely:
|
|
109
|
+
|
|
110
|
+
- **Every step lands somewhere.** "The user sees progress" is not a landing; "the
|
|
111
|
+
run row shows `step 3/7`" is.
|
|
112
|
+
- **The precondition is a state**, not a mood: name it in the product's own
|
|
113
|
+
vocabulary.
|
|
114
|
+
- **The branches are chosen, not listed.** Empty/double/concurrent/permission/
|
|
115
|
+
dependency/slow/large/old — write the ones that apply and delete the rest.
|
|
116
|
+
- **The failure form answers three questions**: what is shown, what was recorded,
|
|
117
|
+
who recovers.
|
|
118
|
+
- **The negative assertion is executable** by someone who was not in this
|
|
119
|
+
conversation.
|
|
120
|
+
|
|
121
|
+
## Three questions that expose a slogan
|
|
122
|
+
|
|
123
|
+
1. Where does this state come from?
|
|
124
|
+
2. Where does this write land?
|
|
125
|
+
3. Who cleans up after it fails?
|
|
126
|
+
|
|
127
|
+
If any answer is "the system handles it", the card is not finished.
|
|
128
|
+
|
|
129
|
+
## How many cards
|
|
130
|
+
|
|
131
|
+
Full scenario list: every row of the grid. P0 cards: three. More than three P0
|
|
132
|
+
cards means the ranking has not been done; fewer means a scenario is probably
|
|
133
|
+
missing a failure branch.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# The delivery check
|
|
2
|
+
|
|
3
|
+
Source: adapted from the local skill `scenario-driven-product-design` (`SKILL.md`,
|
|
4
|
+
「自检(交付前逐条打勾)」), user-authored, no upstream licence; retargeted at this
|
|
5
|
+
protocol's outputs.
|
|
6
|
+
|
|
7
|
+
Tick every line before you hand a design over. This is a gate, not a summary: an
|
|
8
|
+
unticked line is a finding about the design, so fix the design or write the gap into
|
|
9
|
+
the open-questions section. Do not tick a line you did not check.
|
|
10
|
+
|
|
11
|
+
## Roles and boundaries
|
|
12
|
+
|
|
13
|
+
- [ ] Every role has an entry point, a write surface, a refusal surface, and an owner
|
|
14
|
+
for failure.
|
|
15
|
+
- [ ] At least one high-frequency need is **denied** by the permission matrix, with
|
|
16
|
+
its alternative entry point written down.
|
|
17
|
+
- [ ] The non-users are named: who this does not serve, and what it does not replace.
|
|
18
|
+
|
|
19
|
+
## Capability and evidence
|
|
20
|
+
|
|
21
|
+
- [ ] Every row of the feature card has a state and an evidence cell; nothing says
|
|
22
|
+
"should already be implemented".
|
|
23
|
+
- [ ] The capability states come from `/code-audit` or are marked `unconfirmed`;
|
|
24
|
+
none was inferred from a README, a comment, or a test name.
|
|
25
|
+
- [ ] Every numeric claim in the documents came from a command's output, and every
|
|
26
|
+
claim about current behaviour carries `file:line`.
|
|
27
|
+
|
|
28
|
+
## Scenarios
|
|
29
|
+
|
|
30
|
+
- [ ] The list covers the eight baseline groups and the three failure classes, and
|
|
31
|
+
the counts are written under the table.
|
|
32
|
+
- [ ] Every P0 card has all ten fields, including the boundary eight (empty,
|
|
33
|
+
duplicate, concurrent, permission, dependency, slow, large, old) that apply.
|
|
34
|
+
- [ ] Every P0 card has a negative assertion — what the action must not change.
|
|
35
|
+
- [ ] No card contains a solution. Solutions live in the batch table.
|
|
36
|
+
|
|
37
|
+
## Structure (when the project has models, ports, or contracts)
|
|
38
|
+
|
|
39
|
+
- [ ] Every model field can answer where its value comes from; a field that cannot
|
|
40
|
+
was deleted or given a port.
|
|
41
|
+
- [ ] Every external dependency is either behind a port with a written admission
|
|
42
|
+
reason, or listed in the not-abstracting list.
|
|
43
|
+
- [ ] Every invariant has a failure code and a test that can go red. An invariant
|
|
44
|
+
with only wording is not an invariant.
|
|
45
|
+
- [ ] Event types and error codes exist in one catalogue, and every name used by the
|
|
46
|
+
documents or the code is in it.
|
|
47
|
+
- [ ] Every decision points at a D number; a changed decision opened a new row and
|
|
48
|
+
names what it supersedes.
|
|
49
|
+
|
|
50
|
+
## Ranking and batches
|
|
51
|
+
|
|
52
|
+
- [ ] The documents say whether the order used frequency-first or harm-first, and
|
|
53
|
+
did not mix them.
|
|
54
|
+
- [ ] Batch 0 is a gate, and the gate names its scanner, allowlist, ratchet, and
|
|
55
|
+
cross-check.
|
|
56
|
+
- [ ] Every batch has acceptance, risk, and rollback, and the dependency order is in
|
|
57
|
+
the table.
|
|
58
|
+
- [ ] The not-doing table has at least three rows, each with a reason and a condition
|
|
59
|
+
to revisit.
|
|
60
|
+
- [ ] The progress table uses only the four states, and a "done" row has a commit.
|
|
61
|
+
|
|
62
|
+
## Assumptions
|
|
63
|
+
|
|
64
|
+
- [ ] Every assumption that depends on the host or a third party is either verified
|
|
65
|
+
by a probe or marked **unconfirmed** and tied to the batch that needs it.
|
|
66
|
+
- [ ] The unconfirmed items are in their own section and none of them has migrated
|
|
67
|
+
into a conclusion.
|
|
68
|
+
|
|
69
|
+
## What to do with a failed line
|
|
70
|
+
|
|
71
|
+
Say which line failed and what it would take to pass. A design delivered with three
|
|
72
|
+
unticked lines and those three named is usable; one delivered with all sixteen ticked
|
|
73
|
+
and two of them false is the failure this checklist exists to prevent.
|
package/agents/pua/AGENT.md
CHANGED
|
@@ -64,3 +64,6 @@ earns you two postmortems.
|
|
|
64
64
|
| `references/flavors.md` | the session names a corporate flavor, or you need the rhetoric for one |
|
|
65
65
|
| `references/methodology.md` | you are at L3 and owe the 7-point checklist |
|
|
66
66
|
| `examples/run.md` | you want the shape of a stuck turn that recovers, and one that does not |
|
|
67
|
+
|
|
68
|
+
If a reference path is unreadable, continue from this file — the core instructions are
|
|
69
|
+
self-sufficient.
|
package/agents/review/AGENT.md
CHANGED
|
@@ -90,6 +90,22 @@ Return **exactly one JSON object** and nothing else — no prose, no markdown fe
|
|
|
90
90
|
- `fixed` is present only in apply mode, and only for fixes you actually made and verified. In dry-run it is absent or empty.
|
|
91
91
|
- `limitations` is optional; use it for files you could not open, tests you could not run, or generated code you skipped.
|
|
92
92
|
|
|
93
|
+
### When the brief says in-session
|
|
94
|
+
|
|
95
|
+
The envelope is for the isolated run. When the brief says this run is in-session,
|
|
96
|
+
the person reads the report in the conversation, not through the renderer — write
|
|
97
|
+
the same content as Markdown instead of the JSON object:
|
|
98
|
+
|
|
99
|
+
- one line of summary, and the verdict;
|
|
100
|
+
- one section per finding: `### [P1] <title>`, then the location as `path:line`,
|
|
101
|
+
then the body;
|
|
102
|
+
- a `## Fixed` section in apply mode: one entry per fix with its file and the
|
|
103
|
+
command that verified it;
|
|
104
|
+
- a `## Not checked` section when `limitations` is non-empty.
|
|
105
|
+
|
|
106
|
+
The JSON rules above still decide **what** goes in each part; only the format
|
|
107
|
+
changes. Do not send both.
|
|
108
|
+
|
|
93
109
|
## Honesty
|
|
94
110
|
|
|
95
111
|
Zero findings is a valid, common answer. Do not manufacture findings to look thorough. Do not claim you ran a test you did not run. If the change is clean, `overall_correctness` is `"patch is correct"` and `findings` is `[]`.
|
package/agents/scrub/AGENT.md
CHANGED
|
@@ -70,7 +70,11 @@ When you cannot tell whether a value is live, say so in the body and set the pri
|
|
|
70
70
|
|
|
71
71
|
## Output
|
|
72
72
|
|
|
73
|
-
**Dry-run** — return exactly one JSON object, no prose, no fence.
|
|
73
|
+
**Dry-run** — return exactly one JSON object, no prose, no fence. When the brief says
|
|
74
|
+
this run is in-session, write the same rows as a Markdown table instead (one row per
|
|
75
|
+
finding: masked value, `path:line`, priority, one-line reason) — the person reads it in
|
|
76
|
+
the conversation and never sees the renderer. Do not send both. Same schema the review
|
|
77
|
+
agent uses otherwise:
|
|
74
78
|
|
|
75
79
|
```json
|
|
76
80
|
{
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { sessionKey } from './src/identity.js'
|
|
|
7
7
|
import { Journal } from './src/journal.js'
|
|
8
8
|
import { parseReport, renderReport } from './src/report.js'
|
|
9
9
|
import { buildPua, flavorList, resolveFlavor } from './src/pua.js'
|
|
10
|
+
import { buildDesignText, resolveDesignInput } from './src/design.js'
|
|
10
11
|
import { runIsolatedAgent } from './src/runtime.js'
|
|
11
12
|
import { SessionCommand } from './src/command.js'
|
|
12
13
|
|
|
@@ -42,7 +43,7 @@ export function apply(ctx, config = {}) {
|
|
|
42
43
|
if (config.reportDirectory !== undefined && !isAbsolute(config.reportDirectory)) {
|
|
43
44
|
throw new Error(translate(fallbackLocale, 'error.reportDirectory'))
|
|
44
45
|
}
|
|
45
|
-
for (const key of ['reviewModel', 'simplifyModel', 'scrubModel']) {
|
|
46
|
+
for (const key of ['reviewModel', 'simplifyModel', 'scrubModel', 'auditModel']) {
|
|
46
47
|
if (config[key] !== undefined && !String(config[key]).trim()) {
|
|
47
48
|
throw new Error(translate(fallbackLocale, 'error.model'))
|
|
48
49
|
}
|
|
@@ -50,6 +51,9 @@ export function apply(ctx, config = {}) {
|
|
|
50
51
|
if (config.ledgerDirectory !== undefined && !String(config.ledgerDirectory).trim()) {
|
|
51
52
|
throw new Error(translate(fallbackLocale, 'error.ledgerDirectory'))
|
|
52
53
|
}
|
|
54
|
+
if (config.designDirectory !== undefined && !String(config.designDirectory).trim()) {
|
|
55
|
+
throw new Error(translate(fallbackLocale, 'error.designDirectory'))
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
const journal = new Journal(config.reportDirectory ?? Journal.defaultDirectory())
|
|
55
59
|
const personas = {
|
|
@@ -57,6 +61,8 @@ export function apply(ctx, config = {}) {
|
|
|
57
61
|
review: loadPersona('review'),
|
|
58
62
|
scrub: loadPersona('scrub'),
|
|
59
63
|
caption: loadPersona('caption'),
|
|
64
|
+
audit: loadPersona('audit'),
|
|
65
|
+
design: loadPersona('design'),
|
|
60
66
|
pua: loadPersona('pua'),
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -78,6 +84,16 @@ export function apply(ctx, config = {}) {
|
|
|
78
84
|
return cwd ? join(cwd, 'docs', 'caption') : join(ROOT, 'docs', 'caption')
|
|
79
85
|
}
|
|
80
86
|
|
|
87
|
+
/** Where the design documents live; same rule as the caption ledger. */
|
|
88
|
+
const designDirectory = (cwd) => {
|
|
89
|
+
if (config.designDirectory) {
|
|
90
|
+
return isAbsolute(config.designDirectory)
|
|
91
|
+
? config.designDirectory
|
|
92
|
+
: join(cwd ?? ROOT, config.designDirectory)
|
|
93
|
+
}
|
|
94
|
+
return cwd ? join(cwd, 'docs', 'design') : join(ROOT, 'docs', 'design')
|
|
95
|
+
}
|
|
96
|
+
|
|
81
97
|
/** Everything a command needs from the plugin, in one place. */
|
|
82
98
|
const host = {
|
|
83
99
|
ctx,
|
|
@@ -87,6 +103,7 @@ export function apply(ctx, config = {}) {
|
|
|
87
103
|
planMaxAgeMs: minutesToMs(config.planMaxAgeMinutes, 60, 'error.planMaxAge'),
|
|
88
104
|
localeNow,
|
|
89
105
|
ledgerDirectory,
|
|
106
|
+
designDirectory,
|
|
90
107
|
translate: (locale, key) => translate(locale, key),
|
|
91
108
|
deliver(agent, message) {
|
|
92
109
|
try {
|
|
@@ -137,6 +154,21 @@ export function apply(ctx, config = {}) {
|
|
|
137
154
|
structured: true,
|
|
138
155
|
dryRunText: 'Report only. Change no files.',
|
|
139
156
|
}, host),
|
|
157
|
+
new SessionCommand({
|
|
158
|
+
name: 'code-audit',
|
|
159
|
+
command: 'audit',
|
|
160
|
+
descriptionKey: 'cmd.audit',
|
|
161
|
+
hintKey: 'hint.audit',
|
|
162
|
+
persona: personas.audit,
|
|
163
|
+
model: config.auditModel,
|
|
164
|
+
// An audit has no apply path: the state table and its evidence are the
|
|
165
|
+
// whole deliverable, so the mode is fixed instead of being a flag.
|
|
166
|
+
forceDryRun: true,
|
|
167
|
+
defaultScope: 'project',
|
|
168
|
+
structured: true,
|
|
169
|
+
dryRunKey: 'mode.audit',
|
|
170
|
+
deliveryKey: 'audit.delivery',
|
|
171
|
+
}, host),
|
|
140
172
|
new SessionCommand({
|
|
141
173
|
name: 'code-caption',
|
|
142
174
|
command: 'caption',
|
|
@@ -162,6 +194,30 @@ export function apply(ctx, config = {}) {
|
|
|
162
194
|
receipt: (rawInput, t, installed, agent) => t(installed ? 'caption.reinstalled' : 'caption.installed')
|
|
163
195
|
.replace('{dir}', ledgerDirectory(agent?.session?.header?.cwd)),
|
|
164
196
|
}, host),
|
|
197
|
+
new SessionCommand({
|
|
198
|
+
name: 'code-design',
|
|
199
|
+
command: 'design',
|
|
200
|
+
kind: 'inject',
|
|
201
|
+
descriptionKey: 'cmd.design',
|
|
202
|
+
hintKey: 'hint.design',
|
|
203
|
+
persona: personas.design,
|
|
204
|
+
buildText: ({ rawInput, agent, locale, host, installed }) => {
|
|
205
|
+
const cwd = agent.session?.header?.cwd
|
|
206
|
+
const { tier, task } = resolveDesignInput(rawInput)
|
|
207
|
+
return buildDesignText({
|
|
208
|
+
tier,
|
|
209
|
+
task,
|
|
210
|
+
cwd,
|
|
211
|
+
directory: host.designDirectory(cwd),
|
|
212
|
+
personaDirectory: personas.design.directory,
|
|
213
|
+
persona: personas.design.text,
|
|
214
|
+
installed,
|
|
215
|
+
language: outputLanguage(locale),
|
|
216
|
+
})
|
|
217
|
+
},
|
|
218
|
+
receipt: (rawInput, t, installed, agent) => t(installed ? 'design.reinstalled' : 'design.installed')
|
|
219
|
+
.replace('{dir}', designDirectory(agent?.session?.header?.cwd)),
|
|
220
|
+
}, host),
|
|
165
221
|
new SessionCommand({
|
|
166
222
|
name: 'pua',
|
|
167
223
|
kind: 'inject',
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Code toolkit",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Seven commands that work with no arguments. Review looks at the uncommitted changes (or the branch against its base when the tree is clean), reports, and fixes what it finds — add report for the report only. Simplify and scrub cover the whole project and write by default (add report for a plan only). Audit is read-only: it traces every capability from its real entry point to storage and labels it wired, half, fake, broken or missing — a capability nobody reached is unverified, never wired. Caption runs a hard task through an explicit loop with a ledger, and can create expert subagents mid-run for work that splits without colliding. Design turns “what is this project missing” into scenario cards and a batched plan, writes the documents and stops for approval. Pua installs a protocol for changing method and showing evidence instead of shrugging. Add sub to run in an isolated agent instead. Prompts are organised as a layered skill-style tree, with a deterministic test suite and a model evaluation loop."
|
|
5
5
|
}
|
|
6
|
-
}
|
|
6
|
+
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "代码工具箱",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "七条命令,空输入即可用。审查默认看未提交的改动(都提交了就看当前分支相对基线的改动),出报告并修复发现的问题,加 report 只出报告。精炼与隐私清理默认扫整个项目并直接改(加 report 只出报告)。审计只读:从真实入口追到存储,标出通/半/假/断/无五态,没有跑过入口的能力一律标未确认。caption 把难任务装进显式循环:一步一验、过程落成台账,执行中可以创建专家子 agent 分派任务。design 把「这个项目还缺什么」压成场景卡与批次方案,出文档等人批,止于方案。pua 给会话装上「失败换方法、完成要证据」的协议。加 sub 改用独立 agent。提示词按 skill 分层组织,附确定性测试与模型评测流程。"
|
|
5
5
|
}
|
|
6
|
-
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morning-start/dsh-code-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"description": "
|
|
10
|
+
"description": "Seven commands for DeepSeek Harness: review and fix, behavior-preserving simplification, privacy scrubbing, a read-only capability audit, a caption loop with a ledger, scenario-driven product design, and a PUA protocol. Each runs in the current session by default (add sub for an isolated agent) and writes by default (add report for a report only).",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"icon": "./icon.svg",
|
|
13
13
|
"keywords": [
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"simplify",
|
|
21
21
|
"privacy",
|
|
22
22
|
"secret-scan",
|
|
23
|
+
"capability-audit",
|
|
24
|
+
"product-design",
|
|
25
|
+
"scenario",
|
|
23
26
|
"caption",
|
|
24
27
|
"pua",
|
|
25
28
|
"subagent"
|
package/src/command.js
CHANGED
|
@@ -295,15 +295,25 @@ export class SessionCommand {
|
|
|
295
295
|
/** The task text handed to either the current agent or the child. */
|
|
296
296
|
async buildPrompt({ scope, mode, cwd, locale, signal, inline, plan }) {
|
|
297
297
|
const { spec } = this
|
|
298
|
+
const t = (key) => this.host.translate(locale, key)
|
|
298
299
|
const chinese = String(locale).startsWith('zh')
|
|
300
|
+
// A command whose dry run is a report rather than a plan (the audit) names
|
|
301
|
+
// its own instruction by key, so the wording is translated with the rest of
|
|
302
|
+
// the chrome instead of being frozen in one language here.
|
|
303
|
+
const dryRunLine = spec.dryRunKey
|
|
304
|
+
? t(spec.dryRunKey)
|
|
305
|
+
: chinese ? '只出计划,不要改任何文件。' : (spec.dryRunText ?? 'Report only. Change no files.')
|
|
299
306
|
const modeLine = mode === 'dry-run'
|
|
300
|
-
?
|
|
307
|
+
? dryRunLine
|
|
301
308
|
: (chinese
|
|
302
309
|
? '按计划修改,并验证行为不变;验证不通过就回退那一处改动并如实报告。'
|
|
303
310
|
: 'Apply the changes, then verify that behavior is unchanged. If verification fails, revert that change and report it.')
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
const deliveryKey = spec.deliveryKey
|
|
312
|
+
const delivery = deliveryKey
|
|
313
|
+
? t(deliveryKey)
|
|
314
|
+
: chinese
|
|
315
|
+
? '你的最终回复会原样发给用户,作为这次任务的结果:写清改了什么、跑了哪条命令、输出是什么、哪些没有验证。'
|
|
316
|
+
: 'Your final reply is delivered to the user as the result: say what changed, which command ran, what it printed, and what stayed unverified.'
|
|
307
317
|
const personaLine = chinese
|
|
308
318
|
? '先读参考目录下的 AGENT.md,按它的流程与判定标准执行。'
|
|
309
319
|
: 'Read AGENT.md in the reference directory first and follow its process and bar.'
|
package/src/design.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The design command's input and prompt.
|
|
3
|
+
*
|
|
4
|
+
* The skill this protocol comes from grades its own answer by effort: a
|
|
5
|
+
* thirty-minute judgement, a half-day design, a full plan. That is worth keeping,
|
|
6
|
+
* but not as a config option nobody reads — it is the first word of the command,
|
|
7
|
+
* so `/code-design quick` and `/code-design` are different sizes of answer.
|
|
8
|
+
*
|
|
9
|
+
* Only the first word is a tier: a task that happens to contain "quick" later in
|
|
10
|
+
* the sentence is not silently re-sized.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Tiers that can be named explicitly; `default` is what no tier means. */
|
|
14
|
+
export const DESIGN_TIERS = ['quick', 'full']
|
|
15
|
+
|
|
16
|
+
const DEFAULT_TIER = 'default'
|
|
17
|
+
|
|
18
|
+
const DEFAULT_TIER_BRIEF = [
|
|
19
|
+
'Tier: default — a half-day design.',
|
|
20
|
+
'Base maps, eight to twelve scenarios, three P0 cards, one batch table with its',
|
|
21
|
+
'dependencies, and documents 01–03. Give the one-page conclusion first.',
|
|
22
|
+
].join(' ')
|
|
23
|
+
|
|
24
|
+
const TIER_BRIEF = {
|
|
25
|
+
quick: [
|
|
26
|
+
'Tier: quick — a thirty-minute judgement, one page.',
|
|
27
|
+
'One document: the one-page conclusions, five scenarios with a one-line failure',
|
|
28
|
+
'form each, and a batch table of at most three items. No scenario cards, no',
|
|
29
|
+
'appendix. Say at the top that this is the quick tier.',
|
|
30
|
+
].join(' '),
|
|
31
|
+
full: [
|
|
32
|
+
'Tier: full — a plan someone will build from.',
|
|
33
|
+
'All four base maps, every scenario, three P0 cards, the multi-angle matrix, the',
|
|
34
|
+
'batch table with dependencies, the not-doing table and the progress table, plus',
|
|
35
|
+
'every document that applies to this project. The one-page conclusion still comes',
|
|
36
|
+
'first, and fifteen pages of appendix never replace it.',
|
|
37
|
+
].join(' '),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Split the first word off as a tier when it names one. */
|
|
41
|
+
export function resolveDesignInput(rawInput) {
|
|
42
|
+
const text = String(rawInput ?? '').trim()
|
|
43
|
+
const match = /^(quick|full)\b[\s,:,:]*/i.exec(text)
|
|
44
|
+
if (match) return { tier: match[1].toLowerCase(), task: text.slice(match[0].length).trim() }
|
|
45
|
+
return { tier: DEFAULT_TIER, task: text }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The instruction that tells the agent how large an answer to give. */
|
|
49
|
+
export function tierBrief(tier) {
|
|
50
|
+
return TIER_BRIEF[tier] ?? DEFAULT_TIER_BRIEF
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const DEFAULT_TASK = 'design the next step for the project in this session: read its own rules and goals first, then produce the maps and the plan.'
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The text injected into the conversation: where the documents go, which tier
|
|
57
|
+
* this run is, and the protocol itself — unless it is already installed, in which
|
|
58
|
+
* case repeating 10 KB of protocol only gives the agent two copies to disagree
|
|
59
|
+
* with.
|
|
60
|
+
*/
|
|
61
|
+
export function buildDesignText({ tier, task, cwd, directory, personaDirectory, persona, installed, language }) {
|
|
62
|
+
const head = ['# Scenario-driven design', '', `Task: ${task || DEFAULT_TASK}`]
|
|
63
|
+
if (cwd) head.push(`Working directory: ${cwd}`)
|
|
64
|
+
head.push(`Design directory: ${directory}`)
|
|
65
|
+
head.push(`Reference directory: ${personaDirectory}`)
|
|
66
|
+
const body = installed
|
|
67
|
+
? 'The design protocol is already installed earlier in this conversation. Continue under it: re-read the documents you already wrote before adding to them, and never rewrite a settled decision without opening a new one.'
|
|
68
|
+
: persona
|
|
69
|
+
return [...head, '', tierBrief(tier), '', body, '', language].join('\n')
|
|
70
|
+
}
|
package/src/i18n.js
CHANGED
|
@@ -28,6 +28,15 @@ const MESSAGES = {
|
|
|
28
28
|
'hint.caption': '留空即继续当前任务;或写下任务与验收判据',
|
|
29
29
|
'caption.installed': '已装入 caption 循环:台账写到 {dir},每一步都要有命令和它的结果。',
|
|
30
30
|
'caption.reinstalled': 'caption 循环已在本次会话里,只补了任务:台账 {dir},继续按循环走。',
|
|
31
|
+
'cmd.audit': '审计现有能力:从真实入口追到存储,标出通/半/假/断/无,只读',
|
|
32
|
+
'hint.audit': '留空即审整个项目;读取量大,推荐加 sub 用子 agent',
|
|
33
|
+
'mode.audit': '只出五态表与证据,不改任何文件;没有走通真实入口的能力标「未确认」,不要标「通」。',
|
|
34
|
+
'audit.delivery': '你的最终回复会原样作为审计结果发回:一条能力一行,写清状态、证据(文件:行)和链路断在哪一步,以及哪些没有验到。',
|
|
35
|
+
'cmd.design': '场景驱动的需求分析:四张底图、场景卡、批次方案,出文档等你批',
|
|
36
|
+
'hint.design': '留空即按半天深度设计;quick 只出一页结论,full 出完整方案与附录',
|
|
37
|
+
'design.installed': '已装入场景驱动设计协议:设计文档写到 {dir}。方案出完等你批,不会自己动手。',
|
|
38
|
+
'design.reinstalled': '设计协议已在本次会话里:设计文档 {dir},继续按协议推进。',
|
|
39
|
+
'error.designDirectory': 'designDirectory 不能为空。',
|
|
31
40
|
'error.noSteer': '当前宿主不支持向会话注入输入(agent.steer 不可用)。',
|
|
32
41
|
'error.noFollowup': '当前宿主不支持向会话投递任务(agent.followup 不可用)。',
|
|
33
42
|
'cmd.queued': '已交给当前会话,范围:{scope};完成后结果会作为一条消息发回。',
|
|
@@ -69,6 +78,20 @@ const MESSAGES = {
|
|
|
69
78
|
'cancel.done': '已请求取消。',
|
|
70
79
|
'report.verdict': '结论:',
|
|
71
80
|
'report.noFindings': '没有发现需要处理的问题。',
|
|
81
|
+
'report.capabilities': '能力五态',
|
|
82
|
+
'report.capability': '能力',
|
|
83
|
+
'report.state': '状态',
|
|
84
|
+
'report.evidence': '证据',
|
|
85
|
+
'report.walk': '路径:',
|
|
86
|
+
'report.expected': '期望:',
|
|
87
|
+
'report.actual': '实际:',
|
|
88
|
+
'report.impact': '影响:',
|
|
89
|
+
'report.batch': '建议批次:',
|
|
90
|
+
'state.wired': '通',
|
|
91
|
+
'state.half': '半',
|
|
92
|
+
'state.fake': '假',
|
|
93
|
+
'state.broken': '断',
|
|
94
|
+
'state.missing': '无',
|
|
72
95
|
'report.limitation': '未覆盖:',
|
|
73
96
|
'report.fixed': '已修复',
|
|
74
97
|
'report.verifiedBy': '验证:',
|
|
@@ -83,6 +106,15 @@ const MESSAGES = {
|
|
|
83
106
|
'hint.caption': 'Leave empty to continue the current task; or state the task and its acceptance criteria',
|
|
84
107
|
'caption.installed': 'Caption loop installed: keep the ledger in {dir}, with a command and its result for every step.',
|
|
85
108
|
'caption.reinstalled': 'The caption loop is already installed in this session; only the task was added. Ledger: {dir}.',
|
|
109
|
+
'cmd.audit': 'Audit what actually exists: trace every capability to storage and mark it wired/half/fake/broken/missing; read-only',
|
|
110
|
+
'hint.audit': 'Leave empty to audit the whole project; it reads a lot, so add sub for an isolated agent',
|
|
111
|
+
'mode.audit': 'Report the five-state table and its evidence only. Change no files, and mark a capability you did not reach through its real entry point as unverified — never wired.',
|
|
112
|
+
'audit.delivery': 'Your final reply is delivered as the audit result: one capability per row, with its state, its evidence (file:line), which link of the chain is missing, and what you could not verify.',
|
|
113
|
+
'cmd.design': 'Scenario-driven product design: four base maps, scenario cards, a batched plan; writes docs and stops for approval',
|
|
114
|
+
'hint.design': 'Leave empty for a half-day design; quick gives one page of conclusions, full gives the whole plan and appendix',
|
|
115
|
+
'design.installed': 'Scenario-driven design protocol installed: write the design documents under {dir}. It stops when the plan is ready and waits for approval — it never starts building by itself.',
|
|
116
|
+
'design.reinstalled': 'The design protocol is already installed in this session; the documents go under {dir}. Continue under it.',
|
|
117
|
+
'error.designDirectory': 'designDirectory cannot be empty.',
|
|
86
118
|
'error.noSteer': 'This host cannot inject input into the session (agent.steer is unavailable).',
|
|
87
119
|
'error.noFollowup': 'This host cannot queue a task into the session (agent.followup is unavailable).',
|
|
88
120
|
'cmd.queued': 'Handed to this session; scope: {scope}. The result arrives as a message when the run finishes.',
|
|
@@ -124,6 +156,20 @@ const MESSAGES = {
|
|
|
124
156
|
'cancel.done': 'Cancellation requested.',
|
|
125
157
|
'report.verdict': 'Verdict: ',
|
|
126
158
|
'report.noFindings': 'No findings worth acting on.',
|
|
159
|
+
'report.capabilities': 'Capability states',
|
|
160
|
+
'report.capability': 'Capability',
|
|
161
|
+
'report.state': 'State',
|
|
162
|
+
'report.evidence': 'Evidence',
|
|
163
|
+
'report.walk': 'Path: ',
|
|
164
|
+
'report.expected': 'Expected: ',
|
|
165
|
+
'report.actual': 'Actual: ',
|
|
166
|
+
'report.impact': 'Impact: ',
|
|
167
|
+
'report.batch': 'Suggested batch: ',
|
|
168
|
+
'state.wired': 'wired',
|
|
169
|
+
'state.half': 'half',
|
|
170
|
+
'state.fake': 'fake',
|
|
171
|
+
'state.broken': 'broken',
|
|
172
|
+
'state.missing': 'missing',
|
|
127
173
|
'report.limitation': 'Not checked: ',
|
|
128
174
|
'report.fixed': 'Fixed',
|
|
129
175
|
'report.verifiedBy': 'Verified by: ',
|