create-snipara 1.3.26 → 1.3.28
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/dist/index.js +60 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { homedir } from "os";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "create-snipara",
|
|
16
|
-
version: "1.3.
|
|
16
|
+
version: "1.3.28",
|
|
17
17
|
description: "Onboard Snipara Hosted MCP Context + Memory with auth, companion workflows, and optional Snipara Sandbox",
|
|
18
18
|
main: "dist/index.js",
|
|
19
19
|
type: "module",
|
|
@@ -286,6 +286,7 @@ async function runInit(options) {
|
|
|
286
286
|
if (answers.profile !== "runtime-only" || answers.installRuntime) {
|
|
287
287
|
await createMcpConfig(answers);
|
|
288
288
|
}
|
|
289
|
+
await createProjectBinding(answers);
|
|
289
290
|
await createAgentTemplates(answers);
|
|
290
291
|
if (answers.installHooks && answers.aiClient === "claude-code") {
|
|
291
292
|
await installClaudeCodeHooks(answers);
|
|
@@ -331,6 +332,7 @@ async function runRepair(options) {
|
|
|
331
332
|
await installNodeCompanion(true);
|
|
332
333
|
}
|
|
333
334
|
await createMcpConfig(answers);
|
|
335
|
+
await createProjectBinding(answers);
|
|
334
336
|
await createAgentTemplates(answers);
|
|
335
337
|
await updateEnvFiles(answers);
|
|
336
338
|
await createCompanionConfig(answers);
|
|
@@ -361,6 +363,7 @@ async function runUpgrade(options) {
|
|
|
361
363
|
if (options.withMcp || options.withRuntime || detection.files.mcpConfig) {
|
|
362
364
|
await createMcpConfig(upgradedAnswers);
|
|
363
365
|
}
|
|
366
|
+
await createProjectBinding(upgradedAnswers);
|
|
364
367
|
await createAgentTemplates(upgradedAnswers);
|
|
365
368
|
await createCompanionConfig(upgradedAnswers);
|
|
366
369
|
if (options.withHooks || answers.installHooks) {
|
|
@@ -1083,6 +1086,19 @@ async function createMcpConfig(answers) {
|
|
|
1083
1086
|
await createClaudeDesktopConfig(answers);
|
|
1084
1087
|
}
|
|
1085
1088
|
}
|
|
1089
|
+
async function createProjectBinding(answers) {
|
|
1090
|
+
if (answers.profile === "runtime-only") {
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
const sniparaDir = path.join(process.cwd(), ".snipara");
|
|
1094
|
+
const projectBindingPath = path.join(sniparaDir, "project");
|
|
1095
|
+
const projectBinding = `${answers.projectSlug}
|
|
1096
|
+
`;
|
|
1097
|
+
const action = fs.existsSync(projectBindingPath) ? "Updated" : "Created";
|
|
1098
|
+
fs.mkdirSync(sniparaDir, { recursive: true });
|
|
1099
|
+
fs.writeFileSync(projectBindingPath, projectBinding);
|
|
1100
|
+
console.log(chalk.green(` \u2713 ${action} .snipara/project`));
|
|
1101
|
+
}
|
|
1086
1102
|
async function createAgentTemplates(answers) {
|
|
1087
1103
|
if (answers.profile === "runtime-only") {
|
|
1088
1104
|
return;
|
|
@@ -1618,20 +1634,43 @@ async function createCompanionConfig(answers) {
|
|
|
1618
1634
|
}
|
|
1619
1635
|
const configDir = path.join(process.cwd(), ".snipara", "companion");
|
|
1620
1636
|
const configPath = path.join(configDir, "config.json");
|
|
1637
|
+
const globalConfigPath = getGlobalCompanionConfigPath();
|
|
1621
1638
|
fs.mkdirSync(configDir, { recursive: true });
|
|
1622
|
-
|
|
1639
|
+
fs.mkdirSync(path.dirname(globalConfigPath), { recursive: true });
|
|
1640
|
+
const existingGlobalConfig = readCompanionConfigFile(globalConfigPath);
|
|
1641
|
+
const existingWorkspaceConfig = readCompanionConfigFile(configPath);
|
|
1642
|
+
const globalConfig = {
|
|
1643
|
+
...existingGlobalConfig,
|
|
1623
1644
|
apiKey: answers.apiKey,
|
|
1624
|
-
|
|
1625
|
-
apiUrl: API_URL,
|
|
1626
|
-
sessionId: `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
|
|
1645
|
+
apiUrl: API_URL
|
|
1627
1646
|
};
|
|
1628
|
-
|
|
1647
|
+
const workspaceConfig = {
|
|
1648
|
+
projectId: answers.projectId || (typeof existingWorkspaceConfig.projectId === "string" && existingWorkspaceConfig.projectId ? existingWorkspaceConfig.projectId : answers.projectSlug),
|
|
1649
|
+
sessionId: typeof existingWorkspaceConfig.sessionId === "string" && existingWorkspaceConfig.sessionId ? existingWorkspaceConfig.sessionId : `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
|
|
1650
|
+
};
|
|
1651
|
+
fs.writeFileSync(globalConfigPath, JSON.stringify(globalConfig, null, 2) + "\n");
|
|
1652
|
+
fs.writeFileSync(configPath, JSON.stringify(workspaceConfig, null, 2) + "\n");
|
|
1629
1653
|
ensureGitignoreEntry(
|
|
1630
1654
|
".snipara/companion/config.json",
|
|
1631
|
-
"# Snipara local companion config
|
|
1655
|
+
"# Snipara local companion workspace config"
|
|
1632
1656
|
);
|
|
1657
|
+
console.log(chalk.green(" \u2713 Configured global companion auth"));
|
|
1633
1658
|
console.log(chalk.green(" \u2713 Configured local companion workspace"));
|
|
1634
1659
|
}
|
|
1660
|
+
function getGlobalCompanionConfigPath() {
|
|
1661
|
+
return path.join(homedir(), ".rlmsaas", "config.json");
|
|
1662
|
+
}
|
|
1663
|
+
function readCompanionConfigFile(filePath) {
|
|
1664
|
+
if (!fs.existsSync(filePath)) {
|
|
1665
|
+
return {};
|
|
1666
|
+
}
|
|
1667
|
+
try {
|
|
1668
|
+
const parsed = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
1669
|
+
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
1670
|
+
} catch {
|
|
1671
|
+
return {};
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1635
1674
|
function getClientGuidance(client) {
|
|
1636
1675
|
if (client === "claude-code") {
|
|
1637
1676
|
return [
|
|
@@ -3026,19 +3065,31 @@ function getExistingConfig() {
|
|
|
3026
3065
|
const runtimeServer = config.mcpServers?.[SANDBOX_SERVER_NAME] || config.mcpServers?.[LEGACY_RUNTIME_SERVER_NAME];
|
|
3027
3066
|
return {
|
|
3028
3067
|
slug: extractSlugFromMcpEndpoint(sniparaServer?.url) || void 0,
|
|
3029
|
-
projectId:
|
|
3068
|
+
projectId: readExistingCompanionProjectId(),
|
|
3030
3069
|
hasSniparaServer: Boolean(sniparaServer),
|
|
3031
3070
|
hasRuntimeServer: Boolean(runtimeServer)
|
|
3032
3071
|
};
|
|
3033
3072
|
} catch {
|
|
3034
3073
|
return {
|
|
3035
3074
|
slug: void 0,
|
|
3036
|
-
projectId:
|
|
3075
|
+
projectId: readExistingCompanionProjectId(),
|
|
3037
3076
|
hasSniparaServer: false,
|
|
3038
3077
|
hasRuntimeServer: false
|
|
3039
3078
|
};
|
|
3040
3079
|
}
|
|
3041
3080
|
}
|
|
3081
|
+
function readExistingCompanionProjectId() {
|
|
3082
|
+
const configPath = path.join(process.cwd(), ".snipara", "companion", "config.json");
|
|
3083
|
+
if (!fs.existsSync(configPath)) {
|
|
3084
|
+
return void 0;
|
|
3085
|
+
}
|
|
3086
|
+
try {
|
|
3087
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
3088
|
+
return typeof parsed.projectId === "string" && parsed.projectId ? parsed.projectId : void 0;
|
|
3089
|
+
} catch {
|
|
3090
|
+
return void 0;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3042
3093
|
main().catch((error) => {
|
|
3043
3094
|
console.error(chalk.red("Error:"), error.message);
|
|
3044
3095
|
process.exit(1);
|
package/package.json
CHANGED