Skip to content

feat: initialize TypeScript monorepo with pnpm workspaces - #30

Merged
agentic-sdlc-loth[bot] merged 1 commit into
mainfrom
dev-agent/claudecode/ecs-run-1772505178113-tecmrj
Mar 3, 2026
Merged

feat: initialize TypeScript monorepo with pnpm workspaces#30
agentic-sdlc-loth[bot] merged 1 commit into
mainfrom
dev-agent/claudecode/ecs-run-1772505178113-tecmrj

Conversation

@agentic-sdlc-loth

Copy link
Copy Markdown

Closes #2

Summary

  • Created pnpm-workspace.yaml listing packages/* as workspace packages
  • Added root package.json with build, test, lint, and clean scripts; targets Node.js 20+
  • Added tsconfig.base.json with strict TypeScript settings (strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes), ES2022 target, Node16 module/moduleResolution
  • Added root tsconfig.json with project references to all four packages
  • Configured ESLint 9 (flat config) with typescript-eslint for consistent code style
  • Configured Vitest 3 with per-project test configuration (test.projects)
  • Scaffolded four packages under packages/: core, lambdas, worker, cdk, each with package.json, tsconfig.json, and src/index.ts barrel export
  • lambdas, worker, and cdk depend on @auto-graph/core via workspace:* and TypeScript project references
  • Created executable bootstrap.sh that installs pnpm if missing, then runs pnpm install and pnpm build
  • Added .gitignore excluding node_modules/, dist/, .turbo/, and *.tsbuildinfo

Test plan

  • pnpm install completes without errors
  • pnpm build compiles all four packages successfully via tsc --build
  • pnpm test runs and exits 0 (no tests yet, --passWithNoTests flag)
  • pnpm lint runs without errors on scaffold code
  • TypeScript strict mode enforced across all packages
  • bootstrap.sh is executable (chmod +x)

🤖 Generated with Claude Code

Set up the root monorepo structure for Auto-Graph with pnpm workspaces
containing four packages: @auto-graph/core, @auto-graph/lambdas,
@auto-graph/worker, and @auto-graph/cdk.

- Add pnpm-workspace.yaml listing packages/*
- Configure shared tsconfig.base.json with strict mode, ES2022 target,
  Node16 module resolution, noUncheckedIndexedAccess, and exactOptionalPropertyTypes
- Add root tsconfig.json with project references for all four packages
- Configure ESLint 9 with typescript-eslint flat config
- Configure Vitest 3 with per-package test projects
- Add bootstrap.sh (executable) that installs pnpm and runs install+build
- Each package has package.json (name, version, main, types, exports),
  tsconfig.json extending the base, and a src/index.ts barrel export
- lambdas, worker, and cdk packages reference @auto-graph/core via
  workspace:* dependency and TypeScript project references
- Root scripts: build (pnpm -r run build), test (vitest run --passWithNoTests),
  lint (eslint packages/*/src), clean (pnpm -r run clean)
- .gitignore excludes node_modules/, dist/, .turbo/, *.tsbuildinfo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@agentic-sdlc-loth

Copy link
Copy Markdown
Author

Approved — All acceptance criteria met. Monorepo scaffolding is correctly structured with pnpm workspaces, four packages, TypeScript project references, ESLint, and Vitest. Minor note: spec says vitest.workspace.ts but PR uses vitest.config.ts with projects — functionally equivalent in Vitest v3, but future tasks may reference the workspace file name.

@agentic-sdlc-loth
agentic-sdlc-loth Bot merged commit 0047190 into main Mar 3, 2026
1 check passed
tdrml added a commit that referenced this pull request May 9, 2026
…#93)

* feat: gate editor criteria on projectType (fiction vs non-fiction)

