Skip to content

build(taskfile): Bump emsdk version to 4.0.23; Extract emsdk and node-modules into sub-taskfiles; Change default task to package.#139

Merged
Bill-hbrhbr merged 14 commits intoy-scope:mainfrom
Bill-hbrhbr:fix-emsdk-taskfile
Mar 25, 2026
Merged

build(taskfile): Bump emsdk version to 4.0.23; Extract emsdk and node-modules into sub-taskfiles; Change default task to package.#139
Bill-hbrhbr merged 14 commits intoy-scope:mainfrom
Bill-hbrhbr:fix-emsdk-taskfile

Conversation

@Bill-hbrhbr
Copy link
Copy Markdown
Contributor

@Bill-hbrhbr Bill-hbrhbr commented Mar 23, 2026

Description

This PR contains quality-of-life improvements to the taskfile setup. The main benefit is a cleaner root taskfile.yaml that stays focused on top-level package build workflows, while dependency installation and package-manager setup logic are moved into dedicated sub-taskfiles.

This PR also fixes the npm task wiring by reusing the existing workflows defined in package.json and making task input and output paths more explicit.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • CI passes.

Summary by CodeRabbit

  • Chores
    • Rewired task dependencies and default flow to use consolidated toolchain modules.
    • Simplified cleaning to target build/dist directories and added run-once constraints to key tasks.
    • Split provisioning: added a dedicated node-modules install task and a separate toolchain setup task (emsdk) with scoped variables.
    • Updated packaging/build steps to emit artifacts into the configured output directory.
  • Chores
    • Adjusted test init prerequisite ordering for more reliable bootstrapping.

@Bill-hbrhbr Bill-hbrhbr requested a review from a team as a code owner March 23, 2026 16:58
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Extracts emsdk/toolchain setup into taskfiles/toolchains.yaml, adds taskfiles/node-modules.yaml, removes inline emsdk/task vars from taskfile.yaml, updates task dependency wiring (:emsdk:toolchains:emsdk), changes several tasks to run: "once", simplifies clean, revises package build/pack commands, and reorders test init deps.

Changes

Cohort / File(s) Summary
Main Taskfile
taskfile.yaml
Removed inline emsdk task and exported emsdk vars/checksum; updated default to run package (instead of clp-ffi-js); simplified clean to remove only {{.G_BUILD_DIR}} and {{.G_DIST_DIR}}; added run: "once" to clean, clp-ffi-js, package, config-cmake-project; updated clp-ffi-js sources and removed its emsdk dependency; replaced TypeScript/pack commands with npm run build:ts -- --outDir '{{.OUTPUT_DIR}}' and npm pack --pack-destination '{{.OUTPUT_DIR}}'.
Dependency bootstrap
taskfiles/deps.yaml
Changed default.deps to reference :toolchains:emsdk instead of :emsdk.
Toolchains module
taskfiles/toolchains.yaml
New file introducing emsdk task and globals (G_EMSDK_DIR, G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE, G_EMSDK_CHECKSUM); task runs once, downloads/extracts pinned emsdk, installs/activates the pinned version (5.0.4), runs npm install in upstream/emscripten, and generates a checksum file.
Node modules task
taskfiles/node-modules.yaml
New file with default task that tracks package.json/package-lock.json/taskfile, runs npm clean-install, declares generates: node_modules/**/*, and uses run: "once".
Test wiring
taskfiles/test.yaml
init task dependency order changed from [:package, :node-modules][:node-modules, :package] (command unchanged).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant TaskRunner as Task runner
participant Toolchains as toolchains:emsdk
participant GitRemote as Git (emsdk repo)
participant Filesystem as Filesystem
participant Node as npm/node

TaskRunner->>Toolchains: invoke :toolchains:emsdk (run: "once")
Toolchains->>GitRemote: download/extract pinned emsdk release
Toolchains->>Toolchains: run ./emsdk install & ./emsdk activate (VERSION 5.0.4)
Toolchains->>Node: prepend emsdk node bins; run npm install in upstream/emscripten
Toolchains->>Filesystem: write checksum file (emsdk.md5)
TaskRunner->>Node: invoke node-modules (npm clean-install)
Node->>Filesystem: populate node_modules/**
TaskRunner->>TaskRunner: run package (npm run build:ts, npm pack)
TaskRunner->>Filesystem: write outputs to {{.OUTPUT_DIR}}

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions version bumps and task reorganization, but the actual changes show emsdk pinned to 5.0.4, not 4.0.23, and the primary objective is taskfile refactoring for idempotency. Update the title to accurately reflect the actual changes: consider 'build(taskfile): Refactor for idempotent workflows; Extract emsdk and node-modules; Pin emsdk to 5.0.4' or similar to match the commit message and PR objectives.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Restrict root taskfile to idempotent top-level product workflow tasks; Reuse existing npm package workflows where applicable. refactor(taskfile): Keep root workflows idempotent and orchestration-focused; reuse shared npm tasks. Mar 23, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
taskfile.yaml (2)

37-42: ⚠️ Potential issue | 🔴 Critical

Undefined variable: G_EMSDK_CHECKSUM moved to included file.

{{.G_EMSDK_CHECKSUM}} on line 39 is now defined in taskfiles/deps/emsdk.yaml. Task v3 variable scoping propagates variables DOWN to included files, but NOT back UP to the including file. This reference will resolve to an empty string, breaking the source tracking for the clp-ffi-js task.

🐛 Option 1: Re-declare the variable in taskfile.yaml
 vars:
   G_BUILD_DIR: "{{.ROOT_DIR}}/build"
   G_CLP_FFI_JS_BUILD_DIR: "{{.G_BUILD_DIR}}/clp-ffi-js"
   G_DEPS_DIR: "{{.G_BUILD_DIR}}/deps"
   G_DIST_DIR: "{{.ROOT_DIR}}/dist"
+  G_EMSDK_DIR: "{{.G_BUILD_DIR}}/emsdk"
+  G_EMSDK_CHECKSUM: "{{.G_BUILD_DIR}}/emsdk.md5"
🐛 Option 2: Remove emsdk checksum from sources (loses rebuild tracking)
     sources:
       - "{{.G_CLP_FFI_JS_BUILD_DIR}}/CMakeCache.txt"
-      - "{{.G_EMSDK_CHECKSUM}}"
       - "{{.TASKFILE}}"
       - "CMakeLists.txt"
       - "src/**/*"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@taskfile.yaml` around lines 37 - 42, The sources entry uses the variable
{{.G_EMSDK_CHECKSUM}} which is now defined only in the included file
taskfiles/deps/emsdk.yaml and therefore resolves to an empty string here; fix by
re-declaring G_EMSDK_CHECKSUM in the including taskfile.yaml (add a top-level
variable G_EMSDK_CHECKSUM with the same value or computed expression) so the
sources list can expand correctly, or if you intentionally accept losing rebuild
tracking remove the "{{.G_EMSDK_CHECKSUM}}" item from the sources array; update
the variable near the top of taskfile.yaml (or remove the reference) and keep
the sources list that contains "{{.G_EMSDK_CHECKSUM}}" in sync with that change.

99-117: ⚠️ Potential issue | 🔴 Critical

Undefined variables: G_EMSDK_CHECKSUM and G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE.

Both variables referenced here (lines 102 and 115) are now defined only in taskfiles/deps/emsdk.yaml. Due to Task v3's unidirectional variable scoping (parent → child only), these will be undefined:

  1. Line 102: {{.G_EMSDK_CHECKSUM}} in sources will be empty
  2. Line 115: {{.G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE}} will pass an empty path to CMake, causing configuration failure

The deps:emsdk dependency on line 111 ensures the emsdk is installed, but it does NOT make its variables available to this task.

🐛 Proposed fix: Add required variables to taskfile.yaml vars section
 vars:
   G_BUILD_DIR: "{{.ROOT_DIR}}/build"
   G_CLP_FFI_JS_BUILD_DIR: "{{.G_BUILD_DIR}}/clp-ffi-js"
   G_DEPS_DIR: "{{.G_BUILD_DIR}}/deps"
   G_DIST_DIR: "{{.ROOT_DIR}}/dist"
+  G_EMSDK_DIR: "{{.G_BUILD_DIR}}/emsdk"
+  G_EMSDK_CHECKSUM: "{{.G_BUILD_DIR}}/emsdk.md5"
+  G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE: >-
+    {{.G_EMSDK_DIR}}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake

