Skip to content

feat: add package type, platforms, and languages options#471

Merged
patrickkabwe merged 5 commits intomainfrom
feat/more-args
Mar 16, 2026
Merged

feat: add package type, platforms, and languages options#471
patrickkabwe merged 5 commits intomainfrom
feat/more-args

Conversation

@patrickkabwe
Copy link
Copy Markdown
Owner

@patrickkabwe patrickkabwe commented Mar 16, 2026

Summary by CodeRabbit

  • New Features

    • CLI: added --platforms and --langs flags; CI supports a dynamic matrix for multi-package builds/tests.
  • Improvements

    • Platform-aware language selection UI with stricter validation and clearer messages.
    • More robust iOS/Android build and E2E flows with runtime workspace/scheme discovery and safer path handling.
    • CI/artifact naming and caching updated to reflect matrix-driven package metadata.
  • Documentation

    • CLI usage docs updated with new options.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

Converts static per-package CI matrices into a dynamic define-matrix-driven workflow; adds CLI flags for platforms and languages with parsing/validation and UI updates; updates iOS build action and E2E script to discover workspace, scheme, and module/app identifiers at runtime.

Changes

Cohort / File(s) Summary
CI Workflow & Actions
.github/workflows/ci-packages.yml, .github/actions/ios-build-xcode/action.yml
Adds a define-matrix job that emits multiple matrices (generation, ios_build, android_build, ios_e2e, android_e2e); replaces hard-coded per-package matrices with dynamic matrices via outputs/fromJson; standardizes matrix keys (package_type, package_dir, scenario, pm, etc.); updates artifact naming, caching keys, OS-specific steps, and workspace/scheme selection in the iOS action.
Package-related jobs & scripts
.github/.../generate-packages*, .github/.../test-*-build*, .github/.../e2e-*, scripts/e2e-maestro.sh
Unifies generation, build, and E2E jobs to consume define-matrix outputs; computes package_dir values dynamically; introduces scenario-based validation (android/ios directories, podspecs); updates artifact upload/download names and paths; makes e2e-maestro.sh derive PACKAGE_ROOT_NAME, PACKAGE_NAME, APP_ID, MODULE_ID and compute PascalCase scheme and workspace at runtime.
CLI Surface & Parsing
src/cli/index.ts, src/cli/create.ts
Adds --platforms and --langs flags; implements parsing/validation helpers (parseListOption, parsePlatformsOption, parseLangsOption), SUPPORTED_* constants, allowed-language derivation, and formatting helpers; updates CI path to use parsed flags and reworks language-selection UI and spinner lifecycle handling.
Types
src/types.ts
Adds optional langs?: string and platforms?: string to CreateModuleOptions; updates GenerateModuleConfig to omit langs and platforms along with moduleDir.
Docs
docs/docs/commands.md
Documents new CLI options: -t/--package-type, --platforms, --langs, and --ci in usage/help text.
GitHub Action inputs
.github/actions/ios-build-xcode/action.yml
Makes scheme input optional; adds logic to discover the first non-Pods Xcode workspace and default SCHEME_NAME to the workspace base name; updates xcodebuild invocation to use discovered workspace and scheme.
E2E test fixture
e2e-tests/view.e2e.yaml
Replaces static test id with dynamic ${MODULE_ID} to match runtime module identifier passed by scripts/workflows.

Sequence Diagram(s)

sequenceDiagram
  participant GH as GitHub Actions
  participant Define as define-matrix job
  participant Gen as Generator jobs
  participant Build as Build jobs (iOS/Android)
  participant E2E as E2E jobs
  participant Art as Artifact storage

  GH->>Define: start define-matrix
  Define-->>GH: emit matrices (generation, ios_build, android_build, ios_e2e, android_e2e)
  GH->>Gen: for each generation matrix entry (package_dir, package_type, pm, scenario)
  Gen->>Art: upload generated package artifacts
  GH->>Build: use build matrices (from define outputs) to run platform builds
  Build->>Art: upload build artifacts (apk/ipa)
  GH->>E2E: run e2e jobs using artifacts and discovered workspace/scheme/module IDs
  E2E->>Art: upload e2e recordings/logs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I hopped through matrices, one and many,

