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
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
],
"remoteEnv": {
"PATH": "${containerWorkspaceFolder}/.venv/bin:${containerEnv:PATH}"
"PATH": "${containerWorkspaceFolder}/.venv/bin:${containerWorkspaceFolder}/node_modules/.bin:${containerEnv:PATH}"
},
"postCreateCommand": "UV_MALWARE_CHECK=1 devops devcontainer post-create",
"postCreateCommand": "UV_MALWARE_CHECK=1 devops devcontainer post-create && npm ci --ignore-scripts",
"postStartCommand": "devops devcontainer post-start",
"customizations": {
"vscode": {
Expand Down
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
!README.md
!src
!src/**
!package.json
!package-lock.json
22 changes: 4 additions & 18 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,13 @@
"matchStrings": ["\\n\\[python\\.(?<depName>[a-z0-9-]+)\\]\\nversion = \"(?<currentValue>[^\"]+)\""],
"datasourceTemplate": "pypi"
},
{
"customType": "regex",
"description": "The OpenSpec version of the tools lock. The npm manager updates openspec/package.json and its lockfile.",
"managerFilePatterns": ["/^src/devops_cli/tools_lock/tools\\.lock$/"],
"matchStrings": ["\\n\\[npm\\.openspec\\]\\nversion = \"(?<currentValue>[^\"]+)\""],
"depNameTemplate": "@fission-ai/openspec",
"datasourceTemplate": "npm"
},
{
"customType": "regex",
"description": "The Dev Containers CLI version of the tools lock. The npm manager updates devcontainers-cli/package.json and its lockfile.",
"managerFilePatterns": ["/^src/devops_cli/tools_lock/tools\\.lock$/"],
"matchStrings": ["\\n\\[npm\\.devcontainers-cli\\]\\nversion = \"(?<currentValue>[^\"]+)\""],
"depNameTemplate": "@devcontainers/cli",
"datasourceTemplate": "npm"
},
{
"customType": "regex",
"description": "The Style Dictionary version of the tools lock. The npm manager updates style-dictionary/package.json and its lockfile.",
"managerFilePatterns": ["/^src/devops_cli/tools_lock/tools\\.lock$/"],
"matchStrings": ["\\n\\[npm\\.style-dictionary\\]\\nversion = \"(?<currentValue>[^\"]+)\""],
"depNameTemplate": "style-dictionary",
"datasourceTemplate": "npm"
}
],
"dependencyDashboard": {
Expand Down Expand Up @@ -278,12 +262,14 @@
"commitMessagePrefix": "fix(deps):"
},
{
"description": "The OpenSpec package, its lockfile and the tools lock. Each release comes on the day it is published, not on the schedule of the preset, so the project uses the newest skills and planning standard (#5078). The skills that OpenSpec generates change with its version, so the branch writes them again.",
"description": "The OpenSpec devDependency of the root package.json and package-lock.json, which the npm manager updates (#6409). Each release comes on the day it is published, not on the schedule of the preset, so the project uses the newest skills and planning standard (#5078). The skills that OpenSpec generates change with its version, so the branch writes them again.",
"matchManagers": ["npm"],
"matchPackageNames": ["@fission-ai/openspec"],
"groupName": "openspec",
"commitMessagePrefix": "fix(deps):",
"schedule": ["at any time"],
"prBodyNotes": [
"Before the merge, run `uv run --frozen devops install-tools --tool openspec` and `uv run --frozen devops openspec regenerate` on this branch and push the generated skills; Renovate runs no upgrade task until #6020. The regeneration needs Git and access to github.com, because OpenSpec installs its skills from the release tag of its repository.",
"Before the merge, run `npm ci --ignore-scripts` and `uv run --frozen devops openspec regenerate` on this branch and push the generated skills; Renovate runs no upgrade task until #6020. The regeneration needs Git and access to github.com, because OpenSpec installs its skills from the release tag of its repository.",
"Before the merge, record OpenSpec again for the tests that replay it (`tests/support/openspec_recording.py` says how), and run `uv run devops openspec check`."
]
},
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ jobs:
with:
cache-suffix: static

# The Node that `.node-version` names runs the pinned OpenSpec, which the openspec row needs.
# The Node that `.node-version` names runs the OpenSpec that package-lock.json pins, which the
# openspec row runs from node_modules/.bin (#6409).
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
Expand All @@ -76,7 +77,7 @@ jobs:
- name: Install OpenSpec
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
uv run devops install-tools --tool openspec --only-missing
npm ci --ignore-scripts
uv run devops install-tools --tool tofu --only-missing
uv run devops install-tools --tool osv-scanner --only-missing

Expand Down Expand Up @@ -448,6 +449,8 @@ jobs:
src
pyproject.toml
uv.lock
package.json
package-lock.json
README.md
.github/workflows/ci.yml
run: |
Expand Down Expand Up @@ -550,6 +553,8 @@ jobs:
src
pyproject.toml
uv.lock
package.json
package-lock.json
README.md
.github/workflows/ci.yml
run: |
Expand Down Expand Up @@ -649,6 +654,8 @@ jobs:
src
pyproject.toml
uv.lock
package.json
package-lock.json
README.md
.github/workflows/ci.yml
run: |
Expand Down Expand Up @@ -815,7 +822,8 @@ jobs:
filters: |
design:
- 'design/**'
- 'src/devops_cli/tools_lock/style-dictionary/**'
- 'package.json'
- 'package-lock.json'
- 'src/devops_cli/design/**'
- 'docs/assets/css/**'
- 'k8s/monitoring/dashboards/**'
Expand Down Expand Up @@ -846,9 +854,7 @@ jobs:
- name: Install Style Dictionary
if: steps.changes.outputs.design == 'true'
timeout-minutes: 2
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
uv run devops install-tools --tool style-dictionary --only-missing
run: npm ci --ignore-scripts

- name: Build the Design Tokens
if: steps.changes.outputs.design == 'true'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
- name: Install OpenSpec and agent tools
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
uv run devops install-tools --tool openspec --only-missing
echo "$PWD/node_modules/.bin" >> "$GITHUB_PATH"
npm ci --ignore-scripts
uv run devops install-tools --tool gitleaks --only-missing
uv run devops install-tools --tool osv-scanner --only-missing
uv run devops install-tools --tool semgrep --only-missing
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,15 @@ jobs:
with:
cache-suffix: plan-check

# The Node that `.node-version` names runs the pinned OpenSpec, which the command runs.
# The Node that `.node-version` names runs the OpenSpec that package-lock.json pins, which the
# command runs from node_modules/.bin (#6409).
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version

- name: Install OpenSpec
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
uv run devops install-tools --tool openspec --only-missing
run: npm ci --ignore-scripts

# The command counts tokens with the exact encoding and stops when the cache is missing.
# tiktoken names a cache file by the SHA-1 of its blob URL and does not download the file
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/service-image-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
- .dockerignore
- pyproject.toml
- uv.lock
- package.json
- package-lock.json
- src/devops_cli/tools_lock/**
- .github/workflows/service-image-test.yml
schedule:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ env/
# uv
.uv/

# npm: `npm ci --ignore-scripts` installs the devDependencies of package-lock.json here
/node_modules/

# mypy
.mypy_cache/
.dmypy.json
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ repos:
always_run: true

# The OpenSpec gate (ADR 0010) over the plans and the committed skills: it needs Node and the
# pinned openspec (`uv run devops install-tools --tool openspec --only-missing`), so it runs
# only when a commit touches the files it checks. Every `devops ci` and the `Static Analysis`
# openspec that `npm ci --ignore-scripts` installs from package-lock.json, so it runs only
# when a commit touches the files it checks. Every `devops ci` and the `Static Analysis`
# check of CI run it with no path filter. When a committed skill differs from what the pinned
# openspec writes, its regeneration gets the skills of the release from github.com with Git.
- id: openspec-gate
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ cd devops-cli
# 2. Synchronize virtual environment and all dependency groups
uv sync --all-groups --all-extras

# 3. Install pre-commit hooks
# 3. Install OpenSpec and Style Dictionary at the versions of package-lock.json
npm ci --ignore-scripts

# 4. Install pre-commit hooks
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. Run `npm ci --ignore-scripts` again in each new worktree and 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.

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`.

The container has a limit of 8192 processes and threads (`--pids-limit=8192` in `runArgs` of `.devcontainer/devcontainer.json`). Rootless Podman sets 2048 when the option is absent, and a burst of VS Code file searches filled that limit: the tools of agent sessions then failed with exit code 1 or `can't start new thread` (#3722). The extension `ms-python.vscode-python-envs` starts one `rg` search, with one thread for each CPU, for each file that a new worktree or virtual environment creates. A new limit takes effect only after a person rebuilds the container (`Dev Containers: Rebuild Container`). A restart or a reload does not apply it. `cat /sys/fs/cgroup/pids.max` shows the limit that applies.
Expand Down
27 changes: 14 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# syntax=docker/dockerfile:1@sha256:4edf897a3ffa55b89f906fc8cc78afdb3f1834cc9c7083565e611a8a7d5fe99e
FROM ghcr.io/astral-sh/uv:0.13.9@sha256:d3b601f0c7b118bc1753febf7c41cc80981df678445e0254284eecf84db79a7d AS uv

# The Node runtime that runs OpenSpec in the Service and MCP server images. Its major version is the
# one of `.node-version`. These images are on trixie, and the Node package of sid needs a newer glibc.
# The Node runtime that installs OpenSpec and runs it in the Service and MCP server images. Its major
# version is the one of `.node-version`. These images are on trixie, and the Node package of sid
# needs a newer glibc.
FROM node:24-trixie-slim@sha256:af02d57b57719b9657a45199a79264a9437940cd55b3c7b3fc99615654f124a0 AS node

# The devtools image (https://github.com/dan-petty/devtools): Debian sid with the development tools.
Expand Down Expand Up @@ -52,16 +53,16 @@ COPY src/ ./src/
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev --no-editable --extra review --link-mode copy

# OpenSpec and only the npm packages that it needs, from the Node tools of the devtools image, for
# the Service and MCP server images. The stage keeps OpenSpec alone in the package.json of the tree,
# and `npm prune` removes each package that OpenSpec does not need. The prune reads only the tree on
# disk (`--offline`) and runs no install script.
FROM devtools AS openspec
# OpenSpec and only the npm packages that it needs, at the version that the package-lock.json of
# the project pins (#6409), for the Service and MCP server images. The OpenSpec of the devtools
# image has no effect on them. `npm ci` installs the lockfile and runs no install script. The stage
# then keeps OpenSpec alone in the package.json of the tree, and `npm prune` removes each package
# that OpenSpec does not need. The prune reads only the tree on disk (`--offline`).
FROM node AS openspec
WORKDIR /usr/local/lib/openspec
RUN cp -a /usr/local/lib/devtools/npm/. . && \
version="$(node -p 'require("./node_modules/@fission-ai/openspec/package.json").version')" && \
npm pkg delete dependencies overrides allowScripts && \
npm pkg set "dependencies.@fission-ai/openspec=${version}" && \
COPY package.json package-lock.json ./
RUN npm ci --omit=optional --ignore-scripts --no-audit --no-fund && \
npm pkg delete devDependencies.style-dictionary overrides && \
npm prune --offline --ignore-scripts --no-audit --no-fund && \
find node_modules -mindepth 1 -maxdepth 1 -type d -empty -delete

Expand Down Expand Up @@ -136,8 +137,8 @@ USER 1000:1000
ENTRYPOINT ["devops"]

# The layers of the Service and MCP server images that a change of `src/` keeps: git, the Node
# runtime, gh and OpenSpec, and the venv of the runtime requirements. gh and OpenSpec come from the
# devtools image. The image holds no uv, curl or pip.
# runtime, gh and OpenSpec, and the venv of the runtime requirements. gh comes from the devtools
# image, and OpenSpec from the `openspec` stage. The image holds no uv, curl or pip.
FROM python:3.14-slim-trixie@sha256:9aaa474097d094040649f2162a627c0049b408f52138d980916788d80f04802f AS service-deps

RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Build targets that call an open tool through its own command line. Each target names the files
# it writes; commit them, and never edit them by hand.

# Style Dictionary, from the lock in src/devops_cli/tools_lock/style-dictionary/. The devcontainer
# image puts it on PATH; docs/DESIGN.md gives the install steps for another host.
STYLE_DICTIONARY ?= style-dictionary
# Style Dictionary at the version that package-lock.json pins: `npm ci --ignore-scripts` at the root
# installs it into node_modules/.bin (#6409). docs/DESIGN.md gives the steps.
STYLE_DICTIONARY ?= node_modules/.bin/style-dictionary

# The token build: design/tokens/*.tokens.json to docs/assets/css/tokens-*.css and
# src/devops_cli/design/tokens-*.{css,json} (docs/DESIGN.md, "Token pipeline").
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Each persona chats with its role, the chat task and its own prompt (`src/devops_
2. **Key Material Mounting**: `${localEnv:HOME}/.ssh` is bind-mounted by design into `.devcontainer` for local SSH key generation and 90-day rotation.
3. **SSRF Protections**: Every HTTP client is built by the `devops_cli.http.entry` entry point (tool downloads, the Tavily search call, Vault, the `k8s://` proxy and cluster-service clients, Loki, the Grafana, Prometheus and Argo CD clients and their token calls, the sandbox probe, the sandbox metrics scrape, Tempo, the LLM client base, the LLM gateway probes and model query, the `devops ai gateway load` query, the embeddings engine, the pydantic-ai models, the pricing fetch, the documentation crawler, the OSV, Shodan InternetDB and Cloudflare Radar lookups, and the Cloudflare API client). Each client has an egress level (`devops_cli.http.egress`) and resolves a host once, at the connect, dialling only the addresses its level admits. Kept pre-flight callers that do not dial through an httpx2 client (qdrant-client, `devops k8s apply` with manifest URLs, Docker engine endpoint) or dial nothing (`devops config init` wizard) call `vet_addresses` directly at their level. The in-process `kubernetes` client (urllib3) is not checked at the connect: it is trusted because its address comes from the operator's kubeconfig or the in-cluster environment. Untrusted URLs (tool downloads, the pages of the documentation crawler), the default pricing registry and the fixed public APIs (OSV, Shodan InternetDB, Cloudflare Radar and the Cloudflare API) are public-only whatever the configuration says. A service URL from the user's own configuration (Ollama, Qdrant, the LLM gateway, a provider's `api_base_url`, `grafana.url`, `prometheus.url`, `argocd.url`) may name loopback, and a private address once `ai.allow_private_network` (`DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK=true`) is set. Internal infrastructure clients (Vault, the `k8s://` proxy, Loki, the `devops ai gateway connect` probe) reach private addresses. Cloud metadata addresses are refused at every level. Clients of the entry point ignore `HTTP_PROXY`, `HTTPS_PROXY` and `ALL_PROXY`.
4. **Workspace Boundary Guards**: Path traversal checks (`_is_safe_workspace_path`) enforce repository boundaries on file commands.
5. **Checksum Verification**: `devops install-tools` installs every tool only from `tools.lock` (`src/devops_cli/tools_lock/`), at an exact version. A binary is checked against the lock's SHA-256 for its platform, a Python tool (Semgrep, Bandit, and ansible-core with ansible-runner, which links only `ansible-runner`) installs with `uv pip sync --require-hashes` into a virtual environment of its own, and a Node tool (OpenSpec, Dev Containers CLI) installs with `npm ci --ignore-scripts` from a committed `package-lock.json`, which npm checks against the sha512 of every package (`npm` must already be on PATH); a mismatch is refused and the command exits 1. `devops install-tools --check` lists each tool not linked at its locked version, reads the version the `openspec` command on PATH prints, fails naming that path and both versions when they differ, and prints `openspec <locked version>` with the path of that command when they match.
5. **Checksum Verification**: `devops install-tools` installs every tool only from `tools.lock` (`src/devops_cli/tools_lock/`), at an exact version. A binary is checked against the lock's SHA-256 for its platform, a Python tool (Semgrep, Bandit, and ansible-core with ansible-runner, which links only `ansible-runner`) installs with `uv pip sync --require-hashes` into a virtual environment of its own, and the Node tool of the lock (Dev Containers CLI) installs with `npm ci --ignore-scripts` from a committed `package-lock.json`, which npm checks against the sha512 of every package (`npm` must already be on PATH); a mismatch is refused and the command exits 1. `devops install-tools --check` lists each tool not linked at its locked version. OpenSpec and Style Dictionary are devDependencies of the root `package.json`; `npm ci --ignore-scripts` installs them from the root `package-lock.json`.
6. **Automated Design Justification & Documentation Maintenance**: Non-instructional, reference-backed inline comments (`# NOTE (Design Justification - <REF>): ...`) automatically document intentional design trade-offs directly above target code constructs, and a change updates the document that owns each rule it changes. `AGENTS.md` routes each kind of task to that document.

---
Expand Down
Loading