Group the sources into aliased modules and lint with the published plugins #23

Merged
temeddix merged 2 commits from group-modules into main 2026-10-18 15:00:17 +00:00
Owner

Groups the flat src/ into cohesive modules and turns on the published lint plugins. No behavior change.

Module layout

Each module is a direct src/ subfolder with an index.ts barrel and a # alias in package.json imports (layer order, top first):

Alias Files
#prepare index.ts (the prepare phase entry point)
#run index.ts (the run phase entry point)
#post index.ts (the post phase entry point), post.ts, post.test.ts
#agents auth.ts, opencode.ts (Codex / Claude Code sign-in, OpenCode args and output)
#processes child.ts, isolation.ts
#runtime runtime.ts, credentials.ts
#profiles profiles.ts
#common errors.ts, json.ts
#testing index.ts (unchanged)

Every top-level entry of src/ is an aliased module folder. Tests stay next to their code as *.test.ts. Each phase's index.ts is its entry point, and action.yml now runs node src/<phase>/index.ts. The post phase's logic moved to src/post/post.ts so its test can import it; index.ts keeps the env reading and the import.meta.main call. run's prompt URL is now ../../prompt.md. scripts/protect-source.sh now copies src/ recursively (it used to copy src/*.ts only), and the workflow test checks that module files get staged too.

Lint plugins

  • New devDependencies: eslint-plugin-explicit-types@^0.6.1 and eslint-plugin-import-structure@^0.10.2, both in jsPlugins. The lockfile comes from a real npm install.
  • Enabled configs: importStructure.configs.modules, explicitTypes.configs.concrete, explicitTypes.configs.absence.
  • explicit-types naming is off (the other app repos turn it on). Its upper-snake-string-unions and no-upper-snake-object-keys rules fire on wire tokens this repo doesn't choose: profile types "claude" | "codex" | "opencode" from profiles.json, failure reasons posted to Gitea, Gitea's "new" | "old" side, and environment variable names such as PATH. Satisfying them would change behavior or need opt-outs. This is logged as an open question for the user.

Lint fixes, all type-level:

  • Pick<BotProfile, "type" | "model"> became a named ProfileIdentity interface that BotProfile, ProfileFailure, and RuntimeProfile extend. RuntimeOutcome is now RuntimeSuccess | RuntimeFailure.
  • Inline object types became named interfaces.
  • Record<string, string> env maps became NodeJS.ProcessEnv. JsonObject and the verdict table became NodeJS.Dict<…>.
  • T | undefined locals and returns became T | null with matching checks. typeof fetch became a Fetcher type.
  • Claude's result fields are held in camelCase (isError, apiErrorStatus) after parsing, because id-match rejects snake_case interface members.
  • Duplicate import sources are merged (import-structure/no-duplicate-import-source).

Verification

  • vp check: clean.
  • vp test: 61 passed and 5 skipped as a normal user. All 66 passed as root in node:24-bookworm.
  • Each phase (node src/<phase>/index.ts) run from a protect-source.sh copy loads its full alias graph under Node.

🤖 Generated with Claude Code

Groups the flat `src/` into cohesive modules and turns on the published lint plugins. No behavior change. ## Module layout Each module is a direct `src/` subfolder with an `index.ts` barrel and a `#` alias in `package.json` `imports` (layer order, top first): | Alias | Files | | --- | --- | | `#prepare` | `index.ts` (the prepare phase entry point) | | `#run` | `index.ts` (the run phase entry point) | | `#post` | `index.ts` (the post phase entry point), `post.ts`, `post.test.ts` | | `#agents` | `auth.ts`, `opencode.ts` (Codex / Claude Code sign-in, OpenCode args and output) | | `#processes` | `child.ts`, `isolation.ts` | | `#runtime` | `runtime.ts`, `credentials.ts` | | `#profiles` | `profiles.ts` | | `#common` | `errors.ts`, `json.ts` | | `#testing` | `index.ts` (unchanged) | Every top-level entry of `src/` is an aliased module folder. Tests stay next to their code as `*.test.ts`. Each phase's `index.ts` is its entry point, and `action.yml` now runs `node src/<phase>/index.ts`. The post phase's logic moved to `src/post/post.ts` so its test can import it; `index.ts` keeps the env reading and the `import.meta.main` call. `run`'s prompt URL is now `../../prompt.md`. `scripts/protect-source.sh` now copies `src/` recursively (it used to copy `src/*.ts` only), and the workflow test checks that module files get staged too. ## Lint plugins - New devDependencies: `eslint-plugin-explicit-types@^0.6.1` and `eslint-plugin-import-structure@^0.10.2`, both in `jsPlugins`. The lockfile comes from a real `npm install`. - Enabled configs: `importStructure.configs.modules`, `explicitTypes.configs.concrete`, `explicitTypes.configs.absence`. - **explicit-types `naming` is off** (the other app repos turn it on). Its `upper-snake-string-unions` and `no-upper-snake-object-keys` rules fire on wire tokens this repo doesn't choose: profile types `"claude" | "codex" | "opencode"` from `profiles.json`, failure reasons posted to Gitea, Gitea's `"new" | "old"` side, and environment variable names such as `PATH`. Satisfying them would change behavior or need opt-outs. This is logged as an open question for the user. Lint fixes, all type-level: - `Pick<BotProfile, "type" | "model">` became a named `ProfileIdentity` interface that `BotProfile`, `ProfileFailure`, and `RuntimeProfile` extend. `RuntimeOutcome` is now `RuntimeSuccess | RuntimeFailure`. - Inline object types became named interfaces. - `Record<string, string>` env maps became `NodeJS.ProcessEnv`. `JsonObject` and the verdict table became `NodeJS.Dict<…>`. - `T | undefined` locals and returns became `T | null` with matching checks. `typeof fetch` became a `Fetcher` type. - Claude's result fields are held in camelCase (`isError`, `apiErrorStatus`) after parsing, because `id-match` rejects snake_case interface members. - Duplicate import sources are merged (`import-structure/no-duplicate-import-source`). ## Verification - `vp check`: clean. - `vp test`: 61 passed and 5 skipped as a normal user. All 66 passed as root in `node:24-bookworm`. - Each phase (`node src/<phase>/index.ts`) run from a `protect-source.sh` copy loads its full alias graph under Node. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
temeddix added 1 commit 2026-10-18 14:50:52 +00:00
Group the sources into aliased modules and lint with the published plugins
Agents / agent (pull_request) Has been skipped
Check / check (pull_request) Successful in 38s
0a9f86a102
Author
Owner
@bot
bot approved these changes 2026-10-18 14:56:11 +00:00
bot left a comment
Owner

✅ Approved
Summary: Module aliases, staged action sources, and lint configuration are ready.

Checks

  • vp check
  • vp test — 61 passed; 5 expected non-root skips
  • Required CI passed on the reviewed head
Review notes

Strengths: the alias barrels preserve the layer boundaries, and the staged copy loads every phase's alias graph.

Declined: none.

Profile: codex · gpt-5.6-terra

✅ Approved Summary: Module aliases, staged action sources, and lint configuration are ready. ### Checks - `vp check` - `vp test` — 61 passed; 5 expected non-root skips - Required CI passed on the reviewed head <details> <summary>Review notes</summary> Strengths: the alias barrels preserve the layer boundaries, and the staged copy loads every phase's alias graph. Declined: none. </details> > Profile: `codex` · `gpt-5.6-terra`
temeddix added 1 commit 2026-10-18 14:58:17 +00:00
Move the phase entry points into aliased module folders
Check / check (pull_request) Successful in 46s
6c4e4bf67d
Author
Owner
@bot
temeddix merged commit 32806120b3 into main 2026-10-18 15:00:17 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: commons/bot-agents#23