Skip to content

Commit b188491

Browse files
brovattenclaude
andcommitted
refactor: act on the structure/naming review
Addresses the high-level review's findings — internal legibility, not behavior (review mode output is unchanged): - rename scripts/cb_engine.py -> scripts/engine_adapter.py (+ test file): it is a thin CLI adapter over the separate CodeBoarding engine, not the engine; the old name implied analysis logic lived here. Docstring now says so up front. - dedupe the incremental-or-full path: review 'head' and sync 'analyze' shared ~90% logic (try incremental, fall back to full on the same two exceptions); both now call one _incremental_or_full helper, so a fallback fix lands once. - move baseline parsing into the adapter: new 'baseline-info' subcommand emits commit_hash= only when present and SHA-shaped, replacing the sync_seed step's inline python heredoc + grep with one tested code path. - add a 'force_full' input (sync mode) that rebuilds the baseline from scratch, and RETIRE refresh-baseline.yml: it was a 198-line hand-rolled copy of the action's own pipeline. Its 'fresh full rebuild' is now codeboarding-sync.yml's workflow_dispatch + force_full, running the tested action instead of a clone. - structure legibility: a top-of-file phase map (guard / shared setup / analysis-with-key / drop-key + output) naming the shared analysis.json baseline as the binding between the two modes; review-only inputs now carry a 'Review mode:' prefix so the Marketplace-rendered view matches the README. - refresh AGENT.md (was review-only) to describe both modes; document force_full. 93 tests pass (both module orders); actionlint, shellcheck, black clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 8647666 commit b188491

10 files changed

Lines changed: 359 additions & 368 deletions

File tree

.github/workflows/codeboarding-sync.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Dogfood sync mode: sync THIS repo's committed architecture baseline
2-
# (analysis.json + docs) on every push to main, keeping the
3-
# baseline the PR review workflow diffs against current. This supersedes the
4-
# manual refresh-baseline.yml for routine freshness; that workflow stays as a
5-
# manual escape hatch for an on-demand, from-scratch baseline rebuild.
1+
# Dogfood sync mode: keep THIS repo's committed architecture baseline
2+
# (.codeboarding/analysis.json + rendered docs) current on every push to main,
3+
# so the PR review workflow always diffs against an up-to-date baseline.
4+
#
5+
# This is the ONLY baseline writer for this repo. The manual "rebuild from
6+
# scratch" path (previously a separate refresh-baseline.yml) is now the
7+
# workflow_dispatch + force_full input below, which runs the same tested action
8+
# instead of a hand-rolled copy of its pipeline.
69

710
name: CodeBoarding sync
811

@@ -12,22 +15,27 @@ on:
1215
# Don't re-trigger on the files this workflow itself commits. Deliberately
1316
# NOT '.codeboarding/**': that would also swallow pushes that only edit the
1417
# user-authored .codeboarding/.codeboardingignore, which changes analysis
15-
# scope and should regenerate the docs.
18+
# scope and should regenerate the baseline.
1619
paths-ignore:
1720
- '.codeboarding/*.md'
1821
- '.codeboarding/analysis.json'
1922
- '.codeboarding/codeboarding_version.json'
2023
- '.codeboarding/health/**'
2124
- 'docs/development/architecture.md'
2225
workflow_dispatch:
26+
inputs:
27+
force_full:
28+
description: 'Ignore the committed baseline and rebuild it from scratch (full analysis).'
29+
type: boolean
30+
required: false
31+
default: false
2332

2433
permissions:
25-
contents: write # commit the generated docs to the branch
34+
contents: write # commit the generated baseline + docs to main
2635

2736
concurrency:
28-
# Shared with refresh-baseline.yml: both commit .codeboarding/analysis.json
29-
# to main and must never run concurrently (refresh-baseline's plain `git
30-
# push` hard-fails on non-fast-forward).
37+
# Serialize this workflow against itself: a push landing while a manual
38+
# dispatch is mid-run must not produce two concurrent commits to main.
3139
group: codeboarding-baseline-writers
3240
cancel-in-progress: false
3341

@@ -44,4 +52,5 @@ jobs:
4452
- uses: ./
4553
with:
4654
mode: sync
55+
force_full: ${{ inputs.force_full || false }}
4756
llm_api_key: ${{ secrets.OPENROUTER_API_KEY }}

.github/workflows/refresh-baseline.yml

Lines changed: 0 additions & 197 deletions
This file was deleted.

AGENT.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# AGENT.md — CodeBoarding-action
22

3-
This repo is a GitHub Action that gives pull requests a visual system-design
4-
review: it analyzes the PR with the CodeBoarding engine and posts a diagram of
5-
the added, modified, and removed components as a PR comment. The engine
6-
(`CodeBoarding/CodeBoarding`) is pinned to a release in `action.yml`; engine
7-
changes reach users only when that pin is bumped *and* a new action release
8-
ships.
3+
This repo is a GitHub Action with two modes, selected by the `mode` input:
4+
5+
- **`mode: review`** (default): analyzes a PR with the CodeBoarding engine and
6+
posts a Mermaid diagram of the added, modified, and removed components as a PR
7+
comment (runs on `pull_request` / `issue_comment`).
8+
- **`mode: sync`**: on push to a branch, regenerates the architecture and commits
9+
the versioned baseline (`.codeboarding/analysis.json` + rendered markdown) back
10+
to the branch, so review mode always diffs against a current baseline.
11+
12+
The action is a thin orchestration wrapper, not the analysis engine: the engine
13+
(`CodeBoarding/CodeBoarding`) is a separate repo checked out at runtime and
14+
pinned to a release in `action.yml`. `scripts/engine_adapter.py` is the CLI
15+
adapter into it (no analysis logic lives there). Engine changes reach users only
16+
when that pin is bumped *and* a new action release ships.
917

1018
## Releases
1119

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ Be aware that `contents: write` is repo-wide — GitHub does not scope it to a b
252252
| `target_branch` | sync | `${{ github.ref_name }}` | Branch the generated docs are pushed to. |
253253
| `write_architecture_md` | sync | `true` | Also write `docs/development/architecture.md`: all rendered pages concatenated, `overview.md` first. |
254254
| `commit_message` | sync | `chore(codeboarding): sync architecture baseline [skip ci]` | Commit message for the generated docs. |
255+
| `force_full` | sync | `false` | Ignore any committed baseline and run a full analysis from scratch. Use to rebuild a stale or corrupt baseline (e.g. from a `workflow_dispatch`). |
255256

256257
## Outputs
257258

0 commit comments

Comments
 (0)