Simplify beads integration to use bd setup claude

Replace complex marketplace plugin installation with simple 'bd setup claude'
which installs hooks into ~/.claude/settings.json. This is the recommended
approach for Claude Code (CLI + hooks) vs the MCP server approach.
This commit is contained in:
2026-01-08 19:28:17 -08:00
parent 19ee298b71
commit 4e6123de9a

View File

@@ -15,8 +15,6 @@ let
ref = "main";
};
# Beads repository is available via globalInputs.beads from the flake
beadsRepo = globalInputs.beads;
in
{
options.home.roles.development = {
@@ -93,49 +91,14 @@ in
}"
'';
# Install beads Claude plugin as a marketplace
home.activation.claudeCodeBeadsPlugin = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeCommands"] ''
# Create plugin directories
mkdir -p ~/.claude/plugins/marketplaces
mkdir -p ~/.claude/plugins/repos
# Set up beads Claude Code integration (hooks for SessionStart/PreCompact)
# This uses the CLI + hooks approach which is recommended over MCP for Claude Code
home.activation.claudeCodeBeadsSetup = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeCommands"] ''
# Run bd setup claude to install hooks into ~/.claude/settings.json
# This is idempotent - safe to run multiple times
${globalInputs.beads.packages.${system}.default}/bin/bd setup claude 2>/dev/null || true
# Remove old beads marketplace if it exists (to ensure clean update)
rm -rf ~/.claude/plugins/marketplaces/beads-marketplace
# Copy beads repository to marketplaces directory
# Using cp -r because the source is a Nix store path (read-only)
cp -r ${beadsRepo} ~/.claude/plugins/marketplaces/beads-marketplace
chmod -R u+w ~/.claude/plugins/marketplaces/beads-marketplace
# Update known_marketplaces.json to include beads-marketplace
KNOWN_MARKETPLACES="$HOME/.claude/plugins/known_marketplaces.json"
if [ ! -f "$KNOWN_MARKETPLACES" ]; then
echo '{}' > "$KNOWN_MARKETPLACES"
fi
# Add beads-marketplace entry using jq (merge with existing)
${pkgs.jq}/bin/jq --arg installPath "$HOME/.claude/plugins/marketplaces/beads-marketplace" \
'. + {"beads-marketplace": {
"source": {"source": "github", "repo": "steveyegge/beads"},
"installLocation": $installPath,
"lastUpdated": (now | strftime("%Y-%m-%dT%H:%M:%S.000Z"))
}}' "$KNOWN_MARKETPLACES" > "$KNOWN_MARKETPLACES.tmp" && mv "$KNOWN_MARKETPLACES.tmp" "$KNOWN_MARKETPLACES"
# Update config.json to install the beads plugin
CONFIG_JSON="$HOME/.claude/plugins/config.json"
if [ ! -f "$CONFIG_JSON" ]; then
echo '{"repositories": {}}' > "$CONFIG_JSON"
fi
# Add beads to installed repositories
${pkgs.jq}/bin/jq --arg installPath "$HOME/.claude/plugins/marketplaces/beads-marketplace" \
'.repositories["beads-marketplace/beads"] = {
"source": {"source": "marketplace", "marketplace": "beads-marketplace", "plugin": "beads"},
"installLocation": $installPath,
"installedAt": (now | strftime("%Y-%m-%dT%H:%M:%S.000Z"))
}' "$CONFIG_JSON" > "$CONFIG_JSON.tmp" && mv "$CONFIG_JSON.tmp" "$CONFIG_JSON"
$DRY_RUN_CMD echo "Claude Code beads plugin installed successfully"
$DRY_RUN_CMD echo "Claude Code beads integration configured (hooks installed)"
'';
# Note: modules must be imported at top-level home config