found workspaces where schemes were plenty.
I named each module, built with glee,
recorded runs for all to see.
CI blooms — a carrot jubilee!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main feature addition across the changeset: new CLI options for package type, platforms, and languages.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/more-args
📝 Coding Plan
  • Generate coding plan for human review comments

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.

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 (1)
scripts/e2e-maestro.sh (1)

85-96: ⚠️ Potential issue | 🟡 Minor

Quote variables in xcodebuild command to prevent word splitting.

The $SCHEME variable is used unquoted in the buildCmd string on lines 86-87. If SCHEME contains spaces (unlikely but possible with custom workspace names), the command will break.

🛡️ Proposed fix
   buildCmd="xcodebuild \
-    -workspace $SCHEME.xcworkspace \
-    -scheme $SCHEME \
+    -workspace \"$SCHEME.xcworkspace\" \
+    -scheme \"$SCHEME\" \
     -configuration Release \
-    -destination id=$iphone16Id \
+    -destination \"id=$iphone16Id\" \
     -derivedDataPath build \
     -jobs $(sysctl -n hw.ncpu) \
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/e2e-maestro.sh` around lines 85 - 96, The xcodebuild command string
assigned to buildCmd uses unquoted variable expansions (notably $SCHEME and the
workspace expansion $SCHEME.xcworkspace) which can cause word-splitting if the
scheme/workspace name contains spaces; update the buildCmd construction to quote
the variable expansions (e.g., "$SCHEME" and "$SCHEME.xcworkspace") and any
other interpolations like "$iphone16Id" to ensure the command tokens remain
intact when executed via eval or spawned.
🧹 Nitpick comments (1)
.github/workflows/ci-packages.yml (1)

74-79: Output key naming inconsistency between definition and reference.

The outputs are defined with hyphens (ios-build, android-build, etc.) but the Node.js script outputs use underscores (ios_build, android_build). GitHub Actions converts hyphenated output names, but this could cause confusion.

Looking at line 342: matrix: ${{ fromJson(needs.define-matrix.outputs.ios-build) }} - this references ios-build, which maps to the ios_build console.log output due to GitHub's output key normalization. This works but is confusing.

Consider using consistent naming (either all hyphens or all underscores) for clarity:

♻️ Suggested consistency improvement
         outputs:
             generation: ${{ steps.set-matrix.outputs.generation }}
-            ios-build: ${{ steps.set-matrix.outputs.ios_build }}
-            android-build: ${{ steps.set-matrix.outputs.android_build }}
-            ios-e2e: ${{ steps.set-matrix.outputs.ios_e2e }}
-            android-e2e: ${{ steps.set-matrix.outputs.android_e2e }}
+            ios_build: ${{ steps.set-matrix.outputs.ios_build }}
+            android_build: ${{ steps.set-matrix.outputs.android_build }}
+            ios_e2e: ${{ steps.set-matrix.outputs.ios_e2e }}
+            android_e2e: ${{ steps.set-matrix.outputs.android_e2e }}

Then update references like needs.define-matrix.outputs.ios-build to needs.define-matrix.outputs.ios_build.

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

In @.github/workflows/ci-packages.yml around lines 74 - 79, The outputs block
defines keys with hyphens (generation, ios-build, android-build, ios-e2e,
android-e2e) but the Node script and later references use underscores
(ios_build, android_build, ios_e2e, android_e2e); rename the output keys to use
underscores (e.g., ios_build, android_build, ios_e2e, android_e2e) and update
all references that read from the step outputs (e.g., change
needs.define-matrix.outputs.ios-build to needs.define-matrix.outputs.ios_build
and similarly for android and e2e keys, and ensure any usage of
set-matrix.outputs matches the new underscore names) so naming is consistent
across the outputs and their consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/e2e-maestro.sh`:
- Around line 60-65: The script does a cd to "$EXAMPLE_DIR/ios" without checking
for failure, so if the directory is missing the rest of the logic
(WORKSPACE_NAME/SCHEME) will run in the wrong path; update the cd invocation
(the line using cd "$EXAMPLE_DIR/ios") to check its exit status and abort (e.g.,
cd ... || { echo "failed to cd to $EXAMPLE_DIR/ios" >&2; exit 1; }) so the
script stops on failure and avoids SC2164 warnings, leaving the subsequent
WORKSPACE_NAME and SCHEME logic unchanged.
- Line 134: The cd command that changes into the Android example directory (the
line containing cd "$EXAMPLE_DIR/android") must handle failure; update that
invocation to check its exit status and abort with a descriptive error message
if it fails (for example, append a fallback that logs the failure and exits or
test the return code and exit 1). Mirror the same failure-handling approach used
for the iOS cd path so the script does not continue when the directory change
fails.

---

Outside diff comments:
In `@scripts/e2e-maestro.sh`:
- Around line 85-96: The xcodebuild command string assigned to buildCmd uses
unquoted variable expansions (notably $SCHEME and the workspace expansion
$SCHEME.xcworkspace) which can cause word-splitting if the scheme/workspace name
contains spaces; update the buildCmd construction to quote the variable
expansions (e.g., "$SCHEME" and "$SCHEME.xcworkspace") and any other
interpolations like "$iphone16Id" to ensure the command tokens remain intact
when executed via eval or spawned.

---

Nitpick comments:
In @.github/workflows/ci-packages.yml:
- Around line 74-79: The outputs block defines keys with hyphens (generation,
ios-build, android-build, ios-e2e, android-e2e) but the Node script and later
references use underscores (ios_build, android_build, ios_e2e, android_e2e);
rename the output keys to use underscores (e.g., ios_build, android_build,
ios_e2e, android_e2e) and update all references that read from the step outputs
(e.g., change needs.define-matrix.outputs.ios-build to
needs.define-matrix.outputs.ios_build and similarly for android and e2e keys,
and ensure any usage of set-matrix.outputs matches the new underscore names) so
naming is consistent across the outputs and their consumers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a43c2af-e87c-46b0-8a37-9dd796ca27bf

📥 Commits

Reviewing files that changed from the base of the PR and between 1352541 and 48c33f7.

📒 Files selected for processing (3)
  • .github/actions/ios-build-xcode/action.yml
  • .github/workflows/ci-packages.yml
  • scripts/e2e-maestro.sh

Comment on lines +60 to +65
cd "$EXAMPLE_DIR/ios"

WORKSPACE_NAME="$(find . -maxdepth 1 -name "*.xcworkspace" ! -name "Pods.xcworkspace" -exec basename {} .xcworkspace \; | head -1)"
if [ -n "$WORKSPACE_NAME" ]; then
SCHEME="$WORKSPACE_NAME"
fi
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 | 🟡 Minor

Add failure handling for cd command.

If the directory doesn't exist or cd fails for any reason, the script will continue in the wrong directory and potentially cause confusing failures. Static analysis (Shellcheck SC2164) also flags this.

🛡️ Proposed fix
 if [ "$PLATFORM" == "ios" ]; then
-  cd "$EXAMPLE_DIR/ios"
+  cd "$EXAMPLE_DIR/ios" || { echo "Failed to change to iOS directory"; exit 1; }
 
   WORKSPACE_NAME="$(find . -maxdepth 1 -name "*.xcworkspace" ! -name "Pods.xcworkspace" -exec basename {} .xcworkspace \; | head -1)"
   if [ -n "$WORKSPACE_NAME" ]; then
     SCHEME="$WORKSPACE_NAME"
   fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd "$EXAMPLE_DIR/ios"
WORKSPACE_NAME="$(find . -maxdepth 1 -name "*.xcworkspace" ! -name "Pods.xcworkspace" -exec basename {} .xcworkspace \; | head -1)"
if [ -n "$WORKSPACE_NAME" ]; then
SCHEME="$WORKSPACE_NAME"
fi
cd "$EXAMPLE_DIR/ios" || { echo "Failed to change to iOS directory"; exit 1; }
WORKSPACE_NAME="$(find . -maxdepth 1 -name "*.xcworkspace" ! -name "Pods.xcworkspace" -exec basename {} .xcworkspace \; | head -1)"
if [ -n "$WORKSPACE_NAME" ]; then
SCHEME="$WORKSPACE_NAME"
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 60-60: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

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

In `@scripts/e2e-maestro.sh` around lines 60 - 65, The script does a cd to
"$EXAMPLE_DIR/ios" without checking for failure, so if the directory is missing
the rest of the logic (WORKSPACE_NAME/SCHEME) will run in the wrong path; update
the cd invocation (the line using cd "$EXAMPLE_DIR/ios") to check its exit
status and abort (e.g., cd ... || { echo "failed to cd to $EXAMPLE_DIR/ios" >&2;
exit 1; }) so the script stops on failure and avoids SC2164 warnings, leaving
the subsequent WORKSPACE_NAME and SCHEME logic unchanged.

cd "$SCRIPT_DIR"
else
cd $EXAMPLE_DIR/android
cd "$EXAMPLE_DIR/android"
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 | 🟡 Minor

Add failure handling for cd command.

Same issue as the iOS path - the Android cd command should handle failures. Static analysis (Shellcheck SC2164) flags this as well.

🛡️ Proposed fix
 else
-  cd "$EXAMPLE_DIR/android"
+  cd "$EXAMPLE_DIR/android" || { echo "Failed to change to Android directory"; exit 1; }
   chmod +x ./gradlew
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd "$EXAMPLE_DIR/android"
else
cd "$EXAMPLE_DIR/android" || { echo "Failed to change to Android directory"; exit 1; }
chmod +x ./gradlew
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 134-134: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

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

In `@scripts/e2e-maestro.sh` at line 134, The cd command that changes into the
Android example directory (the line containing cd "$EXAMPLE_DIR/android") must
handle failure; update that invocation to check its exit status and abort with a
descriptive error message if it fails (for example, append a fallback that logs
the failure and exits or test the return code and exit 1). Mirror the same
failure-handling approach used for the iOS cd path so the script does not
continue when the directory change fails.

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.

Caution

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

⚠️ Outside diff range comments (2)
.github/workflows/ci-packages.yml (2)

28-30: ⚠️ Potential issue | 🟠 Major

Reduce global workflow token privileges.

contents: write at workflow scope is broader than required for this pipeline and increases blast radius. Prefer least-privilege defaults and elevate only where strictly needed.

Suggested hardening
 permissions:
-    contents: write
-    actions: write
+    contents: read
+    actions: write
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci-packages.yml around lines 28 - 30, The workflow grants
overly broad repository token scopes via the permissions block (permissions:
contents: write and actions: write); change contents: write to contents: read to
follow least-privilege, and remove or downgrade actions: write to the minimum
required (or omit it at workflow scope and elevate to specific job-level
permissions only where a job needs write access). Update the permissions
declaration (referencing the permissions keys "contents" and "actions") so the
default workflow token is read-only for contents and only grants write at the
narrowest scope when strictly necessary.

220-246: ⚠️ Potential issue | 🟠 Major

Use the same Yarn setup path in generation as in build/test jobs.

The generate-packages job gates Node setup for Yarn (line 220) but omits the shared .github/actions/setup-yarn action used in other jobs. When matrix.pm == 'yarn', this skips Yarn v4.6.0 configuration, causing version drift between generate and test phases.

Suggested fix
            - name: Setup Node.js
              if: matrix.pm == 'yarn'
              uses: actions/setup-node@v6
              with:
                  node-version: 22.x

+           - name: Setup Yarn
+             if: matrix.pm == 'yarn'
+             uses: ./.github/actions/setup-yarn
+             with:
+                 working-directory: ${{ github.workspace }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci-packages.yml around lines 220 - 246, The
generate-packages job currently sets up Node.js when matrix.pm == 'yarn' but
omits the shared setup action used elsewhere; update the workflow so that the
conditional Yarn branch uses the same .github/actions/setup-yarn action (the
same invocation used in build/test jobs) before or instead of the Setup Node.js
step to ensure Yarn v4.6.0 is installed and configured; locate the conditional
step labeled "Setup Node.js" (and the subsequent "Setup Bun.js"/"Install
repository dependencies"/"Build CLI and Link Locally" sequence) and replace or
augment it to call the shared setup-yarn action when matrix.pm == 'yarn',
preserving existing node-version and any matrix conditions.
🧹 Nitpick comments (1)
scripts/e2e-maestro.sh (1)

37-39: Consider validating EXAMPLE_DIR before deriving identifiers.

If EXAMPLE_DIR is empty or invalid, the cd in the subshell fails silently, causing PACKAGE_ROOT_NAME to become . (current directory name), which would produce incorrect PACKAGE_NAME and APP_ID values. This could lead to confusing failures later in the script.

🛡️ Proposed fix to validate EXAMPLE_DIR early
 EXAMPLE_DIR=${2:-}
 PACKAGE_TYPE=${3:-}
 
+if [ -z "$EXAMPLE_DIR" ] || [ ! -d "$EXAMPLE_DIR" ]; then
+    echo "Error! EXAMPLE_DIR is not set or does not exist: $EXAMPLE_DIR"
+    exit 1
+fi
+
 echo "🚀 Running e2e video recording for $PLATFORM"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/e2e-maestro.sh` around lines 37 - 39, Validate EXAMPLE_DIR before
