Commit Graph
29 Commits
Author SHA1 Message Date
zeekayandHanzo Dev c58a31887c fix(cli/install): verify the published checksum before running the binary
postinstall downloads a binary from a release and executes it. Until now
the only check on those bytes was the file magic — proof that they are an
executable, not proof that they are ours. Every release asset already
ships a sibling .sha256; read it and compare.

The per-user cache is keyed by version number alone, so a binary of
unknown provenance sitting under an already-cached version survived every
reinstall. A cache entry is now trusted only while a stamp beside it
still matches its bytes, and the stamp is written after the published
checksum verified the archive it came from — so a cache hit carries that
proof forward.

Verified against v0.6.100: a tampered cached binary is refused,
re-downloaded, checked and repaired.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-19 23:18:45 -07:00
zeekayandHanzo Dev 6cbbea2d03 merge: just-every/code v0.6.169 (e4fe007150) — keep Hanzo identity
Our history is just-every's with author emails rewritten, so the graphs are
disjoint and git finds no merge base. Supplied one by hand: d1f1f51a41, the
just-every commit matching our Oct-2025 fork point (22 files apart). 9618
upstream commits, 7004 files, +1.81M/-159k, 37 conflicts.

Resolution:
- Upstream code where our side was the Oct-2025 prototype of a feature they
  have since reimplemented 3-5x larger (agent_runs, browser_sessions,
  history_cell/{agent,browser}, the vt100 harness and its snapshots).
- Upstream's config.rs module split (builder/defaults/sources/validation)
  kept; zen5-coder and the provider-follows-model rule re-applied on top.
- Ours where the file IS the identity: README, package.json, postinstall,
  release notes pipeline, integration-zed.
- Hybrid where upstream improved a file we had branded: updates.rs (their
  release-repo migration, our hanzoai/dev), release.yml (their fail-fast npm
  auth check, our package name), chatwidget.rs (their turn handling, our
  HANZO_USER_KEY hint), exec human output (their 237 lines, our banner).

Superseded and dropped deliberately: our resume_command_name() coder-alias
hack — upstream's derive_resume_command_name() reads the invocation basename
generically, which yields "dev" for us.

LLM.md now records the real topology and the sync point; AGENTS.md and
CLAUDE.md are symlinks to it again. Single parent on purpose: adopting
jecode/main as a second parent would re-import 13,742 commits carrying the
upstream author emails a prior rewrite deliberately removed.

Version 0.2.188 -> 0.2.189.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-05 23:09:12 -07:00
zeekayandHanzo Dev d3d1dfa1d3 dev is ours: the Hanzo Cloud by default, a binary named dev, our namespaces
hanzoai/dev went public defaulting to someone else's cloud. Four things were
wrong, and all four now have a test that fails if they come back.

DEFAULT PROVIDER AND MODEL. built_in_model_providers() gains `hanzo` -- the
Hanzo Cloud at api.hanzo.ai/v1, Responses wire, bearer from HANZO_USER_KEY --
and it is the default. The default model is zen5-coder. This was not cosmetic:
the old default is not in the gateway catalog, so it 400s against our own
cloud. Measured, not assumed:

  POST api.hanzo.ai/v1/responses model=gpt-5-codex -> 400 "model is not
      available. Use GET /v1/models to list available models"
  POST api.hanzo.ai/v1/responses model=zen5-coder  -> 200, clean output

Our own CLI already documented the bug from the other side -- dev.rs says
"Name the model too -- codex's built-in default is not in the gateway catalog
and would 400" and passes `-c model=` on every launch to work around it. It
also asserts that on the native gateway NO model_provider override is needed,
which is only true once `hanzo` is the built-in default. It is now.

zen5-coder over enso because dev is a coding agent and because enso returns
system-prompt text on the Responses wire that dev actually speaks; zen5-coder
returns the answer. Model ids were read from GET /v1/models with a bearer, not
guessed. Other providers stay fully configurable -- this is the default, not
the only choice.

THE LOGIN COMMAND. Messages said `code login` / `codex login`. The real command
is `hanzo auth login` (`hanzo login` is not a command -- it is swallowed as an
AI task). It now lives once, as auth::LOGIN_COMMAND, so no message can drift
into naming a command that does not exist. References to this binary's own
subcommand became `dev login`.

A BINARY NAMED dev. HEAD built `code` and `codex` and nothing named `dev`, so a
release cut today would ship no `dev` -- and `hanzo code` launches a bare `dev`
off PATH, so every new install would break. `dev` is now the canonical bin,
declared first; `code` remains as an alias to the same program, never the
reverse. The CLI identifies as `dev` / "Hanzo Dev", not "OpenAI Codex".

