@multiplatform.one/cli 7.90.3 → 7.90.5

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.
@@ -442,6 +442,62 @@ if [ -f "$TREE/Makefile" ]; then
442
442
  ' "$TREE/Makefile" >"$TREE/Makefile.scaffold.tmp" && mv "$TREE/Makefile.scaffold.tmp" "$TREE/Makefile"
443
443
  fi
444
444
 
445
+ # Procfile.localnet runs one dev chain per line: a line naming a pruned app
446
+ # goes, and the file goes with its last line. A root rule that drives a tree
447
+ # the project lacks goes with the comment block above it: publish runs the
448
+ # release train over public/, localnet supervises Procfile.localnet.
449
+ if [ -f "$TREE/Procfile.localnet" ]; then
450
+ awk -v removed=" $REMOVED_APPS " '
451
+ {
452
+ rest = $0
453
+ while (match(rest, /apps\/[a-z0-9-]+/)) {
454
+ if (index(removed, " " substr(rest, RSTART + 5, RLENGTH - 5) " ")) next
455
+ rest = substr(rest, RSTART + RLENGTH)
456
+ }
457
+ print
458
+ }
459
+ ' "$TREE/Procfile.localnet" >"$TREE/Procfile.localnet.scaffold.tmp" &&
460
+ mv "$TREE/Procfile.localnet.scaffold.tmp" "$TREE/Procfile.localnet"
461
+ if ! grep -q '^[^#[:space:]]' "$TREE/Procfile.localnet"; then
462
+ rm -f "$TREE/Procfile.localnet"
463
+ REMOVED="$REMOVED Procfile.localnet"
464
+ printf 'removed: %s\n' Procfile.localnet
465
+ fi
466
+ fi
467
+ DROP_RULES=""
468
+ case " $REMOVED " in
469
+ *" public "*) DROP_RULES="$DROP_RULES publish" ;;
470
+ esac
471
+ case " $REMOVED " in
472
+ *" Procfile.localnet "*) DROP_RULES="$DROP_RULES localnet" ;;
473
+ esac
474
+ if [ -n "$DROP_RULES" ] && [ -f "$TREE/Makefile" ]; then
475
+ awk -v rules="$DROP_RULES " '
476
+ /^#/ {
477
+ held = held $0 "\n"
478
+ skipping = ""
479
+ next
480
+ }
481
+ /^\.PHONY: [^ ]+$/ && index(rules, " " $2 " ") {
482
+ held = ""
483
+ skipping = $2
484
+ next
485
+ }
486
+ skipping != "" && (index($0, skipping ":") == 1 || /^\t/) { next }
487
+ skipping != "" && /^$/ {
488
+ skipping = ""
489
+ next
490
+ }
491
+ {
492
+ skipping = ""
493
+ printf "%s", held
494
+ held = ""
495
+ print
496
+ }
497
+ END { printf "%s", held }
498
+ ' "$TREE/Makefile" >"$TREE/Makefile.scaffold.tmp" && mv "$TREE/Makefile.scaffold.tmp" "$TREE/Makefile"
499
+ fi
500
+
445
501
  if [ -f "$TREE/.gitignore" ]; then
446
502
  awk -v apps="$APPS" '
447
503
  BEGIN { napps = split(apps, app, " ") }
@@ -777,6 +833,13 @@ const cleanSegment = (segment) =>
777
833
  segment.replace(/\s--ignore-pattern\s+'([^']*)'/g, (whole, pattern) =>
778
834
  namesPruned(pattern) ? "" : whole,
779
835
  );
