Skip to content

Add local AI fix/generate, engine-aware Test Lab, and source-format preservation - #3

Merged
cankilic-gh merged 1 commit into
mainfrom
feature/local-ai-test-lab
Aug 6, 2026
Merged

Add local AI fix/generate, engine-aware Test Lab, and source-format preservation#3
cankilic-gh merged 1 commit into
mainfrom
feature/local-ai-test-lab

Conversation

@cankilic-gh

Copy link
Copy Markdown
Owner

Summary

  • AI Fix/Generate — agentic edit loop via @anthropic-ai/claude-agent-sdk using machine's Claude subscription login (no API key required). PostToolUse re-validation feedback loop; structured JSON output with required uncertainties[]; PDF/docx attachment extraction via mammoth. AiFixModal + SmartFormGenerator AI tab (mode=generate).
  • Engine modelengineModel.ts as single source of truth for the E-Bar XML engine (distilled from Java). validation.ts rewritten data-driven against it; engineRulesPrompt.ts renders it into the AI system prompt to prevent prompt/code drift.
  • Repo-aware Test Lab — git panel auto-loads changed E-Bar forms via EBAR_REPO_PATH env var, shows branch-vs-edit diff, round-trip + validation on working version. New DiffView component.
  • Source-format preservation — detect CRLF/tab vs LF/space at parse time (_sourceFormat), apply at build; eliminates round-trip noise on the 97% CRLF/tab E-Bar corpus.
  • ValidationStatus — clickable rows call formStore.revealNode; FormTree scrolls to selected node.
  • Toolbar — AI Fix button; Save/Save-As hardening (permission-revoked fallback, API-absent alert).
  • New testsaiFixAgent.test.ts (live AI gated behind RUN_LIVE_AI_FIX_TESTS=1), sourceFormat.test.ts, extended validation.test.ts. 85 non-live tests pass; 560-file real corpus round-trip passes.
  • New scriptscripts/scan-corpus.ts (triage CLI).

Expected production limitations

The AI Fix/Generate routes (/api/ai/fix) and repo-comparison routes (/api/repo/*) depend on local machine resources:

  • AI routes require an active Claude subscription login session on the host machine — this will not be available on Vercel serverless, so those routes will error at runtime on production.
  • Repo routes require EBAR_REPO_PATH pointing to a local E-Bar git checkout — not present on Vercel, so those routes return a benign "repo not found" message.
  • All three routes are protected by the existing session middleware.

Test plan

  • npm ci — exact install from lockfile, exit 0
  • tsc --noEmit — exit 0
  • vitest run — 85 passed / 4 skipped (live AI tests gated), exit 0
  • Corpus round-trip (560 forms, EBAR_STATES_DIR) — all pass
  • next build — exit 0, 28 files, 6 routes compiled

🤖 Generated with Claude Code

…reservation

New features (intended for local work machines only):
- AI Fix/Generate: agentic edit loop via @anthropic-ai/claude-agent-sdk; uses
  machine's Claude subscription login (no API key); PostToolUse re-validation
  feedback loop; structured JSON output with required uncertainties[]; PDF/docx
  attachment extraction (mammoth); AiFixModal + SmartFormGenerator AI tab
- Test Lab: git-panel auto-loads changed E-Bar forms (EBAR_REPO_PATH), shows
  branch-vs-edit diff, round-trip + validation on working version; DiffView
- Engine model: single source of truth (engineModel.ts, distilled from Java
  engine); validation rewritten data-driven; engineRulesPrompt renders it into
  AI system prompt to prevent drift
- Source-format preservation: detect CRLF/tab vs LF/space at parse, apply at
  build; eliminates 97% corpus round-trip noise (textDiff, gitStyleDiff)
- ValidationStatus: clickable rows call formStore.revealNode; FormTree scrolls
- Toolbar: AI Fix button; Save/Save-As hardening
- New tests: aiFixAgent (live AI gated behind RUN_LIVE_AI_FIX_TESTS=1),
  sourceFormat round-trip; validation suite extended; corpus tests pass (560 forms)
- New script: scan-corpus.ts (triage CLI, exit 0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
formforge Ready Ready Preview Aug 6, 2026 1:23pm

@cankilic-gh
cankilic-gh merged commit bef69d4 into main Aug 6, 2026
3 checks passed
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