create-snipara 1.3.34 → 1.3.35

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.
Files changed (3) hide show
  1. package/README.md +1 -6
  2. package/dist/index.js +23 -50
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -106,8 +106,7 @@ That distinction matters:
106
106
  - installs optional `snipara-orchestrator` for proof gates, drift checks, and htask workflows when requested
107
107
  - configures `.mcp.json`
108
108
  - generates merge-ready AI agent templates in `.snipara/templates/`, including Pro+ symbol-card, code-impact, and managed workflow guidance for paid Context plans
109
- - creates `AGENTS.md` and `CLAUDE.md` when missing, or appends a marked Snipara section when those files already exist
110
- - creates `.cursor/rules/snipara.mdc` and `.codex/config.toml` when those files do not already exist
109
+ - creates `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/snipara.mdc`, and `.codex/config.toml` when those files do not already exist
111
110
  - writes client-specific companion packs such as `.snipara/companion/CODEX.md` or `.snipara/companion/GEMINI.md`
112
111
  - updates `.env`, `.env.local`, and `.env.example`
113
112
  - generates `.snipara/companion/README.md`
@@ -163,10 +162,6 @@ The generated agent templates cover:
163
162
  - ChatGPT/OpenAI HTTP MCP snippet
164
163
  - Gemini, VS Code, Continue, and custom HTTP MCP reference snippets
165
164
 
166
- Existing root `AGENTS.md` and `CLAUDE.md` files are not replaced. The installer
167
- adds or refreshes a marked Snipara section so project-specific instructions stay
168
- intact.
169
-
170
165
  When `snipara-companion` is installed, the companion pack also includes the compaction-safe managed workflow:
171
166
 