836
+ // A file operand under a removed tree (a spec node --test runs) leaves the
837
+ // segment that names it.
838
+ const dropPrunedOperands = (segment) =>
839
+ segment
840
+ .split(" ")
841
+ .filter((word) => !pruned.some((tree) => word.replace(/^\.\//, "").startsWith(`${tree}/`)))
842
+ .join(" ");
780
843
  // Each product app carries apps/one's design baseline; a pruned tree's
781
844
  // baseline is gone, and a lint naming a missing baseline fails.
782
845
  // A kept baseline can still record only pruned trees (packages' public and
@@ -811,7 +874,10 @@ for (const [name, script] of Object.entries(pkg.scripts ?? {})) {
811
874
  if (name === "lint:design" && !/\s--baseline\s/.test(value)) continue;
812
875
  // verify:lc audits the catalog in public/ against the rulebook in docs/.
813
876
  if (name === "verify:lc" && (pruned.includes("public") || pruned.includes("docs"))) continue;
814
- const kept = value.split(" && ").filter((segment) => !dropSegment(segment)).map(cleanSegment);
877
+ const kept = value
878
+ .split(" && ")
879
+ .filter((segment) => !dropSegment(segment))
880
+ .map((segment) => dropPrunedOperands(cleanSegment(segment)));
815
881
  if (!kept.length) continue;
816
882
  scripts[name] = kept.join(" && ");
817
883
  }
@@ -854,6 +920,113 @@ if (pruned.includes("public") && pkg.pnpm?.patchedDependencies) {
854
920
  fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
855
921
  NODE
856
922
 
923
+ # turbo names packages as well as paths. A task keyed on a package the project
924
+ # has no workspace for (@multiplatform.one/theme#test once public/ is pruned)
925
+ # goes, and so does a script's --filter='!<package>' for one, which turbo
926
+ # refuses with "No package found". A globalDependencies, inputs or outputs
927
+ # entry under a pruned tree goes too. turbo.json is edited as text, so the rest
928
+ # of it keeps the monorepo's formatting.
929
+ if [ -f "$TREE/pnpm-workspace.yaml" ]; then
930
+ node - "$TREE" "$(printf '%s' "$REMOVED" | tr ' ' ',')" <<'NODE'
931
+ const fs = require("node:fs");
932
+ const path = require("node:path");
933
+ const [root, prunedCsv] = process.argv.slice(2);
934
+ const pruned = prunedCsv ? prunedCsv.split(",") : [];
935
+ const globs = [];
936
+ let inPackages = false;
937
+ for (const line of fs.readFileSync(path.join(root, "pnpm-workspace.yaml"), "utf8").split("\n")) {
938
+ if (/^packages:\s*$/.test(line)) inPackages = true;
939
+ else if (inPackages && /^\s+-\s/.test(line)) globs.push(line.replace(/^\s+-\s*["']?|["']?\s*$/g, ""));
940
+ else if (/^\S/.test(line)) inPackages = false;
941
+ }
942
+ if (!globs.length) process.exit(0);
943
+ const names = new Set(["//"]);
944
+ const addPackage = (dir) => {
945
+ const pkg = path.join(root, dir, "package.json");
946
+ if (fs.existsSync(pkg)) names.add(JSON.parse(fs.readFileSync(pkg, "utf8")).name);
947
+ };
948
+ for (const glob of globs) {
949
+ if (!glob.endsWith("/*")) {
950
+ addPackage(glob);
951
+ continue;
952
+ }
953
+ const dir = path.join(root, glob.slice(0, -2));
954
+ if (!fs.existsSync(dir)) continue;
955
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
956
+ if (entry.isDirectory()) addPackage(path.join(glob.slice(0, -2), entry.name));
957
+ }
958
+ }
959
+
960
+ const pkgFile = path.join(root, "package.json");
961
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, "utf8"));
962
+ const exclusion = /\s--filter[= ](['"]?)!(?:\^?\.\.\.)?([@a-z][^'"\s]*?)(?:\.\.\.)?\1(?=\s|$)/g;
963
+ let pkgChanged = false;
964
+ for (const [name, script] of Object.entries(pkg.scripts ?? {})) {
965
+ const kept = script.replace(exclusion, (whole, _quote, filtered) => (names.has(filtered) ? whole : ""));
966
+ if (kept !== script) {
967
+ pkg.scripts[name] = kept;
968
+ pkgChanged = true;
969
+ }
970
+ }
971
+ if (pkgChanged) fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
972
+
973
+ const turboFile = path.join(root, "turbo.json");
974
+ if (!fs.existsSync(turboFile)) process.exit(0);
975
+ const raw = fs.readFileSync(turboFile, "utf8");
976
+ const turbo = JSON.parse(raw);
977
+ const gone = Object.keys(turbo.tasks ?? {}).filter(
978
+ (key) => key.includes("#") && !names.has(key.slice(0, key.lastIndexOf("#"))),
979
+ );
980
+ for (const key of gone) delete turbo.tasks[key];
981
+ const underPruned = (entry) => {
982
+ const target = entry.replace(/^!/, "").replace(/^\$TURBO_ROOT\$\//, "").replace(/^\.\//, "");
983
+ return pruned.some((tree) => target === tree || target.startsWith(`${tree}/`));
984
+ };
985
+ const dead = new Set();
986
+ const keepPaths = (owner, field) => {
987
+ if (!Array.isArray(owner[field])) return;
988
+ for (const entry of owner[field]) if (underPruned(entry)) dead.add(entry);
989
+ owner[field] = owner[field].filter((entry) => !underPruned(entry));
990
+ };
991
+ keepPaths(turbo, "globalDependencies");
992
+ for (const task of Object.values(turbo.tasks ?? {})) {
993
+ keepPaths(task, "inputs");
994
+ keepPaths(task, "outputs");
995
+ }
996
+ if (!gone.length && !dead.size) process.exit(0);
997
+ const cut = (lines) => {
998
+ for (const key of gone) {
999
+ const start = lines.findIndex((line) => line.trimStart().startsWith(`${JSON.stringify(key)}:`));
1000
+ if (start < 1) return null;
1001
+ const close = new RegExp(`^${lines[start].match(/^\s*/)[0]}[}\\]],?\\s*$`);
1002
+ let end = start;
1003
+ if (/[{[]\s*$/.test(lines[start])) while (end < lines.length - 1 && !close.test(lines[end])) end++;
1004
+ if (!/,\s*$/.test(lines[end])) lines[start - 1] = lines[start - 1].replace(/,(\s*)$/, "$1");
1005
+ lines.splice(start, end - start + 1);
1006
+ }
1007
+ for (let i = lines.length - 1; i > 0; i--) {
1008
+ const entry = lines[i].match(/^\s*("(?:[^"\\]|\\.)*"),?\s*$/);
1009
+ if (!entry || !dead.has(JSON.parse(entry[1]))) continue;
1010
+ if (!/,\s*$/.test(lines[i])) lines[i - 1] = lines[i - 1].replace(/,(\s*)$/, "$1");
1011
+ lines.splice(i, 1);
1012
+ }
1013
+ let text = lines.join("\n");
1014
+ for (const entry of dead) {
1015
+ const quoted = JSON.stringify(entry);
1016
+ text = text.split(`${quoted}, `).join("").split(`, ${quoted}`).join("").split(`[${quoted}]`).join("[]");
1017
+ }
1018
+ return text;
1019
+ };
1020
+ let text = cut(raw.split("\n"));
1021
+ try {
1022
+ if (text !== null && JSON.stringify(JSON.parse(text)) !== JSON.stringify(turbo)) text = null;
1023
+ } catch {
1024
+ text = null;
1025
+ }
1026
+ fs.writeFileSync(turboFile, text ?? `${JSON.stringify(turbo, null, 2)}\n`);
1027
+ NODE
1028
+ fi
1029
+
857
1030
  # The monorepo tags its images for its own private registry. A project's local
858
1031
  # `make docker/build/<target>` tags them under the project's name instead, so
859
1032
  # `docker run <project>/app` works with no registry at all (FZ-8862).
@@ -3,95 +3,39 @@ import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import {
6
+ type WaitService,
6
7
  formatServiceList,
7
8
  lookupProjectRoot,
8
- waitForFrappe,
9
- waitForKeycloak,
10
- waitForPostgres,
11
9
  waitServices,
12
10
  } from "@multiplatform.one/utils/dev";
13
11
  import { Command } from "commander";
14
12
  import dotenv from "dotenv";
15
13
 
16
14
  import spawn from "nano-spawn";
17
- import YAML from "yaml";
18
15
  import yoctoSpinner from "yocto-spinner";
19
16
  import { addApp } from "../commands/addApp";
20
17
  import { adoptApp } from "../commands/adoptApp";
21
18
  import { generateDoctypeTypes, typesDrift } from "../commands/doctypeTypes";
22
- import { discoverE2EApp, runE2ESession } from "../commands/e2e";
19
+ import { runE2ESession } from "../commands/e2e";
23
20
  import { SINGLETON_APPS, init } from "../commands/init";
24
21
  import { INIT_APP_PIECES } from "../commands/pieces";
25
22
  import { runRuff } from "../commands/ruff";
26
23
  import { updateApp } from "../commands/updateApp";
24
+ import {
25
+ availableServices,
26
+ parseTestTiers,
27
+ runBuild,
28
+ runFrappeBench,
29
+ runIntegrationTests,
30
+ runTurboLint,
31
+ runUnitTests,
32
+ testTiers,
33
+ waitFunctions,
34
+ } from "../commands/verbs";
27
35
 
28
36
  const projectRoot = lookupProjectRoot();
29
- const availableServices = ["api", "frappe", "solana", "ethereum", "sui"];
30
-
31
- /** Map a service name to its relative directory from the project root. */
32
- function serviceDir(name: string): string {
33
- return `apps/${name}`;
34
- }
35
37
  const defaultDotenvPath = path.resolve(projectRoot, ".env");
36
38
 
37
- /** Apps that exist under apps/ and have package.json (discovered from filesystem). */
38
- async function getPresentApps(root: string): Promise<string[]> {
39
- const appsDir = path.join(root, "apps");
40
- try {
41
- const entries = await fs.readdir(appsDir, { withFileTypes: true });
42
- const names: string[] = [];
43
- for (const e of entries) {
44
- if (!e.isDirectory()) continue;
45
- const pkgPath = path.join(appsDir, e.name, "package.json");
46
- try {
47
- await fs.access(pkgPath);
48
- names.push(e.name);
49
- } catch {
50
- // no package.json
51
- }
52
- }
53
- return names;
54
- } catch {
55
- return [];
56
- }
57
- }
58
-
59
- /** Root-level services that exist and have package.json (discovered from filesystem). */
60
- async function getPresentServices(root: string): Promise<string[]> {
61
- const names: string[] = [];
62
- for (const name of availableServices) {
63
- const dir = path.join(root, serviceDir(name));
64
- const pkgPath = path.join(dir, "package.json");
65
- try {
66
- const stat = await fs.stat(dir);
67
- if (!stat.isDirectory()) continue;
68
- await fs.access(pkgPath);
69
- names.push(name);
70
- } catch {
71
- // dir or package.json missing
72
- }
73
- }
74
- return names;
75
- }
76
-
77
- /** Turbo --filter args to exclude root-level workspaces that are not present (so turbo only runs where they exist).
78
- * Only generates exclude filters for directories that exist on disk (turbo errors on non-existent filter paths). */
79
- async function getTurboExcludeFiltersForMissing(root: string): Promise<string[]> {
80
- const present = await getPresentServices(root);
81
- const filters: string[] = [];
82
- for (const s of availableServices) {
83
- if (present.includes(s)) continue;
84
- const dir = serviceDir(s);
85
- try {
86
- const stat = await fs.stat(path.join(root, dir));
87
- if (stat.isDirectory()) filters.push(`!./${dir}`);
88
- } catch {
89
- // directory doesn't exist; turbo won't find it, no filter needed
90
- }
91
- }
92
- return filters;
93
- }
94
-
95
39
  /** Workspaces that have Storybook and can run visual regression (discovered from filesystem + package.json). */
96
40
  export type StorybookVisualWorkspace = {
97
41
  dirName: string;
@@ -179,35 +123,6 @@ async function getStorybookVisualWorkspaces(root: string): Promise<StorybookVisu
179
123
  return out;
180
124
  }
181
125
 
182
- /** Discover frappe apps from frappe.yaml that have local source paths.
183
- * Supports both string entries (`- ./apps/core`) and object entries (`- name: core\n source: ./apps/core`). */
184
- async function getFrappeApps(root: string): Promise<{ name: string; absolutePath: string }[]> {
185
- const frappeDir = path.join(root, "apps", "frappe");
186
- const frappeYamlPath = path.join(frappeDir, "frappe.yaml");
187
- if (!fsSync.existsSync(frappeYamlPath)) return [];
188
- const raw = await fs.readFile(frappeYamlPath, "utf8");
189
- const config = YAML.parse(raw) as { apps?: (string | { name?: string; source?: string })[] };
190
- const out: { name: string; absolutePath: string }[] = [];
191
- for (const app of config?.apps ?? []) {
192
- let src: string;
193
- let name: string;
194
- if (typeof app === "string") {
195
- src = app;
196
- name = path.basename(app);
197
- } else {
198
- if (!app.source || !app.name) continue;
199
- src = app.source;
200
- name = app.name;
201
- }
202
- src = src.startsWith("file://") ? src.slice(7) : src;
203
- if (!src.startsWith("./") && !src.startsWith("../") && !src.startsWith("/")) continue;
204
- const absPath = path.isAbsolute(src) ? src : path.resolve(frappeDir, src);
205
- if (!fsSync.existsSync(absPath)) continue;
206
- out.push({ name, absolutePath: absPath });
207
- }
208
- return out;
209
- }
210
-
211
126
  const program = new Command();
212
127
  program.name("mpo");
213
128
  program.version(
@@ -434,20 +349,14 @@ frappe
434
349
  frappe
435
350
  .command("bench")
436
351
  .description("run bench command")
437
- .action(async () => {
352
+ .argument("[args...]", "arguments for bench, after --")
353
+ .action(async (args: string[]) => {
438
354
  const parentOptions = frappe.opts();
439
355
  dotenv.config({ path: parentOptions.dotenv || defaultDotenvPath });
440
- await spawn(
441
- "sh",
442
- [
443
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/frappe.sh"),
444
- "bench",
445
- ],
446
- {
447
- stdio: "inherit",
448
- shell: true,
449
- cwd: projectRoot,
450
- },
356
+ await runFrappeBench(
357
+ args,
358
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/frappe.sh"),
359
+ projectRoot,
451
360
  );
452
361
  });
453
362
 
@@ -497,77 +406,12 @@ program
497
406
  )
498
407
  .description("run build command")
499
408
  .action(async (args: string[]) => {
500
- const parsed = args.flatMap((arg) => arg.split(","));
501
- const packages = parsed.includes("packages");
502
- const projects = parsed.filter((arg) => arg !== "packages");
503
- const presentApps = await getPresentApps(projectRoot);
504
- const presentServices = await getPresentServices(projectRoot);
505
- if ((!projects.length && !packages) || packages) {
506
- await spawn(
507
- "pnpm",
508
- [
509
- "turbo",
510
- "run",
511
- "build",
512
- "--filter",
513
- "'!./apps/*'",
514
- ...presentServices.flatMap((s) => ["--filter", `'!./${serviceDir(s)}'`]),
515
- ],
516
- {
517
- stdio: "inherit",
518
- shell: true,
519
- cwd: projectRoot,
520
- },
521
- );
522
- }
523
- for (const platform of presentApps) {
524
- if ((!projects.length && !packages) || projects.includes(platform)) {
525
- const hasBuild = await fs
526
- .access(path.join(projectRoot, "apps", platform, "package.json"))
527
- .then(
528
- () =>
529
- JSON.parse(
530
- fsSync.readFileSync(
531
- path.join(projectRoot, "apps", platform, "package.json"),
532
- "utf8",
533
- ),
534
- ).scripts?.build,
535
- )
536
- .catch(() => false);
537
- if (hasBuild) {
538
- await spawn("pnpm", ["turbo", "run", "build", `--filter=./apps/${platform}`], {
539
- stdio: "inherit",
540
- shell: true,
541
- cwd: projectRoot,
542
- });
543
- }
544
- }
545
- }
546
- for (const service of presentServices) {
547
- if ((!projects.length && !packages) || projects.includes(service)) {
548
- const dir = serviceDir(service);
549
- const hasBuild = await fs
550
- .access(path.join(projectRoot, dir, "package.json"))
551
- .then(
552
- () =>
553
- JSON.parse(fsSync.readFileSync(path.join(projectRoot, dir, "package.json"), "utf8"))
554
- .scripts?.build,
555
- )
556
- .catch(() => false);
557
- if (hasBuild) {
558
- await spawn("pnpm", ["turbo", "run", "build", `--filter=./${dir}`], {
559
- stdio: "inherit",
560
- shell: true,
561
- cwd: projectRoot,
562
- });
563
- }
564
- }
565
- }
409
+ await runBuild(args, projectRoot);
566
410
  });
567
411
 
568
412
  program
569
413
  .command("test")
570
- .argument("[args...]", "test to run: unit, integration, e2e, visual (default: unit)")
414
+ .argument("[args...]", `test to run: ${testTiers.join(", ")} (default: unit)`)
571
415
  .option("--up-only", "start E2E environment and exit (for agent/manual testing)")
572
416
  .option("--down", "tear down E2E test environment")
573
417
  .option("--port-offset <number>", "port offset from defaults", "1000")
@@ -576,79 +420,17 @@ program
576
420
  .option("--filter <pattern>", "run specific Playwright test files")
577
421
  .description("run test command")
578
422
  .action(async (args: string[], options) => {
579
- const parsed = args.flatMap((arg) => arg.split(","));
423
+ const parsed = parseTestTiers(args);
580
424
 
581
425
  // Handle unit tests (turbo test with dynamic excludes: missing services + E2E app, plus frappe app unit tests)
582
426
  if (parsed.includes("unit")) {
583
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
584
- const e2eApp = await discoverE2EApp(projectRoot);
585
- const filters = [
586
- ...excludeFilters.flatMap((f) => ["--filter", f]),
587
- ...(e2eApp ? ["--filter", `'!./apps/${e2eApp}'`] : []),
588
- ];
589
- await spawn("pnpm", ["turbo", "run", "test", ...filters], {
590
- stdio: "inherit",
591
- shell: true,
592
- cwd: projectRoot,
593
- });
594
-
595
- // Run frappe app unit tests (exclude integration-marked tests)
596
- const frappeApps = await getFrappeApps(projectRoot);
597
- for (const app of frappeApps) {
598
- const hasPytest = await fs
599
- .access(path.join(app.absolutePath, "pyproject.toml"))
600
- .then(() => true)
601
- .catch(() => false);
602
- if (hasPytest) {
603
- try {
604
- await spawn("bench", ["run-tests", "--app", app.name, "--", "-m", "not integration"], {
605
- stdio: "inherit",
606
- cwd: path.join(projectRoot, "apps", "frappe"),
607
- });
608
- } catch {
609
- console.warn(`frappe app ${app.name} unit tests failed (bench may not be available)`);
610
- }
611
- }
612
- }
613
-
427
+ await runUnitTests(projectRoot);
614
428
  if (parsed.length === 1) return;
615
429
  }
616
430
 
617
- // Handle integration tests (turbo test + frappe app integration tests)
431
+ // Handle integration tests (frappe app integration tests)
618
432
  if (parsed.includes("integration")) {
619
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
620
- const e2eApp = await discoverE2EApp(projectRoot);
621
- const filters = [
622
- ...excludeFilters.flatMap((f) => ["--filter", f]),
623
- ...(e2eApp ? ["--filter", `'!./apps/${e2eApp}'`] : []),
624
- ];
625
- await spawn("pnpm", ["turbo", "run", "test", ...filters], {
626
- stdio: "inherit",
627
- shell: true,
628
- cwd: projectRoot,
629
- });
630
-
631
- // Run frappe app integration tests (only integration-marked tests)
632
- const frappeApps = await getFrappeApps(projectRoot);
633
- for (const app of frappeApps) {
634
- const hasPytest = await fs
635
- .access(path.join(app.absolutePath, "pyproject.toml"))
636
- .then(() => true)
637
- .catch(() => false);
638
- if (hasPytest) {
639
- try {
640
- await spawn("bench", ["run-tests", "--app", app.name, "--", "-m", "integration"], {
641
- stdio: "inherit",
642
- cwd: path.join(projectRoot, "apps", "frappe"),
643
- });
644
- } catch {
645
- console.warn(
646
- `frappe app ${app.name} integration tests failed (bench may not be available)`,
647
- );
648
- }
649
- }
650
- }
651
-
433
+ await runIntegrationTests(projectRoot);
652
434
  if (parsed.length === 1) return;
653
435
  }
654
436
 
@@ -735,28 +517,9 @@ program
735
517
 
736
518
  program
737
519
  .command("lint")
738
- .description("lint and typecheck all supported files (TS, Python, etc.) via turbo")
520
+ .description("lint all supported files (TS, Python, etc.) via turbo")
739
521
  .action(async () => {
740
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
741
- let turboFailed = false;
742
- try {
743
- await spawn(
744
- "turbo",
745
- [
746
- "run",
747
- "lint",
748
- "typecheck",
749
- "--filter=//",
750
- "--continue",
751
- "--filter",
752
- "!@package/features",
753
- ...excludeFilters.flatMap((f) => ["--filter", f]),
754
- ],
755
- { stdio: "inherit", cwd: projectRoot },
756
- );
757
- } catch {
758
- turboFailed = true;
759
- }
522
+ const turboFailed = await runTurboLint(projectRoot);
760
523
  const ruffFailed = await ruffStep("check");
761
524
  if (turboFailed || ruffFailed) process.exit(1);
762
525
  });
@@ -801,11 +564,6 @@ async function waitWithSpinner(
801
564
  options: { interval?: number; timeout?: number } = {},
802
565
  ) {
803
566
  const { interval = 1000, timeout = 600000 } = options;
804
- const waitFunctions = {
805
- frappe: waitForFrappe,
806
- postgres: waitForPostgres,
807
- keycloak: waitForKeycloak,
808
- };
809
567
  const unreadyServices = [...services];
810
568
  const spinner = yoctoSpinner({
811
569
  text: `waiting for ${formatServiceList(unreadyServices)}`,
@@ -822,7 +580,7 @@ async function waitWithSpinner(
822
580
  await Promise.race([
823
581
  Promise.all(
824
582
  services.map(async (service) => {
825
- const waitFn = waitFunctions[service];
583
+ const waitFn = waitFunctions[service as WaitService];
826
584
  if (!waitFn) throw new Error(`Unknown service: ${service}`);
827
585
  await waitFn(interval);
828
586
  updateSpinner(service);
@@ -49,6 +49,18 @@ async function initRepo(dir: string): Promise<string> {
49
49
  return commitAll(dir, "chore: fixture");
50
50
  }
51
51
 
52
+ /**
53
+ * A clone of this checkout at `head` whose worktree holds only the paths the
54
+ * specs edit. Scaffolds read the source through git objects (scaffold.sh runs
55
+ * git archive), so the rest of the tree would only cost a checkout and a delete.
56
+ */
57
+ async function cloneSource(dir: string, head: string): Promise<void> {
58
+ await spawn("git", ["clone", "--quiet", "--shared", "--no-checkout", monorepo, dir]);
59
+ await spawn("git", ["sparse-checkout", "set", "apps/one", "public/cli/templates"], { cwd: dir });
60
+ await spawn("git", ["checkout", "--quiet", head], { cwd: dir });
61
+ await identity(dir);
62
+ }
63
+
52
64
  function writeFiles(dir: string, files: Record<string, string>): void {
53
65
  mkdirSync(dir, { recursive: true });
54
66
  for (const [file, content] of Object.entries(files)) {
@@ -84,10 +96,7 @@ describe("clone-derived project: init → update → add-app", () => {
84
96
  await initRepo(project);
85
97
 
86
98
  source = join(sandbox, "source");
87
- const head = await gitOut(monorepo, ["rev-parse", "HEAD"]);
88
- await spawn("git", ["clone", "--quiet", "--shared", "--no-checkout", monorepo, source]);
89
- await spawn("git", ["checkout", "--quiet", head], { cwd: source });
90
- await identity(source);
99
+ await cloneSource(source, await gitOut(monorepo, ["rev-parse", "HEAD"]));
91
100
  }, heavy);
92
101
 
93
102
  afterEach(() => {
@@ -97,7 +106,7 @@ describe("clone-derived project: init → update → add-app", () => {
97
106
  afterAll(() => {
98
107
  process.chdir(previousCwd);
99
108
  rmSync(sandbox, { recursive: true, force: true });
100
- });
109
+ }, heavy);
101
110
 
102
111
  it(
103
112
  "merges a One-app change into every product app, commits nothing, then goes quiet",
@@ -248,7 +257,7 @@ describe("template-era project", () => {
248
257
 
249
258
  afterAll(() => {
250
259
  rmSync(sandbox, { recursive: true, force: true });
251
- });
260
+ }, heavy);
252
261
 
253
262
  it(
254
263
  "reconciles from an empty base and becomes clone-derived",
@@ -319,16 +328,14 @@ module.exports = {
319
328
  afterAll(() => {
320
329
  process.chdir(previousCwd);
321
330
  rmSync(sandbox, { recursive: true, force: true });
322
- });
331
+ }, heavy);
323
332
 
324
333
  it(
325
334
  "loses .pnpmfile.cjs and its lockfile checksum on update to this checkout, both staged",
326
335
  async () => {
327
336
  const source = join(sandbox, "source");
328
337
  const head = await gitOut(monorepo, ["rev-parse", "HEAD"]);
329
- await spawn("git", ["clone", "--quiet", "--shared", "--no-checkout", monorepo, source]);
330
- await spawn("git", ["checkout", "--quiet", head], { cwd: source });
331
- await identity(source);
338
+ await cloneSource(source, head);
332
339
  writeFileSync(join(source, "public/cli/templates/pnpmfile.cjs"), pulpPnpmfile);
333
340
  await spawn("git", ["add", "-A"], { cwd: source });
334
341
  await spawn("git", ["commit", "--quiet", "--allow-empty", "-m", "chore: the Pulp pnpmfile"], {
@@ -390,7 +397,7 @@ describe("adopted project (pieces)", () => {
390
397
 
391
398
  afterAll(() => {
392
399
  rmSync(sandbox, { recursive: true, force: true });
393
- });
400
+ }, heavy);
394
401
 
395
402
  it(
396
403
  "first update reconciles from an empty base without committing; the next run is a no-op",