@sdxc/kit 2026.10.21 → 2026.10.23

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.
Files changed (104) hide show
  1. package/README.md +84 -4
  2. package/changelog.jsonl +86 -0
  3. package/config.schema.json +154 -0
  4. package/dist/architecture/complexity.d.ts +73 -0
  5. package/dist/architecture/complexity.js +185 -0
  6. package/dist/architecture/crap.d.ts +62 -0
  7. package/dist/architecture/crap.js +121 -0
  8. package/dist/architecture/graph.d.ts +55 -0
  9. package/dist/architecture/graph.js +194 -0
  10. package/dist/architecture/layers.d.ts +29 -0
  11. package/dist/architecture/layers.js +81 -0
  12. package/dist/architecture/mermaid.d.ts +20 -0
  13. package/dist/architecture/mermaid.js +51 -0
  14. package/dist/cli.js +9 -0
  15. package/dist/commands/create.js +4 -3
  16. package/dist/commands/deploy.js +10 -9
  17. package/dist/commands/destroy.d.ts +1 -1
  18. package/dist/commands/diagram.d.ts +17 -0
  19. package/dist/commands/diagram.js +45 -0
  20. package/dist/commands/fix.d.ts +69 -0
  21. package/dist/commands/fix.js +102 -0
  22. package/dist/commands/make.d.ts +71 -2
  23. package/dist/commands/make.js +46 -0
  24. package/dist/commands/run.d.ts +15 -11
  25. package/dist/commands/run.js +21 -16
  26. package/dist/commands/scaffold.d.ts +1 -1
  27. package/dist/commands/setup.d.ts +26 -0
  28. package/dist/commands/setup.js +33 -0
  29. package/dist/config.d.ts +52 -0
  30. package/dist/config.js +88 -1
  31. package/dist/contract.d.ts +52 -3
  32. package/dist/contract.js +124 -2
  33. package/dist/dependencies.js +7 -1
  34. package/dist/deploy/plan.d.ts +5 -0
  35. package/dist/deploy/plan.js +10 -0
  36. package/dist/destroy.js +13 -6
  37. package/dist/diagram.d.ts +32 -0
  38. package/dist/diagram.js +47 -0
  39. package/dist/doctor/checks.d.ts +2 -1
  40. package/dist/doctor/checks.js +24 -1
  41. package/dist/doctor/complexity.d.ts +13 -0
  42. package/dist/doctor/complexity.js +52 -0
  43. package/dist/doctor/crap.d.ts +14 -0
  44. package/dist/doctor/crap.js +67 -0
  45. package/dist/doctor/dependencies.d.ts +13 -0
  46. package/dist/doctor/dependencies.js +42 -0
  47. package/dist/doctor/duplication.d.ts +19 -0
  48. package/dist/doctor/duplication.js +106 -0
  49. package/dist/doctor/fan-out.d.ts +12 -0
  50. package/dist/doctor/fan-out.js +42 -0
  51. package/dist/doctor/feature-scatter.d.ts +15 -0
  52. package/dist/doctor/feature-scatter.js +84 -0
  53. package/dist/doctor/module-size.d.ts +13 -0
  54. package/dist/doctor/module-size.js +50 -0
  55. package/dist/doctor/mutation.d.ts +20 -0
  56. package/dist/doctor/mutation.js +97 -0
  57. package/dist/doctor/orphans.d.ts +13 -0
  58. package/dist/doctor/orphans.js +50 -0
  59. package/dist/doctor/project.js +8 -5
  60. package/dist/doctor/result-throws.d.ts +17 -0
  61. package/dist/doctor/result-throws.js +72 -0
  62. package/dist/doctor/test-ratio.d.ts +12 -0
  63. package/dist/doctor/test-ratio.js +31 -0
  64. package/dist/fix/commands.d.ts +37 -0
  65. package/dist/fix/commands.js +63 -0
  66. package/dist/fix/emails.d.ts +21 -0
  67. package/dist/fix/emails.js +159 -0
  68. package/dist/fix/env.d.ts +29 -0
  69. package/dist/fix/env.js +58 -0
  70. package/dist/fix/index.d.ts +11 -0
  71. package/dist/fix/index.js +11 -0
  72. package/dist/fix/models.d.ts +20 -0
  73. package/dist/fix/models.js +95 -0
  74. package/dist/lock.js +12 -2
  75. package/dist/make/binding.d.ts +42 -0
  76. package/dist/make/binding.js +237 -0
  77. package/dist/make/imports.js +7 -5
  78. package/dist/make/schema-diff.js +8 -1
  79. package/dist/models.js +7 -7
  80. package/dist/routes/modules.js +8 -5
  81. package/dist/routes/parse.js +8 -7
  82. package/dist/routes/routers.js +9 -5
  83. package/dist/setup/auth.d.ts +12 -0
  84. package/dist/setup/auth.js +209 -0
  85. package/dist/setup/billing.d.ts +11 -0
  86. package/dist/setup/billing.js +116 -0
  87. package/dist/setup/catalog.d.ts +25 -0
  88. package/dist/setup/catalog.js +34 -0
  89. package/dist/setup/credit.d.ts +13 -0
  90. package/dist/setup/credit.js +21 -0
  91. package/dist/setup/flags.d.ts +11 -0
  92. package/dist/setup/flags.js +62 -0
  93. package/dist/setup/index.d.ts +25 -0
  94. package/dist/setup/index.js +53 -0
  95. package/dist/setup/plan.d.ts +38 -0
  96. package/dist/setup/plan.js +62 -0
  97. package/dist/testing.js +3 -3
  98. package/dist/ui/layout.js +1 -1
  99. package/dist/ui/registry.d.ts +2 -2
  100. package/dist/upgrade/project.d.ts +2 -2
  101. package/dist/upgrade/prompt.js +7 -5
  102. package/package.json +10 -7
  103. package/registry/ui/attachment.json +2 -2
  104. package/templates/app/AGENTS.md +14 -1
