mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-21 05:11:26 +00:00
refactor(docker): drop manual @hermes/ink build, rely on esbuild bundle
the esbuild pipeline (scripts/build.mjs) already bundles ink into a single self-contained dist/entry.js. remove the Dockerfile steps that manually copied packages/hermes-ink into node_modules/@hermes/ink and ran a nested npm install there. - Dockerfile: simplify TUI build step to just 'npm run build' - hermes_cli/main.py: _tui_build_needed now checks dist/entry.js staleness against source files before falling back to the old ink-bundle.js logic - tests: update TUI npm install tests and drop the Dockerfile contract test for the removed ink materialization step
This commit is contained in:
parent
279504d5b8
commit
42e166c7ea
4 changed files with 47 additions and 24 deletions
|
|
@ -95,12 +95,25 @@ def test_no_install_prebuilt_bundle_mode(tmp_path: Path, main_mod) -> None:
|
|||
assert main_mod._tui_need_npm_install(tmp_path) is False
|
||||
|
||||
|
||||
def test_build_needed_when_local_ink_bundle_missing(tmp_path: Path, main_mod) -> None:
|
||||
def test_build_needed_when_source_newer_than_entry(tmp_path: Path, main_mod) -> None:
|
||||
_touch_tui_entry(tmp_path)
|
||||
_touch_ink(tmp_path)
|
||||
src = tmp_path / "src" / "entry.tsx"
|
||||
src.parent.mkdir(parents=True, exist_ok=True)
|
||||
src.write_text("console.log('newer')")
|
||||
os.utime(src, (200, 200))
|
||||
os.utime(tmp_path / "dist" / "entry.js", (100, 100))
|
||||
|
||||
assert main_mod._tui_need_npm_install(tmp_path) is False
|
||||
assert main_mod._tui_build_needed(tmp_path) is True
|
||||
|
||||
|
||||
def test_build_not_needed_when_entry_exists_and_sources_unchanged(tmp_path: Path, main_mod) -> None:
|
||||
_touch_tui_entry(tmp_path)
|
||||
_touch_ink(tmp_path)
|
||||
|
||||
assert main_mod._tui_need_npm_install(tmp_path) is False
|
||||
assert main_mod._tui_build_needed(tmp_path) is True
|
||||
assert main_mod._tui_build_needed(tmp_path) is False
|
||||
|
||||
|
||||
def test_build_not_needed_when_entry_and_ink_bundle_present(tmp_path: Path, main_mod) -> None:
|
||||
|
|
|
|||
|
|
@ -121,20 +121,6 @@ def test_dockerfile_builds_tui_assets(dockerfile_text):
|
|||
)
|
||||
|
||||
|
||||
def test_dockerfile_materializes_local_tui_ink_package(dockerfile_text):
|
||||
assert any(
|
||||
"ui-tui" in step
|
||||
and "node_modules/@hermes/ink" in step
|
||||
and "packages/hermes-ink" in step
|
||||
and "rm -rf packages/hermes-ink/node_modules" in step
|
||||
and "npm install --omit=dev" in step
|
||||
and "--prefix node_modules/@hermes/ink" in step
|
||||
and "rm -rf node_modules/@hermes/ink/node_modules/react" in step
|
||||
and "await import('@hermes/ink')" in step
|
||||
for step in _run_steps(dockerfile_text)
|
||||
)
|
||||
|
||||
|
||||
def test_dockerignore_excludes_nested_dependency_dirs():
|
||||
if not DOCKERIGNORE.exists():
|
||||
pytest.skip(".dockerignore not present in this checkout")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue