@wanbicoi/next-steps 0.0.0-stage → 0.1.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.md +203 -2
- package/dist/cli.js +1440 -0
- package/package.json +59 -4
- package/viz/template.html +707 -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,204 @@
|
|
|
1
|
-
#
|
|
1
|
+
# next-steps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A small CLI that keeps an agent on a predefined workflow. The graph lives in
|
|
4
|
+
`workflows/*.json`; the tool records one session per task and always answers the
|
|
5
|
+
same question: **what can I do next?**
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ next-steps create --workflow feature-work
|
|
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
|
+
scope: feature-work status: running
|
|
20
|
+
|
|
21
|
+
next:
|
|
22
|
+
1. e1 -> implement Implement
|
|
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.
|
|
29
|
+
|
|
30
|
+
## Run it
|
|
31
|
+
|
|
32
|
+
Published package (Node 22.13+):
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx @wanbicoi/next-steps help
|
|
36
|
+
bunx @wanbicoi/next-steps help
|
|
37
|
+
pnpm dlx @wanbicoi/next-steps help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The npm package is scoped, but the installed command is still `next-steps`, so a
|
|
41
|
+
project-local install shortens these to `next-steps help`, `bunx next-steps help`,
|
|
42
|
+
or `pnpm exec next-steps help`:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm install --save-dev @wanbicoi/next-steps
|
|
46
|
+
bun add -d @wanbicoi/next-steps
|
|
47
|
+
pnpm add -D @wanbicoi/next-steps
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
From this repo (Bun):
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
bun install
|
|
54
|
+
bun src/cli.ts help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You can also use the package script: `bun run next-steps -- help`.
|
|
58
|
+
|
|
59
|
+
State is created on first use at `./.next-steps/state.db` (SQLite, gitignored).
|
|
60
|
+
There are no path flags: the tool uses the directory it is run from, so run it
|
|
61
|
+
from the project root. Workflow definitions are read from `./workflows/`.
|
|
62
|
+
|
|
63
|
+
This repo keeps its sample graphs under `test/fixtures/workflows/`. To try the
|
|
64
|
+
commands from the repo root:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
mkdir -p workflows && cp test/fixtures/workflows/*.json workflows/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Visualize workflows
|
|
71
|
+
|
|
72
|
+
`next-steps viz` serves an interactive Cytoscape viewer for the workflows in
|
|
73
|
+
`./workflows/`:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
next-steps viz # http://127.0.0.1:3000
|
|
77
|
+
next-steps viz --port 8080
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
From this repo, `bun src/cli.ts viz`. Press Ctrl+C to stop. The viewer shows
|
|
81
|
+
every graph with node/edge labels, conditions, and subgraph drill-down; edit
|
|
82
|
+
`viz/template.html` to change the styles.
|
|
83
|
+
|
|
84
|
+
## Commands
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
next-steps create --workflow <id> [--key <key>] [--json]
|
|
88
|
+
next-steps log --key <key> --node <node> [--json]
|
|
89
|
+
next-steps next --key <key> [--json]
|
|
90
|
+
next-steps steps --key <key> [--limit <n>] [--after <seq>] [--json]
|
|
91
|
+
next-steps keys [--workflow <id>] [--json]
|
|
92
|
+
next-steps reset --key <key> [--json]
|
|
93
|
+
|
|
94
|
+
next-steps workflow new <id> [--json]
|
|
95
|
+
next-steps workflow list [--json]
|
|
96
|
+
next-steps workflow show <id> [--json]
|
|
97
|
+
next-steps workflow check [id] [--json]
|
|
98
|
+
|
|
99
|
+
next-steps viz [--port <n>] [--json]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Pretty output is the default; `--json` is the stable, machine-readable form
|
|
103
|
+
documented in `docs/AGENTS.sample.md`.
|
|
104
|
+
|
|
105
|
+
`create` only opens a session (the key is the task id; a UUID is generated when
|
|
106
|
+
omitted). It does not author a workflow — use `workflow new` for that.
|
|
107
|
+
|
|
108
|
+
## Workflow format
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"id": "deploy",
|
|
113
|
+
"title": "Deploy a change",
|
|
114
|
+
"start": "build",
|
|
115
|
+
"nodes": [
|
|
116
|
+
{ "id": "build", "type": "node", "title": "Build", "description": "Run the build." },
|
|
117
|
+
{
|
|
118
|
+
"id": "review",
|
|
119
|
+
"type": "subgraph",
|
|
120
|
+
"workflow": "code-review",
|
|
121
|
+
"title": "Review",
|
|
122
|
+
"description": "Run the review workflow."
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"edges": [
|
|
126
|
+
{ "id": "e1", "from": "build", "to": "review", "description": "Build is green." },
|
|
127
|
+
{ "id": "e2", "from": "review", "to": "END", "description": "Review done." }
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- `start` names the first step.
|
|
133
|
+
- `END` is a reserved target, not a node. It means "this scope is finished".
|
|
134
|
+
- A conditional edge adds `"condition": "the tests failed"`. Conditions are prose
|
|
135
|
+
for the agent; nothing evaluates them. The edge the agent actually logged is
|
|
136
|
+
the audit trail.
|
|
137
|
+
- A `subgraph` node references another workflow by id. Entering it pushes a
|
|
138
|
+
scope; reaching `END` inside it pops back and continues at the node after the
|
|
139
|
+
subgraph.
|
|
140
|
+
- Every node needs an outgoing edge, every workflow needs an edge to `END`, and
|
|
141
|
+
a node whose only edge is `END` finishes its scope with no extra step.
|
|
142
|
+
- Duplicate `from -> to` pairs are rejected so edge inference is unambiguous.
|
|
143
|
+
|
|
144
|
+
Run `next-steps workflow check` after editing. It fails with exit 5 on structural
|
|
145
|
+
problems and warns about unreachable nodes.
|
|
146
|
+
|
|
147
|
+
## Exit codes
|
|
148
|
+
|
|
149
|
+
`0` ok · `2` usage / duplicate key / invalid key · `3` not found ·
|
|
150
|
+
`4` invalid transition or unknown node · `5` invalid workflow file.
|
|
151
|
+
|
|
152
|
+
Errors go to stderr. With `--json` they are
|
|
153
|
+
`{ "error": { "code", "message", "details" } }`, and `details.legal` lists the
|
|
154
|
+
steps the graph allows.
|
|
155
|
+
|
|
156
|
+
## Publish
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
npm login
|
|
160
|
+
npm publish
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`prepublishOnly` runs lint, typecheck, tests, and knip. `prepack` builds
|
|
164
|
+
`dist/cli.js` for Node with a `#!/usr/bin/env node` shebang; the tarball contains
|
|
165
|
+
`dist/`, `README.md`, and `LICENSE`.
|
|
166
|
+
|
|
167
|
+
Check the package before publishing:
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
npm pack --dry-run
|
|
171
|
+
npx --yes ./wanbicoi-next-steps-<version>.tgz --help
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Development
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
bun run lint:fix # Biome, formatting + safe fixes
|
|
178
|
+
bun test # graph, validation, CLI end-to-end
|
|
179
|
+
bun run typecheck
|
|
180
|
+
bun run knip # unused files, exports, dependencies
|
|
181
|
+
bun run build # dist/cli.js, Node target
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Hooks (Husky): `pre-commit` runs Biome on staged files, `commit-msg` runs
|
|
185
|
+
commitlint (conventional commits), `pre-push` runs typecheck, tests, and knip.
|
|
186
|
+
|
|
187
|
+
Layout:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
src/cli.ts argument parsing, dispatch, exit codes
|
|
191
|
+
src/format.ts pretty output
|
|
192
|
+
src/commands/ one function per command
|
|
193
|
+
src/workflow/ load, validate, pure graph logic
|
|
194
|
+
src/runs/ session service, store, Bun/Node SQLite driver
|
|
195
|
+
scripts/build.ts Node bundle + shebang for dist/cli.js
|
|
196
|
+
test/fixtures/workflows/ sample graphs (test fixtures)
|
|
197
|
+
test/ pure, validation, end-to-end
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`src/workflow/graph.ts` is pure: no I/O, no database, so the tricky scope logic
|
|
201
|
+
is testable in milliseconds. `RunStore` is an interface over `src/runs/driver.ts`,
|
|
202
|
+
which loads `bun:sqlite` under Bun and `node:sqlite` under Node.
|
|
203
|
+
|
|
204
|
+
`docs/initial-plan.md` records the design and the decisions behind it.
|