Skip to content

Vendor blank, coding, and cua presets into the hud wheel - #515

Draft
jdchawla29 wants to merge 1 commit into
jaideep/vendor-environment-templatesfrom
jaideep/vendored-init-presets
Draft

Vendor blank, coding, and cua presets into the hud wheel#515
jdchawla29 wants to merge 1 commit into
jaideep/vendor-environment-templatesfrom
jaideep/vendored-init-presets

Conversation

@jdchawla29

@jdchawla29 jdchawla29 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #512.

hud init now copies the blank, coding, and cua starters from files packaged with the SDK instead of downloading GitHub tarballs — the scaffold a user gets always matches the SDK version they installed, and init works offline for these presets. The remaining presets keep the tarball path.

How

  • The starter trees stay authored (and CI-tested, per CI: run vendored template suites against the SDK checkout #513) at environments/<id>/. The wheel force-includes them at hud/cli/starters/<id>; presets.py resolves the packaged path first and falls back to the repo-relative environments/<id> so uv run hud init works from a source checkout. Missing both raises FileNotFoundError loudly.
  • The sdist now carries the three trees (the wheel is built from the sdist). Verified by building: 40 starter files in the wheel, no top-level environments/ in site-packages, executable bits survive (run_script.sh stays 755), gitignored junk stays out; the source-checkout copy path additionally skips .venv/__pycache__/cache dirs.
  • The inline blank scaffold (hud/cli/templates.py string constants) is replaced by a real environments/blank/ template; templates.py is deleted and init.py has a single materialization path.

Behavior notes

  • hud init NAME --preset blank no longer substitutes NAME into env.py/pyproject.toml — the scaffold is a verbatim copy (Environment(name="blank"), package blank-env), consistent with every other preset.
  • Offline smoke from a temp venv with the built wheel: --preset coding output is byte-identical to environments/coding; blank and cua scaffold cleanly.

Checks

pytest 749 passed (full suite), cli suite 160 passed including new preset materialization tests (vendored copy, exec bits, junk-dir skip, loud missing-tree failure, tarball path + path-traversal guard). ruff format/check clean. pyright: 4 pre-existing errors in untouched test files, none introduced.

HUD-2276


Note

Low Risk
Changes are confined to CLI scaffolding, packaging, and docs; no auth, runtime eval, or grading paths. The blank preset naming change is a minor UX shift for users who relied on directory-name substitution.

Overview
hud init now copies blank, coding, and cua from starter trees shipped inside the installed hud package instead of generating inline strings or downloading GitHub tarballs for those presets. Other presets still use the tarball path. Starters are authored at environments/<id>/, force-included into the wheel as hud/cli/starters/<id>, with a repo-checkout fallback to environments/ so uv run hud init works without a build.

The inline blank scaffold (hud/cli/templates.py) is removed; init always goes through materialize_preset, which copies vendored trees (skipping .venv/__pycache__, preserving executable bits) or downloads remote archives as before.

Behavior change: hud init NAME --preset blank no longer substitutes NAME into env.py/pyproject.toml—the scaffold is a verbatim copy (Environment(name="blank"), package blank-env), like other presets.

Docs and .gitignore are updated to describe bundled vs downloaded presets and to track environments/blank/ in git.

Reviewed by Cursor Bugbot for commit 3062e00. Bugbot is set up for automated code reviews on this repo. Configure here.

hud init copies these starters from files packaged with the SDK instead
of downloading GitHub tarballs, so the scaffold always matches the
installed version and works offline. The trees stay authored under
environments/; the wheel force-includes them at hud/cli/starters/, and
a source checkout falls back to environments/ directly.

The blank preset becomes a real template directory like its siblings,
replacing the inline string scaffold in hud/cli/templates.py; the
scaffold no longer substitutes the target name into env.py/pyproject.
Remaining presets keep the tarball path.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3062e00c67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
"hud/**",
"/environments/blank/**",
"/environments/coding/**",
"/environments/cua/**",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include starter lockfiles in the published wheel

When the package is released through .github/workflows/release.yml's uv build, the wheel is built from the sdist; reproducing that command reports “Building source distribution...” followed by “Building wheel from source distribution...”. Although this glob retains the CUA tree, both starter uv.lock files are absent from the resulting sdist and wheel. Consequently, hud init --preset cua from PyPI produces a tree whose Dockerfile.hud requires COPY ./pyproject.toml ./uv.lock ./env.py ./tasks.py /mcp_server/, so every documented Docker/deploy build fails immediately because uv.lock does not exist. Ensure the lockfiles are explicitly retained in the sdist and resulting wheel.

Useful? React with 👍 / 👎.

Comment thread environments/blank/env.py
from hud.environment import Environment

env = Environment(name="{env_name}")
env = Environment(name="blank")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the requested name in blank scaffolds

When hud init my-env or hud init my-env --preset blank copies this template, it now writes the literal blank instead of deriving the environment name from the requested target as the previous scaffold did. hud deploy treats the declared Environment name as the platform identity and uses get-or-rebuild semantics, so independently named blank projects all deploy as blank and later deployments can rebuild the same registry rather than create the intended environments. Restore target-name substitution for the blank scaffold and its project metadata.

AGENTS.md reference: AGENTS.md:L76-L78

Useful? React with 👍 / 👎.

@jdchawla29
jdchawla29 marked this pull request as draft July 27, 2026 03: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