@specdest/devkit 0.2.2 → 0.3.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.
Files changed (138) hide show
  1. package/README.md +15 -20
  2. package/package.json +4 -4
  3. package/src/canonical-project-operations.js +157 -0
  4. package/src/canonical-project.js +50 -0
  5. package/src/canonical-source.js +114 -0
  6. package/src/cli.js +2 -2
  7. package/src/git-catalog.js +105 -0
  8. package/src/index.js +6 -2
  9. package/src/project-operations.js +65 -6
  10. package/src/remote-installer.js +462 -0
  11. package/src/sync-core.js +20 -7
  12. package/catalog/README.md +0 -11
  13. package/catalog/modules/backend-convex/manifest.json +0 -14
  14. package/catalog/modules/backend-convex-expo/manifest.json +0 -11
  15. package/catalog/modules/backend-supabase/manifest.json +0 -15
  16. package/catalog/modules/backend-supabase-expo/manifest.json +0 -11
  17. package/catalog/modules/checker-runtime/config.ts +0 -25
  18. package/catalog/modules/checker-runtime/fs.ts +0 -48
  19. package/catalog/modules/checker-runtime/manifest.json +0 -29
  20. package/catalog/modules/checker-runtime/runtime.ts +0 -79
  21. package/catalog/modules/devflow/.agents/skills/devflow/SKILL.md +0 -33
  22. package/catalog/modules/devflow/.devflow.json +0 -10
  23. package/catalog/modules/devflow/manifest.json +0 -35
  24. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/SKILL.md +0 -85
  25. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/activeScenario.mjs +0 -130
  26. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/checkLocalEnvironment.mjs +0 -7
  27. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/completeActiveScenario.mjs +0 -36
  28. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/createActiveScenario.mjs +0 -143
  29. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/localEnvironment.mjs +0 -43
  30. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/prompt.mjs +0 -25
  31. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/runActiveScenario.mjs +0 -66
  32. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/runAuthoringScenario.mjs +0 -146
  33. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/seed.mjs +0 -56
  34. package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/seedActiveScenario.mjs +0 -6
  35. package/catalog/modules/e2e-playwright/docs/e2e-playwright/README.md +0 -103
  36. package/catalog/modules/e2e-playwright/manifest.json +0 -206
  37. package/catalog/modules/e2e-playwright/playwright.e2e.config.ts +0 -39
  38. package/catalog/modules/e2e-playwright/tests/e2e/support/e2ePlaywrightFlow.ts +0 -107
  39. package/catalog/modules/e2e-playwright/tests/e2e/support/fixtures.ts +0 -27
  40. package/catalog/modules/local-log/AGENTS.local-log.md +0 -13
  41. package/catalog/modules/local-log/docs/features/local-logging/README.md +0 -70
  42. package/catalog/modules/local-log/manifest.json +0 -39
  43. package/catalog/modules/local-log/tmp/logs/.gitignore +0 -2
  44. package/catalog/modules/local-log/tools/local-log/README.md +0 -47
  45. package/catalog/modules/local-log/tools/local-log/local-log.mjs +0 -241
  46. package/catalog/modules/stack-common-vite/manifest.json +0 -16
  47. package/catalog/modules/stack-expo-convex/manifest.json +0 -31
  48. package/catalog/modules/stack-expo-supabase/manifest.json +0 -44
  49. package/catalog/modules/stack-vite-convex/manifest.json +0 -32
  50. package/catalog/modules/stack-vite-supabase/manifest.json +0 -45
  51. package/catalog/rules/abac-permissions-convex/SKILL.md +0 -17
  52. package/catalog/rules/abac-permissions-convex/check.ts +0 -87
  53. package/catalog/rules/abac-permissions-convex/manifest.json +0 -33
  54. package/catalog/rules/abac-permissions-supabase/SKILL.md +0 -17
  55. package/catalog/rules/abac-permissions-supabase/check.ts +0 -87
  56. package/catalog/rules/abac-permissions-supabase/manifest.json +0 -33
  57. package/catalog/rules/convex-multi-presentation/SKILL.md +0 -47
  58. package/catalog/rules/convex-multi-presentation/check.ts +0 -205
  59. package/catalog/rules/convex-multi-presentation/manifest.json +0 -47
  60. package/catalog/rules/convex-multi-presentation/policy.ts +0 -261
  61. package/catalog/rules/design-rules/SKILL.md +0 -12
  62. package/catalog/rules/design-rules/check.ts +0 -84
  63. package/catalog/rules/design-rules/config.json +0 -5
  64. package/catalog/rules/design-rules/manifest.json +0 -38
  65. package/catalog/rules/e2e-test-rules/SKILL.md +0 -46
  66. package/catalog/rules/e2e-test-rules/check.ts +0 -145
  67. package/catalog/rules/e2e-test-rules/config.json +0 -32
  68. package/catalog/rules/e2e-test-rules/manifest.json +0 -38
  69. package/catalog/rules/error-handling-rules/SKILL.md +0 -21
  70. package/catalog/rules/error-handling-rules/check.ts +0 -73
  71. package/catalog/rules/error-handling-rules/manifest.json +0 -33
  72. package/catalog/rules/layers-and-contracts/SKILL.md +0 -36
  73. package/catalog/rules/layers-and-contracts/check.ts +0 -266
  74. package/catalog/rules/layers-and-contracts/manifest.json +0 -33
  75. package/catalog/rules/layers-and-contracts-convex/SKILL.md +0 -49
  76. package/catalog/rules/layers-and-contracts-convex/check.ts +0 -289
  77. package/catalog/rules/layers-and-contracts-convex/manifest.json +0 -38
  78. package/catalog/rules/layers-and-contracts-convex/policy.ts +0 -68
  79. package/catalog/rules/layers-and-contracts-supabase/SKILL.md +0 -52
  80. package/catalog/rules/layers-and-contracts-supabase/check.ts +0 -371
  81. package/catalog/rules/layers-and-contracts-supabase/manifest.json +0 -38
  82. package/catalog/rules/layers-and-contracts-supabase/policy.ts +0 -68
  83. package/catalog/rules/module-size-rules/SKILL.md +0 -5
  84. package/catalog/rules/module-size-rules/check.ts +0 -144
  85. package/catalog/rules/module-size-rules/config.json +0 -6
  86. package/catalog/rules/module-size-rules/manifest.json +0 -38
  87. package/catalog/rules/module-size-rules-convex/SKILL.md +0 -5
  88. package/catalog/rules/module-size-rules-convex/check.ts +0 -146
  89. package/catalog/rules/module-size-rules-convex/config.json +0 -6
  90. package/catalog/rules/module-size-rules-convex/manifest.json +0 -38
  91. package/catalog/rules/module-size-rules-supabase/SKILL.md +0 -5
  92. package/catalog/rules/module-size-rules-supabase/check.ts +0 -146
  93. package/catalog/rules/module-size-rules-supabase/config.json +0 -12
  94. package/catalog/rules/module-size-rules-supabase/manifest.json +0 -38
  95. package/catalog/rules/mutation-command-rules/SKILL.md +0 -15
  96. package/catalog/rules/mutation-command-rules/check.ts +0 -30
  97. package/catalog/rules/mutation-command-rules/config.json +0 -19
  98. package/catalog/rules/mutation-command-rules/manifest.json +0 -38
  99. package/catalog/rules/nearby-contracts/SKILL.md +0 -18
  100. package/catalog/rules/nearby-contracts/check.ts +0 -138
  101. package/catalog/rules/nearby-contracts/config.json +0 -10
  102. package/catalog/rules/nearby-contracts/manifest.json +0 -38
  103. package/catalog/rules/no-raw-click-buttons/SKILL.md +0 -5
  104. package/catalog/rules/no-raw-click-buttons/check.ts +0 -37
  105. package/catalog/rules/no-raw-click-buttons/manifest.json +0 -33
  106. package/catalog/rules/public-api-export-barrels/SKILL.md +0 -45
  107. package/catalog/rules/public-api-export-barrels/check.ts +0 -73
  108. package/catalog/rules/public-api-export-barrels/config.json +0 -4
  109. package/catalog/rules/public-api-export-barrels/manifest.json +0 -38
  110. package/catalog/rules/route-tree-fresh/SKILL.md +0 -16
  111. package/catalog/rules/route-tree-fresh/check.ts +0 -66
  112. package/catalog/rules/route-tree-fresh/manifest.json +0 -33
  113. package/catalog/rules/strict-typescript/SKILL.md +0 -3
  114. package/catalog/rules/strict-typescript/check.ts +0 -119
  115. package/catalog/rules/strict-typescript/manifest.json +0 -33
  116. package/catalog/rules/supabase-contracts/SKILL.md +0 -3
  117. package/catalog/rules/supabase-contracts/check.ts +0 -172
  118. package/catalog/rules/supabase-contracts/manifest.json +0 -33
  119. package/catalog/rules/supabase-declarative-schema/SKILL.md +0 -30
  120. package/catalog/rules/supabase-declarative-schema/check.ts +0 -262
  121. package/catalog/rules/supabase-declarative-schema/config.json +0 -8
  122. package/catalog/rules/supabase-declarative-schema/manifest.json +0 -38
  123. package/catalog/rules/tanstack-form-rules/SKILL.md +0 -11
  124. package/catalog/rules/tanstack-form-rules/check.ts +0 -58
  125. package/catalog/rules/tanstack-form-rules/manifest.json +0 -33
  126. package/catalog/rules/unit-test-rules/SKILL.md +0 -55
  127. package/catalog/rules/unit-test-rules/check.ts +0 -132
  128. package/catalog/rules/unit-test-rules/config.json +0 -22
  129. package/catalog/rules/unit-test-rules/manifest.json +0 -38
  130. package/catalog/rules/unit-test-rules-convex/SKILL.md +0 -41
  131. package/catalog/rules/unit-test-rules-convex/check.ts +0 -418
  132. package/catalog/rules/unit-test-rules-convex/manifest.json +0 -33
  133. package/catalog/rules/unit-test-rules-supabase/SKILL.md +0 -40
  134. package/catalog/rules/unit-test-rules-supabase/check.ts +0 -492
  135. package/catalog/rules/unit-test-rules-supabase/manifest.json +0 -33
  136. package/catalog/rules/workstation-controller-rules/SKILL.md +0 -22
  137. package/catalog/rules/workstation-controller-rules/check.ts +0 -108
  138. package/catalog/rules/workstation-controller-rules/manifest.json +0 -33
