Skip to content

agent-ready: template verifies green, --json reports, headless remote push, Config schema - #23

Open
HamzaHassanain wants to merge 3 commits into
masterfrom
feat/agent-ready
Open

HamzaHassanain wants to merge 3 commits into
masterfrom
feat/agent-ready

Conversation

@HamzaHassanain

Copy link
Copy Markdown
Owner

Summary

Makes polyman workable for headless AI agents, both as a tool and as a codebase.

Template verifies green out of the box (it did not: three bugs)

  • validator_tests.json fixture did not match val.cpp ("5 10" on line 1 vs one int + EOLN)
  • gen.cpp omitted the trailing newline, so generated tests failed Expected EOLN
  • acc2.java declared package solutions;, which java -cp <dir> acc2 cannot load

Headless CLI

  • polyman run <sol> --json and polyman verify --json: one JSON document on stdout, human output on stderr, exit codes unchanged. Emitted on every failure path, so an abort before solutions run still yields valid JSON with failedStep set.
  • polyman remote push --yes --name <slug>: create a Polygon problem without prompts. With no TTY and no flags, push exits 1 naming the flags instead of hanging.

Config schema

  • template/Config.schema.json (draft-07, mirrors ConfigFile, descriptions on every field), referenced from the template's Config.json via $schema. Every reader tolerates the key; it is never pushed to Polygon.

Tooling / doc drift

  • npm test = vitest run (no watch-mode hang); test:watch added
  • eslint + git ignore .claude/worktrees so a parallel agent's worktree cannot break lint
  • polyman new hints said generate all; the flag is --all
  • CLAUDE.md lists the three runtime deps

Sample verify --json (trimmed):

{ "schemaVersion": 1, "polymanVersion": "2.3.3", "command": "verify", "ok": true, "failedStep": null,
  "steps": [ { "name": "compile-generators", "ok": true, "errors": [] } ],
  "solutions": [ { "name": "tle_solution", "tag": "TL", "matchesTag": true,
      "tests": [ { "testset": "tests", "index": 1, "verdict": "TLE", "timeMs": 1003 } ] } ] }

Test plan

  • npm run build, npm run lint, npm run format:check clean
  • npm test: 822 tests, 24 files
  • fresh polyman newdownload-testlibverify exits 0, all three solutions match their tags
  • verify --json exit 0, valid JSON, no ANSI on stdout; broken copy exits 1 with valid JSON and failedStep: "validate-tests"
  • run main --all --json exit 0
  • remote push . < /dev/null exits 1 in under a second with the flag hint

Notes

  • No memory figure in the JSON: polyman enforces a memory limit but never measures usage.
  • Pre-existing and left alone: run --group/--index exits 1 on a failing test while --all exits 0; .claude/scheduled_tasks.lock is tracked; assets/checkers/ has stray ncmp.exe and nyesno binaries.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RhXUgi99BpnzBNT2pymkDL

HamzaHassanain and others added 3 commits September 12, 2026 17:04
A fresh `polyman new` failed `polyman verify` three times over:
- validator_tests.json fed "5 10" on line 1 while val.cpp reads one int
  then readEoln; fixture rewritten to match (2 VALID, 4 INVALID incl.
  missing trailing newline)
- gen.cpp omitted the trailing newline, so generated tests failed
  "Expected EOLN"
- acc2.java declared `package solutions;`, which `java -cp <dir> acc2`
  can never load

Add template/Config.schema.json (draft-07, mirrors ConfigFile in
types.d.ts, descriptions on every field) and point Config.json at it via
"$schema". Every reader tolerates the key and it is never pushed to
Polygon. tests/config-schema.test.ts keeps schema and template in sync.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhXUgi99BpnzBNT2pymkDL
Headless agents could not drive polyman: verdicts had to be scraped from
box-drawing text and `remote push` of a new problem blocked on readline.

- `run <sol> --json` / `verify --json`: exactly one JSON document on
  stdout (schemaVersion, polymanVersion, command, ok, steps, per-solution
  matchesTag and per-test verdicts); human output moves to stderr; exit
  codes unchanged. Emitted on every failure path via a process exit hook,
  so aborts before solutions run still yield valid JSON with failedStep.
- `remote push -y/--yes -n/--name <slug>`: skip the create-problem
  confirmation and supply the name. Without a TTY and without the flags,
  push exits 1 naming the flags instead of hanging. An invalid or taken
  --name errors instead of re-prompting.
- New src/report.ts collector; formatter gains an output-stream switch
  and error sink; three direct console.* calls in executor.ts routed
  through fmt.
- Docs: README, GUIDE, template/instructions/commands/{run,verify,remote},
  working-rules.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhXUgi99BpnzBNT2pymkDL
- `npm test` runs `vitest run` (no watch-mode hang for agents);
  `test:watch` keeps the old behaviour
- eslint and git ignore .claude/worktrees so a parallel agent's worktree
  cannot break `npm run lint`
- `polyman new` hints said `generate all` / `validate all`; the flags are
  `--all`
- CLAUDE.md: three runtime deps (execa), formatter has no spinners

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhXUgi99BpnzBNT2pymkDL
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