Skip to content

refactor: extract detect-state workflow from project.md (#135)#149

Merged
snipcodeit merged 3 commits intomainfrom
issue/135-extract-detect-state-md-workflow-from-project-md
Mar 2, 2026
Merged

refactor: extract detect-state workflow from project.md (#135)#149
snipcodeit merged 3 commits intomainfrom
issue/135-extract-detect-state-md-workflow-from-project-md

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Extracted the 5-signal state detection logic (~178 lines) from commands/project.md into a new standalone reusable workflow at workflows/detect-state.md
  • The extracted workflow is self-contained with explicit input/output contracts documented at the top — readable without project.md context
  • commands/project.md now delegates to the workflow via @workflows/detect-state.md at the detect_state step location

Closes #135

Milestone Context

  • Milestone: v3.5 — Foundation Hardening
  • Phase: 33 — project.md Decomposition
  • Issue: 3 of 9 in milestone

Changes

  • workflows/detect-state.md — new file (222 lines): contains the extracted detect_state logic with <purpose> header, Input Contract table, Output Contract table, Five Signals table, Six State Classes table, and the full classification + routing code blocks
  • commands/project.md — modified: removed 179 lines of inline detect_state body, replaced with 1-line @workflows/detect-state.md reference; line count reduced from 1979 to 1801 (-178 lines)

Test Plan

  • Confirm workflows/detect-state.md exists at repo root (not inside commands/)
  • Confirm workflows/detect-state.md contains all five signals (P, R, S, M, G), all six STATE_CLASS values, and both the classification and routing code blocks
  • Confirm commands/project.md at line 66-68 shows <step name="detect_state"> containing only @workflows/detect-state.md with no inline logic
  • Confirm commands/project.md line count is ~1801 (down from 1979, reduction of ~178 lines)
  • Confirm workflows/ directory is tracked in git (git ls-files workflows/)
  • Confirm the extracted workflow is self-contained: read workflows/detect-state.md in isolation — all variables, signal names, state classes, and routing branches should be fully understandable without reference to project.md

🤖 Generated with Claude Code

Stephen Miller and others added 3 commits March 1, 2026 22:28
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

slash-commands Changes to slash command files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract detect-state.md workflow from project.md

1 participant