The editor was running the same fiction-tuned criteria against non-fiction
prose. Observed signal from the Phoenix Three book run (issue #30) showed
the editor demanding "scene-grade rendering" and "close-third character
beats" on prose constrained to public record — putting the reviser in an
impossible bind: either fabricate (which the editor would also flag) or
stay analytical (which the editor would call "all summary, no scene").
The fight drove 4-5 review rounds per chapter.

This adds a projectType gate to buildEditorPrompt:
- Optional projectType param defaults to fiction behavior (existing tests
  still pass with no change).
- NOVEL / NOVELLA / SHORT_STORY_COLLECTION go through buildFictionCriteria,
  which keeps the existing scene-structure / character-voice / subtext /
  climax-execution criteria.
- NON_FICTION goes through buildNonFictionCriteria, which:
  - Drops scene-grade demands explicitly ("do NOT demand scene-grade
    rendering or show-vs-tell beats here").
  - Replaces "Character Voice" with "Subject Fidelity" (real-people
    rendering from public record; quotes verbatim from citable sources).
  - Replaces "Pacing and Scene Structure" with "Argument and Flow"
    (claim / evidence / implication for analytical prose).
  - Promotes SOURCING to a CRITICAL primary criterion with four
    explicit sub-classes: FABRICATION, CITATION, HEDGING,
    UNSOURCED SPECIFIC. Each names the fix action.
  - Reframes CONTINUITY as factual continuity (date math, tenure,
    organizational structure, direction-of-time errors).
  - Reference-Materials section also reframes per genre.

Shared scaffolding stays identical: header, style guide, continuity
state injection, output format (severity + confidence tags),
verdict-via-gh-pr-review, self-owned-PR fallback, instructions, guard
rails. The category list also swaps:
- Fiction: PLOT, CHARACTER, PACING, WORD_COUNT, STYLE, PROSE, CONTINUITY
- Non-fiction: PLOT, SOURCING, SUBJECT, ARGUMENT, WORD_COUNT, STYLE,
  PROSE, CONTINUITY

Handler change: review-chapter.ts now passes
projectType: project.config.projectType to buildEditorPrompt.

Tests: existing fiction assertions (148 prompt tests) unchanged; 14 new
tests cover the gate (default → fiction; each fiction projectType →
fiction; NON_FICTION → non-fiction criteria, SOURCING sub-classes,
explicit no-scene-grade demand, reframed reference materials, shared
scaffolding preserved, series mode works on non-fiction). Full suite:
1043 passed.

This is the small-first-cut from the editor-gate design discussion: gate
just the editor to validate the dispatch shape on a real run, then
extend to the writer / outliner / continuity-checker if signal supports
it.

* feat: gate every agent prompt on projectType (fiction vs non-fiction)

Extends the editor-gate pattern to the remaining six agents so the entire
pipeline can adapt to NON_FICTION projects. Same shape across all of
them: optional projectType param defaults to fiction behavior, gate
swaps the agent-specific block(s), shared scaffolding (header, file
paths, completion, self-check skeletons, gh CLI commands, guard rails)
stays identical.

Per-agent changes:

- outliner.ts — replaces fictional Story Architecture (dramatic
  question + character arcs with want/need/flaw/lie/ghost + 8-point
  Climax Checklist + genre-aware predictability contracts + climax
  failure modes) with Reporting Architecture for non-fiction
  (central argument + structural anchors + subject portraits drawn
  from public record only + research mandate + structural-anchor
  chapter concept + non-fiction failure modes including
  "fabricated dramatization", "hagiography", "tell-all",
  "imagined interior on real people"). The character bible spec
  becomes a subject bible (no want/need/flaw/lie/ghost — explicitly
  forbidden); the world bible becomes the institutional landscape
  with cited histories; the research notes spec demands a working
  bibliography and an On Sourcing front-matter draft.

- writer.ts — replaces scene-structure (objective/obstacle/escalation/
  turn) and "show pivotal moments / tell connective tissue" with
  paragraph-grade analytical structure (claim/evidence/implication)
  and "where scene-grade rendering IS allowed" rules
  (only on documented moments). Replaces the AI-fiction-cliche
  watchlist with the AI-non-fiction-tic watchlist actually observed
  in editor reviews of the Phoenix Three book run ("the kind of X",
  "What X taught/bought/added", inversion-aphorism patterns,
  hyphen-stack noun phrases, sourcing meta-commentary inside the
  prose, imagined interior on real people). Replaces climax handling
  with structural-anchor handling. Mandates WebSearch / WebFetch
  use in the writing instructions.

- continuity-checker.ts — keeps the shared ContinuityState JSON
  schema (so writer/editor pipeline keeps consuming a uniform shape)
  but reframes the SEMANTICS for non-fiction. Issue types swap from
  CHARACTER/TIMELINE/WORLD_STATE/PLOT_THREAD to SUBJECT/TIMELINE/
  ENTITY/CITATION/SOURCING. Schema field comments document the
  non-fiction mapping (characters → subjects, plotThreads →
  analytical threads, worldState → cited factual claims keyed by
  topic). Chapter summary becomes a factual summary keyed to
  the chapter's claims rather than a narrative summary.

- auditor.ts — issue categories swap to CONTRADICTION/
  UNSUPPORTED_CLAIM/TIMELINE_ERROR/SUBJECT_INCONSISTENCY/
  ENTITY_ERROR/CITATION_ERROR. World-state schema example shows
  non-fiction semantics (publicTitle, source pointers in timeline
  entries, analytical threads).

- continuity-fixer.ts — reconciliation principles swap: "the bibles
  win" becomes "the public record wins" (with bibles as the cited
  reference); "never edit the climax for hygiene" becomes "never
  edit the structural-anchor chapter". Per-category fix guidance
  covers SUBJECT_INCONSISTENCY, ENTITY_ERROR, CITATION_ERROR (with
  WebFetch verification mandated), and UNSUPPORTED_CLAIM (hedge or
  cut, do not fabricate provenance). Self-check verifies the fix is
  grounded in the public record.

- reviser.ts — light. Reference materials reframe (subject bible,
  institutional landscape, working bibliography). Revision
  instructions add a SOURCING-aware diagnose-before-changing step
  that distinguishes FABRICATION / CITATION / HEDGING / UNSOURCED
  SPECIFIC sub-classes. Self-check requires citation, hedging, and
  forbids new fabrication.

- planner.ts — light. "Climax convergence" dependency rule becomes
  "Structural-anchor convergence". Reference-materials guidance and
  the parallel-storyline rule reframe for non-fiction.

Handlers updated to pass project.config.projectType into each prompt
builder: plan-chapters, trigger-chapter, revise-chapter,
continuity-check, continuity-audit, continuity-fixer.
(generate-outline already passed it; review-chapter was updated in
the prior commit for the editor gate.)

Tests: 41 new non-fiction-gate tests (one block per gated builder),
with assertions covering both what the non-fiction path adds (e.g.
"Sourcing discipline" in writer; "Subject bible" / "institutional
landscape" / "structural-anchor chapter" in outliner;
"UNSUPPORTED_CLAIM" / "CITATION_ERROR" in auditor) and what it
removes (e.g. the fictional "Climax — the chapter that justifies
every chapter before it" header is absent in non-fiction outliner;
"UNRESOLVED_THREAD" / "CHARACTER_INCONSISTENCY" / "LOCATION_ERROR"
absent in non-fiction auditor; "Scene structure / Build each scene"
absent in non-fiction writer). Existing 162 fiction tests unchanged
and still pass. Total prompt-builder tests: 203. Full suite: 1084
passed.

Design choice: kept ContinuityState JSON schema shared rather than
forking. The non-fiction prompts use the same fields with documented
non-fiction semantics. This avoids a large coordinated change to the
writer/editor/reviser/auditor/fixer code that all read or write the
state. Trade-off accepted: the field names (characters, plotThreads,
worldState) read awkwardly for non-fiction, but the cost of forking
the schema across the whole pipeline is much higher than the
readability cost of overloaded field names.
@tdrml
tdrml deleted the dev-agent/claudecode/ecs-run-1772505178113-tecmrj branch July 31, 2026 15:37
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.

Initialize TypeScript monorepo with pnpm workspaces

0 participants