Repository navigation
feat(image): add node capability module with first-scaffold npm recipes - #1042
Merged
Merged
Conversation
Add a `node` capability module (nix/modules/node.nix) contributing `nodejs`
(which bundles npm) to the dev-shell, opt-in via `modules = [ "node" ]`. This
also lands the per-module-options mechanism the ADR deferred: mkProjectShell
now parses a `modules` entry as either a plain name string or an attrset
`{ name = "<name>"; <options> }`, and calls each module as
`pkgs -> options -> contribution` (native updated to the two-arg form).
The node module recognizes one option, `version` (a Node major -> pkgs.nodejs_
<major>; unset -> nixpkgs default); unknown keys and unavailable/insecure majors
throw at eval time. Because the toolchain SSoT already ships `nodejs` and the
ADR orders devTools before module packages, a pinned version is prepended in the
module shellHook so it actually wins PATH.
`modules = [ ]` is unchanged (zero-module drvPath parity holds).
Refs: #1027
On the first scaffold of a Node consumer (package.json detected, no existing
justfile.project) init-workspace.sh now replaces the freshly-copied uv/pyproject
template with a Node seed (assets/justfile.d/node.justfile.project): `sync` =
`npm ci`, plus lint/test/build (tsc)/bundle (ncc), so the CI-contract recipe
names ci.yml calls work in a Node repo. The seed is placed before the
placeholder substitution pass so its {{SHORT_NAME}} token resolves.
Guarded on JUSTFILE_PROJECT_PREEXISTED: an existing consumer-owned
justfile.project is never touched. A full replacement (not an append like the
.gitignore fragments), since appending onto the uv template would redeclare
recipe names and break `just`.
Refs: #1027
3 tasks
c-vigo
added a commit
that referenced
this pull request
Jul 14, 2026
## Summary Implements #1036 as specified: every comment-capable file the scaffold ships now opens with a two-line provenance banner — managed ("regenerated on upgrade; local edits are lost") or preserved ("yours to edit; upgrades never overwrite") — plus the issues-URL pointer. **94 files bannered** (86 managed + 8 preserved). - **Generated, never hand-written:** a `Banner` transform in `scripts/transforms.py`, applied by `scripts/sync_manifest.py` on every sync. The variant derives from `PRESERVE_FILES` in `init-workspace.sh` (parsed as the SSoT), so classification drift is structurally impossible; the `sync-manifest` pre-commit hook regenerates banners and **fails the commit on a tampered or missing banner** (verified with a tampered `ci.yml` — hook fails, restores). - **No version string** — banners are byte-stable across releases (`.vig-os` stays the version SSoT). - **Placement-aware:** after shebangs, YAML `---` document starts, and markdown front-matter (MD041-clean on SKILL.md files); `#` style for yaml/toml/sh/justfiles/githooks/.gitignore/.envrc/CODEOWNERS, HTML comments for markdown. - **`justfile.devc` banner fixed:** the stale "vigOS devcontainer … customizations go in root justfile" box (which pointed at an overwritten file) is replaced by the generated managed banner pointing at `justfile.project`. - **Explicit, documented skip-list** in `_BANNER_SKIP`: strict JSON (no comments); **JSONC files** (deviation from the issue text: the active `check-json` hook parses them strictly with no exclude, so a `//` banner fails the suite both upstream and downstream — bannering them requires a `nix/hooks.nix` exclude, flagged as follow-up); `.pre-commit-config.yaml` (rendered from `nix/hooks.nix`, drift-gated); changelogs (release-diff churn); `.vig-os`, `.gitmessage`, `LICENSE`, `flake.nix`, `justfile.local`. ### Follow-up candidates surfaced (not in this diff) 1. JSONC banner coverage via a `check-json` exclude in `nix/hooks.nix`. 2. `justfile.local`'s shipped header claims preservation but the file is absent from `PRESERVE_FILES` — reclassification decision. 3. The #1027 node seed (`assets/justfile.d/node.justfile.project`, PR #1042) lives outside `assets/workspace/`, so consumers seeded from it won't carry the preserved banner — small alignment once both PRs land. TDD: two failing-test → implementation commit pairs; 25 tests in `tests/test_transforms.py`. ## Test evidence - `uv run pytest tests/test_transforms.py` → 25 passed; `tests/test_flake_hooks.py` → 17 passed (drift gate green) - Tamper test: hand-edited banner → `sync-manifest ... Failed / files were modified by this hook` - Convergence: full `prek run --all-files` twice back-to-back → 0 failures, 0 modifications (re-verified independently after merging dev) Closes #1036 Refs: #878, #913
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the node/typescript capability module per the design decision recorded on the issue (module = v1 shell contract; scaffold statics via #1024/#1025; release bundling via #1029).
nodecapability module (v1 contract)modules = [ "node" ]putsnodejs(bundles npm) in the dev shell — replaces the hand-wiredextraPackages = [ pkgs.nodejs ]every TS-action consumer copied.modulesentry may be{ name = "node"; version = 22; }alongside plain strings — additive, no break for the string form. Modules are now uniformlypkgs -> options -> contribution; unknown option names, malformed entries, and unavailable Node majors all fail at eval time with clear messages.nix/devtools.nix) already shipsnodejsfor@devcontainers/cli, and the ADR orders devTools before module packages — so a pinned module node would be shadowed. When (and only when) an explicitversionis given, the module prepends its node inshellHook(a v1-contract fragment, same pattern asnative's CC/CXX exports). Documented in the module anddocs/NIX.md.nodejs_20(the Actions runtime major the issue mentions) is EOL/insecure in the pinned nixpkgs — pinning it surfaces nixpkgs' own error unless the consumer opts intopermittedInsecurePackages; the versioned test uses maintained LTS 22.modules = [ ]drvPath byte-identity and the parity suite pass untouched.checks.<system>.module-nodeis registry-generated.First-scaffold npm recipes
Node-detected consumers (
package.json, via #1024'sDETECTED_LANGUAGES) getjustfile.projectseeded fromassets/justfile.d/node.justfile.projectat first scaffold only —sync=npm ci,lint/format/test/test-cov,build(tsc),bundle(ncc) — so the CI contract (just sync/just test) and the #1029 release bundle probe work out of the box. Guarded onJUSTFILE_PROJECT_PREEXISTED: an existing consumer-owned file is never touched. Full replacement, not append (appending would redeclare recipe names).Out of scope (per the recorded decision)
eslint/prettier hooks (#883 seam), gitignore/codeql (landed via #1035), release bundle step (landed via #1033).
TDD: two failing-test → implementation commit pairs + a docs commit.
Test evidence
uv run pytest tests/test_flake_modules.py→ 6 passed (node/npm resolve;version = 22pins 22.x; unknown option rejected)bats tests/bats/init-workspace.bats→ 174 ok / 0 failed (5 new seeding tests; re-run after merging dev)module-node,deadnix,statixbuildprek run --all-files→ green (re-verified independently before push)Closes #1027
Refs: #884, #1024, #1029