@heart-of-gold/toolkit 0.1.14 → 0.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heart-of-gold/toolkit",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "description": "Cross-platform installer for Heart of Gold skills — works with Codex, OpenCode, Pi, Claude Code, and more",
6
6
  "bin": {
@@ -9,6 +9,8 @@ Use this skill to hand a bounded task to Claude Code from the current harness, c
9
9
 
10
10
  This skill is task-based, not review-only. Use `plan` for safe read-only analysis, but use other permission modes when the task requires command execution or edits.
11
11
 
12
+ The canonical execution path is direct `claude` CLI usage, mirroring the `codex` skill's direct `codex exec` pattern. The bundled wrapper is optional and must not replace the direct path unless the user explicitly asks for it or you are debugging Claude Code invocation behavior itself.
13
+
12
14
  ## Available Models
13
15
 
14
16
  | Model | Best for |
@@ -37,11 +39,15 @@ Choose the permission mode based on what Claude Code needs to do:
37
39
  `plan` is not the general default for this skill. It is only the safe default for bounded read-only tasks.
38
40
 
39
41
  ## Running a Task
40
- 1. Ask the user which model alias to use (default: `sonnet`) and which permission mode to use when that choice materially affects behavior.
41
- 2. Decide whether Claude should receive the artifact directly or discover it itself:
42
+ 1. Always ask the user which model alias to use (default: `sonnet`) before running Claude Code, unless the user already specified the model.
43
+ 2. Ask for permission mode in the same prompt when the user did not specify it. Default to:
44
+ - `plan` for bounded read-only analysis
45
+ - `acceptEdits` for implementation or refactoring work
46
+ - `default` when Claude needs broader repo exploration without auto-edit authority
47
+ 3. Decide whether Claude should receive the artifact directly or discover it itself:
42
48
  - Pass diffs, logs, or file contents via stdin for safe read-only review
43
49
  - Let Claude inspect the working tree when the task requires tool use
44
- 3. Assemble the command with the appropriate options:
50
+ 4. Assemble the command with the appropriate options:
45
51
  - `-p, --print` for non-interactive output
46
52
  - `--output-format <text|json|stream-json>`
47
53
  - `--model <MODEL>`
@@ -52,17 +58,19 @@ Choose the permission mode based on what Claude Code needs to do:
52
58
  - `--add-dir <DIR>` when Claude must read outside the current working directory
53
59
  - `--name <NAME>` when you want a stable, human-readable session
54
60
  - `"your prompt here"` as the final positional argument
55
- 4. Prefer `--output-format text` for human-readable summaries and `--output-format json` for automation or machine parsing.
56
- 5. In headless automation, prefer explicit permissions:
61
+ 5. Prefer `--output-format text` for human-readable summaries and `--output-format json` for automation or machine parsing.
62
+ 6. In headless automation, prefer explicit permissions:
57
63
  - `plan` for provided artifacts
58
64
  - `acceptEdits` for edit-capable runs
59
65
  - `default` only when prompts are acceptable or when permissions are constrained with `--allowedTools`
60
- 6. Run the command, capture stdout/stderr, and summarize the outcome for the user.
66
+ 7. Run the command, capture stdout/stderr, and summarize the outcome for the user.
67
+ 8. If Claude Code does not actually return output, stop and report that failure. Do not substitute your own review or analysis and present it as if it came from Claude Code.
61
68
 
62
69
  ## Codex Execution
63
70
 
64
71
  When this skill is used from Codex, the skill cannot bypass Codex sandbox policy on its own. Instead, instruct Codex to choose the correct execution path:
65
72
 
73
+ - Prefer the direct `claude` command patterns in this skill. Do not silently substitute the bundled wrapper for the normal path just because it exists.
66
74
  - Run inside the sandbox first when the task is clearly local and read-only.
67
75
  - If Claude Code needs network access, auth refresh, access outside the writable sandbox, or the in-sandbox run fails or hangs for likely sandbox reasons, rerun via `exec_command` with `sandbox_permissions: "require_escalated"`.
68
76
  - Use a concise justification that tells the reviewer why Claude Code needs elevation, for example:
@@ -164,8 +172,15 @@ Use it as a thin helper around the documented CLI patterns above. It supports:
164
172
  - `--name`
165
173
  - `--no-session-persistence`
166
174
  - `--verbose`
175
+ - `--timeout-seconds`
176
+
177
+ Do not treat the wrapper as the default execution path for this skill. Use it only when:
178
+
179
+ - the user explicitly asks to use the wrapper
180
+ - you are debugging Claude Code hangs or invocation edge cases
181
+ - you need its optional timeout helper for diagnosis
167
182
 
168
- Prefer the direct `claude` commands in this document when debugging or when you need to reason about permissions precisely.
183
+ Otherwise, use the direct `claude` commands in this document.
169
184
 
170
185
  ## Following Up
171
186
 
@@ -199,8 +214,9 @@ claude -r latest -p \
199
214
  ## Error Handling
200
215
 
201
216
  - Stop and report failures whenever `claude --version` or a `claude -p` command exits non-zero.
217
+ - If Claude Code hangs or times out, report that Claude did not complete in this environment. Do not continue with a self-authored substitute while implying it came from Claude.
202
218
  - If Claude Code reports permission issues, choose the correct permission mode or constrain tools explicitly.
203
219
  - If a headless run gets stuck on permissions, either switch to `plan`, use `acceptEdits`, or provide `--allowedTools` / a permission prompt tool.
204
220
  - In Codex, if the likely cause is sandboxing or network denial, rerun with reviewer-approved `require_escalated` execution instead of repeatedly retrying the same sandboxed command.
205
221
  - Do not use `bypassPermissions` unless the user explicitly approves it.
206
- - If debugging a failing wrapper invocation, fall back to the direct `claude` command first.
222
+ - If the direct `claude` path fails, report that failure directly. Do not route around it by pretending a wrapper run or a self-authored review is equivalent to Claude output.
@@ -25,6 +25,7 @@ Options:
25
25
  --permission-prompt-tool CMD External permission handler for headless runs
26
26
  --no-session-persistence Do not persist the session on disk
27
27
  --verbose Enable verbose Claude Code output
28
+ --timeout-seconds N Kill Claude Code if it does not finish within N seconds
28
29
  --help Show this help text
29
30
  EOF
30
31
  }