Note: This creates duplication with emsdk.yaml, but is necessary due to Task's scoping rules. Consider documenting this constraint or extracting shared vars to a common location.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@taskfile.yaml` around lines 99 - 117, The task "config-cmake-project"
references variables G_EMSDK_CHECKSUM and G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE that
are only defined in deps/emsdk.yaml and thus are undefined in this task; add
G_EMSDK_CHECKSUM and G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE entries to the vars
section of taskfile.yaml (using the same values/expressions as in
taskfiles/deps/emsdk.yaml) so the sources and the -DCMAKE_TOOLCHAIN_FILE
argument receive the correct values; keep names exact (G_EMSDK_CHECKSUM,
G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE) to match the references in cmd and sources.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@taskfiles/deps/emsdk.yaml`:
- Around line 42-44: The PATH assignment using echo on the glob
"{{.G_EMSDK_DIR}}/node/*/bin" can produce space-separated entries when multiple
matches exist, breaking PATH; update the npm install line to build a
colon-separated PATH properly (e.g., replace the echo-based expansion with a
printf/join approach or explicit single-version selection like using ls to pick
one node dir) so that PATH becomes "dir1:dir2:$PATH" even when multiple
node/*/bin matches exist; change the line that currently reads PATH=$(echo
{{.G_EMSDK_DIR}}/node/*/bin):$PATH npm install to use a colon-joining command
substitution or an explicit node directory selection.
- Around line 19-21: Replace the invalid double-colon task references in the
deps list: change "::init" to "init" and "::utils:checksum:validate" to
"utils:checksum:validate" so the task references use the supported single-colon
syntax; update the deps entries referencing "::init" and
"::utils:checksum:validate" accordingly.

---

Outside diff comments:
In `@taskfile.yaml`:
- Around line 37-42: The sources entry uses the variable {{.G_EMSDK_CHECKSUM}}
which is now defined only in the included file taskfiles/deps/emsdk.yaml and
therefore resolves to an empty string here; fix by re-declaring G_EMSDK_CHECKSUM
in the including taskfile.yaml (add a top-level variable G_EMSDK_CHECKSUM with
the same value or computed expression) so the sources list can expand correctly,
or if you intentionally accept losing rebuild tracking remove the
"{{.G_EMSDK_CHECKSUM}}" item from the sources array; update the variable near
the top of taskfile.yaml (or remove the reference) and keep the sources list
that contains "{{.G_EMSDK_CHECKSUM}}" in sync with that change.
- Around line 99-117: The task "config-cmake-project" references variables
G_EMSDK_CHECKSUM and G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE that are only defined in
deps/emsdk.yaml and thus are undefined in this task; add G_EMSDK_CHECKSUM and
G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE entries to the vars section of taskfile.yaml
(using the same values/expressions as in taskfiles/deps/emsdk.yaml) so the
sources and the -DCMAKE_TOOLCHAIN_FILE argument receive the correct values; keep
names exact (G_EMSDK_CHECKSUM, G_EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE) to match the
references in cmd and sources.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a0e63d73-950d-40c2-a1d0-9904c18929b5

📥 Commits

Reviewing files that changed from the base of the PR and between b991c79 and d9954c8.

📒 Files selected for processing (6)
  • taskfile.yaml
  • taskfiles/deps/emsdk.yaml
  • taskfiles/deps/main.yaml
  • taskfiles/deps/node-modules.yaml
  • taskfiles/lint.yaml
  • taskfiles/test.yaml

Comment on lines +19 to +21
deps:
- "::init"
- task: "::utils:checksum:validate"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Task (go-task) double colon syntax for nested includes root reference

💡 Result:

In go-task (Task), there is no double colon (::) syntax for nested includes or root references. The colon (:) separates namespaces for calling tasks from included Taskfiles. To call a task from an included Taskfile, use single colon syntax like B:up or for nested includes B:C:up (e.g., A includes B, B includes C). Root reference uses templating variables like {{.ROOT_DIR}} (absolute path of root Taskfile directory) or {{.TASKFILE_DIR}} (current/included Taskfile directory). These are available in cmds, vars, dir, etc. Colon-separated syntax (:) exists only in sources for glob patterns (experimental/recent PR #2404), e.g., sources: [".go:internal//.go"]. Official docs confirm single colon for task calls (usage, schema) and templating vars for paths (templating reference). No :: syntax found in authoritative sources.

Citations:


Replace double-colon syntax with single-colon syntax for task references.

The ::init and ::utils:checksum:validate references use invalid go-task syntax. Double colons (::) are not supported. Use single colons instead: init and utils:checksum:validate.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@taskfiles/deps/emsdk.yaml` around lines 19 - 21, Replace the invalid
double-colon task references in the deps list: change "::init" to "init" and
"::utils:checksum:validate" to "utils:checksum:validate" so the task references
use the supported single-colon syntax; update the deps entries referencing
"::init" and "::utils:checksum:validate" accordingly.

@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Keep root workflows idempotent and orchestration-focused; reuse shared npm tasks. refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; reuse shared npm tasks. Mar 23, 2026
@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; reuse shared npm tasks. refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; Reuse shared npm workflows. Mar 23, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@taskfiles/toolchains.yaml`:
- Around line 12-15: The emsdk bootstrap repo is being cloned at HEAD which
makes builds non-reproducible; modify the task that clones the emsdk repository
to pin it to EMSDK_VERSION (or an explicit commit). Use the EMSDK_VERSION
variable from vars (or add EMSDK_REPO_COMMIT) and either clone with git clone
--branch "v${EMSDK_VERSION}" --depth 1 or perform git checkout
"v${EMSDK_VERSION}" (or the pinned commit) immediately after clone in the same
task/step that currently clones the repo, so the bootstrap repo matches the SDK
payload version.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: aeb52ac9-e2a7-46c1-8e78-2f14ae71a7de

📥 Commits

Reviewing files that changed from the base of the PR and between d9954c8 and 3b517e0.

📒 Files selected for processing (5)
  • taskfile.yaml
  • taskfiles/deps.yaml
  • taskfiles/node-modules.yaml
  • taskfiles/test.yaml
  • taskfiles/toolchains.yaml

@Bill-hbrhbr Bill-hbrhbr requested a review from junhaoliao March 23, 2026 18:06
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@taskfile.yaml`:
- Around line 28-33: The clean task currently only deletes '{{.G_BUILD_DIR}}' so
running task clean leaves the top-level release artifacts in '{{.G_DIST_DIR}}'
behind; update the clean task (the clean: run: "once" cmds: list) to also remove
'{{.G_DIST_DIR}}' (e.g., add a "rm -rf '{{.G_DIST_DIR}}'" entry alongside the
existing rm -rf for '{{.G_BUILD_DIR}}'), and make the same change for the other
clean task instance referenced later in the file so both clean targets reset the
repo fully after package/build.
- Around line 6-8: The build fingerprint for the config-cmake-project task is
missing the toolchains Taskfile, so edits to toolchains aren't tracked; update
the config-cmake-project task's sources (and the other affected tasks referenced
around lines 103–105) to include the toolchains Taskfile entry (the "toolchains"
Taskfile) so Task's up-to-date check includes changes to
taskfiles/toolchains.yaml (i.e., add the toolchains Taskfile to the task's
sources/fingerprint list for config-cmake-project and the other similar tasks).
- Around line 111-113: The task has a redundant direct dependency on
"toolchains:emsdk" in the deps list; remove the "toolchains:emsdk" entry from
the deps array for the task (leave the "deps" dependency only) so that the task
relies on the existing ":toolchains:emsdk" transitively via the "deps" task;
target the deps list in taskfile.yaml (the deps key shown in the diff) and
delete the "toolchains:emsdk" line to simplify the dependency graph.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d833502a-9892-4a96-b899-1f3a8d861bae

📥 Commits

Reviewing files that changed from the base of the PR and between 3b517e0 and eb35c7f.

📒 Files selected for processing (1)
  • taskfile.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
taskfile.yaml (1)

71-77: ⚠️ Potential issue | 🟠 Major

Add package-lock.json to the package task's sources to ensure cache invalidation when dependencies change.

The package task depends on node-modules but doesn't fingerprint its own inputs (package-lock.json), meaning the build cache won't invalidate even when the dependency tree changes. This allows dist/ and the tarball to remain cached after npm dependencies update, which causes stale binaries in node_modules to be used by npm run build:ts and npm pack.

Add the lockfile that node-modules tracks:

🛠️ Suggested fix
   package:
     vars:
       CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK}}.md5"
       OUTPUT_DIR: "{{.G_DIST_DIR}}"
     sources:
       - "package.json"
+      - "package-lock.json"
       - "src/**/*.ts"
       - "tsconfig.build.json"
       - "tsconfig.json"
       - "{{.G_CLP_FFI_JS_CHECKSUM}}"
       - "{{.TASKFILE}}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@taskfile.yaml` around lines 71 - 77, The package task's sources list is
