create-snipara 1.3.48 → 1.3.50
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 +116 -15
- 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.50",
|
|
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",
|
|
@@ -248,6 +248,58 @@ function normalizeInitOptions(options) {
|
|
|
248
248
|
}
|
|
249
249
|
return normalized;
|
|
250
250
|
}
|
|
251
|
+
function normalizeMaintenanceOptions(options) {
|
|
252
|
+
const parsed = parseMaintenanceOptionsFromArgv(process.argv.slice(2));
|
|
253
|
+
const normalized = { ...parsed };
|
|
254
|
+
for (const [key, value] of Object.entries(options)) {
|
|
255
|
+
if (value !== void 0) {
|
|
256
|
+
normalized[key] = value;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return normalized;
|
|
260
|
+
}
|
|
261
|
+
function parseMaintenanceOptionsFromArgv(args) {
|
|
262
|
+
const parsed = {};
|
|
263
|
+
const valueFlags = {
|
|
264
|
+
"--api-key": "apiKey",
|
|
265
|
+
"--slug": "slug",
|
|
266
|
+
"--project-id": "projectId",
|
|
267
|
+
"--profile": "profile",
|
|
268
|
+
"--client": "client"
|
|
269
|
+
};
|
|
270
|
+
const booleanFlags = {
|
|
271
|
+
"--skip-npm-check": "skipNpmCheck",
|
|
272
|
+
"--with-hooks": "withHooks",
|
|
273
|
+
"--with-runtime": "withRuntime",
|
|
274
|
+
"--with-mcp": "withMcp",
|
|
275
|
+
"--with-companion": "withCompanion",
|
|
276
|
+
"--with-orchestrator": "withOrchestrator",
|
|
277
|
+
"--json": "json"
|
|
278
|
+
};
|
|
279
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
280
|
+
const arg = args[index];
|
|
281
|
+
if (!arg.startsWith("-")) {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
const [flag, inlineValue] = arg.split("=", 2);
|
|
285
|
+
const valueKey = valueFlags[flag];
|
|
286
|
+
if (valueKey) {
|
|
287
|
+
const value = inlineValue ?? args[index + 1];
|
|
288
|
+
if (value !== void 0 && !value.startsWith("-")) {
|
|
289
|
+
parsed[valueKey] = value;
|
|
290
|
+
if (inlineValue === void 0) {
|
|
291
|
+
index += 1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const booleanKey = booleanFlags[flag];
|
|
297
|
+
if (booleanKey) {
|
|
298
|
+
parsed[booleanKey] = true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return parsed;
|
|
302
|
+
}
|
|
251
303
|
function parseInitOptionsFromArgv(args) {
|
|
252
304
|
const parsed = {};
|
|
253
305
|
const valueFlags = {
|
|
@@ -331,18 +383,19 @@ async function runInit(options) {
|
|
|
331
383
|
}
|
|
332
384
|
}
|
|
333
385
|
async function runDoctor(options) {
|
|
334
|
-
const
|
|
335
|
-
const
|
|
386
|
+
const normalizedOptions = normalizeMaintenanceOptions(options);
|
|
387
|
+
const requestedClient = normalizeClientOption(normalizedOptions.client);
|
|
388
|
+
const existingAnswers = loadExistingAnswers(normalizedOptions);
|
|
336
389
|
const answers = {
|
|
337
390
|
...existingAnswers,
|
|
338
391
|
aiClient: requestedClient || existingAnswers.aiClient
|
|
339
392
|
};
|
|
340
393
|
const report = await runValidation(answers, true, {
|
|
341
394
|
client: requestedClient || answers.aiClient,
|
|
342
|
-
includeNpmFreshness: !
|
|
395
|
+
includeNpmFreshness: !normalizedOptions.skipNpmCheck
|
|
343
396
|
});
|
|
344
397
|
writeDoctorReport(report);
|
|
345
|
-
if (
|
|
398
|
+
if (normalizedOptions.json) {
|
|
346
399
|
console.log(JSON.stringify({ detection: detectEnvironment(), validation: report }, null, 2));
|
|
347
400
|
return;
|
|
348
401
|
}
|
|
@@ -1723,7 +1776,7 @@ async function installClaudeCodeHooks(answers) {
|
|
|
1723
1776
|
{
|
|
1724
1777
|
event: "PreToolUse",
|
|
1725
1778
|
entry: {
|
|
1726
|
-
matcher: "Bash|Read|Grep|Glob|Edit|MultiEdit|Write",
|
|
1779
|
+
matcher: "Bash|Read|Grep|Glob|Edit|MultiEdit|Write|mcp__.*",
|
|
1727
1780
|
hooks: [
|
|
1728
1781
|
{
|
|
1729
1782
|
type: "command",
|
|
@@ -1749,7 +1802,7 @@ async function installClaudeCodeHooks(answers) {
|
|
|
1749
1802
|
{
|
|
1750
1803
|
event: "PostToolUse",
|
|
1751
1804
|
entry: {
|
|
1752
|
-
matcher: "Bash|Read|Grep|Glob|Edit|MultiEdit|Write",
|
|
1805
|
+
matcher: "Bash|Read|Grep|Glob|Edit|MultiEdit|Write|mcp__.*",
|
|
1753
1806
|
hooks: [
|
|
1754
1807
|
{
|
|
1755
1808
|
type: "command",
|
|
@@ -1814,7 +1867,17 @@ fi
|
|
|
1814
1867
|
|
|
1815
1868
|
if [ -n "$SNIPARA_COMPANION_BIN" ]; then
|
|
1816
1869
|
INPUT=$(cat || true)
|
|
1817
|
-
"$
|
|
1870
|
+
TOOL_NAME=$(printf '%s' "$INPUT" | jq -r '.tool_name // .tool // .name // "unknown"' 2>/dev/null || echo "unknown")
|
|
1871
|
+
TOOL_INPUT_JSON=$(printf '%s' "$INPUT" | jq -c '.tool_input // .input // .arguments // .args // .' 2>/dev/null || printf '%s' "$INPUT")
|
|
1872
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" pre-tool "$TOOL_INPUT_JSON" --tool "$TOOL_NAME" --max-tokens "\${SNIPARA_HOOK_MAX_TOKENS:-1200}" 2>/dev/stderr || true)
|
|
1873
|
+
if [ -n "$CONTEXT" ]; then
|
|
1874
|
+
jq -n --arg content "$CONTEXT" '{
|
|
1875
|
+
hookSpecificOutput: {
|
|
1876
|
+
hookEventName: "PreToolUse",
|
|
1877
|
+
additionalContext: $content
|
|
1878
|
+
}
|
|
1879
|
+
}'
|
|
1880
|
+
fi
|
|
1818
1881
|
fi
|
|
1819
1882
|
`;
|
|
1820
1883
|
}
|
|
@@ -1832,9 +1895,17 @@ fi
|
|
|
1832
1895
|
|
|
1833
1896
|
if [ -n "$SNIPARA_COMPANION_BIN" ]; then
|
|
1834
1897
|
if [ -f ".snipara/workflow/current.json" ]; then
|
|
1835
|
-
"$SNIPARA_COMPANION_BIN" workflow resume --include-session-context || true
|
|
1898
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" workflow resume --include-session-context 2>/dev/stderr || true)
|
|
1836
1899
|
else
|
|
1837
|
-
"$SNIPARA_COMPANION_BIN" session-bootstrap || true
|
|
1900
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" session-bootstrap --include-session-context --max-context-tokens "\${SNIPARA_HOOK_MAX_TOKENS:-1200}" 2>/dev/stderr || true)
|
|
1901
|
+
fi
|
|
1902
|
+
if [ -n "$CONTEXT" ]; then
|
|
1903
|
+
jq -n --arg content "$CONTEXT" '{
|
|
1904
|
+
hookSpecificOutput: {
|
|
1905
|
+
hookEventName: "SessionStart",
|
|
1906
|
+
additionalContext: $content
|
|
1907
|
+
}
|
|
1908
|
+
}'
|
|
1838
1909
|
fi
|
|
1839
1910
|
fi
|
|
1840
1911
|
`;
|
|
@@ -1853,7 +1924,23 @@ fi
|
|
|
1853
1924
|
|
|
1854
1925
|
if [ -n "$SNIPARA_COMPANION_BIN" ]; then
|
|
1855
1926
|
INPUT=$(cat || true)
|
|
1856
|
-
"$
|
|
1927
|
+
TOOL_NAME=$(printf '%s' "$INPUT" | jq -r '.tool_name // .tool // .name // "unknown"' 2>/dev/null || echo "unknown")
|
|
1928
|
+
TOOL_INPUT_JSON=$(printf '%s' "$INPUT" | jq -c '.tool_input // .input // .arguments // .args // .' 2>/dev/null || printf '%s' "$INPUT")
|
|
1929
|
+
TOOL_OUTPUT_JSON=$(printf '%s' "$INPUT" | jq -c '.tool_response // .tool_output // .result // .response // {}' 2>/dev/null || echo "{}")
|
|
1930
|
+
STATUS=$(printf '%s' "$INPUT" | jq -r '.status // .tool_status // empty' 2>/dev/null || true)
|
|
1931
|
+
ARGS=(post-tool "$TOOL_INPUT_JSON" --tool "$TOOL_NAME" --result "$TOOL_OUTPUT_JSON")
|
|
1932
|
+
if [ -n "$STATUS" ]; then
|
|
1933
|
+
ARGS+=(--status "$STATUS")
|
|
1934
|
+
fi
|
|
1935
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" "\${ARGS[@]}" 2>/dev/stderr || true)
|
|
1936
|
+
if [ -n "$CONTEXT" ]; then
|
|
1937
|
+
jq -n --arg content "$CONTEXT" '{
|
|
1938
|
+
hookSpecificOutput: {
|
|
1939
|
+
hookEventName: "PostToolUse",
|
|
1940
|
+
additionalContext: $content
|
|
1941
|
+
}
|
|
1942
|
+
}'
|
|
1943
|
+
fi
|
|
1857
1944
|
fi
|
|
1858
1945
|
`;
|
|
1859
1946
|
}
|
|
@@ -1871,9 +1958,17 @@ fi
|
|
|
1871
1958
|
|
|
1872
1959
|
if [ -n "$SNIPARA_COMPANION_BIN" ]; then
|
|
1873
1960
|
if [ -f ".snipara/workflow/current.json" ]; then
|
|
1874
|
-
"$SNIPARA_COMPANION_BIN" task-commit --summary "Claude Code compacted while a managed workflow state existed. Resume with snipara-companion workflow resume --include-session-context and continue from .snipara/workflow/current.json." --category workflow-compaction --outcome partial || true
|
|
1961
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" task-commit --summary "Claude Code compacted while a managed workflow state existed. Resume with snipara-companion workflow resume --include-session-context and continue from .snipara/workflow/current.json." --category workflow-compaction --outcome partial 2>/dev/stderr || true)
|
|
1875
1962
|
else
|
|
1876
|
-
"$SNIPARA_COMPANION_BIN" task-commit --summary "Claude Code compacted local session context" --outcome partial || true
|
|
1963
|
+
CONTEXT=$("$SNIPARA_COMPANION_BIN" task-commit --summary "Claude Code compacted local session context" --category session-compaction --outcome partial 2>/dev/stderr || true)
|
|
1964
|
+
fi
|
|
1965
|
+
if [ -n "$CONTEXT" ]; then
|
|
1966
|
+
jq -n --arg content "$CONTEXT" '{
|
|
1967
|
+
hookSpecificOutput: {
|
|
1968
|
+
hookEventName: "PreCompact",
|
|
1969
|
+
additionalContext: $content
|
|
1970
|
+
}
|
|
1971
|
+
}'
|
|
1877
1972
|
fi
|
|
1878
1973
|
fi
|
|
1879
1974
|
`;
|
|
@@ -2517,7 +2612,11 @@ function getClaudeClientChecks(answers, detection) {
|
|
|
2517
2612
|
const projectHasSnipara = containsSniparaMcpReference(projectConfig);
|
|
2518
2613
|
const projectSettingsHasSnipara = containsSniparaMcpReference(projectSettings);
|
|
2519
2614
|
const codeSettingsHasSnipara = containsSniparaMcpReference(codeSettings);
|
|
2520
|
-
const
|
|
2615
|
+
const legacyCodeSettingsMcpLocations = [
|
|
2616
|
+
projectSettingsHasSnipara ? "project .claude/settings.json" : null,
|
|
2617
|
+
codeSettingsHasSnipara ? "global ~/.claude/settings.json" : null
|
|
2618
|
+
].filter(Boolean);
|
|
2619
|
+
const hasLegacyCodeSettingsMcp = legacyCodeSettingsMcpLocations.length > 0;
|
|
2521
2620
|
const desktopHasSnipara = containsSniparaMcpReference(desktopConfig);
|
|
2522
2621
|
const projectHooksConfigured = containsClaudeHooksReference(projectSettings);
|
|
2523
2622
|
checks.push({
|
|
@@ -2529,7 +2628,9 @@ function getClaudeClientChecks(answers, detection) {
|
|
|
2529
2628
|
checks.push({
|
|
2530
2629
|
name: "claude_code_settings",
|
|
2531
2630
|
status: hasLegacyCodeSettingsMcp ? "warn" : "pass",
|
|
2532
|
-
detail: hasLegacyCodeSettingsMcp ?
|
|
2631
|
+
detail: hasLegacyCodeSettingsMcp ? `Legacy Claude settings contain an MCP server entry (${legacyCodeSettingsMcpLocations.join(
|
|
2632
|
+
", "
|
|
2633
|
+
)}); Claude Code project MCP should live in .mcp.json or be managed by claude mcp add --scope project` : "Claude settings are not being used as the MCP destination; .claude/settings.json is hooks-only"
|
|
2533
2634
|
});
|
|
2534
2635
|
checks.push({
|
|
2535
2636
|
name: "claude_code_hooks",
|
package/package.json
CHANGED