@@ -43,6 +44,7 @@ name=""
43
44
  verbose=0
44
45
  no_session_persistence=0
45
46
  permission_prompt_tool=""
47
+ timeout_seconds=""
46
48
  declare -a add_dirs=()
47
49
  declare -a allowed_tools=()
48
50
  declare -a disallowed_tools=()
@@ -130,6 +132,11 @@ while [[ $# -gt 0 ]]; do
130
132
  verbose=1
131
133
  shift
132
134
  ;;
135
+ --timeout-seconds)
136
+ [[ $# -ge 2 ]] || { echo "Missing value for --timeout-seconds" >&2; exit 2; }
137
+ timeout_seconds="$2"
138
+ shift 2
139
+ ;;
133
140
  --help|-h)
134
141
  usage
135
142
  exit 0
@@ -218,4 +225,24 @@ if [[ -n "$cwd" ]]; then
218
225
  cd "$cwd"
219
226
  fi
220
227
 
221
- exec "${cmd[@]}"
228
+ if [[ -n "$timeout_seconds" ]]; then
229
+ python3 -c '
230
+ import os, signal, subprocess, sys
231
+ timeout = float(sys.argv[1])
232
+ cmd = sys.argv[2:]
233
+ proc = subprocess.Popen(cmd)
234
+ try:
235
+ rc = proc.wait(timeout=timeout)
236
+ sys.exit(rc)
237
+ except subprocess.TimeoutExpired:
238
+ proc.kill()
239
+ try:
240
+ proc.wait(timeout=5)
241
+ except subprocess.TimeoutExpired:
242
+ pass
243
+ print(f"Claude Code timed out after {timeout:g} seconds", file=sys.stderr)
244
+ sys.exit(124)
245
+ ' "$timeout_seconds" "${cmd[@]}"
246
+ else
247
+ exec "${cmd[@]}"
248
+ fi
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ import { targetsCommand } from "./commands/targets";
7
7
  const main = defineCommand({
8
8
  meta: {
9
9
  name: "heart-of-gold",
10
- version: "0.1.14",
10
+ version: "0.1.16",
11
11
  description:
12
12
  "Cross-platform installer for Heart of Gold skills — Codex, OpenCode, Pi, Claude Code, and more",
13
13
  },