Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ npm ci --ignore-scripts
uv run pre-commit install
```

OpenSpec and Style Dictionary are devDependencies of `package.json`, and `package-lock.json` pins each package with its sha512 (#6409). `npm ci --ignore-scripts` installs them into `node_modules/.bin`, and the commands of the project call them from there: `devops openspec check`, `devops openspec regenerate` and `make design-tokens`. An `openspec` or a `style-dictionary` on `PATH`, such as the one of the devtools image, has no effect on these commands. `devops repos worktrees add` runs `npm ci --ignore-scripts` in each new worktree, and you run it again after each change of `package-lock.json`. The devcontainer runs it at post-create, and each CI job that runs one of the tools runs it too. Renovate's npm manager updates `package.json` and `package-lock.json`. A new OpenSpec version changes the text of the skills that OpenSpec writes: on the branch of the update, run `npm ci --ignore-scripts`, `uv run devops openspec regenerate` and `uv run devops openspec check`, commit the skills, and record OpenSpec again for the tests that replay it (`tests/support/openspec_recording.py` says how). The regeneration needs Git and access to github.com, because OpenSpec installs its skills from the release tag of its repository.
OpenSpec and Style Dictionary are devDependencies of `package.json`, and `package-lock.json` pins each package with its sha512 (#6409). `npm ci --ignore-scripts` installs them into `node_modules/.bin`, and the commands of the project call them from there: `devops openspec check`, `devops openspec regenerate` and `make design-tokens`. While that folder is in the checkout, an `openspec` or a `style-dictionary` on `PATH`, such as the one of the devtools image, has no effect on these commands. A checkout with no `node_modules`, such as a new worktree, takes `openspec` from `PATH`. In the devcontainer, `PATH` holds `node_modules/.bin` of the main checkout before the folders of the image, so a new worktree gets the pinned version, and `devops repos worktrees add` installs nothing (#7264). When the `openspec` row of `devops ci` names another version, run `which -a openspec`: a copy in a home folder that is earlier on `PATH` hides the pinned one, and the fix is to remove that copy. Run `npm ci --ignore-scripts` again after each change of `package-lock.json`, and in a worktree before `make design-tokens`. The devcontainer runs it at post-create, and each CI job that runs one of the tools runs it too. Renovate's npm manager updates `package.json` and `package-lock.json`. A new OpenSpec version changes the text of the skills that OpenSpec writes: on the branch of the update, run `npm ci --ignore-scripts`, `uv run devops openspec regenerate` and `uv run devops openspec check`, commit the skills, and record OpenSpec again for the tests that replay it (`tests/support/openspec_recording.py` says how). The regeneration needs Git and access to github.com, because OpenSpec installs its skills from the release tag of its repository.

The devcontainer installs the hooks at each start. A Claude Code cloud session installs them with the SessionStart hook of `.claude/settings.json`, which does nothing when `CLAUDE_CODE_REMOTE` is not `true`. The Copilot cloud agent installs them in a step of `.github/workflows/copilot-setup-steps.yml`.

Expand Down
2 changes: 1 addition & 1 deletion docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ A page selects its theme with the CSS files: `tokens-light.css` on `:root`, `tok

### Install Style Dictionary

