| title | Architecture |
|---|---|
| generator | method sync refs |
| provenance_level | artifact_history |
METHOD is a TypeScript CLI and library that implements the METHOD development workflow. It follows a hexagonal architecture: domain logic in the core, adapters for external systems, and a thin CLI shell.
src/
adapters/
github.ts
types/
git-stunts-plumbing.d.ts
cli-args.ts
cli-renderer.ts
cli.ts
config.ts
cycle-ops.ts
doctor.ts
domain.ts
drift.ts
errors.ts
feedback-surface.ts
frontmatter.ts
generate.ts
index.ts
mcp.ts
renderers.ts
review-state.ts
workspace-commands.ts
workspace-utils.ts
The Workspace class is the core. It owns:
- Backlog operations:
captureIdea,pullItem,moveBacklogItem - Cycle lifecycle:
closeCycle,openCycles,captureWitness - Drift detection:
detectDrift(delegates todrift.ts) - Reference sync:
syncRefs(refreshes generated reference docs without touching ship-only artifacts) - Ship sync:
shipSync(updates CHANGELOG and BEARING) - Status:
status(backlog lanes, active cycles, legend health)
All paths are resolved from this.config.paths, which is configurable
via .method.json. The initWorkspace function scaffolds directories
and placeholder files.
Defines the core vocabulary: Lane, Cycle, BacklogItem, Outcome,
WorkspaceStatus, LegendHealth. Uses Zod for runtime validation.
Loads .method.json from the workspace root. Supports:
paths— configurable directory layout (backlog, design, retro, tests, graveyard, method_dir)github_token/github_repo— GitHub adapter credentials- Environment variable overrides (
GITHUB_TOKEN,GITHUB_REPO)
All path fields have defaults matching the standard METHOD layout.
Compares playback questions from active cycle design docs against test
descriptions extracted from it() / test() calls. Uses exact
normalized matching with near-miss hints (Jaccard token similarity)
for close-but-not-exact matches.
Dispatches commands parsed by cli-args.ts. The runCli function
accepts injectable I/O for testing. The entry point guard uses
realpathSync to handle npm-linked symlinks.
Exposes METHOD tools over the Model Context Protocol (stdio transport).
Every tool requires a workspace parameter — the absolute path to the
METHOD workspace root. A single MCP server instance can serve multiple
projects.
Two-way sync between the local backlog and GitHub Issues:
- Push: Creates or updates GitHub issues from local backlog files.
Strips
## GitHub Commentsbefore sending to avoid mirroring. - Pull: Updates local files with remote labels, comments, and status. Moves closed issues to the graveyard.
docs/CLI.md— CLI command reference (hybrid generated).docs/MCP.md— MCP tool reference (hybrid generated).
23 test files in tests/ using Vitest:
api.test.tsbuild.test.tsci.test.tscli.test.tsconfig.test.tsdocs.test.tsdoctor.test.tsdomain.test.tsdrift.test.tsexec.test.tsfrontmatter.test.tsgenerate.test.tsgithub-adapter.test.tslane-contract.test.tsmcp.test.tsmigrate-backlog-to-github-issues.test.tspackage.test.tsrepo-discipline.test.tsreview-state-exec.test.tsreview-state.test.tsship-sync.test.tswitness.test.tsworkspace-split.test.ts
Each test file creates temp workspaces via mkdtempSync and cleans
up in afterEach. The METHOD_TEST=true environment variable mocks
shell command execution during witness capture.
@flyingrobots/bijou@flyingrobots/bijou-node@git-stunts/plumbing@modelcontextprotocol/sdkyamlzod