Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
`docs/RELEASE-PROCESS.md` §8.

## Unreleased
- fix(permissions): **`install-claude-permissions.sh` now writes one allow rule per script that exists, space form, `*` only at the end; the scripts that record a person's decision (`init-project.sh`, which installs permissions from the profile PROJECT.md names, `install-claude-permissions.sh`, `install-harness-permissions.sh`, `permission-profile.sh`, `exec-approval.sh`, `interview-mode.sh`) and the sourced `_*.sh` libraries get no allow rule and keep prompting (`Bash(./bin/gate-check.sh *)`, `Bash(bin/…)`, `Bash(bash bin/…)` shared; `Bash(<toolkit>/bin/<name>.sh *)` and one `mx` rule per installed `~/.mxcli/mxbuild/<ver>` local), replacing `Bash(./bin/*.sh:*)` and friends (#780)**: a `*` mixed with the trailing `:*` never matched — `claude doctor` 2.1.325 flags each as "matched as a literal prefix … will likely never match", and a real `claude -p` run was denied both `./bin/status.sh` and `./bin/status.sh --brief` under master's rules while `Bash(./bin/status.sh *)` ran both. Re-install removes the old entries through the existing sidecar and never touches foreign ones; `--check` (so `sync-project.sh`) names the ones it will remove and any script installed since. Also fixed: a run that pruned an entry dropped every addition in that same run (the prune rebound the allow list). Project-profile allow rules move to the space form; deny/ask unchanged; `doctor.sh` greps the new exec.sh spelling. Fixture `test-install-claude-permissions.sh` T12 — reported by toolkit users, relayed by the maintainer
- fix(doctor, README): **an empty folder on Windows/macOS with no Studio Pro now gets the truth instead of a dead download.** Doctor said "No Studio Pro needed for the gate: --install downloads the standalone toolchain" and "a brand-new project gets its .mpr from 'mxcli init'"; both are wrong off Linux. The Mendix CDN publishes Linux mxbuild only (mxcli `NativeMxBuildForSetup`, #916), so on macOS/Git Bash `--install` no longer plans the ~800 MB download or calls `mxcli setup mxbuild` (which refuses there): it says to install Studio Pro in the app's version or use the Dev Container. With no `.mpr` it says there is no app yet and how to make one (Studio Pro New app > Blank outside OneDrive, or `mxcli new` *before* `mxcli init`, since `new` refuses a non-empty folder and runs init itself); the project-section help text says the same. The Claude Code permissions section reports "skipped" instead of two WARNs when Claude Code is not on the machine (`MXTK_CLAUDE=1` forces it): another agent reads AGENTS.md, not `.claude/`. README's no-Studio-Pro note says Linux only and adds the empty-folder order. New `tests/wave2/test-doctor-no-app-no-sp.sh` (21/21; 10 of its checks fail on the previous doctor, the stub mxcli shows `setup mxbuild` was called on Windows and macOS; macOS and Windows with Studio Pro installed and Linux behave as before). Three upstream drafts in `pending-github-issues/`: `mxcli new` downloads the Linux mxbuild on Windows/macOS, `init`'s VS Code extension install breaks on spaced paths, no `--version` discovery. Field run: a customer's Windows 11 / Git Bash machine, no Studio Pro, no Docker, an empty OneDrive folder, a non-Claude agent: four FAILs from the missing .mpr, then `mxcli new` left a 373 MB partial Linux mxbuild and no app — Maurits Visser, from a customer setup report
- fix(gate-check, status): **a `## Current stage` readout older than the newest `docs/BUILD-LOG.md` row is now named stale, and exec scripts run since Stage 5 with no `cr:` tag and no build-plan row are listed under the `Change log:` line (#767)** — both warn-only and computed when read (one awk over the log per gate-check/status run, nothing per exec row; `exec.sh` untouched): gate-check (every run) and `status.sh` (WATCH) print `Current stage line is from <date>; N exec rows since — re-run bin/gate-check.sh`; gate-check's rewrite now stamps `· last exec <date>` inside the parenthesis (the `**Stage N` prefix that `status.sh`, `token-burn.sh` and `obligation-check.sh` parse is unchanged) and also rewrites when that date moved; the nudge reads Stage 5's start as the first exec row the plan names (verbatim or `060-…-x.mdl`) and never changes the Change log verdict or an exit code. New `bin/lib/build-log-read.sh`; fixtures `test-stage-header.sh` T13, `test-change-log.sh` T10 — field report, greenfield build in auto mode, 2026-11-13
- fix(platform-link): **going live, the toolkit project IS the Team Server copy (#765)**: an app built with the toolkit went live through a separate Team Server working copy with no `.mxtk`, so every later change skipped the exec gate, snapshots and BUILD-LOG, and nothing said so. `skills/platform-link.md` §3 now states the rule and adds a six-step recovery for a copy that already split off (fetch it in, take its model whole, `mxcli fix hashes` + gate, adopt with `-X ours` and push without force, sync the metadata notes, retire the extra copy; the `mprname` trap, ContentsHash after a checkout, and the model-aware merge path needing mxcli ≥ 0.30); one-line pointers from the runbook's Stage 6 and `deploy-to-sandbox.md`. `bin/status.sh` WATCHes, local git only and exit code unchanged, at Stage 6+ when no remote URL names Team Server, and when a fetched Team Server ref is in no local branch ("Team Server has commits made outside the toolkit"). New `tests/wave2/test-status-teamserver.sh` — greenfield field run, 2026-11-13
Expand Down
2 changes: 1 addition & 1 deletion bin/doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ if [ -n "$PROJECT_DIR" ]; then
PSET="$PROJECT_DIR/.claude/settings.json"
PLOCAL="$PROJECT_DIR/.claude/settings.local.json"
PERM_GAP=""
grep -qF '"Bash(./bin/exec.sh:*)"' "$PSET" 2>/dev/null || PERM_GAP="the safe-wrapper entries"
grep -qF '"Bash(./bin/exec.sh *)"' "$PSET" 2>/dev/null || PERM_GAP="the safe-wrapper entries" # #780 spelling
case "$PERM_PROFILE" in
project|full) grep -qF '"Edit(/**)"' "$PSET" 2>/dev/null || PERM_GAP="${PERM_GAP:-the project-folder entries}" ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion bin/init-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ else
fi

# .claude/settings.local.json (Claude Code's own "project local" precedence tier — see
# https://code.claude.com/docs/en/settings) holds the two install-claude-permissions.sh allow
# https://code.claude.com/docs/en/settings) holds the install-claude-permissions.sh allow
# entries that embed $TOOLKIT_ROOT, an absolute path under this machine's home directory.
# Same reasoning as .mxtk/ above: never shared, so never tracked.
if mxtk_gitignore_has "$GITIGNORE" .claude/settings.local.json; then
Expand Down
124 changes: 84 additions & 40 deletions bin/install-claude-permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,25 @@
# AGENT asks; it has no say over whether the HARNESS itself prompts first.
#
# RULE SYNTAX, verified against https://code.claude.com/docs/en/permissions ("Wildcard
# patterns" section) before choosing these patterns:
# - `*` stands in for any sequence of characters at that position, not just one path segment
# — the doc's own example `Bash(git * main)` matches `git push origin main`, where `*`
# spans two words. So `bin/*.sh` matches any script directly under bin/, and
# `~/.mxcli/mxbuild/*/modeler/mx` matches any installed mxbuild version.
# - A trailing `:*` is an exact equivalent of a trailing ` *` (space + wildcard), and — being
# the rule's ONLY wildcard — also matches the bare command with nothing after it.
# The exec.sh-specific entries are listed separately even though `bin/*.sh:*` already covers
# them; that redundancy is deliberate and matches this script's spec, not an oversight.
# patterns") and https://code.claude.com/docs/en/errors ("Has a wildcard before the rest of the
# command"), Claude Code 2.1.325 (#780):
# - A trailing ` *` (space + wildcard; `:*` is the legacy spelling of the same thing) matches
# the bare command with nothing after it ONLY when it is the rule's only wildcard:
# `Bash(* --help *)` matches `npm --help x` but not `npm --help`. Until #780 this script
# wrote `Bash(./bin/*.sh:*)`, which mixes a `*` with the trailing `:*`. `claude doctor`
# 2.1.325 reports such a rule as "matched as a literal prefix (the * is not expanded) and
# will likely never match", and a real `claude -p` run (2026-11-16) was denied both
# `./bin/status.sh` and `./bin/status.sh --brief` under it; under `Bash(./bin/status.sh *)`
# both ran.
# - A `*` before the rest of the command (in the program name, as `bin/*.sh` was) raises a
# startup warning row for every such allow rule, at every session start.
# So every allow rule here has at most one `*`, at the very end after a space: one rule per
# script that exists when this runs (`Bash(./bin/<name>.sh *)`), which is the docs' own "one
# rule per subcommand". A script installed later is missing until this runs again; --check (and
# so sync-project.sh) names it. Entries an earlier version of this script added (the sidecar
# below records them) and no longer wants are removed on the next install; --check lists them.
# Deny and ask rules are not affected (the warning is for allow rules, and a deny glob is
# meant to be broad), so they keep their spelling.
#
# PROFILES (2026-10-06): bin/permission-profile.sh resolves `wrappers` | `project` (default) |
# `full`, picked at intake Q12. `wrappers` is exactly the list below. `project` adds edits inside
Expand Down Expand Up @@ -61,16 +71,16 @@
# removes only those, never an identical entry that was already present before this script
# ever ran (e.g. `mxcli init` already seeds `Bash(./mxcli:*)` and `Bash(mxcli:*)`).
#
# TWO FILES, SPLIT BY WHAT THE ENTRY LEAKS (2026-09-16). Two of the eleven entries embed
# TWO FILES, SPLIT BY WHAT THE ENTRY LEAKS (2026-09-16). The toolkit-script entries embed
# $TOOLKIT_ROOT — an absolute path under the operator's home directory (a username, routinely).
# `.claude/settings.json` is the SHARED project file, meant to be committed so every teammate
# gets the same allow-list; committing someone's home-directory path into it is exactly the
# per-machine leak this toolkit's leak guard exists to catch elsewhere. So those two entries
# alone go into `.claude/settings.local.json` — precedence level 3 in
# per-machine leak this toolkit's leak guard exists to catch elsewhere. So those entries, and
# the per-version mxbuild `mx` entries (which versions are installed is per machine), go into `.claude/settings.local.json` — precedence level 3 in
# https://code.claude.com/docs/en/settings ("Settings files and precedence"), "You, this
# project", i.e. per-machine and never shared — and init-project.sh's .gitignore template
# ignores it the same way it ignores `.mxtk/`. The other nine entries are all relative (no
# machine-specific path) and stay in the shared `.claude/settings.json`, same as before.
# ignores it the same way it ignores `.mxtk/`. The project-script and mxcli entries are all
# relative (no machine-specific path) and stay in the shared `.claude/settings.json`.
#
# NOT WRITTEN, ON PURPOSE: `autoMode` (2026-09-27). In auto permission mode a second gate, the
# safety classifier, runs after these rules and can refuse a command they allow (field: a Python
Expand Down Expand Up @@ -174,23 +184,47 @@ echo "permission profile: $PROFILE"
#
# SHARED: relative invocations only, safe to commit — everyone on the project gets the same
# allow-list regardless of where they cloned the toolkit.
# One rule per script, `*` only at the end (see RULE SYNTAX above). A name holding a character
# that means something in a rule (`*`, a space, a parenthesis) is skipped rather than escaped.
_script_rules() { # $1 = directory, $2... = prefixes ("./bin/", "bash bin/", ...)
local dir="$1" f n p; shift
for f in "$dir"/*.sh; do
[ -f "$f" ] || continue
n="${f##*/}"
case "$n" in exec.sh|*[\*\ \(\)]*) continue ;; esac # exec.sh is listed first, always
# Scripts that record a person's decision about what the agent may do keep prompting: an
# allow rule would let an agent widen its own permissions (`--profile full` adds a bare
# `Bash`), set its own exec autonomy or interview mode. init-project.sh is one of them: it runs the
# harness installer with the profile PROJECT.md names, which an agent with Edit(/**) can change. Sourced libraries (`_*.sh`) are never run.
case "$n" in _*|init-project.sh|install-claude-permissions.sh|install-harness-permissions.sh|permission-profile.sh|exec-approval.sh|interview-mode.sh) continue ;; esac
for p in "$@"; do printf '%s\n' "Bash($p$n *)"; done
done
}
ENTRIES_SHARED=(
"Bash(./bin/exec.sh:*)"
"Bash(bin/exec.sh:*)"
"Bash(bash bin/exec.sh:*)"
"Bash(./bin/*.sh:*)"
"Bash(bin/*.sh:*)"
"Bash(bash bin/*.sh:*)"
"Bash(~/.mxcli/mxbuild/*/modeler/mx:*)"
"Bash(./mxcli:*)"
"Bash(mxcli:*)"
"Bash(./bin/exec.sh *)"
"Bash(bin/exec.sh *)"
"Bash(bash bin/exec.sh *)"
)
# LOCAL: embeds $TOOLKIT_ROOT, an absolute path under this machine's home directory — per-machine
# only, never committed. See the header note above.
ENTRIES_LOCAL=(
"Bash($TOOLKIT_ROOT/bin/*.sh:*)"
"Bash(bash $TOOLKIT_ROOT/bin/*.sh:*)"
while IFS= read -r _r; do [ -n "$_r" ] && ENTRIES_SHARED+=( "$_r" ); done <<EOF_RULES
$(_script_rules "$PROJECT_DIR/bin" "./bin/" "bin/" "bash bin/")
EOF_RULES
ENTRIES_SHARED+=(
"Bash(./mxcli *)"
"Bash(mxcli *)"
)
# LOCAL: embeds $TOOLKIT_ROOT, an absolute path under this machine's home directory — per-machine
# only, never committed. See the header note above. exec.sh is the project's copy, not this one.
ENTRIES_LOCAL=()
while IFS= read -r _r; do [ -n "$_r" ] && ENTRIES_LOCAL+=( "$_r" ); done <<EOF_RULES
$(_script_rules "$TOOLKIT_ROOT/bin" "$TOOLKIT_ROOT/bin/" "bash $TOOLKIT_ROOT/bin/")
EOF_RULES
# mxbuild's `mx`, one rule per installed version (`mx check` by hand, as the skills show it),
# spelt both ways an agent types it: with `~` and with the absolute path.
for _mx in "$HOME"/.mxcli/mxbuild/*/modeler/mx "$HOME"/.mxcli/mxbuild/*/modeler/mx.exe; do
[ -f "$_mx" ] || continue
case "$_mx" in *[\*\ \(\)]*) continue ;; esac
ENTRIES_LOCAL+=( "Bash(~${_mx#"$HOME"} *)" "Bash($_mx *)" )
done