missing the dependency lockfile so the cache doesn't invalidate when
dependencies change; update the "package" task's sources (the sources array
shown) to include "package-lock.json" (the same lockfile tracked by the
node-modules task) so the task fingerprints the lockfile and invalidates the
cache whenever dependencies are updated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@taskfile.yaml`:
- Around line 40-46: The task caches for config-cmake-project and clp-ffi-js are
missing the generated dependency settings and the deps taskfile in their sources
lists; update config-cmake-project.sources and clp-ffi-js.sources to include
{{.G_DEPS_CMAKE_SETTINGS_FILE}} and taskfiles/deps.yaml so changes produced by
the deps task invalidate these tasks (ensure both entries are added to the
sources arrays alongside the existing CMake/CMakeCache and other entries).

---

Outside diff comments:
In `@taskfile.yaml`:
- Around line 71-77: The package task's sources list is missing the dependency
lockfile so the cache doesn't invalidate when dependencies change; update the
"package" task's sources (the sources array shown) to include
"package-lock.json" (the same lockfile tracked by the node-modules task) so the
task fingerprints the lockfile and invalidates the cache whenever dependencies
are updated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dcf2a664-ed5e-4557-97cd-2669df2c2e2a

📥 Commits

Reviewing files that changed from the base of the PR and between eb35c7f and 35a02d1.

📒 Files selected for processing (1)
  • taskfile.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
taskfiles/toolchains.yaml (1)

49-51: ⚠️ Potential issue | 🟡 Minor

Make the Node bin PATH selection explicit.

This still assumes {{.G_EMSDK_DIR}}/node/*/bin resolves to exactly one directory. If it ever resolves to more than one, echo turns the matches into a single space-separated string, which is not a valid PATH, and npm install can run with the wrong toolchain.

Possible fix
       - |-
         cd "{{.G_EMSDK_DIR}}/upstream/emscripten"
-        PATH=$(echo {{.G_EMSDK_DIR}}/node/*/bin):$PATH npm install
+        PATH="$(printf '%s:' "{{.G_EMSDK_DIR}}"/node/*/bin | sed 's/:$//'):$PATH" npm install
#!/bin/bash
set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

mkdir -p "$tmpdir/node/v1/bin" "$tmpdir/node/v2/bin"

echo "echo-based PATH:"
echo "$(echo "$tmpdir"/node/*/bin)"

echo
echo "colon-joined PATH:"
printf '%s\n' "$(printf '%s:' "$tmpdir"/node/*/bin | sed 's/:$//')"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@taskfiles/toolchains.yaml` around lines 49 - 51, The PATH assignment that
uses PATH=$(echo {{.G_EMSDK_DIR}}/node/*/bin):$PATH before npm install can
produce an invalid PATH if the glob expands to multiple dirs; replace that
echo-based expansion with a deterministic colon-joined expansion (e.g. build the
prefix with printf '%s:' {{.G_EMSDK_DIR}}/node/*/bin and strip the trailing
colon) or explicitly pick the correct node bin (first match) and then export
PATH="$PREFIX:$PATH" before running npm install; update the line that sets PATH
and the subsequent npm install invocation accordingly to ensure a valid,
colon-separated PATH is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@taskfiles/toolchains.yaml`:
- Around line 49-51: The PATH assignment that uses PATH=$(echo
{{.G_EMSDK_DIR}}/node/*/bin):$PATH before npm install can produce an invalid
PATH if the glob expands to multiple dirs; replace that echo-based expansion
with a deterministic colon-joined expansion (e.g. build the prefix with printf
'%s:' {{.G_EMSDK_DIR}}/node/*/bin and strip the trailing colon) or explicitly
pick the correct node bin (first match) and then export PATH="$PREFIX:$PATH"
before running npm install; update the line that sets PATH and the subsequent
npm install invocation accordingly to ensure a valid, colon-separated PATH is
used.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d8fce3b7-0f18-4769-a8e4-b100da91d0dc

📥 Commits

Reviewing files that changed from the base of the PR and between 35a02d1 and 730255b.

📒 Files selected for processing (1)
  • taskfiles/toolchains.yaml

@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; Reuse shared npm workflows. refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; Bump emsdk version to 4.0.23; Reuse shared npm workflows. Mar 24, 2026
Copy link
Copy Markdown
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

lgtm

for the title, how about:

build(taskfile): Bump `emsdk` version to `4.0.23`; Extract emsdk and node-modules into sub-taskfiles; Change default task to `package`.

Co-authored-by: Junhao Liao <junhao@junhao.ca>
@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Keep root workflows idempotent and package-orchestration-focused; Bump emsdk version to 4.0.23; Reuse shared npm workflows. build(taskfile): Bump emsdk version to 4.0.23; Extract emsdk and node-modules into sub-taskfiles; Change default task to package. Mar 25, 2026
@Bill-hbrhbr Bill-hbrhbr requested a review from junhaoliao March 25, 2026 02:11
junhaoliao
junhaoliao previously approved these changes Mar 25, 2026
@Bill-hbrhbr Bill-hbrhbr merged commit e5068cc into y-scope:main Mar 25, 2026
4 checks passed
@Bill-hbrhbr Bill-hbrhbr deleted the fix-emsdk-taskfile branch March 25, 2026 10:39
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.

2 participants