Skip to content

Commit 3572ae9

Browse files
committed
fix: add to bootstrap check and init
1 parent 710354b commit 3572ae9

5 files changed

Lines changed: 62 additions & 0 deletions

File tree

skills/bootstrap/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ Each mode additionally runs hotspot capture-candidate proposal (Step 6) and opti
5454

5555
## Execution
5656

57+
### Step -1: Ensure initialization
58+
59+
Call `mcp__archcore__init_project()` before any other MCP operation. It is idempotent — safe on an already-initialized project (returns existing settings). It creates `.archcore/` and the settings file if they do not exist.
60+
61+
Do NOT ask the user to run `archcore init` in the terminal — `mcp__archcore__init_project` is the correct path in a plugin session.
62+
5763
### Step 0: Check state
5864

5965
Call `mcp__archcore__list_documents()`. Derive:

test/structure/agents.bats

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,16 @@ setup() {
112112
grep -q 'subagent-knowledge-tree-bootstrap.adr' "$file" || fail "$f: missing ADR reference"
113113
done
114114
}
115+
116+
@test "all agent files document the archcore init CLI recovery path" {
117+
# When MCP tools are unavailable (CLI not installed or unresolvable on PATH),
118+
# mcp__archcore__init_project cannot fire. Agents must fall back to telling
119+
# the user how to recover: install the CLI and run `archcore init` in the
120+
# terminal. This must be present in every agent surface across hosts —
121+
# .md (Claude/Cursor) and .toml (Codex) — or the fallback drifts silently.
122+
for f in archcore-assistant.md archcore-auditor.md archcore-assistant.toml archcore-auditor.toml; do
123+
local file="$PLUGIN_ROOT/agents/$f"
124+
grep -q 'archcore init' "$file" \
125+
|| fail "$f: missing 'archcore init' recovery instruction for MCP-unavailable case"
126+
done
127+
}

test/structure/hooks.bats

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,23 @@ setup() {
176176
fail "Script sets differ between Claude Code and Codex"
177177
}
178178
}
179+
180+
@test "every host hook config registers bin/session-start on its session-start event" {
181+
# bin/session-start emits the init_project nudge on first-time / empty-state
182+
# sessions. If any host loses this wiring, onboarding silently breaks on that
183+
# host. Event keys differ by casing per host: SessionStart (Claude/Codex,
184+
# PascalCase) vs sessionStart (Cursor, camelCase).
185+
local entries=(
186+
"hooks/hooks.json:SessionStart"
187+
"hooks/codex.hooks.json:SessionStart"
188+
"hooks/cursor.hooks.json:sessionStart"
189+
)
190+
local entry file event cmds
191+
for entry in "${entries[@]}"; do
192+
file="${entry%:*}"
193+
event="${entry#*:}"
194+
cmds=$(jq -r --arg e "$event" '.hooks[$e][]?.hooks[]?.command // empty' "$PLUGIN_ROOT/$file")
195+
echo "$cmds" | grep -q 'bin/session-start$' \
196+
|| fail "$file: '$event' event must invoke bin/session-start; got: $cmds"
197+
done
198+
}

test/structure/json-configs.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ setup() {
5151
}
5252

5353
@test "cursor plugin.json has skills, agents, hooks paths" {
54+
# NOTE: Cursor plugin manifests intentionally do NOT carry an `mcpServers`
55+
# field, and we ship no `.cursor.mcp.json`. This is by design: at the time
56+
# of writing, Cursor manages MCP servers via the user's `~/.cursor/mcp.json`
57+
# (host-level), not via plugin manifests, so the archcore MCP server must
58+
# be configured by the user in their host config separately. As a result,
59+
# `mcp__archcore__init_project` is reachable in Cursor only when the user
60+
# has wired it themselves — there is no plugin-level guarantee, and no
61+
# structural test enforces one. Before adding an `.cursor.mcp.json`, verify
62+
# current Cursor actually supports plugin-level MCP injection.
5463
run jq -e '.skills and .agents and .hooks' "$PLUGIN_ROOT/.cursor-plugin/plugin.json"
5564
assert_success
5665
}

test/structure/skills.bats

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,17 @@ setup() {
5353
done | sort | uniq -d)
5454
[ -z "$dupes" ] || fail "Duplicate skill names: $dupes"
5555
}
56+
57+
@test "bootstrap skill calls init_project before operating on uninitialized projects" {
58+
grep -q "mcp__archcore__init_project" "$PLUGIN_ROOT/skills/bootstrap/SKILL.md" \
59+
|| fail "bootstrap/SKILL.md must instruct the agent to call mcp__archcore__init_project for uninitialized projects"
60+
}
61+
62+
@test "help skill documents the archcore init CLI recovery path" {
63+
# /archcore:help is a likely first stop when MCP tools fail; it must explain
64+
# how to install the CLI and run `archcore init` to recover. This is the
65+
# MCP-unavailable fallback (distinct from the in-session init_project call
66+
# that bootstrap uses when MCP works but .archcore/ is empty).
67+
grep -q 'archcore init' "$PLUGIN_ROOT/skills/help/SKILL.md" \
68+
|| fail "help/SKILL.md must include 'archcore init' recovery instruction"
69+
}

0 commit comments

Comments
 (0)