Skip to content

feat: add perstack validate and perstack schema CLI commands#795

Merged
FL4TLiN3 merged 5 commits intomainfrom
feat/validate-and-schema-commands
Mar 14, 2026
Merged

feat: add perstack validate and perstack schema CLI commands#795
FL4TLiN3 merged 5 commits intomainfrom
feat/validate-and-schema-commands

Conversation

@FL4TLiN3
Copy link
Contributor

Summary

Two new CLI commands for perstack.toml authoring support:

perstack validate <path>

  • Validates a perstack.toml file against the Zod schema
  • Runs: TOML parsing → schema validation → expert delegation validation
  • Exits 0 with "Valid" on success, exits 1 with friendly errors on failure
  • Example: perstack validate ./perstack.toml

perstack schema

  • Prints a TOML-oriented schema reference auto-generated from the Zod schema
  • Shows valid fields, types, required/optional, enum values (e.g., defaultModelTier: "low" | "middle" | "high")
  • Includes @perstack/base tool names and naming rules as supplementary info
  • Uses z.toJSONSchema() internally then converts to human-readable format

Why

These replace LLM-based structural review in create-expert. The write expert can run perstack validate as a hard signal and perstack schema to learn valid values — no more wrong tool names, invalid fields, or invented field names.

New exports

  • @perstack/perstack-toml: validatePerstackConfigFile(), printPerstackSchema()

Test plan

  • perstack validate definitions/create-expert/perstack.toml → "Valid", exit 0
  • perstack validate nonexistent.toml → error, exit 1
  • perstack validate with invalid defaultModelTier → Zod error, exit 1
  • perstack schema → TOML-oriented reference with all fields
  • bun run typecheck passes
  • bun run test passes

🤖 Generated with Claude Code

FL4TLiN3 and others added 5 commits March 14, 2026 22:30
New commands for perstack.toml authoring support:

- `perstack validate <path>`: Validates a perstack.toml against the schema.
  Runs TOML parsing, Zod schema validation, and expert delegation validation.
  Exits 0 with "Valid" on success, exits 1 with errors on failure.

- `perstack schema`: Prints a TOML-oriented schema reference generated from
  the Zod schema via z.toJSONSchema(). Includes valid fields, types,
  required/optional status, @perstack/base tool names, and naming rules.

These replace LLM-based review for structural correctness — the write expert
can run `perstack validate` as a hard signal after writing perstack.toml.

New exports from @perstack/perstack-toml:
- validatePerstackConfigFile(filePath)
- printPerstackSchema()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation

Architecture overhaul based on 100+ test runs:

- Plan restored as "context expansion" — maximizes context before authoring
- Write uses `perstack validate` and `perstack schema` CLI tools instead
  of LLM-based review (which was unreliable for structural correctness)
- Verify does test execution + ONE completion signal check (no separate
  test expert — context separation caused misunderstanding)
- Verify appends results to plan.md for cross-iteration knowledge continuity
- Review and test experts removed
- Completion signal: ONE, binary, deterministic, essential
- Max 3 iterations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 merged commit afeda1c into main Mar 14, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 deleted the feat/validate-and-schema-commands branch March 14, 2026 22:44
@FL4TLiN3 FL4TLiN3 mentioned this pull request Mar 14, 2026
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