Thread TStateName through platform + rewrite consumer CLI#10
Merged
Conversation
…neCommands Platform changes: - BaseWorkflowState<TStateName> generic replaces string state names in core - WorkflowFactory/WorkflowEngine thread TStateName + TOperation generics - New CLI module: defineCommands, createWorkflowRunner, arg helpers, hook schemas - CommandDefinition is a discriminated union — handler only on transaction type - New recording-ops module for gate-checked workflow operations - parseStateName on factory for edge-to-core string narrowing Consumer changes: - WorkflowState.currentStateMachineState narrowed to StateName - WorkflowAdapter implements full generic factory interface - CLI entry point rewritten from 371 to 249 lines using platform runner - 16 handler functions replaced with declarative command definitions - Event schemas validate StateName at Zod boundary - All test fixtures updated with strong StateName types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te fixtures Decompose the 240-line entry point into focused modules: - Rename autonomous-claude-agent-team-workflow.ts → entrypoint.ts - Extract hook handling → src/hook-routes.ts (uses platform Zod schemas) - Extract analytics/view-report → src/analytics/cli-routes.ts - Remove consumer parse functions from hook-io.ts (replaced by platform schemas) - Consolidate duplicated test fixtures across 3 spec files into shared imports - Entry point now ~80 lines with 4 clear routing paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…th defineCommands Platform changes: - Add preToolUseHandler to WorkflowRunnerConfig for engine-level PreToolUse hooks - Add RunnerOptions with getSessionId injection (removes session-id from route args) - Move formatDenyDecision/formatContextInjection to platform hook-output module - Add PlatformContext type for createWorkflowCli dep assembly Consumer changes: - Extract PreToolUse logic into pre-tool-use-handler.ts - Replace 5 hand-written recording methods with defineRecordingOps + executeRecording - Replace ad-hoc narrowing with Zod-based parseNumber/parseString/parseStringArray - Delete hook-routes.ts, composition-root.ts, hook-io.ts (replaced by platform) - Relocate all entrypoint files to src/workflow-definition/entrypoint/ - Shorten verbose spec/fixture filenames Net -1382 lines. All 1326 tests pass, 100% coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move git, github, linter, arg-parsing, workflow-error to workflow-definition/infra/ - Move analytics CLI routes to workflow-analysis/entrypoint/ - Create src/shell.ts as process boundary and top-level router - Delete src/infra/ entirely (environment + stdin absorbed into shell, state-store deleted as dead code) - Decouple workflow-definition from workflow-analysis (shell.ts routes between them) - Export WorkflowError from workflow-definition barrel for cross-module use - Update depcruiser rules for new module structure - hooks.json now points to src/shell.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
BaseWorkflowState<TStateName>generic threads strong state name types throughWorkflowFactory,WorkflowEngine, andrecording-ops— eliminatingstringfrom the coredefineCommands/createWorkflowRunnerwith discriminated unionCommandDefinition(handler only required ontransactiontype, nottransition/session-start)WorkflowState.currentStateMachineStatenarrowed fromstringtoStateName, event schemas validate at Zod boundary49 files changed, +2237 −703. 100% test coverage, all 1283 tests pass.
Test plan
pnpm typecheck— nostringwhereTStateNameshould bepnpm test— 1283 tests pass, 100% coverage (statements, branches, functions, lines)pnpm lint— cleanpnpm deps— no dependency rule violationspnpm knip— no unused exports🤖 Generated with Claude Code