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
8 changes: 0 additions & 8 deletions .dotfiles/git-hooks/dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ if [ "$hook" = post-checkout ] && [ "${1:-}" = "$null_head" ] &&
fi
fi

# Pin the exact workflow snapshot about to be committed. The helper updates the
# index without staging unrelated working-tree edits, then mirrors its small
# fix back to the working tree when that can be done without a conflict.
dispatch_dir="$(cd "$(dirname "$0")" && pwd)"
if [ "$hook" = pre-commit ] && [ -x "$dispatch_dir/pinact-staged" ]; then
"$dispatch_dir/pinact-staged" || exit $?
fi

# Forward to the repository's own hook. Resolve it through git-common-dir
# rather than `git rev-parse --git-path`, which honours core.hooksPath and
# would point straight back at this script.
Expand Down
21 changes: 8 additions & 13 deletions .dotfiles/git-hooks/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ HOOKS_DIR="${GIT_HOOKS_DIR:-$HOME/.config/git/hooks}"
# the base URL it exported rather than resolving main a second time.
RAW_BASE="${DOTFILES_RAW_BASE:-https://raw.githubusercontent.com/bmthd/dotfiles/${DOTFILES_REF:-main}}"
DISPATCH_URL="$RAW_BASE/.dotfiles/git-hooks/dispatch"
PINACT_STAGED_URL="$RAW_BASE/.dotfiles/git-hooks/pinact-staged"
# Identifies a dispatch this script wrote, so a re-run refreshes its own files
# and only its own.
MARKER="bmthd/dotfiles global git hook dispatcher"
# The helper that used to SHA-pin staged workflows with pinact. Workflow pinning
# is now the job of each repository's own .github/workflows/actions.lock, which
# a machine-wide hook cannot write for a repository that never opted in, so the
# helper is gone — and removed from machines it was installed on, but only when
# the marker proves this script put it there.
PINACT_MARKER="bmthd/dotfiles staged pinact helper"

# githooks(5), including the server-side and p4 hooks. core.hooksPath replaces
Expand All @@ -42,11 +46,6 @@ if [ -e "$HOOKS_DIR/dispatch" ] && ! grep -q "$MARKER" "$HOOKS_DIR/dispatch" 2>
echo "⚠ $HOOKS_DIR/dispatch exists and was not written by this script; aborting"
exit 1
fi
if [ -e "$HOOKS_DIR/pinact-staged" ] &&
! grep -q "$PINACT_MARKER" "$HOOKS_DIR/pinact-staged" 2> /dev/null; then
echo "⚠ $HOOKS_DIR/pinact-staged exists and was not written by this script; aborting"
exit 1
fi

local_dispatch="$(cd "$(dirname "$0")" && pwd)/dispatch"
if [ -f "$local_dispatch" ]; then
Expand All @@ -57,14 +56,10 @@ elif ! curl -fsSL "$DISPATCH_URL" -o "$HOOKS_DIR/dispatch"; then
fi
chmod +x "$HOOKS_DIR/dispatch"

local_pinact_staged="$(cd "$(dirname "$0")" && pwd)/pinact-staged"
if [ -f "$local_pinact_staged" ]; then
cp "$local_pinact_staged" "$HOOKS_DIR/pinact-staged"
elif ! curl -fsSL "$PINACT_STAGED_URL" -o "$HOOKS_DIR/pinact-staged"; then
echo "⚠ Failed to download the staged pinact helper"
exit 1
if [ -f "$HOOKS_DIR/pinact-staged" ] &&
grep -q "$PINACT_MARKER" "$HOOKS_DIR/pinact-staged" 2> /dev/null; then
rm -f "$HOOKS_DIR/pinact-staged"
fi
chmod +x "$HOOKS_DIR/pinact-staged"

skipped=()
for hook in "${HOOK_NAMES[@]}"; do
Expand Down
60 changes: 0 additions & 60 deletions .dotfiles/git-hooks/pinact-staged

This file was deleted.

