@specdest/devkit 0.2.2 → 0.3.1
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/README.md +17 -18
- package/package.json +4 -4
- package/src/canonical-project-operations.js +164 -0
- package/src/canonical-project.js +78 -0
- package/src/canonical-source.js +114 -0
- package/src/cli.js +2 -2
- package/src/git-catalog.js +105 -0
- package/src/index.js +6 -2
- package/src/project-operations.js +65 -6
- package/src/remote-installer.js +478 -0
- package/src/sync-core.js +20 -7
- package/catalog/README.md +0 -11
- package/catalog/modules/backend-convex/manifest.json +0 -14
- package/catalog/modules/backend-convex-expo/manifest.json +0 -11
- package/catalog/modules/backend-supabase/manifest.json +0 -15
- package/catalog/modules/backend-supabase-expo/manifest.json +0 -11
- package/catalog/modules/checker-runtime/config.ts +0 -25
- package/catalog/modules/checker-runtime/fs.ts +0 -48
- package/catalog/modules/checker-runtime/manifest.json +0 -29
- package/catalog/modules/checker-runtime/runtime.ts +0 -79
- package/catalog/modules/devflow/.agents/skills/devflow/SKILL.md +0 -33
- package/catalog/modules/devflow/.devflow.json +0 -10
- package/catalog/modules/devflow/manifest.json +0 -35
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/SKILL.md +0 -85
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/activeScenario.mjs +0 -130
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/checkLocalEnvironment.mjs +0 -7
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/completeActiveScenario.mjs +0 -36
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/createActiveScenario.mjs +0 -143
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/localEnvironment.mjs +0 -43
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/prompt.mjs +0 -25
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/runActiveScenario.mjs +0 -66
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/runAuthoringScenario.mjs +0 -146
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/seed.mjs +0 -56
- package/catalog/modules/e2e-playwright/.agents/skills/e2e-playwright/scripts/seedActiveScenario.mjs +0 -6
- package/catalog/modules/e2e-playwright/docs/e2e-playwright/README.md +0 -103
- package/catalog/modules/e2e-playwright/manifest.json +0 -206
- package/catalog/modules/e2e-playwright/playwright.e2e.config.ts +0 -39
- package/catalog/modules/e2e-playwright/tests/e2e/support/e2ePlaywrightFlow.ts +0 -107
- package/catalog/modules/e2e-playwright/tests/e2e/support/fixtures.ts +0 -27
- package/catalog/modules/local-log/AGENTS.local-log.md +0 -13
- package/catalog/modules/local-log/docs/features/local-logging/README.md +0 -70
- package/catalog/modules/local-log/manifest.json +0 -39
- package/catalog/modules/local-log/tmp/logs/.gitignore +0 -2
- package/catalog/modules/local-log/tools/local-log/README.md +0 -47
- package/catalog/modules/local-log/tools/local-log/local-log.mjs +0 -241
- package/catalog/modules/stack-common-vite/manifest.json +0 -16
- package/catalog/modules/stack-expo-convex/manifest.json +0 -31
- package/catalog/modules/stack-expo-supabase/manifest.json +0 -44
- package/catalog/modules/stack-vite-convex/manifest.json +0 -32
- package/catalog/modules/stack-vite-supabase/manifest.json +0 -45
- package/catalog/rules/abac-permissions-convex/SKILL.md +0 -17
- package/catalog/rules/abac-permissions-convex/check.ts +0 -87
- package/catalog/rules/abac-permissions-convex/manifest.json +0 -33
- package/catalog/rules/abac-permissions-supabase/SKILL.md +0 -17
- package/catalog/rules/abac-permissions-supabase/check.ts +0 -87
- package/catalog/rules/abac-permissions-supabase/manifest.json +0 -33
- package/catalog/rules/convex-multi-presentation/SKILL.md +0 -47
- package/catalog/rules/convex-multi-presentation/check.ts +0 -205
- package/catalog/rules/convex-multi-presentation/manifest.json +0 -47
- package/catalog/rules/convex-multi-presentation/policy.ts +0 -261
- package/catalog/rules/design-rules/SKILL.md +0 -12
- package/catalog/rules/design-rules/check.ts +0 -84
- package/catalog/rules/design-rules/config.json +0 -5
- package/catalog/rules/design-rules/manifest.json +0 -38
- package/catalog/rules/e2e-test-rules/SKILL.md +0 -46
- package/catalog/rules/e2e-test-rules/check.ts +0 -145
- package/catalog/rules/e2e-test-rules/config.json +0 -32
- package/catalog/rules/e2e-test-rules/manifest.json +0 -38
- package/catalog/rules/error-handling-rules/SKILL.md +0 -21
- package/catalog/rules/error-handling-rules/check.ts +0 -73
- package/catalog/rules/error-handling-rules/manifest.json +0 -33
- package/catalog/rules/layers-and-contracts/SKILL.md +0 -36
- package/catalog/rules/layers-and-contracts/check.ts +0 -266
- package/catalog/rules/layers-and-contracts/manifest.json +0 -33
- package/catalog/rules/layers-and-contracts-convex/SKILL.md +0 -49
- package/catalog/rules/layers-and-contracts-convex/check.ts +0 -289
- package/catalog/rules/layers-and-contracts-convex/manifest.json +0 -38
- package/catalog/rules/layers-and-contracts-convex/policy.ts +0 -68
- package/catalog/rules/layers-and-contracts-supabase/SKILL.md +0 -52
- package/catalog/rules/layers-and-contracts-supabase/check.ts +0 -371
- package/catalog/rules/layers-and-contracts-supabase/manifest.json +0 -38
- package/catalog/rules/layers-and-contracts-supabase/policy.ts +0 -68
- package/catalog/rules/module-size-rules/SKILL.md +0 -5
- package/catalog/rules/module-size-rules/check.ts +0 -144
- package/catalog/rules/module-size-rules/config.json +0 -6
- package/catalog/rules/module-size-rules/manifest.json +0 -38
- package/catalog/rules/module-size-rules-convex/SKILL.md +0 -5
- package/catalog/rules/module-size-rules-convex/check.ts +0 -146
- package/catalog/rules/module-size-rules-convex/config.json +0 -6
- package/catalog/rules/module-size-rules-convex/manifest.json +0 -38
- package/catalog/rules/module-size-rules-supabase/SKILL.md +0 -5
- package/catalog/rules/module-size-rules-supabase/check.ts +0 -146
- package/catalog/rules/module-size-rules-supabase/config.json +0 -12
- package/catalog/rules/module-size-rules-supabase/manifest.json +0 -38
- package/catalog/rules/mutation-command-rules/SKILL.md +0 -15
- package/catalog/rules/mutation-command-rules/check.ts +0 -30
- package/catalog/rules/mutation-command-rules/config.json +0 -19
- package/catalog/rules/mutation-command-rules/manifest.json +0 -38
- package/catalog/rules/nearby-contracts/SKILL.md +0 -18
- package/catalog/rules/nearby-contracts/check.ts +0 -138
- package/catalog/rules/nearby-contracts/config.json +0 -10
- package/catalog/rules/nearby-contracts/manifest.json +0 -38
- package/catalog/rules/no-raw-click-buttons/SKILL.md +0 -5
- package/catalog/rules/no-raw-click-buttons/check.ts +0 -37
- package/catalog/rules/no-raw-click-buttons/manifest.json +0 -33
- package/catalog/rules/public-api-export-barrels/SKILL.md +0 -45
- package/catalog/rules/public-api-export-barrels/check.ts +0 -73
- package/catalog/rules/public-api-export-barrels/config.json +0 -4
- package/catalog/rules/public-api-export-barrels/manifest.json +0 -38
- package/catalog/rules/route-tree-fresh/SKILL.md +0 -16
- package/catalog/rules/route-tree-fresh/check.ts +0 -66
- package/catalog/rules/route-tree-fresh/manifest.json +0 -33
- package/catalog/rules/strict-typescript/SKILL.md +0 -3
- package/catalog/rules/strict-typescript/check.ts +0 -119
- package/catalog/rules/strict-typescript/manifest.json +0 -33
- package/catalog/rules/supabase-contracts/SKILL.md +0 -3
- package/catalog/rules/supabase-contracts/check.ts +0 -172
- package/catalog/rules/supabase-contracts/manifest.json +0 -33
- package/catalog/rules/supabase-declarative-schema/SKILL.md +0 -30
- package/catalog/rules/supabase-declarative-schema/check.ts +0 -262
- package/catalog/rules/supabase-declarative-schema/config.json +0 -8
- package/catalog/rules/supabase-declarative-schema/manifest.json +0 -38
- package/catalog/rules/tanstack-form-rules/SKILL.md +0 -11
- package/catalog/rules/tanstack-form-rules/check.ts +0 -58
- package/catalog/rules/tanstack-form-rules/manifest.json +0 -33
- package/catalog/rules/unit-test-rules/SKILL.md +0 -55
- package/catalog/rules/unit-test-rules/check.ts +0 -132
- package/catalog/rules/unit-test-rules/config.json +0 -22
- package/catalog/rules/unit-test-rules/manifest.json +0 -38
- package/catalog/rules/unit-test-rules-convex/SKILL.md +0 -41
- package/catalog/rules/unit-test-rules-convex/check.ts +0 -418
- package/catalog/rules/unit-test-rules-convex/manifest.json +0 -33
- package/catalog/rules/unit-test-rules-supabase/SKILL.md +0 -40
- package/catalog/rules/unit-test-rules-supabase/check.ts +0 -492
- package/catalog/rules/unit-test-rules-supabase/manifest.json +0 -33
- package/catalog/rules/workstation-controller-rules/SKILL.md +0 -22
- package/catalog/rules/workstation-controller-rules/check.ts +0 -108
- package/catalog/rules/workstation-controller-rules/manifest.json +0 -33
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "design-rules",
|
|
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/design-rules/SKILL.md",
|
|
12
|
-
"source": "SKILL.md"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"kind": "managed-file",
|
|
16
|
-
"path": ".agents/skills/design-rules/check.ts",
|
|
17
|
-
"source": "check.ts"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"kind": "scaffold",
|
|
21
|
-
"path": ".agents/skills/design-rules/config.json",
|
|
22
|
-
"source": "config.json"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"kind": "shared-markdown-section",
|
|
26
|
-
"path": "AGENTS.md",
|
|
27
|
-
"heading": "## Specdest rule: design-rules",
|
|
28
|
-
"body": "Use `.agents/skills/design-rules/SKILL.md` when working in this rule area. Run `node .agents/skills/design-rules/check.ts` before handoff."
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"obsolete": [],
|
|
32
|
-
"check": {
|
|
33
|
-
"command": [
|
|
34
|
-
"node",
|
|
35
|
-
".agents/skills/design-rules/check.ts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: e2e-test-rules
|
|
3
|
-
description: General rules for deterministic E2E tests, stable selectors, safe URLs, and failure artifacts.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# E2E test rules
|
|
7
|
-
|
|
8
|
-
Use this skill before adding or changing browser, device, or full-flow E2E tests.
|
|
9
|
-
|
|
10
|
-
## Rules
|
|
11
|
-
|
|
12
|
-
- E2E tests must exercise user-visible flows and business-visible outcomes.
|
|
13
|
-
- The repository quality gate must run the configured E2E suite; browser tests may not be optional/decorative.
|
|
14
|
-
- Critical E2E specs configured by the project must exist and stay in the quality gate.
|
|
15
|
-
- Playwright config references such as `globalSetup` must resolve to real files.
|
|
16
|
-
- Prefer deterministic local component/browser fixtures over stale mocks of an application transport that has changed.
|
|
17
|
-
- Use stable selectors, accessible labels, or explicit test ids.
|
|
18
|
-
- Do not use arbitrary sleeps such as `page.waitForTimeout`.
|
|
19
|
-
- Do not call production APIs or hardcode production URLs.
|
|
20
|
-
- Use a configured base URL, preferably from environment.
|
|
21
|
-
- Keep traces, screenshots, and videos enabled on failure when using Playwright.
|
|
22
|
-
- Keep seed/reset/login setup deterministic and documented.
|
|
23
|
-
- Destructive local reset flows must require an explicit environment flag.
|
|
24
|
-
|
|
25
|
-
## Project-specific TODO
|
|
26
|
-
|
|
27
|
-
- List allowed test domains.
|
|
28
|
-
- Define the seed/reset command.
|
|
29
|
-
- Define the login/auth helper.
|
|
30
|
-
- Define the stable selector convention.
|
|
31
|
-
- Decide which browsers/devices are required.
|
|
32
|
-
- Decide artifact retention for screenshots, videos, traces, and reports.
|
|
33
|
-
|
|
34
|
-
## Check
|
|
35
|
-
|
|
36
|
-
Run before handoff:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
nps lint
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Direct checker:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
node .agents/skills/e2e-test-rules/check.ts
|
|
46
|
-
```
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { runtime } from "../shared/runtime.ts";
|
|
2
|
-
// oxlint-disable no-console no-await-in-loop
|
|
3
|
-
import { assertSchemaVersion, readSkillConfig } from "../shared/config.ts";
|
|
4
|
-
import { exists, walk } from "../shared/fs.ts";
|
|
5
|
-
|
|
6
|
-
type Config = {
|
|
7
|
-
schemaVersion: number;
|
|
8
|
-
e2eRoots?: string[];
|
|
9
|
-
playwrightConfigs?: string[];
|
|
10
|
-
requiredDocs?: string[];
|
|
11
|
-
allowedUrlPatterns?: string[];
|
|
12
|
-
forbiddenPatterns?: string[];
|
|
13
|
-
ignoredDirectories?: string[];
|
|
14
|
-
requiredCriticalSpecs?: string[];
|
|
15
|
-
qualityGateFile?: string;
|
|
16
|
-
qualityGateMarkers?: string[];
|
|
17
|
-
requiredConfigMarkers?: string[];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const { config, root } = await readSkillConfig<Config>(import.meta.url);
|
|
21
|
-
assertSchemaVersion(config.schemaVersion);
|
|
22
|
-
|
|
23
|
-
const ignoredDirectories = new Set(config.ignoredDirectories ?? []);
|
|
24
|
-
const e2eRoots = config.e2eRoots ?? ["tests/e2e"];
|
|
25
|
-
const playwrightConfigs = config.playwrightConfigs ?? [
|
|
26
|
-
"playwright.e2e.config.ts",
|
|
27
|
-
"playwright.config.ts",
|
|
28
|
-
];
|
|
29
|
-
const requiredDocs = config.requiredDocs ?? ["docs/testing/e2e.md"];
|
|
30
|
-
const forbiddenPatterns = config.forbiddenPatterns ?? [
|
|
31
|
-
"page.waitForTimeout(",
|
|
32
|
-
"waitForTimeout(",
|
|
33
|
-
"sleep(",
|
|
34
|
-
];
|
|
35
|
-
const allowedUrlPatterns = config.allowedUrlPatterns ?? ["http://localhost", "http://127.0.0.1"];
|
|
36
|
-
const requiredCriticalSpecs = config.requiredCriticalSpecs ?? [];
|
|
37
|
-
const qualityGateFile = config.qualityGateFile;
|
|
38
|
-
const qualityGateMarkers = config.qualityGateMarkers ?? [];
|
|
39
|
-
const requiredConfigMarkers = config.requiredConfigMarkers ?? [];
|
|
40
|
-
const checkedFilePattern = /\.(ts|tsx|js|jsx|mjs|cjs|yaml|yml)$/;
|
|
41
|
-
const urlPattern = /https?:\/\/[^\s"'`)]+/g;
|
|
42
|
-
|
|
43
|
-
function isAllowedUrl(url: string): boolean {
|
|
44
|
-
return allowedUrlPatterns.some((pattern) => url.startsWith(pattern));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const violations: string[] = [];
|
|
48
|
-
const e2eFiles: string[] = [];
|
|
49
|
-
for (const e2eRoot of e2eRoots) {
|
|
50
|
-
e2eFiles.push(
|
|
51
|
-
...(
|
|
52
|
-
await walk(`${root}/${e2eRoot}`, {
|
|
53
|
-
ignoredDirectories,
|
|
54
|
-
relativeDirectory: e2eRoot,
|
|
55
|
-
})
|
|
56
|
-
).filter((file) => checkedFilePattern.test(file)),
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
for (const file of e2eFiles.toSorted()) {
|
|
61
|
-
const text = await runtime.readTextFile(`${root}/${file}`);
|
|
62
|
-
for (const pattern of forbiddenPatterns) {
|
|
63
|
-
if (text.includes(pattern)) {
|
|
64
|
-
violations.push(`${file}: E2E test contains forbidden pattern ${JSON.stringify(pattern)}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
for (const match of text.matchAll(urlPattern)) {
|
|
68
|
-
const url = match[0];
|
|
69
|
-
if (!isAllowedUrl(url)) {
|
|
70
|
-
violations.push(`${file}: E2E test contains non-local URL ${url}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const presentConfigs: string[] = [];
|
|
76
|
-
for (const relativePath of playwrightConfigs) {
|
|
77
|
-
if (await exists(`${root}/${relativePath}`)) {
|
|
78
|
-
presentConfigs.push(relativePath);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (const relativePath of presentConfigs) {
|
|
83
|
-
const text = await runtime.readTextFile(`${root}/${relativePath}`);
|
|
84
|
-
for (const marker of requiredConfigMarkers) {
|
|
85
|
-
if (!text.includes(marker)) {
|
|
86
|
-
violations.push(
|
|
87
|
-
`${relativePath}: Playwright config is missing required marker ${JSON.stringify(marker)}`,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const globalSetupMatch = text.match(/globalSetup:\s*["']([^"']+)["']/);
|
|
92
|
-
if (
|
|
93
|
-
globalSetupMatch?.[1] &&
|
|
94
|
-
!(await exists(`${root}/${globalSetupMatch[1].replace(/^\.\//, "")}`))
|
|
95
|
-
) {
|
|
96
|
-
violations.push(
|
|
97
|
-
`${relativePath}: configured globalSetup file does not exist: ${globalSetupMatch[1]}`,
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
if (!text.includes("trace:") || !text.includes("retain-on-failure")) {
|
|
101
|
-
violations.push(`${relativePath}: Playwright config must retain traces on failure`);
|
|
102
|
-
}
|
|
103
|
-
if (!text.includes("screenshot:") || !text.includes("only-on-failure")) {
|
|
104
|
-
violations.push(`${relativePath}: Playwright config must capture screenshots on failure`);
|
|
105
|
-
}
|
|
106
|
-
if (!text.includes("video:") || !text.includes("retain-on-failure")) {
|
|
107
|
-
violations.push(`${relativePath}: Playwright config must retain videos on failure`);
|
|
108
|
-
}
|
|
109
|
-
if (!text.includes("baseURL") || !text.includes("E2E_BASE_URL")) {
|
|
110
|
-
violations.push(`${relativePath}: Playwright config must use configured E2E_BASE_URL baseURL`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for (const spec of requiredCriticalSpecs) {
|
|
115
|
-
if (!(await exists(`${root}/${spec}`))) {
|
|
116
|
-
violations.push(`${spec}: required critical E2E spec is missing`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (qualityGateFile) {
|
|
121
|
-
if (!(await exists(`${root}/${qualityGateFile}`))) {
|
|
122
|
-
violations.push(`${qualityGateFile}: configured quality gate file is missing`);
|
|
123
|
-
} else {
|
|
124
|
-
const qualityGateText = await runtime.readTextFile(`${root}/${qualityGateFile}`);
|
|
125
|
-
for (const marker of qualityGateMarkers) {
|
|
126
|
-
if (!qualityGateText.includes(marker)) {
|
|
127
|
-
violations.push(
|
|
128
|
-
`${qualityGateFile}: quality gate is missing required E2E marker ${JSON.stringify(marker)}`,
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (e2eFiles.length > 0 || presentConfigs.length > 0) {
|
|
136
|
-
for (const doc of requiredDocs) {
|
|
137
|
-
if (!(await exists(`${root}/${doc}`))) {
|
|
138
|
-
violations.push(`${doc}: missing E2E testing documentation/TODO`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
console.log(`# e2e test rule violations: ${violations.length}`);
|
|
144
|
-
for (const violation of violations) console.log(`- ${violation}`);
|
|
145
|
-
if (violations.length > 0) runtime.exit(1);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 1,
|
|
3
|
-
"e2eRoots": ["tests/e2e"],
|
|
4
|
-
"playwrightConfigs": ["playwright.e2e.config.ts", "playwright.config.ts"],
|
|
5
|
-
"allowedUrlPatterns": [
|
|
6
|
-
"http://localhost",
|
|
7
|
-
"http://127.0.0.1",
|
|
8
|
-
"https://localhost",
|
|
9
|
-
"https://127.0.0.1"
|
|
10
|
-
],
|
|
11
|
-
"forbiddenPatterns": [
|
|
12
|
-
"page.waitForTimeout(",
|
|
13
|
-
"waitForTimeout(",
|
|
14
|
-
"sleep(",
|
|
15
|
-
"https://prod",
|
|
16
|
-
"http://prod"
|
|
17
|
-
],
|
|
18
|
-
"ignoredDirectories": [
|
|
19
|
-
".git",
|
|
20
|
-
"code-templates",
|
|
21
|
-
"node_modules",
|
|
22
|
-
"dist",
|
|
23
|
-
"build",
|
|
24
|
-
"coverage",
|
|
25
|
-
"playwright-report",
|
|
26
|
-
"test-results"
|
|
27
|
-
],
|
|
28
|
-
"requiredConfigMarkers": ["webServer:"],
|
|
29
|
-
"requiredDocs": [],
|
|
30
|
-
"requiredCriticalSpecs": [],
|
|
31
|
-
"qualityGateMarkers": []
|
|
32
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "e2e-test-rules",
|
|
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/e2e-test-rules/SKILL.md",
|
|
12
|
-
"source": "SKILL.md"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"kind": "managed-file",
|
|
16
|
-
"path": ".agents/skills/e2e-test-rules/check.ts",
|
|
17
|
-
"source": "check.ts"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"kind": "scaffold",
|
|
21
|
-
"path": ".agents/skills/e2e-test-rules/config.json",
|
|
22
|
-
"source": "config.json"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"kind": "shared-markdown-section",
|
|
26
|
-
"path": "AGENTS.md",
|
|
27
|
-
"heading": "## Specdest rule: e2e-test-rules",
|
|
28
|
-
"body": "Use `.agents/skills/e2e-test-rules/SKILL.md` when working in this rule area. Run `node .agents/skills/e2e-test-rules/check.ts` before handoff."
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"obsolete": [],
|
|
32
|
-
"check": {
|
|
33
|
-
"command": [
|
|
34
|
-
"node",
|
|
35
|
-
".agents/skills/e2e-test-rules/check.ts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Error handling rules
|
|
2
|
-
|
|
3
|
-
Use this skill when adding or changing application error handling.
|
|
4
|
-
|
|
5
|
-
## Rules
|
|
6
|
-
|
|
7
|
-
- Do not use `throw new Error()` in `src/**` application code.
|
|
8
|
-
- Use `raise(ERROR_CODE)` from `@/shared/errors/raise` for app-owned errors.
|
|
9
|
-
- Keep error codes in `src/shared/errors/error-catalog.ts` TypeScript-safe.
|
|
10
|
-
- User-facing messages must be Japanese in production.
|
|
11
|
-
- Production public responses must not include raw stack traces, database
|
|
12
|
-
errors, tokens, request bodies, or internal file paths.
|
|
13
|
-
- Expected errors should normally have `reportToSentry: false`.
|
|
14
|
-
- Unknown/system errors should normalize to `INTERNAL_ERROR` and report.
|
|
15
|
-
- Do not add project-specific business error codes to this template.
|
|
16
|
-
|
|
17
|
-
## Allowed exceptions
|
|
18
|
-
|
|
19
|
-
- `src/shared/errors/**` may construct `AppError` internally.
|
|
20
|
-
- Tests may use raw `Error` objects to assert normalization.
|
|
21
|
-
- TanStack Router redirect throws are allowed.
|
|
@@ -1,73 +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
|
-
const allowedRawErrorDirectories = ["src/shared/errors/"];
|
|
7
|
-
const ignoredDirectories = [
|
|
8
|
-
"node_modules/",
|
|
9
|
-
"dist/",
|
|
10
|
-
"coverage/",
|
|
11
|
-
"src/routeTree.gen.ts",
|
|
12
|
-
"src/__generated__/",
|
|
13
|
-
];
|
|
14
|
-
const sourceDirectories = ["src"];
|
|
15
|
-
|
|
16
|
-
async function* walk(dir: string): AsyncGenerator<string> {
|
|
17
|
-
try {
|
|
18
|
-
for await (const entry of runtime.readDir(dir)) {
|
|
19
|
-
const path = `${dir}/${entry.name}`;
|
|
20
|
-
if (ignoredDirectories.some((ignored) => path.startsWith(ignored))) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (entry.isDirectory) yield* walk(path);
|
|
24
|
-
if (entry.isFile && /\.(ts|tsx)$/.test(entry.name)) yield path;
|
|
25
|
-
}
|
|
26
|
-
} catch {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function isTestFile(file: string): boolean {
|
|
32
|
-
return (
|
|
33
|
-
/\.(test|spec|stories)\.(ts|tsx)$/.test(file) ||
|
|
34
|
-
file.includes("/tests/") ||
|
|
35
|
-
file.startsWith("src/test/") ||
|
|
36
|
-
file.includes("/storybook/")
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function isAllowedRawErrorFile(file: string): boolean {
|
|
41
|
-
return isTestFile(file) || allowedRawErrorDirectories.some((dir) => file.startsWith(dir));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function lineNumber(text: string, index: number): number {
|
|
45
|
-
return text.slice(0, index).split("\n").length;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
for (const dir of sourceDirectories) {
|
|
49
|
-
for await (const file of walk(dir)) {
|
|
50
|
-
if (isAllowedRawErrorFile(file)) continue;
|
|
51
|
-
const text = decoder.decode(await runtime.readFile(file));
|
|
52
|
-
const rawErrorPattern = /throw\s+new\s+Error\s*\(/gu;
|
|
53
|
-
for (const match of text.matchAll(rawErrorPattern)) {
|
|
54
|
-
violations.push(
|
|
55
|
-
`${file}:${lineNumber(
|
|
56
|
-
text,
|
|
57
|
-
match.index ?? 0,
|
|
58
|
-
)} use raise(ERROR_CODE) instead of throw new Error()`,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const literalThrowPattern = /throw\s+(["'`])/gu;
|
|
63
|
-
for (const match of text.matchAll(literalThrowPattern)) {
|
|
64
|
-
violations.push(`${file}:${lineNumber(text, match.index ?? 0)} do not throw string literals`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (violations.length) {
|
|
70
|
-
console.error(violations.join("\n"));
|
|
71
|
-
runtime.exit(1);
|
|
72
|
-
}
|
|
73
|
-
console.log("error-handling-rules ok");
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "error-handling-rules",
|
|
3
|
-
"kind": "rule",
|
|
4
|
-
"version": "1.0.5",
|
|
5
|
-
"requires": [
|
|
6
|
-
"checker-runtime"
|
|
7
|
-
],
|
|
8
|
-
"artifacts": [
|
|
9
|
-
{
|
|
10
|
-
"kind": "managed-file",
|
|
11
|
-
"path": ".agents/skills/error-handling-rules/SKILL.md",
|
|
12
|
-
"source": "SKILL.md"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"kind": "managed-file",
|
|
16
|
-
"path": ".agents/skills/error-handling-rules/check.ts",
|
|
17
|
-
"source": "check.ts"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"kind": "shared-markdown-section",
|
|
21
|
-
"path": "AGENTS.md",
|
|
22
|
-
"heading": "## Specdest rule: error-handling-rules",
|
|
23
|
-
"body": "Use `.agents/skills/error-handling-rules/SKILL.md` when working in this rule area. Run `node .agents/skills/error-handling-rules/check.ts` before handoff."
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"obsolete": [],
|
|
27
|
-
"check": {
|
|
28
|
-
"command": [
|
|
29
|
-
"node",
|
|
30
|
-
".agents/skills/error-handling-rules/check.ts"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Layers and contracts
|
|
2
|
-
|
|
3
|
-
Use page-local architecture for route work.
|
|
4
|
-
|
|
5
|
-
Required shape:
|
|
6
|
-
|
|
7
|
-
- routes own URL params/search and render containers
|
|
8
|
-
- containers orchestrate hooks and UI only
|
|
9
|
-
- UI renders visible elements only
|
|
10
|
-
- UI-hooks own form/behavior mapping
|
|
11
|
-
- data-hooks call Convex React hooks and map page data contracts
|
|
12
|
-
- data-hooks call only the shared public Convex API; backend business logic must not leak into presentation
|
|
13
|
-
- Convex backend layering is governed by `.agents/skills/convex-multi-presentation/SKILL.md` (`API -> Application -> Domain/DAL -> integrations/DB`)
|
|
14
|
-
|
|
15
|
-
Enforced guardrails:
|
|
16
|
-
|
|
17
|
-
- route, container, UI, and UI-hook files must not import legacy `@/dal`
|
|
18
|
-
- data-hooks must call Convex through `useQuery`, `useMutation`, or `useAction` from `convex/react`
|
|
19
|
-
- data-hooks must not import UI or container layers
|
|
20
|
-
- placeholder/static page data belongs in UI-hooks or presentation view-models, not data-hooks
|
|
21
|
-
|
|
22
|
-
Boundary files use Zod schemas:
|
|
23
|
-
|
|
24
|
-
- `*.input.schema.ts`
|
|
25
|
-
- `*.output.schema.ts`
|
|
26
|
-
- `*.form.schema.ts`
|
|
27
|
-
|
|
28
|
-
Types at boundaries must be inferred from Zod schemas with `z.infer<typeof schema>`.
|
|
29
|
-
|
|
30
|
-
Form contract rules:
|
|
31
|
-
|
|
32
|
-
- Shared visual form UI is allowed when create/new and edit pages intentionally look the same.
|
|
33
|
-
- Do not share create/new and edit form contracts blindly. Each operation must choose an explicit schema/hook, such as `useResourceCreateForm.form.schema.ts` and `useResourceEditForm.form.schema.ts`, or clearly named equivalents.
|
|
34
|
-
- Shared base schemas are allowed only for common fields. Compose create/edit schemas from the base so divergent rules stay visible.
|
|
35
|
-
- Containers must choose the create/edit form contract explicitly before calling the mutation.
|
|
36
|
-
- Numeric-only fields must use a numeric form control that prevents/sanitizes non-digit input before validation and before network submission. Keep database constraints mirrored in form schemas so invalid values do not rely on backend errors for normal feedback.
|