create-snipara 2.2.18 → 3.0.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 +15 -27
- package/dist/index.js +157 -109
- package/dist/managed-toolchain.d.ts +6 -4
- package/dist/managed-toolchain.js +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ impact tooling instead of starting cold every session.
|
|
|
8
8
|
|
|
9
9
|
## Choose your first step
|
|
10
10
|
|
|
11
|
-
| Goal
|
|
12
|
-
|
|
|
13
|
-
| Track and verify local coding work
|
|
14
|
-
| Connect sourced project context
|
|
15
|
-
| Connect an existing self-hosted server | Use `--self-hosted` with its endpoint
|
|
11
|
+
| Goal | Command | Requirements |
|
|
12
|
+
| -------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------ |
|
|
13
|
+
| Track and verify local coding work | `npx create-snipara@latest init --profile local-work --client codex` | Supported Node.js and Python; no Snipara account |
|
|
14
|
+
| Connect sourced project context | `npx create-snipara@latest` | Authorized Snipara project connection |
|
|
15
|
+
| Connect an existing self-hosted server | Use `--self-hosted` with its endpoint | Running server and operator credentials |
|
|
16
16
|
|
|
17
17
|
Use `--client claude-code` for Claude Code. Local work prepares compatible
|
|
18
|
-
Companion
|
|
18
|
+
Companion and Sandbox tools. It does not install Docker or
|
|
19
19
|
dependency images, run tests or call a model. Hosted context is optional for
|
|
20
20
|
local work; add `--connect-context` when you want to set it up explicitly.
|
|
21
21
|
See [install profiles](#install-profiles) for the full contract.
|
|
@@ -103,7 +103,6 @@ Advanced flags can wire local helpers around those surfaces:
|
|
|
103
103
|
- `snipara-companion` for Git-style status, briefs, timelines, phase commits,
|
|
104
104
|
handoffs, resume, and local workflow commands
|
|
105
105
|
- `snipara-sandbox` for optional local code execution
|
|
106
|
-
- `snipara-orchestrator` only when explicitly requested with `--with-orchestrator`
|
|
107
106
|
- local config, env files, hook scripts, and a project companion pack
|
|
108
107
|
- `snipara-mcp` only for local stdio compatibility, development, or testing
|
|
109
108
|
|
|
@@ -145,7 +144,7 @@ authorization; disconnected users continue locally. To explicitly start optional
|
|
|
145
144
|
context onboarding, add `--connect-context`. This never becomes a prerequisite
|
|
146
145
|
for local tasks or validation, and a global API key does not select a project.
|
|
147
146
|
|
|
148
|
-
Local work prepares compatible private Companion
|
|
147
|
+
Local work prepares compatible private Companion and Sandbox
|
|
149
148
|
versions, checks their versions and installed command hashes, then atomically
|
|
150
149
|
selects the completed bundle. It uses the existing Node/npm and Python runtimes;
|
|
151
150
|
Node.js must already be version 18+ and Python version 3.10+; incompatible
|
|
@@ -183,12 +182,12 @@ the local-work selection from existing activation/native configuration.
|
|
|
183
182
|
|
|
184
183
|
The CLI now works around explicit install profiles:
|
|
185
184
|
|
|
186
|
-
| Profile | What it installs | Best for
|
|
187
|
-
| ------------------ | --------------------------------------------- |
|
|
188
|
-
| `hosted-only` | Hosted MCP config only | Default: first grounded answer with no local companion, hooks, or sandbox
|
|
189
|
-
| `hosted-companion` | MCP + `snipara-companion` | Hosted context plus managed local workflow after first value
|
|
190
|
-
| `full-stack` | MCP + `snipara-companion` + `snipara-sandbox` | Hosted context plus sandboxed local execution
|
|
191
|
-
| `runtime-only` | `snipara-sandbox` only | Local execution without hosted API
|
|
185
|
+
| Profile | What it installs | Best for |
|
|
186
|
+
| ------------------ | --------------------------------------------- | ------------------------------------------------------------------------- |
|
|
187
|
+
| `hosted-only` | Hosted MCP config only | Default: first grounded answer with no local companion, hooks, or sandbox |
|
|
188
|
+
| `hosted-companion` | MCP + `snipara-companion` | Hosted context plus managed local workflow after first value |
|
|
189
|
+
| `full-stack` | MCP + `snipara-companion` + `snipara-sandbox` | Hosted context plus sandboxed local execution |
|
|
190
|
+
| `runtime-only` | `snipara-sandbox` only | Local execution without hosted API |
|
|
192
191
|
|
|
193
192
|
Default profile: `hosted-only`
|
|
194
193
|
|
|
@@ -228,7 +227,6 @@ That distinction matters:
|
|
|
228
227
|
- installs `snipara-companion` only with `--advanced`, `--profile hosted-companion`,
|
|
229
228
|
`--profile full-stack`, or `repair --with-companion`
|
|
230
229
|
- installs optional `snipara-sandbox`
|
|
231
|
-
- installs optional `snipara-orchestrator` for proof gates and drift checks when requested
|
|
232
230
|
- configures `.mcp.json`
|
|
233
231
|
- generates merge-ready AI agent templates in `.snipara/templates/`, including symbol-card, code-impact, and managed workflow guidance within plan capacity
|
|
234
232
|
- creates `AGENTS.md` and `CLAUDE.md` when missing, or appends a marked Snipara section when those files already exist
|
|
@@ -321,8 +319,8 @@ By default, this uses the minimal `hosted-only` setup: configured MCP config and
|
|
|
321
319
|
doctor report, with no local Companion install, hooks, GitHub approval prompt, or
|
|
322
320
|
sandbox prompt. Add `--advanced` when you want profile selection, project id
|
|
323
321
|
entry, hook prompts, GitHub automation prompts, or sandbox provider prompts.
|
|
324
|
-
|
|
325
|
-
validation
|
|
322
|
+
Orchestrator is retired: the `--with-orchestrator` option is gone, and scoped
|
|
323
|
+
validation runs through `snipara-sandbox`.
|
|
326
324
|
|
|
327
325
|
The advanced flow asks for:
|
|
328
326
|
|
|
@@ -726,16 +724,6 @@ npx create-snipara --profile full-stack --advanced
|
|
|
726
724
|
|
|
727
725
|
Best when the user also wants sandboxed `snipara-sandbox` execution.
|
|
728
726
|
|
|
729
|
-
### Full local stack plus production orchestration
|
|
730
|
-
|
|
731
|
-
```bash
|
|
732
|
-
npx create-snipara --profile full-stack --with-orchestrator
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
Best when the user wants Hosted MCP, companion workflows, Sandbox execution, and
|
|
736
|
-
the explicit `snipara-orchestrator` package for production gates, drift checks,
|
|
737
|
-
and coordination.
|
|
738
|
-
|
|
739
727
|
### Connect the current repository
|
|
740
728
|
|
|
741
729
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { homedir as homedir2 } from "os";
|
|
|
14
14
|
// package.json
|
|
15
15
|
var package_default = {
|
|
16
16
|
name: "create-snipara",
|
|
17
|
-
version: "
|
|
17
|
+
version: "3.0.0",
|
|
18
18
|
description: "Onboard Snipara Cloud or self-hosted MCP with an automatic project-grounded proof of value",
|
|
19
19
|
main: "dist/index.js",
|
|
20
20
|
type: "module",
|
|
@@ -187,7 +187,8 @@ import { createHash as createHash4 } from "crypto";
|
|
|
187
187
|
|
|
188
188
|
// ../project-intelligence-contracts/src/managed-toolchain.ts
|
|
189
189
|
var MANAGED_TOOLCHAIN_VERSION = "snipara.toolchain.v1";
|
|
190
|
-
var MANAGED_TOOLCHAIN_COMPONENTS = ["companion", "
|
|
190
|
+
var MANAGED_TOOLCHAIN_COMPONENTS = ["companion", "sandbox"];
|
|
191
|
+
var MANAGED_TOOLCHAIN_RETIRED_COMPONENTS = ["orchestrator"];
|
|
191
192
|
var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
192
193
|
var bounded = (value, max) => typeof value === "string" && value.length > 0 && value.length <= max && !Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127);
|
|
193
194
|
function canonicalAbsolute(value) {
|
|
@@ -199,12 +200,18 @@ function parseManagedToolchainManifest(value) {
|
|
|
199
200
|
}
|
|
200
201
|
const root = value.root;
|
|
201
202
|
const components = {};
|
|
202
|
-
for (const name of MANAGED_TOOLCHAIN_COMPONENTS) {
|
|
203
|
+
for (const name of [...MANAGED_TOOLCHAIN_COMPONENTS, ...MANAGED_TOOLCHAIN_RETIRED_COMPONENTS]) {
|
|
203
204
|
const component = value.components[name];
|
|
205
|
+
if (component === void 0 && MANAGED_TOOLCHAIN_RETIRED_COMPONENTS.includes(name))
|
|
206
|
+
continue;
|
|
204
207
|
if (!object(component) || !bounded(component.version, 64) || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(component.version) || !canonicalAbsolute(component.command) || !component.command.startsWith(root + "/") || typeof component.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(component.sha256)) {
|
|
205
208
|
throw new Error("Invalid managed component identity");
|
|
206
209
|
}
|
|
207
|
-
components[name] = {
|
|
210
|
+
components[name] = {
|
|
211
|
+
version: component.version,
|
|
212
|
+
command: component.command,
|
|
213
|
+
sha256: component.sha256
|
|
214
|
+
};
|
|
208
215
|
}
|
|
209
216
|
return {
|
|
210
217
|
schemaVersion: MANAGED_TOOLCHAIN_VERSION,
|
|
@@ -218,9 +225,8 @@ function parseManagedToolchainManifest(value) {
|
|
|
218
225
|
|
|
219
226
|
// src/managed-versions.json
|
|
220
227
|
var managed_versions_default = {
|
|
221
|
-
companion: "
|
|
222
|
-
|
|
223
|
-
sandbox: "3.3.0"
|
|
228
|
+
companion: "8.0.0",
|
|
229
|
+
sandbox: "3.4.0"
|
|
224
230
|
};
|
|
225
231
|
|
|
226
232
|
// src/managed-toolchain.ts
|
|
@@ -574,7 +580,7 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
574
580
|
prior = null;
|
|
575
581
|
}
|
|
576
582
|
}
|
|
577
|
-
const bundleId = `bundle-${MANAGED_VERSIONS.companion}-${MANAGED_VERSIONS.
|
|
583
|
+
const bundleId = `bundle-${MANAGED_VERSIONS.companion}-${MANAGED_VERSIONS.sandbox}-${randomUUID2()}`;
|
|
578
584
|
const root = path.join(base, bundleId);
|
|
579
585
|
fs.mkdirSync(root, { mode: 448 });
|
|
580
586
|
for (const directory of ["home", "tmp"])
|
|
@@ -602,8 +608,7 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
602
608
|
"install",
|
|
603
609
|
"--no-input",
|
|
604
610
|
"--disable-pip-version-check",
|
|
605
|
-
"snipara-sandbox[validation,mcp]==" + MANAGED_VERSIONS.sandbox
|
|
606
|
-
"snipara-orchestrator==" + MANAGED_VERSIONS.orchestrator
|
|
611
|
+
"snipara-sandbox[validation,mcp]==" + MANAGED_VERSIONS.sandbox
|
|
607
612
|
]);
|
|
608
613
|
await run(npm, [
|
|
609
614
|
"install",
|
|
@@ -625,11 +630,6 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
625
630
|
command: fs.realpathSync(path.join(prefix, "node_modules/.bin/snipara-companion")),
|
|
626
631
|
sha256: ""
|
|
627
632
|
},
|
|
628
|
-
orchestrator: {
|
|
629
|
-
version: MANAGED_VERSIONS.orchestrator,
|
|
630
|
-
command: path.join(venv, "bin/snipara-orchestrator"),
|
|
631
|
-
sha256: ""
|
|
632
|
-
},
|
|
633
633
|
sandbox: {
|
|
634
634
|
version: MANAGED_VERSIONS.sandbox,
|
|
635
635
|
command: path.join(venv, "bin/snipara-sandbox"),
|
|
@@ -974,12 +974,10 @@ var MIN_COMPANION_VERSION = "3.8.0";
|
|
|
974
974
|
var GITHUB_ANSWER_PACKS_LABEL = "GitHub PR Answer Packs";
|
|
975
975
|
var MCP_PACKAGE_NAME = "snipara-mcp";
|
|
976
976
|
var SANDBOX_PACKAGE_NAME = "snipara-sandbox[all]";
|
|
977
|
-
var ORCHESTRATOR_PACKAGE_NAME = "snipara-orchestrator";
|
|
978
977
|
var SANDBOX_SERVER_NAME = "snipara-sandbox";
|
|
979
978
|
var LEGACY_RUNTIME_SERVER_NAME = "rlm-runtime";
|
|
980
979
|
var SANDBOX_COMMAND_NAME = "snipara-sandbox";
|
|
981
980
|
var LEGACY_SANDBOX_COMMAND_NAME = "rlm";
|
|
982
|
-
var ORCHESTRATOR_COMMAND_NAME = "snipara-orchestrator";
|
|
983
981
|
var DEVICE_CLIENT_ID = "create-snipara";
|
|
984
982
|
var DAY_ZERO_CORPUS_MAX_FILES = 8;
|
|
985
983
|
var DAY_ZERO_CORPUS_MAX_FILE_CHARS = 12e3;
|
|
@@ -2195,7 +2193,8 @@ function runLocalSourceActivation(answers, manifest) {
|
|
|
2195
2193
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2196
2194
|
timeout: 3e4
|
|
2197
2195
|
};
|
|
2198
|
-
if (managed)
|
|
2196
|
+
if (managed)
|
|
2197
|
+
execFileSync3(process.execPath, [companionCommand, "source", "init", "."], runOptions);
|
|
2199
2198
|
else execSync(initCommand, runOptions);
|
|
2200
2199
|
manifest.lanes.localSnapshot = createActivationLane(
|
|
2201
2200
|
"ready",
|
|
@@ -2219,7 +2218,8 @@ function runLocalSourceActivation(answers, manifest) {
|
|
|
2219
2218
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2220
2219
|
timeout: 45e3
|
|
2221
2220
|
};
|
|
2222
|
-
if (managed)
|
|
2221
|
+
if (managed)
|
|
2222
|
+
execFileSync3(process.execPath, [companionCommand, "source", "sync", "--json"], runOptions);
|
|
2223
2223
|
else execSync(syncCommand, runOptions);
|
|
2224
2224
|
manifest.lanes.contextIndex = createActivationLane(
|
|
2225
2225
|
"indexing",
|
|
@@ -2579,7 +2579,7 @@ function buildProgram() {
|
|
|
2579
2579
|
).option("--advanced", "Show advanced profile, project id, hooks, GitHub, and sandbox prompts").option("--connect-context", "Optionally connect project context during local-work setup").option(
|
|
2580
2580
|
"--profile <profile>",
|
|
2581
2581
|
"Install profile: hosted-only (Context), local-work, hosted-companion, full-stack, runtime-only"
|
|
2582
|
-
).option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--skip-companion", "Skip local companion CLI installation").option("--skip-mcp", "Skip local snipara-mcp package installation").option("--skip-runtime", "Skip snipara-sandbox installation").option("--skip-hooks", "Skip hook generation").option("--skip-test", "Skip MCP connection and value-proof checks").option("--
|
|
2582
|
+
).option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--skip-companion", "Skip local companion CLI installation").option("--skip-mcp", "Skip local snipara-mcp package installation").option("--skip-runtime", "Skip snipara-sandbox installation").option("--skip-hooks", "Skip hook generation").option("--skip-test", "Skip MCP connection and value-proof checks").option("--github", "Open GitHub repository automation setup when a git remote is detected").option("--skip-github", "Skip the GitHub automation prompt").option("--github-path <path>", "Optional GitHub path filter for the initial repository sync").option("--starter", "Mark this run as a starter activation and print dashboard-first guidance").option("--json", "Print a machine-readable activation summary after setup").option("--runtime-only", "Install only Snipara Sandbox").addOption(new Option("--full", "Legacy alias for --profile full-stack").hideHelp()).option("-y, --yes", "Accept defaults without prompting").action(async (options) => {
|
|
2583
2583
|
printBanner();
|
|
2584
2584
|
await runInit(options);
|
|
2585
2585
|
});
|
|
@@ -2590,7 +2590,7 @@ function buildProgram() {
|
|
|
2590
2590
|
printBanner();
|
|
2591
2591
|
await runDoctor(options);
|
|
2592
2592
|
});
|
|
2593
|
-
program2.command("repair").description("Rebuild local Snipara config and re-run validation").option("--api-key <key>", "Snipara API key override").option("--slug <slug>", "Project slug override").option("--project-id <id>", "Project ID override").option("--profile <profile>", "Target install profile").option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--with-hooks", "Force hook generation").option("--with-runtime", "Force Snipara Sandbox server/config").option("--with-mcp", "Force MCP config").option("--with-companion", "Force companion pack generation").
|
|
2593
|
+
program2.command("repair").description("Rebuild local Snipara config and re-run validation").option("--api-key <key>", "Snipara API key override").option("--slug <slug>", "Project slug override").option("--project-id <id>", "Project ID override").option("--profile <profile>", "Target install profile").option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--with-hooks", "Force hook generation").option("--with-runtime", "Force Snipara Sandbox server/config").option("--with-mcp", "Force MCP config").option("--with-companion", "Force companion pack generation").action(async (options) => {
|
|
2594
2594
|
printBanner();
|
|
2595
2595
|
await runRepair(options);
|
|
2596
2596
|
});
|
|
@@ -2598,7 +2598,7 @@ function buildProgram() {
|
|
|
2598
2598
|
printBanner();
|
|
2599
2599
|
runDemo(options);
|
|
2600
2600
|
});
|
|
2601
|
-
program2.command("upgrade").description("Upgrade installed Snipara local components").option("--slug <slug>", "Project slug override").option("--with-hooks", "Refresh hooks after upgrade").option("--with-runtime", "Upgrade Snipara Sandbox even if not detected").option("--with-mcp", "Upgrade snipara-mcp even if not detected").option("--with-companion", "Upgrade companion even if not detected").
|
|
2601
|
+
program2.command("upgrade").description("Upgrade installed Snipara local components").option("--slug <slug>", "Project slug override").option("--with-hooks", "Refresh hooks after upgrade").option("--with-runtime", "Upgrade Snipara Sandbox even if not detected").option("--with-mcp", "Upgrade snipara-mcp even if not detected").option("--with-companion", "Upgrade companion even if not detected").action(async (options) => {
|
|
2602
2602
|
printBanner();
|
|
2603
2603
|
await runUpgrade(options);
|
|
2604
2604
|
});
|
|
@@ -2620,7 +2620,7 @@ function addSharedRootOptions(program2) {
|
|
|
2620
2620
|
).option("--advanced", "Show advanced profile, project id, hooks, GitHub, and sandbox prompts").option("--connect-context", "Optionally connect project context during local-work setup").option(
|
|
2621
2621
|
"--profile <profile>",
|
|
2622
2622
|
"Install profile: hosted-only (Context), local-work, hosted-companion, full-stack, runtime-only"
|
|
2623
|
-
).option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--skip-companion", "Skip local companion CLI installation").option("--skip-mcp", "Skip local snipara-mcp package installation").option("--skip-runtime", "Skip snipara-sandbox installation").option("--skip-hooks", "Skip hook generation").option("--skip-test", "Skip MCP connection and value-proof checks").option("--
|
|
2623
|
+
).option("--deployment <deployment>", "Deployment: hosted or self-hosted").option("--self-hosted", "Use an existing self-hosted Snipara MCP server").option("--server-url <url>", "Self-hosted MCP endpoint URL").option("--skip-companion", "Skip local companion CLI installation").option("--skip-mcp", "Skip local snipara-mcp package installation").option("--skip-runtime", "Skip snipara-sandbox installation").option("--skip-hooks", "Skip hook generation").option("--skip-test", "Skip MCP connection and value-proof checks").option("--github", "Open GitHub repository automation setup when a git remote is detected").option("--skip-github", "Skip the GitHub automation prompt").option("--github-path <path>", "Optional GitHub path filter for the initial repository sync").option("--starter", "Mark this run as a starter activation and print dashboard-first guidance").option("--json", "Print a machine-readable activation summary after setup").option("--runtime-only", "Install only Snipara Sandbox").addOption(new Option("--full", "Legacy alias for --profile full-stack").hideHelp()).option("-y, --yes", "Accept defaults without prompting");
|
|
2624
2624
|
}
|
|
2625
2625
|
async function main() {
|
|
2626
2626
|
const program2 = buildProgram();
|
|
@@ -2669,7 +2669,6 @@ function parseMaintenanceOptionsFromArgv(args) {
|
|
|
2669
2669
|
"--with-runtime": "withRuntime",
|
|
2670
2670
|
"--with-mcp": "withMcp",
|
|
2671
2671
|
"--with-companion": "withCompanion",
|
|
2672
|
-
"--with-orchestrator": "withOrchestrator",
|
|
2673
2672
|
"--json": "json"
|
|
2674
2673
|
};
|
|
2675
2674
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -2716,7 +2715,6 @@ function parseInitOptionsFromArgv(args) {
|
|
|
2716
2715
|
"--skip-runtime": "skipRuntime",
|
|
2717
2716
|
"--skip-hooks": "skipHooks",
|
|
2718
2717
|
"--skip-test": "skipTest",
|
|
2719
|
-
"--with-orchestrator": "withOrchestrator",
|
|
2720
2718
|
"--runtime-only": "runtimeOnly",
|
|
2721
2719
|
"--full": "full",
|
|
2722
2720
|
"--Full": "full",
|
|
@@ -2758,7 +2756,7 @@ async function runInit(options) {
|
|
|
2758
2756
|
if (answers.profile === "local-work") {
|
|
2759
2757
|
assertManagedMcpConfig();
|
|
2760
2758
|
answers.managedToolchain = await prepareManagedToolchain();
|
|
2761
|
-
} else if (answers.installMcp || answers.installRuntime
|
|
2759
|
+
} else if (answers.installMcp || answers.installRuntime) {
|
|
2762
2760
|
await installPythonPackages(answers, false);
|
|
2763
2761
|
}
|
|
2764
2762
|
if (answers.installCompanion && answers.profile !== "local-work") {
|
|
@@ -2864,7 +2862,7 @@ async function runRepair(options) {
|
|
|
2864
2862
|
if (answers.profile === "local-work") {
|
|
2865
2863
|
assertManagedMcpConfig();
|
|
2866
2864
|
answers.managedToolchain = await prepareManagedToolchain({ repair: true });
|
|
2867
|
-
} else if (answers.installMcp || answers.installRuntime
|
|
2865
|
+
} else if (answers.installMcp || answers.installRuntime) {
|
|
2868
2866
|
await installPythonPackages(answers, true);
|
|
2869
2867
|
}
|
|
2870
2868
|
if (answers.installCompanion && answers.profile !== "local-work") {
|
|
@@ -2897,14 +2895,13 @@ async function runUpgrade(options) {
|
|
|
2897
2895
|
const upgradedAnswers = {
|
|
2898
2896
|
...answers,
|
|
2899
2897
|
installMcp: options.withMcp || answers.installMcp,
|
|
2900
|
-
installRuntime: options.withRuntime || answers.installRuntime
|
|
2901
|
-
installOrchestrator: options.withOrchestrator || answers.installOrchestrator
|
|
2898
|
+
installRuntime: options.withRuntime || answers.installRuntime
|
|
2902
2899
|
};
|
|
2903
2900
|
console.log(chalk.bold("\n\u2B06\uFE0F Upgrading Local Components\n"));
|
|
2904
2901
|
if (answers.profile === "local-work") {
|
|
2905
2902
|
assertManagedMcpConfig();
|
|
2906
2903
|
upgradedAnswers.managedToolchain = await prepareManagedToolchain();
|
|
2907
|
-
} else if (options.withMcp || options.withRuntime ||
|
|
2904
|
+
} else if (options.withMcp || options.withRuntime || detection.existingConfig.hasRuntimeServer) {
|
|
2908
2905
|
await installPythonPackages(upgradedAnswers, true);
|
|
2909
2906
|
}
|
|
2910
2907
|
if (answers.profile !== "local-work" && (options.withCompanion || detection.tooling.companionCli || answers.installCompanion)) {
|
|
@@ -2970,7 +2967,6 @@ async function runPrintConfig(options) {
|
|
|
2970
2967
|
);
|
|
2971
2968
|
console.log(` Local snipara-mcp package: ${answers.installMcp ? "enabled" : "disabled"}`);
|
|
2972
2969
|
console.log(` Snipara Sandbox: ${answers.installRuntime ? "enabled" : "disabled"}`);
|
|
2973
|
-
console.log(` Snipara Orchestrator: ${answers.installOrchestrator ? "enabled" : "disabled"}`);
|
|
2974
2970
|
console.log(` Hooks: ${answers.installHooks ? "enabled" : "disabled"}`);
|
|
2975
2971
|
console.log(` GitHub repo: ${githubRepo ? githubRepo.fullName : "not detected"}`);
|
|
2976
2972
|
if (detection.detectedRepoSlug && detection.detectedRepoSlug !== answers.projectSlug) {
|
|
@@ -3056,7 +3052,6 @@ async function gatherConfiguration(options) {
|
|
|
3056
3052
|
skipCompanion: !!options.skipCompanion,
|
|
3057
3053
|
skipMcp: !!options.skipMcp,
|
|
3058
3054
|
skipRuntime: !!options.skipRuntime,
|
|
3059
|
-
withOrchestrator: !!options.withOrchestrator,
|
|
3060
3055
|
skipHooks: !!options.skipHooks,
|
|
3061
3056
|
configureGitHub: Boolean(
|
|
3062
3057
|
initialDeployment === "hosted" && (options.github || options.githubPath) && detectedGitRepo && !options.skipGithub
|
|
@@ -3102,7 +3097,12 @@ async function gatherConfiguration(options) {
|
|
|
3102
3097
|
type: options.profile ? null : "select",
|
|
3103
3098
|
name: "profile",
|
|
3104
3099
|
message: "How will you use Snipara?",
|
|
3105
|
-
initial: Math.max(
|
|
3100
|
+
initial: Math.max(
|
|
3101
|
+
0,
|
|
3102
|
+
installProfileChoices(showAdvancedPrompts).findIndex(
|
|
3103
|
+
(choice) => choice.value === initialProfile
|
|
3104
|
+
)
|
|
3105
|
+
),
|
|
3106
3106
|
choices: installProfileChoices(showAdvancedPrompts)
|
|
3107
3107
|
},
|
|
3108
3108
|
{
|
|
@@ -3170,12 +3170,6 @@ async function gatherConfiguration(options) {
|
|
|
3170
3170
|
),
|
|
3171
3171
|
choices: AI_CLIENT_CHOICES
|
|
3172
3172
|
},
|
|
3173
|
-
{
|
|
3174
|
-
type: showAdvancedPrompts ? "confirm" : null,
|
|
3175
|
-
name: "installOrchestrator",
|
|
3176
|
-
message: "Install snipara-orchestrator for production gates or drift checks?",
|
|
3177
|
-
initial: Boolean(options.withOrchestrator)
|
|
3178
|
-
},
|
|
3179
3173
|
{
|
|
3180
3174
|
type: showAdvancedPrompts ? "confirm" : null,
|
|
3181
3175
|
name: "installHooks",
|
|
@@ -3231,7 +3225,6 @@ async function gatherConfiguration(options) {
|
|
|
3231
3225
|
skipCompanion: !!options.skipCompanion,
|
|
3232
3226
|
skipMcp: !!options.skipMcp,
|
|
3233
3227
|
skipRuntime: !!options.skipRuntime,
|
|
3234
|
-
withOrchestrator: Boolean(options.withOrchestrator || response.installOrchestrator),
|
|
3235
3228
|
skipHooks: !!options.skipHooks || !(typeof response.installHooks === "boolean" ? response.installHooks : shouldInstallDefaultHooks(requestedClient || response.aiClient || detectedClient)),
|
|
3236
3229
|
configureGitHub: Boolean(
|
|
3237
3230
|
selectedDeployment === "hosted" && (response.configureGitHub || options.github || options.githubPath) && detectedGitRepo && !options.skipGithub
|
|
@@ -3330,7 +3323,9 @@ function getDeploymentLabel(deployment) {
|
|
|
3330
3323
|
return deployment === "self-hosted" ? "self-hosted Snipara Server" : "Snipara Cloud";
|
|
3331
3324
|
}
|
|
3332
3325
|
function isInstallProfile(value) {
|
|
3333
|
-
return ["hosted-only", "local-work", "hosted-companion", "full-stack", "runtime-only"].includes(
|
|
3326
|
+
return ["hosted-only", "local-work", "hosted-companion", "full-stack", "runtime-only"].includes(
|
|
3327
|
+
value
|
|
3328
|
+
);
|
|
3334
3329
|
}
|
|
3335
3330
|
function normalizeClientOption(value) {
|
|
3336
3331
|
if (!value) {
|
|
@@ -3403,7 +3398,9 @@ function installProfileChoices(advanced = true) {
|
|
|
3403
3398
|
}
|
|
3404
3399
|
function buildAnswersFromProfile(input) {
|
|
3405
3400
|
if (input.profile === "local-work" && (input.skipCompanion || input.skipRuntime))
|
|
3406
|
-
throw new Error(
|
|
3401
|
+
throw new Error(
|
|
3402
|
+
"local-work requires the complete managed bundle; choose hosted-only to skip local components"
|
|
3403
|
+
);
|
|
3407
3404
|
const defaults = {
|
|
3408
3405
|
"hosted-only": {
|
|
3409
3406
|
installCompanion: false,
|
|
@@ -3449,7 +3446,6 @@ function buildAnswersFromProfile(input) {
|
|
|
3449
3446
|
installCompanion: selected.installCompanion && !input.skipCompanion,
|
|
3450
3447
|
installMcp: selected.installMcp && !input.skipMcp,
|
|
3451
3448
|
installRuntime: selected.installRuntime && !input.skipRuntime,
|
|
3452
|
-
installOrchestrator: input.profile === "local-work" || input.withOrchestrator,
|
|
3453
3449
|
installHooks: selected.installHooks && !input.skipHooks,
|
|
3454
3450
|
aiClient: input.aiClient,
|
|
3455
3451
|
configureGitHub: Boolean(input.configureGitHub && input.githubRepo),
|
|
@@ -3687,9 +3683,6 @@ function detectSandboxCommand() {
|
|
|
3687
3683
|
}
|
|
3688
3684
|
return null;
|
|
3689
3685
|
}
|
|
3690
|
-
function detectOrchestratorCommand() {
|
|
3691
|
-
return commandExists(ORCHESTRATOR_COMMAND_NAME) ? ORCHESTRATOR_COMMAND_NAME : null;
|
|
3692
|
-
}
|
|
3693
3686
|
async function installPythonPackages(answers, upgrade) {
|
|
3694
3687
|
console.log(chalk.bold(`
|
|
3695
3688
|
\u{1F4E6} ${upgrade ? "Upgrading" : "Installing"} Python Packages
|
|
@@ -3703,11 +3696,6 @@ async function installPythonPackages(answers, upgrade) {
|
|
|
3703
3696
|
if (answers.installRuntime) {
|
|
3704
3697
|
console.log(chalk.gray(` pip install ${upgrade ? "-U " : ""}${SANDBOX_PACKAGE_NAME}`));
|
|
3705
3698
|
}
|
|
3706
|
-
if (answers.installOrchestrator) {
|
|
3707
|
-
console.log(
|
|
3708
|
-
chalk.gray(` pip install ${upgrade ? "-U " : ""}${ORCHESTRATOR_PACKAGE_NAME}`)
|
|
3709
|
-
);
|
|
3710
|
-
}
|
|
3711
3699
|
console.log("");
|
|
3712
3700
|
return;
|
|
3713
3701
|
}
|
|
@@ -3718,9 +3706,6 @@ async function installPythonPackages(answers, upgrade) {
|
|
|
3718
3706
|
if (answers.installRuntime) {
|
|
3719
3707
|
packages.push(SANDBOX_PACKAGE_NAME);
|
|
3720
3708
|
}
|
|
3721
|
-
if (answers.installOrchestrator) {
|
|
3722
|
-
packages.push(ORCHESTRATOR_PACKAGE_NAME);
|
|
3723
|
-
}
|
|
3724
3709
|
if (packages.length === 0) return;
|
|
3725
3710
|
const spinner = ora(
|
|
3726
3711
|
`${upgrade ? "Upgrading" : "Installing"} ${packages.map(stripExtras).join(", ")}...`
|
|
@@ -3820,7 +3805,10 @@ async function installNodeCompanion(upgrade) {
|
|
|
3820
3805
|
`));
|
|
3821
3806
|
}
|
|
3822
3807
|
function assertManagedMcpConfig(file = path4.join(process.cwd(), ".mcp.json")) {
|
|
3823
|
-
sourceConnectionObservation = {
|
|
3808
|
+
sourceConnectionObservation = {
|
|
3809
|
+
workspace: fs4.realpathSync(process.cwd()),
|
|
3810
|
+
source: detectSourceConnection(process.cwd())
|
|
3811
|
+
};
|
|
3824
3812
|
if (!fs4.existsSync(file)) {
|
|
3825
3813
|
try {
|
|
3826
3814
|
fs4.lstatSync(file);
|
|
@@ -3832,14 +3820,20 @@ function assertManagedMcpConfig(file = path4.join(process.cwd(), ".mcp.json")) {
|
|
|
3832
3820
|
}
|
|
3833
3821
|
const info = fs4.lstatSync(file);
|
|
3834
3822
|
if (!info.isFile() || info.isSymbolicLink() || info.size > 1e6)
|
|
3835
|
-
throw new Error(
|
|
3823
|
+
throw new Error(
|
|
3824
|
+
"Existing .mcp.json is not a bounded regular configuration; preserve and repair it first"
|
|
3825
|
+
);
|
|
3836
3826
|
const value = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
3837
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3827
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3828
|
+
throw new Error("Existing .mcp.json is invalid");
|
|
3838
3829
|
const servers = value.mcpServers;
|
|
3839
|
-
if (!servers || typeof servers !== "object" || Array.isArray(servers))
|
|
3830
|
+
if (!servers || typeof servers !== "object" || Array.isArray(servers))
|
|
3831
|
+
throw new Error("Existing MCP servers are invalid");
|
|
3840
3832
|
const native = servers["snipara-local"];
|
|
3841
3833
|
if (native !== void 0 && !isManagedNativeServer(native))
|
|
3842
|
-
throw new Error(
|
|
3834
|
+
throw new Error(
|
|
3835
|
+
"Existing snipara-local connection was preserved; choose another name before managed setup"
|
|
3836
|
+
);
|
|
3843
3837
|
}
|
|
3844
3838
|
function isManagedNativeServer(value) {
|
|
3845
3839
|
const server = asObjectRecord(value);
|
|
@@ -3854,21 +3848,35 @@ function validManagedBootstrap(server, manifest) {
|
|
|
3854
3848
|
}
|
|
3855
3849
|
function managedNativeServer(answers) {
|
|
3856
3850
|
const manifest = answers.managedToolchain ?? managedToolchainStatus().manifest;
|
|
3857
|
-
if (!manifest)
|
|
3858
|
-
|
|
3851
|
+
if (!manifest)
|
|
3852
|
+
throw new Error("Prepare the local-work toolchain before configuring this workspace");
|
|
3853
|
+
const existing = asObjectRecord(
|
|
3854
|
+
asObjectRecord(readJsonFile(path4.join(process.cwd(), ".mcp.json"))).mcpServers
|
|
3855
|
+
)["snipara-local"];
|
|
3859
3856
|
if (isManagedNativeServer(existing)) {
|
|
3860
3857
|
const selected = existing;
|
|
3861
|
-
if (!validManagedBootstrap(selected, manifest))
|
|
3858
|
+
if (!validManagedBootstrap(selected, manifest))
|
|
3859
|
+
throw new Error(
|
|
3860
|
+
"Existing managed bootstrap differs from its retained bundle; configuration was preserved"
|
|
3861
|
+
);
|
|
3862
3862
|
return selected;
|
|
3863
3863
|
}
|
|
3864
3864
|
return {
|
|
3865
3865
|
type: "stdio",
|
|
3866
3866
|
command: process.execPath,
|
|
3867
|
-
args: [
|
|
3867
|
+
args: [
|
|
3868
|
+
manifest.components.companion.command,
|
|
3869
|
+
"toolchain",
|
|
3870
|
+
"mcp",
|
|
3871
|
+
"--workspace-root",
|
|
3872
|
+
observeSource(fs4.realpathSync(process.cwd())).root
|
|
3873
|
+
]
|
|
3868
3874
|
};
|
|
3869
3875
|
}
|
|
3870
3876
|
function hasLocalWorkSelection() {
|
|
3871
|
-
const native = asObjectRecord(
|
|
3877
|
+
const native = asObjectRecord(
|
|
3878
|
+
asObjectRecord(readJsonFile(path4.join(process.cwd(), ".mcp.json"))).mcpServers
|
|
3879
|
+
)["snipara-local"];
|
|
3872
3880
|
const activation = asObjectRecord(readJsonFile(getStableActivationManifestPath()));
|
|
3873
3881
|
return isManagedNativeServer(native) || activation.profile === "local-work";
|
|
3874
3882
|
}
|
|
@@ -3884,21 +3892,39 @@ function managedSetupOnly(answers) {
|
|
|
3884
3892
|
return answers.profile === "local-work" && (!answers.connectContext || hasBoundLocalWorkSource(answers.profile));
|
|
3885
3893
|
}
|
|
3886
3894
|
async function finishManagedLocalWork(answers, json = false) {
|
|
3887
|
-
sourceConnectionObservation = {
|
|
3895
|
+
sourceConnectionObservation = {
|
|
3896
|
+
workspace: fs4.realpathSync(process.cwd()),
|
|
3897
|
+
source: detectSourceConnection(process.cwd())
|
|
3898
|
+
};
|
|
3888
3899
|
await createAgentTemplates(answers);
|
|
3889
3900
|
const report = await runValidation({ ...answers, apiKeyType: "none" }, false);
|
|
3890
3901
|
writeDoctorReport(report);
|
|
3891
3902
|
printDoctorReport(detectEnvironment(), report);
|
|
3892
3903
|
const existingSource = hasBoundLocalWorkSource(answers.profile);
|
|
3893
|
-
console.log(
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3904
|
+
console.log(
|
|
3905
|
+
chalk.green(
|
|
3906
|
+
existingSource ? "Local work prepared. Existing repository context is reused automatically when its connection is authorized." : "Local work prepared. An account or hosted context connection is optional."
|
|
3907
|
+
)
|
|
3908
|
+
);
|
|
3909
|
+
if (json)
|
|
3910
|
+
console.log(
|
|
3911
|
+
JSON.stringify(
|
|
3912
|
+
{
|
|
3913
|
+
ok: true,
|
|
3914
|
+
profile: "local-work",
|
|
3915
|
+
localWork: { prepared: true },
|
|
3916
|
+
context: {
|
|
3917
|
+
configured: existingSource,
|
|
3918
|
+
authorized: null,
|
|
3919
|
+
mode: existingSource ? "existing_source" : "local_only"
|
|
3920
|
+
},
|
|
3921
|
+
activationObserved: false,
|
|
3922
|
+
validation: report
|
|
3923
|
+
},
|
|
3924
|
+
null,
|
|
3925
|
+
2
|
|
3926
|
+
)
|
|
3927
|
+
);
|
|
3902
3928
|
}
|
|
3903
3929
|
async function createMcpConfig(answers) {
|
|
3904
3930
|
console.log(chalk.bold("\n\u2699\uFE0F Creating Configuration\n"));
|
|
@@ -3910,7 +3936,8 @@ async function createMcpConfig(answers) {
|
|
|
3910
3936
|
mcpConfig = JSON.parse(fs4.readFileSync(mcpConfigPath, "utf-8"));
|
|
3911
3937
|
console.log(chalk.dim(" Found existing .mcp.json, merging..."));
|
|
3912
3938
|
} catch {
|
|
3913
|
-
if (answers.profile === "local-work")
|
|
3939
|
+
if (answers.profile === "local-work")
|
|
3940
|
+
throw new Error("Existing .mcp.json changed or became invalid; configuration preserved");
|
|
3914
3941
|
console.log(chalk.yellow(" Could not parse existing .mcp.json, creating new..."));
|
|
3915
3942
|
}
|
|
3916
3943
|
}
|
|
@@ -4015,7 +4042,11 @@ async function createClaudeCodeConfig(answers) {
|
|
|
4015
4042
|
return;
|
|
4016
4043
|
}
|
|
4017
4044
|
if (managedSetupOnly(answers)) {
|
|
4018
|
-
console.log(
|
|
4045
|
+
console.log(
|
|
4046
|
+
chalk.green(
|
|
4047
|
+
" Local connection prepared in .mcp.json; reload and approve it in Claude Code."
|
|
4048
|
+
)
|
|
4049
|
+
);
|
|
4019
4050
|
return;
|
|
4020
4051
|
}
|
|
4021
4052
|
console.log(chalk.bold("\n\u{1F916} Claude Code MCP\n"));
|
|
@@ -4127,7 +4158,11 @@ async function createAgentTemplates(answers) {
|
|
|
4127
4158
|
configureManagedCodex(answers);
|
|
4128
4159
|
} else {
|
|
4129
4160
|
fs4.mkdirSync(codexDir, { recursive: true });
|
|
4130
|
-
writeIfMissing(
|
|
4161
|
+
writeIfMissing(
|
|
4162
|
+
path4.join(codexDir, "config.toml"),
|
|
4163
|
+
buildCodexConfigTemplate(answers),
|
|
4164
|
+
".codex/config.toml"
|
|
4165
|
+
);
|
|
4131
4166
|
}
|
|
4132
4167
|
if (answers.aiClient === "mistral") {
|
|
4133
4168
|
const vibeDir = path4.join(process.cwd(), ".vibe");
|
|
@@ -4142,14 +4177,23 @@ async function createAgentTemplates(answers) {
|
|
|
4142
4177
|
}
|
|
4143
4178
|
function configureManagedCodex(answers) {
|
|
4144
4179
|
const manifest = answers.managedToolchain ?? managedToolchainStatus().manifest;
|
|
4145
|
-
if (!manifest)
|
|
4180
|
+
if (!manifest)
|
|
4181
|
+
throw new Error("The managed local-work bundle must be prepared before configuring Codex");
|
|
4146
4182
|
const native = managedNativeServer(answers);
|
|
4147
4183
|
mergeManagedCodexConfig({
|
|
4148
4184
|
file: path4.join(process.cwd(), ".codex/config.toml"),
|
|
4149
4185
|
python: path4.join(manifest.root, "python/bin/python"),
|
|
4150
|
-
server: {
|
|
4186
|
+
server: {
|
|
4187
|
+
command: native.command,
|
|
4188
|
+
args: native.args,
|
|
4189
|
+
...native.env ? { env: native.env } : {}
|
|
4190
|
+
},
|
|
4151
4191
|
initialContent: buildCodexHostedConfigTemplate(answers),
|
|
4152
|
-
env: {
|
|
4192
|
+
env: {
|
|
4193
|
+
PATH: path4.dirname(process.execPath) + path4.delimiter + "/usr/bin:/bin",
|
|
4194
|
+
HOME: path4.join(manifest.root, "home"),
|
|
4195
|
+
PYTHONNOUSERSITE: "1"
|
|
4196
|
+
},
|
|
4153
4197
|
validateExisting: (server) => validManagedBootstrap({ type: "stdio", ...server }, manifest)
|
|
4154
4198
|
});
|
|
4155
4199
|
}
|
|
@@ -4893,7 +4937,9 @@ async function createClaudeDesktopConfig(answers) {
|
|
|
4893
4937
|
config = JSON.parse(fs4.readFileSync(configPath, "utf-8"));
|
|
4894
4938
|
}
|
|
4895
4939
|
config.mcpServers = config.mcpServers || {};
|
|
4896
|
-
if (!(answers.profile === "local-work" && (managedSetupOnly(answers) || config.mcpServers["snipara-repository"] || asObjectRecord(
|
|
4940
|
+
if (!(answers.profile === "local-work" && (managedSetupOnly(answers) || config.mcpServers["snipara-repository"] || asObjectRecord(
|
|
4941
|
+
asObjectRecord(readJsonFile(path4.join(process.cwd(), ".mcp.json"))).mcpServers
|
|
4942
|
+
)["snipara-repository"])))
|
|
4897
4943
|
config.mcpServers.snipara = buildHostedMcpServer(answers);
|
|
4898
4944
|
if (answers.profile === "local-work") {
|
|
4899
4945
|
config.mcpServers["snipara-local"] = managedNativeServer(answers);
|
|
@@ -5648,11 +5694,6 @@ function getCompanionCommands(answers) {
|
|
|
5648
5694
|
command: `${COMPANION_NPX_COMMAND} code impact --changed-files src/api/webhooks.ts tests/webhooks.test.ts --diff-summary "webhook retry hardening"`,
|
|
5649
5695
|
purpose: "Use code impact analysis within plan capacity to surface likely tests, docs, routes, config, and risks."
|
|
5650
5696
|
},
|
|
5651
|
-
{
|
|
5652
|
-
title: answers.installOrchestrator ? "Run an explicit production orchestration gate" : "Enable explicit production orchestration",
|
|
5653
|
-
command: answers.installOrchestrator ? `${ORCHESTRATOR_COMMAND_NAME} check-drift --route /api/health` : `${CREATE_SNIPARA_NPX_COMMAND} repair --with-orchestrator`,
|
|
5654
|
-
purpose: answers.installOrchestrator ? "Use snipara-orchestrator only for proof-based validation, drift checks, or multi-agent coordination." : "Install snipara-orchestrator only when production gates, drift checks, or multi-agent coordination are required."
|
|
5655
|
-
},
|
|
5656
5697
|
githubAnswerPacksCommand,
|
|
5657
5698
|
{
|
|
5658
5699
|
title: "Upload or refresh a doc",
|
|
@@ -5870,7 +5911,6 @@ The activation doctrine is: one shared activation engine, multiple entry points.
|
|
|
5870
5911
|
- Generated ${deploymentLabel} MCP config: \`${answers.profile !== "runtime-only" ? "yes" : "no"}\`
|
|
5871
5912
|
- Installed local snipara-mcp package: \`${answers.installMcp ? "yes" : "no"}\`
|
|
5872
5913
|
- Installed Snipara Sandbox: \`${answers.installRuntime ? "yes" : "no"}\`
|
|
5873
|
-
- Installed Snipara Orchestrator: \`${answers.installOrchestrator ? "yes" : "no"}\`
|
|
5874
5914
|
- Generated hooks: \`${answers.installHooks ? "yes" : "no"}\`
|
|
5875
5915
|
- GitHub repository: \`${answers.githubRepo ? answers.githubRepo.fullName : "not-detected"}\`
|
|
5876
5916
|
|
|
@@ -5881,7 +5921,6 @@ The activation doctrine is: one shared activation engine, multiple entry points.
|
|
|
5881
5921
|
- .env.local present: \`${detection.files.envLocal ? "yes" : "no"}\`
|
|
5882
5922
|
- Companion CLI on PATH: \`${detection.tooling.companionCli ? "yes" : "no"}\`
|
|
5883
5923
|
- Snipara Sandbox CLI on PATH: \`${detection.tooling.runtimeCli ? "yes" : "no"}\`
|
|
5884
|
-
- Snipara Orchestrator CLI on PATH: \`${detection.tooling.orchestratorCli ? "yes" : "no"}\`
|
|
5885
5924
|
|
|
5886
5925
|
## Client Guidance
|
|
5887
5926
|
|
|
@@ -5991,7 +6030,6 @@ ${item.purpose}`
|
|
|
5991
6030
|
ai_client: answers.aiClient,
|
|
5992
6031
|
profile: answers.profile,
|
|
5993
6032
|
llm_provider: answers.llmProvider || null,
|
|
5994
|
-
install_orchestrator: answers.installOrchestrator,
|
|
5995
6033
|
github_repository: answers.githubRepo || null,
|
|
5996
6034
|
github_automation_url: answers.githubRepo ? buildGitHubAutomationUrl(answers) : null,
|
|
5997
6035
|
client_pack: clientPackFilename,
|
|
@@ -6236,9 +6274,14 @@ async function runValidation(answers, includeHostedCheck, options = {}) {
|
|
|
6236
6274
|
answers.managedToolchain = managed.manifest;
|
|
6237
6275
|
detection.tooling.companionCli = true;
|
|
6238
6276
|
detection.tooling.runtimeCli = true;
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6277
|
+
checks.push({
|
|
6278
|
+
name: "managed_toolchain",
|
|
6279
|
+
status: "pass",
|
|
6280
|
+
detail: `Private compatible bundle ${managed.manifest.bundleId}; installation is not project activation`
|
|
6281
|
+
});
|
|
6282
|
+
const native = asObjectRecord(
|
|
6283
|
+
asObjectRecord(readJsonFile(path4.join(process.cwd(), ".mcp.json"))).mcpServers
|
|
6284
|
+
)["snipara-local"];
|
|
6242
6285
|
checks.push({
|
|
6243
6286
|
name: "managed_native_config",
|
|
6244
6287
|
status: isManagedNativeServer(native) && validManagedBootstrap(native, managed.manifest) ? "pass" : "fail",
|
|
@@ -6247,8 +6290,11 @@ async function runValidation(answers, includeHostedCheck, options = {}) {
|
|
|
6247
6290
|
} catch {
|
|
6248
6291
|
detection.tooling.companionCli = false;
|
|
6249
6292
|
detection.tooling.runtimeCli = false;
|
|
6250
|
-
|
|
6251
|
-
|
|
6293
|
+
checks.push({
|
|
6294
|
+
name: "managed_toolchain",
|
|
6295
|
+
status: "fail",
|
|
6296
|
+
detail: "Managed bundle is absent, changed or incompatible; existing state was preserved"
|
|
6297
|
+
});
|
|
6252
6298
|
}
|
|
6253
6299
|
}
|
|
6254
6300
|
const targetClient = options.client || answers.aiClient;
|
|
@@ -6288,11 +6334,6 @@ async function runValidation(answers, includeHostedCheck, options = {}) {
|
|
|
6288
6334
|
status: answers.installRuntime ? detection.tooling.runtimeCli ? "pass" : "warn" : "pass",
|
|
6289
6335
|
detail: answers.installRuntime && !detection.tooling.runtimeCli ? `${SANDBOX_COMMAND_NAME} CLI not found on PATH` : "Snipara Sandbox CLI ready or not requested"
|
|
6290
6336
|
});
|
|
6291
|
-
checks.push({
|
|
6292
|
-
name: "orchestrator_cli",
|
|
6293
|
-
status: answers.installOrchestrator ? detection.tooling.orchestratorCli ? "pass" : "warn" : "pass",
|
|
6294
|
-
detail: answers.installOrchestrator && !detection.tooling.orchestratorCli ? `${ORCHESTRATOR_COMMAND_NAME} CLI not found on PATH` : "Snipara Orchestrator ready or not requested"
|
|
6295
|
-
});
|
|
6296
6337
|
checks.push({
|
|
6297
6338
|
name: "companion_pack",
|
|
6298
6339
|
status: detection.files.sniparaCompanionPack ? "pass" : "warn",
|
|
@@ -6325,7 +6366,11 @@ async function runValidation(answers, includeHostedCheck, options = {}) {
|
|
|
6325
6366
|
detail: answers.installHooks && targetClient === "claude-code" ? detection.files.claudeProjectSettings ? "Project .claude/settings.json hooks present" : "Project .claude/settings.json hooks missing" : "Hooks not requested"
|
|
6326
6367
|
});
|
|
6327
6368
|
if (managedSetupOnly(answers)) {
|
|
6328
|
-
checks.push({
|
|
6369
|
+
checks.push({
|
|
6370
|
+
name: "repository_context",
|
|
6371
|
+
status: "pass",
|
|
6372
|
+
detail: hasBoundLocalWorkSource(answers.profile) ? "Existing source connection preserved; authorization is observed by its native broker" : "Optional project context is not configured; local work needs no account"
|
|
6373
|
+
});
|
|
6329
6374
|
} else if (targetClient === "claude-code" || targetClient === "claude-desktop") {
|
|
6330
6375
|
checks.push(...getClaudeClientChecks(effectiveAnswers, detection));
|
|
6331
6376
|
}
|
|
@@ -6339,7 +6384,11 @@ async function runValidation(answers, includeHostedCheck, options = {}) {
|
|
|
6339
6384
|
detail: answers.configureGitHub ? `GitHub App setup link generated for ${githubRepo?.fullName || "detected repo"}; PR Answer Packs are enabled after browser approval` : githubRepo ? `GitHub repo ${githubRepo.fullName} detected; run ${CREATE_SNIPARA_NPX_COMMAND} --github to connect PR Answer Packs` : "No GitHub repo detected; PR Answer Packs require the GitHub App setup path"
|
|
6340
6385
|
});
|
|
6341
6386
|
if (includeHostedCheck && managedSetupOnly(answers)) {
|
|
6342
|
-
checks.push({
|
|
6387
|
+
checks.push({
|
|
6388
|
+
name: "hosted_connection",
|
|
6389
|
+
status: "pass",
|
|
6390
|
+
detail: hasBoundLocalWorkSource(answers.profile) ? "Existing native broker automatically reuses authorized project context; authorization was not probed by setup" : "No hosted connection is required for local work"
|
|
6391
|
+
});
|
|
6343
6392
|
} else if (includeHostedCheck && answers.apiKeyType !== "none" && !answers.apiKey.includes("YOUR_")) {
|
|
6344
6393
|
checks.push(...await testHostedConnection(answers));
|
|
6345
6394
|
} else if (includeHostedCheck) {
|
|
@@ -6366,11 +6415,12 @@ function writeDoctorReport(report) {
|
|
|
6366
6415
|
console.log(chalk.green(" \u2713 Wrote .snipara/companion/doctor.json"));
|
|
6367
6416
|
}
|
|
6368
6417
|
function getCodexConfigCheck(answers) {
|
|
6369
|
-
if (managedSetupOnly(answers))
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6418
|
+
if (managedSetupOnly(answers))
|
|
6419
|
+
return {
|
|
6420
|
+
name: "codex_config",
|
|
6421
|
+
status: "warn",
|
|
6422
|
+
detail: "Managed local launcher is configured; restart Codex and observe connection status. Optional context authorization remains separate"
|
|
6423
|
+
};
|
|
6374
6424
|
const candidates = [
|
|
6375
6425
|
{
|
|
6376
6426
|
label: ".codex/config.toml",
|
|
@@ -6842,8 +6892,7 @@ function detectEnvironment(managed = hasLocalWorkSelection()) {
|
|
|
6842
6892
|
docker: (managed ? executableOnPath : commandExists)("docker"),
|
|
6843
6893
|
git: (managed ? executableOnPath : commandExists)("git"),
|
|
6844
6894
|
companionCli: managed ? false : Boolean(detectCompanionCommand()),
|
|
6845
|
-
runtimeCli: managed ? false : Boolean(detectSandboxCommand())
|
|
6846
|
-
orchestratorCli: managed ? false : Boolean(detectOrchestratorCommand())
|
|
6895
|
+
runtimeCli: managed ? false : Boolean(detectSandboxCommand())
|
|
6847
6896
|
},
|
|
6848
6897
|
existingConfig: {
|
|
6849
6898
|
slug: existingConfig?.slug,
|
|
@@ -6880,7 +6929,6 @@ function loadExistingAnswers(options) {
|
|
|
6880
6929
|
skipCompanion: effectiveProfile === "local-work" ? false : options.withCompanion === true ? false : !detection.tooling.companionCli && effectiveProfile !== "hosted-companion" && effectiveProfile !== "full-stack",
|
|
6881
6930
|
skipMcp: options.withMcp === true ? false : !detection.existingConfig.hasSniparaServer && effectiveProfile === "runtime-only",
|
|
6882
6931
|
skipRuntime: effectiveProfile === "local-work" ? false : options.withRuntime === true ? false : !detection.existingConfig.hasRuntimeServer && effectiveProfile !== "full-stack" && effectiveProfile !== "runtime-only",
|
|
6883
|
-
withOrchestrator: Boolean(options.withOrchestrator || detection.tooling.orchestratorCli),
|
|
6884
6932
|
skipHooks: options.withHooks ? false : !shouldInstallDefaultHooks(detection.aiClient)
|
|
6885
6933
|
});
|
|
6886
6934
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** Shared data contract only. Filesystem trust and execution belong to consumers. */
|
|
2
2
|
declare const MANAGED_TOOLCHAIN_VERSION: "snipara.toolchain.v1";
|
|
3
|
-
declare const MANAGED_TOOLCHAIN_COMPONENTS: readonly ["companion", "
|
|
4
|
-
|
|
3
|
+
declare const MANAGED_TOOLCHAIN_COMPONENTS: readonly ["companion", "sandbox"];
|
|
4
|
+
/** Retired components: checked when an older bundle still declares one, never required, never run. */
|
|
5
|
+
declare const MANAGED_TOOLCHAIN_RETIRED_COMPONENTS: readonly ["orchestrator"];
|
|
6
|
+
type ManagedToolchainComponentName = (typeof MANAGED_TOOLCHAIN_COMPONENTS)[number];
|
|
7
|
+
type ManagedToolchainRetiredComponentName = (typeof MANAGED_TOOLCHAIN_RETIRED_COMPONENTS)[number];
|
|
5
8
|
interface ManagedToolchainComponent {
|
|
6
9
|
version: string;
|
|
7
10
|
command: string;
|
|
@@ -11,7 +14,7 @@ interface ManagedToolchainManifest {
|
|
|
11
14
|
schemaVersion: typeof MANAGED_TOOLCHAIN_VERSION;
|
|
12
15
|
bundleId: string;
|
|
13
16
|
root: string;
|
|
14
|
-
components: Record<ManagedToolchainComponentName, ManagedToolchainComponent
|
|
17
|
+
components: Record<ManagedToolchainComponentName, ManagedToolchainComponent> & Partial<Record<ManagedToolchainRetiredComponentName, ManagedToolchainComponent>>;
|
|
15
18
|
contracts: {
|
|
16
19
|
taskReference: 1;
|
|
17
20
|
validation: 1;
|
|
@@ -21,7 +24,6 @@ interface ManagedToolchainManifest {
|
|
|
21
24
|
|
|
22
25
|
declare const MANAGED_VERSIONS: Readonly<{
|
|
23
26
|
companion: string;
|
|
24
|
-
orchestrator: string;
|
|
25
27
|
sandbox: string;
|
|
26
28
|
}>;
|
|
27
29
|
declare function assertManagedRuntimeVersions(nodeVersion: string, pythonVersion: string): void;
|
|
@@ -95,7 +95,8 @@ import { createHash as createHash4 } from "crypto";
|
|
|
95
95
|
|
|
96
96
|
// ../project-intelligence-contracts/src/managed-toolchain.ts
|
|
97
97
|
var MANAGED_TOOLCHAIN_VERSION = "snipara.toolchain.v1";
|
|
98
|
-
var MANAGED_TOOLCHAIN_COMPONENTS = ["companion", "
|
|
98
|
+
var MANAGED_TOOLCHAIN_COMPONENTS = ["companion", "sandbox"];
|
|
99
|
+
var MANAGED_TOOLCHAIN_RETIRED_COMPONENTS = ["orchestrator"];
|
|
99
100
|
var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
100
101
|
var bounded = (value, max) => typeof value === "string" && value.length > 0 && value.length <= max && !Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127);
|
|
101
102
|
function canonicalAbsolute(value) {
|
|
@@ -107,12 +108,18 @@ function parseManagedToolchainManifest(value) {
|
|
|
107
108
|
}
|
|
108
109
|
const root = value.root;
|
|
109
110
|
const components = {};
|
|
110
|
-
for (const name of MANAGED_TOOLCHAIN_COMPONENTS) {
|
|
111
|
+
for (const name of [...MANAGED_TOOLCHAIN_COMPONENTS, ...MANAGED_TOOLCHAIN_RETIRED_COMPONENTS]) {
|
|
111
112
|
const component = value.components[name];
|
|
113
|
+
if (component === void 0 && MANAGED_TOOLCHAIN_RETIRED_COMPONENTS.includes(name))
|
|
114
|
+
continue;
|
|
112
115
|
if (!object(component) || !bounded(component.version, 64) || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(component.version) || !canonicalAbsolute(component.command) || !component.command.startsWith(root + "/") || typeof component.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(component.sha256)) {
|
|
113
116
|
throw new Error("Invalid managed component identity");
|
|
114
117
|
}
|
|
115
|
-
components[name] = {
|
|
118
|
+
components[name] = {
|
|
119
|
+
version: component.version,
|
|
120
|
+
command: component.command,
|
|
121
|
+
sha256: component.sha256
|
|
122
|
+
};
|
|
116
123
|
}
|
|
117
124
|
return {
|
|
118
125
|
schemaVersion: MANAGED_TOOLCHAIN_VERSION,
|
|
@@ -126,9 +133,8 @@ function parseManagedToolchainManifest(value) {
|
|
|
126
133
|
|
|
127
134
|
// src/managed-versions.json
|
|
128
135
|
var managed_versions_default = {
|
|
129
|
-
companion: "
|
|
130
|
-
|
|
131
|
-
sandbox: "3.3.0"
|
|
136
|
+
companion: "8.0.0",
|
|
137
|
+
sandbox: "3.4.0"
|
|
132
138
|
};
|
|
133
139
|
|
|
134
140
|
// src/managed-toolchain.ts
|
|
@@ -482,7 +488,7 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
482
488
|
prior = null;
|
|
483
489
|
}
|
|
484
490
|
}
|
|
485
|
-
const bundleId = `bundle-${MANAGED_VERSIONS.companion}-${MANAGED_VERSIONS.
|
|
491
|
+
const bundleId = `bundle-${MANAGED_VERSIONS.companion}-${MANAGED_VERSIONS.sandbox}-${randomUUID2()}`;
|
|
486
492
|
const root = path.join(base, bundleId);
|
|
487
493
|
fs.mkdirSync(root, { mode: 448 });
|
|
488
494
|
for (const directory of ["home", "tmp"])
|
|
@@ -510,8 +516,7 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
510
516
|
"install",
|
|
511
517
|
"--no-input",
|
|
512
518
|
"--disable-pip-version-check",
|
|
513
|
-
"snipara-sandbox[validation,mcp]==" + MANAGED_VERSIONS.sandbox
|
|
514
|
-
"snipara-orchestrator==" + MANAGED_VERSIONS.orchestrator
|
|
519
|
+
"snipara-sandbox[validation,mcp]==" + MANAGED_VERSIONS.sandbox
|
|
515
520
|
]);
|
|
516
521
|
await run(npm, [
|
|
517
522
|
"install",
|
|
@@ -533,11 +538,6 @@ async function prepareManagedToolchain(options = {}) {
|
|
|
533
538
|
command: fs.realpathSync(path.join(prefix, "node_modules/.bin/snipara-companion")),
|
|
534
539
|
sha256: ""
|
|
535
540
|
},
|
|
536
|
-
orchestrator: {
|
|
537
|
-
version: MANAGED_VERSIONS.orchestrator,
|
|
538
|
-
command: path.join(venv, "bin/snipara-orchestrator"),
|
|
539
|
-
sha256: ""
|
|
540
|
-
},
|
|
541
541
|
sandbox: {
|
|
542
542
|
version: MANAGED_VERSIONS.sandbox,
|
|
543
543
|
command: path.join(venv, "bin/snipara-sandbox"),
|