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: 4 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@
color: "C2E0C6"
description: "Output formats of commands: JSON, YAML and tables"

- name: "scope/research"
color: "5319E7"
description: "The research agent: the pins of the project and the news about them"

- name: "autorelease: pending"
color: "EDEDED"
description: "The release pull request that release-please keeps open"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
rag
release
repos
research
review
roadmap
sandbox
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ and draft readiness. |
| [**tui**](docs/commands/tui.md) | `devops tui [OPTIONS]` | Interactive terminal UI dashboard for workstation situational awareness. |
| [**status**](docs/commands/status.md) | `devops status [OPTIONS]` | Inspect published operational status of upstream cloud platforms (GitHub, Cloudflare) |
| [**survey**](docs/commands/survey.md) | `devops survey [OPTIONS]` | Outward-facing capability and upstream maturity survey. |
| [**research**](docs/commands/research.md) | `devops research inventory [OPTIONS]` | List every pin of the project as a typed component: Python packages, tools, container images, GitHub Actions, Helm charts and Terraform providers. It reads files only. |
| [**format**](docs/commands/format.md) | `devops format [OPTIONS]` | Format codebase with ruff format (or verify in check-only mode with --check). |
| [**lint**](docs/commands/lint.md) | `devops lint [OPTIONS]` | Run ruff linter across the project, automatically applying fixes by default. |

Expand Down
23 changes: 23 additions & 0 deletions docs/CLI_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Complete command-line reference for `devops-cli`, automatically generated from C
- [`devops tui`](#devops-tui) — Interactive terminal UI dashboard (alias)
- [`devops status`](#devops-status) — Inspect published operational status of upstream platforms (GitHub, Cloudflare)
- [`devops survey`](#devops-survey) — Outward-facing capability and upstream maturity survey.
- [`devops research`](#devops-research) — Read what the project pins and watch the upstream of each pin.
- [`devops format`](#devops-format) — Automatically apply code formatting in-place (ruff format).
- [`devops lint`](#devops-lint) — Run static analysis checks and automatically apply fixes (ruff check --fix).

Expand Down Expand Up @@ -10451,6 +10452,28 @@ devops survey [OPTIONS]

---

## devops research

Read what the project pins and watch the upstream of each pin.

### `devops research inventory`

**List every pin of the project as a typed component: Python packages, tools, container images, GitHub Actions, Helm charts and Terraform providers. It reads files only.**

```bash
devops research inventory [OPTIONS]
```

**Options:**

| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--root` | `path` | - | Root of the repository to read. Default: the repository of the current directory. |
| `--format`, `-f` | `string` | `table` | Output format type (table, json, yaml, markdown). |
| `--json`, `-j` | `boolean` | - | Output findings or metrics as JSON. |

---

## devops format

Automatically apply code formatting in-place (ruff format).
Expand Down
1 change: 1 addition & 0 deletions docs/ERRORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Each exception class declares its `error_code` and `exit_code`. A command that a
| `ImplementEvalError` | `ROADMAP_EVAL_REFUSED` | `1` | Roadmap | Raised when `devops roadmap eval implement` cannot read or use a fixture, or is asked for |
| `InvalidBranchNameError` | `INVALID_BRANCH_NAME` | `1` | Git | Raised when a proposed Git branch name violates naming conventions. |
| `InvalidURLError` | `INVALID_URL` | `1` | Validation | Raised when an invalid URL or URI scheme is provided. |
| `InventoryError` | `RESEARCH_INVENTORY_ERROR` | `1` | Research | Raised when `devops research inventory` cannot read or parse a file that holds pins (#3896). |
| `KeyringUnavailableError` | `KEYRING_UNAVAILABLE` | `3` | Security | Raised when the OS Keyring service is unreachable or uninitialized. |
| `KubernetesContextError` | `K8S_CONTEXT_ERROR` | `1` | K8s | Raised when a Kubernetes context cannot be resolved or is invalid. |
| `KubernetesDeployError` | `K8S_DEPLOY_ERROR` | `1` | K8s | Raised when deploying manifests or Helm charts fails. |
Expand Down
15 changes: 12 additions & 3 deletions docs/MCP_TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili
| [`gh_views_spec`](#gh-views-spec) | `true` | Output JSON schema specification for all configured project views. |
| [`gh_views_sync`](#gh-views-sync) | `false` | Synchronize standardized views with the remote GitHub Projects v2 board. |
| [`grafana_dashboards_list`](#grafana-dashboards-list) | `true` | List all dashboards. |
| [`hydrate_tool_domain`](#hydrate-tool-domain) | `true` | Advertise the tools for one domain, which are withheld from the listing by default. Call this before browsing a domain's tools. Available lazy domains include `argo`, `benchmark`, `branches`, `ci`, `docker`, `docs`, `gh`, `grafana`, `k8s`, `pr`, `prometheus`, `rag`, `repos`, `roadmap`, `sandbox`, `scan`, `security`, `ssh`, `telemetry`, `tf`, `tls`, `valkey`, `vault` and `verify`. Pass the domain name alone, for example `k8s`. |
| [`hydrate_tool_domain`](#hydrate-tool-domain) | `true` | Advertise the tools for one domain, which are withheld from the listing by default. Call this before browsing a domain's tools. Available lazy domains include `argo`, `benchmark`, `branches`, `ci`, `docker`, `docs`, `gh`, `grafana`, `k8s`, `pr`, `prometheus`, `rag`, `repos`, `research`, `roadmap`, `sandbox`, `scan`, `security`, `ssh`, `telemetry`, `tf`, `tls`, `valkey`, `vault` and `verify`. Pass the domain name alone, for example `k8s`. |
| [`k8s_audit`](#k8s-audit) | `true` | Sanitize active K8s/Minikube cluster resource health using Derailed Popeye. |
| [`k8s_bootstrap`](#k8s-bootstrap) | `false` | Bootstrap homelab Kubernetes cluster with Minikube, Calico, and ingress. |
| [`k8s_chaos`](#k8s-chaos) | `false` | Run resilience and chaos experiments against Kubernetes workloads. |
Expand Down Expand Up @@ -105,6 +105,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili
| [`prometheus_query`](#prometheus-query) | `true` | Execute an instant PromQL query. |
| [`repos_list`](#repos-list) | `true` | List all cloned repositories. |
| [`repos_sync`](#repos-sync) | `false` | Fetch (and optionally pull) all tracking branches across repos. |
| [`research_inventory`](#research-inventory) | `true` | List every pin of the project as a typed component: Python packages, tools, container images, GitHub Actions, Helm charts and Terraform providers. It reads files only. |
| [`review_branch`](#review-branch) | `true` | Review a git branch diff. |
| [`review_export_feedback`](#review-export-feedback) | `true` | Append review verdicts to the JSONL feedback dataset, which `devops ai prompt-eval` reads. Each session's findings.json and candidates.json are read, and only the findings whose verdict the dataset does not hold yet are appended. An export that finds none leaves the dataset as it was. Without --status only INVALIDATED verdicts are exported. The dataset changes no prompt and no later review. A subject reviewed more than once is exported once: its sessions share their findings by fingerprint v2. Each finding has the newest verdict a person gave it in any of those sessions, or else the verdict of the session that review history counts. --status selects by that verdict. A session that records no subject, and a finding with no fingerprint v2, are exported on their own. |
| [`review_findings`](#review-findings) | `true` | Inspect structured findings for a review session. Each finding keeps its number, its place in findings.json, whatever filter the list applies, and `devops review verify --index` takes that number. With `--candidates` the list is candidates.json: every finding the review raised, the ones verification invalidated included, numbered for `devops review verify --candidate`. |
Expand Down Expand Up @@ -1166,8 +1167,8 @@ Advertise the tools for one domain, which are withheld from the listing by defau

Call this before browsing a domain's tools. Available lazy domains include `argo`,
`benchmark`, `branches`, `ci`, `docker`, `docs`, `gh`, `grafana`, `k8s`, `pr`,
`prometheus`, `rag`, `repos`, `roadmap`, `sandbox`, `scan`, `security`, `ssh`, `telemetry`,
`tf`, `tls`, `valkey`, `vault` and `verify`.
`prometheus`, `rag`, `repos`, `research`, `roadmap`, `sandbox`, `scan`, `security`, `ssh`,
`telemetry`, `tf`, `tls`, `valkey`, `vault` and `verify`.
Pass the domain name alone, for example `k8s`.

**Annotations:** `readOnlyHint: true`
Expand Down Expand Up @@ -1702,6 +1703,14 @@ Fetch (and optionally pull) all tracking branches across repos.
| `pull` | `boolean` | No | `True` | - |
| `dry_run` | `boolean` | No | `False` | Preview execution plan without mutating external state. |

### `research_inventory`

List every pin of the project as a typed component: Python packages, tools, container images, GitHub Actions, Helm charts and Terraform providers. It reads files only.

**Annotations:** `readOnlyHint: true`

*No parameters required.*

### `review_branch`

Review a git branch diff.
Expand Down
23 changes: 23 additions & 0 deletions docs/commands/research.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# `devops research`

Read what the project pins and watch the upstream of each pin.

## Commands

## `devops research inventory`

**List every pin of the project as a typed component: Python packages, tools, container images, GitHub Actions, Helm charts and Terraform providers. It reads files only.**

```bash
devops research inventory [OPTIONS]
```

**Options:**

| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--root` | `path` | - | Root of the repository to read. Default: the repository of the current directory. |
| `--format`, `-f` | `string` | `table` | Output format type (table, json, yaml, markdown). |
| `--json`, `-j` | `boolean` | - | Output findings or metrics as JSON. |

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

## Context

The research agent needs one list of what the project pins before it can look for news upstream. The list is an input to later steps, so it must be stable (same files, same list, same order) and typed.

## Goals / Non-Goals

**Goals:**
- One `Component` for each pin in the files, with a kind, an ecosystem, a name, a version, a file and a line.
- No model, no network, no store, and no program started.
- Tests on fixture files that copy the shapes of the repository, and one test over the real tree.

**Non-Goals:**
- The mapping file `.devops/research-watch.toml`, the purl and the upstream repository of a component, and pins outside the repository.
- The images that Helm renders from a chart.
- Any lookup of a newer version.

## Decisions

- **Decision: One component for each place a pin is written.**
*Choice:* The list holds the same action once for each `uses:` line, so `actions/checkout` has about twenty-two components. A later step groups them by name and version. The file and line of each stay known.
*Rejected alternative:* One component for each name and version, with a list of places. It loses the line of a pin that a later step must edit, and gives a model with a list inside a record.
- **Decision: A direct Python dependency has the pin of `pyproject.toml`; `uv.lock` adds only the packages that no direct dependency names.**
*Choice:* The count of Python components equals the packages of the lock plus the groups that declare them.
*Rejected alternative:* A component for each package of `uv.lock` and one more for each declaration. It counts one pin twice.
- **Decision: Lines come from the parser when it gives one, else from the text.**
*Choice:* PyYAML nodes and tree-sitter nodes give lines. For TOML, JSON and HCL, `LineIndex` finds the line that shows the pin, and gives 0 when none does. A test over the real tree fails on a 0.
*Rejected alternative:* A TOML library that keeps positions, such as `tomlkit`. It adds a dependency for one number.
- **Decision: Read the images in the files, not the rendered ones.**
*Choice:* `image_nodes` of `devops_cli.k8s.image_pins` reads an `image` value, and the reader adds the `repository` with `tag` form of a values file.
*Rejected alternative:* Reuse the renderer of `devops k8s image-pins`. It runs `helm template --repo` and `kubectl kustomize`, which start programs and fetch charts. The acceptance criteria forbid a network request.
- **Decision: The ecosystem is `unknown` when the pin does not show it.**
*Choice:* A binary tool with a GitHub `source` is `github-release`; any other source is `unknown`. The summary counts `unknown`.
*Rejected alternative:* Drop the component. A tool that nobody can map would then be invisible.
- **Decision: A parse failure raises `InventoryError`.**
*Choice:* A file that does not parse stops the run with the file name (`RESEARCH_INVENTORY_ERROR`). A partial list would look complete.
*Rejected alternative:* Skip the file and go on. It hides a pin.
- **Decision: The MCP tool takes no argument.**
*Choice:* `--root` is not an option of the tool, so a model cannot point the reader at another path.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Proposal

## Why

Issue #3896: no tool reads all the pins of the project. `devops survey` reads `pyproject.toml` only, and `devops k8s image-pins` checks that an image exists in its registry, not what it is. Nothing lists GitHub Actions versions, Dockerfile `FROM` lines, `tools.lock` entries and chart versions in one list. A research agent cannot watch what it cannot list. This change is the first slice of the research agent: a reader that lists the pins, with no model, no network and no store.

## What Changes

- New command group `devops research` with one command, `devops research inventory`. It reads the files of a repository and prints a typed list of components. A component has a kind, an ecosystem, a name, a version, a source file and a line. `--json` and `--format yaml` print the list and a summary with the count of each kind and each ecosystem, and the count of components with the ecosystem `unknown`.
- The reader covers these files: `pyproject.toml`, `uv.lock`, the `tools.lock` of the tools and its hashed requirement and Node lock files, the Dockerfiles, the devcontainer lock, the workflows and composite actions of `.github/`, the Argo CD Applications and the YAML under `k8s/`, and the Terraform files under `tf/`.
- A component of a source that the reader cannot map to a registry (a binary tool whose source is no GitHub repository) has the ecosystem `unknown`. It stays in the list and in the count.
- The command has the `no-external-request` dry-run class and an MCP tool (`research_inventory`, read only, with no path argument).
- `devops_cli.k8s.image_pins` makes `yaml_mappings` and `yaml_scalar` public, and adds `key_line` and `image_nodes`, so the reader reuses the way that `devops k8s image-pins` reads an image. `image_values` keeps its result.
- Observable behavior changes (a command, an MCP tool, an error code), so the change carries a spec delta for the new capability `research-inventory`.
- The change fits one pull request.

## Capabilities

### New Capabilities

- `research-inventory`: The typed list of components that `devops research inventory` reads from the files of a repository.

### Modified Capabilities

None.

## Impact

- Code: `src/devops_cli/research/`, `src/devops_cli/commands/research.py`, `src/devops_cli/exceptions/research.py`, `src/devops_cli/k8s/image_pins.py`, `src/devops_cli/main.py`, `src/devops_cli/config/constants.py` (MCP exposure table), `src/devops_cli/ai/mcp/generator.py`, `src/devops_cli/lang/en/`.
- Tests: `tests/research/`, `tests/commands/test_research_inventory.py`, `tests/fixtures/research/repo/`.
- Documents: `README.md`, `docs/CLI_REFERENCE.md`, `docs/commands/research.md`, `docs/MCP_TOOLS.md` and `docs/ERRORS.md`, all generated.
- No new dependency, no network egress and no secret.
- Not in this change: the file `.devops/research-watch.toml` with the OSV mapping and the pins outside the repository, the purl and upstream repository of a component, and the images that Helm renders. Another issue holds them.

## Feasibility

- Checked on 2026-11-07 at `origin/main` b6af763b by running the reader on the real tree: 548 components in eight kinds (312 Python packages, 74 actions, 58 Node packages, 46 container images, 24 tools, 18 charts, 9 Terraform providers, 7 devcontainer features), every one with a line and a version. The Python count agrees with the design result: 98 declared dependencies plus 139 transitive packages are the 237 packages that `uv.lock` lists with the project itself left out, and 18 of the 31 Argo CD Applications pin a chart.
- Parsers are the ones that the project already ships: `tomllib`, PyYAML (composed nodes give lines), `packaging` (requirements), `python-hcl2` 8.1.4, `tree-sitter-dockerfile` through `tree-sitter` 0.26, and `docker.utils.parse_repository_tag` of docker-py for image references.
- python-hcl2 8.1.4 gives no line for an attribute: `with_meta=True` adds none for the `required_providers` block. The line is the one that opens the provider's attribute. A parser gives no line for a key of TOML or JSON either, so the line of those comes from the text.
- tree-sitter 0.26 warns that the integer language of `tree-sitter-dockerfile` 0.2.0 is deprecated. The reader silences this one warning where it loads the grammar, as `devops ai ast` loads it.
- The renderer of `devops k8s image-pins` runs `helm template --repo`, which fetches the chart. The reader must make no request, so it reads the images in the files as they stand, and the rendered images stay for the follow-up issue.

## Existing Tool Considered

Renovate extracts the same pins, but its `extract` step gives no list that code can read here and it needs a service to run. Dependabot is off for this repository. `osv-scanner` reads lock files for advisories, not workflow, image and chart pins. The reader uses `tomllib`, PyYAML, `packaging`, `python-hcl2`, tree-sitter and docker-py, which the project already depends on, and the `tools_lock` model. No new parser library is needed. The code that the change adds is the walk over eight file formats (about 600 lines with the model); it deletes no internal code.
Loading
Loading