Repository navigation
feat(tooling): replace bash workflow scripts with flow.py CLI #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Tooling CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| pull_request: | ||
| branches: [main, develop] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| changes: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| relevant: ${{ steps.filter.outputs.relevant }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - id: filter | ||
| uses: dorny/paths-filter@v3 | ||
| with: | ||
| filters: | | ||
| relevant: | ||
| - "scripts/**" | ||
|
|
||
| tooling-test: | ||
| needs: changes | ||
| if: needs.changes.outputs.relevant == 'true' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pytest black flake8 | ||
|
|
||
| - name: Lint | ||
| run: | | ||
| black --check scripts | ||
| flake8 --max-line-length=100 scripts | ||
|
|
||
| - name: Run tests | ||
| run: python -m pytest scripts/test_flow.py -v | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,58 @@ | ||
| # Working in this repo | ||
|
|
||
| ## Branch / issue workflow — mandatory | ||
| ## OpenSpec → issue → branch → PR — mandatory | ||
|
|
||
| Every OpenSpec task group gets its own branch and its own GitHub sub-issue, | ||
| created together by one command. Full details: `docs/development/WORKFLOW.md`. | ||
| One OpenSpec change = one GitHub parent issue. One task group = one sub-issue = | ||
| one branch = one PR. All of it runs through `scripts/flow.py`. Full details: | ||
| `docs/development/WORKFLOW.md`. | ||
|
|
||
| **Never create a branch with `git checkout -b` / `git switch -c` / `git branch` by | ||
| hand.** Always run: | ||
| There are three moments: | ||
|
|
||
| **1. After proposing a change** — create the tracking issues: | ||
|
|
||
| ``` | ||
| scripts/flow.py init <change-name> --title "<parent issue title>" | ||
| ``` | ||
|
|
||
| Creates the parent issue, folds its number into the change directory name | ||
| (`<service>-<type>-<issue>-<description>`), creates a sub-issue for **every** | ||
| task group up front, and writes the generated Tracking block into `tasks.md`. | ||
| Run it on `main` and commit the result before starting any group. | ||
|
|
||
| If `tasks.md` gains, loses, or renames a group later, re-run | ||
| `scripts/flow.py sync <change-name>` on `main` and commit that too. | ||
|
|
||
| **2. When starting a task group** — never create the branch by hand: | ||
|
|
||
| ``` | ||
| scripts/flow.py start <change-name> <group-number> | ||
| ``` | ||
|
|
||
| Moves the parent and that group to **In Progress**, then branches from a fresh | ||
| `main` as `<Service>/<type>/Issue-<sub-issue>/<description>-group<N>`. Pass | ||
| `--base <ref>` to branch from something other than `main`. | ||
|
|
||
| **Never** use `git checkout -b` / `git switch -c` / `git branch` directly. | ||
|
|
||
| **3. When opening the PR** — get the closing trailer from the branch: | ||
|
|
||
| ``` | ||
| scripts/start-group.sh <change-name> <group-number> | ||
| scripts/flow.py pr | ||
| ``` | ||
|
|
||
| This creates the sub-issue, links it under the parent issue, adds it to the | ||
| project board, and checks out a correctly-named branch: | ||
| `<Service>/<type>/Issue-<sub-issue>/<description>`. | ||
| Prints `Closes #<sub-issue>`, plus `Closes #<parent>` when every sibling group | ||
| is already closed. Put those lines at the end of the PR body — that is what | ||
| fires the board's Done automation. | ||
|
|
||
| This is enforced, not just documented: | ||
| - `.claude/hooks/block_manual_branch_creation.py` (a `PreToolUse` hook on `Bash`) | ||
| blocks manually-created branches whose name doesn't match the convention. | ||
| - `scripts/git-hooks/pre-push` refuses to push a branch with a non-conforming | ||
| name (requires `git config core.hooksPath scripts/git-hooks` — see | ||
| WORKFLOW.md §6, which also covers this hook's lint-mirroring behavior). | ||
| WORKFLOW.md §7, which also covers this hook's lint-mirroring behavior). | ||
| - `.github/workflows/branch-naming.yml` re-checks the branch name on every | ||
| push and PR as a backstop. | ||
|
|
||
| If a task genuinely doesn't fit an OpenSpec change/group (rare — e.g. a | ||
| one-off doc fix), ask the user before improvising a branch name outside the | ||
| convention. | ||
| For a ticket that isn't part of an OpenSpec change, use | ||
| `scripts/flow.py issue "<title>" "<body>"`. If such a task still needs a branch, | ||
| ask the user before improvising a name outside the convention. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.