@wanbicoi/next-steps 0.1.0 → 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/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # next-steps
2
2
 
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?**
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
6
 
7
7
  ```
8
- $ next-steps create --workflow feature-work
8
+ $ next-steps create
9
9
  session: 4f1c9b3e-9a02-4d1c-8e11-7c6b1f0a2d33
10
10
  workflow: feature-work Implement a feature end to end
11
11
  status: running
@@ -16,16 +16,18 @@ next:
16
16
 
17
17
  $ next-steps log --key 4f1c... --node read-issue
18
18
  logged: #1 read-issue (entry)
19
- scope: feature-work status: running
19
+ status: running
20
20
 
21
21
  next:
22
- 1. e1 -> implement Implement
22
+ 1. implement Implement [review]
23
23
  Criteria are understood.
24
24
  ```
25
25
 
26
26
  The point is not to constrain what the agent can think — it is to make the path
27
27
  it took readable afterwards, and to stop it from skipping work or losing its
28
- place.
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.
29
31
 
30
32
  ## Run it
31
33
 
@@ -57,44 +59,43 @@ bun src/cli.ts help
57
59
  You can also use the package script: `bun run next-steps -- help`.
58
60
 
59
61
  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
+ 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.
62
64
 
63
- This repo keeps its sample graphs under `test/fixtures/workflows/`. To try the
65
+ This repo keeps sample graphs under `test/fixtures/<id>/.next-steps/`. To try the
64
66
  commands from the repo root:
65
67
 
66
68
  ```sh
67
- mkdir -p workflows && cp test/fixtures/workflows/*.json workflows/
69
+ mkdir -p .next-steps && cp test/fixtures/feature-work/.next-steps/workflow.json .next-steps/
68
70
  ```
69
71
 
70
- ## Visualize workflows
72
+ ## Visualize the graph
71
73
 
72
- `next-steps viz` serves an interactive Cytoscape viewer for the workflows in
73
- `./workflows/`:
74
+ `next-steps viz` serves an interactive Cytoscape viewer for
75
+ `.next-steps/workflow.json`:
74
76
 
75
77
  ```sh
76
78
  next-steps viz # http://127.0.0.1:3000
77
79
  next-steps viz --port 8080
78
80
  ```
79
81
 
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.
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.
83
85
 
84
86
  ## Commands
85
87
 
86
88
  ```
87
- next-steps create --workflow <id> [--key <key>] [--json]
89
+ next-steps create [--key <key>] [--json]
88
90
  next-steps log --key <key> --node <node> [--json]
89
91
  next-steps next --key <key> [--json]
90
92
  next-steps steps --key <key> [--limit <n>] [--after <seq>] [--json]
91
- next-steps keys [--workflow <id>] [--json]
93
+ next-steps keys [--json]
92
94
  next-steps reset --key <key> [--json]
93
95
 
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]
96
+ next-steps workflow new [--json]
97
+ next-steps workflow show [--json]
98
+ next-steps workflow check [--json]
98
99
 
99
100
  next-steps viz [--port <n>] [--json]
100
101
  ```
@@ -103,7 +104,7 @@ Pretty output is the default; `--json` is the stable, machine-readable form
103
104
  documented in `docs/AGENTS.sample.md`.
104
105
 
105
106
  `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
+ omitted). It does not author the graph — use `workflow new` for that.
107
108
 
108
109
  ## Workflow format
109
110
 
@@ -113,36 +114,44 @@ omitted). It does not author a workflow — use `workflow new` for that.
113
114
  "title": "Deploy a change",
114
115
  "start": "build",
115
116
  "nodes": [
116
- { "id": "build", "type": "node", "title": "Build", "description": "Run the build." },
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
+ },
117
124
  {
118
125
  "id": "review",
119
- "type": "subgraph",
120
- "workflow": "code-review",
121
126
  "title": "Review",
122
- "description": "Run the review workflow."
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
+ ]
123
134
  }
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
135
  ]
129
136
  }
130
137
  ```
131
138
 
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.
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.
143
152
 
144
153
  Run `next-steps workflow check` after editing. It fails with exit 5 on structural
145
- problems and warns about unreachable nodes.
154
+ problems and warns about unreachable nodes or nodes that cannot reach `END`.
146
155
 
147
156
  ## Exit codes
148
157
 
@@ -151,7 +160,7 @@ problems and warns about unreachable nodes.
151
160
 
152
161
  Errors go to stderr. With `--json` they are
153
162
  `{ "error": { "code", "message", "details" } }`, and `details.legal` lists the
154
- steps the graph allows.
163
+ moves the graph allows.
155
164
 
156
165
  ## Publish
157
166
 
@@ -193,12 +202,14 @@ src/commands/ one function per command
193
202
  src/workflow/ load, validate, pure graph logic
194
203
  src/runs/ session service, store, Bun/Node SQLite driver
195
204
  scripts/build.ts Node bundle + shebang for dist/cli.js
196
- test/fixtures/workflows/ sample graphs (test fixtures)
205
+ test/fixtures/<id>/ sample graphs, each in its own .next-steps/ directory
197
206
  test/ pure, validation, end-to-end
198
207
  ```
199
208
 
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.
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.
203
214
 
204
- `docs/initial-plan.md` records the design and the decisions behind it.
215
+ `docs/initial-plan.md` records the original design and the decisions behind it.