@sellable/install 0.1.44 → 0.1.45
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/bin/sellable-install.mjs +53 -0
- package/package.json +1 -1
package/bin/sellable-install.mjs
CHANGED
|
@@ -1295,9 +1295,62 @@ function installClaude(opts) {
|
|
|
1295
1295
|
["mcp", "add", "--transport", "stdio", "sellable", "--", command, ...args],
|
|
1296
1296
|
opts
|
|
1297
1297
|
);
|
|
1298
|
+
// Patch ~/.claude.json to add `alwaysLoad: true` so Claude Code v2.1.121+
|
|
1299
|
+
// pre-loads all mcp__sellable__* tool schemas instead of deferring them
|
|
1300
|
+
// behind ToolSearch (saves 2 round trips per `/sellable:create-campaign`
|
|
1301
|
+
// session). Older Claude Code versions ignore the field — no harm.
|
|
1302
|
+
patchClaudeAlwaysLoad(opts);
|
|
1298
1303
|
return true;
|
|
1299
1304
|
}
|
|
1300
1305
|
|
|
1306
|
+
function patchClaudeAlwaysLoad(opts) {
|
|
1307
|
+
if (opts.dryRun) {
|
|
1308
|
+
logVerbose(
|
|
1309
|
+
`${C.grey}+ would set alwaysLoad: true on sellable MCP server in ~/.claude.json${C.reset}`
|
|
1310
|
+
);
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
const claudeJsonPath = join(homedir(), ".claude.json");
|
|
1314
|
+
if (!existsSync(claudeJsonPath)) {
|
|
1315
|
+
logVerbose(
|
|
1316
|
+
`${C.grey}+ ~/.claude.json missing — skipping alwaysLoad patch (claude mcp add should have created it)${C.reset}`
|
|
1317
|
+
);
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
try {
|
|
1321
|
+
const raw = readFileSync(claudeJsonPath, "utf8");
|
|
1322
|
+
const config = JSON.parse(raw);
|
|
1323
|
+
let touched = false;
|
|
1324
|
+
// Top-level mcpServers.sellable (older claude versions)
|
|
1325
|
+
if (config.mcpServers?.sellable) {
|
|
1326
|
+
if (config.mcpServers.sellable.alwaysLoad !== true) {
|
|
1327
|
+
config.mcpServers.sellable.alwaysLoad = true;
|
|
1328
|
+
touched = true;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
// Per-project mcpServers.sellable (current claude default)
|
|
1332
|
+
for (const projectPath of Object.keys(config.projects || {})) {
|
|
1333
|
+
const projServers = config.projects[projectPath]?.mcpServers;
|
|
1334
|
+
if (projServers?.sellable && projServers.sellable.alwaysLoad !== true) {
|
|
1335
|
+
projServers.sellable.alwaysLoad = true;
|
|
1336
|
+
touched = true;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (touched) {
|
|
1340
|
+
writeFileSync(claudeJsonPath, JSON.stringify(config, null, 2), {
|
|
1341
|
+
mode: 0o600,
|
|
1342
|
+
});
|
|
1343
|
+
logVerbose(
|
|
1344
|
+
`${C.grey}+ patched ${claudeJsonPath} sellable.alwaysLoad = true${C.reset}`
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
} catch (err) {
|
|
1348
|
+
logVerbose(
|
|
1349
|
+
`${C.grey}+ could not patch alwaysLoad: ${err instanceof Error ? err.message : String(err)} (non-fatal)${C.reset}`
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1301
1354
|
function installCodex(opts) {
|
|
1302
1355
|
if (!commandExists("codex")) {
|
|
1303
1356
|
const message =
|