@useorgx/wizard 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1767,7 +1767,7 @@ function formatHttpError(status, body) {
1767
1767
  }
1768
1768
  async function listWorkspaces(options = {}) {
1769
1769
  const auth = await requireOrgxAuth(options);
1770
- const url = buildOrgxApiUrl("/entities?type=command_center&limit=100", auth.baseUrl);
1770
+ const url = buildOrgxApiUrl("/entities?type=workspace&limit=100", auth.baseUrl);
1771
1771
  const response = await fetch(url, {
1772
1772
  method: "GET",
1773
1773
  headers: {
@@ -1813,7 +1813,7 @@ async function createWorkspace(input, options = {}) {
1813
1813
  const auth = await requireOrgxAuth(options);
1814
1814
  const url = buildOrgxApiUrl("/entities", auth.baseUrl);
1815
1815
  const payload = {
1816
- type: "command_center",
1816
+ type: "workspace",
1817
1817
  name,
1818
1818
  ...input.description?.trim() ? { description: input.description.trim() } : {}
1819
1819
  };
@@ -1840,7 +1840,7 @@ async function updateWorkspace(input, patch, options = {}) {
1840
1840
  method: "PATCH",
1841
1841
  headers: buildRequestHeaders(auth.apiKey),
1842
1842
  body: JSON.stringify({
1843
- type: "command_center",
1843
+ type: "workspace",
1844
1844
  id: input.id,
1845
1845
  ...patch
1846
1846
  }),
@@ -5332,6 +5332,199 @@ async function trackWizardTelemetry(event, properties = {}, options = {}) {
5332
5332
  return response?.ok === true;
5333
5333
  }
5334
5334
 
5335
+ // src/lib/daily-brief-onboarding.ts
5336
+ var BASELINE_PROMPTS = [
5337
+ { task_type: "code_review", label: "Code review", placeholder: "20" },
5338
+ { task_type: "prd_draft", label: "PRD draft", placeholder: "45" },
5339
+ { task_type: "test_writeup", label: "Test writeup", placeholder: "25" },
5340
+ { task_type: "pr_description", label: "PR description", placeholder: "10" },
5341
+ { task_type: "launch_post", label: "Launch post", placeholder: "60" },
5342
+ { task_type: "architecture_doc", label: "Architecture doc", placeholder: "90" }
5343
+ ];
5344
+ async function runDailyBriefOnboarding(options) {
5345
+ if (!options.interactive) {
5346
+ return {
5347
+ status: "skipped_non_interactive",
5348
+ message: "Daily Brief onboarding skipped \u2014 not attached to a TTY."
5349
+ };
5350
+ }
5351
+ if (!options.workspace) {
5352
+ return {
5353
+ status: "skipped_no_workspace",
5354
+ message: "Daily Brief onboarding skipped \u2014 no workspace resolved."
5355
+ };
5356
+ }
5357
+ const auth = await resolveOrgxAuth();
5358
+ if (!auth) {
5359
+ return {
5360
+ status: "failed",
5361
+ message: "Daily Brief onboarding needs OrgX auth.",
5362
+ error: "no_auth"
5363
+ };
5364
+ }
5365
+ const state = await fetchOnboardingState(auth).catch(() => null);
5366
+ if (state) {
5367
+ const row = state.workspaces.find((w) => w.id === options.workspace.id);
5368
+ if (row?.onboardingCompletedAt) {
5369
+ return {
5370
+ status: "skipped_already_completed",
5371
+ message: "Daily Brief onboarding already completed for this workspace."
5372
+ };
5373
+ }
5374
+ }
5375
+ const { prompts } = options;
5376
+ const proceed = await prompts.confirm({
5377
+ message: "Set up your Daily Brief? (captures baselines so tomorrow's brief can show real time-saved numbers)",
5378
+ initialValue: true
5379
+ });
5380
+ if (prompts.isCancel(proceed)) {
5381
+ return { status: "cancelled", message: "Daily Brief onboarding cancelled." };
5382
+ }
5383
+ if (!proceed) {
5384
+ return {
5385
+ status: "cancelled",
5386
+ message: "Skipped \u2014 run `wizard brief setup` later to configure."
5387
+ };
5388
+ }
5389
+ const baselines = [];
5390
+ for (const bp of BASELINE_PROMPTS) {
5391
+ const answer = await prompts.text({
5392
+ message: `How long does ${bp.label.toLowerCase()} usually take? (minutes, blank to skip)`,
5393
+ placeholder: bp.placeholder,
5394
+ validate(value) {
5395
+ if (!value || value.trim() === "") return void 0;
5396
+ const n = Number.parseInt(value, 10);
5397
+ if (!Number.isFinite(n) || n <= 0 || n > 24 * 60) {
5398
+ return "Enter 1 \u2013 1440 or leave blank.";
5399
+ }
5400
+ return void 0;
5401
+ }
5402
+ });
5403
+ if (prompts.isCancel(answer)) {
5404
+ return { status: "cancelled", message: "Daily Brief onboarding cancelled." };
5405
+ }
5406
+ if (typeof answer === "string" && answer.trim() !== "") {
5407
+ const minutes = Number.parseInt(answer, 10);
5408
+ if (Number.isFinite(minutes) && minutes > 0) {
5409
+ baselines.push({ task_type: bp.task_type, minutes, confidence: 0.5 });
5410
+ }
5411
+ }
5412
+ }
5413
+ const goals = [];
5414
+ const goalAnswer = await prompts.text({
5415
+ message: "Weekly time saved target (minutes, blank to skip)",
5416
+ placeholder: "180",
5417
+ validate(value) {
5418
+ if (!value || value.trim() === "") return void 0;
5419
+ const n = Number.parseInt(value, 10);
5420
+ if (!Number.isFinite(n) || n <= 0) {
5421
+ return "Enter a positive number or leave blank.";
5422
+ }
5423
+ return void 0;
5424
+ }
5425
+ });
5426
+ if (prompts.isCancel(goalAnswer)) {
5427
+ return { status: "cancelled", message: "Daily Brief onboarding cancelled." };
5428
+ }
5429
+ if (typeof goalAnswer === "string" && goalAnswer.trim() !== "") {
5430
+ const target = Number.parseInt(goalAnswer, 10);
5431
+ if (Number.isFinite(target) && target > 0) {
5432
+ goals.push({
5433
+ goal_type: "time_saved_weekly",
5434
+ target_value: target,
5435
+ unit: "minutes",
5436
+ period: "weekly"
5437
+ });
5438
+ }
5439
+ }
5440
+ const sendTimeAnswer = await prompts.text({
5441
+ message: "When should your daily brief arrive? (HH:MM local, default 07:00)",
5442
+ placeholder: "07:00",
5443
+ validate(value) {
5444
+ if (!value || value.trim() === "") return void 0;
5445
+ if (!/^\d{1,2}:\d{2}$/.test(value.trim())) {
5446
+ return "Use HH:MM (24h).";
5447
+ }
5448
+ return void 0;
5449
+ }
5450
+ });
5451
+ if (prompts.isCancel(sendTimeAnswer)) {
5452
+ return { status: "cancelled", message: "Daily Brief onboarding cancelled." };
5453
+ }
5454
+ const sendTimeLocal = typeof sendTimeAnswer === "string" && sendTimeAnswer.trim() ? sendTimeAnswer.trim().length === 4 ? `0${sendTimeAnswer.trim()}` : sendTimeAnswer.trim() : "07:00";
5455
+ const onlyOnAttentionAnswer = await prompts.confirm({
5456
+ message: "Only email when something needs your attention?",
5457
+ initialValue: false
5458
+ });
5459
+ if (prompts.isCancel(onlyOnAttentionAnswer)) {
5460
+ return { status: "cancelled", message: "Daily Brief onboarding cancelled." };
5461
+ }
5462
+ const onlyOnAttention = Boolean(onlyOnAttentionAnswer);
5463
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
5464
+ const commitPayload = {
5465
+ workspace_id: options.workspace.id,
5466
+ agent_roster: [
5467
+ { id: "engineering-agent", display_name: "Eli", color: "6, 182, 212", enabled: true },
5468
+ { id: "product-agent", display_name: "Pace", color: "22, 163, 74", enabled: true },
5469
+ { id: "marketing-agent", display_name: "Mark", color: "249, 115, 22", enabled: true },
5470
+ { id: "orchestrator-agent", display_name: "Xandy", color: "20, 184, 166", enabled: true }
5471
+ ],
5472
+ baselines,
5473
+ goals,
5474
+ starter_skill_loadouts: [],
5475
+ notification_preference: {
5476
+ channel: "email",
5477
+ digest_kind: "daily_brief",
5478
+ enabled: true,
5479
+ send_time_local: `${sendTimeLocal}:00`,
5480
+ timezone,
5481
+ only_on_attention: onlyOnAttention
5482
+ }
5483
+ };
5484
+ const commitResponse = await fetch(buildOrgxApiUrl("/v1/onboarding/daily-brief", auth.baseUrl), {
5485
+ method: "POST",
5486
+ headers: {
5487
+ Authorization: `Bearer ${auth.apiKey}`,
5488
+ "Content-Type": "application/json"
5489
+ },
5490
+ body: JSON.stringify(commitPayload),
5491
+ signal: AbortSignal.timeout(1e4)
5492
+ });
5493
+ if (!commitResponse.ok) {
5494
+ const text2 = await commitResponse.text().catch(() => "");
5495
+ return {
5496
+ status: "failed",
5497
+ message: "Could not commit onboarding capture.",
5498
+ error: `HTTP ${commitResponse.status}: ${text2.slice(0, 200)}`
5499
+ };
5500
+ }
5501
+ const commitBody = await commitResponse.json().catch(() => ({}));
5502
+ const previewUrl = typeof commitBody.daily_brief_preview_url === "string" ? commitBody.daily_brief_preview_url : "/today?mode=preview";
5503
+ return {
5504
+ status: "completed",
5505
+ message: "Your Daily Brief is configured. First brief lands tomorrow.",
5506
+ previewUrl
5507
+ };
5508
+ }
5509
+ async function fetchOnboardingState(auth) {
5510
+ try {
5511
+ const res = await fetch(
5512
+ buildOrgxApiUrl("/v1/onboarding/daily-brief", auth.baseUrl),
5513
+ {
5514
+ method: "GET",
5515
+ headers: { Authorization: `Bearer ${auth.apiKey}` },
5516
+ signal: AbortSignal.timeout(5e3)
5517
+ }
5518
+ );
5519
+ if (!res.ok) return null;
5520
+ const body = await res.json();
5521
+ if (!body || !Array.isArray(body.workspaces)) return null;
5522
+ return body;
5523
+ } catch {
5524
+ return null;
5525
+ }
5526
+ }
5527
+
5335
5528
  // src/spinner.ts
5336
5529
  import ora from "ora";
5337
5530
  import pc2 from "picocolors";
@@ -5408,6 +5601,21 @@ function printMutationResults(results) {
5408
5601
  console.log(` ${icon} ${pc3.bold(result.name.padEnd(10))} ${state} ${pc3.dim(result.message)}`);
5409
5602
  }
5410
5603
  }
5604
+ function printSurfaceSummary(results) {
5605
+ const summarized = summarizeMutationResults(results);
5606
+ const updated = summarized.filter((r) => r.state === "updated");
5607
+ if (updated.length === 0) {
5608
+ console.log(
5609
+ ` ${ICON.skip} ${pc3.dim(`${summarized.length} surface${summarized.length === 1 ? "" : "s"} already configured`)}`
5610
+ );
5611
+ return;
5612
+ }
5613
+ for (const result of summarized) {
5614
+ const icon = result.state === "updated" ? ICON.ok : ICON.skip;
5615
+ const state = result.state === "updated" ? pc3.green("updated ") : pc3.dim("unchanged");
5616
+ console.log(` ${icon} ${pc3.bold(result.name.padEnd(10))} ${state} ${pc3.dim(result.message)}`);
5617
+ }
5618
+ }
5411
5619
  function printPluginMutationReport(report) {
5412
5620
  for (const result of report.results) {
5413
5621
  const icon = result.changed ? ICON.ok : ICON.skip;
@@ -5417,10 +5625,16 @@ function printPluginMutationReport(report) {
5417
5625
  );
5418
5626
  }
5419
5627
  }
5420
- async function printPluginStatusSection() {
5628
+ async function checkPluginStatusesCompact() {
5421
5629
  const spinner = createOrgxSpinner("Checking OrgX companion plugin status");
5422
5630
  spinner.start();
5423
5631
  const statuses = await listOrgxPluginStatuses();
5632
+ const installable = statuses.filter((s) => s.available && !s.installed);
5633
+ const installed = statuses.filter((s) => s.installed).length;
5634
+ if (installable.length === 0) {
5635
+ spinner.succeed(`Plugins ready (${installed} installed)`);
5636
+ return statuses;
5637
+ }
5424
5638
  spinner.succeed("OrgX companion plugin status checked");
5425
5639
  console.log("");
5426
5640
  console.log(pc3.dim(" plugins"));
@@ -6038,7 +6252,7 @@ function printDoctorReport(report, assessment) {
6038
6252
  async function main() {
6039
6253
  const program = new Command();
6040
6254
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
6041
- const pkgVersion = true ? "0.1.15" : void 0;
6255
+ const pkgVersion = true ? "0.1.17" : void 0;
6042
6256
  program.version(pkgVersion ?? "unknown", "-V, --version");
6043
6257
  program.hook("preAction", () => {
6044
6258
  console.log(renderBanner(pkgVersion));
@@ -6150,13 +6364,14 @@ async function main() {
6150
6364
  spinner.start();
6151
6365
  const results = await setupDetectedSurfaces();
6152
6366
  spinner.succeed("Detected surfaces configured");
6153
- printMutationResults(results);
6154
- const pluginStatuses = await printPluginStatusSection();
6367
+ printSurfaceSummary(results);
6368
+ const pluginStatuses = await checkPluginStatusesCompact();
6155
6369
  await safeTrackWizardTelemetry("mcp_injected", {
6156
6370
  changed_count: results.filter((result) => result.changed).length,
6157
6371
  preset: "standard",
6158
6372
  surface_count: results.length
6159
6373
  });
6374
+ const wasAlreadyPaired = await resolveOrgxAuth() !== null;
6160
6375
  let resolvedAuth = await resolveOrgxAuth();
6161
6376
  if (!resolvedAuth) {
6162
6377
  console.log("");
@@ -6230,6 +6445,24 @@ async function main() {
6230
6445
  if (workspaceSetup.workspace) {
6231
6446
  console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(workspaceSetup.workspace.name)}`);
6232
6447
  }
6448
+ const briefResult = await runDailyBriefOnboarding({
6449
+ interactive,
6450
+ workspace: resolvedWorkspace,
6451
+ prompts: {
6452
+ cancel: clack.cancel,
6453
+ isCancel: clack.isCancel,
6454
+ text: textPrompt,
6455
+ select: selectPrompt,
6456
+ confirm: clack.confirm
6457
+ }
6458
+ });
6459
+ if (briefResult.status === "cancelled") {
6460
+ console.log(` ${ICON.skip} ${pc3.dim(briefResult.message)}`);
6461
+ } else if (briefResult.status === "completed") {
6462
+ console.log(` ${ICON.ok} ${pc3.green("daily brief")} ${pc3.dim(briefResult.message)}`);
6463
+ } else if (briefResult.status === "failed") {
6464
+ console.log(` ${ICON.warn} ${pc3.yellow("daily brief")} ${pc3.dim(briefResult.message)}`);
6465
+ }
6233
6466
  const addOnResult = await maybeConfigureOptionalWorkspaceAddOns({
6234
6467
  interactive,
6235
6468
  telemetry: { command: "setup", preset: "standard" },
@@ -6261,6 +6494,11 @@ async function main() {
6261
6494
  console.log("");
6262
6495
  if (assessment.issues.length === 0) {
6263
6496
  console.log(` ${ICON.ok} ${pc3.green("You're all set.")} ${pc3.dim(`OrgX is active across ${configuredCount} editor${configuredCount !== 1 ? "s" : ""}`)}`);
6497
+ if (wasAlreadyPaired) {
6498
+ console.log(
6499
+ ` ${pc3.dim("\u2192")} ${pc3.dim("If you opened the browser onboarding, click")} ${pc3.cyan("I've already paired")} ${pc3.dim("to continue.")}`
6500
+ );
6501
+ }
6264
6502
  } else {
6265
6503
  printDoctorReport(doctor, assessment);
6266
6504
  if (verification.status === "error") {