Document that package.json aliases may target only direct subfolders of src (#21)
Follow-up to #20, which was merged before this landed. bot-agents has no `package.json` `imports` aliases (`src/` is flat and everything imports relatively), so no code changes. This records the new rule in the docs: - `.agents/memory/imports-aliases-barrels.md`: aliases may target only a direct subfolder of `src/` (its `index.ts` or a `#x/*` pattern); nothing outside `src/`, not `src/` itself, not deeper folders; such code imports relatively. - `.agents/memory/tests-layout-vitest.md`: `tests/` reach the public entry through a relative import, not a `#plugin` alias. - `.agents/skills/migrate-deno-repo/SKILL.md` and `AGENTS.md`: same rule. `vp check`, `vp test`, and `damem doctor` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #21 Reviewed-by: bot <noreply@capsulizers.com> Co-authored-by: Danny Kim <temeddix@gmail.com> Co-committed-by: Danny Kim <temeddix@gmail.com>
This commit was merged in pull request #21.
This commit is contained in:
@@ -13,11 +13,34 @@ explicit permission.
|
||||
# Runtime and checks
|
||||
|
||||
The action's TypeScript runs directly on the job image's Node.js (24.2 or
|
||||
newer), which strips the types itself: there is no build step and no runtime
|
||||
newer; `package.json` has no `engines`, the `node:24-bookworm` image pins it),
|
||||
which strips the types itself: there is no build step and no runtime
|
||||
dependency. Keep the sources to erasable syntax and `.ts` imports, which
|
||||
`tsconfig.json` enforces. Checks use Vite+: `vp check` formats, lints, and
|
||||
type-checks, and `vp test` runs Vitest. Unit tests sit next to the code as
|
||||
`src/*.test.ts`; repository-level tests live in `tests/`.
|
||||
`tsconfig.json` enforces. Its strictness set is fixed and leaves
|
||||
`exactOptionalPropertyTypes` off
|
||||
([.agents/memory/ts-only-files-and-imports.md](.agents/memory/ts-only-files-and-imports.md)).
|
||||
Checks use Vite+: `vp check` formats, lints, and type-checks, and `vp test`
|
||||
runs Vitest. Unit tests sit next to the code as `src/*.test.ts`;
|
||||
repository-level tests live in `tests/`.
|
||||
|
||||
A `#` alias in `package.json` `imports` may point anywhere and owns its
|
||||
target: an alias to a folder's `index.ts` owns that folder and everything
|
||||
below it; an alias to any other file owns only that file. No overlap: no file
|
||||
may be owned by 2 aliases, so no alias inside another alias's area and no 2
|
||||
aliases with the same target. Outside an area, only the exact alias reaches
|
||||
it; a deeper alias specifier or a relative path into the area is a bypass.
|
||||
Inside an area, relative imports of siblings and subfolders are free. A `../`
|
||||
import is banned in every file, owned or not
|
||||
(`import/no-relative-parent-imports`); runtime file URLs such as
|
||||
`new URL("../prompt.md", import.meta.url)` are paths, not imports, and stay.
|
||||
Files no alias owns need no `index.ts` and no alias, and import `./` siblings
|
||||
and subfolders freely. The one alias is `#testing` (`./src/testing/index.ts`):
|
||||
tests that use its helpers import it by alias, and `tests/` imports `src/`
|
||||
only through it. Local convention, stricter than the general rule above: in
|
||||
this repo, aliases point only at a direct subfolder of `src/`
|
||||
(`"#helpers": "./src/helpers/index.ts"`), and code outside `src/` uses `./`
|
||||
relative imports. `scripts/` is flat: one file per tool, no subfolders and no `index.ts`, imported directly by file path
|
||||
([.agents/memory/imports-aliases-barrels.md](.agents/memory/imports-aliases-barrels.md)).
|
||||
|
||||
The only config files are `package.json`, `tsconfig.json`, and
|
||||
`vite.config.ts`, plus `package-lock.json`. Repo-local lint rules and the rule
|
||||
|
||||
Reference in New Issue
Block a user