using it: check that EXAMPLE_DIR is non-empty and points to an existing
directory (e.g., test -n "$EXAMPLE_DIR" && [ -d "$EXAMPLE_DIR" ]), and if not,
print a clear error and exit early; then derive PACKAGE_ROOT_NAME, PACKAGE_NAME,
and APP_ID only after the validation succeeds so the subshell cd and basename
calls cannot silently return "." and produce incorrect identifiers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/ci-packages.yml:
- Around line 28-30: The workflow grants overly broad repository token scopes
via the permissions block (permissions: contents: write and actions: write);
change contents: write to contents: read to follow least-privilege, and remove
or downgrade actions: write to the minimum required (or omit it at workflow
scope and elevate to specific job-level permissions only where a job needs write
access). Update the permissions declaration (referencing the permissions keys
"contents" and "actions") so the default workflow token is read-only for
contents and only grants write at the narrowest scope when strictly necessary.
- Around line 220-246: The generate-packages job currently sets up Node.js when
matrix.pm == 'yarn' but omits the shared setup action used elsewhere; update the
workflow so that the conditional Yarn branch uses the same
.github/actions/setup-yarn action (the same invocation used in build/test jobs)
before or instead of the Setup Node.js step to ensure Yarn v4.6.0 is installed
and configured; locate the conditional step labeled "Setup Node.js" (and the
subsequent "Setup Bun.js"/"Install repository dependencies"/"Build CLI and Link
Locally" sequence) and replace or augment it to call the shared setup-yarn
action when matrix.pm == 'yarn', preserving existing node-version and any matrix
conditions.

---

Nitpick comments:
In `@scripts/e2e-maestro.sh`:
- Around line 37-39: Validate EXAMPLE_DIR before using it: check that
EXAMPLE_DIR is non-empty and points to an existing directory (e.g., test -n
"$EXAMPLE_DIR" && [ -d "$EXAMPLE_DIR" ]), and if not, print a clear error and
exit early; then derive PACKAGE_ROOT_NAME, PACKAGE_NAME, and APP_ID only after
the validation succeeds so the subshell cd and basename calls cannot silently
return "." and produce incorrect identifiers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bc4cad9-aff3-457e-bd6c-ab6c0dc6e2ad

📥 Commits

Reviewing files that changed from the base of the PR and between 48c33f7 and 20f97f1.

📒 Files selected for processing (3)
  • .github/workflows/ci-packages.yml
  • e2e-tests/view.e2e.yaml
  • scripts/e2e-maestro.sh
✅ Files skipped from review due to trivial changes (1)
  • e2e-tests/view.e2e.yaml

@patrickkabwe patrickkabwe merged commit edaedfc into main Mar 16, 2026
83 checks passed
@patrickkabwe patrickkabwe deleted the feat/more-args branch March 16, 2026 10:26
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