heimdall-agent 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -26
- package/README.pt-BR.md +443 -0
- package/agents/cloud-engineer.md +77 -0
- package/agents/code-sentinel.md +71 -34
- package/agents/database-architect.md +31 -25
- package/agents/frontend-designer.md +30 -28
- package/agents/mobile-designer.md +25 -24
- package/agents/modernizer.md +68 -0
- package/agents/orchestrator.md +107 -93
- package/agents/reviewer.md +102 -71
- package/agents/security-auditor.md +27 -27
- package/agents/tester.md +97 -90
- package/commands/grill-me.md +20 -4
- package/commands/orchestrate.md +16 -0
- package/commands/orchestrator.md +16 -0
- package/commands/plan.md +17 -1
- package/config/agents.json +31 -3
- package/config/mcp.json +72 -0
- package/config/models.json +26 -16
- package/config/profiles.json +2 -4
- package/config/skills.json +762 -573
- package/docs/SKILLS.md +393 -275
- package/docs/designs/old/2026-10-31 plan-lifecycle-backlog-and-clean-code-skill.md +87 -0
- package/docs/designs/old/2026-11-02 skill-upstream-audit-and-update.md +105 -0
- package/docs/designs/old/2026-11-05 communication-doctrine-bluf-ste.md +94 -0
- package/docs/designs/old/2026-11-06-cloud-engineer-and-resilience-synthesis.md +67 -0
- package/docs/designs/old/2026-11-06-herdr-native-agent-orchestration.md +45 -0
- package/docs/runs/skill-audit/2026-11-12-compare-report.json +1028 -0
- package/docs/runs/skill-audit/2026-11-12-upstream-audit.json +275 -0
- package/docs/runs/skill-audit/add_progressive_disclosure.cjs +30 -0
- package/docs/runs/skill-audit/check_heimdall_skills.ps1 +9 -0
- package/docs/runs/skill-audit/compare_classics.ps1 +26 -0
- package/docs/runs/skill-audit/compare_taste.ps1 +12 -0
- package/docs/runs/skill-audit/customization-report.json +380 -0
- package/docs/runs/skill-audit/diff_pending_skills.cjs +94 -0
- package/docs/runs/skill-audit/fetch_and_apply_skill.cjs +58 -0
- package/docs/runs/skill-audit/fetch_and_apply_taste_v2.cjs +65 -0
- package/docs/runs/skill-audit/inspect_pending_skills.cjs +71 -0
- package/docs/runs/skill-audit/inventory.json +308 -0
- package/docs/runs/skill-audit/list_local_taste.ps1 +1 -0
- package/docs/runs/skill-audit/phase5-update-plan.json +595 -0
- package/docs/runs/skill-audit/phase5-update-plan.md +138 -0
- package/docs/runs/skill-audit/probe.ps1 +16 -0
- package/docs/runs/skill-audit/probe_classics_branches.ps1 +3 -0
- package/docs/runs/skill-audit/probe_commits.ps1 +15 -0
- package/docs/runs/skill-audit/probe_repos.ps1 +17 -0
- package/docs/runs/skill-audit/probe_sentry_sec.ps1 +3 -0
- package/docs/runs/skill-audit/probe_sentry_sweep.ps1 +5 -0
- package/docs/runs/skill-audit/probe_snyk.ps1 +3 -0
- package/docs/runs/skill-audit/probe_snyk_recipes.ps1 +5 -0
- package/docs/runs/skill-audit/probe_taste_branches.ps1 +8 -0
- package/docs/runs/skill-audit/probe_taste_v19.ps1 +3 -0
- package/docs/runs/skill-audit/probe_user_repos.ps1 +19 -0
- package/docs/runs/skill-audit/prune_taste_skills.cjs +22 -0
- package/docs/runs/skill-audit/run_phase1_2.cjs +142 -0
- package/docs/runs/skill-audit/run_phase6_verification.cjs +107 -0
- package/docs/runs/skill-audit/show_16_details.ps1 +25 -0
- package/docs/runs/skill-audit/show_20_skills.ps1 +28 -0
- package/docs/runs/skill-audit/show_classics_diff.cjs +37 -0
- package/docs/runs/skill-audit/sync_agent_markdowns.cjs +30 -0
- package/docs/runs/skill-audit/taste-skill-upstream.md +542 -0
- package/docs/runs/skill-audit/update-manifest.md +88 -0
- package/docs/runs/skill-audit/update_config_skills.cjs +52 -0
- package/docs/runs/skill-audit/update_registry_phase7.cjs +83 -0
- package/docs/runs/skill-audit/upstream-status.json +563 -0
- package/docs/runs/skill-audit/verification-results.json +252 -0
- package/doctrine/AGENTS.md +42 -77
- package/hooks/git/pre-commit +11 -0
- package/hooks/heimdall-hook.cjs +81 -2
- package/hooks/herdr-agent-state.ps1 +55 -0
- package/hooks/hooks.json +0 -11
- package/lib/catalog-sync.cjs +167 -0
- package/lib/hermes-context.cjs +57 -0
- package/lib/model-context.cjs +123 -0
- package/lib/path-discovery.cjs +94 -0
- package/package.json +7 -3
- package/playbooks/01-interactive-grilling-gate.md +23 -6
- package/playbooks/02-fast-code-deep-verification.md +3 -2
- package/playbooks/03-adversarial-code-review.md +15 -7
- package/playbooks/05-canonical-plan-template.md +35 -19
- package/playbooks/06-model-registry-matrix.md +24 -13
- package/playbooks/07-legacy-code-modernization.md +74 -0
- package/playbooks/08-backlog-and-change-request-flow.md +122 -0
- package/setup.mjs +592 -172
- package/skills/antislop/SKILL.md +76 -56
- package/skills/antislop/VERSION +1 -0
- package/skills/antislop-copywriting/SKILL.md +407 -372
- package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-human/SKILL.md +204 -147
- package/skills/antislop-human/contrast-check.py +168 -165
- package/skills/antislop-human/contrast-mcp.py +6 -3
- package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/antislop-human/references/WCAG.md +127 -0
- package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-ui/SKILL.md +344 -304
- package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
- package/skills/brainstorming/SKILL.md +296 -265
- package/skills/brainstorming/builder-check-prompt.md +23 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -213
- package/skills/brainstorming/scripts/server.cjs +723 -723
- package/skills/brandkit/SKILL.md +798 -798
- package/skills/brutalist-skill/SKILL.md +93 -92
- package/skills/caveman/README.md +68 -0
- package/skills/caveman/SKILL.md +73 -38
- package/skills/claude-collaborator/SKILL.md +24 -44
- package/skills/clean-code/SKILL.md +152 -0
- package/skills/cloudflare-security-audit/AI-AND-LLM.md +83 -83
- package/skills/cloudflare-security-audit/ATTACK-CLASSES.md +130 -130
- package/skills/cloudflare-security-audit/CLIENT-SIDE.md +83 -83
- package/skills/cloudflare-security-audit/CLOUD-AND-DEPLOYMENT.md +86 -86
- package/skills/cloudflare-security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -84
- package/skills/cloudflare-security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -89
- package/skills/cloudflare-security-audit/HUNTING.md +251 -251
- package/skills/cloudflare-security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -101
- package/skills/cloudflare-security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -81
- package/skills/cloudflare-security-audit/RECONNAISSANCE.md +156 -156
- package/skills/cloudflare-security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -78
- package/skills/cloudflare-security-audit/SKILL.md +192 -192
- package/skills/cloudflare-security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -73
- package/skills/cloudflare-security-audit/VALIDATION-AND-REPORTING.md +186 -186
- package/skills/cloudflare-security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -105
- package/skills/cloudflare-security-audit/report-schema.json +461 -461
- package/skills/cloudflare-security-audit/validate-coverage-ledger.cjs +872 -872
- package/skills/cloudflare-security-audit/validate-coverage-ledger.test.cjs +740 -740
- package/skills/cloudflare-security-audit/validate-findings.cjs +773 -773
- package/skills/cloudflare-security-audit/validate-findings.test.cjs +652 -652
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +114 -0
- package/skills/codex-collaborator/SKILL.md +24 -45
- package/skills/communication-doctrine/SKILL.md +89 -0
- package/skills/diagnosing-superpowers/SKILL.md +1 -1
- package/skills/diagnosing-superpowers/references/github-issues.md +3 -3
- package/skills/diagnosing-superpowers/templates/issue.md +23 -4
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/executing-plans/SKILL.md +6 -56
- package/skills/executing-plans/scripts/task-done +52 -52
- package/skills/executing-plans/scripts/task-start +28 -28
- package/skills/gemini-collaborator/SKILL.md +24 -56
- package/skills/grill-me/SKILL.md +65 -0
- package/skills/handoff/SKILL.md +64 -0
- package/skills/herdr/SKILL.md +243 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -1228
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -1465
- package/skills/imagegen-frontend-web/SKILL.md +987 -987
- package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/skills/karpathy-guidelines/SKILL.md +67 -67
- package/skills/mcp-engineering/SKILL.md +74 -0
- package/skills/minimalist-skill/SKILL.md +87 -85
- package/skills/output-skill/SKILL.md +49 -49
- package/skills/owasp-security/reference/config-and-supply-chain.md +346 -344
- package/skills/owasp-security/reference/languages.md +378 -372
- package/skills/owasp-security/reference/owasp-report.md +1144 -1140
- package/skills/owasp-security/reference/review-checklist.md +134 -132
- package/skills/ponytail/SKILL.md +36 -52
- package/skills/postgres-best-practices/SKILL.md +30 -52
- package/skills/postgres-best-practices/references/backup-restore.md +372 -0
- package/skills/postgres-best-practices/references/bulk-loading.md +315 -0
- package/skills/postgres-best-practices/references/connection-pooling.md +310 -0
- package/skills/postgres-best-practices/references/hot-standby.md +221 -0
- package/skills/postgres-best-practices/references/indexing.md +318 -0
- package/skills/postgres-best-practices/references/logical-replication.md +610 -0
- package/skills/postgres-best-practices/references/major-version-upgrades.md +334 -0
- package/skills/postgres-best-practices/references/performance-diagnostics.md +553 -0
- package/skills/postgres-best-practices/references/query-optimization.md +294 -0
- package/skills/postgres-best-practices/references/query-patterns.md +566 -0
- package/skills/postgres-best-practices/references/schema-design.md +362 -0
- package/skills/postgres-best-practices/references/security-roles.md +489 -0
- package/skills/postgres-best-practices/references/transaction-isolation.md +344 -0
- package/skills/progressive-disclosure/SKILL.md +68 -0
- package/skills/pstack-discipline/SKILL.md +40 -0
- package/skills/receiving-code-review/SKILL.md +2 -23
- package/skills/requesting-code-review/SKILL.md +7 -36
- package/skills/soft-skill/SKILL.md +99 -98
- package/skills/stitch-skill/DESIGN.md +121 -121
- package/skills/stitch-skill/SKILL.md +185 -184
- package/skills/strix-security/SKILL.md +54 -53
- package/skills/subagent-driven-development/SKILL.md +35 -264
- package/skills/subagent-driven-development/references/batching.md +11 -0
- package/skills/subagent-driven-development/references/cannot-verify.md +10 -0
- package/skills/subagent-driven-development/references/final-review.md +47 -0
- package/skills/subagent-driven-development/references/fix-loop.md +77 -0
- package/skills/subagent-driven-development/references/handling-reports.md +15 -0
- package/skills/subagent-driven-development/references/preflight.md +26 -0
- package/skills/subagent-driven-development/references/resuming.md +12 -0
- package/skills/subagent-driven-development/scripts/review-package +53 -53
- package/skills/subagent-driven-development/scripts/sdd-workspace +87 -82
- package/skills/subagent-driven-development/scripts/task-brief +43 -43
- package/skills/systematic-debugging/SKILL.md +283 -306
- package/skills/taste-skill/SKILL.md +542 -1206
- package/skills/taste-skill/references/app-screens.md +1199 -0
- package/skills/taste-skill/references/colour.md +141 -0
- package/skills/taste-skill/references/copy.md +177 -0
- package/skills/taste-skill/references/critique.md +182 -0
- package/skills/taste-skill/references/imagery.md +791 -0
- package/skills/taste-skill/references/layout.md +292 -0
- package/skills/taste-skill/references/motion.md +980 -0
- package/skills/taste-skill/references/research.md +356 -0
- package/skills/taste-skill/references/scenes.md +174 -0
- package/skills/taste-skill/references/tells.md +115 -0
- package/skills/taste-skill/references/type.md +170 -0
- package/skills/test-driven-development/SKILL.md +330 -337
- package/skills/thermo/SKILL.md +67 -0
- package/skills/threat-modeling/SKILL.md +55 -0
- package/skills/to-spec/SKILL.md +75 -0
- package/skills/to-tickets/SKILL.md +105 -0
- package/skills/trailofbits-audit-context/SKILL.md +72 -72
- package/skills/trailofbits-insecure-defaults/commands/audit.md +35 -0
- package/skills/trailofbits-insecure-defaults/references/debug-features.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/debug-features.md +75 -75
- package/skills/trailofbits-insecure-defaults/references/default-credentials.json +12 -12
- package/skills/trailofbits-insecure-defaults/references/default-credentials.md +76 -76
- package/skills/trailofbits-insecure-defaults/references/fail-open-security.json +11 -11
- package/skills/trailofbits-insecure-defaults/references/fail-open-security.md +70 -70
- package/skills/trailofbits-insecure-defaults/references/fallback-secrets.json +11 -11
- package/skills/trailofbits-insecure-defaults/references/fallback-secrets.md +70 -70
- package/skills/trailofbits-insecure-defaults/references/permissive-access.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/permissive-access.md +62 -62
- package/skills/trailofbits-insecure-defaults/references/weak-crypto.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/weak-crypto.md +71 -71
- package/skills/trailofbits-triage-brocards/SKILL.md +208 -208
- package/skills/verification-before-completion/SKILL.md +0 -14
- package/skills/wayfinder/SKILL.md +128 -0
- package/skills/writing-plans/SKILL.md +11 -15
- package/skills/writing-skills/SKILL.md +21 -303
- package/skills/writing-skills/references/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/references/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/references/bulletproofing.md +80 -0
- package/skills/writing-skills/references/discovery.md +201 -0
- package/skills/writing-skills/references/flowcharts.md +37 -0
- package/skills/writing-skills/references/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/references/persuasion-principles.md +187 -0
- package/skills/writing-skills/references/testing-skills-with-subagents.md +384 -0
- package/tools/{claude-bridge.ps1 → archive/claude-bridge.ps1} +10 -7
- package/tools/{codex-bridge.ps1 → archive/codex-bridge.ps1} +1 -1
- package/tools/{gemini-bridge.ps1 → archive/gemini-bridge.ps1} +12 -19
- package/skills/gpt-tasteskill/SKILL.md +0 -74
- package/skills/taste-skill-v1/SKILL.md +0 -226
- /package/tools/{claude-bridge.cmd → archive/claude-bridge.cmd} +0 -0
- /package/tools/{claude-bridge.sh → archive/claude-bridge.sh} +0 -0
- /package/tools/{codex-bridge.cmd → archive/codex-bridge.cmd} +0 -0
- /package/tools/{codex-bridge.sh → archive/codex-bridge.sh} +0 -0
- /package/tools/{codexcli-bridge.cmd → archive/codexcli-bridge.cmd} +0 -0
- /package/tools/{codexcli-bridge.ps1 → archive/codexcli-bridge.ps1} +0 -0
- /package/tools/{gemini-bridge.cmd → archive/gemini-bridge.cmd} +0 -0
- /package/tools/{gemini-bridge.sh → archive/gemini-bridge.sh} +0 -0
package/setup.mjs
CHANGED
|
@@ -18,6 +18,10 @@ import os from 'node:os';
|
|
|
18
18
|
import readline from 'node:readline/promises';
|
|
19
19
|
import { fileURLToPath } from 'node:url';
|
|
20
20
|
import { execSync } from 'node:child_process';
|
|
21
|
+
import { resolveModelMaxContext, resolveCustomModelsEndpoint } from './lib/model-context.cjs';
|
|
22
|
+
import { updateHermesConfigContext } from './lib/hermes-context.cjs';
|
|
23
|
+
import { detectPathCandidates } from './lib/path-discovery.cjs';
|
|
24
|
+
import { syncCatalogCounts } from './lib/catalog-sync.cjs';
|
|
21
25
|
|
|
22
26
|
const __filename = fileURLToPath(import.meta.url);
|
|
23
27
|
const __dirname = path.dirname(__filename);
|
|
@@ -46,6 +50,7 @@ const profilesPath = path.join(__dirname, 'config', 'profiles.json');
|
|
|
46
50
|
const modelsPath = path.join(__dirname, 'config', 'models.json');
|
|
47
51
|
const agentsConfigPath = path.join(__dirname, 'config', 'agents.json');
|
|
48
52
|
const skillsConfigPath = path.join(__dirname, 'config', 'skills.json');
|
|
53
|
+
const mcpConfigPath = path.join(__dirname, 'config', 'mcp.json');
|
|
49
54
|
|
|
50
55
|
/**
|
|
51
56
|
* Resolves the platform-specific Hermes Agent directory:
|
|
@@ -124,6 +129,98 @@ const targetHookPaths = {
|
|
|
124
129
|
claude: path.join(userHome, '.claude', 'hooks')
|
|
125
130
|
};
|
|
126
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Resolves the root directory of a target agent harness.
|
|
134
|
+
*/
|
|
135
|
+
function getAgentRootDir(agent) {
|
|
136
|
+
if (agent === 'claude') return path.join(userHome, '.claude');
|
|
137
|
+
if (agent === 'gemini') return path.join(userHome, '.gemini');
|
|
138
|
+
if (agent === 'codex') return path.join(userHome, '.codex');
|
|
139
|
+
if (agent === 'agents') return path.join(userHome, '.agents');
|
|
140
|
+
if (agent === 'hermes') return getHermesDir();
|
|
141
|
+
if (agent === 'openclaw') return getOpenClawDir();
|
|
142
|
+
if (agent === 'desktop') return getClaudeDesktopDir();
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Checks whether an agent harness exists and has an existing root directory/configuration.
|
|
148
|
+
* Heimdall will only configure an agent harness if its root directory already exists.
|
|
149
|
+
*/
|
|
150
|
+
function isAgentConfigurable(agent) {
|
|
151
|
+
if (agent === 'desktop') {
|
|
152
|
+
const status = detectClaudeDesktop();
|
|
153
|
+
return Boolean(status.configExists);
|
|
154
|
+
}
|
|
155
|
+
const rootDir = getAgentRootDir(agent);
|
|
156
|
+
return Boolean(rootDir && fs.existsSync(rootDir));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
const pkgJsonPath = path.join(__dirname, 'package.json');
|
|
162
|
+
let currentVersion = '1.0.0';
|
|
163
|
+
try {
|
|
164
|
+
currentVersion = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')).version || '1.0.0';
|
|
165
|
+
} catch {}
|
|
166
|
+
|
|
167
|
+
function isNewerVersion(current, latest) {
|
|
168
|
+
if (!latest || !current) return false;
|
|
169
|
+
const c = current.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);
|
|
170
|
+
const l = latest.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);
|
|
171
|
+
for (let i = 0; i < 3; i++) {
|
|
172
|
+
const cv = c[i] || 0;
|
|
173
|
+
const lv = l[i] || 0;
|
|
174
|
+
if (lv > cv) return true;
|
|
175
|
+
if (lv < cv) return false;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function checkForUpdates() {
|
|
181
|
+
const cacheFile = path.join(userHome, '.heimdall-update.json');
|
|
182
|
+
let cache = { lastChecked: 0, latestVersion: null };
|
|
183
|
+
|
|
184
|
+
if (fs.existsSync(cacheFile)) {
|
|
185
|
+
try {
|
|
186
|
+
cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
|
187
|
+
} catch {}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const now = Date.now();
|
|
191
|
+
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
192
|
+
let latestVersion = cache.latestVersion;
|
|
193
|
+
|
|
194
|
+
if (now - (cache.lastChecked || 0) > ONE_DAY) {
|
|
195
|
+
try {
|
|
196
|
+
const res = await fetch('https://registry.npmjs.org/heimdall-agent/latest', {
|
|
197
|
+
headers: { 'Accept': 'application/json' },
|
|
198
|
+
signal: AbortSignal.timeout(1200)
|
|
199
|
+
});
|
|
200
|
+
if (res.ok) {
|
|
201
|
+
const data = await res.json();
|
|
202
|
+
if (data && data.version) {
|
|
203
|
+
latestVersion = data.version;
|
|
204
|
+
cache = { lastChecked: now, latestVersion };
|
|
205
|
+
try {
|
|
206
|
+
fs.writeFileSync(cacheFile, JSON.stringify(cache), 'utf8');
|
|
207
|
+
} catch {}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} catch {
|
|
211
|
+
// Offline, timeout, or registry unreachable - fail silently
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {
|
|
216
|
+
console.log(`${colors.yellow}╭────────────────────────────────────────────────────────────╮
|
|
217
|
+
│ ${colors.bold}Update available:${colors.reset}${colors.yellow} ${currentVersion} → ${colors.green}${colors.bold}${latestVersion}${colors.reset}${colors.yellow} │
|
|
218
|
+
│ Run: ${colors.cyan}npm install -g heimdall-agent${colors.reset}${colors.yellow} │
|
|
219
|
+
│ Or: ${colors.cyan}npx heimdall-agent@latest${colors.reset}${colors.yellow} │
|
|
220
|
+
╰────────────────────────────────────────────────────────────╯${colors.reset}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
127
224
|
function printBanner() {
|
|
128
225
|
console.log(`
|
|
129
226
|
${colors.cyan}${colors.bold} ██╗ ██╗███████╗██╗███╗ ███╗██████╗ █████╗ ██╗ ██╗
|
|
@@ -166,6 +263,249 @@ function getClaudeDesktopDir() {
|
|
|
166
263
|
return path.join(configHome, 'Claude');
|
|
167
264
|
}
|
|
168
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Detects Claude Desktop by checking for an existing configuration file
|
|
268
|
+
* or the presence of the native desktop executable on OS-specific paths.
|
|
269
|
+
*/
|
|
270
|
+
function detectClaudeDesktop() {
|
|
271
|
+
const configDir = getClaudeDesktopDir();
|
|
272
|
+
const configFile = path.join(configDir, 'claude_desktop_config.json');
|
|
273
|
+
|
|
274
|
+
if (fs.existsSync(configFile)) {
|
|
275
|
+
return { dir: configDir, file: configFile, detected: true, configExists: true };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const platform = os.platform();
|
|
279
|
+
let appInstalled = false;
|
|
280
|
+
|
|
281
|
+
if (platform === 'win32') {
|
|
282
|
+
const winCandidates = [
|
|
283
|
+
path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Claude', 'Claude.exe'),
|
|
284
|
+
path.join(process.env.LOCALAPPDATA || '', 'Claude', 'Claude.exe'),
|
|
285
|
+
path.join(process.env.PROGRAMFILES || '', 'Claude', 'Claude.exe'),
|
|
286
|
+
path.join(process.env['ProgramFiles(x86)'] || '', 'Claude', 'Claude.exe')
|
|
287
|
+
];
|
|
288
|
+
appInstalled = winCandidates.some(p => p && fs.existsSync(p));
|
|
289
|
+
} else if (platform === 'darwin') {
|
|
290
|
+
const macCandidates = [
|
|
291
|
+
'/Applications/Claude.app',
|
|
292
|
+
path.join(userHome, 'Applications', 'Claude.app')
|
|
293
|
+
];
|
|
294
|
+
appInstalled = macCandidates.some(p => fs.existsSync(p));
|
|
295
|
+
} else {
|
|
296
|
+
appInstalled = !!checkCommand('claude-desktop') || fs.existsSync('/opt/Claude/claude');
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return { dir: configDir, file: configFile, detected: appInstalled, configExists: false };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Dynamically resolves the active Open Design installation and MCP configuration.
|
|
304
|
+
*/
|
|
305
|
+
function resolveOpenDesignMcpConfig() {
|
|
306
|
+
const platform = os.platform();
|
|
307
|
+
let fallbackConfig = null;
|
|
308
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
309
|
+
try {
|
|
310
|
+
const data = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
311
|
+
fallbackConfig = data.mcpServers?.['open-design']?.config || null;
|
|
312
|
+
} catch {}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (platform !== 'win32') return fallbackConfig;
|
|
316
|
+
|
|
317
|
+
const appData = process.env.APPDATA || path.join(userHome, 'AppData', 'Roaming');
|
|
318
|
+
const localAppData = process.env.LOCALAPPDATA || path.join(userHome, 'AppData', 'Local');
|
|
319
|
+
const odRoaming = path.join(appData, 'Open Design');
|
|
320
|
+
|
|
321
|
+
if (!fs.existsSync(odRoaming)) return fallbackConfig;
|
|
322
|
+
|
|
323
|
+
// 1. Locate executable
|
|
324
|
+
let odExe = null;
|
|
325
|
+
const enDir = path.join(odRoaming, 'en');
|
|
326
|
+
if (fs.existsSync(enDir)) {
|
|
327
|
+
try {
|
|
328
|
+
const subdirs = fs.readdirSync(enDir);
|
|
329
|
+
for (const sub of subdirs) {
|
|
330
|
+
const cand = path.join(enDir, sub, 'Open Design.exe');
|
|
331
|
+
if (fs.existsSync(cand)) {
|
|
332
|
+
odExe = cand;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
} catch {}
|
|
337
|
+
}
|
|
338
|
+
if (!odExe) {
|
|
339
|
+
const defaultLocalExe = path.join(localAppData, 'Programs', 'Open Design', 'Open Design.exe');
|
|
340
|
+
if (fs.existsSync(defaultLocalExe)) odExe = defaultLocalExe;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// 2. Locate daemon-cli.mjs in version payloads
|
|
344
|
+
let daemonCli = null;
|
|
345
|
+
const versionsDir = path.join(odRoaming, 'launcher', 'channels', 'stable', 'namespaces', 'release-stable-win', 'versions');
|
|
346
|
+
if (fs.existsSync(versionsDir)) {
|
|
347
|
+
try {
|
|
348
|
+
const versions = fs.readdirSync(versionsDir);
|
|
349
|
+
for (const ver of versions) {
|
|
350
|
+
const cand = path.join(versionsDir, ver, 'payload', 'resources', 'app', 'prebundled', 'daemon', 'daemon-cli.mjs');
|
|
351
|
+
if (fs.existsSync(cand)) {
|
|
352
|
+
daemonCli = cand;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
} catch {}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// 3. Locate active named pipe if running
|
|
360
|
+
let activePipe = null;
|
|
361
|
+
try {
|
|
362
|
+
const pipeCandidates = fs.readdirSync('\\\\.\\pipe');
|
|
363
|
+
const odPipe = pipeCandidates.find(p => p.startsWith('open-design-sidecar-'));
|
|
364
|
+
if (odPipe) {
|
|
365
|
+
activePipe = `\\\\.\\pipe\\${odPipe}`;
|
|
366
|
+
}
|
|
367
|
+
} catch {}
|
|
368
|
+
|
|
369
|
+
if (!odExe || !daemonCli) return fallbackConfig;
|
|
370
|
+
|
|
371
|
+
const dataDir = path.join(odRoaming, 'namespaces', 'release-stable-win', 'data');
|
|
372
|
+
const bootstrapExe = path.join(localAppData, 'Programs', 'Open Design', 'Open Design.exe');
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
command: odExe,
|
|
376
|
+
args: [daemonCli, "mcp"],
|
|
377
|
+
env: {
|
|
378
|
+
OD_DATA_DIR: dataDir,
|
|
379
|
+
OD_SIDECAR_CLIENT_ENDPOINT: activePipe || fallbackConfig?.env?.OD_SIDECAR_CLIENT_ENDPOINT || "\\\\.\\pipe\\open-design-sidecar-active",
|
|
380
|
+
OD_MCP_BOOTSTRAP_COMMAND: fs.existsSync(bootstrapExe) ? bootstrapExe : odExe,
|
|
381
|
+
OD_MCP_BOOTSTRAP_ARGS: "[\"--headless\"]",
|
|
382
|
+
ELECTRON_RUN_AS_NODE: "1"
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Synchronizes curated and dynamic MCP servers (including OpenDesign and Context7)
|
|
389
|
+
* across Antigravity, Claude Desktop, and Claude Code.
|
|
390
|
+
*/
|
|
391
|
+
function syncMcpServers(detected, options = {}) {
|
|
392
|
+
let syncedAny = false;
|
|
393
|
+
let mcpRegistry = {};
|
|
394
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
395
|
+
try {
|
|
396
|
+
mcpRegistry = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8')).mcpServers || {};
|
|
397
|
+
} catch {}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const odConfig = resolveOpenDesignMcpConfig();
|
|
401
|
+
|
|
402
|
+
// 1. Antigravity (AGY)
|
|
403
|
+
const agyMcpFile = path.join(userHome, '.gemini', 'config', 'mcp_config.json');
|
|
404
|
+
if (fs.existsSync(path.dirname(agyMcpFile))) {
|
|
405
|
+
let agyConfig = { mcpServers: {} };
|
|
406
|
+
try {
|
|
407
|
+
if (fs.existsSync(agyMcpFile)) {
|
|
408
|
+
agyConfig = JSON.parse(fs.readFileSync(agyMcpFile, 'utf8'));
|
|
409
|
+
}
|
|
410
|
+
} catch {}
|
|
411
|
+
if (!agyConfig.mcpServers) agyConfig.mcpServers = {};
|
|
412
|
+
|
|
413
|
+
let agyUpdated = false;
|
|
414
|
+
if (odConfig && JSON.stringify(agyConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
|
|
415
|
+
agyConfig.mcpServers['open-design'] = odConfig;
|
|
416
|
+
agyUpdated = true;
|
|
417
|
+
}
|
|
418
|
+
if (mcpRegistry.context7?.config && !agyConfig.mcpServers['context7']) {
|
|
419
|
+
agyConfig.mcpServers['context7'] = mcpRegistry.context7.config;
|
|
420
|
+
agyUpdated = true;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (agyUpdated && !options.dryRun) {
|
|
424
|
+
fs.writeFileSync(agyMcpFile, JSON.stringify(agyConfig, null, 2), 'utf8');
|
|
425
|
+
console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign MCP for Google Antigravity`);
|
|
426
|
+
syncedAny = true;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 2. Claude Desktop
|
|
431
|
+
const claudeDesktopDir = getClaudeDesktopDir();
|
|
432
|
+
const claudeDesktopFile = path.join(claudeDesktopDir, 'claude_desktop_config.json');
|
|
433
|
+
if (fs.existsSync(claudeDesktopFile)) {
|
|
434
|
+
let deskConfig = { mcpServers: {} };
|
|
435
|
+
try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
|
|
436
|
+
if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
|
|
437
|
+
|
|
438
|
+
let deskUpdated = false;
|
|
439
|
+
if (odConfig && JSON.stringify(deskConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
|
|
440
|
+
deskConfig.mcpServers['open-design'] = odConfig;
|
|
441
|
+
deskUpdated = true;
|
|
442
|
+
}
|
|
443
|
+
if (mcpRegistry.context7?.config && !deskConfig.mcpServers['context7']) {
|
|
444
|
+
deskConfig.mcpServers['context7'] = mcpRegistry.context7.config;
|
|
445
|
+
deskUpdated = true;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (deskUpdated && !options.dryRun) {
|
|
449
|
+
fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2), 'utf8');
|
|
450
|
+
console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign & Context7 MCP for Claude Desktop`);
|
|
451
|
+
syncedAny = true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// 3. Claude Code CLI
|
|
456
|
+
const claudeConfigFile = path.join(userHome, '.claude.json');
|
|
457
|
+
if (fs.existsSync(claudeConfigFile)) {
|
|
458
|
+
let claudeConfig = {};
|
|
459
|
+
try { claudeConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8')); } catch {}
|
|
460
|
+
if (!claudeConfig.mcpServers) claudeConfig.mcpServers = {};
|
|
461
|
+
|
|
462
|
+
let claudeUpdated = false;
|
|
463
|
+
if (odConfig && JSON.stringify(claudeConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
|
|
464
|
+
claudeConfig.mcpServers['open-design'] = odConfig;
|
|
465
|
+
claudeUpdated = true;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (claudeUpdated && !options.dryRun) {
|
|
469
|
+
fs.writeFileSync(claudeConfigFile, JSON.stringify(claudeConfig, null, 2), 'utf8');
|
|
470
|
+
console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign MCP for Claude Code`);
|
|
471
|
+
syncedAny = true;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return syncedAny;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Audits registered and configured MCP servers across harnesses.
|
|
480
|
+
*/
|
|
481
|
+
function auditMcpServers() {
|
|
482
|
+
const results = [];
|
|
483
|
+
const agyMcpFile = path.join(userHome, '.gemini', 'config', 'mcp_config.json');
|
|
484
|
+
if (fs.existsSync(agyMcpFile)) {
|
|
485
|
+
try {
|
|
486
|
+
const cfg = JSON.parse(fs.readFileSync(agyMcpFile, 'utf8'));
|
|
487
|
+
results.push({ harness: 'Google Antigravity', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
|
|
488
|
+
results.push({ harness: 'Google Antigravity', server: 'context7', configured: Boolean(cfg.mcpServers?.['context7']) });
|
|
489
|
+
} catch {}
|
|
490
|
+
}
|
|
491
|
+
const claudeDesktopFile = path.join(getClaudeDesktopDir(), 'claude_desktop_config.json');
|
|
492
|
+
if (fs.existsSync(claudeDesktopFile)) {
|
|
493
|
+
try {
|
|
494
|
+
const cfg = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8'));
|
|
495
|
+
results.push({ harness: 'Claude Desktop', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
|
|
496
|
+
results.push({ harness: 'Claude Desktop', server: 'context7', configured: Boolean(cfg.mcpServers?.['context7']) });
|
|
497
|
+
} catch {}
|
|
498
|
+
}
|
|
499
|
+
const claudeConfigFile = path.join(userHome, '.claude.json');
|
|
500
|
+
if (fs.existsSync(claudeConfigFile)) {
|
|
501
|
+
try {
|
|
502
|
+
const cfg = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
|
|
503
|
+
results.push({ harness: 'Claude Code', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
|
|
504
|
+
} catch {}
|
|
505
|
+
}
|
|
506
|
+
return results;
|
|
507
|
+
}
|
|
508
|
+
|
|
169
509
|
/**
|
|
170
510
|
* Resiliently discovers the OpenAI Codex CLI binary on PATH and standard Windows/POSIX install paths.
|
|
171
511
|
*/
|
|
@@ -283,53 +623,45 @@ function configureHermesExternalDirs(hermesDir, dryRun = false) {
|
|
|
283
623
|
}
|
|
284
624
|
|
|
285
625
|
/**
|
|
286
|
-
*
|
|
287
|
-
* Never assumes a hardcoded system path.
|
|
626
|
+
* Ensures Hermes Agent config.yaml has maximum context_length set for active models.
|
|
288
627
|
*/
|
|
289
|
-
function
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
628
|
+
function configureHermesContextLimit(hermesDir, modelsList = null, dryRun = false) {
|
|
629
|
+
if (!fs.existsSync(path.join(hermesDir, 'config.yaml'))) return false;
|
|
630
|
+
|
|
631
|
+
let contextMap = {};
|
|
632
|
+
if (Array.isArray(modelsList) && modelsList.length > 0) {
|
|
633
|
+
for (const m of modelsList) {
|
|
634
|
+
if (m.id && m.context_window_tokens) {
|
|
635
|
+
contextMap[m.id] = m.context_window_tokens;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
} else if (fs.existsSync(modelsPath)) {
|
|
297
639
|
try {
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (fs.existsSync(resolved)) {
|
|
304
|
-
// Exclude system directories
|
|
305
|
-
const isSystem = lower.includes('\\windows\\system32') ||
|
|
306
|
-
lower.includes('\\windows\\system') ||
|
|
307
|
-
lower.includes('/usr/sbin') ||
|
|
308
|
-
lower.includes('/sbin') ||
|
|
309
|
-
lower.includes('\\powershell');
|
|
310
|
-
if (!isSystem) {
|
|
311
|
-
const isToolLike = lower.includes('tool') ||
|
|
312
|
-
lower.includes('bin') ||
|
|
313
|
-
lower.includes('.local') ||
|
|
314
|
-
lower.includes('apps') ||
|
|
315
|
-
lower.includes('npm') ||
|
|
316
|
-
lower.includes('cargo') ||
|
|
317
|
-
lower.includes('heimdall');
|
|
318
|
-
if (isToolLike) {
|
|
319
|
-
candidates.push(resolved);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
640
|
+
const catalog = JSON.parse(fs.readFileSync(modelsPath, 'utf8'));
|
|
641
|
+
const allModels = [...(catalog.ghostcli || []), ...(catalog.custom_proxies || []), ...(catalog.google || [])];
|
|
642
|
+
for (const m of allModels) {
|
|
643
|
+
const resolved = resolveModelMaxContext(m, { prioritizeMax: true });
|
|
644
|
+
contextMap[m.id] = resolved.tokens;
|
|
322
645
|
}
|
|
323
646
|
} catch {}
|
|
324
647
|
}
|
|
325
648
|
|
|
326
|
-
//
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
649
|
+
// Ensure both canonical and [1m] suffixed model names are registered
|
|
650
|
+
for (const [id, tokens] of Object.entries({ ...contextMap })) {
|
|
651
|
+
if (!id.endsWith('[1m]')) {
|
|
652
|
+
contextMap[`${id}[1m]`] = tokens;
|
|
653
|
+
}
|
|
330
654
|
}
|
|
331
655
|
|
|
332
|
-
|
|
656
|
+
// Ensure default fallbacks for common models
|
|
657
|
+
if (!contextMap['claude-opus-5-5']) contextMap['claude-opus-5-5'] = 1000000;
|
|
658
|
+
if (!contextMap['claude-sonnet-5']) contextMap['claude-sonnet-5'] = 1000000;
|
|
659
|
+
if (!contextMap['claude-fable-5.1']) contextMap['claude-fable-5.1'] = 1000000;
|
|
660
|
+
if (!contextMap['gpt-6-astra']) contextMap['gpt-6-astra'] = 1000000;
|
|
661
|
+
if (!contextMap['z-ai/glm-5.3']) contextMap['z-ai/glm-5.3'] = 1000000;
|
|
662
|
+
if (!contextMap['z-ai/glm-5.3-flash']) contextMap['z-ai/glm-5.3-flash'] = 1000000;
|
|
663
|
+
|
|
664
|
+
return updateHermesConfigContext(hermesDir, contextMap, dryRun);
|
|
333
665
|
}
|
|
334
666
|
|
|
335
667
|
/**
|
|
@@ -381,9 +713,9 @@ function detectEnvironment() {
|
|
|
381
713
|
detected.tools.cursor = checkCommand('cursor');
|
|
382
714
|
detected.tools.windsurf = checkCommand('windsurf');
|
|
383
715
|
|
|
384
|
-
// 2. Check Claude Desktop
|
|
385
|
-
const
|
|
386
|
-
detected.tools.claudeDesktop =
|
|
716
|
+
// 2. Check Claude Desktop (executable or existing config file)
|
|
717
|
+
const desktopStatus = detectClaudeDesktop();
|
|
718
|
+
detected.tools.claudeDesktop = desktopStatus.detected ? desktopStatus.dir : null;
|
|
387
719
|
|
|
388
720
|
// 3. Check Claude Code endpoint
|
|
389
721
|
const claudeSettingsPath = path.join(userHome, '.claude', 'settings.json');
|
|
@@ -482,6 +814,7 @@ ${colors.dim}Note: 'heimdall' and 'node setup.mjs' are identical. 'heimdall' is
|
|
|
482
814
|
|
|
483
815
|
${colors.bold}PRIMARY SUBCOMMANDS:${colors.reset}
|
|
484
816
|
${colors.green}sync${colors.reset} (or ${colors.dim}--sync${colors.reset}) Scan PATH for newly installed AI tools and link skills (1-sec zero-drift)
|
|
817
|
+
${colors.green}sync-docs${colors.reset} (or ${colors.dim}--sync-docs${colors.reset}) Synchronize documentation and config count references from Single Source of Truth
|
|
485
818
|
${colors.green}audit${colors.reset} (or ${colors.dim}--audit${colors.reset}) Audit installed harnesses, active API endpoints, and skill counts
|
|
486
819
|
${colors.green}uninstall${colors.reset} (or ${colors.dim}--uninstall${colors.reset}) Safely remove Heimdall skills and agent personas from all harnesses
|
|
487
820
|
${colors.green}sync-models${colors.reset} (or ${colors.dim}--sync-models${colors.reset}) Probe active proxy/endpoint (e.g. Custom Proxies / API or Custom Vendors) and refresh models.json
|
|
@@ -490,7 +823,7 @@ ${colors.bold}PRIMARY SUBCOMMANDS:${colors.reset}
|
|
|
490
823
|
${colors.green}help${colors.reset} (or ${colors.dim}--help, -h${colors.reset}) Display this parameter and command reference
|
|
491
824
|
|
|
492
825
|
${colors.bold}SETUP & BOOTSTRAP OPTIONS:${colors.reset}
|
|
493
|
-
${colors.yellow}--profile <name>${colors.reset} Skill profile tier: full (
|
|
826
|
+
${colors.yellow}--profile <name>${colors.reset} Skill profile tier: full (64), minimal (16), security (12), design (14) [default: full]
|
|
494
827
|
${colors.yellow}--agents <targets>${colors.reset} Comma-separated harnesses: claude, gemini, codex, hermes, openclaw, desktop, all [default: all]
|
|
495
828
|
${colors.yellow}--link / --no-link${colors.reset} Use live NTFS junctions / symlinks vs static copies [default: false in wizard, true recommended]
|
|
496
829
|
${colors.yellow}--clean${colors.reset} Wipe legacy skills from target directory before deploying
|
|
@@ -523,6 +856,7 @@ function parseArgs() {
|
|
|
523
856
|
link: false,
|
|
524
857
|
clean: false,
|
|
525
858
|
sync: false,
|
|
859
|
+
syncDocs: false,
|
|
526
860
|
uninstall: false,
|
|
527
861
|
tools: true,
|
|
528
862
|
doctrine: true,
|
|
@@ -545,6 +879,7 @@ function parseArgs() {
|
|
|
545
879
|
if (arg === 'help' || arg === '--help' || arg === '-h') options.help = true;
|
|
546
880
|
else if (arg === 'audit' || arg === '--audit') options.audit = true;
|
|
547
881
|
else if (arg === 'sync' || arg === '--sync') options.sync = true;
|
|
882
|
+
else if (arg === 'sync-docs' || arg === '--sync-docs' || arg === 'syncdocs') options.syncDocs = true;
|
|
548
883
|
else if (arg === 'uninstall' || arg === '--uninstall') options.uninstall = true;
|
|
549
884
|
else if (arg === 'sync-models' || arg === '--sync-models' || arg === 'syncmodels') options.syncModels = true;
|
|
550
885
|
else if (arg === 'skills' || arg === '--skills') options.listSkills = true;
|
|
@@ -600,7 +935,9 @@ function cleanTargetDirectory(targetDir, dryRun = false, preserveList = ['.syste
|
|
|
600
935
|
|
|
601
936
|
function registerClaudeHooks(targetHookDir, dryRun = false) {
|
|
602
937
|
if (dryRun) return;
|
|
603
|
-
const
|
|
938
|
+
const claudeDir = path.join(userHome, '.claude');
|
|
939
|
+
if (!fs.existsSync(claudeDir)) return;
|
|
940
|
+
const claudeSettingsPath = path.join(claudeDir, 'settings.json');
|
|
604
941
|
const hooksJsonSrc = path.join(hooksDir, 'hooks.json');
|
|
605
942
|
if (!fs.existsSync(hooksJsonSrc)) return;
|
|
606
943
|
|
|
@@ -629,6 +966,8 @@ function registerClaudeHooks(targetHookDir, dryRun = false) {
|
|
|
629
966
|
|
|
630
967
|
function linkDirectory(src, dest, dryRun = false) {
|
|
631
968
|
if (dryRun) return;
|
|
969
|
+
const parentDir = path.dirname(dest);
|
|
970
|
+
if (!fs.existsSync(parentDir)) return;
|
|
632
971
|
if (fs.existsSync(dest)) {
|
|
633
972
|
try {
|
|
634
973
|
const stat = fs.lstatSync(dest);
|
|
@@ -673,6 +1012,8 @@ function copyDirectory(src, dest, dryRun = false) {
|
|
|
673
1012
|
|
|
674
1013
|
function deployAgentContracts(targetDir, link = false, clean = false, dryRun = false, agentsList = null) {
|
|
675
1014
|
if (!fs.existsSync(agentsDir)) return 0;
|
|
1015
|
+
const parentDir = path.dirname(targetDir);
|
|
1016
|
+
if (!fs.existsSync(parentDir)) return 0;
|
|
676
1017
|
const allFiles = fs.readdirSync(agentsDir).filter(f => f.endsWith('.md'));
|
|
677
1018
|
const agentFiles = agentsList ? allFiles.filter(f => agentsList.includes(f)) : allFiles;
|
|
678
1019
|
|
|
@@ -747,17 +1088,7 @@ function deployGlobalShims(targetToolsDir, dryRun = false) {
|
|
|
747
1088
|
async function syncModelsFromEndpoint() {
|
|
748
1089
|
console.log(`${colors.cyan}${colors.bold}=== Live Model Synchronization ===${colors.reset}\n`);
|
|
749
1090
|
const detected = detectEnvironment();
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
let targetUrl = null;
|
|
753
|
-
if (proxyUrl && proxyUrl.startsWith('http')) {
|
|
754
|
-
if (proxyUrl.includes('ghostcli.cloud')) {
|
|
755
|
-
targetUrl = 'https://ghostcli.cloud/v1/models';
|
|
756
|
-
} else if (!proxyUrl.includes('api.anthropic.com') && !proxyUrl.includes('api.openai.com')) {
|
|
757
|
-
const base = proxyUrl.replace(/\/+$/, '');
|
|
758
|
-
targetUrl = base.endsWith('/v1') ? `${base}/models` : (base.endsWith('/models') ? base : `${base}/v1/models`);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
1091
|
+
const targetUrl = resolveCustomModelsEndpoint(detected.endpoints);
|
|
761
1092
|
|
|
762
1093
|
if (targetUrl) {
|
|
763
1094
|
console.log(`Probing Proxy / Vendor Models API: ${colors.yellow}${targetUrl}${colors.reset}...`);
|
|
@@ -773,18 +1104,82 @@ async function syncModelsFromEndpoint() {
|
|
|
773
1104
|
currentModels = JSON.parse(fs.readFileSync(modelsPath, 'utf8'));
|
|
774
1105
|
}
|
|
775
1106
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1107
|
+
console.log(`Checking live health of discovered models...`);
|
|
1108
|
+
const apiKey = detected.endpoints.claude_key || detected.endpoints.codex_key || process.env.ANTHROPIC_API_KEY || process.env.GHOSTCLI_API_KEY || '';
|
|
1109
|
+
const baseUrl = targetUrl.replace(/\/v1\/models\/?$/, '');
|
|
1110
|
+
|
|
1111
|
+
const testedModels = await Promise.all(modelsList.map(async m => {
|
|
1112
|
+
const modelId = m.id || m.slug;
|
|
1113
|
+
let isAlive = true;
|
|
1114
|
+
|
|
1115
|
+
if (apiKey) {
|
|
1116
|
+
try {
|
|
1117
|
+
const controller = new AbortController();
|
|
1118
|
+
const timeout = setTimeout(() => controller.abort(), 8000);
|
|
1119
|
+
const testRes = await fetch(`${baseUrl}/v1/messages`, {
|
|
1120
|
+
method: 'POST',
|
|
1121
|
+
headers: {
|
|
1122
|
+
'x-api-key': apiKey,
|
|
1123
|
+
'anthropic-version': '2023-06-01',
|
|
1124
|
+
'content-type': 'application/json'
|
|
1125
|
+
},
|
|
1126
|
+
body: JSON.stringify({
|
|
1127
|
+
model: modelId,
|
|
1128
|
+
max_tokens: 5,
|
|
1129
|
+
messages: [{ role: 'user', content: 'hi' }]
|
|
1130
|
+
}),
|
|
1131
|
+
signal: controller.signal
|
|
1132
|
+
});
|
|
1133
|
+
clearTimeout(timeout);
|
|
1134
|
+
isAlive = testRes.ok;
|
|
1135
|
+
} catch {
|
|
1136
|
+
isAlive = false;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
return { raw: m, modelId, isAlive };
|
|
781
1141
|
}));
|
|
782
1142
|
|
|
1143
|
+
const liveModels = testedModels.filter(t => t.isAlive);
|
|
1144
|
+
const deadModels = testedModels.filter(t => !t.isAlive);
|
|
1145
|
+
|
|
1146
|
+
if (deadModels.length > 0) {
|
|
1147
|
+
console.log(`${colors.yellow}⚠ Filtered out ${deadModels.length} unresponsive model(s): ${deadModels.map(d => d.modelId).join(', ')}${colors.reset}\n`);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
const mapped = liveModels.map(({ raw: m }) => {
|
|
1151
|
+
const resolved = resolveModelMaxContext(m, { prioritizeMax: true });
|
|
1152
|
+
return {
|
|
1153
|
+
id: m.id || m.slug,
|
|
1154
|
+
displayName: m.display_name || m.id,
|
|
1155
|
+
context: resolved.label,
|
|
1156
|
+
context_window_tokens: resolved.tokens,
|
|
1157
|
+
description: m.description || ''
|
|
1158
|
+
};
|
|
1159
|
+
});
|
|
1160
|
+
|
|
783
1161
|
currentModels.custom_proxies = mapped;
|
|
784
1162
|
currentModels.ghostcli = mapped;
|
|
785
1163
|
|
|
786
1164
|
fs.writeFileSync(modelsPath, JSON.stringify(currentModels, null, 2));
|
|
787
1165
|
console.log(`${colors.green}✔ Synchronized models catalog to config/models.json${colors.reset}\n`);
|
|
1166
|
+
|
|
1167
|
+
console.log(`${colors.bold}Available Models Catalog (${mapped.length} models):${colors.reset}`);
|
|
1168
|
+
mapped.forEach(m => {
|
|
1169
|
+
const idStr = `${colors.cyan}${m.id.padEnd(24)}${colors.reset}`;
|
|
1170
|
+
const ctxStr = `${colors.yellow}[${m.context}]${colors.reset}`;
|
|
1171
|
+
const descStr = m.description ? `${colors.dim}— ${m.description}${colors.reset}` : '';
|
|
1172
|
+
console.log(` • ${idStr} ${ctxStr} ${descStr}`);
|
|
1173
|
+
});
|
|
1174
|
+
console.log('');
|
|
1175
|
+
|
|
1176
|
+
const hermesDir = getHermesDir();
|
|
1177
|
+
if (fs.existsSync(hermesDir)) {
|
|
1178
|
+
const hermesContextUpdated = configureHermesContextLimit(hermesDir, mapped);
|
|
1179
|
+
if (hermesContextUpdated) {
|
|
1180
|
+
console.log(`${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}\n`);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
788
1183
|
} else {
|
|
789
1184
|
console.log(`${colors.yellow}Notice: Endpoint returned HTTP ${res.status}. Preserving cached models.json.${colors.reset}\n`);
|
|
790
1185
|
}
|
|
@@ -798,6 +1193,12 @@ async function syncModelsFromEndpoint() {
|
|
|
798
1193
|
|
|
799
1194
|
async function runSync(options, detected) {
|
|
800
1195
|
console.log(`${colors.bold}${colors.cyan}=== Heimdall Auto-Sync Engine ===${colors.reset}\n`);
|
|
1196
|
+
|
|
1197
|
+
const countSyncResult = syncCatalogCounts(__dirname, options.dryRun);
|
|
1198
|
+
if (countSyncResult && countSyncResult.modified) {
|
|
1199
|
+
console.log(` ${colors.green}✔ Synchronized documentation & catalog counts (${countSyncResult.suiteCount} suites / ${countSyncResult.skillCount} modules)${colors.reset}\n`);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
801
1202
|
console.log(`Scanning for newly installed AI tools on PATH...\n`);
|
|
802
1203
|
|
|
803
1204
|
const allAvailableSkills = fs.readdirSync(skillsDir, { withFileTypes: true })
|
|
@@ -811,17 +1212,17 @@ async function runSync(options, detected) {
|
|
|
811
1212
|
let syncedAny = false;
|
|
812
1213
|
|
|
813
1214
|
for (const [agent, targetDir] of Object.entries(targetPaths)) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
else if (agent === 'codex' && detected.tools.codex) toolInstalled = true;
|
|
818
|
-
else if (agent === 'agents') toolInstalled = true;
|
|
819
|
-
else if (agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) {
|
|
820
|
-
toolInstalled = true;
|
|
1215
|
+
if (!isAgentConfigurable(agent)) continue;
|
|
1216
|
+
|
|
1217
|
+
if (agent === 'hermes') {
|
|
821
1218
|
configureHermesExternalDirs(getHermesDir(), false);
|
|
1219
|
+
const hermesContextUpdated = configureHermesContextLimit(getHermesDir(), null, false);
|
|
1220
|
+
if (hermesContextUpdated) {
|
|
1221
|
+
console.log(` ${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}`);
|
|
1222
|
+
}
|
|
822
1223
|
}
|
|
823
|
-
else if (agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir()))) toolInstalled = true;
|
|
824
1224
|
|
|
1225
|
+
const toolInstalled = true;
|
|
825
1226
|
if (toolInstalled) {
|
|
826
1227
|
// Synchronize doctrine, playbooks & commands unconditionally for installed harnesses
|
|
827
1228
|
const targetDocFile = targetDoctrinePaths[agent];
|
|
@@ -888,24 +1289,9 @@ async function runSync(options, detected) {
|
|
|
888
1289
|
}
|
|
889
1290
|
}
|
|
890
1291
|
|
|
891
|
-
//
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
let deskConfig = { mcpServers: {} };
|
|
895
|
-
if (fs.existsSync(claudeDesktopFile)) {
|
|
896
|
-
try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
|
|
897
|
-
}
|
|
898
|
-
if (!deskConfig.mcpServers?.context7) {
|
|
899
|
-
if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
|
|
900
|
-
deskConfig.mcpServers.context7 = {
|
|
901
|
-
command: "npx",
|
|
902
|
-
args: ["-y", "@upstash/context7-mcp"]
|
|
903
|
-
};
|
|
904
|
-
fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2));
|
|
905
|
-
console.log(` ${colors.green}✔${colors.reset} Configured Context7 MCP for Claude Desktop`);
|
|
906
|
-
syncedAny = true;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
1292
|
+
// Synchronize Model Context Protocol (MCP) servers (OpenDesign, Context7, etc.)
|
|
1293
|
+
const mcpSynced = syncMcpServers(detected, options);
|
|
1294
|
+
if (mcpSynced) syncedAny = true;
|
|
909
1295
|
|
|
910
1296
|
// Refresh bridge tools & shims
|
|
911
1297
|
const activeToolsDir = options.toolsDir || detected.pathCandidates[0];
|
|
@@ -913,6 +1299,16 @@ async function runSync(options, detected) {
|
|
|
913
1299
|
deployGlobalShims(activeToolsDir, false);
|
|
914
1300
|
}
|
|
915
1301
|
|
|
1302
|
+
// Refresh active workspace doctrine files
|
|
1303
|
+
const srcDoc = path.join(doctrineDir, 'AGENTS.md');
|
|
1304
|
+
if (fs.existsSync(srcDoc)) {
|
|
1305
|
+
for (const cand of detected.doctrineCandidates) {
|
|
1306
|
+
if (fs.existsSync(cand)) {
|
|
1307
|
+
try { fs.copyFileSync(srcDoc, cand); } catch {}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
|
|
916
1312
|
if (syncedAny) {
|
|
917
1313
|
console.log(`\n${colors.bold}${colors.green}✔ Auto-sync complete! All active AI tools are now synchronized.${colors.reset}\n`);
|
|
918
1314
|
} else {
|
|
@@ -969,50 +1365,44 @@ function runAudit(options) {
|
|
|
969
1365
|
const unlinkedTools = [];
|
|
970
1366
|
|
|
971
1367
|
for (const [agent, targetDir] of Object.entries(targetPaths)) {
|
|
1368
|
+
const rootDir = getAgentRootDir(agent);
|
|
972
1369
|
const targetAgentDir = targetAgentPaths[agent];
|
|
973
|
-
if (
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1370
|
+
if (isAgentConfigurable(agent)) {
|
|
1371
|
+
if (fs.existsSync(targetDir)) {
|
|
1372
|
+
const entries = fs.readdirSync(targetDir, { withFileTypes: true })
|
|
1373
|
+
.filter(d => (d.isDirectory() || d.isSymbolicLink()) && d.name !== '.system');
|
|
1374
|
+
|
|
1375
|
+
let linkedCount = 0;
|
|
1376
|
+
for (const entry of entries) {
|
|
1377
|
+
try {
|
|
1378
|
+
if (fs.lstatSync(path.join(targetDir, entry.name)).isSymbolicLink()) {
|
|
1379
|
+
linkedCount++;
|
|
1380
|
+
}
|
|
1381
|
+
} catch {}
|
|
1382
|
+
}
|
|
985
1383
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1384
|
+
const installed = entries.map(d => d.name);
|
|
1385
|
+
const missing = availableSkills.filter(s => !installed.includes(s));
|
|
1386
|
+
const statusColor = missing.length === 0 ? colors.green : colors.yellow;
|
|
1387
|
+
const linkLabel = linkedCount === installed.length && installed.length > 0
|
|
1388
|
+
? ` (${colors.cyan}Live Junctions / Single Source of Truth${colors.reset})`
|
|
1389
|
+
: linkedCount > 0 ? ` (${linkedCount} linked, ${installed.length - linkedCount} copies)` : ' (Static copies)';
|
|
992
1390
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1391
|
+
const agentCount = fs.existsSync(targetAgentDir)
|
|
1392
|
+
? fs.readdirSync(targetAgentDir).filter(f => f.endsWith('.md')).length
|
|
1393
|
+
: 0;
|
|
996
1394
|
|
|
997
|
-
|
|
1395
|
+
console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${statusColor}${installed.length} skills, ${agentCount} agents${colors.reset} in ${rootDir}${linkLabel}`);
|
|
998
1396
|
|
|
999
|
-
|
|
1397
|
+
if (installed.length === 0) {
|
|
1398
|
+
unlinkedTools.push(agent);
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.yellow}INSTALLED BUT NOT LINKED (${targetDir})${colors.reset}`);
|
|
1000
1402
|
unlinkedTools.push(agent);
|
|
1001
1403
|
}
|
|
1002
1404
|
} else {
|
|
1003
|
-
|
|
1004
|
-
const isToolDetected = (agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) ||
|
|
1005
|
-
(agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir())));
|
|
1006
|
-
if (!isHermesOrOpenClaw || isToolDetected) {
|
|
1007
|
-
console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.dim}NOT LINKED (${targetDir})${colors.reset}`);
|
|
1008
|
-
}
|
|
1009
|
-
if ((agent === 'claude' && detected.tools.claude) ||
|
|
1010
|
-
(agent === 'gemini' && detected.tools.agy) ||
|
|
1011
|
-
(agent === 'codex' && detected.tools.codex) ||
|
|
1012
|
-
(agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) ||
|
|
1013
|
-
(agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir())))) {
|
|
1014
|
-
unlinkedTools.push(agent);
|
|
1015
|
-
}
|
|
1405
|
+
console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.dim}Not found (${rootDir || 'unconfigured'})${colors.reset}`);
|
|
1016
1406
|
}
|
|
1017
1407
|
}
|
|
1018
1408
|
|
|
@@ -1038,6 +1428,17 @@ function runAudit(options) {
|
|
|
1038
1428
|
console.log(` ${colors.dim}Not found at ${activeDoctrine}${colors.reset}`);
|
|
1039
1429
|
}
|
|
1040
1430
|
|
|
1431
|
+
console.log(`\n${colors.bold}Model Context Protocol (MCP) Servers:${colors.reset}`);
|
|
1432
|
+
const mcpReport = auditMcpServers();
|
|
1433
|
+
if (mcpReport.length > 0) {
|
|
1434
|
+
for (const item of mcpReport) {
|
|
1435
|
+
const status = item.configured ? `${colors.green}Configured${colors.reset}` : `${colors.dim}Not configured${colors.reset}`;
|
|
1436
|
+
console.log(` ${item.harness.padEnd(20)} [${item.server}] -> ${status}`);
|
|
1437
|
+
}
|
|
1438
|
+
} else {
|
|
1439
|
+
console.log(` ${colors.dim}No MCP server harnesses detected.${colors.reset}`);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1041
1442
|
console.log('');
|
|
1042
1443
|
}
|
|
1043
1444
|
|
|
@@ -1204,40 +1605,54 @@ async function runUninstall(options, detected) {
|
|
|
1204
1605
|
|
|
1205
1606
|
async function runPostInstallMenu(options, detected) {
|
|
1206
1607
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1608
|
+
const hasCustomApi = Boolean(resolveCustomModelsEndpoint(detected.endpoints));
|
|
1207
1609
|
try {
|
|
1208
1610
|
console.log(`${colors.bold}${colors.cyan}=== Heimdall Management Hub ===${colors.reset}`);
|
|
1209
1611
|
console.log(`Heimdall is currently installed and active across your environment.\n`);
|
|
1210
1612
|
console.log(`What would you like to do?`);
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1613
|
+
|
|
1614
|
+
const menuItems = [
|
|
1615
|
+
{ label: 'Audit Environment & Health Check', action: 'audit' },
|
|
1616
|
+
{ label: 'Fast Sync Skills & Agents (1-sec zero-drift)', action: 'sync' },
|
|
1617
|
+
...(hasCustomApi ? [{ label: 'Refresh Dynamic Models (sync-models)', action: 'sync-models' }] : []),
|
|
1618
|
+
{ label: 'Uninstall Heimdall', action: 'uninstall' },
|
|
1619
|
+
{ label: 'Reinstall / Reconfigure Profile & Targets', action: 'reinstall' },
|
|
1620
|
+
{ label: 'Exit', action: 'exit' }
|
|
1621
|
+
];
|
|
1622
|
+
|
|
1623
|
+
menuItems.forEach((item, idx) => {
|
|
1624
|
+
console.log(` ${idx + 1}. ${item.label}`);
|
|
1625
|
+
});
|
|
1626
|
+
console.log('');
|
|
1627
|
+
|
|
1628
|
+
const answer = await rl.question(`Choose an option [1-${menuItems.length}, default: 1]: `);
|
|
1219
1629
|
const choice = answer.trim().toLowerCase();
|
|
1220
1630
|
|
|
1221
|
-
if (choice === '
|
|
1631
|
+
if (choice === 'q' || choice === 'exit') {
|
|
1632
|
+
console.log('Goodbye!');
|
|
1633
|
+
process.exit(0);
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
const idx = choice === '' ? 0 : parseInt(choice, 10) - 1;
|
|
1637
|
+
const selected = menuItems[idx] ? menuItems[idx].action : 'audit';
|
|
1638
|
+
|
|
1639
|
+
if (selected === 'audit') {
|
|
1222
1640
|
runAudit(options);
|
|
1223
1641
|
process.exit(0);
|
|
1224
|
-
} else if (
|
|
1642
|
+
} else if (selected === 'sync') {
|
|
1225
1643
|
await runSync(options, detected);
|
|
1226
1644
|
process.exit(0);
|
|
1227
|
-
} else if (
|
|
1645
|
+
} else if (selected === 'sync-models') {
|
|
1228
1646
|
await syncModelsFromEndpoint();
|
|
1229
1647
|
process.exit(0);
|
|
1230
|
-
} else if (
|
|
1648
|
+
} else if (selected === 'uninstall') {
|
|
1231
1649
|
await runUninstall(options, detected);
|
|
1232
1650
|
process.exit(0);
|
|
1233
|
-
} else if (
|
|
1651
|
+
} else if (selected === 'reinstall') {
|
|
1234
1652
|
return 'reinstall';
|
|
1235
|
-
} else if (
|
|
1653
|
+
} else if (selected === 'exit') {
|
|
1236
1654
|
console.log('Goodbye!');
|
|
1237
1655
|
process.exit(0);
|
|
1238
|
-
} else {
|
|
1239
|
-
runAudit(options);
|
|
1240
|
-
process.exit(0);
|
|
1241
1656
|
}
|
|
1242
1657
|
} finally {
|
|
1243
1658
|
rl.close();
|
|
@@ -1287,7 +1702,7 @@ async function runInteractive(options, detected) {
|
|
|
1287
1702
|
}
|
|
1288
1703
|
|
|
1289
1704
|
console.log(`\n${colors.yellow}Select Installation Profile Tier:${colors.reset}`);
|
|
1290
|
-
console.log(` 1. full - All
|
|
1705
|
+
console.log(` 1. full - All 64 curated skills (Complete Powerhouse)`);
|
|
1291
1706
|
console.log(` 2. minimal - 16 core skills (Planning, TDD, Anti-Slop, Taste, Hygiene)`);
|
|
1292
1707
|
console.log(` 3. security - 12 security skills (Differential HTTP probing, OWASP, Trail of Bits)`);
|
|
1293
1708
|
console.log(` 4. design - 14 frontend skills (Taste, GSAP motion, Brandkit, Tokens)`);
|
|
@@ -1476,6 +1891,7 @@ function runUpdateSkill(targetSkill = 'all') {
|
|
|
1476
1891
|
|
|
1477
1892
|
async function main() {
|
|
1478
1893
|
printBanner();
|
|
1894
|
+
await checkForUpdates();
|
|
1479
1895
|
const options = parseArgs();
|
|
1480
1896
|
const detected = detectEnvironment();
|
|
1481
1897
|
|
|
@@ -1504,6 +1920,16 @@ async function main() {
|
|
|
1504
1920
|
process.exit(0);
|
|
1505
1921
|
}
|
|
1506
1922
|
|
|
1923
|
+
if (options.syncDocs) {
|
|
1924
|
+
const res = syncCatalogCounts(__dirname, options.dryRun);
|
|
1925
|
+
if (res) {
|
|
1926
|
+
console.log(`${colors.green}✔ Documentation and catalog counts synchronized (${res.suiteCount} suites / ${res.skillCount} modules).${colors.reset}\n`);
|
|
1927
|
+
} else {
|
|
1928
|
+
console.log(`${colors.red}Failed to synchronize catalog counts.${colors.reset}\n`);
|
|
1929
|
+
}
|
|
1930
|
+
process.exit(0);
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1507
1933
|
if (options.sync) {
|
|
1508
1934
|
await runSync(options, detected);
|
|
1509
1935
|
process.exit(0);
|
|
@@ -1564,21 +1990,25 @@ async function main() {
|
|
|
1564
1990
|
// 2. Resolve destination agent directories
|
|
1565
1991
|
let activeDestinations = [];
|
|
1566
1992
|
if (options.agents.includes('all')) {
|
|
1567
|
-
activeDestinations = Object.entries(targetPaths).filter(([agent]) =>
|
|
1568
|
-
if (agent === 'openclaw') return Boolean(detected.tools.openclaw || fs.existsSync(getOpenClawDir()));
|
|
1569
|
-
if (agent === 'hermes') return Boolean(detected.tools.hermes || fs.existsSync(getHermesDir()));
|
|
1570
|
-
return true;
|
|
1571
|
-
});
|
|
1993
|
+
activeDestinations = Object.entries(targetPaths).filter(([agent]) => isAgentConfigurable(agent));
|
|
1572
1994
|
} else {
|
|
1573
1995
|
for (const agent of options.agents) {
|
|
1574
1996
|
if (targetPaths[agent]) {
|
|
1575
|
-
|
|
1997
|
+
if (isAgentConfigurable(agent)) {
|
|
1998
|
+
activeDestinations.push([agent, targetPaths[agent]]);
|
|
1999
|
+
} else {
|
|
2000
|
+
const rootDir = getAgentRootDir(agent);
|
|
2001
|
+
console.log(`\n-> ${colors.bold}${agent.toUpperCase()}${colors.reset} directory not found at ${rootDir} (skipped; only configured if exists)`);
|
|
2002
|
+
}
|
|
1576
2003
|
}
|
|
1577
2004
|
}
|
|
1578
2005
|
}
|
|
1579
2006
|
|
|
1580
2007
|
// 3. Clean and deploy skills
|
|
1581
2008
|
for (const [agent, targetDir] of activeDestinations) {
|
|
2009
|
+
const rootDir = getAgentRootDir(agent);
|
|
2010
|
+
if (!rootDir || !fs.existsSync(rootDir)) continue;
|
|
2011
|
+
|
|
1582
2012
|
console.log(`\n-> Deploying to ${colors.bold}${agent.toUpperCase()}${colors.reset} (${targetDir})...`);
|
|
1583
2013
|
if (!options.dryRun && !fs.existsSync(targetDir)) {
|
|
1584
2014
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
@@ -1611,6 +2041,10 @@ async function main() {
|
|
|
1611
2041
|
if (hermesConfigured) {
|
|
1612
2042
|
console.log(` ${colors.green}✔ Registered ~/.agents/skills in Hermes config.yaml external_dirs${colors.reset}`);
|
|
1613
2043
|
}
|
|
2044
|
+
const hermesContextUpdated = configureHermesContextLimit(getHermesDir(), null, options.dryRun);
|
|
2045
|
+
if (hermesContextUpdated) {
|
|
2046
|
+
console.log(` ${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}`);
|
|
2047
|
+
}
|
|
1614
2048
|
}
|
|
1615
2049
|
}
|
|
1616
2050
|
|
|
@@ -1640,35 +2074,16 @@ async function main() {
|
|
|
1640
2074
|
}
|
|
1641
2075
|
}
|
|
1642
2076
|
|
|
1643
|
-
// 4.
|
|
1644
|
-
|
|
1645
|
-
const claudeDesktopDir = getClaudeDesktopDir();
|
|
1646
|
-
const claudeDesktopFile = path.join(claudeDesktopDir, 'claude_desktop_config.json');
|
|
1647
|
-
|
|
1648
|
-
console.log(`\n-> Configuring Claude Desktop (${claudeDesktopFile})...`);
|
|
1649
|
-
if (!options.dryRun) {
|
|
1650
|
-
if (!fs.existsSync(claudeDesktopDir)) fs.mkdirSync(claudeDesktopDir, { recursive: true });
|
|
1651
|
-
let deskConfig = { mcpServers: {} };
|
|
1652
|
-
if (fs.existsSync(claudeDesktopFile)) {
|
|
1653
|
-
try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
|
|
1654
|
-
}
|
|
1655
|
-
if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
|
|
1656
|
-
deskConfig.mcpServers.context7 = {
|
|
1657
|
-
command: "npx",
|
|
1658
|
-
args: ["-y", "@upstash/context7-mcp"]
|
|
1659
|
-
};
|
|
1660
|
-
fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2));
|
|
1661
|
-
}
|
|
1662
|
-
console.log(` ${colors.green}✔ Configured Context7 MCP for Claude Desktop${colors.reset}`);
|
|
1663
|
-
}
|
|
2077
|
+
// 4. Synchronize Model Context Protocol (MCP) servers (OpenDesign, Context7, etc.)
|
|
2078
|
+
syncMcpServers(detected, options);
|
|
1664
2079
|
|
|
1665
2080
|
// 5. Deploy tools & global heimdall CLI shims if requested
|
|
1666
2081
|
if (options.tools && options.toolsDir) {
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
const tools = fs.readdirSync(toolsDir);
|
|
2082
|
+
if (!fs.existsSync(options.toolsDir)) {
|
|
2083
|
+
console.log(`\n-> Tools directory not found at ${options.toolsDir} (skipped)`);
|
|
2084
|
+
} else {
|
|
2085
|
+
console.log(`\n-> Deploying Bridge Tools & 'heimdall' CLI to ${colors.bold}${options.toolsDir}${colors.reset}...`);
|
|
2086
|
+
const tools = fs.readdirSync(toolsDir).filter(f => fs.statSync(path.join(toolsDir, f)).isFile());
|
|
1672
2087
|
for (const tool of tools) {
|
|
1673
2088
|
const src = path.join(toolsDir, tool);
|
|
1674
2089
|
const dest = path.join(options.toolsDir, tool);
|
|
@@ -1682,6 +2097,7 @@ async function main() {
|
|
|
1682
2097
|
// Deploy global heimdall shim
|
|
1683
2098
|
deployGlobalShims(options.toolsDir, options.dryRun);
|
|
1684
2099
|
console.log(` ${colors.green}✔ Deployed ${tools.length} cross-model bridge tools + 'heimdall' global CLI shim${colors.reset}`);
|
|
2100
|
+
}
|
|
1685
2101
|
}
|
|
1686
2102
|
|
|
1687
2103
|
// 6. Deploy universal doctrine & playbooks if requested
|
|
@@ -1698,6 +2114,7 @@ async function main() {
|
|
|
1698
2114
|
|
|
1699
2115
|
// Synchronize doctrine across all active harnesses
|
|
1700
2116
|
for (const [agent, targetDocFile] of Object.entries(targetDoctrinePaths)) {
|
|
2117
|
+
if (!isAgentConfigurable(agent)) continue;
|
|
1701
2118
|
const parentDir = path.dirname(targetDocFile);
|
|
1702
2119
|
if (fs.existsSync(parentDir)) {
|
|
1703
2120
|
fs.copyFileSync(srcDoc, targetDocFile);
|
|
@@ -1708,6 +2125,7 @@ async function main() {
|
|
|
1708
2125
|
// Synchronize playbooks
|
|
1709
2126
|
if (fs.existsSync(playbooksDir)) {
|
|
1710
2127
|
for (const [agent, targetPlayDir] of Object.entries(targetPlaybookPaths)) {
|
|
2128
|
+
if (!isAgentConfigurable(agent)) continue;
|
|
1711
2129
|
const parentDir = path.dirname(targetPlayDir);
|
|
1712
2130
|
if (fs.existsSync(parentDir)) {
|
|
1713
2131
|
if (options.link) {
|
|
@@ -1723,6 +2141,7 @@ async function main() {
|
|
|
1723
2141
|
// Synchronize custom commands (Claude Code CLI)
|
|
1724
2142
|
if (fs.existsSync(commandsDir)) {
|
|
1725
2143
|
for (const [agent, targetCmdDir] of Object.entries(targetCommandPaths)) {
|
|
2144
|
+
if (!isAgentConfigurable(agent)) continue;
|
|
1726
2145
|
const parentDir = path.dirname(targetCmdDir);
|
|
1727
2146
|
if (fs.existsSync(parentDir)) {
|
|
1728
2147
|
if (options.link) {
|
|
@@ -1738,6 +2157,7 @@ async function main() {
|
|
|
1738
2157
|
// Synchronize lifecycle hooks (Claude Code CLI)
|
|
1739
2158
|
if (fs.existsSync(hooksDir)) {
|
|
1740
2159
|
for (const [agent, targetHookDir] of Object.entries(targetHookPaths)) {
|
|
2160
|
+
if (!isAgentConfigurable(agent)) continue;
|
|
1741
2161
|
const parentDir = path.dirname(targetHookDir);
|
|
1742
2162
|
if (fs.existsSync(parentDir)) {
|
|
1743
2163
|
if (options.link) {
|