Skip to content

feat(scaffold): declarative .guardex.json worktree provisioning (workmux W2)#642

Merged
NagyVikt merged 1 commit into
mainfrom
agent/claude/workmux-w2-declarative-guardex-yaml-work-2026-06-08-08-54
Jun 8, 2026
Merged

feat(scaffold): declarative .guardex.json worktree provisioning (workmux W2)#642
NagyVikt merged 1 commit into
mainfrom
agent/claude/workmux-w2-declarative-guardex-yaml-work-2026-06-08-08-54

Conversation

@NagyVikt

@NagyVikt NagyVikt commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

…mux W2)

A fresh agent worktree is a clean checkout — gitignored files (.env,
node_modules, .venv) are missing, so agents start broken. gitguardex only
auto-provisioned the hardcoded apps/* monorepo shape; any other layout got
nothing. Port workmux's declarative provisioning so any repo can describe its own.

- New .guardex.json `provision` block: files.copy / files.symlink (globs) +
  postCreate hooks. Parsed with the existing jsonc-parser (comments allowed) —
  no new dependency.
- src/scaffold/provision-config.js: loader + minimal dependency-free glob
  (literal + single-segment *, e.g. apps/*/.env) + copy/symlink/postCreate
  appliers. Best-effort: missing config, no-match, or a failing hook never
  throws fatally (protects gx branch start).
- Wired into prepareAgentWorktree (auto-invoked on worktree creation), ahead of
  the apps/* convenience which stays the zero-config default. The apps-gate
  early-return was removed so non-monorepo repos are provisioned too.

Security: copy/symlink are fenced two ways — pattern strings reject absolute/..
paths, and each resolved source/destination is realpath-checked to stay inside
repoRoot/worktreePath, so an in-repo symlink (link -> /etc) cannot escape on
read or write. postCreate runs repo-owner config (same trust as package.json
scripts), logs each command, is non-fatal, and is disabled with
GUARDEX_PROVISION_HOOKS=0.

Tests: test/provision-config.test.js (9 cases incl. escape-fence regression).
Independent review: 1 HIGH (symlink escape) fixed + covered; full-suite failing
set byte-identical to base (zero new failures).
@NagyVikt NagyVikt merged commit 77cc650 into main Jun 8, 2026
@NagyVikt NagyVikt deleted the agent/claude/workmux-w2-declarative-guardex-yaml-work-2026-06-08-08-54 branch June 8, 2026 07:11
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