Skip to content

feat: Merge butterflow into codemod #1535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 80 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
0f9c882
Initial commit
mohebifar Mar 8, 2025
1514e91
test: Add unit tests
mohebifar Mar 8, 2025
cf5bdb4
ci: basic CI for tests, formatting, and linting (#1)
ribru17 Apr 14, 2025
3357c8e
feat: workflow schema generation (#2)
ribru17 Apr 14, 2025
b723173
refactor: remove unused, duplicate struct definitions (#3)
ribru17 Apr 15, 2025
d208da1
refactor: remove redundant Task constructor (#4)
ribru17 Apr 15, 2025
2d1dadf
feat: support global outputs (#5)
ribru17 Apr 17, 2025
d80e52e
fix: fetch updated state after each step (#6)
ribru17 Apr 17, 2025
e1cba28
feat: support workflow & template parameters
ribru17 Apr 17, 2025
3e9380a
refactor: unify step action handling by introducing StepAction enum
mohebifar Apr 17, 2025
16e49b1
chore: Update the workflow JSON schema to use the `oneOf` type for `u…
mohebifar Apr 17, 2025
f9f1247
ci: check for uncommitted schema changes (#9)
ribru17 Apr 18, 2025
95b03c3
refactor: remove redundant trigger field (#11)
ribru17 Apr 18, 2025
97b54c6
Revert "refactor: remove redundant trigger field (#11)" (#12)
ribru17 Apr 18, 2025
c8c3d3d
refactor!: change `uses` from vector -> scalar (#14)
ribru17 Apr 18, 2025
303c432
fix: don't attempt to run master tasks (#15)
ribru17 Apr 18, 2025
fa66db8
refactor: remove unnecessary id, description fields of `step` (#13)
ribru17 Apr 18, 2025
2b82797
feat: Generate TypeScript types with ts-rs
mohebifar Apr 19, 2025
ce77cae
chore: Mark files in schemas/ as generated
mohebifar Apr 19, 2025
87d9394
Merge pull request #16 from codemod-com/ts_types
mohebifar Apr 19, 2025
ccaf593
refactor: Separate state-adapters
mohebifar Apr 19, 2025
b61e174
feat: Matrix task recompilation
mohebifar Apr 19, 2025
2e94744
refactor: Separate scheduler from core
mohebifar Apr 19, 2025
5c95371
feat: Scheduler WASM
mohebifar Apr 20, 2025
f090bae
Merge pull request #19 from codemod-com/feat/scheduler-wasm
mohebifar Apr 20, 2025
1ad38f0
Merge pull request #18 from codemod-com/refactor/separate-scheduler
mohebifar Apr 20, 2025
b05b604
chore: Make the scheduler npm package public
mohebifar Apr 20, 2025
4d2d91e
refactor: Change the matrix values from string to serde_json::Value
mohebifar Apr 20, 2025
995c101
fix: Improve generated TypeScript types
mohebifar Apr 22, 2025
e3fdd2e
feat: Cloud state adapter
mohebifar Apr 22, 2025
131ffcf
refactor: Separate runners' files
mohebifar Apr 29, 2025
ad15b98
feat: Ability to run workflows by directory
mohebifar May 6, 2025
be6a5c2
fix: Fix tests and cargo fmt
mohebifar May 6, 2025
88ac880
Merge pull request #17 from codemod-com/refactor/state-adapters
mohebifar May 6, 2025
70d3e39
feat: Add release workflow
mohebifar May 6, 2025
4afa975
chore: Fix CLI output path
mohebifar May 6, 2025
af214e0
chore: Initialize CHANGELOG
mohebifar May 6, 2025
b9df906
chore: unignore cargo.lock
mohebifar May 6, 2025
86c213d
chore(bump): Bump version 0.1.0
mohebifar May 6, 2025
450f64f
chore: Support linux ARM builds
mohebifar May 7, 2025
f9584a4
fix: Fix ARM builds libssl error
mohebifar May 7, 2025
d4f57c2
chore: Another attempt to fix arm64 builds
mohebifar May 7, 2025
8507787
chore(bump): Bump version 0.1.0
mohebifar May 7, 2025
58b45f1
feat: initialize quickjs
mohebifar May 22, 2025
5ba48b5
feat(codemod-sandbox): TypeScript compilation
mohebifar May 24, 2025
cd56647
chore: Upgrade ast-grep to 0.38.2
mohebifar May 25, 2025
c7fb491
fix: Fix the heap allocation issue and node.js env
mohebifar May 26, 2025
c57c8f5
fix: Fix lint errors and build features
mohebifar May 26, 2025
abb1b12
Merge pull request #21 from codemod-com/feat/quickjs
mohebifar May 26, 2025
efe6cf2
feat: Convert quickjs value to wasm JsValue instead of JSON stringifi…
mohebifar May 31, 2025
c3e22ef
feat: Support native env with filesystem module resolution
mohebifar Jun 5, 2025
5b94f09
refactor: Refactor CLI separating command logics and group workflow c…
mohebifar Jun 5, 2025
d105be7
chore: Fix CI
mohebifar Jun 5, 2025
036b6ce
Merge pull request #23 from codemod-com/refactor/CLI
mohebifar Jun 5, 2025
1050e7f
fix(codemod-sandbox): Use ignore's WalkParallel
mohebifar Jun 6, 2025
1408aa4
Merge pull request #22 from codemod-com/feat/codemod-sandbox-native
mohebifar Jun 6, 2025
2b95ff5
feat: codemod sandbox performing transform and write to target file
mohebifar Jun 7, 2025
9fe49e2
feat: transpile typescript using SWC
mohebifar Jun 7, 2025
b8a19bd
feat(cli): Add jssg (js ast-grep) command to butterflow cli
mohebifar Jun 7, 2025
8adb9a0
fix: Fix releasing butterflow CLI
mohebifar Jun 7, 2025
406c4b4
chore(release): pull submodules in release workflow
mohebifar Jun 7, 2025
413af50
refactor: separate js source from rust
mohebifar Jun 7, 2025
d5af275
chore: temporarily disable windows builds due to quickjs error
mohebifar Jun 7, 2025
29d2d40
feat: report stats of codemod run
mohebifar Jun 7, 2025
abdd08b
chore: Remove dist
mohebifar Jun 7, 2025
6b1f502
fix: Fix the WASM build
mohebifar Jun 8, 2025
39f6dbc
fix: Fix WASI lint errors
mohebifar Jun 8, 2025
8fe28af
chore: Fix cargo fmt
mohebifar Jun 8, 2025
8d94a85
chore: release codesign without --timestamp
mohebifar Jun 8, 2025
181fbaa
chore: Rename butterflow-cli to codemode
mohebifar Jun 8, 2025
e8a1a77
chore: update package versions to 0.1.1 and adjust workspace dependen…
mohebifar Jun 8, 2025
740e8be
chore: another attempt at fixing mac build notarization
mohebifar Jun 9, 2025
8050e7b
chore: rename butterflow-cli to codemod in github actions release wor…
mohebifar Jun 9, 2025
f8adcc4
chore: install coreutils in release pipeline
mohebifar Jun 9, 2025
a5454e6
chore: disable codemod build for arm64
mohebifar Jun 9, 2025
f69611a
chore: fix changelog generation on github actions
mohebifar Jun 9, 2025
0c27a72
chore(bump): Bump version 0.2.0
mohebifar Jun 9, 2025
d54c336
Merge remote-tracking branch 'butterflow/main' into feat/butterflow
mohebifar Jun 12, 2025
f84bb1c
chore: Update workflow.json
mohebifar Jun 12, 2025
9fac1cb
fix: Fix tests failing in CI
mohebifar Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set all files in schemas/ directory as generated
schemas/* linguist-generated=true
258 changes: 258 additions & 0 deletions .github/workflows/cargo-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- main

jobs:
paths-filter:
name: Check for crates changes
runs-on: ubuntu-22.04
outputs:
crates: ${{ steps.filter.outputs.crates }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
crates:
- 'crates/**'

build:
name: Build Release
needs: paths-filter
if: always() && needs.paths-filter.outputs.crates == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
binary_name: butterflow-linux-x86_64
# - os: self-hosted
# target: aarch64-unknown-linux-gnu
# binary_name: butterflow-linux-aarch64
- os: macos-latest
target: aarch64-apple-darwin
binary_name: butterflow-darwin-aarch64
- os: macos-latest
target: x86_64-apple-darwin
binary_name: butterflow-darwin-x86_64
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# binary_name: butterflow-windows-x86_64.exe
# - os: windows-latest
# target: i686-pc-windows-msvc
# binary_name: butterflow-windows-i686.exe
# - os: windows-latest
# target: aarch64-pc-windows-msvc
# binary_name: butterflow-windows-aarch64.exe

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Get Binary Path
id: binary_path
shell: bash
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
echo "path=target/${{ matrix.target }}/release/codemod.exe" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "path=target/${{ matrix.target }}/release/codemod" >> "$GITHUB_OUTPUT"

- name: Cache Cargo
uses: Swatinem/rust-cache@v2

- name: Install dependencies (Linux only)
if: matrix.os == 'ubuntu-22.04' || (matrix.os == 'self-hosted' && matrix.target == 'aarch64-unknown-linux-gnu')
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libssl-dev

- name: Install GNU coreutils (macOS only)
if: matrix.os == 'macos-latest'
run: brew install coreutils

- name: Import Code Signing Certificate (macOS only)
if: matrix.os == 'macos-latest'
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}

- name: Build
run: |
cargo build --release -p codemod --target ${{ matrix.target }}

- name: Chmod binary
run: |
chmod 755 ${{ steps.binary_path.outputs.path }}

- name: Sign Binary (macOS only)
if: matrix.os == 'macos-latest'
env:
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
# Set timeout for codesign (5 minutes)
timeout 300 codesign \
--force \
--timestamp \
--sign "$APPLE_IDENTITY" \
--team-id "$APPLE_TEAM_ID" \
--options runtime \
--verbose \
${{ steps.binary_path.outputs.path }}

- name: Verify Signing (macOS only)
if: matrix.os == 'macos-latest'
run: |
codesign --verify --deep --verbose=4 ${{ steps.binary_path.outputs.path }}

- name: Create ZIP for Notarization (macOS only)
if: matrix.os == 'macos-latest'
run: zip -r binary.zip ${{ steps.binary_path.outputs.path }}

- name: Submit for Notarization (macOS only)
if: matrix.os == 'macos-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
# Set timeout for notarization (15 minutes)
timeout 900 xcrun notarytool submit binary.zip \
--apple-id "$APPLE_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
--team-id "$APPLE_TEAM_ID" \
--wait \
--verbose

# - name: Staple Notarization (macOS only)
# if: matrix.os == 'macos-latest'
# run: xcrun stapler staple -v ${{ steps.binary_path.outputs.path }}

- name: Rename binary (Non-Windows)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
mv codemod ${{ matrix.binary_name }}

- name: Rename binary (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
mv codemod.exe ${{ matrix.binary_name }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}

changelog:
name: Generate Changelog
runs-on: ubuntu-22.04
needs: build
# if changes to the crates directory
outputs:
version: ${{ steps.git-cliff.outputs.version }}
changelog: ${{ steps.git-cliff.outputs.content }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
submodules: recursive

- name: Back up CHANGELOG.md
run: cp CHANGELOG.md CHANGELOG.md.bak

- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v1

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: cliff.toml
args: --unreleased --bump
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Restore CHANGELOG.md
run: |
# Remove the starting "# Changelog" section from the backup
sed -i '/^# Changelog$/,$!d' CHANGELOG.md.bak
cat CHANGELOG.md.bak >> CHANGELOG.md
rm CHANGELOG.md.bak

- name: Update version in Cargo.toml
shell: bash
run: |
version=$(echo "${{ steps.git-cliff.outputs.version }}" | sed 's/v//g')

sed "s/^version = \".*\"\$/version = \"$version\"/" ./Cargo.toml > /tmp/cargo.toml
mv /tmp/cargo.toml ./Cargo.toml

- name: Cache Cargo
uses: Swatinem/rust-cache@v2

- name: Re-generate Cargo.lock
run: cargo generate-lockfile

- name: Update Changelog
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref }}
commit_message: "chore(bump): Bump version ${{ steps.git-cliff.outputs.version }}"
file_pattern: "CHANGELOG.md Cargo.toml Cargo.lock"

- name: Create tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${{ steps.git-cliff.outputs.version }}`,
sha: context.sha
})

create_release:
name: Create Release
needs: changelog
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
body: ${{ needs.changelog.outputs.changelog }}
tag_name: ${{ needs.changelog.outputs.version }}
files: |
x86_64-unknown-linux-gnu/*
aarch64-apple-darwin/*
x86_64-apple-darwin/*
x86_64-pc-windows-msvc/*
i686-pc-windows-msvc/*
aarch64-pc-windows-msvc/*
aarch64-unknown-linux-gnu/*
generate_release_notes: true
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: NPM Release

on:
push:
Expand All @@ -9,7 +9,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
name: NPM Release
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
Expand All @@ -33,4 +33,4 @@ jobs:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68 changes: 68 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read

env:
TEST_PACKAGES: -p codemod -p codemod-sandbox -p butterflow-core -p butterflow-models -p butterflow-runners -p butterflow-scheduler -p butterflow-state

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
id: toolchain
with:
components: clippy
- run: cargo clippy --tests --no-deps ${{ env.TEST_PACKAGES }} -- -D warnings

format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
id: toolchain
with:
components: rustfmt
- run: cargo fmt --check

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
id: toolchain
- name: Run tests
run: cargo test ${{ env.TEST_PACKAGES }}
- name: Check schema generation
run: |
# Generate schema
cargo xtask schema
# Check for uncommitted changes (excluding schemas/workflow.ts)
if [[ -n "$(git status --porcelain)" ]]; then
echo '❌ Uncommitted changes detected after running `cargo xtask schema`:'
git --no-pager diff -- .
exit 1
else
echo "✅ No changes — schema is up to date."
fi
Loading
Loading