KeiSeiKit-1.0/install/lib-summary.sh
KeiSei84 3e0be312f8 feat(install): first-run /onboard nudge + normalize null hook matchers (#38)
1. SessionStart hook first-run-onboard.sh: on first Claude Code session after
   install, nudges user/Claude to run `/onboard ~/Projects/*` (scan stack +
   create a project-specialist agent per project; delegates to /new-agent).
   Fires once (marker), then silent. Wired in settings-snippet under SessionStart.
2. lib-summary next-steps: lead with /onboard ~/Projects/*, then /new-agent.
3. lib-hooks merge: normalize null/absent matcher → "" (Claude Code /doctor
   rejects null; pre-kit hooks often lack a matcher field).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 19:38:22 +08:00

107 lines
3.7 KiB
Bash

# shellcheck shell=bash
# lib-summary.sh — final success banner with next-step hints.
#
# Two shapes: "hooks activated" vs "hooks pending manual merge". Both tell
# the user how to verify the install and how to create a new specialist.
# v0.40 Wave 39: appends substrate-ready block listing kei-fork/kei-ledger/
# kei-spawn entry points + kei-doctor health check + sleep-layer setup.
#
# Requires: say from lib-log.sh.
# Reads globals: $PROFILE, $DID_ACTIVATE, $KIT_DIR, $AGENTS_DIR, $HOME_DIR.
# Print the substrate-ready next-steps block (always shown after install).
print_substrate_summary() {
local target_dir="$AGENTS_DIR/_primitives/_rust/target/release"
cat <<EOF
==========================================================================
Substrate ready
==========================================================================
Substrate primitives are installed under:
$target_dir/
Quick sanity checks:
kei-fork list # managed worktrees + ledger lifecycle
kei-ledger list # agent-fork rows
kei-spawn list-pending # pending spawn requests
Full health diagnostic:
kei-doctor # PATH, ledger, secrets, deps
kei-doctor --fix # attempt to repair what is recoverable
EOF
case "$PROFILE" in
cortex|full)
cat <<EOF
Cortex profile:
/cortex-setup # token, whisper, model, UI bundle, daemon
EOF
;;
esac
cat <<EOF
Sleep layer (recommended — nightly REM consolidation):
/sleep-setup # one-time wizard
If kei-* commands are not found, open a new terminal or run:
source ~/.bashrc # or ~/.zshrc / ~/.config/fish/config.fish
==========================================================================
EOF
}
print_summary() {
local settings_file="$HOME_DIR/.claude/settings.json"
echo
say "install complete (profile=$PROFILE)"
echo
if [ "$DID_ACTIVATE" = "1" ]; then
cat <<EOF
==========================================================================
Hooks activated. Settings merged into $settings_file
==========================================================================
To verify install:
ls $AGENTS_DIR/*.md # should show 12 generated agents
$AGENTS_DIR/_assembler/target/release/assemble --validate
./install.sh --list # show installed primitives
To set up agents for ALL your projects (scan stack + create one per project):
/onboard ~/Projects/*
Or create a single project-specialist agent:
/new-agent
==========================================================================
EOF
else
cat <<EOF
==========================================================================
NEXT STEP: merge settings-snippet.json into ~/.claude/settings.json
==========================================================================
KeiSeiKit ships 9 hooks (assemble-agents, assemble-validate, no-hand-edit,
tomd-preread, agent-fork-logger, site-wysiwyd-check, session-end-dump,
milestone-commit-hook, error-spike-detector).
To activate them, merge entries from:
$KIT_DIR/settings-snippet.json
into your:
$settings_file
Or re-run with automatic activation:
./install.sh --activate-hooks
To verify install:
ls $AGENTS_DIR/*.md # should show 12 generated agents
$AGENTS_DIR/_assembler/target/release/assemble --validate
./install.sh --list # show installed primitives
To set up agents for ALL your projects (scan stack + create one per project):
/onboard ~/Projects/*
Or create a single project-specialist agent:
/new-agent
==========================================================================
EOF
fi
print_substrate_summary
}