Skip to content

feat: trim codebase, refactor abstractions, fix doc injection and project_path override - #293

Merged
mrsimpson merged 5 commits into
mainfrom
feat/feature-inventory
Sep 21, 2026
Merged

mrsimpson merged 5 commits into
mainfrom
feat/feature-inventory

Conversation

@mrsimpson

Copy link
Copy Markdown
Collaborator

Summary

Trimmed @codemcp/workflows from ~14,900 to ~10,900 LOC by removing dead features, then refactored the remaining codebase and fixed two bugs.

Changes

Dead code removal

  • Deleted packages/visualizer and the original packages/docs
  • Removed 17 dead source files: beads components, MCP resource registry, artifact-check, branch-prompt, visualization CLI, crowd workflow variants
  • Deleted 3 crowd YAMLs (sdd-feature-crowd, sdd-bugfix-crowd, sdd-greenfield-crowd)
  • Stripped dead branches from all kept files

Refactoring

  • Collapsed single-implementation interfaces (IPlanManager, IInstructionGenerator, ITaskBackendClient)
  • Removed registerMcpResources/ResourceRegistry, setTaskBackend, setStateMachine, GitCommitConfig, shadow ConversationContext, role?/collaboration/requiredRoles from state machine types
  • Deduplicated SessionMetadata, extracted ConversationStateReader interface, replaced 5 test-access methods with handleTool<T> generic

New feature: referred_docs

  • YAML phases declare referred_docs: [requirements|architecture|design]
  • InstructionGenerator.injectReferredDocs() checks file existence at runtime and prepends contextual read instructions
  • 11 of 22 workflow YAMLs updated with referred_docs; old conditional exists: sentences removed

Bug fix: project_path override

  • whats_next, proceed_to_phase, conduct_review, resume_workflow, reset_development now use project_path arg to override the server's PROJECT_PATH env var
  • Implemented via getProjectPathOverride(args) hook on ConversationRequiredToolHandler

Docs restored

  • packages/docs recreated as VitePress site with WorkflowVisualizer.vue inlined as a single SFC (~650 LOC)

Tested

  • pnpm build: zero errors
  • pnpm test: 699 passing, 0 failing
  • CLI smoke test: workflow list works, MCP server starts cleanly, 8 tools registered
  • project_path override verified via end-to-end smoke test

@mrsimpson
mrsimpson force-pushed the feat/feature-inventory branch from 50fd710 to 3713535 Compare September 21, 2026 08:42
## Intent

The package had accumulated dead features — beads, commit plugin, plugin system, MCP
resource registry, artifact-check, branch-prompt, crowd workflows, visualization CLI —
that were no longer used but still tested and maintained. Carrying them increased the
surface area for bugs, slowed down comprehension, and made the test suite harder to
trust. Removing them and collapsing the abstractions they left behind brings the
codebase down to what is actually needed.

## Key decisions

- Deleted packages/visualizer and original packages/docs rather than leaving them
  dormant — they had no consumers and would have needed ongoing maintenance.
- Collapsed IPlanManager, IInstructionGenerator, ITaskBackendClient: each had exactly
  one implementation; the interfaces added indirection with no benefit.
- Replaced five ad-hoc test-access methods with a single handleTool<T> generic to
  reduce test boilerplate without losing type safety.
- Kept all domain filtering (WORKFLOW_DOMAINS, metadata.domain) — it is used by
  non-code workflow variants and removing it would be a behaviour change.

## Side effects

- 3 crowd YAMLs deleted (sdd-feature-crowd, sdd-bugfix-crowd, sdd-greenfield-crowd)
- registerMcpResources, ResourceRegistry, setTaskBackend, setStateMachine,
  GitCommitConfig, shadow ConversationContext, role?/collaboration/requiredRoles
  removed from state machine types
- SessionMetadata deduplicated; ConversationStateReader interface extracted
- 35 previously disabled test files re-enabled; tests for deleted modules deleted
- Stray smoke-test scripts and conversation state files removed from tracked tree;
  mcp-call*.mjs and scripts/disable-tests.js added to .gitignore
## Intent

Workflows that reference project documents need to tell the agent to read those files,
but only when they actually exist. Previously this was done with $ARCHITECTURE_DOC
variables hardcoded into instruction text, which produced literal file paths regardless
of whether the file existed, and with conditional fallback prose duplicated across many
YAMLs. A declarative referred_docs field on phases replaces both: the server injects a
read instruction at runtime only when the file is present. The docs package is restored
so the visualizer is accessible again. The requiresDocumentation artifact check is also
restored after being incorrectly removed during the trim.

