@wanbicoi/next-steps 0.0.0-stage → 0.1.1
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.md +214 -2
- package/dist/cli.js +1174 -0
- package/package.json +59 -4
- package/viz/template.html +648 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 next-steps contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,215 @@
|
|
|
1
|
-
#
|
|
1
|
+
# next-steps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A small CLI that keeps an agent on a predefined workflow. The graph is one file,
|
|
4
|
+
`.next-steps/workflow.json`; the tool records one session per task and always
|
|
5
|
+
answers the same question: **what can I do next?**
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ next-steps create
|
|
9
|
+
session: 4f1c9b3e-9a02-4d1c-8e11-7c6b1f0a2d33
|
|
10
|
+
workflow: feature-work Implement a feature end to end
|
|
11
|
+
status: running
|
|
12
|
+
|
|
13
|
+
next:
|
|
14
|
+
1. read-issue Read the issue
|
|
15
|
+
Open the ticket and summarize the acceptance criteria.
|
|
16
|
+
|
|
17
|
+
$ next-steps log --key 4f1c... --node read-issue
|
|
18
|
+
logged: #1 read-issue (entry)
|
|
19
|
+
status: running
|
|
20
|
+
|
|
21
|
+
next:
|
|
22
|
+
1. implement Implement [review]
|
|
23
|
+
Criteria are understood.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The point is not to constrain what the agent can think — it is to make the path
|
|
27
|
+
it took readable afterwards, and to stop it from skipping work or losing its
|
|
28
|
+
place. A node marked `[review]` means the agent shows the plan and waits for an
|
|
29
|
+
explicit yes before doing the work; the flag is advisory, so nothing blocks a
|
|
30
|
+
scripted run.
|
|
31
|
+
|
|
32
|
+
## Run it
|
|
33
|
+
|
|
34
|
+
Published package (Node 22.13+):
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npx @wanbicoi/next-steps help
|
|
38
|
+
bunx @wanbicoi/next-steps help
|
|
39
|
+
pnpm dlx @wanbicoi/next-steps help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The npm package is scoped, but the installed command is still `next-steps`, so a
|
|
43
|
+
project-local install shortens these to `next-steps help`, `bunx next-steps help`,
|
|
44
|
+
or `pnpm exec next-steps help`:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npm install --save-dev @wanbicoi/next-steps
|
|
48
|
+
bun add -d @wanbicoi/next-steps
|
|
49
|
+
pnpm add -D @wanbicoi/next-steps
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
From this repo (Bun):
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
bun install
|
|
56
|
+
bun src/cli.ts help
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
You can also use the package script: `bun run next-steps -- help`.
|
|
60
|
+
|
|
61
|
+
State is created on first use at `./.next-steps/state.db` (SQLite, gitignored).
|
|
62
|
+
The graph is read from `./.next-steps/workflow.json`; commit that file, and run
|
|
63
|
+
the tool from the project root. There are no path flags.
|
|
64
|
+
|
|
65
|
+
This repo keeps sample graphs under `test/fixtures/<id>/.next-steps/`. To try the
|
|
66
|
+
commands from the repo root:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
mkdir -p .next-steps && cp test/fixtures/feature-work/.next-steps/workflow.json .next-steps/
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Visualize the graph
|
|
73
|
+
|
|
74
|
+
`next-steps viz` serves an interactive Cytoscape viewer for
|
|
75
|
+
`.next-steps/workflow.json`:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
next-steps viz # http://127.0.0.1:3000
|
|
79
|
+
next-steps viz --port 8080
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
From this repo, `bun src/cli.ts viz`. Press Ctrl+C to stop. Groups are drawn as
|
|
83
|
+
labelled boxes, review nodes are marked, and every move shows its description and
|
|
84
|
+
condition. Edit `viz/template.html` to change the styles.
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
next-steps create [--key <key>] [--json]
|
|
90
|
+
next-steps log --key <key> --node <node> [--json]
|
|
91
|
+
next-steps next --key <key> [--json]
|
|
92
|
+
next-steps steps --key <key> [--limit <n>] [--after <seq>] [--json]
|
|
93
|
+
next-steps keys [--json]
|
|
94
|
+
next-steps reset --key <key> [--json]
|
|
95
|
+
|
|
96
|
+
next-steps workflow new [--json]
|
|
97
|
+
next-steps workflow show [--json]
|
|
98
|
+
next-steps workflow check [--json]
|
|
99
|
+
|
|
100
|
+
next-steps viz [--port <n>] [--json]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Pretty output is the default; `--json` is the stable, machine-readable form
|
|
104
|
+
documented in `docs/AGENTS.sample.md`.
|
|
105
|
+
|
|
106
|
+
`create` only opens a session (the key is the task id; a UUID is generated when
|
|
107
|
+
omitted). It does not author the graph — use `workflow new` for that.
|
|
108
|
+
|
|
109
|
+
## Workflow format
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"id": "deploy",
|
|
114
|
+
"title": "Deploy a change",
|
|
115
|
+
"start": "build",
|
|
116
|
+
"nodes": [
|
|
117
|
+
{
|
|
118
|
+
"id": "build",
|
|
119
|
+
"title": "Build",
|
|
120
|
+
"description": "Run the build.",
|
|
121
|
+
"group": "Prepare",
|
|
122
|
+
"next": [{ "to": "review", "description": "The build is green." }]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "review",
|
|
126
|
+
"title": "Review",
|
|
127
|
+
"description": "Read the change before it ships.",
|
|
128
|
+
"group": "Prepare",
|
|
129
|
+
"reviewRequired": true,
|
|
130
|
+
"next": [
|
|
131
|
+
{ "to": "build", "description": "Fix the review notes." },
|
|
132
|
+
{ "to": "END", "description": "Approved." }
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
- `start` names the first step. Every node needs at least one move.
|
|
140
|
+
- `next` holds the ways out of the node. `to` is a node id or `END`; a
|
|
141
|
+
`condition` adds prose the agent reads but nothing evaluates. The move the
|
|
142
|
+
agent actually logs is the audit trail, recorded as `from->to`.
|
|
143
|
+
- `END` is a reserved target, not a node. A node whose only move is `END`
|
|
144
|
+
finishes the run as soon as it is logged, with no extra step.
|
|
145
|
+
- `group` labels a region of the graph. It is rendering metadata: the viewer
|
|
146
|
+
draws it as a box, and the rest of the tool ignores it.
|
|
147
|
+
- `reviewRequired` marks a node that needs an explicit yes before the work
|
|
148
|
+
starts. It is reported in `next` and `workflow show`, and never enforced.
|
|
149
|
+
- Duplicate moves out of one node are rejected so the log is unambiguous, and at
|
|
150
|
+
least one move to `END` is required.
|
|
151
|
+
- The graph is flat: there are no subgraphs and no cross-file references.
|
|
152
|
+
|
|
153
|
+
Run `next-steps workflow check` after editing. It fails with exit 5 on structural
|
|
154
|
+
problems and warns about unreachable nodes or nodes that cannot reach `END`.
|
|
155
|
+
|
|
156
|
+
## Exit codes
|
|
157
|
+
|
|
158
|
+
`0` ok · `2` usage / duplicate key / invalid key · `3` not found ·
|
|
159
|
+
`4` invalid transition or unknown node · `5` invalid workflow file.
|
|
160
|
+
|
|
161
|
+
Errors go to stderr. With `--json` they are
|
|
162
|
+
`{ "error": { "code", "message", "details" } }`, and `details.legal` lists the
|
|
163
|
+
moves the graph allows.
|
|
164
|
+
|
|
165
|
+
## Publish
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
npm login
|
|
169
|
+
npm publish
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`prepublishOnly` runs lint, typecheck, tests, and knip. `prepack` builds
|
|
173
|
+
`dist/cli.js` for Node with a `#!/usr/bin/env node` shebang; the tarball contains
|
|
174
|
+
`dist/`, `README.md`, and `LICENSE`.
|
|
175
|
+
|
|
176
|
+
Check the package before publishing:
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
npm pack --dry-run
|
|
180
|
+
npx --yes ./wanbicoi-next-steps-<version>.tgz --help
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
bun run lint:fix # Biome, formatting + safe fixes
|
|
187
|
+
bun test # graph, validation, CLI end-to-end
|
|
188
|
+
bun run typecheck
|
|
189
|
+
bun run knip # unused files, exports, dependencies
|
|
190
|
+
bun run build # dist/cli.js, Node target
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Hooks (Husky): `pre-commit` runs Biome on staged files, `commit-msg` runs
|
|
194
|
+
commitlint (conventional commits), `pre-push` runs typecheck, tests, and knip.
|
|
195
|
+
|
|
196
|
+
Layout:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
src/cli.ts argument parsing, dispatch, exit codes
|
|
200
|
+
src/format.ts pretty output
|
|
201
|
+
src/commands/ one function per command
|
|
202
|
+
src/workflow/ load, validate, pure graph logic
|
|
203
|
+
src/runs/ session service, store, Bun/Node SQLite driver
|
|
204
|
+
scripts/build.ts Node bundle + shebang for dist/cli.js
|
|
205
|
+
test/fixtures/<id>/ sample graphs, each in its own .next-steps/ directory
|
|
206
|
+
test/ pure, validation, end-to-end
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`src/workflow/graph.ts` is pure: no I/O, no database, so the next computation is
|
|
210
|
+
testable in milliseconds. `RunStore` is an interface over `src/runs/driver.ts`,
|
|
211
|
+
which loads `bun:sqlite` under Bun and `node:sqlite` under Node. A state file from
|
|
212
|
+
0.1.0 or earlier is replaced on first use, since those sessions name graphs that
|
|
213
|
+
no longer exist.
|
|
214
|
+
|
|
215
|
+
`docs/initial-plan.md` records the original design and the decisions behind it.
|