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
+37-23Lines changed: 37 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,14 +108,13 @@ Since state files are in the working tree, they get committed with normal `git a
108
108
- No special tooling needed to read/write state
109
109
- State merge conflicts are possible but manageable (JSON/MD files)
110
110
111
-
**3. `han parse` replacement**
111
+
**3. `han parse` replacement — `jq` + `yq` (Go)**
112
112
113
-
Replace `han parse` with lightweight alternatives:
114
-
-**JSON parsing:** Use `jq` (already used in `config.sh`) or a small built-in shell function
115
-
-**YAML parsing:** Use the existing `_yaml_get_simple` / `_yaml_get_array` functions from `dag.sh` (already working, no external dep)
116
-
-**YAML-to-JSON:** Use `python3 -c 'import yaml, json, sys; ...'` or `yq` as optional
117
-
-**JSON-set:** Use `jq` for JSON manipulation
118
-
-**YAML-set:** Use `sed` for simple frontmatter updates (already partially done in `dag.sh`)
113
+
Replace all `han parse` commands with:
114
+
-**JSON read/write:**`jq` (already used in `config.sh`)
115
+
-**YAML read/write:**`yq` (mikefarah/yq, Go version)
116
+
-**Frontmatter read/write:**`yq --front-matter=extract` / `yq --front-matter=process` — directly replaces `han parse yaml-set` for `unit-*.md` and `intent.md` files
117
+
-**YAML-to-JSON:**`yq -o=json`
119
118
120
119
### Dependency Management: `jq` and `yq` (Go)
121
120
@@ -126,22 +125,37 @@ The `han` CLI bundled both parsing utilities and state storage in one tool. Repl
126
125
127
126
**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
127
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
128
+
**Install check at plugin load time (SessionStart hook):**
129
+
130
+
Create `plugin/lib/deps.sh` sourced by `inject-context.sh` (and other hooks). Each hook calls `dlc_check_deps` early — replacing the current `command -v han` check.
131
+
132
+
On failure: **`exit 2` with install instructions on stderr**. In Claude Code hooks, `exit 0` means stdout gets injected as context; `exit 2` means stdout is discarded and only stderr is shown to the user. This is the correct way to signal a missing dependency without polluting Claude's context.
133
+
134
+
```bash
135
+
dlc_check_deps() {
136
+
local missing=()
137
+
command -v jq &>/dev/null || missing+=("jq")
138
+
139
+
ifcommand -v yq &>/dev/null;then
140
+
if! yq --version 2>&1| grep -q "mikefarah";then
141
+
echo"AI-DLC requires mikefarah/yq (Go), but kislyuk/yq (Python) is installed.">&2
0 commit comments