@@ -1,38 +0,0 @@
1
- {
2
- "id": "nearby-contracts",
3
- "kind": "rule",
4
- "version": "1.0.3",
5
- "requires": [
6
- "checker-runtime"
7
- ],
8
- "artifacts": [
9
- {
10
- "kind": "managed-file",
11
- "path": ".agents/skills/nearby-contracts/SKILL.md",
12
- "source": "SKILL.md"
13
- },
14
- {
15
- "kind": "managed-file",
16
- "path": ".agents/skills/nearby-contracts/check.ts",
17
- "source": "check.ts"
18
- },
19
- {
20
- "kind": "managed-file",
21
- "path": ".agents/skills/nearby-contracts/config.json",
22
- "source": "config.json"
23
- },
24
- {
25
- "kind": "shared-markdown-section",
26
- "path": "AGENTS.md",
27
- "heading": "## Specdest rule: nearby-contracts",
28
- "body": "Use `.agents/skills/nearby-contracts/SKILL.md` when working in this rule area. Run `node .agents/skills/nearby-contracts/check.ts` before handoff."
29
- }
30
- ],
31
- "obsolete": [],
32
- "check": {
33
- "command": [
34
- "node",
35
- ".agents/skills/nearby-contracts/check.ts"
36
- ]
37
- }
38
- }
@@ -1,5 +0,0 @@
1
- # No Raw Click Buttons
2
-
3
- App code must use shared guarded button primitives instead of raw `<button>` elements.
4
-
5
- Use `Button` for normal actions and submits. Use `ConfirmButton` for destructive actions such as delete/remove.
@@ -1,37 +0,0 @@
1
- import { runtime } from "../shared/runtime.ts";
2
- import { walk } from "../shared/fs.ts";
3
-
4
- const allowedFiles = new Set(["src/components/ui/button.tsx"]);
5
- const ignoredSuffixes = [".test.tsx", ".stories.tsx"];
6
-
7
- function shouldCheck(file: string): boolean {
8
- return (
9
- file.startsWith("src/") &&
10
- file.endsWith(".tsx") &&
11
- !allowedFiles.has(file) &&
12
- !ignoredSuffixes.some((suffix) => file.endsWith(suffix))
13
- );
14
- }
15
-
16
- const files = (await walk("src")).map((file) => `src/${file}`).filter(shouldCheck);
17
- const violations: string[] = [];
18
-
19
- for (const file of files) {
20
- const text = await runtime.readTextFile(file);
21
- const lines = text.split("\n");
22
- lines.forEach((line, index) => {
23
- if (/<button(\s|>|$)/.test(line)) {
24
- violations.push(
25
- `${file}:${index + 1}: raw <button> is forbidden; use Button or ConfirmButton`,
26
- );
27
- }
28
- });
29
- }
30
-
31
- if (violations.length > 0) {
32
- console.error(`# raw button violations: ${violations.length}`);
33
- console.error(violations.join("\n"));
34
- runtime.exit(1);
35
- }
36
-
37
- console.log("no-raw-click-buttons ok");
@@ -1,33 +0,0 @@
1
- {
2
- "id": "no-raw-click-buttons",
3
- "kind": "rule",
4
- "version": "1.0.1",
5
- "requires": [
6
- "checker-runtime"
7
- ],
8
- "artifacts": [
9
- {
10
- "kind": "managed-file",
11
- "path": ".agents/skills/no-raw-click-buttons/SKILL.md",
12
- "source": "SKILL.md"
13
- },
14
- {
15
- "kind": "managed-file",
16
- "path": ".agents/skills/no-raw-click-buttons/check.ts",
17
- "source": "check.ts"
18
- },
19
- {
20
- "kind": "shared-markdown-section",
21
- "path": "AGENTS.md",
22
- "heading": "## Specdest rule: no-raw-click-buttons",
23
- "body": "Use `.agents/skills/no-raw-click-buttons/SKILL.md` when working in this rule area. Run `node .agents/skills/no-raw-click-buttons/check.ts` before handoff."
24
- }
25
- ],
26
- "obsolete": [],
27
- "check": {
28
- "command": [
29
- "node",
30
- ".agents/skills/no-raw-click-buttons/check.ts"
31
- ]
32
- }
33
- }
@@ -1,45 +0,0 @@
1
- ---
2
- name: public-api-export-barrels
3
- description: Rules for approving and checking public API export barrel files.
4
- ---
5
-
6
- # Approved public API export barrels
7
-
8
- Use this skill before adding, changing, or reviewing export barrel files.
9
-
10
- ## Rule
11
-
12
- Barrel files are public API boundaries. Do not add `index.ts`, `index.tsx`, `index.js`, or `index.jsx` files that re-export modules unless the file is intentionally approved in project configuration.
13
-
14
- ## Approval config
15
-
16
- Approved barrels live in `.agents/skills/public-api-export-barrels/config.json`:
17
-
18
- ```json
19
- {
20
- "schemaVersion": 1,
21
- "allowedBarrels": ["src/features/user/index.ts"]
22
- }
23
- ```
24
-
25
- Use project-relative POSIX paths. Keep the list small and intentional.
26
-
27
- ## Check
28
-
29
- Run before handoff:
30
-
31
- ```bash
32
- nps lint
33
- ```
34
-
35
- Direct checker:
36
-
37
- ```bash
38
- node .agents/skills/public-api-export-barrels/check.ts
39
- ```
40
-
41
- ## Fix violations
42
-
43
- - Prefer direct imports from the source module.
44
- - Keep a barrel only when it is the documented public API for a package, feature, or boundary.
45
- - Add the barrel path to `.agents/skills/public-api-export-barrels/config.json` only after the public API decision is explicit.
@@ -1,73 +0,0 @@
1
- import { runtime } from "../shared/runtime.ts";
2
- const textEncoder = new TextEncoder();
3
- function writeLine(message: string): void {
4
- runtime.stdout.writeSync(textEncoder.encode(`${message}\n`));
5
- }
6
- import { existsSync, readFileSync, readdirSync } from "node:fs";
7
- import path from "node:path";
8
-
9
- const root = path.resolve(runtime.args[0] || runtime.cwd());
10
- const configFile = path.join(path.dirname(new URL(import.meta.url).pathname), "config.json");
11
- const skip = new Set([".git", "code-templates", "node_modules", "dist", "build", "coverage"]);
12
-
13
- function rel(file: string): string {
14
- return path.relative(root, file).split(path.sep).join("/");
15
- }
16
-
17
- type Config = { readonly schemaVersion: 1; readonly allowedBarrels: readonly string[] };
18
-
19
- function readConfig(): Config {
20
- if (!existsSync(configFile)) return { schemaVersion: 1, allowedBarrels: [] };
21
- const config = JSON.parse(readFileSync(configFile, "utf8")) as {
22
- schemaVersion?: unknown;
23
- allowedBarrels?: unknown;
24
- };
25
- if (config.schemaVersion !== 1)
26
- throw new Error(".agents/skills/public-api-export-barrels/config.json schemaVersion must be 1");
27
- if (!Array.isArray(config.allowedBarrels))
28
- throw new Error(
29
- ".agents/skills/public-api-export-barrels/config.json allowedBarrels must be an array",
30
- );
31
- return { schemaVersion: 1, allowedBarrels: config.allowedBarrels as string[] };
32
- }
33
-
34
- function walk(dir: string, out: string[] = []): string[] {
35
- if (!existsSync(dir)) return out;
36
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
37
- const full = path.join(dir, entry.name);
38
- if (entry.isDirectory()) {
39
- if (!skip.has(entry.name)) walk(full, out);
40
- } else if (
41
- [
42
- "index.ts",
43
- "index.tsx",
44
- "index.js",
45
- "index.jsx",
46
- "index.mts",
47
- "index.cts",
48
- "index.mjs",
49
- "index.cjs",
50
- ].includes(entry.name)
51
- ) {
52
- out.push(full);
53
- }
54
- }
55
- return out;
56
- }
57
-
58
- function hasReExport(file: string): boolean {
59
- return readFileSync(file, "utf8")
60
- .split("\n")
61
- .some((line) => line.trim().startsWith("export *") || line.trim().startsWith("export {"));
62
- }
63
-
64
- const allowed = new Set(
65
- readConfig().allowedBarrels.map((item: string) => item.replaceAll("\\", "/")),
66
- );
67
- const failures = walk(root)
68
- .map(rel)
69
- .filter((file) => hasReExport(path.join(root, file)) && !allowed.has(file));
70
-
71
- writeLine(`# public API export barrel violations: ${failures.length}`);
72
- for (const file of failures) writeLine(`- ${file}: unapproved export barrel`);
73
- if (failures.length > 0) throw new Error("Unapproved export barrels found");
@@ -1,4 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "allowedBarrels": []
4
- }
@@ -1,38 +0,0 @@
1
- {
2
- "id": "public-api-export-barrels",
3
- "kind": "rule",
4
- "version": "1.0.2",
5
- "requires": [
6
- "checker-runtime"
7
- ],
8
- "artifacts": [
9
- {
10
- "kind": "managed-file",
11
- "path": ".agents/skills/public-api-export-barrels/SKILL.md",
12
- "source": "SKILL.md"
13
- },
14
- {
15
- "kind": "managed-file",
16
- "path": ".agents/skills/public-api-export-barrels/check.ts",
17
- "source": "check.ts"
18
- },
19
- {
20
- "kind": "scaffold",
21
- "path": ".agents/skills/public-api-export-barrels/config.json",
22
- "source": "config.json"
23
- },
24
- {
25
- "kind": "shared-markdown-section",
26
- "path": "AGENTS.md",
27
- "heading": "## Specdest rule: public-api-export-barrels",
28
- "body": "Use `.agents/skills/public-api-export-barrels/SKILL.md` when working in this rule area. Run `node .agents/skills/public-api-export-barrels/check.ts` before handoff."
29
- }
30
- ],
31
- "obsolete": [],
32
- "check": {
33
- "command": [
34
- "node",
35
- ".agents/skills/public-api-export-barrels/check.ts"
36
- ]
37
- }
38
- }
@@ -1,16 +0,0 @@
1
- # Route tree freshness
2
-
3
- Use this skill when adding, removing, or renaming TanStack Router route files.
4
-
5
- ## Rules
6
-
7
- - `src/routeTree.gen.ts` must exist.
8
- - Every route file that calls `createFileRoute("...")` must have its route id
9
- present in `src/routeTree.gen.ts`.
10
- - Regenerate the route tree after changing `src/routes/**`.
11
-
12
- ## Script wiring
13
-
14
- Run `nps lint.routeTreeFresh` for this checker directly. It is also part of
15
- `nps lint.raw`, so `nps lint`, `nps check`, and the generated Husky pre-commit
16
- hook enforce this rule.
@@ -1,66 +0,0 @@
1
- import { runtime } from "../shared/runtime.ts";
2
- // oxlint-disable no-console no-await-in-loop
3
- const decoder = new TextDecoder();
4
- const violations: string[] = [];
5
-
6
- async function exists(path: string): Promise<boolean> {
7
- try {
8
- await runtime.stat(path);
9
- return true;
10
- } catch {
11
- return false;
12
- }
13
- }
14
-
15
- async function* walk(dir: string): AsyncGenerator<string> {
16
- try {
17
- for await (const entry of runtime.readDir(dir)) {
18
- const path = `${dir}/${entry.name}`;
19
- if (entry.isDirectory) yield* walk(path);
20
- if (entry.isFile && /\.tsx?$/.test(entry.name)) yield path;
21
- }
22
- } catch {
23
- return;
24
- }
25
- }
26
-
27
- const usesTanstackFileRoutes =
28
- (await exists("src/routes")) || (await exists("src/routeTree.gen.ts"));
29
-
30
- if (!usesTanstackFileRoutes) {
31
- console.log("route-tree-fresh not applicable");
32
- runtime.exit(0);
33
- }
34
-
35
- if (!(await exists("src/routeTree.gen.ts"))) {
36
- violations.push("missing generated route tree: src/routeTree.gen.ts");
37
- } else {
38
- const routeTree = decoder.decode(await runtime.readFile("src/routeTree.gen.ts"));
39
-
40
- for await (const file of walk("src/routes")) {
41
- if (file.includes("/-components/")) continue;
42
- if (!file.endsWith(".tsx")) continue;
43
-
44
- const text = decoder.decode(await runtime.readFile(file));
45
- const match = text.match(/createFileRoute\(["']([^"']+)["']\)/u);
46
- if (!match) continue;
47
-
48
- const routeId = match[1];
49
- const routeIdPattern = new RegExp(escapeRegExp(routeId), "u");
50
- if (!routeIdPattern.test(routeTree)) {
51
- violations.push(
52
- `${file}: route id ${routeId} is missing from src/routeTree.gen.ts; regenerate routes`,
53
- );
54
- }
55
- }
56
- }
57
-
58
- if (violations.length) {
59
- console.error(violations.join("\n"));
60
- runtime.exit(1);
61
- }
62
- console.log("route-tree-fresh ok");
63
-
64
- function escapeRegExp(value: string): string {
65
- return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
66
- }
@@ -1,33 +0,0 @@
1
- {
2
- "id": "route-tree-fresh",
3
- "kind": "rule",
4
- "version": "1.0.2",
5
- "requires": [
6
- "checker-runtime"
7
- ],
8
- "artifacts": [
9
- {
10
- "kind": "managed-file",
11
- "path": ".agents/skills/route-tree-fresh/SKILL.md",
12
- "source": "SKILL.md"
13
- },
14
- {
15
- "kind": "managed-file",
16
- "path": ".agents/skills/route-tree-fresh/check.ts",
17
- "source": "check.ts"
18
- },
19
- {
20
- "kind": "shared-markdown-section",
21
- "path": "AGENTS.md",
22
- "heading": "## Specdest rule: route-tree-fresh",
23
- "body": "Use `.agents/skills/route-tree-fresh/SKILL.md` when working in this rule area. Run `node .agents/skills/route-tree-fresh/check.ts` before handoff."
24
- }
25
- ],
26
- "obsolete": [],
27
- "check": {
28
- "command": [
29
- "node",
30
- ".agents/skills/route-tree-fresh/check.ts"
31
- ]
32
- }
33
- }
@@ -1,3 +0,0 @@
1
- # Strict TypeScript
2
-
3
- Use strict compiler options. Do not use `any`, unsafe casts, non-null assertions, or manually declared boundary object types. Boundary types must come from Zod schemas.
@@ -1,119 +0,0 @@
1
- import { runtime } from "../shared/runtime.ts";
2
- // oxlint-disable no-console no-await-in-loop
3
- const violations: string[] = [];
4
-
5
- async function* walk(dir: string): AsyncGenerator<string> {
6
- try {
7
- for await (const entry of runtime.readDir(dir)) {
8
- const path = `${dir}/${entry.name}`;
9
- if (entry.isDirectory) yield* walk(path);
10
- if (entry.isFile && /\.(ts|tsx)$/u.test(entry.name)) yield path;
11
- }
12
- } catch {
13
- return;
14
- }
15
- }
16
-
17
- function isIgnored(file: string): boolean {
18
- return file.endsWith("routeTree.gen.ts") || file.startsWith("src/__generated__/");
19
- }
20
-
21
- function isTestOrStory(file: string): boolean {
22
- return (
23
- /\.(test|spec)\.(ts|tsx)$/u.test(file) ||
24
- file.endsWith(".stories.tsx") ||
25
- file.includes("/tests/") ||
26
- file.startsWith("src/test/")
27
- );
28
- }
29
-
30
- function stripComments(text: string): string {
31
- let result = "";
32
- let index = 0;
33
- let quote: string | null = null;
34
- while (index < text.length) {
35
- const char = text[index] ?? "";
36
- const next = text[index + 1] ?? "";
37
- if (quote) {
38
- result += char;
39
- if (char === "\\") {
40
- result += next;
41
- index += 2;
42
- continue;
43
- }
44
- if (char === quote) quote = null;
45
- index += 1;
46
- continue;
47
- }
48
- if (char === '"' || char === "'" || char === "`") {
49
- quote = char;
50
- result += char;
51
- index += 1;
52
- continue;
53
- }
54
- if (char === "/" && next === "/") {
55
- while (index < text.length && text[index] !== "\n") {
56
- result += " ";
57
- index += 1;
58
- }
59
- continue;
60
- }
61
- if (char === "/" && next === "*") {
62
- result += " ";
63
- index += 2;
64
- while (index < text.length && !(text[index] === "*" && text[index + 1] === "/")) {
65
- result += text[index] === "\n" ? "\n" : " ";
66
- index += 1;
67
- }
68
- if (index < text.length) {
69
- result += " ";
70
- index += 2;
71
- }
72
- continue;
73
- }
74
- result += char;
75
- index += 1;
76
- }
77
- return result;
78
- }
79
-
80
- function lineNumber(text: string, index: number): number {
81
- return text.slice(0, index).split("\n").length;
82
- }
83
-
84
- function checkBoundarySchemaTypes(file: string, text: string): void {
85
- if (!/\.(input|output|form|callbackInput)\.schema\.ts$/u.test(file)) return;
86
- if (/\bexport\s+(?:type|interface)\s+\w+\s*(?:=\s*\{|\{)/u.test(text)) {
87
- violations.push(
88
- `${file}: boundary schema files must not hand-author object boundary types; use z.infer<typeof schema>`,
89
- );
90
- }
91
- }
92
-
93
- for await (const file of walk("src")) {
94
- if (isIgnored(file)) continue;
95
- const text = await runtime.readTextFile(file);
96
- const source = stripComments(text);
97
- checkBoundarySchemaTypes(file, source);
98
- if (isTestOrStory(file)) continue;
99
- const hasAnyType =
100
- /:\s*[^=;\n]*\bany\b/u.test(source) ||
101
- /\btype\s+\w+(?:\s*<[^>]+>)?\s*=\s*[^;\n]*\bany\b/u.test(source) ||
102
- /\b(?:Array|Promise|ReadonlyArray|Record|Map|Set)\s*<[^>\n]*\bany\b[^>\n]*>/u.test(source) ||
103
- /\bany\s*\[\]/u.test(source);
104
- if (hasAnyType) violations.push(`${file}: avoid any`);
105
- if (/!\./u.test(source) || /!;/u.test(source)) {
106
- violations.push(`${file}: avoid non-null assertions`);
107
- }
108
- for (const match of source.matchAll(
109
- /\bas\s+(any|unknown|never)\b|\bas\s+unknown\s+as\b|<any>/gu,
110
- )) {
111
- violations.push(`${file}:${lineNumber(text, match.index ?? 0)} avoid unsafe casts`);
112
- }
113
- }
114
-
115
- if (violations.length) {
116
- console.error(violations.join("\n"));
117
- runtime.exit(1);
118
- }
119
- console.log("strict-typescript ok");
@@ -1,33 +0,0 @@
1
- {
2
- "id": "strict-typescript",
3
- "kind": "rule",
4
- "version": "1.0.4",
5
- "requires": [
6
- "checker-runtime"
7
- ],
8
- "artifacts": [
9
- {
10
- "kind": "managed-file",
11
- "path": ".agents/skills/strict-typescript/SKILL.md",
12
- "source": "SKILL.md"
13
- },
14
- {
15
- "kind": "managed-file",
16
- "path": ".agents/skills/strict-typescript/check.ts",
17
- "source": "check.ts"
18
- },
19
- {
20
- "kind": "shared-markdown-section",
21
- "path": "AGENTS.md",
22
- "heading": "## Specdest rule: strict-typescript",
23
- "body": "Use `.agents/skills/strict-typescript/SKILL.md` when working in this rule area. Run `node .agents/skills/strict-typescript/check.ts` before handoff."
24
- }
25
- ],
26
- "obsolete": [],
27
- "check": {
28
- "command": [
29
- "node",
30
- ".agents/skills/strict-typescript/check.ts"
31
- ]
32
- }
33
- }
@@ -1,3 +0,0 @@
1
- # Supabase contracts
2
-
3
- DB send/return contracts derive from generated DB Zod schemas. Edge Functions use `edgeSchema`. Keep `src/__generated__` and `supabase/functions/_shared` synchronized by symlink when safe or copy fallback.