Skip to content

Commit fad8f2f

Browse files
committed
CI(Windows): Harden cross-platform path checks
1 parent dc0a3ed commit fad8f2f

12 files changed

Lines changed: 868 additions & 4 deletions

.ai/context/accuracy-guardrails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Read deeper references before editing when touching:
2121
- Package ownership or cycles: `.ai/architecture.md`, `.ai/package-map.md`, `.ai/boundaries.md`.
2222
- Performance: `.ai/commands.md`, `.ai/testing-policy.md`, affected package `AI.md`.
2323
- Review: `.ai/review-checklist.md`, `.ai/boundaries.md`, affected package `AI.md`.
24-
- Cross-platform paths: `.ai/code-style.md` and affected package tests.
24+
- Cross-platform paths: `.ai/context/cross-platform.md`, `.ai/code-style.md`, and affected package tests.
2525

2626
## Work Rules
2727

.ai/context/cross-platform.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Cross-Platform Paths Pack
2+
3+
Use this when a task touches filesystem paths, file URLs, public URLs, virtual module ids, generated import specifiers, scanner or project roots, build integrations, CLI behavior, language server paths, VS Code packaging, or tests and fixtures that assert paths.
4+
5+
## Read
6+
7+
- `AGENTS.md`
8+
- `.ai/context/index.md`
9+
- `.ai/code-style.md`
10+
- `.ai/context/testing.md`
11+
- The affected package `package.json`
12+
- The affected package-local `AI.md`, if present
13+
- Existing source and tests near the path-sensitive behavior
14+
15+
## Workflow
16+
17+
- Classify every changed string domain before editing: filesystem path, file URL, public URL, virtual module id, or generated import specifier.
18+
- Use `node:path` helpers for filesystem paths, with path segments passed separately.
19+
- Convert file URLs only at boundaries with `fileURLToPath()` / `pathToFileURL()` or the local package helper.
20+
- Use `path.relative(parent, child)` for filesystem containment checks; reject `..`, `../...`, and absolute relative results.
21+
- Keep URL-like strings slash-based and do not pass public URLs, virtual ids, or import specifiers through `node:path`.
22+
- For path-sensitive pure helpers, add focused tests with `path.win32` and `path.posix` where practical. Otherwise rely on package tests that already run in Windows CI and document that choice.
23+
24+
## Validation
25+
26+
- Run the affected package test command.
27+
- Run affected package lint if it defines `lint`.
28+
- Run `pnpm test:cross-platform-paths` when code or tests touch paths, file URLs, public URLs, virtual ids, generated import specifiers, scanner roots, project roots, build integrations, CLI, language server, or VS Code packaging.
29+
- If a flagged path pattern is intentional, either rewrite it into an explicit helper domain or update `.ai/cross-platform-path-baseline.json` with a clear review reason.
30+
31+
## Escalate When
32+
33+
- Path-sensitive behavior crosses package boundaries: read `.ai/context/package-boundaries.md`.
34+
- CSS output, runtime, extraction, language tooling, ESLint, compiler, parser, virtual module ids, or generated import specifiers change: read `.ai/context/accuracy-guardrails.md`.
35+
- CI, release, lockfiles, or package manager behavior changes: read `.ai/context/accuracy-guardrails.md`.

.ai/context/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Do not read every `.ai/` file by default. Do read `.ai/context/accuracy-guardrai
2626
| PR/code review | `.ai/context/review.md` |
2727
| Public docs or examples | `.ai/context/docs.md` |
2828
| Package ownership, dependency direction, exports, cycles | `.ai/context/package-boundaries.md` |
29+
| Filesystem paths, file URLs, public URLs, virtual ids, import specifiers | `.ai/context/cross-platform.md` |
2930
| File path, package, or diff routing | `.ai/context/package-routing.md` |
3031

3132
## Deep References
@@ -38,6 +39,7 @@ Do not read every `.ai/` file by default. Do read `.ai/context/accuracy-guardrai
3839
- Validation matrix and benchmark policy: `.ai/testing-policy.md`
3940
- Commands and CI equivalents: `.ai/commands.md`
4041
- Style and path conventions: `.ai/code-style.md`
42+
- Cross-platform path workflow: `.ai/context/cross-platform.md`
4143
- PR review checklist: `.ai/review-checklist.md`
4244

4345
## Accuracy Rule

.ai/cross-platform-path-baseline.json

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)