@ethlete/agent-rules 0.1.0-next.43 → 0.1.0-next.45

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/AGENTS.md CHANGED
@@ -13,8 +13,8 @@ yarn agents:sync # then regenerate
13
13
  ```
14
14
 
15
15
  A few content files are vendored from another repository. Keep them as written upstream,
16
- apart from the generator's link syntax - `libs/agent-rules/THIRD-PARTY-LICENSES.md` names
17
- each one, its upstream commit and its license.
16
+ apart from the generator's link syntax and the local changes `libs/agent-rules/THIRD-PARTY-LICENSES.md`
17
+ names, with each file's upstream commit and its license.
18
18
 
19
19
  `content/output-styles/` is the exception: a Claude Code output style is a machine-level
20
20
  file, so `sync` never emits it and `agents:check` never diffs it. It is installed on
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @ethlete/agent-rules
2
2
 
3
+ ## 0.1.0-next.45
4
+
5
+ ### Minor Changes
6
+
7
+ - New opt-in `builder-idle-check` Stop hook: a builder session that ends a turn with nothing running while `plans/QUEUE.md` has open Builder rows is sent back to work, with those rows named.
8
+ - Restore the `away-mode` hook and the `awayMode` config key, including the report on return.
9
+
10
+ ### Patch Changes
11
+
12
+ - `agent-sessions run` and `restart` no longer refuse a command that sets CLAUDE_CONFIG_DIR when the caller is a human shell (no CLAUDECODE, no CLAUDE_CONFIG_DIR), so `claude2` starts from a plain terminal.
13
+ - `et design sketch check` warns when a state draws a title next to an `<img data-et-carries-title>`, a picture with the title baked in.
14
+ - `sync` registers the `design-live-check` hook in every repo with `.ethlete/design/config.json`, without the repo listing it in `hooks`. Before, no repo turned it on, so a design agent never got its live findings.
15
+ - `et design product new --colors` registers an error and a warning colour theme, so a danger button no longer falls back to the accent.
16
+ - `design sketch check` now also catches an element a variant draws in an existing part's root class or tag under another prefix (`<span class="tsh-badge">Serie</span>` for `et-badge`) as an inline rebuild, and checks only parts the drawing layer may embed.
17
+ - The sketch check fails a variant that draws an existing part inline (`<span>${FIXTURE.badge}</span>` beside the SDK badge) unless it embeds the part or the target states the difference.
18
+ - A parent sketch merge now also writes each approved sub-sketch's `shared/` and asset changes, and refuses when two of its sketches change the same file.
19
+ - A parent sketch merges together with its sub-sketches once every one is approved; until then each merge path refuses it.
20
+ - Picking another variant of a parent sketch now discards the sub-sketches it no longer marks, after a confirmation in `sketch pick` (`--discard-sub-sketches`) and in Studio.
21
+ - Marked sub-parts may differ between composition variants, a name match with an existing part needs `--not-rebuild-of` and a stated difference, a mark change reopens a ready sketch, and Studio shows the marks at the variant header.
22
+ - `et design studio open` keeps its request when Studio is not running and exits 3 (queued); Studio adds the checkout at its next start and drops requests older than 7 days or whose checkout lost its design config.
23
+ - `sketch check` warns when a state uses an `et-color--<name>` class that no foundation of the product defines, and names the defined ones, instead of letting it fall back to the accent silently.
24
+
25
+ ## 0.1.0-next.44
26
+
27
+ ### Minor Changes
28
+
29
+ - The `codex-subagent` skill and its wrapper now default to `gpt-6.2-sol`; `gpt-6.2-astra` is for the hardest work and needs the user's approval first.
30
+ - Add the opt-in `design-live-check` hook: after each write of a design file it runs `et design lint` on it and hands every finding back to the agent.
31
+ - Remove the `away-mode` and `builder-chat-words` hooks and the `awayMode` config key.
32
+ - Add `et design studio open [<dir>]`: it adds a checkout to the running Studio and switches Studio to it, after the agent asks the human.
33
+
34
+ ### Patch Changes
35
+
36
+ - The domain-modeling and grill-with-docs skills record a decision as a test or a tool, never as an ADR; `ADR-FORMAT.md` is gone.
37
+ - `agent-sessions run` called from an agent shell inside tmux now starts the session detached instead of switching the human's client to it.
38
+ - The design guidance keeps a variant note to two short sentences in the words of the screen, and lets the agent work only from its repo and what the user hands it, asking for missing images in one plain sentence.
39
+ - Teach a new product to start with one real screen in finished moods instead of a wireframe round, and add rules for looking at a shot before `ready`, talking about the product, hover and focus states, and the app shell.
40
+ - The design exploration guide draws interactions once, on the first grid row, and a content row only at rest with `interactionRows` `restOnly`.
41
+ - Reword the design skill so a mood round asks for comments, not a pick, and the first real page is drawn from them.
42
+ - Reword the design skill so the first sketch draws the shell as an imported element and interaction states live on the parts a page imports.
43
+ - Make the design check's FONT-FACE rule flag a font the design names but that did not load in the shot, and tell the agent to self-host it.
44
+ - `interactionRows` takes a plain row-name list as `restOnly` when it is called with explicit type arguments.
45
+ - The Studio logo part gets anatomy, clear space, minimum size, colour variants, misuse and motion sections and owns the busy animation; the design check reports a merged logo part that lacks one.
46
+ - Stop the design check's OVERFLOW rule from failing a page taller than its preset height, so a page can scroll.
47
+ - Drop the ADR plan-question open point and ADR numbers from design CLI texts and comments.
48
+ - `agent-sessions restart` refuses a stored command that does not run `claude` or `codex` instead of starting a bare shell, and a footer with only "↓ to manage" no longer counts as background work.
49
+ - The design-exploration skill says that the pick of another sketch is not a wait: a sketch draws with the part as merged now and goes ready, so the user can choose it.
50
+ - The design exploration skill says a composition's variants differ only in arrangement and how a sub-part from an open sketch is used.
51
+ - The Studio menu puts client runs in a submenu named by date and time, lists projects apart from the actions, opens the design server as a submenu and marks "Projekt entfernen" as dangerous; the Start page tells same-name checkouts apart.
52
+ - The design guide asks for states that read as different from rest at a glance, not a lift of a few px alone.
53
+
3
54
  ## 0.1.0-next.43
4
55
 
5
56
  ### Patch Changes
package/README.md CHANGED
@@ -312,14 +312,7 @@ per hook in the config:
312
312
 
313
313
  ```json
314
314
  {
315
- "hooks": [
316
- "context-warning",
317
- "subagent-model-policy",
318
- "background-design-commands",
319
- "git-safety",
320
- "builder-chat-words",
321
- "away-mode"
322
- ]
315
+ "hooks": ["context-warning", "subagent-model-policy", "background-design-commands", "git-safety", "away-mode"]
323
316
  }
324
317
  ```
325
318
 
@@ -381,6 +374,14 @@ Available hooks:
381
374
  user knows whether the task is judgment-heavy. A fork and an agent type whose own
382
375
  definition sets a model both pass untouched, because `model` would change nothing there.
383
376
 
377
+ - **`builder-idle-check`** (Claude Code only) - a `Stop` hook for the builder session (the
378
+ one that ran the `builder-agent` skill or `/handoff resume builder-...`). When a turn ends
379
+ with no subagent and no background command running - a CI watcher (`gh run watch`, a
380
+ `gh run view` poll loop) or a dev server does not count - while `plans/QUEUE.md` has open
381
+ rows owned by `Builder` without a wait reason, it blocks the stop and names those rows. A
382
+ row waits when its `Stand` cell contains "wartet auf" or "Offen nur:". It fires once per
383
+ idle stop chain (`stop_hook_active` passes).
384
+
384
385
  - **`away-mode`** (Claude Code only) - switches an interactive session into "user is away" mode
385
386
  on its own. Opt in with `"awayMode": { "skills": ["my-skill"], "thresholdMinutes": 15 }` in the
386
387
  config (the local config overrides it); a session is tracked once a prompt starts with
@@ -6,11 +6,11 @@ To update one, copy it again from upstream and record the new commit here.
6
6
  ## [mattpocock/skills](https://github.com/mattpocock/skills)
7
7
 
8
8
  Commit `3cca18b` (2026-09-04). Vendored skills, kept as written upstream apart from the
9
- generator's own link syntax:
9
+ generator's own link syntax and the local changes named below:
10
10
 
11
- - `content/skills/grill-with-docs` - the entry point; calls the other two.
11
+ - `content/skills/grill-with-docs` - the entry point; calls the other two. Its description names tests, not ADRs.
12
12
  - `content/skills/grilling` - plus our own section "Local addition" after the upstream footer.
13
- - `content/skills/domain-modeling`
13
+ - `content/skills/domain-modeling` - our change: a decision becomes a test or a tool, never an ADR; `ADR-FORMAT.md` is gone.
14
14
 
15
15
  MIT License
16
16
 
@@ -0,0 +1,253 @@
1
+ #!/usr/bin/env python3
2
+ """Stop hook: keep a builder session working while the queue has rows for it.
3
+
4
+ A builder session (one that ran the `builder-agent` skill, or `/handoff resume
5
+ builder-...`) must not end a turn idle. When a turn ends with no subagent and no
6
+ background command running - a CI watcher or a dev server does not count - and `plans/QUEUE.md`
7
+ has open rows owned by `Builder` without a wait reason, the stop is blocked and
8
+ the reason names those rows, so the turn goes on.
9
+
10
+ Running work comes from the transcript: every background Bash, Monitor and
11
+ async Agent start, minus every task-notification and every TaskStop for it. An
12
+ agent that "is waiting on its own background work" has handed back, so it counts as done.
13
+
14
+ A row waits when its `Stand` cell contains "wartet auf" or "Offen nur:"
15
+ (case-insensitive). Rows owned by anyone else are skipped.
16
+
17
+ Fires at most once per idle stop chain: a stop that a Stop hook already
18
+ continued (`stop_hook_active`) passes.
19
+
20
+ Can be disabled per machine via a gitignored ethlete-agents.config.local.json at
21
+ the repo root: {"disableHooks": true} or {"disableHooks": ["builder-idle-check"]}.
22
+
23
+ Fail-safe: any error exits 0 with no output.
24
+ """
25
+
26
+ import json
27
+ import os
28
+ import re
29
+ import sys
30
+ from datetime import datetime
31
+
32
+ HOOK_NAME = "builder-idle-check"
33
+ LOCAL_CONFIG_FILE = "ethlete-agents.config.local.json"
34
+ QUEUE_FILE = os.path.join("plans", "QUEUE.md")
35
+ QUEUE_OWNER = "Builder"
36
+ WAIT_MARKERS = ("wartet auf", "offen nur:")
37
+
38
+ BUILDER_LAUNCH = re.compile(
39
+ r"Base directory for this skill: \S*/skills/builder-agent\b"
40
+ r"|<command-name>/builder-agent</command-name>"
41
+ r"|<command-args>\s*resume\s+builder\b"
42
+ )
43
+ OTHER_ROLE_LAUNCH = re.compile(
44
+ r"Base directory for this skill: \S*/skills/doc-agent\b"
45
+ r"|<command-name>/doc-agent</command-name>"
46
+ r"|<command-args>\s*resume\s+doc\b"
47
+ )
48
+ WATCHER_COMMAND = re.compile(
49
+ r"\bgh\s+run\s+watch\b"
50
+ r"|\bgh\s+pr\s+checks\b[^\n]*--watch\b"
51
+ r"|\bglab\s+ci\s+(?:status|view)\b[^\n]*--live\b"
52
+ )
53
+ SERVER_COMMAND = re.compile(
54
+ r"\b(?:npm|yarn)\s+(?:run\s+)?(?:storybook|serve|start|dev)\b"
55
+ r"|\bnx\s+(?:serve\b|run\s+\S+:(?:serve|storybook)\b)"
56
+ r"|\bstorybook\s+dev\b"
57
+ )
58
+ CI_POLL = re.compile(r"\b(?:gh\s+run\s+(?:view|list)|glab\s+ci\s+(?:status|list|get))\b")
59
+ LOOP = re.compile(r"\b(?:while|until|for)\b")
60
+ NOTIFICATION = re.compile(r"<task-notification>(.*?)</task-notification>", re.S)
61
+ NOTIFICATION_IDS = re.compile(r"<(?:task-id|tool-use-id)>([^<]+)</(?:task-id|tool-use-id)>")
62
+ LINE_HINTS = ("tool_use", "task-notification", "builder", "doc-agent", "resume")
63
+
64
+
65
+ def repo_root(data):
66
+ value = os.environ.get("CLAUDE_PROJECT_DIR")
67
+ if value:
68
+ return value
69
+ cwd = data.get("cwd")
70
+ return cwd if isinstance(cwd, str) and cwd else os.getcwd()
71
+
72
+
73
+ def disabled_locally(root):
74
+ try:
75
+ with open(os.path.join(root, LOCAL_CONFIG_FILE), encoding="utf-8") as f:
76
+ config = json.load(f)
77
+ except (OSError, ValueError):
78
+ return False
79
+ disabled = config.get("disableHooks") if isinstance(config, dict) else None
80
+ return disabled is True or (isinstance(disabled, list) and HOOK_NAME in disabled)
81
+
82
+
83
+ def is_watcher(command):
84
+ if WATCHER_COMMAND.search(command) or SERVER_COMMAND.search(command):
85
+ return True
86
+ return bool(CI_POLL.search(command) and LOOP.search(command) and "sleep" in command)
87
+
88
+
89
+ def parse_time(value):
90
+ try:
91
+ return datetime.fromisoformat(value.replace("Z", "+00:00")).timestamp()
92
+ except (AttributeError, ValueError):
93
+ return None
94
+
95
+
96
+ def texts_of(content):
97
+ if isinstance(content, str):
98
+ return [content]
99
+ if isinstance(content, list):
100
+ return [item.get("text", "") for item in content if isinstance(item, dict) and item.get("type") == "text"]
101
+ return []
102
+
103
+
104
+ def read_transcript(path):
105
+ state = {"builder": False, "tool_uses": {}, "tasks": {}, "done": set(), "now": None}
106
+ with open(path, encoding="utf-8") as f:
107
+ for raw in f:
108
+ if not any(hint in raw for hint in LINE_HINTS):
109
+ continue
110
+ for chunk in NOTIFICATION.findall(raw.replace("\\n", "\n")):
111
+ state["done"].update(NOTIFICATION_IDS.findall(chunk))
112
+ try:
113
+ line = json.loads(raw)
114
+ except ValueError:
115
+ continue
116
+ if not isinstance(line, dict) or line.get("isSidechain") or line.get("type") not in ("user", "assistant"):
117
+ continue
118
+ state["now"] = parse_time(line.get("timestamp")) or state["now"]
119
+ message = line.get("message") or {}
120
+ content = message.get("content")
121
+ if line["type"] == "user":
122
+ read_user_line(state, line, content)
123
+ else:
124
+ read_assistant_line(state, content)
125
+ return state
126
+
127
+
128
+ def read_user_line(state, line, content):
129
+ for text in texts_of(content):
130
+ if BUILDER_LAUNCH.search(text):
131
+ state["builder"] = True
132
+ elif OTHER_ROLE_LAUNCH.search(text):
133
+ state["builder"] = False
134
+ if not isinstance(content, list):
135
+ return
136
+ result = line.get("toolUseResult")
137
+ if not isinstance(result, dict):
138
+ return
139
+ for item in content:
140
+ if not isinstance(item, dict) or item.get("type") != "tool_result":
141
+ continue
142
+ use = state["tool_uses"].get(item.get("tool_use_id"))
143
+ if not use:
144
+ continue
145
+ name, tool_input = use
146
+ task_id = result.get("backgroundTaskId") or result.get("taskId")
147
+ if task_id and name in ("Bash", "Monitor"):
148
+ started = parse_time(line.get("timestamp"))
149
+ timeout = result.get("timeoutMs")
150
+ state["tasks"][task_id] = {
151
+ "kind": "command",
152
+ "tool_use_id": item.get("tool_use_id"),
153
+ "label": tool_input.get("description") or tool_input.get("command", "")[:80],
154
+ "watcher": is_watcher(tool_input.get("command", "")),
155
+ "ends": started + timeout / 1000 if started and isinstance(timeout, (int, float)) else None,
156
+ }
157
+ elif result.get("agentId") and (result.get("isAsync") or result.get("status") == "async_launched"):
158
+ state["tasks"][result["agentId"]] = {
159
+ "kind": "agent",
160
+ "tool_use_id": item.get("tool_use_id"),
161
+ "label": tool_input.get("description", ""),
162
+ "watcher": False,
163
+ "ends": None,
164
+ }
165
+
166
+
167
+ def read_assistant_line(state, content):
168
+ if not isinstance(content, list):
169
+ return
170
+ for item in content:
171
+ if not isinstance(item, dict) or item.get("type") != "tool_use":
172
+ continue
173
+ tool_input = item.get("input") if isinstance(item.get("input"), dict) else {}
174
+ state["tool_uses"][item.get("id")] = (item.get("name"), tool_input)
175
+ if item.get("name") == "Skill" and tool_input.get("skill") == "builder-agent":
176
+ state["builder"] = True
177
+ elif item.get("name") == "Skill" and tool_input.get("skill") == "doc-agent":
178
+ state["builder"] = False
179
+ elif item.get("name") == "TaskStop":
180
+ state["done"].update(str(tool_input.get(key)) for key in ("task_id", "shell_id") if tool_input.get(key))
181
+
182
+
183
+ def running_tasks(state):
184
+ now = state["now"]
185
+ return [
186
+ task
187
+ for task_id, task in state["tasks"].items()
188
+ if task_id not in state["done"]
189
+ and task["tool_use_id"] not in state["done"]
190
+ and not (task["ends"] and now and now >= task["ends"])
191
+ ]
192
+
193
+
194
+ def waits(stand):
195
+ lowered = stand.lower()
196
+ return any(marker in lowered for marker in WAIT_MARKERS)
197
+
198
+
199
+ def open_builder_rows(queue_text):
200
+ rows = []
201
+ stand_index = None
202
+ for raw in queue_text.splitlines():
203
+ if not raw.startswith("|"):
204
+ continue
205
+ cells = [cell.strip() for cell in raw.strip().strip("|").split("|")]
206
+ if cells and cells[0] == "ID":
207
+ stand_index = cells.index("Stand") if "Stand" in cells else None
208
+ continue
209
+ if stand_index is None or len(cells) <= stand_index or not re.fullmatch(r"[A-Z]+\d+", cells[0]):
210
+ continue
211
+ if cells[-1] == QUEUE_OWNER and not waits(cells[stand_index]):
212
+ rows.append(f"{cells[0]} ({cells[1]})")
213
+ return rows
214
+
215
+
216
+ def reason_for(rows, watchers):
217
+ watching = f" (still watching: {', '.join(watchers)})" if watchers else ""
218
+ return (
219
+ f"[{HOOK_NAME} hook] This turn ends with no subagent and no background command running apart from CI watchers and dev servers{watching}, "
220
+ f"while plans/QUEUE.md has open Builder rows without a wait reason: {', '.join(rows)}. "
221
+ "Do not wait idle: take the first of them now, or start a subagent on it. "
222
+ 'A row waits when its Stand cell contains "wartet auf" or "Offen nur:"; if a row really waits, '
223
+ "write the reason into its Stand cell. This hook fires once per idle stop."
224
+ )
225
+
226
+
227
+ def main():
228
+ try:
229
+ data = json.load(sys.stdin)
230
+ if not isinstance(data, dict) or data.get("stop_hook_active"):
231
+ return
232
+ root = repo_root(data)
233
+ transcript_path = data.get("transcript_path")
234
+ if disabled_locally(root) or not isinstance(transcript_path, str):
235
+ return
236
+ state = read_transcript(transcript_path)
237
+ if not state["builder"]:
238
+ return
239
+ running = running_tasks(state)
240
+ if any(not task["watcher"] for task in running):
241
+ return
242
+ with open(os.path.join(root, QUEUE_FILE), encoding="utf-8") as f:
243
+ rows = open_builder_rows(f.read())
244
+ if not rows:
245
+ return
246
+ watchers = [task["label"] for task in running]
247
+ print(json.dumps({"decision": "block", "reason": reason_for(rows, watchers)}))
248
+ except Exception:
249
+ return
250
+
251
+
252
+ if __name__ == "__main__":
253
+ main()
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env python3
2
+ """PostToolUse hook: each design file the agent writes gets the design check's findings at once.
3
+
4
+ After an Edit, Write or MultiEdit of a `.ts`, `.css` or `.html` file under `.ethlete/design/`, it runs
5
+ `et design lint <file>`: the static design rules of the file's part or sketch variant, and eslint on it.
6
+ No draw, no type check. A finding comes back to the agent as a blocking message, one line each, so it fixes
7
+ the file before it hands the design to a human. A clean file stays silent.
8
+
9
+ It runs `et` the way the repo's `ethlete-design` MCP server in `.mcp.json` does, with `lint` in place
10
+ of `mcp`, else `node_modules/.bin/et`. A repo with neither gets no check.
11
+
12
+ Can be disabled per machine via a gitignored ethlete-agents.config.local.json at the repo
13
+ root: {"disableHooks": true} or {"disableHooks": ["design-live-check"]}.
14
+
15
+ Fail-safe: any error exits 0 with no output.
16
+ """
17
+
18
+ import json
19
+ import os
20
+ import subprocess
21
+ import sys
22
+
23
+ HOOK_NAME = "design-live-check"
24
+ LOCAL_CONFIG_FILE = "ethlete-agents.config.local.json"
25
+ TOOLS = frozenset(("Edit", "Write", "MultiEdit"))
26
+ DESIGN_DIR = os.path.join(".ethlete", "design")
27
+ CHECKED_EXTENSIONS = (".ts", ".mts", ".css", ".html")
28
+ RUN_SECONDS = 50
29
+
30
+
31
+ def agent_name(argv):
32
+ for index, arg in enumerate(argv):
33
+ if arg == "--agent" and index + 1 < len(argv):
34
+ return argv[index + 1]
35
+ if arg.startswith("--agent="):
36
+ return arg.split("=", 1)[1]
37
+ return "claude"
38
+
39
+
40
+ def repo_root(data):
41
+ for variable in ("CLAUDE_PROJECT_DIR", "CODEX_PROJECT_DIR"):
42
+ value = os.environ.get(variable)
43
+ if value:
44
+ return value
45
+ cwd = data.get("cwd")
46
+ return cwd if isinstance(cwd, str) and cwd else os.getcwd()
47
+
48
+
49
+ def load_json(path):
50
+ try:
51
+ with open(path, encoding="utf-8") as f:
52
+ value = json.load(f)
53
+ except (OSError, ValueError):
54
+ return {}
55
+ return value if isinstance(value, dict) else {}
56
+
57
+
58
+ def disabled_locally(root):
59
+ disabled = load_json(os.path.join(root, LOCAL_CONFIG_FILE)).get("disableHooks")
60
+ return disabled is True or (isinstance(disabled, list) and HOOK_NAME in disabled)
61
+
62
+
63
+ def design_file_of(root, path):
64
+ if not isinstance(path, str) or not path.endswith(CHECKED_EXTENSIONS):
65
+ return None
66
+ file = os.path.normpath(os.path.join(root, path))
67
+ relative = os.path.relpath(file, root)
68
+ if relative.startswith("..") or not relative.startswith(DESIGN_DIR + os.sep):
69
+ return None
70
+ return file if os.path.isfile(file) else None
71
+
72
+
73
+ def lint_command_of(root):
74
+ servers = load_json(os.path.join(root, ".mcp.json")).get("mcpServers", {})
75
+ design = servers.get("ethlete-design") if isinstance(servers, dict) else None
76
+ if isinstance(design, dict) and isinstance(design.get("command"), str):
77
+ args = design.get("args") if isinstance(design.get("args"), list) else []
78
+ words = [design["command"], *[str(arg) for arg in args]]
79
+ if words[-1] == "mcp":
80
+ return [*words[:-1], "lint"]
81
+ local = os.path.join(root, "node_modules", ".bin", "et")
82
+ return [local, "design", "lint"] if os.path.isfile(local) else None
83
+
84
+
85
+ def message_of(relative, findings):
86
+ return (
87
+ f"The design check finds this in {relative}. Fix each finding now, before you hand the design back; "
88
+ "every line says what to change:\n" + findings
89
+ )
90
+
91
+
92
+ def main():
93
+ if agent_name(sys.argv[1:]) != "claude":
94
+ return
95
+
96
+ data = json.load(sys.stdin)
97
+
98
+ if data.get("tool_name") not in TOOLS:
99
+ return
100
+
101
+ tool_input = data.get("tool_input")
102
+ root = repo_root(data)
103
+
104
+ if not isinstance(tool_input, dict) or disabled_locally(root):
105
+ return
106
+
107
+ file = design_file_of(root, tool_input.get("file_path"))
108
+ command = lint_command_of(root) if file else None
109
+
110
+ if not command:
111
+ return
112
+
113
+ run = subprocess.run(
114
+ [*command, file],
115
+ cwd=root,
116
+ capture_output=True,
117
+ text=True,
118
+ timeout=RUN_SECONDS,
119
+ )
120
+ findings = run.stdout.strip()
121
+
122
+ if run.returncode != 1 or not findings:
123
+ return
124
+
125
+ sys.stderr.write(message_of(os.path.relpath(file, root), findings) + "\n")
126
+ sys.exit(2)
127
+
128
+
129
+ if __name__ == "__main__":
130
+ try:
131
+ main()
132
+ except SystemExit:
133
+ raise
134
+ except Exception:
135
+ pass
136
+ sys.exit(0)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "e2e-progress",
3
- "version": "0.1.0-next.43",
3
+ "version": "0.1.0-next.45",
4
4
  "description": "Live Playwright e2e progress from a run log, as a status line entry and a pane",
5
5
  "types": "./types/index.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "status-line",
3
- "version": "0.1.0-next.43",
3
+ "version": "0.1.0-next.45",
4
4
  "description": "Always-visible band with the running task, its duration, the open queue, open questions and a CI blocked mark",
5
5
  "types": "./types/index.d.ts"
6
6
  }
@@ -218,7 +218,9 @@ const ENV_WORD = /^[A-Za-z_][A-Za-z0-9_]*=/;
218
218
  const CONFIG_WORD = 'CLAUDE_CONFIG_DIR=';
219
219
  const callerConfigDir = () => resolve(process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude'));
220
220
  const configDirOf = (words) => words.find((word) => word.startsWith(CONFIG_WORD))?.slice(CONFIG_WORD.length);
221
+ const callerIsAgent = () => Boolean(process.env.CLAUDECODE || process.env.CLAUDE_CONFIG_DIR);
221
222
  const configMismatch = (words) => {
223
+ if (!callerIsAgent()) return false;
222
224
  const given = configDirOf(words);
223
225
  return given !== undefined && resolve(given) !== callerConfigDir();
224
226
  };
@@ -238,6 +240,22 @@ const hasAgentBinary = (words) => {
238
240
  index++;
239
241
  return index < words.length;
240
242
  };
243
+ const AGENT_PROGRAM = /^(?:claude|codex)$/;
244
+ const programIndexOf = (words) => {
245
+ let index = 0;
246
+ while (
247
+ index < words.length &&
248
+ (ENV_WORD.test(words[index]) ||
249
+ words[index] === 'env' ||
250
+ (index > 0 && words.includes('env') && words[index].startsWith('-')))
251
+ )
252
+ index++;
253
+ return index;
254
+ };
255
+ const runsAgentProgram = (words) => {
256
+ const index = programIndexOf(words);
257
+ return index < words.length && AGENT_PROGRAM.test(basename(words[index]));
258
+ };
241
259
  const quoteShellWord = (word) =>
242
260
  ENV_WORD.test(word) ? word.replace(/^([^=]+=)(.*)$/s, (_, key, value) => `${key}${quote(value)}`) : quote(word);
243
261
  const unwrappedRun = (command) => {
@@ -254,20 +272,12 @@ const unwrappedRun = (command) => {
254
272
  const end = rest.findIndex((word) => /[;&|]$/.test(word));
255
273
  const inner = end < 0 ? rest : [...rest.slice(0, end), rest[end].replace(/[;&|]+$/, '')];
256
274
  const program = inner.findIndex((word) => !ENV_WORD.test(word));
257
- if (program < 0 || !hasAgentBinary(inner)) return null;
275
+ if (program < 0 || !runsAgentProgram(inner)) return null;
258
276
  const kept = [...inner.slice(0, program), ...withoutPrompt(inner.slice(program))];
259
277
  const env = tokens.slice(0, at).filter((word) => ENV_WORD.test(word));
260
278
  const unwrapped = [...env, ...kept.map(quoteShellWord)].join(' ');
261
279
  return runRole ? commandWithRole(unwrapped, runRole) : unwrapped;
262
280
  };
263
- const healedCommand = (command, agent) => {
264
- const unwrapped = unwrappedRun(command);
265
- if (unwrapped) return unwrapped;
266
- const words = [...command.matchAll(SHELL_WORD)].map(([word]) => unquoteWord(word));
267
- if (hasAgentBinary(words)) return command;
268
- const binary = agent.match(/^(claude|codex)/)?.[1];
269
- return binary ? `${command} ${quote(binary)}` : null;
270
- };
271
281
  const SHELL_WRAP =
272
282
  /^((?:[A-Za-z_][A-Za-z0-9_]*=(?:'[^']*'|\S*)\s+)*)'?((?:\S*\/)?(?:sh|bash|zsh|dash))'?\s+'?(-[a-z]*c)'?\s+(.+)$/s;
273
283
  const wrapOf = (command) => {
@@ -279,6 +289,17 @@ const wrapOf = (command) => {
279
289
  const inner = single ? single[1].replaceAll("'\\''", "'") : double ? double[1].replace(/\\(["\\$`])/g, '$1') : rest;
