Skip to content

Commit 1113eff

Browse files
committed
feat(orchestrator): rename flags, add glab support, multi-repo resolution
Rename user-facing flags for clarity: --repo → --source-code-repo, --repo-path → --docs-repo-path. Orchestrator maps these to internal step-skill flags (--repo, --repo-path) automatically. Add glab CLI support for GitLab MR resolution via glab mr view with GITLAB_HOST set per-instance. Remove GitLab limitation follow-on work. Resolve all discovered repos equally (both explicit --pr and scan-requirements paths) instead of picking the repo with the most PRs. Multi-repo clones go to code-repo/<name>/ subdirectories. Expand Parse arguments descriptions with propagation details, defaults, and precedence rules. Co-Authored-By: Claude Opus 4.6 <[email protected]> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent 1af1254 commit 1113eff

4 files changed

Lines changed: 177 additions & 111 deletions

File tree

plugins/docs-tools/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs-tools",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"description": "Documentation review, writing, and workflow tools for Red Hat AsciiDoc and Markdown documentation.",
55
"author": {
66
"name": "Red Hat Documentation Team",

plugins/docs-tools/skills/docs-orchestrator/SKILL.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: docs-orchestrator
33
description: Documentation workflow orchestrator. Reads the step list from .claude/docs-workflow.yaml (or the plugin default). Runs steps sequentially, manages progress state, handles iteration and confirmation gates. Claude is the orchestrator — the YAML is a step list, not a workflow engine.
44

5-
argument-hint: <ticket> [--workflow <name>] [--pr <url>]... [--repo <url-or-path>] [--mkdocs] [--draft] [--repo-path <path>] [--create-jira <PROJECT>]
5+
argument-hint: <ticket> [--workflow <name>] [--pr <url>]... [--source-code-repo <url-or-path>] [--mkdocs] [--draft] [--docs-repo-path <path>] [--create-jira <PROJECT>]
66

77
allowed-tools: Read, Write, Glob, Grep, Edit, Bash, Skill, AskUserQuestion
88
---
@@ -35,7 +35,7 @@ fi
3535
1. If `JIRA_API_TOKEN` is still unset:
3636
- In interactive mode: **STOP** and ask the user to set it in `~/.env`
3737
- In headless mode (no user interaction available, e.g., ACP): log a warning and continue — agents will use `~/.env` credentials for JIRA access (populated by `setup.sh`)
38-
2. Warn (don't stop) if `GITHUB_TOKEN` or `GITLAB_TOKEN` are unset
38+
2. Warn (don't stop) if `GITHUB_TOKEN` or `GITLAB_TOKEN` are unset. Check that `gh` and `glab` CLIs are available — warn if either is missing
3939
3. Check that `uv` is available (needed by the code-evidence step to manage the `code-finder` dependency):
4040
```bash
4141
command -v uv >/dev/null 2>&1
@@ -51,14 +51,13 @@ bash ${CLAUDE_SKILL_DIR}/scripts/setup-hooks.sh
5151
## Parse arguments
5252

5353
- `$1` — JIRA ticket ID (required). If missing, STOP and ask the user.
54-
- `--workflow <name>` — Use `.claude/docs-<name>.yaml` instead of `docs-workflow.yaml`
55-
- `--pr <url>` — PR/MR URLs (repeatable, accumulated into a list)
56-
- `--mkdocs` — Use Material for MkDocs format instead of AsciiDoc
57-
- `--draft` — Write documentation to a staging area instead of directly into the repo. When set, the writing step uses DRAFT placement mode (no framework detection, no branch creation). Without this flag, UPDATE-IN-PLACE is the default
58-
59-
- `--repo-path <path>` — Target repository for UPDATE-IN-PLACE mode. The docs-writer agent explores this directory for framework detection and writes files there, instead of writing to the repository at the current working directory. **Precedence**: if both `--repo-path` and `--draft` are passed, `--repo-path` wins — log a warning and ignore `--draft`
60-
- `--repo <url-or-path>` — Source code repository. Can be a local path or a remote URL (https://, git@, ssh://). When provided without `--pr`, enables repo-driven documentation mode where the entire repo (or scoped subdirectories) is the subject matter. When provided alongside `--pr`, the PR branch is checked out within the provided repo.
61-
- `--create-jira <PROJECT>` — Create a linked JIRA ticket in the specified project
54+
- `--workflow <name>` — Use `.claude/docs-<name>.yaml` instead of `docs-workflow.yaml`. Allows running alternative pipelines (e.g., writing-only, review-only). Falls back to the plugin default at `skills/docs-orchestrator/defaults/docs-workflow.yaml` if no project-level YAML exists
55+
- `--pr <url>` — PR/MR URLs (repeatable, accumulated into a list). Accepts GitHub PRs (`gh` CLI) and GitLab MRs (`glab` CLI). Used both as requirements input (agent reads diffs/descriptions) and for source repo resolution (repo URL and branch derived from the first PR/MR). When multiple PRs from different repos are provided, all repos are resolved and treated equally as source material
56+
- `--mkdocs` — Use Material for MkDocs format instead of AsciiDoc. Propagates to the writing step (generates `.md` with MkDocs front matter) and style-review step (applies Markdown-appropriate rules). Sets `options.format` to `"mkdocs"` in the progress file
57+
- `--draft` — Write documentation to the staging area (`.claude/docs/<ticket>/writing/`) instead of directly into the repo. Uses DRAFT placement mode: no framework detection, no file placement into the target repo. Without this flag, UPDATE-IN-PLACE is the default
58+
- `--docs-repo-path <path>` — Target documentation repository for UPDATE-IN-PLACE mode. The docs-writer explores this directory for framework detection (Antora, MkDocs, Docusaurus, etc.) and writes files there instead of the current working directory. Propagates to `prepare-branch`, `writing`, `commit`, and `create-mr` steps (mapped to their internal `--repo-path` flag). **Precedence**: if both `--docs-repo-path` and `--draft` are passed, `--docs-repo-path` wins — log a warning and ignore `--draft`
59+
- `--source-code-repo <url-or-path>` — Source code repository for code evidence and requirements enrichment. Accepts remote URLs (https://, git@, ssh:// — shallow-cloned to `.claude/docs/<ticket>/code-repo/`) or local paths (used directly). Passed to requirements, code-evidence, and writing steps (mapped to their internal `--repo` flag). Without `--pr`, the entire repo is the subject matter; with `--pr`, the PR branch is checked out so code-evidence reflects the PR's state. Takes highest priority in source resolution, overriding `source.yaml` and PR-derived URLs
60+
- `--create-jira <PROJECT>` — Create a linked JIRA ticket in the specified project after the planning step completes. Activates the `create-jira` workflow step (guarded by `when: create_jira_project`). Requires `JIRA_API_TOKEN` to be set
6261

6362
## Resolve source repository
6463

@@ -79,9 +78,9 @@ python3 ${CLAUDE_SKILL_DIR}/scripts/resolve_source.py \
7978

8079
The script checks sources in priority order:
8180

82-
1. **CLI `--repo` flag** — clone or verify the path
81+
1. **CLI `--source-code-repo` flag** — clone or verify the path
8382
2. **Per-ticket `source.yaml`** — read and apply existing config
84-
3. **PR-derived** — resolve repo URL and branch from `--pr` via `gh pr view`
83+
3. **PR-derived** — resolve repo URL and branch from `--pr` via `gh pr view` or `glab mr view`
8584
4. **No source** — exit code 2, defer resolution until after requirements
8685

8786
The script outputs JSON to stdout:
@@ -104,7 +103,7 @@ The script outputs JSON to stdout:
104103
| 1 | `error` | **STOP** with the error `message` from the JSON |
105104
| 2 | `no_source` | Mark steps with `when: has_source_repo` as `deferred`. Source resolution will be retried after requirements (see [Post-requirements source resolution](#post-requirements-source-resolution)) |
106105

107-
If `discovered_repos` is present in the result (multiple repos found during scan), log which repo was auto-selected and list the others.
106+
If `discovered_repos` is present in the result (multiple repos found), log all resolved repos. If `additional_repos` is present, record them in the progress file alongside the primary source. If `warnings` is present, log each warning.
108107

109108
### Per-ticket source config schema
110109

@@ -143,7 +142,7 @@ Read the YAML file and extract the ordered step list. Each step has: `name`, `sk
143142

144143
- `when: create_jira_project` → run this step only if `--create-jira` was passed
145144
- `when: has_source_repo` → evaluation depends on timing:
146-
- If a source repo was already resolved pre-flight (via `--repo`, `--pr`, or `source.yaml`) → step runs normally (`pending`)
145+
- If a source repo was already resolved pre-flight (via `--source-code-repo`, `--pr`, or `source.yaml`) → step runs normally (`pending`)
147146
- If no source is resolved yet but post-requirements discovery is possible (case 4 above) → mark the step `deferred` (not `skipped`). The orchestrator re-evaluates after requirements completes
148147
- After post-requirements resolution: `deferred` steps become `pending` (source found) or `skipped` (no source found)
149148
- Steps with no `when` always run
@@ -203,7 +202,8 @@ Use this absolute `BASE_PATH` for the progress file's `base_path` field and for
203202
```
204203
.claude/docs/proj-123/
205204
source.yaml (per-ticket source config, if applicable)
206-
code-repo/ (cloned source repo, if applicable)
205+
code-repo/ (single repo: flat clone; multi-repo: subdirs)
206+
<repo-name>/ (only when multiple repos are resolved)
207207
requirements/
208208
requirements.md
209209
planning/
@@ -254,7 +254,8 @@ The `workflow_type` field and filename prefix match the YAML's `workflow.name`.
254254
"draft": false,
255255
"create_jira_project": null,
256256
"pr_urls": [],
257-
"source": null
257+
"source": null,
258+
"additional_sources": []
258259
},
259260
"step_order": ["requirements", "planning", "writing", ...],
260261
"steps": {
@@ -315,7 +316,7 @@ Run steps in the order defined by the YAML. For each step:
315316

316317
### Construct arguments
317318

318-
Build the args string for the step skill:
319+
Build the args string for the step skill. The orchestrator maps its user-facing flags to the internal flags that step skills expect: `--source-code-repo``--repo`, `--docs-repo-path``--repo-path`.
319320

320321
1. **Always**: `<ticket> --base-path <base_path>` — the ticket ID and the **absolute** base output path
321322
2. **If source repo is resolved**: `--repo <repo_path>` — passed to steps that can use it
@@ -356,21 +357,21 @@ python3 ${CLAUDE_SKILL_DIR}/scripts/resolve_source.py \
356357
--scan-requirements
357358
```
358359

359-
The script scans `requirements.md` for GitHub/GitLab PR/MR URLs, groups them by repo, selects the repo with the most PRs, resolves the branch via `gh pr view`, clones, and writes `source.yaml`.
360+
The script scans `requirements.md` for GitHub/GitLab PR/MR URLs, groups them by repo, resolves all repos equally (via `gh pr view` or `glab mr view`), clones each into `code-repo/<name>/`, and writes `source.yaml` for the primary repo.
360361

361362
### 2. Handle the result
362363

363364
| Exit code | `status` | Action |
364365
|---|---|---|
365-
| 0 | `resolved` | Record `options.source` in the progress file. Update all `deferred` steps to `pending`. If `discovered_repos` has multiple entries, log which was auto-selected |
366-
| 1 | `error` / `clone_failed` | Log a warning: "Could not clone `<repo_url>`. Code-evidence will be skipped. To retry, run with `--repo <url-or-local-path>`." Update all `deferred` steps to `skipped` |
366+
| 0 | `resolved` | Record `options.source` in the progress file (primary repo + any `additional_repos`). Update all `deferred` steps to `pending`. Log all resolved repos |
367+
| 1 | `error` / `clone_failed` | Log a warning: "Could not clone `<repo_url>`. Code-evidence will be skipped. To retry, run with `--source-code-repo <url-or-local-path>`." Update all `deferred` steps to `skipped` |
367368
| 2 | `no_source` | Skip code-evidence (see below) |
368369

369370
### 3. No source found
370371

371372
When the script returns `no_source`, skip code-evidence without prompting.
372373

373-
Update all `deferred` steps to `skipped` and continue without code-evidence. Log: "No source code repository or PR discovered. Skipping code-evidence. To enable it, re-run with `--repo <url-or-path>` or `--pr <url>`."
374+
Update all `deferred` steps to `skipped` and continue without code-evidence. Log: "No source code repository or PR discovered. Skipping code-evidence. To enable it, re-run with `--source-code-repo <url-or-path>` or `--pr <url>`."
374375

375376
## Technical review iteration
376377

@@ -399,7 +400,7 @@ Before running the `commit` step, check whether this is an interactive session:
399400
- If `artifacts/.setup-complete` exists (ACP/headless mode): proceed without confirmation
400401
- Otherwise (interactive/local mode): **ask the user to confirm** before committing. Show:
401402
- The target branch name
402-
- The repository being committed to (current directory or `--repo-path`)
403+
- The repository being committed to (current directory or `--docs-repo-path`)
403404
- The number of files in the writing manifest
404405

405406
If the user declines, mark the `commit` step as `skipped` and also skip the `create-mr` step (its input dependency is unsatisfied).
@@ -440,7 +441,7 @@ Same as new session. The progress file shows which steps completed and which fai
440441

441442
### Requirements-analyst agent: repo-aware analysis
442443

443-
When `--repo` is passed to the requirements step, the `requirements-analyst` agent should use the repo to enrich its analysis. This is **not yet implemented** — the requirements step currently accepts `--repo` but the agent does not act on it. Future work:
444+
When `--source-code-repo` is passed to the requirements step, the `requirements-analyst` agent should use the repo to enrich its analysis. This is **not yet implemented** — the requirements step currently accepts `--source-code-repo` but the agent does not act on it. Future work:
444445

445446
- Scan the repo's `README.md`, `CHANGELOG.md`, and `docs/` directory for existing documentation
446447
- Note what documentation already exists and what gaps remain (feeds directly into the planning step's gap analysis)
@@ -450,6 +451,3 @@ When `--repo` is passed to the requirements step, the `requirements-analyst` age
450451

451452
This work requires changes to the `requirements-analyst` agent definition (`agents/requirements-analyst.md`), not just the step skill.
452453

453-
### GitLab MR resolution
454-
455-
`resolve_source.py` discovers GitLab MRs during requirements scanning but cannot resolve them automatically — `gh pr view` is GitHub-only. When only GitLab MRs are found, the script returns `no_source` with a message prompting the user to provide `--repo` manually. Future work: add `glab` CLI support or GitLab API integration for automatic MR resolution.

0 commit comments

Comments
 (0)