@@ -10,6 +10,7 @@ import { createCommand, success, usage } from "@sdxc/cli";
10
10
  import { isFailure } from "@sdxc/result";
11
11
  import { METHODS, SDXC_COMMANDS } from "../contract.js";
12
12
  import { makeActions } from "../make/actions.js";
13
+ import { makeBinding, makeDo, makeSecret } from "../make/binding.js";
13
14
  import { make } from "../make/index.js";
14
15
  import { copyStubs } from "../make/stubs.js";
15
16
  import { makeTest } from "../make/test.js";
@@ -232,6 +233,51 @@ export const stubs = createCommand(SDXC_COMMANDS.make.stubs, {
232
233
  return success();
233
234
  },
234
235
  });
236
+ /** `sdxc make secret`. */
237
+ export const secret = createCommand(SDXC_COMMANDS.make.secret, {
238
+ middleware: MAKE_MIDDLEWARE,
239
+ async handler(ctx) {
240
+ let made = await makeSecret(ctx, ctx.project.root, {
241
+ name: ctx.arguments.name,
242
+ dryRun: ctx.flags.dryRun,
243
+ force: ctx.flags.force,
244
+ });
245
+ if (isFailure(made))
246
+ return made;
247
+ return success();
248
+ },
249
+ });
250
+ /** `sdxc make binding`. */
251
+ export const binding = createCommand(SDXC_COMMANDS.make.binding, {
252
+ middleware: MAKE_MIDDLEWARE,
253
+ async handler(ctx) {
254
+ let made = await makeBinding(ctx, ctx.project.root, {
255
+ kind: ctx.arguments.kind,
256
+ name: ctx.arguments.name,
257
+ dryRun: ctx.flags.dryRun,
258
+ force: ctx.flags.force,
259
+ });
260
+ if (isFailure(made))
261
+ return made;
262
+ return success();
263
+ },
264
+ });
265
+ /** `sdxc make do`. */
266
+ export const durableObject = createCommand(SDXC_COMMANDS.make.do, {
267
+ middleware: MAKE_MIDDLEWARE,
268
+ async handler(ctx) {
269
+ let made = await makeDo(ctx, ctx.project.root, ctx.packageRoot, {
270
+ name: ctx.arguments.name,
271
+ role: ctx.flags.role,
272
+ binding: ctx.flags.binding,
273
+ dryRun: ctx.flags.dryRun,
274
+ force: ctx.flags.force,
275
+ });
276
+ if (isFailure(made))
277
+ return made;
278
+ return success();
279
+ },
280
+ });
235
281
  /**
236
282
  * `sdxc make` with no kind: the contract asks for the kind and the name on a terminal, and this
237
283
  * asks a controller's method, then makes it with every flag of the kind at its default. Without
@@ -1,14 +1,15 @@
1
1
  /**
2
- * The `sdxc run` handler: runs the project's own command line, `bootstrap/cli.ts`, with the
3
- * project's runtime and every token after `run` as typed, so a globally installed `sdxc` reaches
4
- * any project's commands without a package script.
2
+ * The `sdxc run` handler: runs the project's own command line with the project's runtime and
3
+ * every token after `run` as typed, so a globally installed `sdxc` reaches any project's
4
+ * commands without a package script. The entry module defaults to `bootstrap/cli.ts` and a
5
+ * project overrides it with `run.entry` in `.config/sdxc.jsonc`.
5
6
  *
6
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
7
8
  * @copyright Sergio Xalambrí 2026
8
9
  */