280
290
  return { head, shell, flag, inner };
281
291
  };
292
+ const wordsOf = (command) => [...command.matchAll(SHELL_WORD)].map(([word]) => unquoteWord(word));
293
+ const healedCommand = (command, agent) => {
294
+ const unwrapped = unwrappedRun(command);
295
+ if (unwrapped) return unwrapped;
296
+ const wrap = wrapOf(command);
297
+ if (wrap) return runsAgentProgram(wordsOf(wrap.inner)) ? command : null;
298
+ const words = wordsOf(command);
299
+ if (programIndexOf(words) < words.length) return runsAgentProgram(words) ? command : null;
300
+ const binary = agent.match(/^(claude|codex)/)?.[1];
301
+ return binary ? `${command} ${quote(binary)}` : null;
302
+ };
282
303
  const rewrapped = (wrap, head, inner) => `${head}${wrap.shell} ${wrap.flag} ${quote(inner)}`;
283
304
  const commandWithoutPrompt = (command) => {
284
305
  const wrap = wrapOf(command);
@@ -485,7 +506,7 @@ const inAgentScopeCommand = (command, session, unscoped = (plain) => plain) => {
485
506
  };
486
507
  const EXIT_DIALOG_JOBS = /will stop when you exit/i;
487
508
  const EXIT_AND_STOP = /exit and stop/i;
488
- const BACKGROUND_FOOTER = /\b\d+ (?:shells?|agents?)\b|↓ to manage/i;
509
+ const BACKGROUND_FOOTER = /\b\d+ (?:shells?|agents?)\b/i;
489
510
 
490
511
  /**
491
512
  * Reads the last prompt line (`❯` for Claude Code, `›` for Codex) of the pane. Dim text is the empty
@@ -829,13 +850,9 @@ if (command === 'send' && sender) {
829
850
  );
830
851
  process.exitCode = 1;
831
852
  } else createRunSession(session, shellCommand, baseCommand);
832
- const callerSession = tmux(
833
- 'display-message',
834
- '-p',
835
- '-t',
836
- process.env.TMUX_PANE ?? '',
837
- '#{session_id}',
838
- ).stdout.trim();
853
+ const callerSession = hasTerminal
854
+ ? tmux('display-message', '-p', '-t', process.env.TMUX_PANE ?? '', '#{session_id}').stdout.trim()
855
+ : '';
839
856
  const [callerClient] = callerSession
840
857
  ? tmux('list-clients', '-t', callerSession, '-F', '#{client_tty}').stdout.split('\n').filter(Boolean)
841
858
  : [];
@@ -949,7 +966,7 @@ if (command === 'send' && sender) {
949
966
  healedCommand(commandWithoutPrompt(agentCommandOf(session)), sender) === null
950
967
  ) {
951
968
  process.stderr.write(
952
- `Refused: the stored command of ${session} has no agent program (${agentCommandOf(session)}), restarting would end the session. Nothing was stopped.\n`,
969
+ `Refused: the stored command of ${session} has no claude or codex program (${agentCommandOf(session)}), restarting would end the session. Nothing was stopped.\n`,
953
970
  );
954
971
  restartLog(`${session} refused, stored command has no agent program: ${agentCommandOf(session)}`);
955
972
  process.exitCode = 1;
@@ -979,6 +996,10 @@ if (command === 'send' && sender) {
979
996
  const restartRole = restartRoleOf(session, words.join(' '));
980
997
  const recorded = commandWithoutPrompt(agentCommandOf(session));
981
998
  const stored = healedCommand(recorded, sender);
999
+ if (stored === null) {
1000
+ restartNotice(`restart of ${session} refused, its stored command has no agent program: ${recorded}`);
1001
+ process.exit(1);
1002
+ }
982
1003
  if (configMismatch(stored.split(' ').map((word) => word.replaceAll("'", '')))) {
983
1004
  restartNotice(
984
1005
  `restart of ${session} refused, its command sets another CLAUDE_CONFIG_DIR than the caller (${callerConfigDir()})`,