Style Dictionary is a devDependency of `package.json`, and `package-lock.json` pins it with each package that it needs (#6409). The `audit` row of `devops ci` audits that lockfile. `npm ci --ignore-scripts` at the root of the checkout installs it into `node_modules/.bin`, and `make` calls it from there, so a `style-dictionary` on `PATH`, such as the one of the devtools image, has no effect on the build. The devcontainer runs `npm ci --ignore-scripts` at post-create, and `devops repos worktrees add` runs it in each new worktree. On another host, run:
Style Dictionary is a devDependency of `package.json`, and `package-lock.json` pins it with each package that it needs (#6409). The `audit` row of `devops ci` audits that lockfile. `npm ci --ignore-scripts` at the root of the checkout installs it into `node_modules/.bin`, and `make` calls it from there, so a `style-dictionary` on `PATH`, such as the one of the devtools image, has no effect on the build. The devcontainer runs `npm ci --ignore-scripts` at post-create. In a new worktree or on another host, run:

```bash
npm ci --ignore-scripts
Expand Down
2 changes: 1 addition & 1 deletion docs/DEVCONTAINER_USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The published Dev Container image is built FROM the devtools image ([dan-petty/d
- **Kubernetes & Cloud Native**: `kubectl`, `helm`, `minikube` (with optional GPU passthrough support), `kustomize`. The docker driver of Minikube with `podman-docker` is not tested ([#6466](https://github.com/dan-petty/devops-cli/issues/6466)).
- **Dev Container Features**: `.devcontainer/image/devcontainer.json` has two Features: `common-utils` (the user `vscode`, uid and gid 1000, and zsh) and `podman-in-podman`. No Feature option names a tool version: each tool comes from the devtools image. `.devcontainer/image/devcontainer-lock.json` pins the digest of each Feature, and the image build runs with `--frozen-lockfile`. Renovate's devcontainer manager changes the tag of a Feature but has no code for the lockfile. So after a Feature bump, run `devcontainer upgrade --workspace-folder . --config .devcontainer/image/devcontainer.json` and commit the lockfile in the same pull request. A case of `tests/invariants/test_devcontainer_config.py` fails on a feature that the lockfile does not resolve.
- **Infrastructure as Code**: `devops tf` wraps OpenTofu or Terraform. The image has `tofu` and `tflint`; install `terraform` yourself.
- **Security & Compliance Integrations**: runners for `bandit`, `trivy`, `semgrep`, `gitleaks`, `kube-linter`, `kubeconform`, `pluto` and `actionlint` (`devops scan`, `devops k8s`, `devops ci`). Trivy's misconfiguration scan (`devops scan trivy --type config`) scans the IaC files. These tools and `gitleaks` and `osv-scanner` come from the devtools image. Its commands are in `/usr/local/bin`, and the files of a Python or Node tool are in `/usr/local/lib/devtools`. `devops devcontainer post-create` installs no tool: a new devtools digest in `.devcontainer/Dockerfile` and a rebuild of the image change a tool. OpenSpec and Style Dictionary are devDependencies of the project: the `postCreateCommand` of `.devcontainer/devcontainer.json` runs `npm ci --ignore-scripts` after post-create, which installs them at the versions of `package-lock.json` into `node_modules/.bin`, and `remoteEnv` puts that directory on `PATH` after `.venv/bin`. The project commands call them from `node_modules/.bin` of the checkout, so the `openspec` of the devtools image has no effect on them (#6409). `devops repos worktrees add` runs `npm ci --ignore-scripts` in a new worktree, so `devops openspec check` and `make design-tokens` find the pinned versions there.
- **Security & Compliance Integrations**: runners for `bandit`, `trivy`, `semgrep`, `gitleaks`, `kube-linter`, `kubeconform`, `pluto` and `actionlint` (`devops scan`, `devops k8s`, `devops ci`). Trivy's misconfiguration scan (`devops scan trivy --type config`) scans the IaC files. These tools and `gitleaks` and `osv-scanner` come from the devtools image. Its commands are in `/usr/local/bin`, and the files of a Python or Node tool are in `/usr/local/lib/devtools`. `devops devcontainer post-create` installs no tool: a new devtools digest in `.devcontainer/Dockerfile` and a rebuild of the image change a tool. OpenSpec and Style Dictionary are devDependencies of the project: the `postCreateCommand` of `.devcontainer/devcontainer.json` runs `npm ci --ignore-scripts` after post-create, which installs them at the versions of `package-lock.json` into `node_modules/.bin`, and `remoteEnv` puts that directory on `PATH` after `.venv/bin`. The project commands call them from `node_modules/.bin` of the checkout when that folder is there, so the `openspec` of the devtools image has no effect on them (#6409). A new worktree has no such folder and takes `openspec` from `PATH`, which holds `node_modules/.bin` of the main checkout before `/usr/local/bin`. So `devops openspec check` needs no install in a worktree, and `devops repos worktrees add` installs nothing (#7264). A tool copy in a home folder that is earlier on `PATH`, such as a link in `~/.local/bin` from an old install, hides both: find it with `which -a openspec` and remove it. In a new worktree, run `npm ci --ignore-scripts` only before `make design-tokens`.
- **Terminal tools**: The image installs `k9s`, a terminal dashboard for Kubernetes, `gh-dash`, a terminal dashboard for GitHub pull requests and issues, and `tuicr`, a terminal program that shows a diff and lets a person add typed comments, from the devtools image in `/usr/local/bin`. Post-create installs no tool. A person starts `gh-dash` at the root of the clone with `gh-dash --config .gh-dash.yml`. The file `.gh-dash.yml` shows the pull requests oldest first and the issues for triage, and it refreshes every 60 minutes with the preview closed. The first start also writes `~/.config/gh-dash/config.yml`. Agents never start `gh-dash`.
- **Reviewing an agent diff with `tuicr`**: A person uses `tuicr` to review the diff of an agent. The person copies `.devops/tuicr.config.toml` to `~/.config/tuicr/config.toml` once, after a backup of any existing file with the suffix `.bak-<YYYYMMDD-HHMMSS>`. The template turns off the update check, which otherwise calls `crates.io` at start, and defines the comment types `issue`, `question` and `nit`. In the worktree of the agent, the person starts `tuicr -r origin/main..HEAD` for the commits or `tuicr -w` for the uncommitted changes. Nobody runs `tuicr pr`, `tuicr update` or `curl | sh`, and agents never start `tuicr`. The "Human Review Round" bullet of [`SDLC.md`](SDLC.md) Phase 6 gives the rules for agents.
- **What `gh-dash` sends and can do**: At start, `gh-dash` sends one GraphQL request to `api.github.com` that asks for its latest release, and it has no switch to stop this request. Its approve, merge, close, ready, reopen, update, assign, label and comment keys stay active and use the token of the person who runs it. `gh-dash` still draws some icons with Nerd Font glyphs, in its preview pane, its notification rows and some column headers. `.gh-dash.yml` hides the icon cells of the tables, holds only ASCII and sets no glyph.
Expand Down
2 changes: 0 additions & 2 deletions docs/commands/repos.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-26
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Design

## Decisions
- **Delete the step, keep no switch.** The cause was a stale copy on `PATH`, and it is gone. A setting that turns the install on again would keep code for a case that the image and `PATH` cover.
- **Keep the gate message.** `version_differs` of the OpenSpec gate names the path of the binary that it ran. That path shows a stale copy at once, so the documents name `which -a openspec` as the first step.
- **The archive of #7233 stays.** It is the record of that change. This change removes its requirement with a delta.

## Rejected alternatives
- **Keep the install for each worktree.** It hides a wrong `PATH`: the gate passes in the worktree, and each other user of the container still gets the stale tool.
- **Put the image copy first on `PATH` in the product code.** The devcontainer and the image own `PATH`. Product code that changes it is a second fix on a fix.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Proposal: #7264

## Why
#7233 (pull request #7260) made `devops repos worktrees add` run `npm ci --ignore-scripts` in each new worktree. Its premise was wrong: the `openspec` row of `devops ci` did not find the `openspec` of the image. It found a stale copy in the home volume. `~/.local/bin/openspec` (2.1.0) was a link into `~/.local/share/devops-cli/tools/`, which the removed `devops install-tools` wrote, and the shell profiles of the home volume put `~/.local/bin` first on `PATH`. The link hid the pinned copy (`node_modules/.bin` of the main checkout, 2.2.0, on `PATH` through `remoteEnv` of `.devcontainer/devcontainer.json`) and the copy of the devtools image (`/usr/local/bin`). The stale links are removed. So the step installs 87 MB of Node tools a second time for each worktree and fixes no cause. Owner direction of 2026-11-26: the devtools image installs the tools, and `PATH` gives each user of the container the intended versions.

## What Changes
- `devops repos worktrees add` starts no npm process. `install_node_tools` (`git/worktree_add.py`), its call in `commands/repos.py` and the message `worktrees_add_node_tools_failed` are deleted.
- CONTRIBUTING.md and docs/DEVCONTAINER_USAGE.md say where a worktree gets `openspec` from, and how to find a stale copy on `PATH`. docs/DESIGN.md says again that a worktree needs `npm ci --ignore-scripts` before `make design-tokens`.
- The command stops an install that a person can observe, so the change has a spec delta.

## Capabilities
- `repos-worktrees-add`: REMOVED requirement for the Node tools of the lock file; ADDED requirement that the command installs no Node tools.

## Impact
- A new worktree is made faster and is 87 MB smaller.
- In the devcontainer, `devops openspec check` in a new worktree runs the pinned `openspec` of the main checkout from `PATH`. A worktree needs `npm ci --ignore-scripts` only before `make design-tokens`, or when its branch changes `package-lock.json`.
- The change fits one pull request.

## Feasibility
- `OpenSpecTool.path` (`openspec/tool.py`) starts the binary of the checkout when it is there, else the `openspec` that `PATH` resolves.
- Proof in the devcontainer on 2026-11-26, after the stale links were removed: in a worktree with no `node_modules`, `uv run devops ci --check --only openspec` passes, and `which -a openspec` gives `node_modules/.bin/openspec` of the main checkout (2.2.0) before `/usr/local/bin/openspec` (2.1.1).
- `src/devops_cli` holds no code that writes `~/.local/share/devops-cli/tools/`.

## Existing Tool Considered
The devtools image and the `PATH` of the devcontainer already give each worktree the pinned tool. The change deletes code and adds none.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## REMOVED Requirements

### Requirement: A new worktree gets the Node tools of the lock file
**Reason**: The gate failure that the install answered came from a stale `openspec` in a home folder that was first on `PATH`, not from a missing install (#7264).
**Migration**: The devcontainer puts `node_modules/.bin` of the main checkout on `PATH`, so a new worktree gets the pinned tools. Run `npm ci --ignore-scripts` in a worktree only before `make design-tokens`, or when its branch changes `package-lock.json`.

## ADDED Requirements

### Requirement: The add command installs no Node tools
The `devops repos worktrees add` command SHALL start no npm process, also when the new worktree holds `package-lock.json`.

#### Scenario: A repository with a lock file
- **WHEN** A test runs `devops repos worktrees add` with the process fake for a repository that holds `package-lock.json`.
- **THEN** The fake records no call of `npm`, and the new worktree exists.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Tasks

## 1. Behavior: the add command installs no Node tools

- [x] 1.1 Write a failing test: `devops repos worktrees add` records no `npm` call for a repository that holds `package-lock.json`, and the worktree exists
- Verification: `$ uv run devops ci test tests/core/test_repos_worktrees_add.py`
- [x] 1.2 Delete `install_node_tools`, its call in `worktrees_add`, its imports and the message `worktrees_add_node_tools_failed`
- Verification: `$ uv run devops ci test tests/core/test_repos_worktrees_add.py`

## 2. Documents

- [x] 2.1 Say in CONTRIBUTING.md and docs/DEVCONTAINER_USAGE.md where a worktree gets `openspec` from and how to find a stale copy on `PATH`, restore the worktree step of docs/DESIGN.md, and regenerate docs/commands/repos.md
- Verification: `$ uv run devops ci docs`
16 changes: 4 additions & 12 deletions openspec/specs/repos-worktrees-add/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,17 +396,9 @@ The command MUST raise `GitOperationError` when it cannot restore the original b
- **WHEN** A test calls `add_worktree` with a test double that detaches HEAD and a restore helper that fails
- **THEN** The test asserts that `GitOperationError` is raised and its message names the original branch

### Requirement: A new worktree gets the Node tools of the lock file
The `devops repos worktrees add` command SHALL run `npm ci --ignore-scripts` in the new worktree when that worktree holds `package-lock.json`, SHALL start no npm process when the worktree holds no such file, and SHALL start none on a dry run. A failed install SHALL write a warning that names `npm ci --ignore-scripts` and SHALL keep the new worktree.
### Requirement: The add command installs no Node tools
The `devops repos worktrees add` command SHALL start no npm process, also when the new worktree holds `package-lock.json`.

#### Scenario: The add command installs the Node tools of the lock file
#### Scenario: A repository with a lock file
- **WHEN** A test runs `devops repos worktrees add` with the process fake for a repository that holds `package-lock.json`.
- **THEN** The fake records one `npm ci --ignore-scripts` call whose working directory is the new worktree.

#### Scenario: A checkout with no lock file starts no npm
- **WHEN** A test runs `devops repos worktrees add` with the process fake for a repository that holds no `package-lock.json`.
- **THEN** The fake records no call of `npm`.

#### Scenario: A failed install warns and keeps the worktree
- **WHEN** The process fake answers the `npm ci --ignore-scripts` call with exit code 1.
- **THEN** The command writes a warning that names `npm ci --ignore-scripts`, and the new worktree still exists.
- **THEN** The fake records no call of `npm`, and the new worktree exists.
5 changes: 0 additions & 5 deletions src/devops_cli/commands/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
ReclaimResult,
WorktreeAddReport,
add_worktree,
install_node_tools,
managed_folder,
read_remote_heads,
reclaim_merged_worktrees,
Expand Down Expand Up @@ -899,8 +898,6 @@ def worktrees_add(
the standard directory or a pushed branch of origin already holds. A pushed branch whose
commits past origin/main all have the App as author is a staged branch: the command adds the
worktree on it and takes --type and --slug from it. After the worktree exists, the command
runs `npm ci --ignore-scripts` in it when it holds package-lock.json, so the worktree gets the
Node tools that the lock file pins, and warns when that install fails. Then the command
claims the issue for an agent with the label owner/agent, and sets the Status In Progress
when the item is New, Ready or Planned, or has no Status. It only warns if the claim or the
Status write fails.
Expand Down Expand Up @@ -947,8 +944,6 @@ def worktrees_add(
emit_serialized(report.model_dump(), resolved)
else:
_render_add_report(report)
if not is_plan and (warning := install_node_tools(Path(report.path))) is not None:
print_warning(warning, prefix=False)
_render_claim(report)


Expand Down
Loading