@sibyllinesoft/smith-installer 0.1.1
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/agents.md +109 -0
- package/dist/agents.d.ts +9 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +42 -0
- package/dist/agents.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +301 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +49 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +265 -0
- package/dist/lib.js.map +1 -0
- package/package.json +51 -0
- package/skills/build-client/SKILL.md +49 -0
- package/skills/choose-deployment/SKILL.md +48 -0
- package/skills/configure-agentd/SKILL.md +74 -0
- package/skills/configure-policy/SKILL.md +134 -0
- package/skills/detect-system/SKILL.md +69 -0
- package/skills/generate-certs/SKILL.md +54 -0
- package/skills/generate-pairing-code/SKILL.md +87 -0
- package/skills/install-agentd/SKILL.md +46 -0
- package/skills/install-runtime/SKILL.md +49 -0
- package/skills/preflight/SKILL.md +86 -0
- package/skills/setup-activitywatch/SKILL.md +44 -0
- package/skills/setup-chat-bridge/SKILL.md +289 -0
- package/skills/start-agentd/SKILL.md +55 -0
- package/skills/start-chat-bridge/SKILL.md +109 -0
- package/skills/start-stack/SKILL.md +56 -0
- package/skills/verify/SKILL.md +53 -0
package/agents.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Smith Core Installer & Configuration Agent
|
|
2
|
+
|
|
3
|
+
You are the Smith Core installer and configuration agent. Your job is to bootstrap a local `smith-core` development environment, verify that it is operational, and configure runtime policy settings.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
- Use repository-native commands. Do not assume external bootstrap scripts exist.
|
|
8
|
+
- Prefer safe, reversible actions. Ask before destructive operations unless `--force` is explicit.
|
|
9
|
+
- Keep output transparent. Explain each command before running it.
|
|
10
|
+
- Diagnose failures with logs and command output, then retry only the failed step.
|
|
11
|
+
- Favor idempotent behavior. Re-running install steps should be safe.
|
|
12
|
+
- Emit loud non-blocking security warnings when defaults are weak or when private-network controls (VPN/tunnel) are not configured.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
Run these phases in order unless the user asks for a specific step:
|
|
17
|
+
|
|
18
|
+
1. `infra` — start Docker infrastructure.
|
|
19
|
+
2. `build` — compile Rust workspaces.
|
|
20
|
+
3. `npm` — install Node workspace dependencies.
|
|
21
|
+
4. `verify` — run lightweight build checks and tunnel e2e checks when configured.
|
|
22
|
+
5. `configure-agentd` — ensure `.env` defaults are present and, on macOS, enable Gondolin VM pool settings.
|
|
23
|
+
6. `configure-policy` — inspect and configure OPA security policies, tool-access rules, and security profiles.
|
|
24
|
+
7. `chat` — configure chat platform bridges, start the daemon and gateways, and optionally generate a pairing code.
|
|
25
|
+
|
|
26
|
+
Step aliases accepted by CLI:
|
|
27
|
+
- `25` -> `npm`
|
|
28
|
+
- `30` -> `infra`
|
|
29
|
+
- `40` -> `build`
|
|
30
|
+
- `90` -> `verify`
|
|
31
|
+
- `policy` -> `configure-policy`
|
|
32
|
+
- `chat` -> `setup-chat-bridge`, `start-chat-bridge`, `generate-pairing-code`
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
Use commands from the repository root:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# baseline env defaults
|
|
40
|
+
cp -n .env.example .env || true
|
|
41
|
+
|
|
42
|
+
# macOS Gondolin defaults (required for persistent VM sandbox sessions)
|
|
43
|
+
if [ "$(uname -s)" = "Darwin" ]; then
|
|
44
|
+
command -v gondolin >/dev/null
|
|
45
|
+
# ensure these values exist in .env:
|
|
46
|
+
# SMITH_EXECUTOR_VM_POOL_ENABLED=true
|
|
47
|
+
# SMITH_EXECUTOR_VM_METHOD=gondolin
|
|
48
|
+
# SMITH_EXECUTOR_GONDOLIN_COMMAND=gondolin
|
|
49
|
+
# SMITH_EXECUTOR_GONDOLIN_ARGS=exec,--
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# infra
|
|
53
|
+
bash infra/envoy/certs/generate-certs.sh
|
|
54
|
+
docker compose up -d
|
|
55
|
+
docker compose ps
|
|
56
|
+
|
|
57
|
+
# build
|
|
58
|
+
cargo build --workspace
|
|
59
|
+
cargo build --manifest-path agent/agentd/Cargo.toml --features grpc --bin agentd
|
|
60
|
+
|
|
61
|
+
# npm
|
|
62
|
+
npm install
|
|
63
|
+
|
|
64
|
+
# verify
|
|
65
|
+
cargo check --workspace
|
|
66
|
+
cargo check --manifest-path agent/agentd/Cargo.toml --features grpc --bin agentd
|
|
67
|
+
npm run build --workspaces --if-present
|
|
68
|
+
|
|
69
|
+
# optional tunnel e2e checks when configured in .env
|
|
70
|
+
bash scripts/tunnel-e2e.sh cloudflare
|
|
71
|
+
bash scripts/tunnel-e2e.sh tailscale
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If `--force` is provided for `all` or `infra`, run:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
docker compose down
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
before bringing services back up.
|
|
81
|
+
|
|
82
|
+
## Decision Points
|
|
83
|
+
|
|
84
|
+
Ask the user before:
|
|
85
|
+
|
|
86
|
+
1. Pulling large dependencies over slow or metered networks.
|
|
87
|
+
2. Restarting infrastructure that may already be in use.
|
|
88
|
+
3. Running optional long checks not requested by the user.
|
|
89
|
+
|
|
90
|
+
## Validation Targets
|
|
91
|
+
|
|
92
|
+
Confirm these outcomes:
|
|
93
|
+
|
|
94
|
+
- `docker compose ps` shows key services running (`nats`, `postgres`, `envoy`, `mcp-index`).
|
|
95
|
+
- Rust build/check commands complete successfully.
|
|
96
|
+
- Node workspace build succeeds.
|
|
97
|
+
- Any warnings or non-blocking issues are reported clearly.
|
|
98
|
+
- Security posture warnings are surfaced when default secrets are present or private-network indicators are missing.
|
|
99
|
+
- OPA server healthy and policies loaded from PostgreSQL (when policy step is run).
|
|
100
|
+
|
|
101
|
+
## Failure Recovery
|
|
102
|
+
|
|
103
|
+
When a step fails:
|
|
104
|
+
|
|
105
|
+
1. Capture stderr and exit code.
|
|
106
|
+
2. Identify likely cause (missing dependency, port conflict, auth, resource limits).
|
|
107
|
+
3. Apply the smallest viable fix.
|
|
108
|
+
4. Re-run only the failed command.
|
|
109
|
+
5. Summarize the root cause and the fix applied.
|
package/dist/agents.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import type { InstallerOptions } from "./lib.js";
|
|
3
|
+
export type { InstallerOptions };
|
|
4
|
+
export declare function createInstallerSession(opts: InstallerOptions): Promise<{
|
|
5
|
+
session: import("@mariozechner/pi-coding-agent").AgentSession;
|
|
6
|
+
authStorage: AuthStorage;
|
|
7
|
+
modelRegistry: ModelRegistry;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACX,aAAa,EAEd,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAKjC,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB;;;;GAqClE"}
|
package/dist/agents.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createAgentSession, DefaultResourceLoader, SessionManager, SettingsManager, AuthStorage, ModelRegistry, codingTools, } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { getModel } from "@mariozechner/pi-ai";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { join, dirname } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { buildSystemPrompt } from "./lib.js";
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const PKG_ROOT = join(__dirname, "..");
|
|
9
|
+
export async function createInstallerSession(opts) {
|
|
10
|
+
const authStorage = new AuthStorage();
|
|
11
|
+
const modelRegistry = new ModelRegistry(authStorage);
|
|
12
|
+
const agentsMd = readFileSync(join(PKG_ROOT, "agents.md"), "utf8");
|
|
13
|
+
const loader = new DefaultResourceLoader({
|
|
14
|
+
cwd: opts.smithRoot,
|
|
15
|
+
additionalSkillPaths: [join(PKG_ROOT, "skills")],
|
|
16
|
+
systemPromptOverride: () => buildSystemPrompt(opts),
|
|
17
|
+
agentsFilesOverride: (current) => ({
|
|
18
|
+
agentsFiles: [
|
|
19
|
+
...current.agentsFiles,
|
|
20
|
+
{ path: "/smith-installer/AGENTS.md", content: agentsMd },
|
|
21
|
+
],
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
await loader.reload();
|
|
25
|
+
const provider = opts.provider ?? "anthropic";
|
|
26
|
+
const modelId = opts.model ?? "claude-sonnet-4-20250514";
|
|
27
|
+
const { session } = await createAgentSession({
|
|
28
|
+
cwd: opts.smithRoot,
|
|
29
|
+
model: getModel(provider, modelId),
|
|
30
|
+
thinkingLevel: opts.thinkingLevel ?? "medium",
|
|
31
|
+
authStorage,
|
|
32
|
+
modelRegistry,
|
|
33
|
+
tools: codingTools,
|
|
34
|
+
resourceLoader: loader,
|
|
35
|
+
sessionManager: SessionManager.create(opts.smithRoot),
|
|
36
|
+
settingsManager: SettingsManager.inMemory({
|
|
37
|
+
compaction: { enabled: true },
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
return { session, authStorage, modelRegistry };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL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W;gBACtB,EAAE,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,QAAQ,EAAE;aAC1D;SACF,CAAC;KACH,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IAEtB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAK,WAAqB,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,0BAA0B,CAAC;IAEzD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC;QAC3C,GAAG,EAAE,IAAI,CAAC,SAAS;QACnB,KAAK,EAAG,QAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAChD,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,QAAQ;QAC7C,WAAW;QACX,aAAa;QACb,KAAK,EAAE,WAAW;QAClB,cAAc,EAAE,MAAM;QACtB,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QACrD,eAAe,EAAE,eAAe,CAAC,QAAQ,CAAC;YACxC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SAC9B,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { copyFileSync, existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { resolve, join } from "path";
|
|
4
|
+
import { execFileSync } from "child_process";
|
|
5
|
+
import { createInstallerSession } from "./agents.js";
|
|
6
|
+
import { parseArgs, findSmithRoot, evaluateInstallerSecurity } from "./lib.js";
|
|
7
|
+
function runCommand(cwd, spec) {
|
|
8
|
+
execFileSync(spec.command, spec.args, {
|
|
9
|
+
cwd,
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
env: process.env,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function ensureEnvFile(smithRoot) {
|
|
15
|
+
const envPath = join(smithRoot, ".env");
|
|
16
|
+
if (existsSync(envPath)) {
|
|
17
|
+
return envPath;
|
|
18
|
+
}
|
|
19
|
+
const examplePath = join(smithRoot, ".env.example");
|
|
20
|
+
if (!existsSync(examplePath)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
copyFileSync(examplePath, envPath);
|
|
24
|
+
console.log(`[installer] Created ${envPath} from .env.example`);
|
|
25
|
+
return envPath;
|
|
26
|
+
}
|
|
27
|
+
function parseEnvFile(path) {
|
|
28
|
+
const vars = {};
|
|
29
|
+
if (!existsSync(path)) {
|
|
30
|
+
return vars;
|
|
31
|
+
}
|
|
32
|
+
const content = readFileSync(path, "utf8");
|
|
33
|
+
for (const rawLine of content.split("\n")) {
|
|
34
|
+
const line = rawLine.trim();
|
|
35
|
+
if (!line || line.startsWith("#"))
|
|
36
|
+
continue;
|
|
37
|
+
const eq = line.indexOf("=");
|
|
38
|
+
if (eq <= 0)
|
|
39
|
+
continue;
|
|
40
|
+
const key = line.slice(0, eq).trim();
|
|
41
|
+
let value = line.slice(eq + 1).trim();
|
|
42
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
43
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
44
|
+
value = value.slice(1, -1);
|
|
45
|
+
}
|
|
46
|
+
vars[key] = value;
|
|
47
|
+
}
|
|
48
|
+
return vars;
|
|
49
|
+
}
|
|
50
|
+
function upsertEnvValue(path, key, value) {
|
|
51
|
+
const current = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
52
|
+
const lines = current.length > 0 ? current.split("\n") : [];
|
|
53
|
+
const rendered = `${key}=${value}`;
|
|
54
|
+
let replaced = false;
|
|
55
|
+
const updated = lines.map((line) => {
|
|
56
|
+
const trimmed = line.trim();
|
|
57
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
58
|
+
return line;
|
|
59
|
+
}
|
|
60
|
+
const eq = line.indexOf("=");
|
|
61
|
+
if (eq <= 0) {
|
|
62
|
+
return line;
|
|
63
|
+
}
|
|
64
|
+
const existingKey = line.slice(0, eq).trim();
|
|
65
|
+
if (existingKey !== key) {
|
|
66
|
+
return line;
|
|
67
|
+
}
|
|
68
|
+
replaced = true;
|
|
69
|
+
return rendered;
|
|
70
|
+
});
|
|
71
|
+
if (!replaced) {
|
|
72
|
+
if (updated.length > 0 && updated[updated.length - 1] !== "") {
|
|
73
|
+
updated.push("");
|
|
74
|
+
}
|
|
75
|
+
updated.push(rendered);
|
|
76
|
+
}
|
|
77
|
+
writeFileSync(path, `${updated.join("\n")}\n`);
|
|
78
|
+
}
|
|
79
|
+
function ensureMacOsGondolinDefaults(smithRoot) {
|
|
80
|
+
if (process.platform !== "darwin") {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const envPath = ensureEnvFile(smithRoot);
|
|
84
|
+
if (!envPath) {
|
|
85
|
+
console.warn("[installer] .env.example not found; skipping macOS Gondolin defaults.");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
execFileSync("gondolin", ["help"], { stdio: "ignore", env: process.env });
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
throw new Error("macOS setup requires 'gondolin' for sandboxed VM execution. Install Gondolin and rerun the installer.");
|
|
93
|
+
}
|
|
94
|
+
upsertEnvValue(envPath, "SMITH_EXECUTOR_VM_POOL_ENABLED", "true");
|
|
95
|
+
upsertEnvValue(envPath, "SMITH_EXECUTOR_VM_METHOD", "gondolin");
|
|
96
|
+
upsertEnvValue(envPath, "SMITH_EXECUTOR_GONDOLIN_COMMAND", "gondolin");
|
|
97
|
+
upsertEnvValue(envPath, "SMITH_EXECUTOR_GONDOLIN_ARGS", "exec,--");
|
|
98
|
+
console.log("[installer] macOS detected: enabled persistent VM pool and Gondolin defaults in .env");
|
|
99
|
+
}
|
|
100
|
+
function runOptionalTunnelE2E(smithRoot) {
|
|
101
|
+
const envPath = join(smithRoot, ".env");
|
|
102
|
+
if (!existsSync(envPath)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const vars = parseEnvFile(envPath);
|
|
106
|
+
const providers = [];
|
|
107
|
+
const hasCloudflare = (vars.CLOUDFLARE_TUNNEL_E2E_URL ?? "").trim().length > 0 ||
|
|
108
|
+
(vars.CLOUDFLARE_TUNNEL_HOSTNAME ?? "").trim().length > 0;
|
|
109
|
+
const hasTailscale = (vars.TAILSCALE_TUNNEL_E2E_URL ?? "").trim().length > 0;
|
|
110
|
+
if (hasCloudflare) {
|
|
111
|
+
providers.push("cloudflare");
|
|
112
|
+
}
|
|
113
|
+
if (hasTailscale) {
|
|
114
|
+
providers.push("tailscale");
|
|
115
|
+
}
|
|
116
|
+
if (providers.length === 0) {
|
|
117
|
+
console.log("[installer] Skipping tunnel e2e checks: no CLOUDFLARE/TAILSCALE tunnel e2e variables configured in .env");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
for (const provider of providers) {
|
|
121
|
+
console.log(`[installer] Running tunnel e2e check for ${provider}`);
|
|
122
|
+
runCommand(smithRoot, {
|
|
123
|
+
command: "bash",
|
|
124
|
+
args: ["scripts/tunnel-e2e.sh", provider],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function printSecurityWarnings(sourceFile, warnings) {
|
|
129
|
+
if (warnings.length === 0)
|
|
130
|
+
return;
|
|
131
|
+
const sourceLabel = sourceFile ? ` (${sourceFile})` : "";
|
|
132
|
+
console.error(`\n[SECURITY WARNING] Installer detected ${warnings.length} warning(s)${sourceLabel}`);
|
|
133
|
+
for (const warning of warnings) {
|
|
134
|
+
console.error(`[SECURITY WARNING] ${warning.message}`);
|
|
135
|
+
console.error(`[SECURITY WARNING] Recommended action: ${warning.recommendation}`);
|
|
136
|
+
}
|
|
137
|
+
console.error("[SECURITY WARNING] This installer will continue, but deployment outside a private network is not recommended.");
|
|
138
|
+
}
|
|
139
|
+
function runNonInteractiveBootstrap(smithRoot, step, force) {
|
|
140
|
+
const normalizedStep = step?.toLowerCase() ?? "all";
|
|
141
|
+
const plans = {
|
|
142
|
+
all: [
|
|
143
|
+
{ command: "bash", args: ["infra/envoy/certs/generate-certs.sh"] },
|
|
144
|
+
{ command: "docker", args: ["compose", "up", "-d"] },
|
|
145
|
+
{ command: "docker", args: ["compose", "ps"] },
|
|
146
|
+
{ command: "cargo", args: ["build", "--workspace"] },
|
|
147
|
+
{ command: "cargo", args: ["build", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
148
|
+
{ command: "npm", args: ["install"] },
|
|
149
|
+
{ command: "cargo", args: ["check", "--workspace"] },
|
|
150
|
+
{ command: "cargo", args: ["check", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
151
|
+
{ command: "npm", args: ["run", "build", "--workspaces", "--if-present"] },
|
|
152
|
+
],
|
|
153
|
+
infra: [
|
|
154
|
+
{ command: "bash", args: ["infra/envoy/certs/generate-certs.sh"] },
|
|
155
|
+
{ command: "docker", args: ["compose", "up", "-d"] },
|
|
156
|
+
{ command: "docker", args: ["compose", "ps"] },
|
|
157
|
+
],
|
|
158
|
+
build: [
|
|
159
|
+
{ command: "cargo", args: ["build", "--workspace"] },
|
|
160
|
+
{ command: "cargo", args: ["build", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
161
|
+
],
|
|
162
|
+
npm: [
|
|
163
|
+
{ command: "npm", args: ["install"] },
|
|
164
|
+
],
|
|
165
|
+
verify: [
|
|
166
|
+
{ command: "cargo", args: ["check", "--workspace"] },
|
|
167
|
+
{ command: "cargo", args: ["check", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
168
|
+
{ command: "npm", args: ["run", "build", "--workspaces", "--if-present"] },
|
|
169
|
+
],
|
|
170
|
+
"25": [
|
|
171
|
+
{ command: "npm", args: ["install"] },
|
|
172
|
+
],
|
|
173
|
+
"30": [
|
|
174
|
+
{ command: "bash", args: ["infra/envoy/certs/generate-certs.sh"] },
|
|
175
|
+
{ command: "docker", args: ["compose", "up", "-d"] },
|
|
176
|
+
{ command: "docker", args: ["compose", "ps"] },
|
|
177
|
+
],
|
|
178
|
+
"40": [
|
|
179
|
+
{ command: "cargo", args: ["build", "--workspace"] },
|
|
180
|
+
{ command: "cargo", args: ["build", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
181
|
+
],
|
|
182
|
+
"90": [
|
|
183
|
+
{ command: "cargo", args: ["check", "--workspace"] },
|
|
184
|
+
{ command: "cargo", args: ["check", "--manifest-path", "agent/agentd/Cargo.toml", "--features", "grpc", "--bin", "agentd"] },
|
|
185
|
+
{ command: "npm", args: ["run", "build", "--workspaces", "--if-present"] },
|
|
186
|
+
],
|
|
187
|
+
"configure-policy": [
|
|
188
|
+
{ command: "docker", args: ["compose", "exec", "-T", "postgres", "psql", "-U", "smith", "-d", "smith", "-c", "SELECT id, name, updated_at FROM opa_policies ORDER BY updated_at DESC;"] },
|
|
189
|
+
{ command: "docker", args: ["compose", "exec", "-T", "opa-management", "wget", "-qO-", "http://localhost:8181/health"] },
|
|
190
|
+
],
|
|
191
|
+
"policy": [
|
|
192
|
+
{ command: "docker", args: ["compose", "exec", "-T", "postgres", "psql", "-U", "smith", "-d", "smith", "-c", "SELECT id, name, updated_at FROM opa_policies ORDER BY updated_at DESC;"] },
|
|
193
|
+
{ command: "docker", args: ["compose", "exec", "-T", "opa-management", "wget", "-qO-", "http://localhost:8181/health"] },
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
const plan = plans[normalizedStep];
|
|
197
|
+
if (!plan) {
|
|
198
|
+
const valid = Object.keys(plans).join(", ");
|
|
199
|
+
throw new Error(`Unknown --step '${step}'. Valid values: ${valid}`);
|
|
200
|
+
}
|
|
201
|
+
if (force && (normalizedStep === "all" || normalizedStep === "infra" || normalizedStep === "30")) {
|
|
202
|
+
runCommand(smithRoot, { command: "docker", args: ["compose", "down"] });
|
|
203
|
+
}
|
|
204
|
+
for (const spec of plan) {
|
|
205
|
+
runCommand(smithRoot, spec);
|
|
206
|
+
}
|
|
207
|
+
if (normalizedStep === "all" || normalizedStep === "verify" || normalizedStep === "90") {
|
|
208
|
+
runOptionalTunnelE2E(smithRoot);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function printHelp() {
|
|
212
|
+
console.log(`smith-install — AI-guided Smith Core installer
|
|
213
|
+
|
|
214
|
+
Usage: smith-install [options]
|
|
215
|
+
|
|
216
|
+
Options:
|
|
217
|
+
--non-interactive Run bootstrap commands directly (no TUI)
|
|
218
|
+
--provider <name> LLM provider (default: anthropic)
|
|
219
|
+
--model <id> Model ID (default: claude-sonnet-4-20250514)
|
|
220
|
+
--thinking <level> Thinking level: none, low, medium, high (default: medium)
|
|
221
|
+
--step <name> Run one step: all, infra, build, npm, verify, policy (also accepts 25/30/40/90)
|
|
222
|
+
--force Recreate infrastructure before running infra/all
|
|
223
|
+
--repo <path> Path to smith-core repo root (auto-detected by default)
|
|
224
|
+
--help Show this help`);
|
|
225
|
+
}
|
|
226
|
+
async function main() {
|
|
227
|
+
let args;
|
|
228
|
+
try {
|
|
229
|
+
args = parseArgs(process.argv);
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
console.error(err.message);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
if (args.help) {
|
|
236
|
+
printHelp();
|
|
237
|
+
process.exit(0);
|
|
238
|
+
}
|
|
239
|
+
// Resolve smith-core repo root.
|
|
240
|
+
const smithRoot = args.repo
|
|
241
|
+
? resolve(args.repo)
|
|
242
|
+
: findSmithRoot(process.cwd());
|
|
243
|
+
if (!smithRoot || !existsSync(join(smithRoot, "justfile"))) {
|
|
244
|
+
console.error("Error: Could not find Smith Core repo root.\n" +
|
|
245
|
+
"Run from within the smith-core repo, or use --repo <path>.\n\n" +
|
|
246
|
+
"To clone the repo:\n" +
|
|
247
|
+
" git clone https://github.com/sibyllinesoft/smith-core.git\n" +
|
|
248
|
+
" cd smith-core && npx @sibyllinesoft/smith-installer");
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
ensureEnvFile(smithRoot);
|
|
252
|
+
ensureMacOsGondolinDefaults(smithRoot);
|
|
253
|
+
const securityReport = evaluateInstallerSecurity(smithRoot);
|
|
254
|
+
printSecurityWarnings(securityReport.sourceFile, securityReport.warnings);
|
|
255
|
+
// Non-interactive mode: run bootstrap commands directly.
|
|
256
|
+
if (args.nonInteractive) {
|
|
257
|
+
try {
|
|
258
|
+
runNonInteractiveBootstrap(smithRoot, args.step, args.force);
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
const err = e;
|
|
262
|
+
if (err.message) {
|
|
263
|
+
console.error(err.message);
|
|
264
|
+
}
|
|
265
|
+
process.exit(err.status ?? 1);
|
|
266
|
+
}
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
// Interactive mode: create pi-agent session
|
|
270
|
+
const { InteractiveMode, runPrintMode } = await import("@mariozechner/pi-coding-agent");
|
|
271
|
+
const { session } = await createInstallerSession({
|
|
272
|
+
smithRoot,
|
|
273
|
+
provider: args.provider,
|
|
274
|
+
model: args.model,
|
|
275
|
+
thinkingLevel: args.thinkingLevel,
|
|
276
|
+
step: args.step,
|
|
277
|
+
force: args.force,
|
|
278
|
+
securityWarnings: securityReport.warnings.map((w) => `${w.message} Recommended action: ${w.recommendation}`),
|
|
279
|
+
});
|
|
280
|
+
const configSteps = ["configure-policy", "policy"];
|
|
281
|
+
const isConfigStep = args.step && configSteps.includes(args.step.toLowerCase());
|
|
282
|
+
const initialMessage = isConfigStep
|
|
283
|
+
? `Inspect and configure OPA security policies for this smith-core environment (step '${args.step}'). Show current policy state and tool-access rules.`
|
|
284
|
+
: args.step
|
|
285
|
+
? `Bootstrap this smith-core environment and execute step '${args.step}'.`
|
|
286
|
+
: "Bootstrap this smith-core development environment. Ensure Docker services are up, Rust workspaces build, Node workspaces are installed, and report any fixes required.";
|
|
287
|
+
if (process.stdin.isTTY) {
|
|
288
|
+
// Interactive TUI with auto-start prompt.
|
|
289
|
+
const interactive = new InteractiveMode(session, { initialMessage });
|
|
290
|
+
await interactive.run();
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
// Piped input: run with a default prompt.
|
|
294
|
+
await runPrintMode(session, { mode: "text", initialMessage });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
main().catch((err) => {
|
|
298
|
+
console.error("Fatal error:", err);
|
|
299
|
+
process.exit(1);
|
|
300
|
+
});
|
|
301
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAQ/E,SAAS,UAAU,CAAC,GAAW,EAAE,IAAiB;IAChD,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE;QACpC,GAAG;QACH,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,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C,CAAC,OAAO,wBAAwB,CAAC,CAAC,cAAc,EAAE,CAC9D;KACF,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAEhF,MAAM,cAAc,GAAG,YAAY;QACjC,CAAC,CAAC,sFAAsF,IAAI,CAAC,IAAI,sDAAsD;QACvJ,CAAC,CAAC,IAAI,CAAC,IAAI;YACT,CAAC,CAAC,2DAA2D,IAAI,CAAC,IAAI,IAAI;YAC1E,CAAC,CAAC,wKAAwK,CAAC;IAE/K,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,0CAA0C;QAC1C,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACrE,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,0CAA0C;QAC1C,MAAM,YAAY,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createInstallerSession } from "./agents.js";
|
|
2
|
+
export type { InstallerOptions } from "./agents.js";
|
|
3
|
+
export { parseArgs, findSmithRoot, loadSkills, buildSystemPrompt, evaluateInstallerSecurity, } from "./lib.js";
|
|
4
|
+
export type { CliArgs, Skill, InstallerSecurityWarning, InstallerSecurityReport, } from "./lib.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,OAAO,EACP,KAAK,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,UAAU,CAAC"}
|
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { KnownProvider } from "@mariozechner/pi-ai";
|
|
2
|
+
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
|
|
3
|
+
export type { KnownProvider, ThinkingLevel };
|
|
4
|
+
export interface CliArgs {
|
|
5
|
+
nonInteractive: boolean;
|
|
6
|
+
provider: KnownProvider;
|
|
7
|
+
model: string;
|
|
8
|
+
thinkingLevel: ThinkingLevel;
|
|
9
|
+
step?: string;
|
|
10
|
+
force: boolean;
|
|
11
|
+
help: boolean;
|
|
12
|
+
repo?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface InstallerOptions {
|
|
15
|
+
/** Path to smith-core repo root */
|
|
16
|
+
smithRoot: string;
|
|
17
|
+
/** LLM provider (default: anthropic) */
|
|
18
|
+
provider?: KnownProvider;
|
|
19
|
+
/** Model ID (default: claude-sonnet-4-20250514) */
|
|
20
|
+
model?: string;
|
|
21
|
+
/** Thinking level (default: medium) */
|
|
22
|
+
thinkingLevel?: ThinkingLevel;
|
|
23
|
+
/** Single step prefix to run */
|
|
24
|
+
step?: string;
|
|
25
|
+
/** Ignore idempotency markers */
|
|
26
|
+
force?: boolean;
|
|
27
|
+
/** Non-blocking local security warnings to surface in agent instructions */
|
|
28
|
+
securityWarnings?: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface Skill {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}
|
|
35
|
+
export interface InstallerSecurityWarning {
|
|
36
|
+
id: string;
|
|
37
|
+
message: string;
|
|
38
|
+
recommendation: string;
|
|
39
|
+
}
|
|
40
|
+
export interface InstallerSecurityReport {
|
|
41
|
+
sourceFile: string | null;
|
|
42
|
+
warnings: InstallerSecurityWarning[];
|
|
43
|
+
}
|
|
44
|
+
export declare function parseArgs(argv: string[]): CliArgs;
|
|
45
|
+
export declare function findSmithRoot(startDir: string): string | null;
|
|
46
|
+
export declare function loadSkills(skillsDir: string): Skill[];
|
|
47
|
+
export declare function buildSystemPrompt(opts: InstallerOptions): string;
|
|
48
|
+
export declare function evaluateInstallerSecurity(smithRoot: string): InstallerSecurityReport;
|
|
49
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAE7C,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACx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