@cubocicloide/stack-react-fastapi 13.0.8 → 13.2.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.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // src/index.ts
2
- import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
3
- import path16 from "pathe";
2
+ import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
3
+ import path15 from "pathe";
4
4
  import yaml2 from "yaml";
5
- import { defineStack, renderTemplateTree } from "@cubocicloide/dude";
5
+ import { defineStack, renderTemplateTree, defineCheatsheetCommand, defineDocsCommand } from "@cubocicloide/dude";
6
6
 
7
7
  // src/commands/api/index.ts
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
@@ -405,111 +405,14 @@ var rollbackCommand = {
405
405
  }
406
406
  };
407
407
 
408
- // src/commands/docs/index.ts
409
- import { spawn, spawnSync as spawnSync2 } from "child_process";
410
- import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
411
- import path3 from "pathe";
412
- async function regenerateApiDoc(projectRoot, docsDir) {
413
- try {
414
- const dude = await import("@cubocicloide/dude");
415
- if (typeof dude.generateApiDoc !== "function") return;
416
- const md = await dude.generateApiDoc(projectRoot, "md");
417
- writeFileSync2(path3.join(docsDir, "docs", "api.md"), md);
418
- process.stdout.write("[docs] Regenerated docs/api.md from the live command catalog.\n");
419
- } catch (e) {
420
- process.stderr.write(
421
- `[docs] Could not regenerate api.md (${e.message}); using the existing file.
422
- `
423
- );
424
- }
425
- }
426
- function isDockerRunning() {
427
- const r = spawnSync2("docker", ["info"], { stdio: "ignore" });
428
- return r.error == null && r.status === 0;
429
- }
430
- function openBrowser(url) {
431
- if (process.platform === "win32") {
432
- spawnSync2("cmd", ["/c", "start", "", url], { stdio: "ignore" });
433
- return;
434
- }
435
- const opener = process.platform === "darwin" ? "open" : "xdg-open";
436
- spawnSync2(opener, [url], { stdio: "ignore" });
437
- }
438
- var docsCommand = {
439
- description: "Serve the project documentation in dev mode (live-reload) at http://localhost:8001.",
440
- args: {
441
- port: {
442
- type: "string",
443
- description: "Host port to expose the docs site on (default: 8001).",
444
- default: "8001"
445
- }
446
- },
447
- async run({ projectRoot, args }) {
448
- const docsDir = path3.join(projectRoot, "docs");
449
- const port = String(args.port ?? "8001");
450
- const url = `http://localhost:${port}`;
451
- if (!existsSync3(docsDir)) {
452
- process.stderr.write(
453
- "[docs] No docs/ folder found in the project root. Make sure you ran `dude init`.\n"
454
- );
455
- process.exit(1);
456
- }
457
- await regenerateApiDoc(projectRoot, docsDir);
458
- if (!isDockerRunning()) {
459
- process.stderr.write("[docs] Docker is not running. Start Docker Desktop and retry.\n");
460
- process.exit(1);
461
- }
462
- process.stdout.write(`[docs] Starting MkDocs at ${url} (Ctrl+C to stop)
463
- `);
464
- const child = spawn(
465
- "docker",
466
- [
467
- "run",
468
- "--rm",
469
- "-i",
470
- "-p",
471
- `${port}:8000`,
472
- "-v",
473
- `${docsDir}:/docs`,
474
- "squidfunk/mkdocs-material",
475
- "serve",
476
- "--dev-addr=0.0.0.0:8000"
477
- ],
478
- { stdio: ["inherit", "pipe", "pipe"] }
479
- );
480
- if (child.pid == null) {
481
- process.stderr.write("[docs] Failed to start Docker container.\n");
482
- process.exit(1);
483
- }
484
- let browserOpened = false;
485
- function watchChunk(chunk) {
486
- if (!browserOpened && chunk.toString().includes("Serving on")) {
487
- browserOpened = true;
488
- process.stdout.write(`[docs] Opening ${url}
489
- `);
490
- openBrowser(url);
491
- }
492
- }
493
- child.stdout?.on("data", (chunk) => {
494
- process.stdout.write(chunk);
495
- watchChunk(chunk);
496
- });
497
- child.stderr?.on("data", (chunk) => {
498
- process.stderr.write(chunk);
499
- watchChunk(chunk);
500
- });
501
- await new Promise((resolve) => child.on("close", resolve));
502
- }
503
- };
504
-
505
408
  // src/commands/iac/providers/aws-eks/lib/terraform.ts
506
- import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync4 } from "fs";
507
- import path6 from "pathe";
409
+ import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync4 } from "fs";
410
+ import path5 from "pathe";
508
411
 
509
412
  // src/commands/iac/shared.ts
510
- import { spawnSync as spawnSync3 } from "child_process";
413
+ import { spawnSync as spawnSync2 } from "child_process";
511
414
  import { readFileSync as readFileSync2 } from "fs";
512
- import path4 from "pathe";
415
+ import path3 from "pathe";
513
416
  function shouldUseShell() {
514
417
  return process.platform === "win32";
515
418
  }
@@ -517,7 +420,7 @@ function childEnv(profile) {
517
420
  return profile ? { ...process.env, AWS_PROFILE: profile } : process.env;
518
421
  }
