refactor: extract detect-state workflow from project.md (#135)#149
Merged
snipcodeit merged 3 commits intomainfrom Mar 2, 2026
Merged
Conversation
Add comprehensive unit tests for all 10 exported functions in lib/github.cjs using node:test built-in runner with execSync mocked via module cache invalidation — no real gh CLI calls made. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds test/state.test.cjs with 44 unit tests covering all 9 exported functions in lib/state.cjs using node:test + node:assert/strict (zero new dependencies). Critical schema-evolution paths — migrateProjectState idempotency and resolveActiveMilestoneIndex new-vs-legacy schema precedence — are tested first. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the 5-signal state detection logic (~178 lines) out of commands/project.md into a standalone reusable workflow at workflows/detect-state.md. The new file includes input/output contract documentation and is self-contained without project.md context. commands/project.md now delegates via @workflows/detect-state.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 2, 2026
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
commands/project.mdinto a new standalone reusable workflow atworkflows/detect-state.mdcommands/project.mdnow delegates to the workflow via@workflows/detect-state.mdat thedetect_statestep locationCloses #135
Milestone Context
Changes
workflows/detect-state.md— new file (222 lines): contains the extracteddetect_statelogic with<purpose>header, Input Contract table, Output Contract table, Five Signals table, Six State Classes table, and the full classification + routing code blockscommands/project.md— modified: removed 179 lines of inline detect_state body, replaced with 1-line@workflows/detect-state.mdreference; line count reduced from 1979 to 1801 (-178 lines)Test Plan
workflows/detect-state.mdexists at repo root (not insidecommands/)workflows/detect-state.mdcontains all five signals (P, R, S, M, G), all six STATE_CLASS values, and both the classification and routing code blockscommands/project.mdat line 66-68 shows<step name="detect_state">containing only@workflows/detect-state.mdwith no inline logiccommands/project.mdline count is ~1801 (down from 1979, reduction of ~178 lines)workflows/directory is tracked in git (git ls-files workflows/)workflows/detect-state.mdin isolation — all variables, signal names, state classes, and routing branches should be fully understandable without reference to project.md🤖 Generated with Claude Code