9
10
  import type { Result } from "@sdxc/result";
10
- /** Where the app layout puts an app's command line, relative to the project root. */
11
- export declare const CLI_ENTRY = "bootstrap/cli.ts";
11
+ /** Where an app's command line starts when `run.entry` is left at its default. */
12
+ export declare const DEFAULT_CLI_ENTRY = "bootstrap/cli.ts";
12
13
  /**
13
14
  * `PATH` with the project's `node_modules/.bin` first, as a package script has it, so a child
14
15
  * runs the project's own `cf` or `vp` in place of a global one.
@@ -18,16 +19,19 @@ export declare const CLI_ENTRY = "bootstrap/cli.ts";
18
19
  */
19
20
  export declare function projectPath(root: string, path: string | undefined): string;
20
21
  /**
21
- * The command that starts the project's command line with `args`: under Bun for a project on
22
- * Bun and under Node otherwise.
22
+ * The command that starts the project's command line at `entry` with `args`: under Bun for a
23
+ * project on Bun and under Node otherwise.
23
24
  *
24
25
  * @param root - The project root, whose `package.json` and lock file name the package manager
26
+ * @param entry - The module to start, relative to the project root
27
+ * @param args - Tokens after `sdxc run`
25
28
  */
26
- export declare function commandLine(root: string, args: readonly string[]): Promise<Result<string[], Error>>;
29
+ export declare function commandLine(root: string, entry: string, args: readonly string[]): Promise<Result<string[], Error>>;
27
30
  /**
28
- * Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
29
- * output on the terminal and the project's `node_modules/.bin` first on `PATH`, as a package
30
- * script has it; the app's exit code is `sdxc run`'s, and only the app's messages print on failure.
31
+ * Runs the configured command-line entry under Bun for a project on Bun and under Node
32
+ * otherwise, with its output on the terminal and the project's `node_modules/.bin` first on
33
+ * `PATH`, as a package script has it; the app's exit code is `sdxc run`'s, and only the app's
34
+ * messages print on failure.
31
35
  */
32
36
  declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
33
37
  readonly args: import("@sdxc/cli").Argument<string[]>;
@@ -1,7 +1,8 @@
1
1
  /**
2
- * The `sdxc run` handler: runs the project's own command line, `bootstrap/cli.ts`, with the
3
- * project's runtime and every token after `run` as typed, so a globally installed `sdxc` reaches
4
- * any project's commands without a package script.
2
+ * The `sdxc run` handler: runs the project's own command line with the project's runtime and
3
+ * every token after `run` as typed, so a globally installed `sdxc` reaches any project's
4
+ * commands without a package script. The entry module defaults to `bootstrap/cli.ts` and a
5
+ * project overrides it with `run.entry` in `.config/sdxc.jsonc`.
5
6
  *
6
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
7
8
  * @copyright Sergio Xalambrí 2026
@@ -14,8 +15,8 @@ import { SDXC_COMMANDS } from "../contract.js";
14
15
  import { project } from "../middleware.js";
15
16
  import { lockFileAtOrAbove, packageManager } from "../package-manager.js";
16
17
  import { readManifest } from "../upgrade/project.js";
17
- /** Where the app layout puts an app's command line, relative to the project root. */
18
- export const CLI_ENTRY = "bootstrap/cli.ts";
18
+ /** Where an app's command line starts when `run.entry` is left at its default. */
19
+ export const DEFAULT_CLI_ENTRY = "bootstrap/cli.ts";
19
20
  /**
20
21
  * `PATH` with the project's `node_modules/.bin` first, as a package script has it, so a child
21
22
  * runs the project's own `cf` or `vp` in place of a global one.
@@ -28,12 +29,14 @@ export function projectPath(root, path) {
28
29
  return path === undefined ? bin : `${bin}${delimiter}${path}`;
29
30
  }
30
31
  /**
31
- * The command that starts the project's command line with `args`: under Bun for a project on
32
- * Bun and under Node otherwise.
32
+ * The command that starts the project's command line at `entry` with `args`: under Bun for a
33
+ * project on Bun and under Node otherwise.
33
34
  *
34
35
  * @param root - The project root, whose `package.json` and lock file name the package manager
36
+ * @param entry - The module to start, relative to the project root
37
+ * @param args - Tokens after `sdxc run`
35
38
  */
36
- export async function commandLine(root, args) {
39
+ export async function commandLine(root, entry, args) {
37
40
  let manifest = await readManifest(root);
38
41
  if (isFailure(manifest))
39
42
  return manifest;
@@ -41,23 +44,25 @@ export async function commandLine(root, args) {
41
44
  declared: manifest.data.manifest.packageManager,
42
45
  findLockFile: lockFileAtOrAbove(root),
43
46
  });
44
- return success([manager.name === "bun" ? "bun" : "node", CLI_ENTRY, ...args]);
47
+ return success([manager.name === "bun" ? "bun" : "node", entry, ...args]);
45
48
  }
46
49
  /**
47
- * Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
48
- * output on the terminal and the project's `node_modules/.bin` first on `PATH`, as a package
49
- * script has it; the app's exit code is `sdxc run`'s, and only the app's messages print on failure.
50
+ * Runs the configured command-line entry under Bun for a project on Bun and under Node
51
+ * otherwise, with its output on the terminal and the project's `node_modules/.bin` first on
52
+ * `PATH`, as a package script has it; the app's exit code is `sdxc run`'s, and only the app's
53
+ * messages print on failure.
50
54
  */
51
55
  export default createCommand(SDXC_COMMANDS.run, {
52
56
  middleware: [project()],
53
57
  /** Fails naming the missing entry; otherwise hands the app's exit code back unchanged. */
54
58
  async handler(ctx) {
55
59
  let root = ctx.project.root;
56
- let entry = join(root, CLI_ENTRY);
57
- if (!isSuccess(await wrap(() => stat(entry)))) {
58
- return failure(new Error(`${CLI_ENTRY} not found in ${root}; an app's command line starts there`));
60
+ let entry = ctx.project.config.run.entry;
61
+ let absolute = join(root, entry);
62
+ if (!isSuccess(await wrap(() => stat(absolute)))) {
63
+ return failure(new Error(`${entry} not found in ${root}; an app's command line starts there`));
59
64
  }
60
- let command = await commandLine(root, ctx.arguments.args);
65
+ let command = await commandLine(root, entry, ctx.arguments.args);
61
66
  if (isFailure(command))
62
67
  return command;
63
68
  let ran = await ctx.exec(command.data, {
@@ -14,7 +14,7 @@ declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Co
14
14
  readonly mcp: import("@sdxc/cli").Flag<boolean>;
15
15
  readonly command: import("@sdxc/cli").Flag<boolean>;
16
16
  readonly api: import("@sdxc/cli").Flag<boolean>;
17
- readonly skip: import("@sdxc/cli").ValueFlag<"validator" | "model" | "migration" | "factory" | "policy" | "pages", false, true, false>;
17
+ readonly skip: import("@sdxc/cli").ValueFlag<"model" | "validator" | "migration" | "factory" | "policy" | "pages", false, true, false>;
18
18
  readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
19
19
  readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
20
20
  readonly dryRun: import("@sdxc/cli").Flag<boolean>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The `sdxc setup` handler: lists known features with no name, or installs auth / billing /
3
+ * flags from a printed plan (`-y` writes; without it the plan is dry-run).
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ /**
9
+ * `sdxc setup` with no feature: lists the catalog. With a feature argument, installs it.
10
+ */
11
+ declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
12
+ readonly feature: import("@sdxc/cli").Argument<string | undefined>;
13
+ }, {
14
+ readonly provider: import("@sdxc/cli").ValueFlag<string, false, false, false>;
15
+ readonly yes: import("@sdxc/cli").Flag<boolean>;
16
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
17
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
18
+ key: typeof import("../middleware.js").CurrentProject;
19
+ value: import("../middleware.js").Project;
20
+ property: "project";
21
+ }>, import("@sdxc/cli").CommandMiddleware<{
22
+ key: typeof import("../middleware.js").PackageRoot;
23
+ value: string;
24
+ property: "packageRoot";
25
+ }>]>;
26
+ export default _default;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The `sdxc setup` handler: lists known features with no name, or installs auth / billing /
3
+ * flags from a printed plan (`-y` writes; without it the plan is dry-run).
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ import { createCommand, success } from "@sdxc/cli";
9
+ import { isFailure } from "@sdxc/result";
10
+ import { SDXC_COMMANDS } from "../contract.js";
11
+ import { packageRoot, project } from "../middleware.js";
12
+ import { listFeatures, runSetup } from "../setup/index.js";
13
+ /**
14
+ * `sdxc setup` with no feature: lists the catalog. With a feature argument, installs it.
15
+ */
16
+ export default createCommand(SDXC_COMMANDS.setup, {
17
+ middleware: [project(), packageRoot()],
18
+ async handler(ctx) {
19
+ if (ctx.arguments.feature === undefined) {
20
+ ctx.stdout(listFeatures());
21
+ return success();
22
+ }
23
+ let ran = await runSetup(ctx.project.root, ctx.arguments.feature, {
24
+ provider: ctx.flags.provider,
25
+ dryRun: ctx.flags.dryRun,
26
+ yes: ctx.flags.yes,
27
+ stdout: (text) => ctx.stdout(text),
28
+ });
29
+ if (isFailure(ran))
30
+ return ran;
31
+ return success();
32
+ },
33
+ });
package/dist/config.d.ts CHANGED
@@ -38,6 +38,32 @@ export declare const CONFIG_SCHEMA: s.Schema<{
38
38
  }[] | undefined;
39
39
  } | undefined;
40
40
  checks?: string | undefined;
41
+ complexity?: {
42
+ max?: number | undefined;
43
+ } | undefined;
44
+ moduleSize?: {
45
+ maxLines?: number | undefined;
46
+ } | undefined;
47
+ crap?: {
48
+ max?: number | undefined;
49
+ coverage?: string | undefined;
50
+ } | undefined;
51
+ testRatio?: {
52
+ min?: number | undefined;
53
+ } | undefined;
54
+ fanOut?: {
55
+ max?: number | undefined;
56
+ } | undefined;
57
+ duplication?: {
58
+ minLines?: number | undefined;
59
+ } | undefined;
60
+ mutation?: {
61
+ report?: string | undefined;
62
+ maxSurvived?: number | undefined;
63
+ } | undefined;
64
+ } | undefined;
65
+ run?: {
66
+ entry?: string | undefined;
41
67
  } | undefined;
42
68
  lock?: string | undefined;
43
69
  }, {
@@ -61,6 +87,32 @@ export declare const CONFIG_SCHEMA: s.Schema<{
61
87
  }[];
62
88
  };
63
89
  checks: string;
90
+ complexity: {
91
+ max: number;
92
+ };
93
+ moduleSize: {
94
+ maxLines: number;
95
+ };
96
+ crap: {
97
+ max: number;
98
+ coverage: string;
99
+ };
100
+ testRatio: {
101
+ min: number;
102
+ };
103
+ fanOut: {
104
+ max: number;
105
+ };
106
+ duplication: {
107
+ minLines: number;
108
+ };
109
+ mutation: {
110
+ report: string;
111
+ maxSurvived: number;
112
+ };
113
+ };
114
+ run: {
115
+ entry: string;
64
116
  };
