@neat.is/core 0.10.3-dev.20260930 → 0.10.3

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
@@ -5447,6 +5447,15 @@ function bindUrl(webUrl, projectId) {
5447
5447
  function onboardingUrl(webUrl) {
5448
5448
  return `${webUrl}/onboarding`;
5449
5449
  }
5450
+ async function offerLocalExtraction(input, d, out, readLine) {
5451
+ const run = d.orchestrator;
5452
+ if (!run || !readLine) return false;
5453
+ const answer = (await readLine("Build it now? [Y/n] "))?.trim().toLowerCase();
5454
+ if (answer === "n" || answer === "no") return false;
5455
+ out("");
5456
+ const code = await run(d.cwd ?? process.cwd(), {});
5457
+ return code === 0;
5458
+ }
5450
5459
  async function runPostLoginConnect(input) {
5451
5460
  const d = input.deps;
5452
5461
  const out = d.out ?? ((line) => console.log(line));
@@ -5456,9 +5465,27 @@ async function runPostLoginConnect(input) {
5456
5465
  const readLine = d.readLine;
5457
5466
  const repo = await detect6(cwd);
5458
5467
  out("");
5468
+ const cmd = commandPrefix();
5469
+ const syncLine = `${cmd} sync --to ${input.project.name}`;
5459
5470
  if (!repo) {
5460
5471
  out("This directory has no GitHub remote, so it can't be bound to the project.");
5461
- out(` Push its graph instead: neat sync --to ${input.project.name}`);
5472
+ const hasGraph = await (d.hasLocalGraph ?? hasLocalSnapshot)(cwd);
5473
+ if (!hasGraph) {
5474
+ out(`A graph of this directory has to be built first, then pushed to ${input.project.name}.`);
5475
+ const built = await offerLocalExtraction(input, d, out, readLine);
5476
+ out("");
5477
+ if (built) {
5478
+ out(`Now push it to ${input.project.name}:`);
5479
+ out(` ${syncLine}`);
5480
+ } else {
5481
+ out(`When you're ready, build it and push it to ${input.project.name}:`);
5482
+ out(` ${cmd}`);
5483
+ out(` ${syncLine}`);
5484
+ }
5485
+ out(` Manage projects and repos: ${input.webUrl}`);
5486
+ return;
5487
+ }
5488
+ out(` Push its graph instead: ${syncLine}`);
5462
5489
  out(` Manage projects and repos: ${input.webUrl}`);
5463
5490
  return;
5464
5491
  }
@@ -5492,18 +5519,18 @@ async function runPostLoginConnect(input) {
5492
5519
  out("");
5493
5520
  if (!hasGraph) {
5494
5521
  out("There is no local graph to push yet. Build one, then push it:");
5495
- out(" neat");
5496
- out(` neat sync --to ${input.project.name}`);
5522
+ out(` ${cmd}`);
5523
+ out(` ${syncLine}`);
5497
5524
  return;
5498
5525
  }
5499
5526
  out("Push the local graph with:");
5500
- out(` neat sync --to ${input.project.name}`);
5527
+ out(` ${syncLine}`);
5501
5528
  return;
5502
5529
  }
5503
5530
  out("");
5504
5531
  out("No problem \u2014 when you want this repo in the graph:");
5505
5532
  out(` Bind it: ${bindUrl(input.webUrl, input.project.id)}`);
5506
- out(` Or push it: neat sync --to ${input.project.name}`);
5533
+ out(` Or push it: ${syncLine}`);
5507
5534
  }
5508
5535
 
5509
5536
  // src/login-sso.ts
@@ -5682,7 +5709,7 @@ async function runSsoLogin(opts, deps) {
5682
5709
  ...deps.signal ? { signal: deps.signal } : {}
5683
5710
  });
5684
5711
  if (waited.kind === "aborted") {
5685
- out("Stopped. Run `neat login` again once your project is up.");
5712
+ out(`Stopped. Run \`${commandPrefix()} login\` again once your project is up.`);
5686
5713
  return 130;
5687
5714
  }
5688
5715
  if (waited.kind === "timeout") {
@@ -5750,7 +5777,7 @@ async function runSsoLogin(opts, deps) {
5750
5777
  }
5751
5778
  });
5752
5779
  out("");
5753
- out("Run `neat logout` to switch back to your local daemon.");
5780
+ out(`Run \`${commandPrefix()} logout\` to switch back to your local daemon.`);
5754
5781
  }
5755
5782
  return 0;
5756
5783
  }
@@ -9766,23 +9793,24 @@ async function tryOrchestrator(cmd, parsed, overrides = {}) {
9766
9793
  return result.exitCode;
9767
9794
  }
9768
9795
  async function runWelcomeFlow(parsed) {
9796
+ const runLocal = async (cwd, opts) => await tryOrchestrator(
9797
+ cwd,
9798
+ {
9799
+ ...parsed,
9800
+ ...opts?.project !== void 0 ? { project: opts.project } : {},
9801
+ ...opts?.noInstrument !== void 0 ? { noInstrument: opts.noInstrument } : {},
9802
+ ...opts?.yes !== void 0 ? { yes: opts.yes } : {}
9803
+ },
9804
+ { skipBanner: opts?.headerShown === true }
9805
+ ) ?? 0;
9769
9806
  return runWelcome({
9770
- login: (loginArgv) => runLoginCommand(loginArgv),
9807
+ login: (loginArgv) => runLoginCommand(loginArgv, { connect: { orchestrator: runLocal } }),
9771
9808
  // What the person chose at the door reaches the orchestrator as the flags they
9772
9809
  // stand for: the name as `--project`, the instrument answer as `--no-instrument`
9773
9810
  // or as `yes` (which keeps the orchestrator's own prompt quiet, since the door
9774
9811
  // already asked). `headerShown` isn't a flag anyone can type — it says the
9775
9812
  // door's wordmark already opened this run, so the orchestrator's banner is skipped.
9776
- orchestrator: async (cwd, opts) => await tryOrchestrator(
9777
- cwd,
9778
- {
9779
- ...parsed,
9780
- ...opts?.project !== void 0 ? { project: opts.project } : {},
9781
- ...opts?.noInstrument !== void 0 ? { noInstrument: opts.noInstrument } : {},
9782
- ...opts?.yes !== void 0 ? { yes: opts.yes } : {}
9783
- },
9784
- { skipBanner: opts?.headerShown === true }
9785
- ) ?? 0,
9813
+ orchestrator: runLocal,
9786
9814
  // An explicit flag is an answer; don't ask again.
9787
9815
  instrumentFlagGiven: parsed.noInstrument || parsed.dryRun
9788
9816
  });