You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .ai-dlc/remove-hankeep-improve-state/intent.md
+65-12Lines changed: 65 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,12 +117,40 @@ Replace `han parse` with lightweight alternatives:
117
117
-**JSON-set:** Use `jq` for JSON manipulation
118
118
-**YAML-set:** Use `sed` for simple frontmatter updates (already partially done in `dag.sh`)
119
119
120
+
### Dependency Management: `jq` and `yq` (Go)
121
+
122
+
The `han` CLI bundled both parsing utilities and state storage in one tool. Replacing it means the plugin now depends on two standard CLI tools:
123
+
124
+
-**`jq`** (v1.7+) — JSON parsing and manipulation
125
+
-**`yq`** (mikefarah/yq, Go version, v4+) — YAML parsing with native `--front-matter` support
126
+
127
+
**Why Go `yq` specifically:** The Go version (`mikefarah/yq`) has a `--front-matter` flag that can extract/modify YAML frontmatter from markdown files directly — exactly what `han parse yaml-set` did for `unit-*.md` and `intent.md` files. The Python `yq` (kislyuk/yq) is just a jq wrapper and lacks this.
128
+
129
+
**Install check at plugin load time:**
130
+
131
+
Create `plugin/lib/deps.sh` that runs during plugin initialization (e.g., from `inject-context.sh`) and:
132
+
133
+
1. Checks for `jq` and `yq` (Go variant) in `$PATH`
134
+
2. Validates the `yq` variant is mikefarah's (via `yq --version` output containing `mikefarah`)
135
+
3. If missing, emits a clear error message with install instructions:
136
+
```
137
+
AI-DLC requires jq and yq (mikefarah/yq). Missing: yq
138
+
Install with:
139
+
brew install yq # macOS
140
+
sudo snap install yq # Ubuntu/Debian
141
+
go install github.com/mikefarah/yq/v4@latest # Go
142
+
choco install yq # Windows
143
+
```
144
+
4. Optionally: if running in a CI/cloud environment (detected via `CI=true` or similar), auto-install via the appropriate package manager
145
+
146
+
This replaces the implicit `han` dependency with explicit, well-known tools that most developers already have.
147
+
120
148
### State Management Helper Library
121
149
122
150
Create a new `plugin/lib/state.sh` that provides a clean API matching the current `han keep` interface but using files:
123
151
124
152
```bash
125
-
# Save state (writes file, auto-commits if in git)
### Unit 1: Create `deps.sh` — Dependency Check & Install
273
+
Build `plugin/lib/deps.sh` that validates `jq` (v1.7+) and `yq` (mikefarah/yq v4+) are installed. Provide clear install instructions per platform. Detect wrong `yq` variant (kislyuk vs mikefarah). Run at plugin initialization.
274
+
275
+
### Unit 2: Create `state.sh` Library
223
276
Build `plugin/lib/state.sh` with file-based state management functions that mirror `han keep` semantics but use `.ai-dlc/{slug}/state/` files.
224
277
225
-
### Unit 2: Create `parse.sh` Library
226
-
Build `plugin/lib/parse.sh` with JSON/YAML parsing utilities that replace `han parse` using `jq`, `sed`, and existing `_yaml_get_simple` patterns.
278
+
### Unit 3: Create `parse.sh` Library
279
+
Build `plugin/lib/parse.sh` with JSON/YAML parsing utilities that replace `han parse` using `jq` and `yq` (mikefarah/Go). Include frontmatter operations using `yq --front-matter`.
227
280
228
-
### Unit 3: Migrate Hooks
281
+
### Unit 4: Migrate Hooks
229
282
Update `inject-context.sh`, `enforce-iteration.sh`, and `subagent-context.sh` to use `state.sh` and `parse.sh` instead of `han keep` and `han parse`.
230
283
231
-
### Unit 4: Migrate Skills
232
-
Update all 10 skills that use `han keep` (advance, blockers, completion-criteria, construct, elaborate, execute, fail, operate, reflect, refine, reset, resume) to use the new libraries.
284
+
### Unit 5: Migrate Skills
285
+
Update all skills that use `han keep` (advance, blockers, completion-criteria, construct, elaborate, execute, fail, operate, reflect, refine, reset, resume) to use the new libraries.
233
286
234
-
### Unit 5: Migrate Hat Documentation
287
+
### Unit 6: Migrate Hat Documentation
235
288
Update references in hat markdown files (builder, experimenter, observer, planner, red-team).
236
289
237
-
### Unit 6: Migrate Config Libraries
290
+
### Unit 7: Migrate Config Libraries
238
291
Update `config.sh` and `config.ts` to remove `han keep`/`han parse` dependencies.
0 commit comments