OUR NAMESPACES. The pipeline published to @just-every/* on npm and pushed
formulae to just-every/homebrew-tap. Both of ours already exist and are already
populated at v0.6.91 -- @hanzo/dev plus all five @hanzo/dev-<target> packages,
and hanzoai/homebrew-tap's Formula/hanzo-dev.rb, which installs `dev` and
expects assets named dev-<triple>. Nothing here is squatted; this is our own
distribution, reclaimed. Assets are renamed to match the formula.

Two live supply-chain bugs fell out of that, both worse than a naming problem:
postinstall.js (runs on every npm install) and the tui auto-updater fetched
from a third party's releases -- the updater also told our users to
`npm install -g @just-every/code@latest`. Worse, a shadowed `isWSL` const put
the two fast paths in the temporal dead zone, so their catch blocks swallowed
the error and EVERY install fell through to that download: the five published
platform packages were never used, and the third-party fetch was not an edge
case but the only path that ran. Fixed and exercised in a sandbox across all
three paths. codex-cli/.pack/ -- a committed `npm pack` artifact CI
regenerates, and the reason the bad URL had two homes -- is now untracked.

DURABILITY, because upstream-merge.yml merges openai/codex every 30 minutes.
A one-time edit to a default is a suggestion that survives until the next
merge. Two mechanisms:

  - .github/merge-policy.json prefer_ours_globs listed only codex-rs/** while
    the workspace that SHIPS is code-rs/**, so it protected nothing that
    ships. The identity-bearing code-rs files are now listed.
  - code-rs/core/tests/hanzo_identity.rs asserts all four properties -- the
    provider, a Zen default, a bin named dev, and no third-party publish
    target. Upstream has no such file, so a merge cannot conflict with it or
    carry the guard away with the thing it guards. Policy can be edited;
    a red build cannot be ignored.

The gate is not decorative: it failed on the un-retargeted pipeline
("release.yml still references `@just-every/`") and went green only when the
pipeline was actually fixed.

Verified: cargo build --bin dev clean; hanzo_identity 4/4; code-core lib
332 passed, 1 failed -- git_info::test_collect_git_info_with_remote, which
fails identically on a clean origin/main checkout here because this machine
has a global [email protected]:.insteadof rewrite. Pre-existing and
environmental, not from this change.

  $ dev exec "say OK"        # fresh profile, no config
  Hanzo Dev v0.0.0
  model: zen5-coder
  provider: hanzo

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-01 14:05:00 -07:00
James Peter 31412ca2e4 fix(cli/postinstall): restore shim detector 2025-09-25 17:01:19 +10:00
James Peter 5fa4f5e85c merge code-branch-20250925-045812 via /merge 2025-09-25 16:30:29 +10:00
James Peter 1b46db1586 fix(cli/postinstall): avoid overwriting existing code shim 2025-09-25 15:43:26 +10:00
James Peter 4830f8b725 fix(cli/postinstall): preserve external code shims
Closes #239
2025-09-25 14:35:16 +10:00
James Peter 931ef782b0 fix(cli/postinstall): restore code shim on npm global installs
Closes #199.
2025-09-20 06:05:32 +10:00
James Peter 7f25099c05 fix(codex-cli/install): harden Windows/WSL install paths and locks
- Avoid placing EXE inside node_modules on Windows and WSL-on-NTFS
- Add preinstall cleanup (global-only), limited to our EXE; age-guard stale .code-* dirs
- Atomic cache writes with retries; mirror to node_modules only on Unix filesystems
- Robust Windows unzip fallback chain (powershell.exe→powershell→pwsh→tar)
- Detect WSL drvfs/cifs with realpath mount check; skip taskkill on WSL
- Fallback to per-user cache if tmp staging dir is unavailable
- Package windows-cleanup.ps1 and preinstall script
2025-09-11 19:11:59 +10:00
James Peter 6a0befcd2b fix(cli/windows): avoid EBUSY/EPERM on global upgrades by keeping native .exe in per-user cache; launcher prefers cache\n\n- Postinstall: on Windows, install binary to %LocalAppData%\just-every\code\<version> and do not leave a copy in node_modules.\n- Launcher: run from cache when available; mirror into node_modules only on Unix.\n- Outcome: global npm upgrades no longer fail when the CLI is running. 2025-09-11 10:06:49 +10:00
James Peter 7588a47618 fix(cli/install): stop publishing 'code' bin; create wrapper only when safe and remove on collision\n\nPrevents overriding VS Code's 'code' CLI. Postinstall now:\n- Detects PATH collisions and removes legacy npm shim if present\n- Creates a 'code' wrapper -> 'coder' only when no conflict exists (npm/bun)\n- Keeps 'coder' as the canonical entrypoint\n\nThis matches the goal: never hijack an existing 'code' while preserving a friendly alias when safe. 2025-08-30 11:56:26 +10:00
James Peter 8bdb21e9ef fix(cli/postinstall): print collision guidance to stderr and suggest 'coder' when VS Code's 'code' is on PATH 2025-08-30 10:52:06 +10:00
James Peter dcedda693e feat(tui/file-completion): prioritize CWD matches; related UX fixes
- TUI: prioritize files from current working directory in completions;
  refine redraw debounce for lower latency; history/markdown rendering tweaks.
- Core/web_fetch: safer HTML sanitization, basic GitHub issue extraction,
  and trimmed payload heuristics.
- Core/agent_tool: more robust command_exists on unix/windows; improve fallbacks.
- Fix: remove unused var in JSON-LD scan to silence warning.

Build: verified with ./build-fast.sh (no warnings).
2025-08-30 06:19:34 +10:00
James Peter 90904eda59 ui(tui/assistant): remove inner top/bottom padding from code cards\n\n- Drop 1-row inner pads; keep only top/bottom border\n- Update height math: +2 (borders) instead of +4\n- Adjust render skip/visible calculations to match\n- Keeps left/right padding and language title logic intact 2025-08-29 17:44:33 +10:00
James Peter 25c5a5945c fix(cli/postinstall): if any other 'code' exists on PATH, remove our global shim and log clear guidance\n\n- Detect collisions using all candidates (which -a) not just the first\n- Remove npm global 'code' shim to avoid shadowing VS Code et al.\n- Keep 'coder' as the stable entrypoint; still create code-tui/exec wrappers\n- Offer optional 'vscode' alias to the detected editor path\n\nPairs with runtime change to always exec our bundled binary under npx. 2025-08-29 16:09:11 +10:00
James Peter 10116b03e5 packaging: move binaries to npm optionalDependencies per target; postinstall resolves platform package before GitHub fallback 2025-08-27 11:51:13 +10:00
James Peter ebb15a6519 packaging: download single binary + create code-tui/code-exec wrappers; CI builds only 'code' 2025-08-27 11:06:08 +10:00
James Peter 43bbe5081d release: slimmer assets + zstd fallback (.zst/.tar.gz)\n\n- Dual-format artifacts for macOS and Linux (.zst + .tar.gz)\n- Postinstall picks one: prefers .zst when zstd available, else .tar.gz\n- Windows stays .zip\n- Trim npm package (no embedded natives)\n- release-prod strips debuginfo; warning cleanup 2025-08-27 10:33:56 +10:00
James Peter 7f7f3f6bd9 cli(downloads): verify Content-Length, add retries/timeouts; improve WSL guidance\n\n- postinstall: bytes count vs Content-Length, inactivity/absolute timeouts, retry with backoff\n- coder.js: WSL detection + tailored guidance when binaries missing/invalid 2025-08-20 07:46:25 +10:00
James Peter e6646c4d72 cli(windows): guard against corrupt/empty downloads and improve spawn errors\n\n- postinstall: robust download + header validation (MZ/ELF/Mach-O), delete on failure\n- coder.js: pre-spawn binary header check; clearer EFTYPE/ENOEXEC/EACCES guidance\n- reduces confusing Windows EFTYPE crashes from partial downloads 2025-08-19 13:51:46 +10:00
James Peter fc17d512b7 refactor(naming): switch binaries and artifacts from 'coder' to 'code'; keep 'coder' as fallback alias only. Update workflows, scripts, and postinstall. 2025-08-17 20:45:10 +10:00
James Peter bc7eb8fbec chore(release): nudge workflow by touching postinstall.js (no functional change) 2025-08-17 20:31:10 +10:00
James Peter 9c5b23abeb feat(cli): add 'coder' bin alias and postinstall notice if existing 'code' is not ours 2025-08-17 19:16:42 +10:00
James Peter e1f9079b50 chore: commit pending changes on main (CLI, TUI, core, docs) 2025-08-17 18:55:58 +10:00
James Peter dce25e11b5 feat(cli): switch npm bin to 'code' and handle collisions gracefully
- package.json: expose bin as 'code'
- postinstall: detect existing 'code'; create 'coder' fallback and optional 'vscode' alias to existing editor
- keep Rust binary named 'coder' for builds; wrappers updated accordingly
2025-08-16 12:17:04 +10:00
James Peter 434f13571f chore(rebrand): rename user-facing Coder → Code; update links to new repo
- Update TUI titles, labels, messages
- Update onboarding copy and links
- Update MCP titles and human-output banner
- Update README branding and URLs
- postinstall: switch release URL to just-every/code; offer optional 'code' alias without collisions
- package.json repository URL updated

Note: CLI command remains 'coder' to avoid VS Code collision; optional alias offered interactively.
2025-08-16 12:10:29 +10:00
James Peter 2372c7122c fix: postinstall script import assertion error
- Replace dynamic import of package.json with readFileSync for Node.js compatibility
- Fixes 'ERR_IMPORT_ATTRIBUTE_MISSING' error during npm install
- Bump version to 0.1.3
2025-08-12 07:58:23 +10:00
James Peter d1641caa42 fix: handle permission errors for binaries on Linux/WSL
- Add automatic chmod +x when running coder.js on Unix systems
- Fix postinstall script to use octal notation for chmod (0o755)
- Add better error messages when binary is not executable
- Always try to fix permissions for existing binaries
- Bump version to 0.1.2 for hotfix release
2025-08-12 06:55:01 +10:00
James Peter 56c1bf910b fix: reduce npm package size by downloading binaries on install
- Add postinstall script to download platform-specific binaries from GitHub releases
- Update package.json to exclude binaries from npm package (only include JS wrappers)
- Modify release workflow to upload binaries as GitHub release assets
- Fixes 'Payload Too Large' error when publishing to npm (was 219MB, now <1MB)
2025-08-11 22:49:21 +10:00