Skip to content

craft | Complete phases 0–6 of REMAINING.md - #2

Merged
shahen94 merged 624 commits into
mainfrom
refactor/explicit-context
Oct 24, 2026
Merged

shahen94 merged 624 commits into
mainfrom
refactor/explicit-context

Conversation

@shahen94

Copy link
Copy Markdown
Member

What

Works through phases 0–6 of REMAINING.md, turning craft into a working package manager:

  • Foundations: explicit Context, isolated tests, mock registry and end-to-end suite.
  • Correctness: no panicking specs, aliases, integrity checks, atomic downloads, symlink-safe filesystem helpers, git / tarball / file: / link: dependencies.
  • Layout: read-only global store, per-project virtual store node_modules/.craft, peer resolution, hidden hoisting, pruning.
  • Lockfile: deterministic craft.lock, lockfile-backed and frozen installs, craft ci.
  • Platforms and scripts: optional and os/cpu/libc dependencies; lifecycle scripts only for trustedDependencies.
  • Network: retries, timeouts, concurrency limits, streaming downloads, ETag metadata cache, .npmrc registries, auth, proxies and TLS.
  • CLI: progress and summaries, errors with causes and hints, and the commands list, why, outdated, update, exec, dlx, trust, init and ci; -v prints the version and --verbose is now --debug.
  • Windows: junctions, cmd-shim bins and cmd quoting.
  • Release: Linux arm64 and musl builds, checksums verified by install.sh, README rewritten.

For the reviewer

  • 622 commits, one per file; meant to be squash-merged.
  • --verbose is gone: anything passing it now fails with an unknown-argument error.
  • CI gains a windows-latest job (first run on real Windows) and runs make real-world (registry.npmjs.org and GitHub) in registry-tests.
  • The new release targets and checksums only run on the next tag.
  • Under Wine (docker/windows/test.sh) all unit tests and 177/178 e2e tests pass; the last one is blocked by a Rosetta crash on Apple Silicon, not by craft.
  • Known gaps: prepare for git dependencies, install.ps1, Phase 7 (workspaces, overrides, lockfile import).

Packages that run install scripts must not share inodes with the store.
The pipeline runs install scripts.
Reflects the pipeline's process dependency.
Install scripts run once per entry, and the installed state now includes the script policy.
Dependency scripts are the main supply-chain attack path, so only packages in trustedDependencies run them, dependencies first, never writing into the store.
Exports it from the pipes module.
The installed lockfile copy became the installed state.
import_dir now takes the hardlink choice.
Lets actors run install scripts.
Builds the policy from trustedDependencies, reports skipped packages and runs the project's own lifecycle.
Wires install scripts into the actors.
Trusting a package must make the next install build it.
Trusted dependencies build and the project's own scripts run, unless scripts are ignored.
Added packages build like installed ones.
Turns all lifecycle scripts off for install, add and ci.
Covers trust, one-time builds, ordering, failures, --ignore-scripts and project scripts.
Records 4.3, completing Phase 4.
Every range requesting a package fetched its full metadata again: 415 requests for a 218-package tree.
Several ranges of one package must share a single packument request.
Basic auth credentials from .npmrc are base64 encoded.
Reflects the contract base64 dependency.
The registry was hardcoded, so private and scoped registries, auth tokens and proxies were unusable.
Lets the network and resolver use it.
Layers user and project .npmrc and npm_config_* variables under CRAFT_REGISTRY.
Sends each host only its own credentials and honours proxy, TLS and CA settings.
Replaces force_symlink_file, whose only users were bins.
The standard argument quoting escapes quotes as backslash-quote, which cmd doesn't understand, so scripts reach cmd /d /s /c as written. One builder now sets up the command for run and run_captured.
MSVC quoting plus caret escaping, doubled when the script runs a batch file such as a bin shim. Moves the sh quoting here too.
Lets the run actor append quoted arguments on every platform.
They are unused on Windows, where clippy denies dead code.
Newer clippy flags the macro's boxed future.
Gets shims on Windows; the executable bit moves into fsutil.
Dangling bins are found by their target rather than as broken symlinks, and junction targets are compared without their verbatim prefix.
A lockfile written on Windows was different from one written elsewhere.
Runs a bin's .cmd shim, and appends arguments with the platform's quoting.
Finds them by target through fsutil instead of reading symlinks.
Uses the platform's bin command.
Link assertions use the same helpers craft does.
Fixtures print, append and create files through node, the same under sh and cmd.
Uses a node bin and checks targets through fsutil.
Relative targets are still checked on Unix.
Covers arguments with &, %, quotes, a trailing backslash, parentheses and carets through a script and a bin shim.
Replaces touch and echo redirection with node.
file://C:\ is not a URL; file:///C:/ is.
Builds every test executable for x86_64-pc-windows-gnu with mingw.
Wine staging, for junctions, with the Windows builds of Node.js and Git.
Cross-compiles the tests and runs each executable in the runner.
Wine is not Windows; CI is the final check.
Explains junctions, shims and cmd, and how to run the tests under Wine.
Records 6.4 and what was verified under Wine.
Link replacement on Windows backs off between retries.
A link another writer is deleting stays delete pending for a moment and refuses removal and renaming with Access is denied, which failed concurrent replacements on windows-latest.
@shahen94
shahen94 marked this pull request as ready for review October 24, 2026 23:19
@shahen94
shahen94 merged commit 64d2236 into main Oct 24, 2026
4 checks passed
@shahen94
shahen94 deleted the refactor/explicit-context branch October 24, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant