javascript-refactoring
SKILL.md
JavaScript Code Refactoring Guide
This guide explains how to refactor JavaScript code into a separate .cjs file in the gh-aw repository. Follow these steps when extracting shared functionality or creating new JavaScript modules.
Overview
The gh-aw project uses CommonJS modules (.cjs files) for JavaScript code that runs in GitHub Actions workflows. These files are:
- Embedded in the Go binary using
//go:embeddirectives - Bundled using a custom JavaScript bundler that inlines local
require()calls - Executed in GitHub Actions using
actions/github-script@v8
Top-Level Script Pattern
Top-level .cjs scripts (those that are executed directly in workflows) follow a specific pattern: