Skip to content

Commit e71ebfd

Browse files
committed
fixup! docs: add AGENTS.md guide for AI agents
1 parent 818a773 commit e71ebfd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This is the source code for the Angular CLI and related build tooling. This guid
2828
- Tests in this repository only run in Bazel. **ALWAYS** use `process.env['TEST_TMPDIR']` and assert that it is set:
2929
```ts
3030
import assert from 'node:assert';
31-
import fs from 'node:fs/promises';
31+
import { mkdtemp } from 'node:fs/promises';
3232
import path from 'node:path';
3333

3434
describe('...', () => {
@@ -37,14 +37,14 @@ This is the source code for the Angular CLI and related build tooling. This guid
3737
beforeAll(async () => {
3838
const baseTmpDir = process.env['TEST_TMPDIR'];
3939
assert(baseTmpDir, 'TEST_TMPDIR is not set');
40-
tempRoot = await fs.mkdtemp(path.join(baseTmpDir, 'angular-cli-test-'));
40+
tempRoot = await mkdtemp(path.join(baseTmpDir, 'angular-cli-test-'));
4141
});
4242
});
4343
```
4444
- **NEVER** use or fallback to `os.tmpdir()`. Bazel executes tests in hermetic sandboxes and sets `TEST_TMPDIR` to an isolated, sandboxed directory. Using `os.tmpdir()` can cause sandboxing failures, permission errors, or file leakage outside the Bazel sandbox.
4545
- **Imports:**
4646
- Always use the `node:` protocol for Node.js built-in imports (e.g., `node:fs`, `node:path`, `node:assert`).
47-
- Prefer `import fs from 'node:fs'` (or `'node:fs/promises'`) instead of `import * as fs`.
47+
- Prefer named imports (e.g., `import { mkdtemp } from 'node:fs'`) or default imports (`import fs from 'node:fs'`) instead of namespace imports (`import * as fs`).
4848
- **Unit Tests:**
4949
- Run all unit tests: `pnpm bazel test //packages/...`
5050
- Run a specific test target: `pnpm bazel test //packages/angular/build:test`

0 commit comments

Comments
 (0)