Skip to content

Commit 7fd155d

Browse files
fix(skills): make pre-resolution commands shell-portable so skills load under PowerShell (#1078)
1 parent 415b472 commit 7fd155d

9 files changed

Lines changed: 74 additions & 76 deletions

File tree

skills/ce-brainstorm/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ Do not proceed until you have a feature description from the user.
5959
Determine `OUTPUT_FORMAT` before any other phase fires. Output mode is **exclusive** — the requirements-only unified plan is written as either markdown (`.md`) OR HTML (`.html`), never both. Precedence: in-prompt request > user-stated preference > config > default (`md`), with a hard pipeline-mode override.
6060

6161
**Read config.** The repo root is pre-resolved at skill load:
62-
!`git rev-parse --show-toplevel 2>/dev/null || true`
62+
!`git rev-parse --show-toplevel`
6363

64-
If the line above is an absolute path, use it as `<repo-root>`. If it is empty or still shows a backtick command string (a non-Claude harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
64+
If the line above is an absolute path, use it as `<repo-root>`. If it is empty, shows an error, or still shows a backtick command string (a harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
6565

6666
Resolution steps:
6767

skills/ce-commit-push-pr/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ argument-hint: "[PR ref] [mode:pipeline] [archive:on|off]"
3333
!`git log --oneline -10`
3434

3535
**Remote default branch:**
36-
!`git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo 'DEFAULT_BRANCH_UNRESOLVED'`
36+
!`git rev-parse --abbrev-ref origin/HEAD`
3737

3838
**Existing PR check:**
39-
!`gh pr view --json url,title,body,state 2>/dev/null || echo 'NO_OPEN_PR'`
39+
!`gh pr view --json url,title,body,state`
4040

4141
**Repo root (pre-resolved):**
42-
!`git rev-parse --show-toplevel 2>/dev/null || true`
42+
!`git rev-parse --show-toplevel`
4343

4444
### Context fallback
4545

@@ -51,7 +51,7 @@ printf '=== STATUS ===\n'; git status; printf '\n=== DIFF ===\n'; git diff HEAD;
5151

5252
## Step 1: Resolve branch and PR state
5353

54-
The remote default branch returns something like `origin/main`; strip the `origin/` prefix. If it returned `DEFAULT_BRANCH_UNRESOLVED` or bare `HEAD`, try `gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'`. If both fail, fall back to `main`.
54+
The remote default branch returns something like `origin/main`; strip the `origin/` prefix. If it returned `DEFAULT_BRANCH_UNRESOLVED`, an error, or bare `HEAD`, try `gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'`. If both fail, fall back to `main`. An error from the existing-PR check means no open PR was found (or `gh` is unavailable) — treat it as `NO_OPEN_PR`.
5555

5656
Branch routing:
5757

skills/ce-commit/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Create a single, well-crafted git commit from the current working tree changes.
2626
!`git log --oneline -10`
2727

2828
**Remote default branch:**
29-
!`git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo '__DEFAULT_BRANCH_UNRESOLVED__'`
29+
!`git rev-parse --abbrev-ref origin/HEAD`
3030

3131
### Context fallback
3232

@@ -46,7 +46,7 @@ printf '=== STATUS ===\n'; git status; printf '\n=== DIFF ===\n'; git diff HEAD;
4646

4747
Use the context above (git status, working tree diff, current branch, recent commits, remote default branch). All data needed for this step is already available -- do not re-run those commands.
4848

49-
The remote default branch value returns something like `origin/main`. Strip the `origin/` prefix to get the branch name. If it returned `__DEFAULT_BRANCH_UNRESOLVED__` or a bare `HEAD`, try:
49+
The remote default branch value returns something like `origin/main`. Strip the `origin/` prefix to get the branch name. If it returned `__DEFAULT_BRANCH_UNRESOLVED__`, an error, or a bare `HEAD`, try:
5050

5151
```bash
5252
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'

skills/ce-compound/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ Headless mode is intended for automations and skill-to-skill invocation where no
4242

4343
## Pre-resolved context
4444

45-
**Git branch (pre-resolved):** !`git rev-parse --abbrev-ref HEAD 2>/dev/null || true`
45+
**Git branch (pre-resolved):** !`git rev-parse --abbrev-ref HEAD`
4646

47-
If the line above resolved to a plain branch name (like `feat/my-branch`), use it in Phase 1 session-history filtering so the orchestrator does not waste a turn deriving it. If it still contains a backtick command string or is empty, derive the branch at runtime.
47+
If the line above resolved to a plain branch name (like `feat/my-branch`), use it in Phase 1 session-history filtering so the orchestrator does not waste a turn deriving it. If it still contains a backtick command string, shows an error, or is empty, derive the branch at runtime.
4848

49-
**Repo root (pre-resolved):** !`git rev-parse --show-toplevel 2>/dev/null || pwd`
49+
**Repo root (pre-resolved):** !`git rev-parse --show-toplevel`
5050

51-
If the line above resolved to an absolute path, use it as the session-history repo filter in Phase 1. If it still contains a backtick command string or is empty, derive the repo root at runtime with `git rev-parse --show-toplevel 2>/dev/null || pwd`.
51+
If the line above resolved to an absolute path, use it as the session-history repo filter in Phase 1. If it still contains a backtick command string, shows an error, or is empty, derive the repo root at runtime with the shell tool (`git rev-parse --show-toplevel`, falling back to the working directory outside a git repo).
5252

5353
## Support Files
5454

skills/ce-ideate/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Determine `OUTPUT_FORMAT` for the ideation artifact this run might persist. Outp
6868
Unlike `ce-plan` and `ce-brainstorm` (which default to `md`), ce-ideate defaults to **`html`** — ideation artifacts are read mainly by humans weighing candidate directions, and a rich self-contained HTML file (with illustrative diagrams for the top candidates) makes the ideas easier to approach.
6969

7070
**Read config.** The repo root is pre-resolved at skill load:
71-
!`git rev-parse --show-toplevel 2>/dev/null || true`
71+
!`git rev-parse --show-toplevel`
7272

73-
If the line above is an absolute path, use it as `<repo-root>`. If it is empty or still shows a backtick command string (a non-Claude harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
73+
If the line above is an absolute path, use it as `<repo-root>`. If it is empty, shows an error, or still shows a backtick command string (a harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
7474

7575
Resolution steps:
7676

skills/ce-plan/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ A plan is ready when an implementer can start confidently without needing the pl
7272
Determine `OUTPUT_FORMAT` before any other phase fires. Output mode is **exclusive** — the plan is written as either markdown (`.md`) OR HTML (`.html`), never both. Precedence: in-prompt request > user-stated preference > config > default (`md`), with a hard pipeline-mode override.
7373

7474
**Read config.** The repo root is pre-resolved at skill load:
75-
!`git rev-parse --show-toplevel 2>/dev/null || true`
75+
!`git rev-parse --show-toplevel`
7676

77-
If the line above is an absolute path, use it as `<repo-root>`. If it is empty or still shows a backtick command string (a non-Claude harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
77+
If the line above is an absolute path, use it as `<repo-root>`. If it is empty, shows an error, or still shows a backtick command string (a harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool. If the root cannot be resolved (not a git repo) or the file does not exist, fall through to the defaults below.
7878

7979
Resolution steps:
8080

skills/ce-product-pulse/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ Apply a **15-minute trailing buffer** to the window's upper bound. Many analytic
5353
### Phase 0: Route by Config State
5454

5555
**Read config.** The repo root is pre-resolved at skill load:
56-
!`git rev-parse --show-toplevel 2>/dev/null || true`
56+
!`git rev-parse --show-toplevel`
5757

58-
If the line above is an absolute path, use it as `<repo-root>`. If it is empty or still shows a backtick command string (a non-Claude harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool (e.g., Read in Claude Code, read_file in Codex). If the root cannot be resolved or the file does not exist, treat this as a first run. Otherwise extract values for the `pulse_*` keys listed under "Config keys" below.
58+
If the line above is an absolute path, use it as `<repo-root>`. If it is empty, shows an error, or still shows a backtick command string (a harness that did not run the pre-resolution), resolve `<repo-root>` at runtime by running `git rev-parse --show-toplevel` with the shell tool. Then read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool (e.g., Read in Claude Code, read_file in Codex). If the root cannot be resolved or the file does not exist, treat this as a first run. Otherwise extract values for the `pulse_*` keys listed under "Config keys" below.
5959

6060
**Config keys:**
6161
- `pulse_product_name` -- string, used in report titles. Required for routing: if unset, skill is unconfigured.

skills/ce-sweep/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Parse a `mode:headless` token from anywhere in the arguments, strip it, and trea
4040
### Phase 0: Route by Config State
4141

4242
**Resolve the repo root.** Pre-resolved at skill load:
43-
!`git rev-parse --show-toplevel 2>/dev/null || true`
43+
!`git rev-parse --show-toplevel`
4444

45-
If the line above is an absolute path, use it as `<repo-root>`. If it is empty or still shows a backtick command string (a harness that did not pre-resolve), run `git rev-parse --show-toplevel` with the shell tool. Read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool.
45+
If the line above is an absolute path, use it as `<repo-root>`. If it is empty, shows an error, or still shows a backtick command string (a harness that did not pre-resolve), run `git rev-parse --show-toplevel` with the shell tool. Read `<repo-root>/.compound-engineering/config.local.yaml` with the native file-read tool.
4646

4747
**Route:**
4848
- Config file missing, or it has no `feedback_sources` key -> first run -> Phase 1.

0 commit comments

Comments
 (0)