172
167
  ```bash
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.34",
16
+ version: "1.3.35",
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",
@@ -1152,12 +1152,12 @@ async function createAgentTemplates(answers) {
1152
1152
  fs.writeFileSync(template.path, template.content);
1153
1153
  }
1154
1154
  console.log(chalk.green(" Created .snipara/templates agent snippets"));
1155
- writeOrMergeMarkdownInstructions(
1155
+ writeIfMissing(
1156
1156
  path.join(process.cwd(), "AGENTS.md"),
1157
1157
  buildAgentsMdTemplate(answers),
1158
1158
  "AGENTS.md"
1159
1159
  );
1160
- writeOrMergeMarkdownInstructions(
1160
+ writeIfMissing(
1161
1161
  path.join(process.cwd(), "CLAUDE.md"),
1162
1162
  buildClaudeMdTemplate(answers),
1163
1163
  "CLAUDE.md"
@@ -1186,45 +1186,6 @@ function writeIfMissing(filePath, content, label) {
1186
1186
  fs.writeFileSync(filePath, content);
1187
1187
  console.log(chalk.green(` Created ${label}`));
1188
1188
  }
1189
- function markdownInstructionMarker(label, type) {
1190
- return `<!-- snipara:instructions ${label}:${type} -->`;
1191
- }
1192
- function escapeRegExp(value) {
1193
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1194
- }
1195
- function ensureTrailingNewline(content) {
1196
- return content.endsWith("\n") ? content : `${content}
1197
- `;
1198
- }
1199
- function buildMarkdownInstructionBlock(label, content) {
1200
- return [
1201
- markdownInstructionMarker(label, "start"),
1202
- content.trimEnd(),
1203
- markdownInstructionMarker(label, "end"),
1204
- ""
1205
- ].join("\n");
1206
- }
1207
- function writeOrMergeMarkdownInstructions(filePath, content, label) {
1208
- if (!fs.existsSync(filePath)) {
1209
- fs.writeFileSync(filePath, content);
1210
- console.log(chalk.green(` Created ${label}`));
1211
- return;
1212
- }
1213
- const current = fs.readFileSync(filePath, "utf8");
1214
- if (current.trim() === content.trim()) {
1215
- console.log(chalk.dim(` ${label} already contains Snipara instructions`));
1216
- return;
1217
- }
1218
- const block = buildMarkdownInstructionBlock(label, content);
1219
- const start = markdownInstructionMarker(label, "start");
1220
- const end = markdownInstructionMarker(label, "end");
1221
- const existingBlockPattern = new RegExp(
1222
- `${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}\\n?`
1223
- );
1224
- const nextContent = existingBlockPattern.test(current) ? ensureTrailingNewline(current.replace(existingBlockPattern, block)) : `${current}${current.endsWith("\n\n") ? "" : current.endsWith("\n") ? "\n" : "\n\n"}${block}`;
1225
- fs.writeFileSync(filePath, nextContent);
1226
- console.log(chalk.green(` Updated ${label} with Snipara instructions`));
1227
- }
1228
1189
  function buildHostedMcpEndpoint(answers) {
1229
1190
  return `${API_URL}/mcp/${answers.projectSlug}`;
1230
1191
  }
@@ -1269,8 +1230,7 @@ Agent task lifecycle:
1269
1230
  8. Use \`snipara_plan\` or \`snipara_decompose\` only for FULL-mode work and only
1270
1231
  when the hosted server exposes them.
1271
1232
  9. When the LLM has produced a visible multi-phase plan and \`snipara-companion\`
1272
- is installed, run \`snipara-companion workflow start --goal "<goal>" --plan-file
1273
- <plan_file>\`, then use \`workflow phase-start\`, \`workflow phase-commit\`,
1233
+ is installed, run \`snipara-companion workflow start --goal "<goal>" --plan-file <plan_file>\`, then use \`workflow phase-start\`, \`workflow phase-commit\`,
1274
1234
  \`workflow resume\`, and \`final-commit\` so compaction cannot lose the next
1275
1235
  phase.
1276
1236
  10. Use local file reads, \`rg\`, git commands, and test commands for exact edits,
@@ -1680,18 +1640,31 @@ async function createCompanionConfig(answers) {
1680
1640
  }
1681
1641
  const configDir = path.join(process.cwd(), ".snipara", "companion");
1682
1642
  const configPath = path.join(configDir, "config.json");
1643
+ const globalConfigPath = getGlobalCompanionConfigPath();
1683
1644
  fs.mkdirSync(configDir, { recursive: true });
1645
+ fs.mkdirSync(path.dirname(globalConfigPath), { recursive: true });
1646
+ const existingGlobalConfig = readCompanionConfigFile(globalConfigPath);
1684
1647
  const existingWorkspaceConfig = readCompanionConfigFile(configPath);
1685
- const workspaceConfig = {
1686
- ...existingWorkspaceConfig,
1648
+ const globalConfig = {
1649
+ ...existingGlobalConfig,
1687
1650
  apiKey: answers.apiKey,
1688
- apiUrl: API_URL,
1689
- projectId: answers.projectId || answers.projectSlug,
1651
+ apiUrl: API_URL
1652
+ };
1653
+ const workspaceConfig = {
1654
+ projectId: answers.projectSlug,
1690
1655
  sessionId: typeof existingWorkspaceConfig.sessionId === "string" && existingWorkspaceConfig.sessionId ? existingWorkspaceConfig.sessionId : `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
1691
1656
  };
1657
+ fs.writeFileSync(globalConfigPath, JSON.stringify(globalConfig, null, 2) + "\n");
1692
1658
  fs.writeFileSync(configPath, JSON.stringify(workspaceConfig, null, 2) + "\n");
1693
- ensureGitignoreEntry(".snipara/companion/config.json", "# Snipara local companion config");
1694
- console.log(chalk.green(" \u2713 Configured local companion config"));
1659
+ ensureGitignoreEntry(
1660
+ ".snipara/companion/config.json",
1661
+ "# Snipara local companion workspace config"
1662
+ );
1663
+ console.log(chalk.green(" \u2713 Configured global companion auth"));
1664
+ console.log(chalk.green(" \u2713 Configured local companion workspace"));
1665
+ }
1666
+ function getGlobalCompanionConfigPath() {
1667
+ return path.join(homedir(), ".rlmsaas", "config.json");
1695
1668
  }
1696
1669
  function readCompanionConfigFile(filePath) {
1697
1670
  if (!fs.existsSync(filePath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-snipara",
3
- "version": "1.3.34",
3
+ "version": "1.3.35",
4
4
  "description": "Onboard Snipara Hosted MCP Context + Memory with auth, companion workflows, and optional Snipara Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",