feat(ms-ai-architect): C2.1 lib/user-data resolver + ambient org-injeksjon + C1 config bakoverkompat (TDD) [skip-docs]
Bæreren i C2 onboarding-redesign (#26). TDD: test FØR kode. - lib/user-data.mjs (NY, ren, SKRIVER ALDRI; kun node:os/path): resolveUserDataDir/resolveOrgDir/resolveConfigPath peker ~/.claude/ms-ai-architect/ (uavhengig av pluginRoot -> overlever reinstall, K2). CONFIG_FILENAME delt med C1 (en sannhetskilde). buildOrgSummary: deterministisk, lengde-kappet H2-ekstraksjon. - detection-schedule.mjs: loadScheduleConfig(pluginRoot, home=homedir()) leser bruker-sti FORST, fallback plugin-rot. Lokal CONFIG_FILENAME -> importeres fra resolver. Alle 3 kallere bruker ett-arg-kall (uendret oppforsel). - session-start-context.mjs: injiserer buildOrgSummary ambient (K1) som egen Virksomhetskontekst-blokk; status-nudge beholdt nar org tom. Verifisert: user-data 16/16 · detection-schedule 23/23 · test-hooks 10/10 · kb-update 191 · kb-eval 100 · validate PASSED. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4ff60803ce
commit
dc0b627e98
6 changed files with 459 additions and 31 deletions
|
|
@ -39,6 +39,57 @@ else
|
|||
fail "Output missing 'Architect:' prefix"
|
||||
fi
|
||||
|
||||
# C2.1: ambient org-context injection from the USER-owned org dir (HOME override).
|
||||
# Proves K1 — the hook injects org CONTENT, not just a status nudge.
|
||||
TMPHOME=$(mktemp -d)
|
||||
mkdir -p "$TMPHOME/.claude/ms-ai-architect/org"
|
||||
cat > "$TMPHOME/.claude/ms-ai-architect/org/organization-profile.md" <<'ORGEOF'
|
||||
---
|
||||
category: organization-profile
|
||||
completed: true
|
||||
---
|
||||
|
||||
# Virksomhetsprofil
|
||||
|
||||
## Sektor
|
||||
Statlig
|
||||
|
||||
## Virksomhet
|
||||
Testetaten
|
||||
ORGEOF
|
||||
|
||||
OUTPUT=$(CLAUDE_PLUGIN_ROOT="$PLUGIN_ROOT" HOME="$TMPHOME" node "$SCRIPTS_DIR/session-start-context.mjs" 2>/dev/null)
|
||||
|
||||
if echo "$OUTPUT" | grep -q "Virksomhetskontekst (auto-injisert"; then
|
||||
pass "Injects ambient org-context block when user org/ has content (K1)"
|
||||
else
|
||||
fail "Missing ambient org-context block when user org/ has content"
|
||||
fi
|
||||
|
||||
if echo "$OUTPUT" | grep -q "Sektor: Statlig"; then
|
||||
pass "Ambient block reflects an org fact (Sektor: Statlig)"
|
||||
else
|
||||
fail "Ambient block missing org fact"
|
||||
fi
|
||||
|
||||
# Empty home (no user org, no plugin org) => onboarding nudge, NO ambient block.
|
||||
TMPHOME2=$(mktemp -d)
|
||||
OUTPUT=$(CLAUDE_PLUGIN_ROOT="$PLUGIN_ROOT" HOME="$TMPHOME2" node "$SCRIPTS_DIR/session-start-context.mjs" 2>/dev/null)
|
||||
|
||||
if echo "$OUTPUT" | grep -q "Ingen virksomhetstilpasning"; then
|
||||
pass "No org content => onboarding nudge"
|
||||
else
|
||||
fail "Expected onboarding nudge when no org content"
|
||||
fi
|
||||
|
||||
if echo "$OUTPUT" | grep -q "Virksomhetskontekst (auto-injisert"; then
|
||||
fail "Should NOT inject ambient block when org is empty"
|
||||
else
|
||||
pass "No ambient block when org is empty"
|
||||
fi
|
||||
|
||||
rm -rf "$TMPHOME" "$TMPHOME2"
|
||||
|
||||
echo ""
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue