This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
ghats is a TypeScript library for defining GitHub Actions workflows using TypeScript instead of YAML. It allows developers to write workflows with type safety and autocompletion, then compile them to standard GitHub Actions YAML files.
bun install- Install dependenciesbun run lint- Run Biome linter with error-on-warnings flagbun run fmt- Format code with Biome (auto-fix mode)bun test- Run testsbun test --coverage- Run tests with coverage reporting
bun run build:package- Build the package (runs tasks/build.ts)bun run gha:build- Build GitHub Actions workflows from TypeScript files
ghats install [actions...]orbun run gha:install- Install and generate type definitions for GitHub Actionsghats build [workflows...]orbun run gha:build- Build workflow YAML files from TypeScriptghats cache clear- Clear the action cache
- When testing workflow generation, create an example TypeScript workflow and use
bun run ./lib/cli/index.ts buildto compile it
-
package/: Core workflow definition classes
workflow.ts: Main Workflow class for defining GitHub Actions workflowsjob.ts: Job class supporting both normal jobs and reusable workflow callsstep.ts,on.ts,permissions.ts, etc.: Type definitions for workflow components
-
internal/: JSON serialization and transformation logic
- Each component has a corresponding internal module that handles conversion to YAML-compatible JSON
-
cli/: Command-line interface implementation
commands/build/: Compiles TypeScript workflows to YAMLcommands/install/: Fetches action schemas and generates TypeScript type definitions- Stores action metadata in
.github/workflows/actions.jsonandactions-lock.json
-
Builder Pattern: Jobs and workflows use method chaining for configuration
new Job("test", { runsOn: "ubuntu-latest" }) .uses("actions/checkout@v4") .run("npm test")
-
Type-Safe Actions: The
action()function provides typed inputs for installed actions- Action schemas are fetched from GitHub and stored locally
- TypeScript definitions are generated in
.github/workflows/actions.d.ts
-
File Conventions:
- Workflow TypeScript files in
.github/workflows/*.tsare compiled to*.yml - Files starting with
_(e.g.,_helpers.ts) are ignored during build
- Workflow TypeScript files in
The project uses Bun as its runtime and build tool:
tasks/build.ts: Custom build script that:- Generates TypeScript declarations using oxc-transform
- Builds CLI entry point with Node target
- Builds library with external packages
- Linter: Biome with strict configuration (must pass with --error-on-warnings)
- Formatter: Biome with 2-space indentation and double quotes
- TypeScript: Strict mode enabled with ESNext target
- Pre-commit: Husky hooks configured (run with
huskyprepare script)