Group the sources into aliased modules and lint with the published plugins
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Child processes use plain node:child_process spawn (explicit stdio, uid/gid, whole env); src/child.ts has exitCode (128+signo) and echo; no execFile maxBuffer
|
||||
description: Child processes use plain node:child_process spawn (explicit stdio, uid/gid, whole env); src/processes/child.ts has exitCode (128+signo) and echo; no execFile maxBuffer
|
||||
---
|
||||
|
||||
Every call site calls `spawn` from `node:child_process` itself, with
|
||||
@@ -15,7 +15,7 @@ everything explicit:
|
||||
- No `execFile`/`exec`: their `maxBuffer` (1 MiB) kills a chatty child. Read
|
||||
piped streams incrementally instead.
|
||||
|
||||
`src/child.ts` holds what the call sites share:
|
||||
`src/processes/child.ts` holds what the call sites share:
|
||||
|
||||
- **`exitCode(child)`**: call it right after `spawn`. It settles on `exit`
|
||||
(not `close`, which a daemonized grandchild can hold open), maps a signal to
|
||||
@@ -28,9 +28,9 @@ Tests use `spawnSync` for short commands.
|
||||
|
||||
Other port details:
|
||||
|
||||
- **`src/errors.ts`** `isNotFound` checks `ENOENT` (file) or `ESRCH` (process).
|
||||
- **`src/common/errors.ts`** `isNotFound` checks `ENOENT` (file) or `ESRCH` (process).
|
||||
- Temporary files are an exclusive `wx` create with mode `0600`.
|
||||
- `src/json.ts` holds type guards used instead of `as` casts on parsed JSON.
|
||||
- `src/common/json.ts` holds type guards used instead of `as` casts on parsed JSON.
|
||||
- `process` and `Buffer` must come from `node:` imports:
|
||||
`no-restricted-globals` in `scripts/project-lint.ts` enforces it
|
||||
([[lint-parity-never-shrinks]]).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
description: bot-agents migration decisions: live @main action for six repos, JSON profiles, Node 24.2+, no eslint-plugin-* packages needed
|
||||
description: bot-agents migration decisions: live @main action for six repos, JSON profiles, Node 24.2+, lints with eslint-plugin-import-structure and explicit-types (concrete, absence)
|
||||
---
|
||||
|
||||
Decisions for `commons/bot-agents` (Capsulizers Gitea), from the Deno to
|
||||
@@ -18,13 +18,16 @@ Node + Vite+ migration (PR #20, `node-migration`, 2026-10-15/16):
|
||||
- **Node 24.2+**, not 22: `src/post.ts` uses `import.meta.main`. There is no
|
||||
`engines` (user decision 2026-10-18): the `node:24-bookworm` job image
|
||||
decides the version ([[bot-agents-runtime-no-build]]).
|
||||
- **No `eslint-plugin-*` packages** (`eslint-plugin-explicit-types`,
|
||||
`eslint-plugin-import-structure`, `eslint-plugin-lit-robust`; unscoped
|
||||
since 2026-10-18, formerly `@cunarist/...`). The Deno setup enabled no
|
||||
plugin, so this repo depends on none and CI passes without them being
|
||||
published. Planned (2026-10-17): once the plugins are on npm, add
|
||||
`eslint-plugin-import-structure` (rule prefix `import-structure/`) here for
|
||||
its import checks.
|
||||
- **Published lint plugins** (2026-10-18, after they reached npm):
|
||||
`eslint-plugin-import-structure` (`modules` config) and
|
||||
`eslint-plugin-explicit-types` (`concrete` and `absence` configs) are
|
||||
devDependencies, enabled in `vite.config.ts`. explicit-types' `naming`
|
||||
config is left off: its `upper-snake-string-unions` and
|
||||
`no-upper-snake-object-keys` rules fire on wire tokens this repo does not
|
||||
name (profile types such as `"claude"`, failure reasons posted to Gitea,
|
||||
environment variable names), which cannot change without changing
|
||||
behavior. Open question for the user. `eslint-plugin-lit-robust` does not apply
|
||||
(no Lit).
|
||||
- **Stricter input checks were accepted** in the migration: Gitea `/user` and
|
||||
comment responses, the runtime manifest, and the outcome's profile type are
|
||||
validated; some type errors became `TypeError` with the same messages.
|
||||
|
||||
@@ -21,5 +21,5 @@ as skipped instead of silently passing.
|
||||
`runCommand`) behind the `#testing` alias. Every test imports it as
|
||||
`#testing`. It imports no source module, so `tests/` (which may not use
|
||||
`../`) never reaches internals. Tests follow
|
||||
[[tests-layout-vitest]] (unit tests in `src/*.test.ts`, repo-level ones in
|
||||
[[tests-layout-vitest]] (unit tests next to their code in `src/`, repo-level ones in
|
||||
`tests/`).
|
||||
|
||||
@@ -97,7 +97,8 @@ It is not a plugin rule.
|
||||
- Every `package.json` `imports` alias points only at the `index.ts` of a
|
||||
direct subfolder of `src/`, e.g. `"#helpers": "./src/helpers/index.ts"`.
|
||||
No alias to a single file, a deeper folder, or anything outside `src/`.
|
||||
Here the one alias is `"#testing": "./src/testing/index.ts"`.
|
||||
Here the aliases are `#agents`, `#processes`, `#runtime`, `#profiles`,
|
||||
`#common`, and `#testing`, in that layer order.
|
||||
- Code outside `src/` (`scripts/`, `tests/`, `vite.config.ts`) gets no alias
|
||||
of its own and imports its own files by `./` relative paths. It reaches
|
||||
`src/` only through the aliases, since `../` is banned.
|
||||
|
||||
Reference in New Issue
Block a user