## Key decisions

- referred_docs is phase-level ([requirements|architecture|design]) rather than
  workflow-level, because different phases care about different documents.
- File existence is checked at runtime in injectReferredDocs() so a missing file
  silently skips the sentence instead of failing the tool call.
- $ARCHITECTURE_DOC etc. in YAML body still substitute to literal paths via
  getVariableSubstitutions() for cases where the path is needed as an output target;
  the conditional path is only used for referred_docs injection.
- WorkflowVisualizer inlined as a single SFC into packages/docs rather than keeping
  a separate packages/visualizer package — one fewer build artifact.
- All $*_DOC references removed from phase instruction text in 13 workflow YAMLs and
  replaced with plain behavioural instructions so they remain valid whether or not
  the doc exists.

## Side effects

- 11 of 22 workflow YAMLs updated with referred_docs; old "If $X exists:" sentences removed
- 13 YAMLs had $*_DOC instruction text replaced with plain instructions
- instructionSource: 'plugin_hook' added to suppress whats_next() reminder in opencode context
- start-development-artifact-detection.test.ts restored (8 tests)
- MockContextFactory.createBasicContext updated with generateWorkflowDocumentationUrl mock
- instruction-generator-referred-docs.test.ts added with regression suite
## Intent

The docs package and its companion visualizer package were deleted early in the trim.
Restoring them makes the workflow visualizer accessible again without requiring a
separate npm package. Inlining the visualizer as a self-contained Vue SFC into the
docs VitePress site removes the packages/visualizer build artifact entirely while
keeping the feature available at the docs URL.

## Key decisions

- WorkflowVisualizer inlined as a single SFC (~650 LOC) in packages/docs/.vitepress/
  rather than keeping a separate packages/visualizer package — one fewer package to
  build, version, and publish.
- Deleted stale docs pages for removed features: beads-integration, crowd-mcp-integration,
  git-commit-feature, long-term-memory (beads), dev/ directory.
- packages/docs/public/workflows/ excluded from git — the prebuild script copies from
  resources/workflows/ at build time so committing them is redundant.

## Side effects

- packages/visualizer deleted (22 files)
- packages/docs restored with updated content: WorkflowVisualizer.vue, workflow-manifest.js,
  visualizer.md page, updated nav/sidebar in config.ts
- turbo.json updated to add .vitepress/dist/** to docs build outputs
- docs:build and docs:dev scripts added to root package.json
## Intent

whats_next, proceed_to_phase, conduct_review, resume_workflow, and reset_development
all accepted a project_path argument in their schemas but silently ignored it, always
resolving the conversation via the server's PROJECT_PATH env var. This made it
impossible to use those tools against a project other than the one the server was
started for — the parameter appeared to work but had no effect.

## Key decisions

- Added a getProjectPathOverride(args) hook on ConversationRequiredToolHandler that
  returns undefined by default; handlers that accept project_path override it. This
  keeps the base class generic without requiring every handler to know about project
  paths.
- ConversationManager.getConversationContext() now accepts an optional
  projectPathOverride, consistent with the pattern already used by
  initializeConversation().

## Side effects

- project_path added to Zod schemas for all five affected tool registrations
- resetConversation() in ConversationManager updated with the same override pattern
## Intent

Three crowd workflow variants (sdd-feature-crowd, sdd-bugfix-crowd, sdd-greenfield-crowd)
were removed as part of the trim. They were left unstaged during the refactor commit by
accident — moving them into the refactor commit would require a rebase, so this finalizes
their deletion cleanly.

## Side effects

- resources/workflows/sdd-bugfix-crowd.yaml deleted
- resources/workflows/sdd-feature-crowd.yaml deleted
- resources/workflows/sdd-greenfield-crowd.yaml deleted
@mrsimpson
mrsimpson force-pushed the feat/feature-inventory branch from 3713535 to dfe8d33 Compare September 21, 2026 09:21
@mrsimpson
mrsimpson merged commit 9dd3c08 into main Sep 21, 2026
3 checks passed
@mrsimpson
mrsimpson deleted the feat/feature-inventory branch September 21, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant