Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80fb47f050 | ||
|
|
e4c67f0080 | ||
|
|
72a23ff0d0 | ||
|
|
8378ac41fd |
No files matched your search
@@ -0,0 +1,20 @@
|
||||
agent-self-scheduling
|
||||
codex-goal-loop
|
||||
delegating-to-agents
|
||||
markdown-rendering
|
||||
run-deep-swe
|
||||
cyber-audit
|
||||
pi-custom-model
|
||||
vps-server-management
|
||||
pi-web-search
|
||||
research-prompt
|
||||
youtube-polls
|
||||
youtube-transcript
|
||||
distribute-skill-to-all-agents
|
||||
folder-specific-claude-and-agents-md
|
||||
push-skill-to-github
|
||||
brain-to-docs
|
||||
grill-me
|
||||
interview-style-doc-building
|
||||
short
|
||||
teach
|
||||
@@ -33,6 +33,13 @@ let
|
||||
rev = "6b0300214a09fd6029cfb7077043125758cd1fd2";
|
||||
hash = "sha256-TDuZ1v+taPdqyvvCs1VHUjtpSy8zHxhQKJv/kIPTpK8=";
|
||||
};
|
||||
# Skills deleted upstream from davidondrej/skills. rebuild.sh reads the same
|
||||
# file to keep these names out of the Skills CLI update. One name per line.
|
||||
deletedSkillNames = lib.pipe (builtins.readFile ./deleted-upstream-skills.txt) [
|
||||
(lib.splitString "\n")
|
||||
(map lib.trim)
|
||||
(builtins.filter (name: name != ""))
|
||||
];
|
||||
in
|
||||
|
||||
{
|
||||
@@ -71,6 +78,10 @@ in
|
||||
syntaxHighlighting.enable = true; # commands turn green when valid
|
||||
initContent = ''
|
||||
bindkey '^f' autosuggest-accept
|
||||
# Brave-only bird wrapper wins over Homebrew's npm bird shim. zshrc runs
|
||||
# after .zprofile, whose brew shellenv puts /opt/homebrew/bin first.
|
||||
typeset -U path
|
||||
path=("$HOME/.pi/agent/bin" $path)
|
||||
# Keep the OpenCode Go CLI, Pi, no-mistakes, and Hermes key aligned with
|
||||
# the desktop app login after an account switch.
|
||||
if [ -x "$HOME/.local/bin/opencode-go-key-sync" ]; then
|
||||
@@ -295,10 +306,12 @@ in
|
||||
|
||||
# Brave-only bird reader. The config points bird's Chromium source at Brave;
|
||||
# the wrapper decrypts Brave cookies with the Brave Safe Storage key and
|
||||
# hands them to bird as env vars. PATH puts ~/.pi/agent/bin before Homebrew,
|
||||
# so `bird` resolves to this wrapper. force = true on the config is needed
|
||||
# once: a pre-existing unmanaged ~/.config/bird/config.json5 would otherwise
|
||||
# make home-manager refuse the switch. The wrapper path is new, so no force.
|
||||
# hands them to bird as env vars. The session PATH puts ~/.pi/agent/bin
|
||||
# before Homebrew, so `bird` resolves to this wrapper and not the npm shim.
|
||||
# force = true on the config is needed once: a pre-existing unmanaged
|
||||
# ~/.config/bird/config.json5 would otherwise make home-manager refuse the
|
||||
# switch. The wrapper path is new, so no force.
|
||||
home.sessionPath = [ "${home}/.pi/agent/bin" ];
|
||||
home.file.".config/bird/config.json5" = {
|
||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/bird/config.json5";
|
||||
force = true;
|
||||
@@ -597,6 +610,39 @@ in
|
||||
echo "pstackSkills: installed ${toString (lib.length pstackSkillNames)} pinned skills into $dest"
|
||||
'';
|
||||
|
||||
# Remove only the skills deleted upstream from davidondrej/skills. The names
|
||||
# come from the source-controlled denylist that rebuild.sh also reads. The
|
||||
# guard below leaves every other skill, the skill lock, house-authored skills,
|
||||
# and the pinned pstack copies alone. Only exact directory or link names in
|
||||
# the agent skill folders used on this Mac are removed.
|
||||
home.activation.removeDeletedUpstreamSkills = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
set -euo pipefail
|
||||
deny_file=${./deleted-upstream-skills.txt}
|
||||
if [ ! -r "$deny_file" ]; then
|
||||
echo "removeDeletedUpstreamSkills: denylist missing at $deny_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
skill_dirs=(
|
||||
"$HOME/.agents/skills"
|
||||
"$HOME/.claude/skills"
|
||||
"$HOME/.config/opencode/skills"
|
||||
"$HOME/.grok/skills"
|
||||
)
|
||||
count=0
|
||||
while IFS= read -r name; do
|
||||
[ -n "$name" ] || continue
|
||||
count=$((count + 1))
|
||||
for dir in "''${skill_dirs[@]}"; do
|
||||
target="$dir/$name"
|
||||
if [ -e "$target" ] || [ -L "$target" ]; then
|
||||
rm -rf -- "$target"
|
||||
echo "removeDeletedUpstreamSkills: removed $target"
|
||||
fi
|
||||
done
|
||||
done < "$deny_file"
|
||||
echo "removeDeletedUpstreamSkills: checked $count deleted skill names"
|
||||
'';
|
||||
|
||||
# OpenSuperWhisper - local voice-first prompting (cask in configuration.nix).
|
||||
# The app reads its model from its own Application Support directory, so the
|
||||
# 1.6 GB Whisper model is downloaded here once and kept outside the Nix store.
|
||||
|
||||
@@ -103,6 +103,7 @@ Before the switch:
|
||||
- `no-mistakes update`, using `~/.no-mistakes/bin/no-mistakes`, or the command on `PATH` if that binary is absent.
|
||||
- `hermes update --yes`, which pulls the configured channel and restarts the services that run its new code.
|
||||
- `nix flake update`, so the switch builds from the newest locked inputs. Commit the resulting `flake.lock` change.
|
||||
- `brew trust can1357/tap` and `brew trust incoai/tap`, so `brew bundle` can install formulae from those third-party taps. Trust can revert between runs, so every rebuild restores it. The `whisper-cpp was renamed to whisper.cpp` notice is a warning. It does not abort the rebuild.
|
||||
|
||||
During the switch:
|
||||
|
||||
@@ -115,6 +116,17 @@ After the switch:
|
||||
- The Skills CLI updates skills tracked in `~/.agents/.skill-lock.json`, except `security-audit`. See [security-audit skill](#security-audit-skill-agent-security-reviews) for its freeze policy and manual update command. Untracked skills receive no update here. See [pstack skills](#pstack-skills-pinned-on-every-rebuild) for the pinned skills and their update procedure.
|
||||
- `pi update --extensions --no-approve`, run after the switch because the Homebrew bundle may have upgraded the `pi` binary.
|
||||
|
||||
## Deleted upstream skills denylist
|
||||
|
||||
`deleted-upstream-skills.txt` at the repo root names the 20 skills deleted upstream from `davidondrej/skills`. It holds one name per line. Both paths read this same source-controlled file:
|
||||
|
||||
- `rebuild.sh` filters those names out of the `skills@latest update` arguments, even when they return to `~/.agents/.skill-lock.json`.
|
||||
- `home.nix` reads the file into `deletedSkillNames` and runs `home.activation.removeDeletedUpstreamSkills`. That step removes only exact directory or link names under `~/.agents/skills`, `~/.claude/skills`, `~/.config/opencode/skills`, and `~/.grok/skills`. It leaves the skill lock, house-authored skills, pinned pstack skills, and every other skill untouched.
|
||||
|
||||
The list keeps local skill trees in sync with upstream. It also stops a deleted skill from returning through the CLI updater. Add a name here only when upstream deletes that skill. Do not add house-authored or pinned names.
|
||||
|
||||
`tests/skill-denylist.sh` checks that both paths read the list. `tests/rebuild-update-steps.py` runs `rebuild.sh` with a lock that contains denied names and asserts the update call excludes them.
|
||||
|
||||
## security-audit skill (agent security reviews)
|
||||
|
||||
`home.activation.securityAuditSkill` installs Cloudflare's `security-audit` skill from `https://github.com/cloudflare/security-audit-skill` so the coding agents can run a structured vulnerability audit. The exact command:
|
||||
|
||||
+16
-2
@@ -13,6 +13,8 @@
|
||||
# A failed switch stops the script before post-switch updates.
|
||||
set -euo pipefail
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
# Shared with home.nix: skills deleted upstream must stay out of the CLI update.
|
||||
DENYLIST="$DIR/deleted-upstream-skills.txt"
|
||||
ln -sfn "$DIR" ~/.dotfiles
|
||||
NPM=/opt/homebrew/bin/npm
|
||||
|
||||
@@ -193,6 +195,14 @@ else
|
||||
echo "==> WARNING: flake update failed. Continuing with locked inputs."
|
||||
fi
|
||||
|
||||
# Trust third-party Homebrew taps before the switch. `brew bundle` refuses to
|
||||
# install formulae from an untrusted tap, and a trust can revert between runs.
|
||||
# The whisper-cpp rename notice is only a warning and stays harmless here.
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
brew trust can1357/tap 2>/dev/null || true
|
||||
brew trust incoai/tap 2>/dev/null || true
|
||||
fi
|
||||
|
||||
sudo darwin-rebuild switch --flake ~/.dotfiles#lt-mbp
|
||||
|
||||
# Update tracked skills after activation. Exclude security-audit to preserve
|
||||
@@ -205,15 +215,19 @@ if [ ! -x "$NPX" ]; then
|
||||
echo "==> WARNING: $NPX not found. Skipping agent skill update."
|
||||
elif [ ! -f "$SKILL_LOCK" ]; then
|
||||
echo "==> WARNING: $SKILL_LOCK not found. Skipping agent skill update."
|
||||
elif [ ! -f "$DENYLIST" ]; then
|
||||
echo "==> WARNING: $DENYLIST not found. Skipping agent skill update."
|
||||
else
|
||||
skill_names="$(/usr/bin/python3 - "$SKILL_LOCK" 2>/dev/null <<'PY' || true
|
||||
skill_names="$(/usr/bin/python3 - "$SKILL_LOCK" "$DENYLIST" 2>/dev/null <<'PY' || true
|
||||
import json
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1]) as lock_file:
|
||||
skills = json.load(lock_file).get("skills", {})
|
||||
with open(sys.argv[2]) as deny_file:
|
||||
denied = {line.strip() for line in deny_file if line.strip()}
|
||||
for name in sorted(skills):
|
||||
if name != "security-audit":
|
||||
if name != "security-audit" and name not in denied:
|
||||
print(name)
|
||||
PY
|
||||
)"
|
||||
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
# Check that the Nix source wires the Brave-only bird wrapper into the shell.
|
||||
#
|
||||
# The Bird merge added home.file entries for the wrapper and the Brave config,
|
||||
# but no PATH entry. A rebuild installs the wrapper at ~/.pi/agent/bin/bird and
|
||||
# leaves `bird` resolving to Homebrew's npm shim. This check evaluates the real
|
||||
# home-manager config, then runs the generated zshrc in a fresh zsh with a fake
|
||||
# Homebrew bird ahead of the wrapper. It passes only when the wrapper wins.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
|
||||
TMP=$(mktemp -d "${TMPDIR:-/tmp}/bird-path.XXXXXX")
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }
|
||||
pass() { printf 'PASS: %s\n' "$1"; }
|
||||
|
||||
command -v nix >/dev/null 2>&1 \
|
||||
|| { echo "bird-path: nix is required to evaluate the configuration" >&2; exit 2; }
|
||||
command -v jq >/dev/null 2>&1 \
|
||||
|| { echo "bird-path: jq is required to read the session path" >&2; exit 2; }
|
||||
command -v zsh >/dev/null 2>&1 \
|
||||
|| { echo "bird-path: zsh is required to run the generated zshrc" >&2; exit 2; }
|
||||
|
||||
CONFIG='(builtins.getFlake (toString '"$ROOT"')).darwinConfigurations."lt-mbp".config.home-manager.users.laptran'
|
||||
|
||||
wrapper_source=$(nix eval --raw --impure --expr "$CONFIG.home.file.\".pi/agent/bin/bird\".source")
|
||||
wrapper_target=$(readlink "$wrapper_source" 2>/dev/null || printf '%s' "$wrapper_source")
|
||||
case "$wrapper_target" in
|
||||
*"home/.pi/agent/bin/bird") pass "source declares the Brave-only bird wrapper" ;;
|
||||
*) fail "wrapper home.file source points to $wrapper_target" ;;
|
||||
esac
|
||||
|
||||
nix eval --json --impure --expr "$CONFIG.home.sessionPath" > "$TMP/session-path.json"
|
||||
first_path=$(jq -r '.[0] // ""' "$TMP/session-path.json")
|
||||
case "$first_path" in
|
||||
*"/.pi/agent/bin") pass "session PATH puts the wrapper directory first" ;;
|
||||
*) fail "first session PATH entry is '$first_path', not the bird wrapper directory" ;;
|
||||
esac
|
||||
|
||||
nix eval --raw --impure --expr "$CONFIG.home.file.\"./.zshrc\".text" > "$TMP/zshrc"
|
||||
mkdir -p "$TMP/home/.pi/agent/bin" "$TMP/homebrew/bin"
|
||||
printf '#!/bin/sh\nprintf wrapper\n' > "$TMP/home/.pi/agent/bin/bird"
|
||||
printf '#!/bin/sh\nprintf homebrew\n' > "$TMP/homebrew/bin/bird"
|
||||
chmod +x "$TMP/home/.pi/agent/bin/bird" "$TMP/homebrew/bin/bird"
|
||||
|
||||
# shellcheck disable=SC2016 # the snippet expands inside the fresh zsh
|
||||
resolved=$(HOME="$TMP/home" ZSHRC="$TMP/zshrc" \
|
||||
PATH="$TMP/homebrew/bin:/usr/bin:/bin" \
|
||||
timeout 60 zsh -f -i -c '
|
||||
source "$ZSHRC" >/dev/null 2>&1 || exit 4
|
||||
command -v bird
|
||||
' 2>"$TMP/stderr") || {
|
||||
echo "bird-path: failed to run generated zshrc" >&2
|
||||
cat "$TMP/stderr" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
[ "$resolved" = "$TMP/home/.pi/agent/bin/bird" ] \
|
||||
|| fail "generated zshrc resolves bird to $resolved instead of the wrapper"
|
||||
|
||||
pass "generated zshrc resolves bird to the wrapper ahead of Homebrew"
|
||||
@@ -105,6 +105,15 @@ elif kind in ("no-mistakes", "hermes", "nix", "npx", "pi"):
|
||||
else:
|
||||
state["components"][kind] = "new"
|
||||
save()
|
||||
elif kind == "brew":
|
||||
if state.get("fail_brew_trust"):
|
||||
sys.exit(1)
|
||||
trusted = state.setdefault("trusted_taps", [])
|
||||
if len(args) >= 2 and args[0] == "trust" and args[1] not in trusted:
|
||||
trusted.append(args[1])
|
||||
# The rename notice is a harmless brew warning, never a rebuild failure.
|
||||
print("Warning: Formula whisper-cpp was renamed to whisper.cpp.")
|
||||
save()
|
||||
elif kind == "sudo":
|
||||
sys.exit(state.get("switch_status", 0))
|
||||
else:
|
||||
@@ -174,7 +183,9 @@ class RebuildUpdates(unittest.TestCase):
|
||||
self.state = json.loads((self.root / "state.json").read_text())
|
||||
self.calls = [json.loads(line) for line in
|
||||
(self.root / "calls.jsonl").read_text().splitlines()]
|
||||
self.assertFalse(any(call[0] in ("brew", "bare-npm") for call in self.calls))
|
||||
self.assertFalse(any(call[0] == "bare-npm" for call in self.calls))
|
||||
self.assertFalse(any(call[0] == "brew" and (len(call) < 2 or call[1] != "trust")
|
||||
for call in self.calls))
|
||||
self.assertFalse(any(call[:2] == ["npm", "view"] and
|
||||
call[2] in ACTIVATION_GLOBALS for call in self.calls))
|
||||
self.assertEqual(Path(os.readlink(self.home / ".dotfiles")), ROOT)
|
||||
@@ -210,6 +221,46 @@ class RebuildUpdates(unittest.TestCase):
|
||||
self.execute()
|
||||
self.assertFalse(any(call[:2] == ["npm", "install"] for call in self.calls))
|
||||
|
||||
def test_brew_trust_is_restored_before_switch(self):
|
||||
output = self.execute()
|
||||
self.assert_update_order()
|
||||
trust_calls = [call for call in self.calls if call[0] == "brew"]
|
||||
self.assertEqual(trust_calls, [
|
||||
["brew", "trust", "can1357/tap"],
|
||||
["brew", "trust", "incoai/tap"],
|
||||
])
|
||||
switch_index = next(i for i, call in enumerate(self.calls)
|
||||
if call[0] == "sudo")
|
||||
self.assertLess(self.calls.index(trust_calls[-1]), switch_index)
|
||||
self.assertEqual(self.state["trusted_taps"],
|
||||
["can1357/tap", "incoai/tap"])
|
||||
self.assertIn("whisper-cpp was renamed", output)
|
||||
self.assertNotIn("brew bundle failed", output)
|
||||
|
||||
def test_brew_trust_failure_still_switches(self):
|
||||
self.state["fail_brew_trust"] = True
|
||||
self.execute()
|
||||
self.assertTrue(any(call[0] == "sudo" for call in self.calls))
|
||||
|
||||
def test_deleted_upstream_skills_never_reach_the_cli(self):
|
||||
denied = (ROOT / "deleted-upstream-skills.txt").read_text().split()
|
||||
self.assertEqual(len(denied), 20)
|
||||
names = denied + ["tdd", "security-audit", "codebase-design"]
|
||||
(self.home / ".agents/.skill-lock.json").write_text(
|
||||
json.dumps({"skills": {name: {} for name in names}}))
|
||||
self.state["skills"] = {name: "old" for name in names}
|
||||
self.execute()
|
||||
skills_call = next(call for call in self.calls if call[0] == "npx")
|
||||
for name in denied:
|
||||
self.assertNotIn(name, skills_call)
|
||||
self.assertEqual(self.state["skills"][name], "old")
|
||||
self.assertIn("tdd", skills_call)
|
||||
self.assertEqual(self.state["skills"]["tdd"], "new")
|
||||
self.assertNotIn("security-audit", skills_call)
|
||||
self.assertEqual(self.state["skills"]["security-audit"], "old")
|
||||
self.assertIn("codebase-design", skills_call)
|
||||
self.assertEqual(self.state["skills"]["codebase-design"], "new")
|
||||
|
||||
def test_absent_packages_are_not_installed_or_queried(self):
|
||||
self.state["packages"] = {}
|
||||
self.execute()
|
||||
@@ -248,7 +299,8 @@ class RebuildUpdates(unittest.TestCase):
|
||||
(self.home / ".no-mistakes/bin/no-mistakes").unlink()
|
||||
output = self.execute()
|
||||
self.assertGreaterEqual(output.count("WARNING:"), 5)
|
||||
self.assertEqual([call[0] for call in self.calls], ["nix", "sudo"])
|
||||
self.assertEqual([call[0] for call in self.calls],
|
||||
["nix", "brew", "brew", "sudo"])
|
||||
|
||||
def test_no_mistakes_path_fallback(self):
|
||||
(self.home / ".no-mistakes/bin/no-mistakes").unlink()
|
||||
|
||||
@@ -14,5 +14,7 @@ status=0
|
||||
"$ROOT/tests/crew-dispatch.sh" || status=1
|
||||
"$ROOT/tests/rebuild-update-steps.sh" || status=1
|
||||
"$ROOT/tests/bird-brave-e2e.sh" || status=1
|
||||
"$ROOT/tests/bird-path.sh" || status=1
|
||||
"$ROOT/tests/skill-denylist.sh" || status=1
|
||||
|
||||
exit "$status"
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
# End-to-end check for the shared deleted-upstream skill denylist.
|
||||
#
|
||||
# The same source-controlled file must drive both paths. home.nix copies it to
|
||||
# the Nix store and reads it in home.activation.removeDeletedUpstreamSkills.
|
||||
# rebuild.sh reads it from its own checkout before calling the Skills CLI. This
|
||||
# check compares the Nix copy with the source file and confirms rebuild.sh uses
|
||||
# the same name to filter CLI arguments. The CLI call itself is exercised with
|
||||
# spies in tests/rebuild-update-steps.py.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
|
||||
LIST="$ROOT/deleted-upstream-skills.txt"
|
||||
CONFIG='(builtins.getFlake (toString '"$ROOT"')).darwinConfigurations."lt-mbp".config.home-manager.users.laptran'
|
||||
|
||||
fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }
|
||||
pass() { printf 'PASS: %s\n' "$1"; }
|
||||
|
||||
command -v nix >/dev/null 2>&1 \
|
||||
|| { echo "skill-denylist: nix is required to evaluate the configuration" >&2; exit 2; }
|
||||
|
||||
[ -r "$LIST" ] || fail "denylist missing at $LIST"
|
||||
|
||||
expected='agent-self-scheduling
|
||||
codex-goal-loop
|
||||
delegating-to-agents
|
||||
markdown-rendering
|
||||
run-deep-swe
|
||||
cyber-audit
|
||||
pi-custom-model
|
||||
vps-server-management
|
||||
pi-web-search
|
||||
research-prompt
|
||||
youtube-polls
|
||||
youtube-transcript
|
||||
distribute-skill-to-all-agents
|
||||
folder-specific-claude-and-agents-md
|
||||
push-skill-to-github
|
||||
brain-to-docs
|
||||
grill-me
|
||||
interview-style-doc-building
|
||||
short
|
||||
teach'
|
||||
|
||||
[ "$(cat "$LIST")" = "$expected" ] || fail "denylist does not hold the 20 expected names"
|
||||
pass "denylist holds the 20 deleted upstream skills"
|
||||
|
||||
activation=$(nix eval --raw --impure --expr "$CONFIG.home.activation.removeDeletedUpstreamSkills.data")
|
||||
nix_list=$(printf '%s\n' "$activation" | sed -n 's/^deny_file=//p')
|
||||
[ -n "$nix_list" ] || fail "activation script does not reference a denylist file"
|
||||
cmp -s "$nix_list" "$LIST" || fail "Nix denylist copy differs from $LIST"
|
||||
pass "home.nix activation reads the same denylist"
|
||||
|
||||
# shellcheck disable=SC2016 # the literal line in rebuild.sh is the assertion
|
||||
grep -qF 'DENYLIST="$DIR/deleted-upstream-skills.txt"' "$ROOT/rebuild.sh" \
|
||||
|| fail "rebuild.sh does not read the shared denylist"
|
||||
grep -qF 'name not in denied' "$ROOT/rebuild.sh" \
|
||||
|| fail "rebuild.sh does not filter denied names from the Skills CLI call"
|
||||
pass "rebuild.sh reads the same denylist and filters CLI arguments"
|
||||
Reference in new issue
Block a user