start-jibril 1.0.2 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +54 -32
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -46,29 +46,37 @@ function checkPrereqs() {
46
46
  try { run("git --version", { quiet: true }); ok("git"); }
47
47
  catch { fail("git not found — install from https://git-scm.com"); }
48
48
 
49
- // Claude Code CLI
49
+ // Claude Code CLI — auto-install if missing
50
50
  try { run("claude --version", { quiet: true }); ok("Claude Code CLI"); }
51
51
  catch {
52
- log();
53
- log(" Claude Code CLI is required but not installed.");
54
- log();
55
- log(` Install: ${B}npm install -g @anthropic-ai/claude-code${X}`);
56
- log(` Authenticate: ${B}claude auth${X}`);
57
- log(` Then re-run: ${B}npx start-jibril${X}`);
58
- log();
59
- process.exit(1);
52
+ log(" Installing Claude Code CLI...");
53
+ try {
54
+ run("npm install -g @anthropic-ai/claude-code");
55
+ ok("Claude Code CLI installed");
56
+ } catch {
57
+ fail("Failed to install Claude Code CLI. Run manually: npm install -g @anthropic-ai/claude-code");
58
+ }
60
59
  }
61
60
 
62
- // Claude auth
61
+ // Claude auth — prompt user to authenticate if needed
63
62
  const creds = path.join(os.homedir(), ".claude", ".credentials.json");
64
63
  if (!fs.existsSync(creds)) {
65
64
  log();
66
- log(` Claude Code is installed but not authenticated.`);
67
- log(` Run ${B}claude auth${X} first, then re-run ${B}npx start-jibril${X}.`);
65
+ log(` Claude Code needs authentication (one-time).`);
66
+ log(` Running ${B}claude auth login${X}...`);
68
67
  log();
69
- process.exit(1);
68
+ try {
69
+ spawnSync("claude", ["auth", "login"], { stdio: "inherit" });
70
+ if (!fs.existsSync(creds)) {
71
+ fail("Authentication failed. Run manually: claude auth login");
72
+ }
73
+ ok("Claude Code authenticated");
74
+ } catch {
75
+ fail("Authentication failed. Run manually: claude auth login");
76
+ }
77
+ } else {
78
+ ok("Claude Code authenticated");
70
79
  }
71
- ok("Claude Code authenticated");
72
80
  }
73
81
 
74
82
  // ── Resume if already installed ───────────────────────────────────────────────
@@ -134,7 +142,14 @@ async function main() {
134
142
  if (fs.existsSync(webDir)) {
135
143
  log(" Installing web UI dependencies...");
136
144
  run("npm install --silent", { cwd: webDir });
137
- ok("web/ ready");
145
+ ok("web/ deps ready");
146
+ log(" Building web UI (production)...");
147
+ try {
148
+ run("npm run build", { cwd: webDir });
149
+ ok("web/ built");
150
+ } catch {
151
+ warn("web/ build failed — will build on first launch");
152
+ }
138
153
  }
139
154
  if (fs.existsSync(channelsDir)) {
140
155
  log(" Installing channel server dependencies...");
@@ -188,28 +203,35 @@ async function main() {
188
203
  write(path.join(memDir, "feedback", "pending.json"), JSON.stringify({ pending: [] }));
189
204
  write(path.join(stateDir, "first_run.json"), JSON.stringify({ first_run_completed: false, onboarding_version: 1 }, null, 2));
190
205
 
191
- // ── MCP config (hub SSE mode) ────────────────────────────────────────────────
192
- h("Configuring MCP server...");
193
- log();
194
-
206
+ // ── Ensure .claude dir exists ────────────────────────────────────────────────
195
207
  const claudeDir = path.join(targetDir, ".claude");
196
208
  fs.mkdirSync(claudeDir, { recursive: true });
197
- fs.writeFileSync(
198
- path.join(claudeDir, "mcp_config.json"),
199
- JSON.stringify(
200
- { mcpServers: { "jibril-hub": { type: "sse", url: "http://127.0.0.1:7779/mcp" } } },
201
- null, 2
202
- )
203
- );
204
- ok("MCP config written (hub SSE mode)");
205
209
 
206
- // ── Cloudflare Tunnel (optional, for anywhere access) ────────────────────────
210
+ // ── Cloudflare Tunnel (for anywhere access) ──────────────────────────────────
211
+ h("Setting up Cloudflare Tunnel...");
212
+ log();
207
213
  try {
208
214
  run("which cloudflared", { quiet: true });
209
215
  ok("cloudflared found — tunnel will start automatically");
210
216
  } catch {
211
- warn("cloudflared not found Cloudflare Tunnel disabled");
212
- log(` Install for anywhere access: ${B}brew install cloudflared${X}`);
217
+ // Auto-install on macOS if brew available
218
+ const isMac = process.platform === "darwin";
219
+ let hasBrew = false;
220
+ try { run("which brew", { quiet: true }); hasBrew = true; } catch {}
221
+
222
+ if (isMac && hasBrew) {
223
+ log(" Installing cloudflared via Homebrew (for anywhere access)...");
224
+ try {
225
+ run("brew install cloudflared");
226
+ ok("cloudflared installed — tunnel will start automatically");
227
+ } catch {
228
+ warn("cloudflared install failed — you can install manually later: brew install cloudflared");
229
+ }
230
+ } else {
231
+ warn("cloudflared not found — install for anywhere access:");
232
+ log(` ${B}brew install cloudflared${X} (macOS)`);
233
+ log(` ${B}https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/${X}`);
234
+ }
213
235
  }
214
236
 
215
237
  // ── Make scripts executable ─────────────────────────────────────────────────
@@ -254,9 +276,9 @@ async function main() {
254
276
  log(` ${G}jibril${X}`);
255
277
  log();
256
278
  log(` ${D}This one command starts everything:${X}`);
257
- log(` ${D} Claude Code + mobile web UI (localhost:3333) + tunnel${X}`);
279
+ log(` ${D} Claude Code + mobile web UI + Cloudflare Tunnel${X}`);
258
280
  log();
259
- log(` ${D}Open ${B}http://localhost:3333${X}${D} on your phone (same WiFi)${X}`);
281
+ log(` ${D}Everything runs on port 7779 one URL for API + UI.${X}`);
260
282
  log(` ${D}If cloudflared is installed, a public URL prints for anywhere access.${X}`);
261
283
  log(` ${D}On first launch Jibril will introduce itself.${X}`);
262
284
  log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "start-jibril",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Set up and start Jibril — the self-evolving AI assistant — in one command",
5
5
  "keywords": [
6
6
  "jibril",