519
422
  function run(cmd, args, cwd, profile) {
520
- const r = spawnSync3(cmd, args, {
423
+ const r = spawnSync2(cmd, args, {
521
424
  cwd,
522
425
  stdio: "inherit",
523
426
  env: childEnv(profile),
@@ -541,7 +444,7 @@ function run(cmd, args, cwd, profile) {
541
444
  return r.status ?? 1;
542
445
  }
543
446
  function capture(cmd, args, cwd, profile) {
544
- const r = spawnSync3(cmd, args, {
447
+ const r = spawnSync2(cmd, args, {
545
448
  cwd,
546
449
  encoding: "utf8",
547
450
  env: childEnv(profile),
@@ -557,7 +460,7 @@ function textTokens(stdout) {
557
460
  }
558
461
  function readAnswers(projectRoot) {
559
462
  try {
560
- const j = JSON.parse(readFileSync2(path4.join(projectRoot, "dude.json"), "utf8"));
463
+ const j = JSON.parse(readFileSync2(path3.join(projectRoot, "dude.json"), "utf8"));
561
464
  return j.answers ?? {};
562
465
  } catch {
563
466
  return {};
@@ -573,22 +476,22 @@ function hclScalar(text, key) {
573
476
  }
574
477
 
575
478
  // src/commands/iac/providers/aws-eks/lib/exec.ts
576
- import { spawnSync as spawnSync5 } from "child_process";
479
+ import { spawnSync as spawnSync4 } from "child_process";
577
480
 
578
481
  // src/commands/iac/providers/aws-eks/lib/runner.ts
579
- import { spawnSync as spawnSync4 } from "child_process";
482
+ import { spawnSync as spawnSync3 } from "child_process";
580
483
  import { createHash } from "crypto";
581
- import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
484
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
582
485
  import os from "os";
583
- import path5 from "pathe";
584
- var RUNNER_DOCKERFILE = path5.join("iac", "runner", "Dockerfile");
486
+ import path4 from "pathe";
487
+ var RUNNER_DOCKERFILE = path4.join("iac", "runner", "Dockerfile");
585
488
  var CONTAINERIZED = /* @__PURE__ */ new Set(["terraform", "kubectl", "helm", "k9s"]);
586
489
  function findDockerfile(cwd) {
587
- let dir = path5.resolve(cwd);
490
+ let dir = path4.resolve(cwd);
588
491
  for (; ; ) {
589
- const candidate = path5.join(dir, RUNNER_DOCKERFILE);
590
- if (existsSync4(candidate)) return candidate;
591
- const parent = path5.dirname(dir);
492
+ const candidate = path4.join(dir, RUNNER_DOCKERFILE);
493
+ if (existsSync3(candidate)) return candidate;
494
+ const parent = path4.dirname(dir);
592
495
  if (parent === dir) return "";
593
496
  dir = parent;
594
497
  }
@@ -601,7 +504,7 @@ var dockerChecked;
601
504
  var ensured = /* @__PURE__ */ new Set();
602
505
  function dockerAvailable() {
603
506
  if (dockerChecked !== void 0) return dockerChecked;
604
- const r = spawnSync4("docker", ["version", "--format", "{{.Server.Version}}"], {
507
+ const r = spawnSync3("docker", ["version", "--format", "{{.Server.Version}}"], {
605
508
  encoding: "utf8"
606
509
  });
607
510
  dockerChecked = r.status === 0 && !!r.stdout.trim();
@@ -613,7 +516,7 @@ function useRunner(cwd) {
613
516
  }
614
517
  function ensureImage(dockerfile, tag) {
615
518
  if (ensured.has(tag)) return;
616
- const exists = spawnSync4("docker", ["image", "inspect", tag], { stdio: "ignore" }).status === 0;
519
+ const exists = spawnSync3("docker", ["image", "inspect", tag], { stdio: "ignore" }).status === 0;
617
520
  if (!exists) {
618
521
  process.stderr.write(
619
522
  `
@@ -621,9 +524,9 @@ function ensureImage(dockerfile, tag) {
621
524
 
622
525
  `
623
526
  );
624
- const build = spawnSync4(
527
+ const build = spawnSync3(
625
528
  "docker",
626
- ["build", "-t", tag, "-f", dockerfile, path5.dirname(dockerfile)],
529
+ ["build", "-t", tag, "-f", dockerfile, path4.dirname(dockerfile)],
627
530
  { stdio: "inherit" }
628
531
  );
629
532
  if (build.status !== 0) {
@@ -637,9 +540,9 @@ function baseDockerArgs(cwd, profile, tty) {
637
540
  const args = ["run", "--rm", tty ? "-it" : "-i"];
638
541
  args.push("-v", `${cwd}:/work`, "-w", "/work");
639
542
  const home = os.homedir();
640
- args.push("-v", `${path5.join(home, ".aws")}:/root/.aws:ro`);
641
- const kube = path5.join(home, ".kube");
642
- if (existsSync4(kube)) args.push("-v", `${kube}:/root/.kube:ro`);
543
+ args.push("-v", `${path4.join(home, ".aws")}:/root/.aws:ro`);
544
+ const kube = path4.join(home, ".kube");
545
+ if (existsSync3(kube)) args.push("-v", `${kube}:/root/.kube:ro`);
643
546
  if (profile) args.push("-e", `AWS_PROFILE=${profile}`);
644
547
  return args;
645
548
  }
@@ -693,7 +596,7 @@ function routed(cmd, cwd) {
693
596
  function run2(cmd, args, cwd, profile, kube) {
694
597
  if (!routed(cmd, cwd)) return run(cmd, args, cwd, profile);
695
598
  const dargs = dockerRunArgs(cmd, args, cwd, profile, { tty: !!process.stdin.isTTY, kube });
696
- const r = spawnSync5("docker", dargs, { stdio: "inherit" });
599
+ const r = spawnSync4("docker", dargs, { stdio: "inherit" });
697
600
  if (r.error) {
698
601
  process.stderr.write(`
699
602
  \u2717 failed to run docker: ${r.error.message}
@@ -706,17 +609,17 @@ function run2(cmd, args, cwd, profile, kube) {
706
609
  function capture2(cmd, args, cwd, profile, kube) {
707
610
  if (!routed(cmd, cwd)) return capture(cmd, args, cwd, profile);
708
611
  const dargs = dockerRunArgs(cmd, args, cwd, profile, { tty: false, kube });
709
- const r = spawnSync5("docker", dargs, { encoding: "utf8" });
612
+ const r = spawnSync4("docker", dargs, { encoding: "utf8" });
710
613
  return { status: r.status ?? 1, stdout: r.stdout ?? "" };
711
614
  }
712
615
 
713
616
  // src/commands/iac/providers/aws-eks/lib/terraform.ts
714
- var TF_DIR = path6.join("iac", "terraform");
715
- var TF_BOOTSTRAP_DIR = path6.join(TF_DIR, "bootstrap");
716
- var TF_ENVIRONMENTS_DIR = path6.join(TF_DIR, "environments");
717
- var HELM_CHART = path6.join("iac", "helm", "app");
617
+ var TF_DIR = path5.join("iac", "terraform");
618
+ var TF_BOOTSTRAP_DIR = path5.join(TF_DIR, "bootstrap");
619
+ var TF_ENVIRONMENTS_DIR = path5.join(TF_DIR, "environments");
620
+ var HELM_CHART = path5.join("iac", "helm", "app");
718
621
  function hasIac(projectRoot) {
719
- return existsSync5(path6.join(projectRoot, "iac", "terraform"));
622
+ return existsSync4(path5.join(projectRoot, "iac", "terraform"));
720
623
  }
721
624
  function requireIac(projectRoot) {
722
625
  if (!hasIac(projectRoot)) {
@@ -742,10 +645,10 @@ function varFile(env) {
742
645
  return `-var-file=environments/${env}/terraform.tfvars`;
743
646
  }
744
647
  function tfBoot(projectRoot, args, profile) {
745
- return run2("terraform", args, path6.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
648
+ return run2("terraform", args, path5.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
746
649
  }
747
650
  function captureBootstrap(projectRoot, args, profile) {
748
- return capture2("terraform", args, path6.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
651
+ return capture2("terraform", args, path5.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
749
652
  }
750
653
  function resolveProfile(projectRoot, args, env) {
751
654
  if (args.profile) return String(args.profile);
@@ -762,7 +665,7 @@ function kubeTarget(projectRoot, env, namespace) {
762
665
  function tfvarsValue(projectRoot, env, key) {
763
666
  try {
764
667
  return hclScalar(
765
- readFileSync4(path6.join(projectRoot, TF_DIR, "environments", env, "terraform.tfvars"), "utf8"),
668
+ readFileSync4(path5.join(projectRoot, TF_DIR, "environments", env, "terraform.tfvars"), "utf8"),
766
669
  key
767
670
  );
768
671
  } catch {
@@ -772,7 +675,7 @@ function tfvarsValue(projectRoot, env, key) {
772
675
  function readBackend(projectRoot, env) {
773
676
  try {
774
677
  const txt = readFileSync4(
775
- path6.join(projectRoot, TF_DIR, "environments", env, "backend.hcl"),
678
+ path5.join(projectRoot, TF_DIR, "environments", env, "backend.hcl"),
776
679
  "utf8"
777
680
  );
778
681
  return {
@@ -796,10 +699,10 @@ var envArg = {
796
699
  }
797
700
  };
798
701
  function listEnvironments(projectRoot) {
799
- const base = path6.join(projectRoot, TF_ENVIRONMENTS_DIR);
702
+ const base = path5.join(projectRoot, TF_ENVIRONMENTS_DIR);
800
703
  try {
801
704
  return readdirSync2(base, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).filter(
802
- (name) => existsSync5(path6.join(base, name, "backend.hcl")) && existsSync5(path6.join(base, name, "terraform.tfvars"))
705
+ (name) => existsSync4(path5.join(base, name, "backend.hcl")) && existsSync4(path5.join(base, name, "terraform.tfvars"))
803
706
  ).sort();
804
707
  } catch {
805
708
  return [];
@@ -860,8 +763,8 @@ var iacApplyCommand = {
860
763
  };
861
764
 
862
765
  // src/commands/iac/providers/aws-eks/commands/bootstrap/index.ts
863
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
864
- import path7 from "pathe";
766
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
767
+ import path6 from "pathe";
865
768
  var iacBootstrapCommand = {
866
769
  available: hasIac,
867
770
  description: "One-time: create the S3 state bucket + DynamoDB lock table, then write the values into backend.hcl.",
@@ -944,12 +847,12 @@ var iacBootstrapCommand = {
944
847
  process.stderr.write("\n \u2717 Bootstrap outputs `state_bucket` / `lock_table` not found.\n\n");
945
848
  process.exit(1);
946
849
  }
947
- const backendHclPath = path7.join(projectRoot, TF_DIR, "environments", env, "backend.hcl");
850
+ const backendHclPath = path6.join(projectRoot, TF_DIR, "environments", env, "backend.hcl");
948
851
  try {
949
852
  let hcl = readFileSync5(backendHclPath, "utf8");
950
853
  hcl = hcl.replace(/^bucket\s*=\s*".*"$/m, `bucket = "${stateBucket}"`);
951
854
  hcl = hcl.replace(/^dynamodb_table\s*=\s*".*"$/m, `dynamodb_table = "${lockTable}"`);
952
- writeFileSync3(backendHclPath, hcl);
855
+ writeFileSync2(backendHclPath, hcl);
953
856
  } catch {
954
857
  process.stderr.write(`
955
858
  \u2717 Could not update ${backendHclPath}.
@@ -972,9 +875,9 @@ var iacBootstrapCommand = {
972
875
  };
973
876
 
974
877
  // src/commands/iac/providers/aws-eks/lib/images.ts
975
- import { spawnSync as spawnSync6 } from "child_process";
976
- import { existsSync as existsSync6 } from "fs";
977
- import path8 from "pathe";
878
+ import { spawnSync as spawnSync5 } from "child_process";
879
+ import { existsSync as existsSync5 } from "fs";
880
+ import path7 from "pathe";
978
881
  var tagArg = {
979
882
  tag: {
980
883
  type: "string",
@@ -1049,7 +952,7 @@ function dockerLogin(host, region, projectRoot, profile) {
1049
952
  process.stderr.write("\n \u2717 Could not obtain an ECR login password (check your AWS auth).\n\n");
1050
953
  return 1;
1051
954
  }
1052
- const r = spawnSync6("docker", ["login", "--username", "AWS", "--password-stdin", host], {
955
+ const r = spawnSync5("docker", ["login", "--username", "AWS", "--password-stdin", host], {
1053
956
  cwd: projectRoot,
1054
957
  input: pw.stdout.trim(),
1055
958
  stdio: ["pipe", "inherit", "inherit"],
@@ -1123,8 +1026,8 @@ function doDeploy(projectRoot, profile, env, ns, tag, repos) {
1123
1026
  ns,
1124
1027
  "--create-namespace"
1125
1028
  ];
1126
- const valuesFile = path8.join(HELM_CHART, `values-${env}.yaml`);
1127
- if (existsSync6(path8.join(projectRoot, valuesFile))) helmArgs.push("--values", valuesFile);
1029
+ const valuesFile = path7.join(HELM_CHART, `values-${env}.yaml`);
1030
+ if (existsSync5(path7.join(projectRoot, valuesFile))) helmArgs.push("--values", valuesFile);
1128
1031
  helmArgs.push(
1129
1032
  "--set",
1130
1033
  `image.registry=${repos.registryHost}`,
@@ -1760,8 +1663,8 @@ var iacLoginCommand = {
1760
1663
  };
1761
1664
 
1762
1665
  // src/commands/iac/providers/aws-eks/commands/new-env/index.ts
1763
- import { cpSync, existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
1764
- import path9 from "pathe";
1666
+ import { cpSync, existsSync as existsSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
1667
+ import path8 from "pathe";
1765
1668
  var iacNewEnvCommand = {
1766
1669
  available: hasIac,
1767
1670
  description: "Scaffold a new environment (iac/terraform/environments/<name>) by copying an existing one.",
@@ -1812,26 +1715,26 @@ var iacNewEnvCommand = {
1812
1715
  `);
1813
1716
  process.exit(1);
1814
1717
  }
1815
- const base = path9.join(projectRoot, TF_ENVIRONMENTS_DIR);
1816
- const dst = path9.join(base, name);
1817
- cpSync(path9.join(base, from), dst, { recursive: true });
1818
- const tfvarsPath = path9.join(dst, "terraform.tfvars");
1819
- writeFileSync4(
1718
+ const base = path8.join(projectRoot, TF_ENVIRONMENTS_DIR);
1719
+ const dst = path8.join(base, name);
1720
+ cpSync(path8.join(base, from), dst, { recursive: true });
1721
+ const tfvarsPath = path8.join(dst, "terraform.tfvars");
1722
+ writeFileSync3(
1820
1723
  tfvarsPath,
1821
1724
  readFileSync6(tfvarsPath, "utf8").replace(/^(\s*environment\s*=\s*).*$/m, `$1"${name}"`)
1822
1725
  );
1823
- const backendPath = path9.join(dst, "backend.hcl");
1824
- writeFileSync4(
1726
+ const backendPath = path8.join(dst, "backend.hcl");
1727
+ writeFileSync3(
1825
1728
  backendPath,
1826
1729
  readFileSync6(backendPath, "utf8").replace(
1827
1730
  /^(\s*key\s*=\s*).*$/m,
1828
1731
  `$1"${projectName(projectRoot)}/${name}/terraform.tfstate"`
1829
1732
  )
1830
1733
  );
1831
- const fromValues = path9.join(projectRoot, HELM_CHART, `values-${from}.yaml`);
1832
- const copiedValues = existsSync7(fromValues);
1734
+ const fromValues = path8.join(projectRoot, HELM_CHART, `values-${from}.yaml`);
1735
+ const copiedValues = existsSync6(fromValues);
1833
1736
  if (copiedValues) {
1834
- cpSync(fromValues, path9.join(projectRoot, HELM_CHART, `values-${name}.yaml`));
1737
+ cpSync(fromValues, path8.join(projectRoot, HELM_CHART, `values-${name}.yaml`));
1835
1738
  }
1836
1739
  const valuesLine = copiedValues ? ` ${HELM_CHART}/values-${name}.yaml (per-env Helm overrides + secrets \u2014 gitignored)
1837
1740
  ` : ` (no ${HELM_CHART}/values-${from}.yaml on disk \u2014 the new env will use the base
@@ -1903,7 +1806,7 @@ var iacPushCommand = {
1903
1806
  };
1904
1807
 
1905
1808
  // src/commands/iac/providers/aws-eks/commands/shell/index.ts
1906
- import { spawnSync as spawnSync7 } from "child_process";
1809
+ import { spawnSync as spawnSync6 } from "child_process";
1907
1810
  var iacShellCommand = {
1908
1811
  available: hasIac,
1909
1812
  description: "Open an interactive shell in the IaC runner container (terraform, kubectl, helm, k9s, aws) scoped to an environment.",
@@ -1937,7 +1840,7 @@ var iacShellCommand = {
1937
1840
 
1938
1841
  `
1939
1842
  );
1940
- const r = spawnSync7(
1843
+ const r = spawnSync6(
1941
1844
  "docker",
1942
1845
  dockerShellArgs(projectRoot, profile, { cluster, region, namespace: env }),
1943
1846
  { stdio: "inherit", cwd: projectRoot }
@@ -2047,9 +1950,9 @@ var provider = activeIacProvider() ?? iacProviders[0];
2047
1950
  var iacCommands = provider?.commands ?? {};
2048
1951
 
2049
1952
  // src/commands/_docker.ts
2050
- import { spawnSync as spawnSync8 } from "child_process";
1953
+ import { spawnSync as spawnSync7 } from "child_process";
2051
1954
  function dc(args) {
2052
- const result = spawnSync8("docker", ["compose", ...args], { stdio: "inherit" });
1955
+ const result = spawnSync7("docker", ["compose", ...args], { stdio: "inherit" });
2053
1956
  process.exit(result.status ?? 0);
2054
1957
  }
2055
1958
 
@@ -2063,18 +1966,18 @@ var downCommand = {
2063
1966
  };
2064
1967
 
2065
1968
  // src/commands/format/index.ts
2066
- import { spawnSync as spawnSync9 } from "child_process";
2067
- import { existsSync as existsSync8 } from "fs";
2068
- import path10 from "pathe";
1969
+ import { spawnSync as spawnSync8 } from "child_process";
1970
+ import { existsSync as existsSync7 } from "fs";
1971
+ import path9 from "pathe";
2069
1972
  function shouldUseShell2() {
2070
1973
  return process.platform === "win32";
2071
1974
  }
2072
1975
  function isAvailable(cmd) {
2073
- const r = spawnSync9(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell2() });
1976
+ const r = spawnSync8(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell2() });
2074
1977
  return r.error == null;
2075
1978
  }
2076
1979
  function exec(cmd, args, cwd) {
2077
- const result = spawnSync9(cmd, args, { cwd, stdio: "inherit", shell: shouldUseShell2() });
1980
+ const result = spawnSync8(cmd, args, { cwd, stdio: "inherit", shell: shouldUseShell2() });
2078
1981
  if (result.error) {
2079
1982
  process.stderr.write(`error: failed to run ${cmd}: ${result.error.message}
2080
1983
  `);
@@ -2083,12 +1986,12 @@ function exec(cmd, args, cwd) {
2083
1986
  return result.status === 0;
2084
1987
  }
2085
1988
  function hasLocalExecutable(dir, executable) {
2086
- const localBin = path10.join(dir, "node_modules", ".bin", executable);
2087
- return existsSync8(localBin);
1989
+ const localBin = path9.join(dir, "node_modules", ".bin", executable);
1990
+ return existsSync7(localBin);
2088
1991
  }
2089
1992
  function ensureNodeModules(dir, executable) {
2090
- const nodeModulesDir = path10.join(dir, "node_modules");
2091
- const hasDeps = existsSync8(nodeModulesDir);
1993
+ const nodeModulesDir = path9.join(dir, "node_modules");
1994
+ const hasDeps = existsSync7(nodeModulesDir);
2092
1995
  const hasExecutable = executable == null || hasLocalExecutable(dir, executable);
2093
1996
  if (hasDeps && hasExecutable) return true;
2094
1997
  process.stdout.write(
@@ -2098,13 +2001,13 @@ function ensureNodeModules(dir, executable) {
2098
2001
  return exec("npm", ["install", "--prefix", dir, "--silent"], dir);
2099
2002
  }
2100
2003
  function ensureVenv(dir) {
2101
- const venvRuff = path10.join(dir, ".venv", "bin", "ruff");
2102
- if (existsSync8(venvRuff)) return true;
2004
+ const venvRuff = path9.join(dir, ".venv", "bin", "ruff");
2005
+ if (existsSync7(venvRuff)) return true;
2103
2006
  process.stdout.write(".venv not found \u2014 running uv sync\u2026\n");
2104
2007
  return exec("uv", ["sync"], dir);
2105
2008
  }
2106
2009
  function isDockerServiceRunning(service, cwd) {
2107
- const r = spawnSync9("docker", ["compose", "ps", "--status", "running", "-q", service], {
2010
+ const r = spawnSync8("docker", ["compose", "ps", "--status", "running", "-q", service], {
2108
2011
  stdio: "pipe",
2109
2012
  cwd
2110
2013
  });
@@ -2121,15 +2024,15 @@ var formatCommand = {
2121
2024
  },
2122
2025
  async run({ projectRoot, args }) {
2123
2026
  const check = Boolean(args.check);
2124
- const backendDir = path10.join(projectRoot, "backend");
2125
- const frontendDir = path10.join(projectRoot, "frontend");
2126
- const e2eDir = path10.join(projectRoot, "e2e");
2127
- const backendExists = existsSync8(backendDir);
2027
+ const backendDir = path9.join(projectRoot, "backend");
2028
+ const frontendDir = path9.join(projectRoot, "frontend");
2029
+ const e2eDir = path9.join(projectRoot, "e2e");
2030
+ const backendExists = existsSync7(backendDir);
2128
2031
  const backendContainerUp = backendExists && isDockerServiceRunning("backend", projectRoot);
2129
2032
  const missing = [];
2130
2033
  if (backendExists && !backendContainerUp && !isAvailable("uv"))
2131
2034
  missing.push("uv \u2192 https://docs.astral.sh/uv/getting-started/installation/");
2132
- if ((existsSync8(frontendDir) || existsSync8(e2eDir)) && !isAvailable("pnpm"))
2035
+ if ((existsSync7(frontendDir) || existsSync7(e2eDir)) && !isAvailable("pnpm"))
2133
2036
  missing.push("pnpm \u2192 https://pnpm.io/installation");
2134
2037
  if (missing.length > 0) {
2135
2038
  process.stderr.write(
@@ -2192,26 +2095,26 @@ var formatCommand = {
2192
2095
  }
2193
2096
  }
2194
2097
  }
2195
- if (existsSync8(frontendDir)) {
2098
+ if (existsSync7(frontendDir)) {
2196
2099
  process.stdout.write(check ? "Checking frontend formatting\u2026\n" : "Formatting frontend\u2026\n");
2197
- const prettierBin = path10.join(frontendDir, "node_modules", ".bin", "prettier");
2198
- if (!existsSync8(prettierBin)) {
2100
+ const prettierBin = path9.join(frontendDir, "node_modules", ".bin", "prettier");
2101
+ if (!existsSync7(prettierBin)) {
2199
2102
  ensureNodeModules(frontendDir, "prettier");
2200
2103
  }
2201
- if (!existsSync8(prettierBin)) {
2104
+ if (!existsSync7(prettierBin)) {
2202
2105
  process.stderr.write(" prettier not found \u2014 run: cd frontend && npm install\n");
2203
2106
  ok = false;
2204
2107
  } else {
2205
2108
  ok = exec(prettierBin, [...check ? ["--check"] : ["--write"], "src/"], frontendDir) && ok;
2206
2109
  }
2207
2110
  }
2208
- if (existsSync8(e2eDir)) {
2111
+ if (existsSync7(e2eDir)) {
2209
2112
  process.stdout.write(check ? "Checking e2e formatting\u2026\n" : "Formatting e2e\u2026\n");
2210
- const prettierBin = path10.join(e2eDir, "node_modules", ".bin", "prettier");
2211
- if (!existsSync8(prettierBin)) {
2113
+ const prettierBin = path9.join(e2eDir, "node_modules", ".bin", "prettier");
2114
+ if (!existsSync7(prettierBin)) {
2212
2115
  ensureNodeModules(e2eDir, "prettier");
2213
2116
  }
2214
- if (!existsSync8(prettierBin)) {
2117
+ if (!existsSync7(prettierBin)) {
2215
2118
  process.stderr.write(" prettier not found \u2014 run: cd e2e && npm install\n");
2216
2119
  ok = false;
2217
2120
  } else {
@@ -2252,19 +2155,19 @@ var logsCommand = {
2252
2155
  };
2253
2156
 
2254
2157
  // src/commands/review/index.ts
2255
- import { spawnSync as spawnSync10 } from "child_process";
2256
- import { existsSync as existsSync9 } from "fs";
2257
- import path11 from "pathe";
2158
+ import { spawnSync as spawnSync9 } from "child_process";
2159
+ import { existsSync as existsSync8 } from "fs";
2160
+ import path10 from "pathe";
2258
2161
  import { runLint, formatDiagnostic } from "@cubocicloide/dude";
2259
2162
  function shouldUseShell3() {
2260
2163
  return process.platform === "win32";
2261
2164
  }
2262
2165
  function isAvailable2(cmd) {
2263
- const r = spawnSync10(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell3() });
2166
+ const r = spawnSync9(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell3() });
2264
2167
  return r.error == null;
2265
2168
  }
2266
2169
  function exec2(cmd, args, cwd) {
2267
- const r = spawnSync10(cmd, args, { cwd, stdio: "inherit", shell: shouldUseShell3() });
2170
+ const r = spawnSync9(cmd, args, { cwd, stdio: "inherit", shell: shouldUseShell3() });
2268
2171
  if (r.error) {
2269
2172
  process.stderr.write(`error: failed to run ${cmd}: ${r.error.message}
2270
2173
  `);
@@ -2285,12 +2188,12 @@ ${header}
2285
2188
  var reviewCommand2 = {
2286
2189
  description: "Run all checks: custom lint, ESLint, and API contract review.",
2287
2190
  async run({ projectRoot, stackRoot }) {
2288
- const frontendDir = path11.join(projectRoot, "frontend");
2289
- const e2eDir = path11.join(projectRoot, "e2e");
2191
+ const frontendDir = path10.join(projectRoot, "frontend");
2192
+ const e2eDir = path10.join(projectRoot, "e2e");
2290
2193
  const isTTY = process.stdout.isTTY;
2291
2194
  let ok = true;
2292
2195
  const missing = [];
2293
- if ((existsSync9(frontendDir) || existsSync9(e2eDir)) && !isAvailable2("pnpm"))
2196
+ if ((existsSync8(frontendDir) || existsSync8(e2eDir)) && !isAvailable2("pnpm"))
2294
2197
  missing.push("pnpm \u2192 https://pnpm.io/installation");
2295
2198
  if (missing.length > 0) {
2296
2199
  process.stderr.write("error: required tools not found on your PATH:\n\n");
@@ -2310,20 +2213,20 @@ var reviewCommand2 = {
2310
2213
  }
2311
2214
  }
2312
2215
  ok = errorCount === 0 && ok;
2313
- if (existsSync9(frontendDir)) {
2216
+ if (existsSync8(frontendDir)) {
2314
2217
  section("eslint");
2315
- const eslintBin = path11.join(frontendDir, "node_modules", ".bin", "eslint");
2316
- if (!existsSync9(eslintBin)) {
2218
+ const eslintBin = path10.join(frontendDir, "node_modules", ".bin", "eslint");
2219
+ if (!existsSync8(eslintBin)) {
2317
2220
  process.stderr.write(" eslint not found \u2014 run: cd frontend && pnpm install\n");
2318
2221
  ok = false;
2319
2222
  } else {
2320
2223
  ok = exec2(eslintBin, ["src/"], frontendDir) && ok;
2321
2224
  }
2322
2225
  }
2323
- if (existsSync9(e2eDir)) {
2226
+ if (existsSync8(e2eDir)) {
2324
2227
  section("eslint (e2e)");
2325
- const eslintBin = path11.join(e2eDir, "node_modules", ".bin", "eslint");
2326
- if (!existsSync9(eslintBin)) {
2228
+ const eslintBin = path10.join(e2eDir, "node_modules", ".bin", "eslint");
2229
+ if (!existsSync8(eslintBin)) {
2327
2230
  process.stderr.write(" eslint not found \u2014 run: cd e2e && pnpm install\n");
2328
2231
  ok = false;
2329
2232
  } else {
@@ -2343,9 +2246,9 @@ var reviewCommand2 = {
2343
2246
  };
2344
2247
 
2345
2248
  // src/commands/security/index.ts
2346
- import { spawnSync as spawnSync11 } from "child_process";
2347
- import { cpSync as cpSync2, existsSync as existsSync11, mkdirSync as mkdirSync3, readFileSync as readFileSync8, rmSync, writeFileSync as writeFileSync6 } from "fs";
2348
- import path14 from "pathe";
2249
+ import { spawnSync as spawnSync10 } from "child_process";
2250
+ import { cpSync as cpSync2, existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync8, rmSync, writeFileSync as writeFileSync5 } from "fs";
2251
+ import path13 from "pathe";
2349
2252
 
2350
2253
  // src/commands/security/models.ts
2351
2254
  import { createHash as createHash2 } from "crypto";
@@ -2377,15 +2280,15 @@ function findingToRecord(f) {
2377
2280
  }
2378
2281
 
2379
2282
  // src/commands/security/baseline.ts
2380
- import { existsSync as existsSync10, readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "fs";
2381
- import path12 from "pathe";
2283
+ import { existsSync as existsSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync2 } from "fs";
2284
+ import path11 from "pathe";
2382
2285
  var Baseline = class _Baseline {
2383
2286
  constructor(entries = /* @__PURE__ */ new Map()) {
2384
2287
  this.entries = entries;
2385
2288
  }
2386
2289
  entries;
2387
2290
  static load(filePath) {
2388
- if (!existsSync10(filePath)) return new _Baseline();
2291
+ if (!existsSync9(filePath)) return new _Baseline();
2389
2292
  const raw = readFileSync7(filePath, "utf8") || "{}";
2390
2293
  const data = JSON.parse(raw);
2391
2294
  const entries = /* @__PURE__ */ new Map();
@@ -2404,7 +2307,7 @@ var Baseline = class _Baseline {
2404
2307
  return new _Baseline(entries);
2405
2308
  }
2406
2309
  save(filePath) {
2407
- mkdirSync2(path12.dirname(filePath), { recursive: true });
2310
+ mkdirSync2(path11.dirname(filePath), { recursive: true });
2408
2311
  const sorted = [...this.entries.entries()].sort(([a], [b]) => a.localeCompare(b));
2409
2312
  const payload = {
2410
2313
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2423,7 +2326,7 @@ var Baseline = class _Baseline {
2423
2326
  ])
2424
2327
  )
2425
2328
  };
2426
- writeFileSync5(filePath, JSON.stringify(payload, null, 2) + "\n");
2329
+ writeFileSync4(filePath, JSON.stringify(payload, null, 2) + "\n");
2427
2330
  }
2428
2331
  updateFrom(findings) {
2429
2332
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -2452,9 +2355,9 @@ var Baseline = class _Baseline {
2452
2355
  };
2453
2356
 
2454
2357
  // src/commands/security/adapters.ts
2455
- import path13 from "pathe";
2358
+ import path12 from "pathe";
2456
2359
  function reportInContainer(projectRoot, runDir, name) {
2457
- return `/src/${path13.relative(projectRoot, path13.join(runDir, `${name}.json`))}`;
2360
+ return `/src/${path12.relative(projectRoot, path12.join(runDir, `${name}.json`))}`;
2458
2361
  }
2459
2362
  var BANDIT_SEV = {
2460
2363
  UNDEFINED: 0 /* UNKNOWN */,
@@ -2823,7 +2726,7 @@ function parseSeverityArg(value, fallback) {
2823
2726
  return map[value.trim().toUpperCase()] ?? fallback;
2824
2727
  }
2825
2728
  function ensureDocker() {
2826
- const r = spawnSync11("docker", ["info"], { stdio: "ignore" });
2729
+ const r = spawnSync10("docker", ["info"], { stdio: "ignore" });
2827
2730
  if (r.error != null || r.status !== 0) {
2828
2731
  process.stderr.write(
2829
2732
  "[security] docker is required but is not available or the daemon is not running.\n"
@@ -2837,13 +2740,13 @@ function truncate(text) {
2837
2740
  return cleaned.length > MAX_MESSAGE_LEN ? cleaned.slice(0, MAX_MESSAGE_LEN - 1) + "\u2026" : cleaned;
2838
2741
  }
2839
2742
  function writeFindingsJson(findings, filePath) {
2840
- mkdirSync3(path14.dirname(filePath), { recursive: true });
2743
+ mkdirSync3(path13.dirname(filePath), { recursive: true });
2841
2744
  const payload = {
2842
2745
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
2843
2746
  count: findings.length,
2844
2747
  findings: findings.map(findingToRecord)
2845
2748
  };
2846
- writeFileSync6(filePath, JSON.stringify(payload, null, 2) + "\n");
2749
+ writeFileSync5(filePath, JSON.stringify(payload, null, 2) + "\n");
2847
2750
  }
2848
2751
  function writeMarkdownSummary(newFindings, knownFindings, resolved, filePath, minSeverity) {
2849
2752
  const lines = [];
@@ -2911,18 +2814,18 @@ function writeMarkdownSummary(newFindings, knownFindings, resolved, filePath, mi
2911
2814
  for (const fp of resolved.slice(0, 50)) lines.push(`- \`${fp}\``);
2912
2815
  if (resolved.length > 50) lines.push(`- \u2026 and ${resolved.length - 50} more`);
2913
2816
  }
2914
- mkdirSync3(path14.dirname(filePath), { recursive: true });
2915
- writeFileSync6(filePath, lines.join("\n").trimEnd() + "\n");
2817
+ mkdirSync3(path13.dirname(filePath), { recursive: true });
2818
+ writeFileSync5(filePath, lines.join("\n").trimEnd() + "\n");
2916
2819
  }
2917
2820
  function runScan(config) {
2918
2821
  ensureDocker();
2919
2822
  const now = /* @__PURE__ */ new Date();
2920
2823
  const pad = (n) => String(n).padStart(2, "0");
2921
2824
  const timestamp = `${now.getUTCFullYear()}${pad(now.getUTCMonth() + 1)}${pad(now.getUTCDate())}T${pad(now.getUTCHours())}${pad(now.getUTCMinutes())}${pad(now.getUTCSeconds())}Z`;
2922
- const runDir = path14.join(config.reportsRoot, timestamp);
2923
- const latestDir = path14.join(config.reportsRoot, "latest");
2825
+ const runDir = path13.join(config.reportsRoot, timestamp);
2826
+ const latestDir = path13.join(config.reportsRoot, "latest");
2924
2827
  mkdirSync3(runDir, { recursive: true });
2925
- const cachePrefix = path14.basename(config.projectRoot);
2828
+ const cachePrefix = path13.basename(config.projectRoot);
2926
2829
  const opts = { cachePrefix };
2927
2830
  const findings = [];
2928
2831
  for (const name of config.adapterNames) {
@@ -2938,12 +2841,12 @@ function runScan(config) {
2938
2841
  const [bin, ...cmdArgs] = cmd;
2939
2842
  process.stderr.write(`[security] running ${name}: ${cmd.join(" ")}
2940
2843
  `);
2941
- const result = spawnSync11(bin ?? "docker", cmdArgs, {
2844
+ const result = spawnSync10(bin ?? "docker", cmdArgs, {
2942
2845
  cwd: config.projectRoot,
2943
2846
  stdio: ["ignore", "pipe", "pipe"]
2944
2847
  });
2945
- const reportPath = path14.join(runDir, `${name}.json`);
2946
- if (!existsSync11(reportPath)) {
2848
+ const reportPath = path13.join(runDir, `${name}.json`);
2849
+ if (!existsSync10(reportPath)) {
2947
2850
  const stdout = result.stdout?.toString() ?? "";
2948
2851
  const stderr = result.stderr?.toString() ?? "";
2949
2852
  process.stderr.write(
@@ -2964,16 +2867,16 @@ function runScan(config) {
2964
2867
  }
2965
2868
  const baseline = Baseline.load(config.baselinePath);
2966
2869
  const { newFindings, knownFindings, resolved } = baseline.classify(findings);
2967
- writeFindingsJson(findings, path14.join(runDir, "findings.json"));
2968
- writeFindingsJson(newFindings, path14.join(runDir, "findings.new.json"));
2870
+ writeFindingsJson(findings, path13.join(runDir, "findings.json"));
2871
+ writeFindingsJson(newFindings, path13.join(runDir, "findings.new.json"));
2969
2872
  writeMarkdownSummary(
2970
2873
  newFindings,
2971
2874
  knownFindings,
2972
2875
  resolved,
2973
- path14.join(runDir, "summary.md"),
2876
+ path13.join(runDir, "summary.md"),
2974
2877
  config.minSeverity
2975
2878
  );
2976
- if (existsSync11(latestDir)) rmSync(latestDir, { recursive: true, force: true });
2879
+ if (existsSync10(latestDir)) rmSync(latestDir, { recursive: true, force: true });
2977
2880
  cpSync2(runDir, latestDir, { recursive: true });
2978
2881
  if (config.updateBaseline) {
2979
2882
  baseline.updateFrom(findings);
@@ -3017,8 +2920,8 @@ var securityScanCommand = {
3017
2920
  }
3018
2921
  },
3019
2922
  async run({ projectRoot, args }) {
3020
- const reportsRoot = path14.join(projectRoot, "private", "sast-reports");
3021
- const baselinePath = path14.join(projectRoot, "security", "baseline.json");
2923
+ const reportsRoot = path13.join(projectRoot, "private", "sast-reports");
2924
+ const baselinePath = path13.join(projectRoot, "security", "baseline.json");
3022
2925
  section2("security scan");
3023
2926
  const result = runScan({
3024
2927
  projectRoot,
@@ -3033,8 +2936,8 @@ var securityScanCommand = {
3033
2936
  `[security] done. run_dir=${result.runDir} total=${result.findings.length} new=${result.newFindings.length} known=${result.knownFindings.length} resolved=${result.resolved.length}
3034
2937
  `
3035
2938
  );
3036
- const summaryPath = path14.join(result.latestDir, "summary.md");
3037
- if (existsSync11(summaryPath)) {
2939
+ const summaryPath = path13.join(result.latestDir, "summary.md");
2940
+ if (existsSync10(summaryPath)) {
3038
2941
  process.stdout.write(readFileSync8(summaryPath, "utf8"));
3039
2942
  }
3040
2943
  if (result.exitCode !== 0) process.exit(result.exitCode);
@@ -3049,8 +2952,8 @@ var securityAcceptCommand = {
3049
2952
  }
3050
2953
  },
3051
2954
  async run({ projectRoot, args }) {
3052
- const reportsRoot = path14.join(projectRoot, "private", "sast-reports");
3053
- const baselinePath = path14.join(projectRoot, "security", "baseline.json");
2955
+ const reportsRoot = path13.join(projectRoot, "private", "sast-reports");
2956
+ const baselinePath = path13.join(projectRoot, "security", "baseline.json");
3054
2957
  section2("security accept");
3055
2958
  const result = runScan({
3056
2959
  projectRoot,
@@ -3088,8 +2991,8 @@ var securityVerifyCommand = {
3088
2991
  }
3089
2992
  },
3090
2993
  async run({ projectRoot, args }) {
3091
- const reportsRoot = path14.join(projectRoot, "private", "sast-reports");
3092
- const baselinePath = path14.join(projectRoot, "security", "baseline.json");
2994
+ const reportsRoot = path13.join(projectRoot, "private", "sast-reports");
2995
+ const baselinePath = path13.join(projectRoot, "security", "baseline.json");
3093
2996
  const isTTY = process.stdout.isTTY;
3094
2997
  section2("security verify");
3095
2998
  const result = runScan({
@@ -3166,7 +3069,7 @@ Review and commit the change.
3166
3069
  };
3167
3070
 
3168
3071
  // src/commands/shell/index.ts
3169
- import { spawnSync as spawnSync12 } from "child_process";
3072
+ import { spawnSync as spawnSync11 } from "child_process";
3170
3073
  var shellCommand = {
3171
3074
  description: "Open an interactive shell in a service container.",
3172
3075
  args: {
@@ -3178,7 +3081,7 @@ var shellCommand = {
3178
3081
  },
3179
3082
  async run({ args }) {
3180
3083
  const svc = String(args.service);
3181
- const bash = spawnSync12("docker", ["compose", "exec", svc, "/bin/bash"], { stdio: "inherit" });
3084
+ const bash = spawnSync11("docker", ["compose", "exec", svc, "/bin/bash"], { stdio: "inherit" });
3182
3085
  if (bash.status !== 0) {
3183
3086
  dc(["exec", svc, "/bin/sh"]);
3184
3087
  } else {
@@ -3188,18 +3091,18 @@ var shellCommand = {
3188
3091
  };
3189
3092
 
3190
3093
  // src/commands/test/index.ts
3191
- import { spawnSync as spawnSync13 } from "child_process";
3192
- import { existsSync as existsSync12 } from "fs";
3193
- import path15 from "pathe";
3094
+ import { spawnSync as spawnSync12 } from "child_process";
3095
+ import { existsSync as existsSync11 } from "fs";
3096
+ import path14 from "pathe";
3194
3097
  function shouldUseShell4() {
3195
3098
  return process.platform === "win32";
3196
3099
  }
3197
3100
  function isAvailable3(cmd) {
3198
- const r = spawnSync13(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell4() });
3101
+ const r = spawnSync12(cmd, ["--version"], { stdio: "ignore", shell: shouldUseShell4() });
3199
3102
  return r.error == null;
3200
3103
  }
3201
3104
  function exec3(cmd, args, cwd, env) {
3202
- const r = spawnSync13(cmd, args, {
3105
+ const r = spawnSync12(cmd, args, {
3203
3106
  cwd,
3204
3107
  stdio: "inherit",
3205
3108
  env: { ...process.env, ...env },
@@ -3247,8 +3150,8 @@ var testCommand = {
3247
3150
  }
3248
3151
  },
3249
3152
  async run({ projectRoot, args }) {
3250
- const backendDir = path15.join(projectRoot, "backend");
3251
- const e2eDir = path15.join(projectRoot, "e2e");
3153
+ const backendDir = path14.join(projectRoot, "backend");
3154
+ const e2eDir = path14.join(projectRoot, "e2e");
3252
3155
  const flagBackend = Boolean(args.backend);
3253
3156
  const flagE2e = Boolean(args.e2e);
3254
3157
  const headed = Boolean(args.headed);
@@ -3256,8 +3159,8 @@ var testCommand = {
3256
3159
  const runAll = !flagBackend && !flagE2e;
3257
3160
  const runBackend = flagBackend || runAll;
3258
3161
  const runE2e = flagE2e || runAll;
3259
- const hasBackend = existsSync12(backendDir);
3260
- const hasE2e = existsSync12(e2eDir);
3162
+ const hasBackend = existsSync11(backendDir);
3163
+ const hasE2e = existsSync11(e2eDir);
3261
3164
  const missing = [];
3262
3165
  if (runBackend && hasBackend && !isAvailable3("uv"))
3263
3166
  missing.push("uv \u2192 https://docs.astral.sh/uv/getting-started/installation/");
@@ -3286,8 +3189,8 @@ var testCommand = {
3286
3189
  if (runE2e && hasE2e) {
3287
3190
  const script = report ? "test:report" : "test";
3288
3191
  section3(`cucumber${headed ? " (headed)" : ""}${report ? " + report" : ""}`);
3289
- const nmDir = path15.join(e2eDir, "node_modules");
3290
- if (!existsSync12(nmDir)) {
3192
+ const nmDir = path14.join(e2eDir, "node_modules");
3193
+ if (!existsSync11(nmDir)) {
3291
3194
  process.stdout.write("node_modules not found \u2014 running pnpm install\u2026\n");
3292
3195
  const installed = exec3("pnpm", ["install"], e2eDir);
3293
3196
  if (!installed) {
@@ -3374,6 +3277,24 @@ var src_default = defineStack({
3374
3277
  default: "none"
3375
3278
  }
3376
3279
  ],
3280
+ docs: {
3281
+ tagline: "React (Vite) frontend with a FastAPI backend \u2014 Postgres, Celery and AWS EKS when you need them.",
3282
+ useCases: [
3283
+ "A CRUD/product web app that needs a typed REST API behind a modern SPA",
3284
+ "A Python + TypeScript team that wants Kubernetes-grade IaC (AWS EKS) once it scales",
3285
+ "Background/async work (Celery + Celery Beat) without leaving the Python backend"
3286
+ ],
3287
+ technologies: ["React 19", "Vite", "FastAPI", "SQLModel", "Alembic", "Celery"],
3288
+ iac: { provider: "aws-eks", flag: "--iac aws-eks" },
3289
+ pages: [
3290
+ { file: "index.md", title: "Home" },
3291
+ { file: "dude.md", title: "Working with dude" },
3292
+ { file: "api.md", title: "Command reference" },
3293
+ { file: "cheatsheet.md", title: "Cheatsheet" },
3294
+ { file: "mkdocs.md", title: "Writing docs" },
3295
+ { file: "deploy.md", title: "Deploy (AWS EKS)", when: "withIac" }
3296
+ ]
3297
+ },
3377
3298
  async scaffold(ctx) {
3378
3299
  const { answers, dest, stackRoot, dudeVersion, stackVersion } = ctx;
3379
3300
  const withPostgres = answers.database === "postgres";
@@ -3391,24 +3312,24 @@ var src_default = defineStack({
3391
3312
  dudeVersion,
3392
3313
  stackVersion
3393
3314
  };
3394
- const templates = path16.join(stackRoot, "templates");
3395
- await renderTemplateTree({ src: path16.join(templates, "base"), dest, data });
3315
+ const templates = path15.join(stackRoot, "templates");
3316
+ await renderTemplateTree({ src: path15.join(templates, "base"), dest, data });
3396
3317
  if (withPostgres) {
3397
- await renderTemplateTree({ src: path16.join(templates, "postgres"), dest, data });
3318
+ await renderTemplateTree({ src: path15.join(templates, "postgres"), dest, data });
3398
3319
  }
3399
3320
  if (withCelery) {
3400
- await renderTemplateTree({ src: path16.join(templates, "celery"), dest, data });
3321
+ await renderTemplateTree({ src: path15.join(templates, "celery"), dest, data });
3401
3322
  }
3402
3323
  if (withCeleryBeat) {
3403
- await renderTemplateTree({ src: path16.join(templates, "celerybeat"), dest, data });
3324
+ await renderTemplateTree({ src: path15.join(templates, "celerybeat"), dest, data });
3404
3325
  }
3405
3326
  if (withIac) {
3406
- await renderTemplateTree({ src: path16.join(templates, "aws-eks"), dest, data });
3327
+ await renderTemplateTree({ src: path15.join(templates, "aws-eks"), dest, data });
3407
3328
  }
3408
- const openapiYamlPath = path16.join(dest, "frontend", "src", "openapi", "utils", "openapi.yaml");
3409
- if (existsSync13(openapiYamlPath)) {
3329
+ const openapiYamlPath = path15.join(dest, "frontend", "src", "openapi", "utils", "openapi.yaml");
3330
+ if (existsSync12(openapiYamlPath)) {
3410
3331
  const spec = yaml2.parse(readFileSync9(openapiYamlPath, "utf8"));
3411
- await generateClientFromSpec(spec, path16.join(dest, "frontend", "src", "openapi"), dest);
3332
+ await generateClientFromSpec(spec, path15.join(dest, "frontend", "src", "openapi"), dest);
3412
3333
  }
3413
3334
  },
3414
3335
  hooks: {
@@ -3444,8 +3365,9 @@ var src_default = defineStack({
3444
3365
  ctx.logger.info(" Endpoints:");
3445
3366
  ctx.logger.info(" Frontend: http://localhost:5173");
3446
3367
  ctx.logger.info(" Backend: http://localhost:8000/api/health");
3368
+ ctx.logger.info(" API docs: http://localhost:8000/api/docs (Scalar reference)");
3447
3369
  if (withPostgres) {
3448
- ctx.logger.info(" Users: http://localhost:8000/api/users/");
3370
+ ctx.logger.info(" Users: http://localhost:8000/api/users");
3449
3371
  }
3450
3372
  if (withIac) {
3451
3373
  ctx.logger.info("");
@@ -3459,6 +3381,7 @@ var src_default = defineStack({
3459
3381
  },
3460
3382
  rules: [],
3461
3383
  commands: {
3384
+ cheatsheet: defineCheatsheetCommand(),
3462
3385
  up: upCommand,
3463
3386
  down: downCommand,
3464
3387
  logs: logsCommand,
@@ -3467,7 +3390,7 @@ var src_default = defineStack({
3467
3390
  format: formatCommand,
3468
3391
  review: reviewCommand2,
3469
3392
  test: testCommand,
3470
- docs: docsCommand,
3393
+ docs: defineDocsCommand(),
3471
3394
  security: {
3472
3395
  scan: securityScanCommand,
3473
3396
  accept: securityAcceptCommand,