Skip to content

feat(js): add lightweight core shell entry with an import budget - #236

Merged
konard merged 6 commits into
mainfrom
issue-235-32c1444df9bd
Oct 24, 2026
Merged

konard merged 6 commits into
mainfrom
issue-235-32c1444df9bd

Conversation

@konard

@konard konard commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Adds command-stream/core so shell-only consumers can use $, ProcessRunner and virtual commands without loading compatibility layers, terminals or development tools. Core loads 70 ESM / 71 CommonJS modules, compared with 284 for the full entry.

Fixes #235

Changes

  • Share the existing shell implementation, built-in commands, registrations, settings and runner identity between the full entry, typed ESM/CommonJS core entries and process-runner.
  • Separate virtual-command composition and metadata from the package installer that imports Execa.
  • Enforce fewer than 100 cold-loaded non-builtin modules in both core formats. Reject compatibility, terminal, REPL/debugger and testing modules in the graph; bundle and execute core without those inputs.
  • Document the public core API and prepare its minor release with a changeset.
  • Update Execa to 10.2.1 after its strict TypeScript blocker closed. Update fancy-regex and both Rust lockfiles to fix dependency freshness checks, with a Rust patch fragment.
  • Retry Deno imports only when esm.sh reports HTTP 408 while a cold build is queued: at most three attempts, with 5- and 10-second delays. Preserve live stderr and a bounded diagnostic tail; persistent timeouts, compiler errors and runtime failures remain fatal. Both real HTTP probes remain required.

The issue explicitly allows the lightweight-subpath approach. The full API remains available; installed dependency size is unchanged. The parity-exempt label applies to JavaScript's module-loader graph, which has no Rust counterpart. Executable language parity checks remain enabled.

Reproduction and regression coverage

Run node experiments/issue-235/import-probe.mjs command-stream or substitute command-stream/core. Before implementation, the full entry loaded 284 modules in approximately 461 ms on Linux / Node 26.12.1. Commit 7bb8fe2 preserves four failing core regressions before the subpath existed. Module count is the deterministic CI budget; elapsed time is diagnostic.

core-entry.test.mjs checks fresh ESM/CommonJS loads, the module budget, executable bundling, real commands, synchronous and exact-argv execution, virtual pipelines, shared state and API identity. Strict TypeScript consumers verify both declaration formats.

The previous Deno failure belongs to 285f44b, created 2026-10-24T08:20:11Z. Downloaded job-log line 550 reports an esm.sh Execa import returning HTTP 408; line 565 records exit code 1. The same dependency import and immutable GitHub-head URL failed locally, and the CDN status endpoint confirmed queued builds. The queue subsequently recovered and both real probes passed locally. Ten mocked regression tests verify retry success, exhaustion, ANSI diagnostics and immediate failure for other errors. No manual action is required.

Validation

  • Full Bun suite: 2,812 passed, 10 skipped, zero failures across 179 files, including all ten CDN retry regressions.
  • Node core budget, bundling, execution and shared-state checks: 5 passed.
  • Both real Deno CDN probes passed locally, exercising the HTTP-served checkout and immutable GitHub head, shell execution, ShellJS identity, normal brace globs and depth protection.
  • Lint, formatting, duplication and strict TypeScript checks passed. The pre-commit hook also passed.
  • Existing Node regression suite: 124 passed; zx: 490 passed, 2 skipped; Execa: 38 passed.
  • Rust all-feature suite including doctests: 905 passed, 7 ignored. Formatting, Clippy and rustdoc with warnings denied, and generated documentation checks passed.
  • Declared and installed dependency freshness checks passed. Package dry-run includes the core source files and both declaration formats.

CI on 4f88be8eb7d7fa93cd84410cbc1c2933de003f2c: 49 passed, zero failed or pending, with six release-only jobs correctly skipped on this PR. All eight workflows completed successfully:

Downloaded Deno job-log lines 605–608 and 625–628 confirm both real probes executed all assertions successfully. The first Windows Rust attempt stalled in the existing PID-identity test and was cancelled for log collection; the targeted rerun passed on the same commit, including that test and all doctests. Both attempts' logs are preserved locally. No checks were disabled or relaxed.

The latest default branch is included, the working tree is clean, and the complete diff has been reviewed. Implementation and verification are complete; this PR is ready for review and remains unmerged.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #235
@konard konard self-assigned this Oct 24, 2026
@konard konard changed the title [WIP] import { $ } loads 281 modules (ShellJS, execa, zx, Bun shell, terminal capture) and takes ~350 ms feat(js): add lightweight core shell entry with an import budget Oct 24, 2026
@konard konard added the parity-exempt Change is intentionally single-language; skip JS/Rust parity check label Oct 24, 2026
@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

Working session summary

Implemented and pushed to PR #236.

  • Added command-stream/core: 70–71 loaded modules versus 284.
  • Local tests passed: 2,800 Bun tests and 905 Rust tests.
  • 48 CI checks passed; working tree is clean.

Completion is blocked by esm.sh returning HTTP 408 in the required Deno check, confirmed locally and on CI retry. Evidence is in the PR, which remains draft and unmerged.


This summary was automatically extracted from the AI working session output.

@konard
konard marked this pull request as ready for review October 24, 2026 08:30
@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-6.1 Sol
  • Provider: OpenAI
  • Public pricing estimate: $2.820997

📊 Context and tokens usage:

  • 190.2K / 272K (70%) input tokens, 45.0K / 128K (35%) output tokens

Total: (190.2K + 6.9M cached) input tokens, 45.0K output tokens, $2.820997 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-6.1-sol
  • Thinking level: xhigh (~31999 tokens)
  • Model: GPT-6.1 Sol (gpt-6.1-sol)

📎 Log file uploaded as Gist (1524KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

🔄 Auto-restart 1/5

Reason: CI failures detected

Evidence:

Starting a new session to address it.

@konard
konard marked this pull request as draft October 24, 2026 08:33
@konard
konard marked this pull request as ready for review October 24, 2026 09:09
@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

Working session summary

Fixed in PR #236: bounded retries for esm.sh HTTP 408 errors, covered by 10 regression tests.

  • CI: 49 passed, six release-only jobs skipped.
  • Local Bun tests: 2,812 passed.
  • PR ready for review and unmerged; latest main included, working tree clean.

Elapsed: 36 minutes.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

🔄 Auto-restart-until-mergeable Log 1/5

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-6.1 Sol
  • Provider: OpenAI
  • Public pricing estimate: $3.750726

📊 Context and tokens usage:

  • 252.4K / 272K (93%) input tokens, 51.4K / 128K (40%) output tokens

Total: (252.4K + 9.8M cached) input tokens, 51.4K output tokens, $3.750726 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-6.1-sol
  • Thinking level: xhigh (~31999 tokens)
  • Model: GPT-6.1 Sol (gpt-6.1-sol)

📎 Log file uploaded as Gist (3071KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
konard merged commit 9a8f87c into main Oct 24, 2026
61 of 65 checks passed
@konard

konard commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Linked issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity-exempt Change is intentionally single-language; skip JS/Rust parity check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import { $ } loads 281 modules (ShellJS, execa, zx, Bun shell, terminal capture) and takes ~350 ms

1 participant