Skip to content
Color theme

Git Examples

Git and GitHub workflow examples for the Loopstack automation framework.

Two workflow examples that show how to compose git tools and integrate with GitHub.

Use in Your App

Copy this directory into your app, then install what it imports:

Terminal window
npm install @loopstack/common @loopstack/git @loopstack/github-integration @loopstack/remote-client

Register the module:

import { Module } from '@nestjs/common';
import { LoopstackModule } from '@loopstack/loopstack-module';
import { GitExamplesModule } from './git/git-examples.module';
@Module({
imports: [LoopstackModule.forRoot(), GitExamplesModule],
})
export class AppModule {}

Required app-module configuration

Both examples invoke git tools that execute on a remote agent, so the workspace needs a connected sandbox environment. GitExamplesModule declares the slot via RemoteClientModule.forFeature(...), but the consumer must register at least one matching environment in their root module via RemoteClientModule.forRoot(...):

import { Module } from '@nestjs/common';
import { LoopstackModule } from '@loopstack/loopstack-module';
import { RemoteClientModule } from '@loopstack/remote-client';
import { GitExamplesModule } from './git/git-examples.module';
@Module({
imports: [
LoopstackModule.forRoot(),
RemoteClientModule.forRoot({
environments: {
available: [
{
type: 'sandbox',
name: 'Local Remote Server',
connectionUrl: process.env.SANDBOX_URL ?? 'http://localhost:3080',
agentUrl: process.env.SANDBOX_AGENT_URL ?? 'http://localhost:3001',
local: true,
},
],
},
}),
GitExamplesModule,
],
})
export class AppModule {}

The type: 'sandbox' must match the slot type declared by GitExamplesModule. The simplest remote agent option is @loopstack/remote-server on localhost:3001.

GitExamplesModule re-imports GitModule.forFeature() and GitHubIntegrationModule, which transitively brings in the global OAuthModule and the GitHub OAuth provider — no additional OAuth wiring required in your AppModule. You just need to set the GitHub OAuth client env vars (see Environment below).

Environment

The repo-sync example requires GitHub OAuth credentials:

Terminal window
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...

Examples

Example Studio title Description
Git Commit Flow Git - Commit Flow Example Scripted multi-tool git workflow — status → add → commit → log, no LLM
GitHub Repo Sync Git - GitHub Repo Sync Example Launches ConnectGitHubWorkflow for the full repo sync flow

Git Commit Flow

A scripted workflow that orchestrates four git tools in sequence: gitStatus, gitAdd, gitCommit, gitLog. No LLM involved — demonstrates composing tools deterministically.

Files

  • git-commit-flow-example.workflow.ts — workflow class

GitHub Repo Sync

Thin wrapper that launches ConnectGitHubWorkflow from @loopstack/github-integration as a sub-workflow. The integration handles the full sync flow: OAuth → create or pick repo → check uncommitted changes → resolve divergence → push.

For examples of the GitHub API tools (repos, issues, PRs, actions, search), see github.

Files

  • github-repo-sync-example.workflow.ts — workflow class

About

Author: Jakob Klippel

License: MIT