Skip to content

feat(protect): generic scaffold + wiring plan + protect --check (infra-free agent loop)#82

Merged
patchstackdave merged 1 commit into
mainfrom
feat/protect-verify-and-plan
Jul 15, 2026
Merged

feat(protect): generic scaffold + wiring plan + protect --check (infra-free agent loop)#82
patchstackdave merged 1 commit into
mainfrom
feat/protect-verify-and-plan

Conversation

@patchstackdave

Copy link
Copy Markdown
Contributor

Stacked on #81. Closes the "unmatched stack" gap without a hosted MCP server or anything in saas/hub — the CLI itself is the channel to the builder's agent (which already runs the CLI and reads stdout).

Generic scaffold + wiring plan (no more silent skip / bare "unsupported")

On a stack no adapter matches, runProtect now scaffolds a framework-agnostic guard (templates/generic-guard.tssrc/patchstack/{guard.ts,rules.json}) and prints a wiring plan with best-effort server-entry detection (candidate files + Express). The generic guard exposes protectFetch(handler) (Web-Fetch) and patchstackMiddleware (Node/Express).

protect --check — the verify half of the loop

runVerify inspects the app and reports whether the guard is wired, exit 1 if not. Adapters own verify(); the generic path checks the guard is scaffolded and imported into a source file. This is the feedback channel the agent (or CI) drives: scaffold → wire per plan → --check → iterate. All via CLI stdout + exit code — no server.

Also

  • Adapter interface gains verify(); tanstack-supabase implements it.
  • AGENT-INSTALL.md documents the loop.

Verified end-to-end via the shipped CLI (scaffold+plan → --check exit 1 → wire → --check exit 0). +3 tests. 447 pass, typecheck + build clean.

Note: AGENT-INSTALL.md changed, so per CLAUDE.md a field-test run is advisable before publishing.

🤖 Generated with Claude Code

@coderbuds

coderbuds Bot commented Jul 15, 2026

Copy link
Copy Markdown

Cohesive generic guard scaffold with robust wire-and-verify CLI integration.

🎯 Quality: 100% Elite · 📦 Size: Large — consider splitting if possible

📈 This month: Your 35th PR — above team average · Averaging Excellent

See how your team is trending →

@patchstackdave

Copy link
Copy Markdown
Contributor Author

/review

Base automatically changed from feat/protect-install-adapters to main July 15, 2026 15:40
…fra-free agent loop)

Close the "unmatched stack" gap without a hosted server or saas/hub: the CLI itself is the
channel to the builder's agent (it already runs the CLI and reads stdout).

- Unmatched stack no longer returns bare "unsupported" — `runProtect` scaffolds a
  framework-agnostic guard (templates/generic-guard.ts → src/patchstack/{guard.ts,rules.json})
  and prints a wiring plan with best-effort server-entry detection (candidate files + Express).
  The generic guard exposes protectFetch(handler) (Web-Fetch) and patchstackMiddleware (Node/Express).
- `protect --check` (runVerify): inspects the app and reports whether the guard is wired, exit 1
  if not — the feedback half of a wire-then-verify loop the agent (or CI) drives. Adapters own
  their verify(); the generic path checks the guard is scaffolded AND imported into a source file.
- Adapter interface gains verify(); tanstack-supabase implements it (guard/client/start checks).
- AGENT-INSTALL documents the loop: auto-wire known stacks; otherwise scaffold → wire per plan →
  `--check` to confirm. No MCP, no backend — all in the npm package.

+3 tests (generic scaffold+plan, verify not-wired→wired, tanstack verify). Verified end-to-end via
the shipped CLI. 447 tests pass, typecheck + build clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@patchstackdave patchstackdave force-pushed the feat/protect-verify-and-plan branch from 26a9afa to 3487103 Compare July 15, 2026 15:43
@patchstackdave patchstackdave merged commit 92e5dc1 into main Jul 15, 2026
4 checks passed
@patchstackdave patchstackdave deleted the feat/protect-verify-and-plan branch July 15, 2026 15:46
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.

2 participants