Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 11 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@
}
]
},
{
"matcher": "Write|Edit",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match MultiEdit for memory updates

If a Claude Code version exposes MultiEdit (as the adjacent post-edit hook already accounts for), memory files changed via that tool skip this reminder entirely because the Claude Code hooks reference treats Write|Edit as an exact list of tool names, not a substring regex. Batched updates under ~/.claude/projects/*/memory/ therefore won't inject the Notion sync context even though they are the same memory-update scenario.

Useful? React with 👍 / 👎.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
"hooks": [
{
"type": "command",
"command": "jq -c 'if ((.tool_input.file_path // \"\") | test(\"/[.]claude/projects/[^/]+/memory/\")) then {\"hookSpecificOutput\":{\"hookEventName\":\"PostToolUse\",\"additionalContext\":\"📝 メモリを更新しました。READMEの反映先チェックリストに従い、①NotionコンテキストDocの🔄最近の動き ②デイリーログ への反映も必要か確認し、必要ならその場で反映してください。\"}} else empty end'",
"timeout": 10,
"statusMessage": "メモリ更新を検知..."
}
]
},
{
"matcher": "Bash",
"hooks": [
Expand Down
6 changes: 3 additions & 3 deletions .zsh/configs/pre/devcontainer-env.zsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Expose selected shared local secrets to CLI tools such as Codex MCP servers.
# NOTE: This list is duplicated in nix/home/zsh.nix (home.file). Keep both in sync.
# Clear previously exported tokens so removed entries in ~/.devcontainer.env don't linger.
unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN
unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN ELU_SENTRY_TOKEN GEMINI_API_KEY ELU_NOTION_API_KEY OYKOT_NOTION_API_KEY GITHUB_TOKEN NODE_AUTH_TOKEN

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inherited GitHub/npm tokens

When a devcontainer, Codespace, or parent shell already injects GITHUB_TOKEN or NODE_AUTH_TOKEN, this startup file now unsets them before it even checks whether ~/.devcontainer.env exists or contains replacements. Because nix/home/zsh.nix sources this loader during zsh startup, shells without those keys in ~/.devcontainer.env lose otherwise-valid GitHub/npm credentials and gh, npm package installs, or package publishing can fail; the home-manager copy of this list needs the same treatment.

Useful? React with 👍 / 👎.

if [[ -r "$HOME/.devcontainer.env" ]]; then
while IFS='=' read -r _codex_env_key _codex_env_value || [[ -n $_codex_env_key ]]; do
# Strip trailing CR so Windows-style CRLF files work correctly.
_codex_env_value="${_codex_env_value%$'\r'}"
case "$_codex_env_key" in
# Allowed keys: SUPABASE_ACCESS_TOKEN | VERCEL_TOKEN | LINEAR_API_KEY | DOPPLER_TOKEN
SUPABASE_ACCESS_TOKEN|VERCEL_TOKEN|LINEAR_API_KEY|DOPPLER_TOKEN)
# Allowed keys: SUPABASE_ACCESS_TOKEN | VERCEL_TOKEN | LINEAR_API_KEY | DOPPLER_TOKEN | ELU_SENTRY_TOKEN | GEMINI_API_KEY | ELU_NOTION_API_KEY | OYKOT_NOTION_API_KEY | GITHUB_TOKEN | NODE_AUTH_TOKEN
SUPABASE_ACCESS_TOKEN|VERCEL_TOKEN|LINEAR_API_KEY|DOPPLER_TOKEN|ELU_SENTRY_TOKEN|GEMINI_API_KEY|ELU_NOTION_API_KEY|OYKOT_NOTION_API_KEY|GITHUB_TOKEN|NODE_AUTH_TOKEN)
export "$_codex_env_key=$_codex_env_value"
;;
esac
Expand Down
13 changes: 13 additions & 0 deletions credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ credentials/
| **Linear** | `.codex` | `LINEAR_API_KEY` | Linear 課題操作 |
| **Doppler** | `.codex` | `DOPPLER_TOKEN` | Secret 管理 |
| **n8n** | optional/manual | `N8N_API_URL`, `N8N_API_KEY` | n8n ワークフロー自動化 |
| **Sentry** | local tooling | `ELU_SENTRY_TOKEN` | ELU Sentry 操作 |
| **Gemini API** | local tooling | `GEMINI_API_KEY` | Gemini API 利用 |
| **Notion** | local tooling | `ELU_NOTION_API_KEY`, `OYKOT_NOTION_API_KEY` | Notion integration token |
| **GitHub Packages** | local tooling | `GITHUB_TOKEN`, `NODE_AUTH_TOKEN` | npm/GitHub Packages 認証 |

### MCP環境変数の設定

Expand All @@ -77,8 +81,17 @@ credentials/
- GitHub / GITHUB_COPILOT_MCP_TOKEN
- N8N_API_URL / value
- N8N_API_KEY / value
- Sentry / ELU_SENTRY_TOKEN
- Gemini / GEMINI_API_KEY
- NOTION_SECRET / ELU_NOTION_API_KEY
- NOTION_SECRET / OYKOT_NOTION_API_KEY
- GITHUB_TOKEN / credential
```

`NODE_AUTH_TOKEN` は `GITHUB_TOKEN` と同じ 1Password 参照から生成します。
`OP_SERVICE_ACCOUNT_TOKEN` は 1Password 自身へアクセスするためのトークンなので、
このテンプレートでは管理しません。

### 従来の方法

レガシーな方法でクレデンシャルを取得する場合:
Expand Down
8 changes: 8 additions & 0 deletions credentials/templates/mcp.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ GITHUB_COPILOT_MCP_TOKEN=op://Dev/GitHub/GITHUB_COPILOT_MCP_TOKEN
# n8n API Configuration (n8n MCP サーバー用)
N8N_API_URL=op://Dev/N8N_API_URL/value
N8N_API_KEY=op://Dev/N8N_API_KEY/value

# Project service tokens
ELU_SENTRY_TOKEN=op://Dev/Sentry/ELU_SENTRY_TOKEN
GEMINI_API_KEY=op://Dev/Gemini/GEMINI_API_KEY
ELU_NOTION_API_KEY=op://Dev/NOTION_SECRET/ELU_NOTION_API_KEY
OYKOT_NOTION_API_KEY=op://Dev/NOTION_SECRET/OYKOT_NOTION_API_KEY
GITHUB_TOKEN=op://Dev/GITHUB_TOKEN/credential
NODE_AUTH_TOKEN=op://Dev/GITHUB_TOKEN/credential
6 changes: 3 additions & 3 deletions nix/home/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
# Expose selected shared local secrets to CLI tools such as Codex MCP servers.
# NOTE: This list is duplicated in .zsh/configs/pre/devcontainer-env.zsh. Keep both in sync.
# Clear previously exported tokens so removed entries in ~/.devcontainer.env don't linger.
unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN
unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN ELU_SENTRY_TOKEN GEMINI_API_KEY ELU_NOTION_API_KEY OYKOT_NOTION_API_KEY GITHUB_TOKEN NODE_AUTH_TOKEN
if [[ -r "$HOME/.devcontainer.env" ]]; then
while IFS='=' read -r _codex_env_key _codex_env_value || [[ -n $_codex_env_key ]]; do
# Strip trailing CR so Windows-style CRLF files work correctly.
_codex_env_value="''${_codex_env_value%$'\r'}"
case "$_codex_env_key" in
# Allowed keys: SUPABASE_ACCESS_TOKEN | VERCEL_TOKEN | LINEAR_API_KEY | DOPPLER_TOKEN
SUPABASE_ACCESS_TOKEN|VERCEL_TOKEN|LINEAR_API_KEY|DOPPLER_TOKEN)
# Allowed keys: SUPABASE_ACCESS_TOKEN | VERCEL_TOKEN | LINEAR_API_KEY | DOPPLER_TOKEN | ELU_SENTRY_TOKEN | GEMINI_API_KEY | ELU_NOTION_API_KEY | OYKOT_NOTION_API_KEY | GITHUB_TOKEN | NODE_AUTH_TOKEN
SUPABASE_ACCESS_TOKEN|VERCEL_TOKEN|LINEAR_API_KEY|DOPPLER_TOKEN|ELU_SENTRY_TOKEN|GEMINI_API_KEY|ELU_NOTION_API_KEY|OYKOT_NOTION_API_KEY|GITHUB_TOKEN|NODE_AUTH_TOKEN)
export "$_codex_env_key=$_codex_env_value"
;;
esac
Expand Down
3 changes: 3 additions & 0 deletions nix/modules/homebrew.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@
"aerospace"
"alfred"
"bettertouchtool"
"duet"
"linear"
"notion"
"notion-calendar"
"raycast"
"readdle-spark"

# AI Tools
"chatgpt"
Expand Down
14 changes: 13 additions & 1 deletion test/integration/credentials_templates.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ extract_mcp_env_vars() {
local template="$REPO_ROOT/credentials/templates/mcp.env.template"
local readme="$REPO_ROOT/credentials/README.md"
local referenced_vars
local optional_vars=(N8N_API_URL N8N_API_KEY)
local optional_vars=(
N8N_API_URL
N8N_API_KEY
ELU_SENTRY_TOKEN
GEMINI_API_KEY
ELU_NOTION_API_KEY
OYKOT_NOTION_API_KEY
GITHUB_TOKEN
NODE_AUTH_TOKEN
)
local var

assert_file_exists "$template"
Expand All @@ -42,4 +51,7 @@ extract_mcp_env_vars() {
grep -q "^${var}=op://Dev/" "$template"
grep -q "$var" "$readme"
done

! grep -q "^OP_SERVICE_ACCOUNT_TOKEN=" "$template"
grep -q "OP_SERVICE_ACCOUNT_TOKEN" "$readme"
}
27 changes: 27 additions & 0 deletions test/nix-darwin-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ describe('nix-darwin and home-manager macOS configuration', () => {
expect(homebrewModule).toContain('"flutter"');
expect(homebrewModule).toContain('"google-chrome"');
expect(homebrewModule).toContain('"google-japanese-ime"');
expect(homebrewModule).toContain('"duet"');
expect(homebrewModule).toContain('"linear"');
expect(homebrewModule).toContain('"readdle-spark"');
expect(homebrewModule).not.toContain('"mattermost"');
expect(homebrewModule).not.toContain('"messenger"');
expect(homebrewModule).not.toContain('"karabiner-elements"');
Expand Down Expand Up @@ -150,6 +153,30 @@ describe('nix-darwin and home-manager macOS configuration', () => {
expect(dotfilesModule).not.toContain('.env.secret"');
});

test('devcontainer env loader exports approved local credential keys', () => {
const zshModule = readRepoFile('nix/home/zsh.nix');
const devcontainerEnvLoader = readRepoFile('.zsh/configs/pre/devcontainer-env.zsh');

[
'SUPABASE_ACCESS_TOKEN',
'VERCEL_TOKEN',
'LINEAR_API_KEY',
'DOPPLER_TOKEN',
'ELU_SENTRY_TOKEN',
'GEMINI_API_KEY',
'ELU_NOTION_API_KEY',
'OYKOT_NOTION_API_KEY',
'GITHUB_TOKEN',
'NODE_AUTH_TOKEN',
].forEach((envKey) => {
expect(zshModule).toContain(envKey);
expect(devcontainerEnvLoader).toContain(envKey);
});

expect(zshModule).not.toContain('OP_SERVICE_ACCOUNT_TOKEN');
expect(devcontainerEnvLoader).not.toContain('OP_SERVICE_ACCOUNT_TOKEN');
});

test('agent local config collector is installed as a safe command', () => {
const agentCommandsModule = readRepoFile('nix/home/agent-commands.nix');
const packagesModule = readRepoFile('nix/home/packages.nix');
Expand Down