@selesai/code 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -1
- package/dist/config.js.map +1 -1
- package/dist/core/git-command.d.ts +9 -0
- package/dist/core/git-command.d.ts.map +1 -0
- package/dist/core/git-command.js +49 -0
- package/dist/core/git-command.js.map +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/defaults/models.json +18 -0
- package/dist/extensions/handoff-new.test.ts +210 -0
- package/dist/extensions/handoff-new.ts +172 -0
- package/dist/extensions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/dist/extensions/package.json +1 -0
- package/dist/extensions/test-resolve-hook-impl.mjs +7 -0
- package/dist/extensions/test-resolve-hook.mjs +7 -0
- package/dist/extensions/workflow/adapter.ts +162 -6
- package/dist/extensions/workflow/modes/prototype.ts +42 -17
- package/dist/extensions/workflow/modes/quick.ts +40 -17
- package/dist/extensions/workflow/state-machine.ts +117 -15
- package/dist/extensions/workflow/validators.ts +42 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +23 -8
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/skills/improve-codebase/SKILL.md +2 -2
- package/dist/utils/version-check.d.ts +3 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +19 -0
- package/dist/utils/version-check.js.map +1 -1
- package/docs/workflows.md +21 -24
- package/package.json +5 -5
package/docs/workflows.md
CHANGED
|
@@ -6,17 +6,19 @@ Selesai ships a workflow engine under `src/extensions/workflow/`. It powers the
|
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
src/extensions/workflow/
|
|
9
|
-
package.json pi package manifest;
|
|
9
|
+
package.json pi package manifest; loads ./extension.ts as the single entry
|
|
10
10
|
state-machine.ts pure phase state machine (no fs, no pi API)
|
|
11
11
|
adapter.ts pi wiring: tools, commands, events, fs, agent continuation
|
|
12
|
+
extension.ts single pi extension that mounts every workflow mode
|
|
12
13
|
modes/
|
|
13
|
-
prototype.ts config
|
|
14
|
-
quick.ts config
|
|
14
|
+
prototype.ts mode config + registration object (exported as `prototypeMode`)
|
|
15
|
+
quick.ts mode config + registration object (exported as `quickMode`)
|
|
15
16
|
```
|
|
16
17
|
|
|
17
18
|
- **`state-machine.ts`** is the deep module. It owns the phase graph, artifact gating, skip rules, the terminal close gate, and the reentrancy guard. It imports nothing external — no `node:fs`, no pi API, no `pi-tui`, no `typebox`. Every method returns a `WorkflowEffect` (a discriminated union in domain vocabulary) that the adapter pattern-matches on.
|
|
18
|
-
- **`adapter.ts`** is the thin glue. One state-machine method per call site (`start` tool, `
|
|
19
|
-
-
|
|
19
|
+
- **`adapter.ts`** is the thin glue. One state-machine method per call site (`start` tool, `end` tool, `tool_result` auto-advance, `/<command>`) plus one `applyEffect` switch. It owns all pi/fs wiring and the git-based `reuse` skip predicate. There is no `next` tool — phase advance is automatic once the phase artifact lands, and terminal close is via the `end` tool.
|
|
20
|
+
- **`extension.ts`** imports each mode's registration object and calls `createWorkflowExtension(config, options)(pi)` for each, so one extension load resolves a single shared writer tool + one start/end tool pair per mode.
|
|
21
|
+
- **A mode file** is pure data: the phase list, the per-phase artifact filenames, the per-phase prompt generators, the terminal close artifacts, and identity strings (tool names, command name, status key, entry type). Prompts are functions that receive `{ artifactDir, userPrompt }` and return a string. Each mode exports a `WorkflowModeRegistration` object (e.g. `prototypeMode`, `quickMode`); it does not call `createWorkflowExtension` itself.
|
|
20
22
|
|
|
21
23
|
## To add a future mode
|
|
22
24
|
|
|
@@ -31,8 +33,8 @@ import type {
|
|
|
31
33
|
Phase,
|
|
32
34
|
PromptContext,
|
|
33
35
|
WorkflowConfig,
|
|
36
|
+
WorkflowModeRegistration,
|
|
34
37
|
} from "../state-machine.ts";
|
|
35
|
-
import { createWorkflowExtension } from "../adapter.ts";
|
|
36
38
|
|
|
37
39
|
const phases: Phase[] = [
|
|
38
40
|
"grilling",
|
|
@@ -81,40 +83,35 @@ const config: WorkflowConfig = {
|
|
|
81
83
|
footerLabel: "rigorous",
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
export
|
|
86
|
+
export const rigorousMode: WorkflowModeRegistration = {
|
|
87
|
+
config,
|
|
85
88
|
commandName: "rigorous",
|
|
86
89
|
commandDescription:
|
|
87
90
|
"Run the rigorous workflow (grill → spec → research → plan → reuse → handoff → loop → audit → sign-off)",
|
|
88
91
|
toolNames: {
|
|
89
92
|
start: "start_rigorous_workflow",
|
|
90
|
-
next: "next_rigorous_step",
|
|
91
93
|
end: "end_rigorous_workflow",
|
|
92
94
|
},
|
|
93
95
|
toolLabels: {
|
|
94
96
|
start: "Start Rigorous Workflow",
|
|
95
|
-
next: "Next Rigorous Step",
|
|
96
97
|
end: "End Rigorous Workflow",
|
|
97
98
|
},
|
|
98
|
-
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default rigorousMode;
|
|
99
102
|
```
|
|
100
103
|
|
|
101
|
-
### 2. Register it in
|
|
104
|
+
### 2. Register it in `extension.ts`
|
|
102
105
|
|
|
103
|
-
Add the mode to `src/extensions/workflow/
|
|
106
|
+
Add the mode to the `MODES` array in `src/extensions/workflow/extension.ts`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { rigorousMode } from "./modes/rigorous.ts";
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
"pi": {
|
|
108
|
-
"extensions": [
|
|
109
|
-
"./modes/prototype.ts",
|
|
110
|
-
"./modes/quick.ts",
|
|
111
|
-
"./modes/rigorous.ts"
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
111
|
+
const MODES = [prototypeMode, quickMode, rigorousMode] as const;
|
|
115
112
|
```
|
|
116
113
|
|
|
117
|
-
That's it. The loader picks it up at boot; the
|
|
114
|
+
That's it. The loader picks it up at boot (`package.json` loads only `./extension.ts`); the two tools (`start_rigorous_workflow`, `end_rigorous_workflow`) and the `/rigorous` command are registered automatically. There is no `next` tool — phases auto-advance as artifacts land and the `end` tool closes the terminal phase.
|
|
118
115
|
|
|
119
116
|
## Config reference
|
|
120
117
|
|
|
@@ -136,7 +133,7 @@ The second argument to `createWorkflowExtension`:
|
|
|
136
133
|
|
|
137
134
|
| Field | Description |
|
|
138
135
|
|---|---|
|
|
139
|
-
| `toolNames` | `{ start,
|
|
136
|
+
| `toolNames` | `{ start, end }` — the two registered tool names. There is no `next` tool; phases auto-advance as artifacts land. |
|
|
140
137
|
| `toolLabels` | Human-readable labels for the tools. |
|
|
141
138
|
| `commandName` | The `/<command>` name users type to kick off the workflow. |
|
|
142
139
|
| `commandDescription` | Description shown in the command list. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selesai/code",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Selesai coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"@earendil-works/pi-ai": "0.80.2",
|
|
35
35
|
"@earendil-works/pi-tui": "0.80.2",
|
|
36
36
|
"@mariozechner/clipboard": "^0.3.9",
|
|
37
|
+
"@mozilla/readability": "^0.6.0",
|
|
37
38
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
38
39
|
"chalk": "5.6.2",
|
|
40
|
+
"cheerio": "^1.1.0",
|
|
39
41
|
"cross-spawn": "7.0.6",
|
|
40
42
|
"diff": "8.0.4",
|
|
41
|
-
"@mozilla/readability": "^0.6.0",
|
|
42
|
-
"cheerio": "^1.1.0",
|
|
43
|
-
"jsdom": "^26.0.0",
|
|
44
|
-
"playwright": "^1.60.0",
|
|
45
43
|
"glob": "13.0.6",
|
|
46
44
|
"highlight.js": "10.7.3",
|
|
47
45
|
"hosted-git-info": "9.0.3",
|
|
48
46
|
"ignore": "7.0.5",
|
|
49
47
|
"jiti": "2.7.0",
|
|
48
|
+
"jsdom": "^26.0.0",
|
|
50
49
|
"minimatch": "10.2.5",
|
|
50
|
+
"playwright": "^1.60.0",
|
|
51
51
|
"proper-lockfile": "4.1.2",
|
|
52
52
|
"semver": "7.8.0",
|
|
53
53
|
"typebox": "1.1.38",
|