@jefuriiij/synthra 0.1.7 → 0.1.8

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/index.js CHANGED
@@ -18,7 +18,7 @@ var init_package = __esm({
18
18
  "package.json"() {
19
19
  package_default = {
20
20
  name: "@jefuriiij/synthra",
21
- version: "0.1.7",
21
+ version: "0.1.8",
22
22
  publishConfig: {
23
23
  access: "public"
24
24
  },
@@ -864,7 +864,7 @@ var public_default = `<!doctype html>
864
864
 
865
865
  <!-- ============ Footer ============ -->
866
866
  <footer class="foot">
867
- <div>Synth<em>ra</em> \xB7 v0.1.7</div>
867
+ <div>Synth<em>ra</em> \xB7 v0.1.8</div>
868
868
  <div>Cost figures approximate \xB7 @jefuriiij</div>
869
869
  </footer>
870
870
 
@@ -4680,6 +4680,8 @@ async function dashboardCommand(rawPath) {
4680
4680
  import { mkdir as mkdir10, readFile as readFile14, writeFile as writeFile9 } from "fs/promises";
4681
4681
  import { homedir as homedir3 } from "os";
4682
4682
  import { join as join10 } from "path";
4683
+ import { createInterface } from "readline/promises";
4684
+ import spawn from "cross-spawn";
4683
4685
  var PKG_NAME = "@jefuriiij/synthra";
4684
4686
  var CACHE_DIR = join10(homedir3(), ".synthra");
4685
4687
  var CACHE_PATH = join10(CACHE_DIR, "version-check.json");
@@ -4762,14 +4764,49 @@ async function checkForUpdate() {
4762
4764
  const hasUpdate = latest ? isNewer(latest, current) : false;
4763
4765
  return { current, latest, hasUpdate };
4764
4766
  }
4765
- async function logUpdateHintIfNeeded() {
4767
+ async function promptYesNo(question) {
4768
+ if (!process.stdin.isTTY) return false;
4769
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
4770
+ try {
4771
+ const answer = (await rl.question(question)).trim().toLowerCase();
4772
+ return answer === "y" || answer === "yes";
4773
+ } finally {
4774
+ rl.close();
4775
+ }
4776
+ }
4777
+ function runNpmUpdate() {
4778
+ return new Promise((resolve5) => {
4779
+ const proc = spawn("npm", ["install", "-g", PKG_NAME + "@latest"], {
4780
+ stdio: "inherit"
4781
+ });
4782
+ proc.on("error", () => resolve5(false));
4783
+ proc.on("exit", (code) => resolve5(code === 0));
4784
+ });
4785
+ }
4786
+ async function promptForUpdateOrLog() {
4766
4787
  try {
4767
4788
  const r = await checkForUpdate();
4768
- if (r.hasUpdate && r.latest) {
4789
+ if (!r.hasUpdate || !r.latest) return;
4790
+ if (!process.stdin.isTTY) {
4769
4791
  log.info(
4770
4792
  `Synthra ${r.latest} is available (you have ${r.current}) \u2014 run: npm install -g @jefuriiij/synthra@latest`
4771
4793
  );
4794
+ return;
4795
+ }
4796
+ log.info(`Synthra ${r.latest} is available (you have ${r.current}).`);
4797
+ const yes = await promptYesNo("[syn] Update now? [y/N]: ");
4798
+ if (!yes) {
4799
+ log.info("Skipping update \u2014 continuing with current version.");
4800
+ return;
4772
4801
  }
4802
+ log.info(`Running: npm install -g ${PKG_NAME}@latest`);
4803
+ const ok2 = await runNpmUpdate();
4804
+ if (!ok2) {
4805
+ log.warn("npm install failed \u2014 continuing with current version.");
4806
+ return;
4807
+ }
4808
+ log.info(`\u2713 Updated to ${r.latest}. Please re-run: syn .`);
4809
+ process.exit(0);
4773
4810
  } catch {
4774
4811
  }
4775
4812
  }
@@ -4805,11 +4842,11 @@ async function serveCommand(rawPath) {
4805
4842
  }
4806
4843
 
4807
4844
  // src/cli/start-claude.ts
4808
- import spawn from "cross-spawn";
4845
+ import spawn2 from "cross-spawn";
4809
4846
  var MCP_NAME = "synthra";
4810
4847
  function runClaude(bin, args, cwd, stdio = "pipe") {
4811
4848
  return new Promise((resolve5) => {
4812
- const proc = spawn(bin, args, {
4849
+ const proc = spawn2(bin, args, {
4813
4850
  cwd,
4814
4851
  stdio: stdio === "inherit" ? "inherit" : ["ignore", "pipe", "pipe"]
4815
4852
  });
@@ -4889,7 +4926,7 @@ async function defaultFlow(rawPath, opts) {
4889
4926
  const projectRoot = resolve4(rawPath);
4890
4927
  const paths = resolvePaths(projectRoot);
4891
4928
  const cfg = loadConfig();
4892
- void logUpdateHintIfNeeded();
4929
+ await promptForUpdateOrLog();
4893
4930
  await recordProject(projectRoot);
4894
4931
  const scan = await scanCommand(rawPath);
4895
4932
  const mcpHandle = await startServer(paths);