# THE ONE DENY and THE ONE HOOK (2026-09-17, see header notes above) are global, not
# per-machine — they carry no $TOOLKIT_ROOT path — so they are only ever merged into the
Expand Down Expand Up @@ -221,8 +255,8 @@ DENY=(
# redirect or `cp` cannot be denied without also denying `cat`, so a hand-copied approval is caught
# by the checksum security-check.sh verifies on every run, and by review of the files in git.
# This is a guard rail, not a lock.
# `file-bugs.sh --auto` is deliberately NOT denied, and needs no rule of its own: `bin/*.sh:*`
# above already allows it. It posts only in a project whose PROJECT.md has the person's line
# `file-bugs.sh --auto` is deliberately NOT denied, and needs no rule of its own: the per-script
# `Bash($TOOLKIT_ROOT/bin/file-bugs.sh *)` allow rules above already allow it. It posts only in a project whose PROJECT.md has the person's line
# `Bug filing: auto`, only rows that pass the redaction scan, and never without a deny list —
# that line, not a y/N an agent could type into a pty, is the gate. --file/--all stay denied.
# `--import` (the maintainer filing a mailed bundle with their own gh, no opt-in line) is denied
Expand All @@ -237,14 +271,14 @@ if [ "$PROFILE" = project ] || [ "$PROFILE" = full ]; then
"Edit(/**)"
"Bash(node tests/*)"
"Bash(npx playwright *)"
"Bash(npm install:*)"
"Bash(npm ci:*)"
"Bash(docker compose:*)"
"Bash(docker ps:*)"
"Bash(docker logs:*)"
"Bash(git add:*)"
"Bash(git commit:*)"
"Bash(git mv:*)"
"Bash(npm install *)"
"Bash(npm ci *)"
"Bash(docker compose *)"
"Bash(docker ps *)"
"Bash(docker logs *)"
"Bash(git add *)"
"Bash(git commit *)"
"Bash(git mv *)"
"Bash(python3 bin/*)" # portability-ok: a permission-rule string, not an interpreter call
"Bash(python3 tests/*)" # portability-ok: a permission-rule string, not an interpreter call
)
Expand Down Expand Up @@ -366,6 +400,14 @@ if mode == "check":
missing_deny = [e for e in deny_entries if e not in deny]
missing_ask = [e for e in ask_entries if e not in d.get("permissions", {}).get("ask", [])]
missing_hooks = [h for h in hook_specs if not hook_present(d, h) or extra_copies(d, h)]
# Entries an earlier run added that this one no longer wants (e.g. the pre-#780 wildcard
# `Bash(./bin/*.sh:*)`): named so the re-run's removals are no surprise; not a failure alone.
# Not under --hooks-only: that mode passes no entries and never prunes (#781 review).
stale = [] if os.environ.get("MXTK_HOOKS_ONLY") == "1" else [e for e in allow if e in added and e not in entries]
if stale:
print("Entries an earlier install added that the next install removes (%s):" % settings_path)
for m in stale:
print(" - " + m)
if missing or missing_deny or missing_ask or missing_hooks:
print("Missing entries in %s:" % settings_path)
for m in missing:
Expand Down Expand Up @@ -466,7 +508,9 @@ for key, want, mine in (("allow", entries, added), ("deny", deny_entries, added_
break # --hooks-only: add the hooks, never prune what an earlier full install wrote
gone = [e for e in perms.get(key, []) if e in mine and e not in want]
if gone:
perms[key] = [e for e in perms[key] if e not in gone]
# In place: `allow` above is this same list, and the additions below go into it (#780: a
# rebinding here dropped every addition made in the run that pruned).
perms[key][:] = [e for e in perms[key] if e not in gone]
pruned += ["%s %s" % (key, e) for e in gone]
mine.difference_update(set(mine) - set(want))

Expand Down Expand Up @@ -607,7 +651,7 @@ if [ "$HOOKS_ONLY" -eq 1 ]; then
exit $?
fi
_merge_group "$SETTINGS" "$SIDECAR" "$MODE" "$HOOKS" "${#ENTRIES_SHARED[@]}" "${#DENY[@]}" "${ENTRIES_SHARED[@]}" "${DENY[@]}" ${ASK[@]+"${ASK[@]}"} || RC=$?
_merge_group "$SETTINGS_LOCAL" "$SIDECAR_LOCAL" "$MODE" "" "${#ENTRIES_LOCAL[@]}" 0 "${ENTRIES_LOCAL[@]}" || {
_merge_group "$SETTINGS_LOCAL" "$SIDECAR_LOCAL" "$MODE" "" "${#ENTRIES_LOCAL[@]}" 0 ${ENTRIES_LOCAL[@]+"${ENTRIES_LOCAL[@]}"} || {
RC2=$?
[ "$RC2" -gt "$RC" ] && RC=$RC2
}
Expand Down
Loading
Loading