65
117
  lock: string;
66
118
  $schema?: string | undefined;
package/dist/config.js CHANGED
@@ -37,8 +37,42 @@ const ACCEPTED_MIGRATION_FAILURE = s.object({
37
37
  const DOCTOR_MIGRATIONS_DEFAULTS = {
38
38
  accept: [],
39
39
  };
40
+ /** The `doctor.complexity` group as a project with no such key gets it. */
41
+ const DOCTOR_COMPLEXITY_DEFAULTS = { max: 4 };
42
+ /** The `doctor.moduleSize` group as a project with no such key gets it. */
43
+ const DOCTOR_MODULE_SIZE_DEFAULTS = { maxLines: 200 };
44
+ /** The `doctor.crap` group as a project with no such key gets it. */
45
+ const DOCTOR_CRAP_DEFAULTS = { max: 12, coverage: "coverage/coverage-final.json" };
46
+ /** Integer at least 1; shared so doctor leaf schemas stay under the nested-call ceiling. */
47
+ const POSITIVE_INTEGER = s.integer().pipe(checks.min(1));
48
+ /** Integer at least 0; shared so doctor leaf schemas stay under the nested-call ceiling. */
49
+ const NON_NEGATIVE_INTEGER = s.integer().pipe(checks.min(0));
50
+ /** Integer at least 2; shared so doctor leaf schemas stay under the nested-call ceiling. */
51
+ const INTEGER_AT_LEAST_TWO = s.integer().pipe(checks.min(2));
52
+ /** Number at least 0; shared so doctor leaf schemas stay under the nested-call ceiling. */
53
+ const NON_NEGATIVE_NUMBER = s.number().pipe(checks.min(0));
54
+ /** The `doctor.testRatio` group as a project with no such key gets it. */
55
+ const DOCTOR_TEST_RATIO_DEFAULTS = { min: 0.3 };
56
+ /** The `doctor.fanOut` group as a project with no such key gets it. */
57
+ const DOCTOR_FAN_OUT_DEFAULTS = { max: 15 };
58
+ /** The `doctor.duplication` group as a project with no such key gets it. */
59
+ const DOCTOR_DUPLICATION_DEFAULTS = { minLines: 8 };
60
+ /** The `doctor.mutation` group as a project with no such key gets it. */
61
+ const DOCTOR_MUTATION_DEFAULTS = { report: "reports/mutation/mutation.json", maxSurvived: 0 };
40
62
  /** The `doctor` group as a project with no `doctor` key gets it. */
41
- const DOCTOR_DEFAULTS = { checks: ".config/sdxc/checks", migrations: DOCTOR_MIGRATIONS_DEFAULTS };
63
+ const DOCTOR_DEFAULTS = {
64
+ checks: ".config/sdxc/checks",
65
+ migrations: DOCTOR_MIGRATIONS_DEFAULTS,
66
+ complexity: DOCTOR_COMPLEXITY_DEFAULTS,
67
+ moduleSize: DOCTOR_MODULE_SIZE_DEFAULTS,
68
+ crap: DOCTOR_CRAP_DEFAULTS,
69
+ testRatio: DOCTOR_TEST_RATIO_DEFAULTS,
70
+ fanOut: DOCTOR_FAN_OUT_DEFAULTS,
71
+ duplication: DOCTOR_DUPLICATION_DEFAULTS,
72
+ mutation: DOCTOR_MUTATION_DEFAULTS,
73
+ };
74
+ /** The `run` group as a project with no `run` key gets it. */
75
+ const RUN_DEFAULTS = { entry: "bootstrap/cli.ts" };
42
76
  /**
43
77
  * Every configuration key. Each leaf carries its default, or an example when it has none, and
44
78
  * a description that becomes its comment in `sdxc init`'s output; an unknown key is an error, so
@@ -88,7 +122,57 @@ export const CONFIG_SCHEMA = s.object({
88
122
  description: "Migration errors `sdxc doctor` steps past, each a file that already ran and the column its error names",
89
123
  }),
90
124
  }, { unknownKeys: "error" }), DOCTOR_MIGRATIONS_DEFAULTS),
125
+ complexity: s.defaulted(s.object({
126
+ max: s.defaulted(POSITIVE_INTEGER, DOCTOR_COMPLEXITY_DEFAULTS.max).meta({
127
+ description: "Maximum cyclomatic complexity per function; the complexity check warns above it",
128
+ }),
129
+ }, { unknownKeys: "error" }), DOCTOR_COMPLEXITY_DEFAULTS),
130
+ moduleSize: s.defaulted(s.object({
131
+ maxLines: s.defaulted(POSITIVE_INTEGER, DOCTOR_MODULE_SIZE_DEFAULTS.maxLines).meta({
132
+ description: "Maximum code lines per module; the module-size check warns above it",
133
+ }),
134
+ }, { unknownKeys: "error" }), DOCTOR_MODULE_SIZE_DEFAULTS),
135
+ crap: s.defaulted(s.object({
136
+ max: s.defaulted(POSITIVE_INTEGER, DOCTOR_CRAP_DEFAULTS.max).meta({
137
+ description: "Maximum CRAP score per function; the crap check warns above it",
138
+ }),
139
+ coverage: s.defaulted(s.string(), DOCTOR_CRAP_DEFAULTS.coverage).meta({
140
+ description: "Istanbul coverage-final.json the crap check reads, relative to the project root",
141
+ }),
142
+ }, { unknownKeys: "error" }), DOCTOR_CRAP_DEFAULTS),
143
+ testRatio: s.defaulted(s.object({
144
+ min: s.defaulted(NON_NEGATIVE_NUMBER, DOCTOR_TEST_RATIO_DEFAULTS.min).meta({
145
+ description: "Minimum tests/code ratio from sdxc stats; the test-ratio check warns below it",
146
+ }),
147
+ }, { unknownKeys: "error" }), DOCTOR_TEST_RATIO_DEFAULTS),
148
+ fanOut: s.defaulted(s.object({
149
+ max: s.defaulted(POSITIVE_INTEGER, DOCTOR_FAN_OUT_DEFAULTS.max).meta({
150
+ description: "Maximum distinct modules one file may import; the fan-out check warns above it",
151
+ }),
152
+ }, { unknownKeys: "error" }), DOCTOR_FAN_OUT_DEFAULTS),
153
+ duplication: s.defaulted(s.object({
154
+ minLines: s
155
+ .defaulted(INTEGER_AT_LEAST_TWO, DOCTOR_DUPLICATION_DEFAULTS.minLines)
156
+ .meta({
157
+ description: "Minimum consecutive code lines that count as a duplicated block",
158
+ }),
159
+ }, { unknownKeys: "error" }), DOCTOR_DUPLICATION_DEFAULTS),
160
+ mutation: s.defaulted(s.object({
161
+ report: s.defaulted(s.string(), DOCTOR_MUTATION_DEFAULTS.report).meta({
162
+ description: "Mutation report JSON the mutation check reads, relative to the project root",
163
+ }),
164
+ maxSurvived: s
165
+ .defaulted(NON_NEGATIVE_INTEGER, DOCTOR_MUTATION_DEFAULTS.maxSurvived)
166
+ .meta({
167
+ description: "Maximum surviving mutants the mutation check allows",
168
+ }),
169
+ }, { unknownKeys: "error" }), DOCTOR_MUTATION_DEFAULTS),
91
170
  }, { unknownKeys: "error" }), DOCTOR_DEFAULTS),
171
+ run: s.defaulted(s.object({
172
+ entry: s.defaulted(s.string(), RUN_DEFAULTS.entry).meta({
173
+ description: "Module `sdxc run` starts, relative to the project root; apps keep the default",
174
+ }),
175
+ }, { unknownKeys: "error" }), RUN_DEFAULTS),
92
176
  format: s.optional(s.array(s.string()).pipe(checks.minItems(1))).meta({
93
177
  description: "Command run on every file the CLI writes or edits, paths appended",
94
178
  examples: [["bunx", "vp", "fmt", "--no-error-on-unmatched-pattern"]],
@@ -175,6 +259,9 @@ function configuredPaths(config) {
175
259
  ["ui.directory", config.ui.directory],
176
260
  ["make.stubs", config.make.stubs],
177
261
  ["doctor.checks", config.doctor.checks],
262
+ ["doctor.crap.coverage", config.doctor.crap.coverage],
263
+ ["doctor.mutation.report", config.doctor.mutation.report],
264
+ ["run.entry", config.run.entry],
178
265
  ["lock", config.lock],
179
266
  ];
180
267
  for (let [chain, folder] of Object.entries(config.make.migrations)) {
@@ -22,7 +22,7 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
22
22
  readonly skip: import("@sdxc/cli").ValueFlag<"build" | "migrate" | "deploy", false, true, false>;
23
23
  }>;
24
24
  readonly destroy: import("@sdxc/cli").Command<{
25
- readonly kind: import("@sdxc/cli").Argument<"email" | "command" | "controller" | "middleware" | "validator" | "job" | "model" | "factory" | "service" | "initializer" | "mcp">;
25
+ readonly kind: import("@sdxc/cli").Argument<"email" | "command" | "model" | "service" | "controller" | "middleware" | "validator" | "job" | "factory" | "initializer" | "mcp">;
26
26
  readonly name: import("@sdxc/cli").Argument<string>;
27
27
  }, {
28
28
  readonly yes: import("@sdxc/cli").Flag<boolean>;
@@ -34,6 +34,23 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
34
34
  readonly only: import("@sdxc/cli").ValueFlag<string, false, true, false>;
35
35
  readonly skip: import("@sdxc/cli").ValueFlag<string, false, true, false>;
36
36
  }>;
37
+ readonly fix: import("@sdxc/cli").Group<Omit<{
38
+ readonly description: "Apply doctor repairs the kit can make safely";
39
+ readonly flags: {
40
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
41
+ };
42
+ readonly env: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
43
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
44
+ }>;
45
+ readonly models: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
46
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
47
+ }>;
48
+ readonly emails: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
49
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
50
+ }>;
51
+ }, "description" | "hidden" | "arguments" | "flags" | "tasks">, Record<never, never>, {
52
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
53
+ }>;
37
54
  readonly init: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
38
55
  readonly dryRun: import("@sdxc/cli").Flag<boolean>;
39
56
  }>;
@@ -59,7 +76,7 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
59
76
  readonly path: import("@sdxc/cli").ValueFlag<string, false, false, false>;
60
77
  readonly routes: import("@sdxc/cli").ValueFlag<string, false, false, false>;
61
78
  readonly resource: import("@sdxc/cli").ValueFlag<string, false, false, false>;
62
- readonly actions: import("@sdxc/cli").ValueFlag<"index" | "all" | "new" | "show" | "edit" | "create" | "update" | "destroy", false, true, false>;
79
+ readonly actions: import("@sdxc/cli").ValueFlag<"index" | "new" | "all" | "show" | "edit" | "create" | "update" | "destroy", false, true, false>;
63
80
  readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
64
81
  readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
65
82
  readonly dryRun: import("@sdxc/cli").Flag<boolean>;
@@ -167,6 +184,27 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
167
184
  readonly stubs: import("@sdxc/cli").Command<{
168
185
  readonly kinds: import("@sdxc/cli").Argument<(import("./make/kinds.js").KindName | "scaffold")[]>;
169
186
  }, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>;
187
+ readonly secret: import("@sdxc/cli").Command<{
188
+ readonly name: import("@sdxc/cli").Argument<string>;
189
+ }, {
190
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
191
+ readonly force: import("@sdxc/cli").Flag<boolean>;
192
+ }>;
193
+ readonly binding: import("@sdxc/cli").Command<{
194
+ readonly kind: import("@sdxc/cli").Argument<"secret" | "kv" | "d1" | "r2" | "queue" | "rateLimit" | "sendEmail" | "durableObject">;
195
+ readonly name: import("@sdxc/cli").Argument<string>;
196
+ }, {
197
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
198
+ readonly force: import("@sdxc/cli").Flag<boolean>;
199
+ }>;
200
+ readonly do: import("@sdxc/cli").Command<{
201
+ readonly name: import("@sdxc/cli").Argument<string>;
202
+ }, {
203
+ readonly role: import("@sdxc/cli").ValueFlag<"model" | "service", true, false, false>;
204
+ readonly binding: import("@sdxc/cli").ValueFlag<string, false, false, false>;
205
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
206
+ readonly force: import("@sdxc/cli").Flag<boolean>;
207
+ }>;
170
208
  }, "description" | "hidden" | "arguments" | "flags" | "tasks">, {
171
209
  readonly kind: import("@sdxc/cli").Argument<import("./make/kinds.js").KindName>;
172
210
  readonly name: import("@sdxc/cli").Argument<string>;
@@ -209,7 +247,7 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
209
247
  readonly mcp: import("@sdxc/cli").Flag<boolean>;
210
248
  readonly command: import("@sdxc/cli").Flag<boolean>;
211
249
  readonly api: import("@sdxc/cli").Flag<boolean>;
212
- readonly skip: import("@sdxc/cli").ValueFlag<"validator" | "model" | "migration" | "factory" | "policy" | "pages", false, true, false>;
250
+ readonly skip: import("@sdxc/cli").ValueFlag<"model" | "validator" | "migration" | "factory" | "policy" | "pages", false, true, false>;
213
251
  readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
214
252
  readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
215
253
  readonly dryRun: import("@sdxc/cli").Flag<boolean>;
@@ -217,9 +255,20 @@ export declare const SDXC_COMMANDS: import("@sdxc/cli").Group<Omit<{
217
255
  readonly schedule: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
218
256
  readonly json: import("@sdxc/cli").Flag<boolean>;
219
257
  }>;
258
+ readonly setup: import("@sdxc/cli").Command<{
259
+ readonly feature: import("@sdxc/cli").Argument<string | undefined>;
260
+ }, {
261
+ readonly provider: import("@sdxc/cli").ValueFlag<string, false, false, false>;
262
+ readonly yes: import("@sdxc/cli").Flag<boolean>;
263
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
264
+ }>;
220
265
  readonly stats: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
221
266
  readonly json: import("@sdxc/cli").Flag<boolean>;
222
267
  }>;
268
+ readonly diagram: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
269
+ readonly json: import("@sdxc/cli").Flag<boolean>;
270
+ readonly svg: import("@sdxc/cli").ValueFlag<string, false, false, false>;
271
+ }>;
223
272
  readonly ui: import("@sdxc/cli").Group<Omit<{
224
273
  readonly description: "Copy @sdxc/ui components into the project and keep imports on the copies";
225
274
  readonly list: import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>;