refactor(layout): role contracts move to roles/ - root is bootstrap-only
Owner direction: the repository root holds first-class, bootstrap-required configuration only. conductor-policy.json is a ROLE contract (the conductor's authority), one of scores of future role contracts (agent-policy, coder-policy, ...) - such files get a dedicated home. - roles/conductor-policy.json (git mv) - conductor-apply.sh + test-conductor.sh read the new path - CONDUCTOR.md records the roles/ convention Closes UX follow-up from owner layout review; no issue (convention change).
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Usage: scripts/conductor-apply.sh <runId> [--dry-run]
|
||||
#
|
||||
# Policy (conductor-policy.json in the target repo, strictly validated):
|
||||
# Policy (roles/conductor-policy.json in the target repo, strictly validated):
|
||||
# autoApply.enabled master switch
|
||||
# autoApply.allowedPaths glob allowlist ('dir/**' = everything under dir)
|
||||
# autoApply.suites suite scripts that must pass AFTER applying
|
||||
@@ -27,19 +27,19 @@ cd "$TARGET_ROOT"
|
||||
|
||||
fail() { echo "conductor-apply: $*" >&2; exit "${2:-1}"; }
|
||||
[ -d .git ] || fail "target is not a git repository: $TARGET_ROOT" 4
|
||||
[ -f conductor-policy.json ] || fail "no conductor-policy.json in target" 2
|
||||
[ -f roles/conductor-policy.json ] || fail "no roles/conductor-policy.json in target" 2
|
||||
|
||||
# ---- policy (strict) ----
|
||||
POLICY_JSON="$(node -e '
|
||||
const fs = require("fs");
|
||||
const p = JSON.parse(fs.readFileSync("conductor-policy.json", "utf8"));
|
||||
const p = JSON.parse(fs.readFileSync("roles/conductor-policy.json", "utf8"));
|
||||
if (p.policyVersion !== 1) process.exit(3);
|
||||
if (!p.autoApply || typeof p.autoApply.enabled !== "boolean" || !Array.isArray(p.autoApply.allowedPaths) || !Array.isArray(p.autoApply.suites)) process.exit(3);
|
||||
for (const g of p.autoApply.allowedPaths) {
|
||||
if (typeof g !== "string" || !/^[A-Za-z0-9_.*/-]+$/.test(g) || g.startsWith("/") || g.includes("..")) process.exit(3);
|
||||
}
|
||||
console.log(JSON.stringify(p.autoApply));
|
||||
')" || fail "invalid conductor-policy.json" 2
|
||||
')" || fail "invalid roles/conductor-policy.json" 2
|
||||
|
||||
ENABLED="$(node -e 'console.log(JSON.parse(process.argv[1]).enabled)' "$POLICY_JSON")"
|
||||
[ "$ENABLED" = "true" ] || fail "auto-apply is disabled by policy" 2
|
||||
|
||||
Reference in New Issue
Block a user