jowork 0.2.0 → 0.2.2

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/dist/cli.js +138 -147
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2388,138 +2388,92 @@ import { existsSync as existsSync15, mkdirSync as mkdirSync4, writeFileSync as w
2388
2388
  import { join as join10 } from "path";
2389
2389
  import { execSync } from "child_process";
2390
2390
  var HOME3 = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
2391
- var SKILL_FILES = {
2392
- "SKILL.md": [
2393
- "---",
2394
- "name: jowork",
2395
- "version: 0.1.0",
2396
- "description: |",
2397
- " AI Agent companion \u2014 connect data sources, manage sessions, drag files into",
2398
- " context, track goals. Works with Claude Code, Codex, and OpenClaw.",
2399
- "allowed-tools:",
2400
- " - Bash",
2401
- " - Read",
2402
- " - Write",
2403
- " - Edit",
2404
- " - AskUserQuestion",
2405
- "---",
2406
- "",
2407
- "# JoWork \u2014 Agent Infrastructure Skill",
2408
- "",
2409
- "JoWork gives your AI agent eyes (data connectors), memory (cross-session",
2410
- "persistence), purpose (goal tracking), and a companion dashboard.",
2411
- "",
2412
- "## Auto-Setup",
2413
- "",
2414
- "On first use, check if JoWork is initialized:",
2415
- "```bash",
2416
- 'command -v jowork >/dev/null 2>&1 && echo "CLI_INSTALLED" || echo "CLI_MISSING"',
2417
- '[ -d ~/.jowork ] && echo "INITIALIZED" || echo "NOT_INITIALIZED"',
2418
- "```",
2419
- "If CLI_MISSING: tell user to run `npx jowork@latest setup`.",
2420
- "If NOT_INITIALIZED: run `jowork init`.",
2421
- "",
2422
- "## Proactive Suggestions",
2423
- "",
2424
- "When you notice the user is at these stages, suggest the appropriate action:",
2425
- "- User asks about team discussions or what happened \u2192 use `search_data` MCP tool",
2426
- "- User mentions connecting GitHub/Slack/data \u2192 suggest `/jowork-connect`",
2427
- "- User wants dashboard or session management \u2192 suggest `/jowork-dashboard`",
2428
- "- User sets goals or wants metrics \u2192 suggest `jowork goal add`",
2429
- "- User mentions a folder to index \u2192 suggest `/jowork-context`",
2430
- "- User asks for a briefing \u2192 use `get_briefing` MCP tool",
2431
- "",
2432
- "## Status Check",
2433
- "",
2434
- "When invoked as `/jowork`:",
2435
- "```bash",
2436
- 'jowork status 2>/dev/null || echo "Not initialized. Run: npx jowork@latest setup"',
2437
- "```"
2438
- ].join("\n"),
2439
- "jowork-connect/SKILL.md": [
2440
- "---",
2441
- "name: jowork-connect",
2442
- "version: 0.1.0",
2443
- "description: |",
2444
- " Connect a data source (GitHub, GitLab, Linear, PostHog, Feishu) to JoWork.",
2445
- "allowed-tools:",
2446
- " - Bash",
2447
- " - AskUserQuestion",
2448
- "---",
2449
- "",
2450
- "# /jowork-connect \u2014 Connect Data Source",
2451
- "",
2452
- "Connect a data source without leaving your agent session.",
2453
- "",
2454
- "## Sources",
2455
- '- **GitHub**: `jowork connect github --token "$GITHUB_PERSONAL_ACCESS_TOKEN"`',
2456
- '- **GitLab**: `jowork connect gitlab --token "<token>"`',
2457
- '- **Linear**: `jowork connect linear --api-key "<key>"`',
2458
- '- **PostHog**: `jowork connect posthog --api-key "<key>" --project-id "<id>"`',
2459
- '- **Feishu**: `jowork connect feishu --app-id "<id>" --app-secret "<secret>"`',
2460
- "",
2461
- "After connecting, run `jowork sync --source <source>` to pull data.",
2462
- "Never log or display tokens. Use AskUserQuestion for credential input."
2463
- ].join("\n"),
2464
- "jowork-sync/SKILL.md": [
2465
- "---",
2466
- "name: jowork-sync",
2467
- "version: 0.1.0",
2468
- "description: Sync data from all connected sources into JoWork.",
2469
- "allowed-tools:",
2470
- " - Bash",
2471
- "---",
2472
- "",
2473
- "# /jowork-sync",
2474
- "",
2475
- "```bash",
2476
- "jowork sync 2>&1",
2477
- "```",
2478
- "Report which sources synced and how many new objects."
2479
- ].join("\n"),
2480
- "jowork-dashboard/SKILL.md": [
2481
- "---",
2482
- "name: jowork-dashboard",
2483
- "version: 0.1.0",
2484
- "description: Open the JoWork companion dashboard in your browser.",
2485
- "allowed-tools:",
2486
- " - Bash",
2487
- "---",
2488
- "",
2489
- "# /jowork-dashboard",
2490
- "",
2491
- "```bash",
2492
- "PORT=$(cat ~/.jowork/dashboard.port 2>/dev/null || echo 18801)",
2493
- 'if curl -s --max-time 1 "http://127.0.0.1:$PORT/api/status" >/dev/null 2>&1; then',
2494
- ' open "http://127.0.0.1:$PORT" 2>/dev/null || echo "Open http://127.0.0.1:$PORT"',
2495
- "else",
2496
- " jowork dashboard &",
2497
- "fi",
2498
- "```"
2499
- ].join("\n"),
2500
- "jowork-context/SKILL.md": [
2501
- "---",
2502
- "name: jowork-context",
2503
- "version: 0.1.0",
2504
- "description: Index a local directory so your agent can search its files.",
2505
- "allowed-tools:",
2506
- " - Bash",
2507
- " - AskUserQuestion",
2508
- "---",
2509
- "",
2510
- "# /jowork-context",
2511
- "",
2512
- "Ask which directory to index, then:",
2513
- "```bash",
2514
- "PORT=$(cat ~/.jowork/dashboard.port 2>/dev/null || echo 18801)",
2515
- `CSRF=$(curl -s "http://127.0.0.1:$PORT/" | grep csrf-token | sed 's/.*content="\\([^"]*\\)".*/\\1/')`,
2516
- 'curl -s -X POST "http://127.0.0.1:$PORT/api/context" \\',
2517
- ' -H "Content-Type: application/json" -H "X-CSRF-Token: $CSRF" \\',
2518
- ' -d "{\\"type\\":\\"directory\\",\\"value\\":\\"$DIR\\",\\"label\\":\\"$(basename $DIR)\\"}"',
2519
- "```",
2520
- "If dashboard not running, start it first with `jowork dashboard &`."
2521
- ].join("\n")
2522
- };
2391
+ var SKILL_CONTENT = `---
2392
+ name: jowork
2393
+ version: 0.2.0
2394
+ description: |
2395
+ AI Agent companion \u2014 connect data sources, manage sessions, drag files into
2396
+ context, track goals. Works with Claude Code, Codex, and OpenClaw.
2397
+ Use /jowork for status, or just ask naturally ("connect my GitHub", "sync data",
2398
+ "open dashboard", "search PRs").
2399
+ allowed-tools:
2400
+ - Bash
2401
+ - Read
2402
+ - AskUserQuestion
2403
+ ---
2404
+
2405
+ # JoWork \u2014 Agent Infrastructure
2406
+
2407
+ JoWork gives your AI agent data awareness (connectors), memory (cross-session),
2408
+ goal tracking, and a companion dashboard. All data stays local.
2409
+
2410
+ ## How it works
2411
+
2412
+ JoWork runs as an MCP server. Your agent already has these tools available:
2413
+ - **search_data** \u2014 search across all synced data
2414
+ - **read_memory / write_memory** \u2014 cross-session memory
2415
+ - **search_memory** \u2014 time-weighted memory search
2416
+ - **get_goals / get_metrics** \u2014 goal progress
2417
+ - **get_hot_context** \u2014 recent 24-72h activity summary
2418
+ - **get_briefing** \u2014 daily briefing
2419
+ - **sync_now** \u2014 trigger data sync
2420
+ - **push_to_channel** \u2014 send messages to connected channels
2421
+
2422
+ Use these MCP tools directly. No slash commands needed for data queries.
2423
+
2424
+ ## When the user asks to connect a data source
2425
+
2426
+ Run the appropriate bash command. Ask for credentials via AskUserQuestion
2427
+ if not in environment. Never display tokens in output.
2428
+
2429
+ \`\`\`
2430
+ GitHub: jowork connect github --token "$GITHUB_PERSONAL_ACCESS_TOKEN"
2431
+ GitLab: jowork connect gitlab --token "<token>"
2432
+ Linear: jowork connect linear --api-key "<key>"
2433
+ PostHog: jowork connect posthog --api-key "<key>" --project-id "<id>"
2434
+ Feishu: jowork connect feishu --app-id "<id>" --app-secret "<secret>"
2435
+ \`\`\`
2436
+
2437
+ After connecting, call the \`sync_now\` MCP tool or run \`jowork sync\`.
2438
+
2439
+ ## When the user asks to open the dashboard
2440
+
2441
+ \`\`\`bash
2442
+ PORT=$(cat ~/.jowork/dashboard.port 2>/dev/null || echo 18801)
2443
+ if curl -s --max-time 1 "http://127.0.0.1:$PORT/api/status" >/dev/null 2>&1; then
2444
+ open "http://127.0.0.1:$PORT" 2>/dev/null || echo "Open http://127.0.0.1:$PORT"
2445
+ else
2446
+ jowork dashboard &
2447
+ sleep 2
2448
+ open "http://127.0.0.1:$(cat ~/.jowork/dashboard.port 2>/dev/null || echo 18801)"
2449
+ fi
2450
+ \`\`\`
2451
+
2452
+ ## When the user asks to index a folder
2453
+
2454
+ \`\`\`bash
2455
+ jowork context add "<directory_path>"
2456
+ \`\`\`
2457
+
2458
+ Or if dashboard is running, use its API for progress feedback.
2459
+
2460
+ ## Proactive behavior
2461
+
2462
+ When you notice these patterns, act without being asked:
2463
+ - User asks about team discussions \u2192 call \`search_data\` or \`get_hot_context\`
2464
+ - User mentions connecting a service \u2192 guide through connection (see above)
2465
+ - User asks "what's new" or wants a briefing \u2192 call \`get_briefing\`
2466
+ - User mentions a folder to index \u2192 offer to index it
2467
+ - User wants to track a metric \u2192 guide through \`jowork goal add\`
2468
+
2469
+ ## Status check (when invoked as /jowork)
2470
+
2471
+ \`\`\`bash
2472
+ jowork status 2>/dev/null || echo "Not initialized. Run: npx jowork@latest setup"
2473
+ \`\`\`
2474
+
2475
+ Show results and suggest next action based on state.
2476
+ `;
2523
2477
  function setupSkillCommand(program2) {
2524
2478
  program2.command("setup").description("One-command setup: install skills + init DB + register with AI agents").action(async () => {
2525
2479
  console.log("");
@@ -2527,14 +2481,11 @@ function setupSkillCommand(program2) {
2527
2481
  console.log(" ============");
2528
2482
  console.log("");
2529
2483
  const skillDir = join10(HOME3, ".claude", "skills", "jowork");
2530
- console.log(" Installing skills to ~/.claude/skills/jowork/ ...");
2531
- for (const [relativePath, content] of Object.entries(SKILL_FILES)) {
2532
- const fullPath = join10(skillDir, relativePath);
2533
- mkdirSync4(join10(fullPath, ".."), { recursive: true });
2534
- writeFileSync7(fullPath, content);
2535
- }
2536
- writeFileSync7(join10(skillDir, "VERSION"), "0.1.0\n");
2537
- console.log(" \u2713 5 skills installed");
2484
+ console.log(" Installing skill to ~/.claude/skills/jowork/ ...");
2485
+ mkdirSync4(skillDir, { recursive: true });
2486
+ writeFileSync7(join10(skillDir, "SKILL.md"), SKILL_CONTENT);
2487
+ writeFileSync7(join10(skillDir, "VERSION"), "0.2.0\n");
2488
+ console.log(" \u2713 Skill installed (/jowork)");
2538
2489
  const jDir = joworkDir();
2539
2490
  if (existsSync15(join10(jDir, "config.json"))) {
2540
2491
  console.log(" \u2713 Database already initialized");
@@ -2586,18 +2537,58 @@ function setupSkillCommand(program2) {
2586
2537
  }
2587
2538
  } catch {
2588
2539
  }
2540
+ const { listCredentials: listCredentials2 } = await import("./credential-store-ZRZCSRPC.js");
2541
+ const connectedSources = listCredentials2();
2589
2542
  console.log("");
2590
2543
  console.log(" ============");
2591
2544
  console.log(" JoWork is ready!");
2592
2545
  console.log("");
2593
- console.log(" \u26A0 Restart Claude Code to activate MCP tools");
2594
- console.log("");
2595
- console.log(" Then try in Claude Code:");
2596
- console.log(" /jowork Status overview");
2597
- console.log(" /jowork-connect Connect GitHub, Slack, etc.");
2598
- console.log(" /jowork-dashboard Open companion panel");
2599
- console.log(' "search my PRs" Agent uses search_data automatically');
2546
+ if (!mcpRegistered) {
2547
+ console.log(" \u26A0 Restart Claude Code to activate MCP tools (search_data, read_memory, etc.)");
2548
+ console.log("");
2549
+ }
2550
+ if (connectedSources.length === 0) {
2551
+ console.log(" Next: Connect your first data source. Run one of:");
2552
+ console.log("");
2553
+ console.log(" jowork connect github # Uses GITHUB_PERSONAL_ACCESS_TOKEN env var");
2554
+ console.log(" jowork connect gitlab --token <token>");
2555
+ console.log(" jowork connect linear --api-key <key>");
2556
+ console.log(" jowork connect posthog --api-key <key> --project-id <id>");
2557
+ console.log(" jowork connect feishu --app-id <id> --app-secret <secret>");
2558
+ console.log("");
2559
+ console.log(' Or in Claude Code, just say: "connect my GitHub"');
2560
+ } else {
2561
+ console.log(` ${connectedSources.length} data source(s) connected: ${connectedSources.join(", ")}`);
2562
+ console.log("");
2563
+ console.log(" Try in Claude Code:");
2564
+ console.log(" /jowork Status overview");
2565
+ console.log(" /jowork-dashboard Open companion panel");
2566
+ console.log(' "search my PRs" Agent uses search_data automatically');
2567
+ }
2600
2568
  console.log("");
2569
+ if (!connectedSources.includes("github") && process.env["GITHUB_PERSONAL_ACCESS_TOKEN"]) {
2570
+ console.log(" Detected GITHUB_PERSONAL_ACCESS_TOKEN in environment.");
2571
+ console.log(" Connecting GitHub automatically...");
2572
+ try {
2573
+ execSync('jowork connect github --token "$GITHUB_PERSONAL_ACCESS_TOKEN"', {
2574
+ stdio: "pipe",
2575
+ env: process.env
2576
+ });
2577
+ console.log(" \u2713 GitHub connected! Running initial sync...");
2578
+ try {
2579
+ const output = execSync("jowork sync --source github", {
2580
+ encoding: "utf-8",
2581
+ timeout: 3e4,
2582
+ env: process.env
2583
+ });
2584
+ console.log(output.trim().split("\n").map((l) => " " + l).join("\n"));
2585
+ } catch {
2586
+ }
2587
+ } catch (err) {
2588
+ console.log(` \u26A0 Could not auto-connect GitHub: ${err}`);
2589
+ }
2590
+ console.log("");
2591
+ }
2601
2592
  });
2602
2593
  }
2603
2594
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jowork",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI Agent Infrastructure — let AI agents truly understand your work. Connect data sources, give agents awareness and goals. Local-first, one command.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",