2 changes: 1 addition & 1 deletion .dotfiles/setup/git-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# comment there.
RAW_BASE="${DOTFILES_RAW_BASE:-https://raw.githubusercontent.com/bmthd/dotfiles/${DOTFILES_REF:-main}}"
INSTALLER="$(mktemp)"
# The installer downloads dispatch and pinact-staged itself, so hand it the
# The installer downloads dispatch itself, so hand it the
# same base rather than letting it fall back to main on its own.
export DOTFILES_RAW_BASE="$RAW_BASE"
if curl -fsSL "$RAW_BASE/.dotfiles/git-hooks/install.sh" -o "$INSTALLER"; then
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file is machine-generated by `gh actions-lock`.
# Do not edit by hand; run `gh actions-lock` to update.
# Docs: https://gh.io/actions-lockfile
version: 'v0.0.3'
workflows:
'.github/workflows/bump-tools.yml':
- 'actions/checkout@v7.0.1'
- 'actions/create-github-app-token@v3.3.0'
- 'flatt-security/setup-takumi-guard-npm@v1.4.0'
- 'jdx/mise-action@v4.3.0'
'.github/workflows/quality.yml':
- 'actions/checkout@v7.0.1'
- 'flatt-security/setup-takumi-guard-npm@v1.4.0'
- 'jdx/mise-action@v4.3.0'
- 'ludeeus/action-shellcheck@2.0.0'
dependencies:
'actions/checkout@v7.0.1':
ref: 'v7.0.1'
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'actions/create-github-app-token@v3.3.0':
ref: 'v3.3.0'
commit: 'sha1-64ab729a6294000f5aa4a4bc0b73d1f32bc45510'
owner_id: 44036562
repo_id: 642580244
'flatt-security/setup-takumi-guard-npm@v1.4.0':
ref: 'v1.4.0'
commit: 'sha1-14f07d0cbc739b42a1b7c70a04c2b84cd1318ddd'
owner_id: 88821409
repo_id: 1160374496
'jdx/mise-action@v4.3.0':
ref: 'v4.3.0'
commit: 'sha1-c2a87611a18de5b3828c5652fe268e992400cb5c'
owner_id: 216188
repo_id: 738284564
'ludeeus/action-shellcheck@2.0.0':
ref: '2.0.0'
commit: 'sha1-00cae500b08a931fb5698e11e79bfbd38e612a38'
owner_id: 15093472
repo_id: 174679242
8 changes: 4 additions & 4 deletions .github/workflows/bump-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
steps:
- name: Mint a token for the bypass-listed App
id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
uses: actions/create-github-app-token@v3.3.0
with:
client-id: ${{ secrets.BUMP_APP_CLIENT_ID }}
private-key: ${{ secrets.BUMP_APP_PRIVATE_KEY }}

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v7.0.1
with:
# Keep the App token as the push credential; the default GITHUB_TOKEN
# would be rejected by the ruleset.
Expand All @@ -44,8 +44,8 @@ jobs:
# Resolving the `npm:` tools reaches the npm registry, so send that
# traffic through the same malware-blocking proxy the installed machines
# use. Anonymous mode needs no bot-id and no extra permissions.
- uses: flatt-security/setup-takumi-guard-npm@14f07d0cbc739b42a1b7c70a04c2b84cd1318ddd # v1.4.0
- uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
- uses: flatt-security/setup-takumi-guard-npm@v1.4.0
- uses: jdx/mise-action@v4.3.0
with:
install: false

Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
name: Mise
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v7.0.1
# Resolving the `npm:` tools below reaches the npm registry, so send that
# traffic through the same malware-blocking proxy the installed machines
# use. Anonymous mode needs no bot-id and no extra permissions.
- uses: flatt-security/setup-takumi-guard-npm@14f07d0cbc739b42a1b7c70a04c2b84cd1318ddd # v1.4.0
- uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
- uses: flatt-security/setup-takumi-guard-npm@v1.4.0
- uses: jdx/mise-action@v4.3.0
with:
install: false
- name: Validate tool config parses
Expand All @@ -42,23 +42,40 @@ jobs:
# checks that a task and its script still agree.
- name: Test the setup task facade
run: bash tests/setup-facade-test.sh
- name: Verify immutable GitHub Actions references
run: mise x pinact -- pinact run --check --verify-comment
env:
GITHUB_TOKEN: ${{ github.token }}

actions-lock:
# Actions refuses to run an onboarded workflow whose `uses:` has no entry in
# .github/workflows/actions.lock, but only once the job starts. --verify
# catches a missing entry, or a locked commit that no longer verifies
# upstream, on the PR that introduces it. Renovate regenerates the lockfile
# in its own PRs; a hand edit to a workflow needs `gh actions-lock` rerun.
name: Actions lockfile
runs-on: ubuntu-latest
permissions:
contents: read
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
# Pinned: the extension is what decides whether every other action here
# is trustworthy, so it is not one to take at whatever main is today.
- run: gh extension install github/gh-actions-lock --pin v0.4.1
- run: gh actions-lock --verify

shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
- uses: actions/checkout@v7.0.1
- uses: ludeeus/action-shellcheck@2.0.0

syntax:
name: Shell syntax
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v7.0.1
- name: bash -n
run: |
bash -n install.sh
Expand Down
5 changes: 3 additions & 2 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pnpm = { version = "latest" }
bun = { version = "latest" }
ghq = { version = "latest" }
jq = { version = "latest" }
pinact = { version = "latest" }
uv = { version = "latest" }
"cargo:similarity-ts" = { version = "latest" }
"npm:@antfu/ni" = { version = "latest" }
Expand All @@ -54,7 +53,9 @@ oci = { version = "latest" }
cloudflared = { version = "latest" }
wrangler = { version = "latest" }
hunk = { version = "latest" }
github-cli = { version = "latest", postinstall = "gh extension install github/gh-stack 2>/dev/null || gh extension upgrade stack 2>/dev/null || true" }
# gh-actions-lock regenerates .github/workflows/actions.lock after a hand edit
# to a workflow; CI only verifies it.
github-cli = { version = "latest", postinstall = "gh extension install github/gh-stack 2>/dev/null || gh extension upgrade stack 2>/dev/null || true; gh extension install github/gh-actions-lock 2>/dev/null || gh extension upgrade actions-lock 2>/dev/null || true" }
# `depends = ["node"]` on the npm: tools below: their postinstall shells out to
# `npx`, which only exists once node is installed. Without the explicit
# dependency mise may run it while node is still being (re)installed — `mise
Expand Down
4 changes: 2 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ curl -fsSL https://raw.githubusercontent.com/bmthd/dotfiles/main/install.sh | ba
- **エージェントスキル** — Claude Code / OpenCode / Cursor / Codex / Gemini CLI の 5 つに同じものを導入
- **プラグイン** — Codex、pstack、および公式プラグイン (TypeScript LSP)
- **npm レジストリ** — マルウェアを遮断する [Takumi Guard](https://npm.flatt.tech/) プロキシ経由に変更
- **グローバル git フック** — 新しい worktree の mise config を trust し、repository hook と部分 stage を維持したまま、commit 前に staged GitHub Actions 参照を pin する ([`.dotfiles/git-hooks`](.dotfiles/git-hooks))
- **グローバル git フック** — repository hook を維持したまま、新しい worktree の mise config を trust する ([`.dotfiles/git-hooks`](.dotfiles/git-hooks))
- **シェルの起動ファイル** — mise の有効化と更新通知を、mise が所有し書き換えられるブロックとして `~/.zshrc` と `~/.bashrc` に書き込む([`.mise.toml`](.mise.toml) の `[bootstrap.mise_shell_activate]` と `[dotfiles]`)

セットアップはいつでも mise タスクとして再実行できます。
Expand Down Expand Up @@ -85,7 +85,7 @@ mise の設定はもう含まれません。リポジトリ側のコピーは `~
| [`mise.lock`](mise.lock) | 実際に入るバージョンとチェックサム。`~/.config/mise/mise.lock` に配置される |
| [`.agents/skills`](.agents/skills) | このリポジトリ専用のスキル。汎用のものは [bmthd/skills](https://github.com/bmthd/skills) に分離 |
| [`renovate.json`](renovate.json) | GitHub Actions の更新 PR の方針 |
| [`.githooks`](.githooks) | `[tools]` を守る repository 固有の pre-commit フック。global dispatcher は先に pinact を実行してからここへ処理を渡す |
| [`.githooks`](.githooks) | `[tools]` を守る repository 固有の pre-commit フック。global dispatcher からここへ処理を渡す |

ツールのバージョンは `mise upgrade` ではなく、毎日走る [`bump-tools.yml`](.github/workflows/bump-tools.yml) が `mise.lock` を進めることで上がります。
手元で先に進めたい場合は `mise lock --bump --minimum-release-age 2d --global`。
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Afterwards, restart the shell or run `source ~/.zshrc` (`source ~/.bashrc` for b
- **Agent skills** — the same set installed for Claude Code, OpenCode, Cursor, Codex, and Gemini CLI
- **Plugins** — Codex, pstack, plus the official plugins (TypeScript LSP)
- **npm registry** — routed through [Takumi Guard](https://npm.flatt.tech/), a proxy that refuses known-malicious packages
- **Global git hooks** — trust mise configs in new worktrees and pin staged GitHub Actions references before commit, while preserving repository hooks and partial staging ([`.dotfiles/git-hooks`](.dotfiles/git-hooks))
- **Global git hooks** — trust mise configs in new worktrees while preserving repository hooks ([`.dotfiles/git-hooks`](.dotfiles/git-hooks))
- **Shell startup** — the mise activation and the update notice, written into `~/.zshrc` and `~/.bashrc` as blocks mise owns and can rewrite (`[bootstrap.mise_shell_activate]` and `[dotfiles]` in [`.mise.toml`](.mise.toml))

The setup can be re-run at any time as a mise task.
Expand Down Expand Up @@ -79,7 +79,7 @@ All of the setup logic lives in mise.
| [`mise.lock`](mise.lock) | The versions and checksums that actually get installed, installed to `~/.config/mise/mise.lock` |
| [`.agents/skills`](.agents/skills) | Skills specific to this repository; the general-purpose ones live in [bmthd/skills](https://github.com/bmthd/skills) |
| [`renovate.json`](renovate.json) | Update policy for GitHub Actions PRs |
| [`.githooks`](.githooks) | A repository pre-commit hook guarding the `[tools]` block; the global dispatcher runs pinact first and then forwards here |
| [`.githooks`](.githooks) | A repository pre-commit hook guarding the `[tools]` block; the global dispatcher forwards here |

Tool versions move when the daily [`bump-tools.yml`](.github/workflows/bump-tools.yml) advances `mise.lock`, not through `mise upgrade`.
To get ahead locally: `mise lock --bump --minimum-release-age 2d --global`.
Expand Down
Loading
Loading