feat: migrate workflows to TypeScript orchestration - #30
Draft
devagrawal09 wants to merge 3 commits into
Draft
devagrawal09 wants to merge 3 commits into
devagrawal09 wants to merge 3 commits into
Conversation
Replace the YAML/Butterflow workflows (workflow.yaml, transform.yaml,
codemod.yaml, the 41 per-rule scripts/ entrypoints, emit-report.ts, and
the codemod:workflow shared-state accumulation) with two inline
TypeScript workflows on @codemod.com/orchestration.
- workflows/analyze.ts defines each of the 37 named analyzers as its own
inline jssg() transform and awaits them as 37 sequential
workspace-semantic commands, in the former step order.
- workflows/transform.ts keeps the three deterministic rewrites as three
sequential commands so later rules see earlier output.
- shared/entrypoint.ts becomes a per-file adapter (analyzeFile,
transformFile) returning structured { content, output } results; it
is bundled into every artifact and imports nothing from the runtime.
- shared/workflow.ts holds the shared applicability globs, the
FileStrings output guard, and aggregateReport (flatten, exact-dedupe,
whole-string sort), matching the removed report emitter.
- shared/run-workflow.mjs no longer spawns the Codemod CLI: launch()
re-runs the module as a Node 24 workflow process with
--experimental-transform-types and shared/register-ts.mjs (a module
hook that strips types for .ts under node_modules), loads the workflow
through the orchestration build step, runs one BridgeExecutor per
command, forwards SIGINT/SIGTERM to cancel the command in flight, and
prints the returned guidance or report to stdout.
- The CLI gains a `transform` subcommand; `analyze` stays the default.
Usage/target errors exit 2, failed or cancelled commands exit 1, and
the launcher refuses to start without a bridge binary
(CODEMOD_BRIDGE_BIN or the linked checkout's target/debug build).
- package.json drops the pinned codemod CLI, links
@codemod.com/orchestration from the sibling checkout, requires Node
>=24, removes the YAML validate script, and typechecks both the
sandbox-side (tsconfig.json) and workflow-side
(tsconfig.workflows.json) programs.
- Tests cover the inline composition, launcher behavior, exact guidance,
cross-file semantic resolution, missing-bridge and failed-command
reporting, SIGINT cancellation, artifact bundling, scripted command
sequencing, transform idempotency, and the packed file list. The
benchmark generates inline workflow modules instead of YAML.
Publication blocker: @codemod.com/orchestration is private and
unpublished, the dependency is a relative link to the sibling codemod
checkout, and the execution bridge is not distributed. This version is
not publishable; both READMEs document the setup and the blocker.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The 37 analyzers only read the target and share nothing, so `workflows/analyze.ts` now declares all of them as one `parallel()` group instead of awaiting them one at a time. The group states only that the commands are eligible to overlap: the engine's weighted admission scheduler owns how many actually run, and this package declares no chunking, no concurrency level, no scheduler of its own, and no author-facing knob. Nothing observable changes. Commands are still issued in declaration order, `parallel()` returns one output per member in that order however the commands interleave, and `aggregateReport` still flattens, exact-deduplicates, and sorts as whole strings, so stdout stays byte-identical. The analyzers stay 37 separate JSSG commands, each a complete workspace-semantic pass over the whole selected file set, and the three mutating rewrites in `workflows/transform.ts` stay sequential because their order is a correctness property of the files they write. Because members overlap, a failure or cancellation now names whichever command reported first rather than a fixed one, and a cancelled member is either an admitted command whose bridge is killed or a queued one refused without spawning anything. The launcher tests pin everything around that name and accept either cancellation reason. Tests cover the group's declaration in the analyze body, all 37 outputs aggregating correctly under deterministic reverse-order completion, the scheduler's own peak accounting at a fixed capacity, and a real launcher run whose stand-in bridges must see a peer to finish and record the most they ever saw alive, which bounds real bridge concurrency without timing assertions. The benchmark now generates parallel groups so it keeps mirroring production, and reports the host capacity its numbers depend on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates Solid Migration Assistant from the YAML/Butterflow workflows (
workflow.yaml,transform.yaml,codemod.yaml, 41 per-rulescripts/entrypoints,emit-report.ts, andcodemod:workflowshared state) to two inline TypeScript orchestration workflows on@codemod.com/orchestration.workflows/analyze.ts: each of the 37 named analyzers is its own inlinejssg()definition, awaited as its own sequential workspace-semantic command, in the order the YAML workflow ran its steps.workflows/transform.ts: the three deterministic rewrites stay three separate sequential commands, so later rules see earlier output.shared/entrypoint.tsis now a per-file adapter (analyzeFile/transformFile) returning structured{ content, output }results instead of accumulating into workflow state under a lock. It is bundled into every transform artifact and imports nothing from the runtime.shared/workflow.tsholds the shared include/exclude globs, theFileStringsoutput guard, andaggregateReport, which flattens, exact-deduplicates, and sorts each command's per-file strings exactly as the removed report emitter did.shared/run-workflow.mjsno longer spawns the Codemod CLI.launch()re-runs the module as a Node 24 workflow process (--experimental-transform-typesplusshared/register-ts.mjs, a module hook that strips types for.tsundernode_modules), loads the workflow through the orchestration build step, and runs it with oneBridgeExecutorper command.SIGINT/SIGTERMare forwarded and cancel the command in flight.Behavior changes
transformsubcommand:solid-migration-assistant [analyze|transform] [--target <dir>].analyzeremains the default.references()resolution, analyzer immutability, and transform idempotency are unchanged and covered by the same fixtures.>=24.0.0(needed forregisterHooks/stripTypeScriptTypesand type transformation).pnpm validate(YAML schema validation) is gone;check-typesnow typechecks both the sandbox-side program (tsconfig.json) and the workflow-side program (tsconfig.workflows.json).Validation
pnpm verifypasses fromcodemods/solid-migration-assistant(Node v24.18.0, pnpm 11.20.0):jssg run)tsc --noEmitfor both programsgit diff --checkThe packaging test packs the tarball, extracts it by hand into a consumer's
node_modules, links the orchestration prototype in, and runs the analyzer twice from that layout with pnpm offPATH.Publication blocker
This version is not publishable, and this PR does not claim npm publish readiness.
@codemod.com/orchestrationisprivate: trueand unpublished. The committed dependency is a relative link to a sibling checkout:"@codemod.com/orchestration": "link:../../../codemod/packages/orchestration"(the codemod monorepo on itsprototype/typescript-orchestrationbranch, at97a3695).butterflow-execution-bridge) is not distributed; the launcher resolves it from that checkout'starget/debug/or fromCODEMOD_BRIDGE_BIN.link:dependency, sonpm installof the packed tarball fails. Both READMEs document this and the local setup steps.Not in scope
jssg runtests.🤖 Generated with Claude Code