Skip to main content

Your First Workflow

JJHub workflows are TypeScript files stored in your repository under .jjhub/workflows/.

Create a Workflow File

// .jjhub/workflows/ci.ts
import { defineWorkflow, on, run } from "@jjhub/workflow";

export default defineWorkflow({
  name: "CI",
  triggers: [on.push({ bookmarks: ["main"] }), on.landingRequest.opened()],
  steps: [
    run("test", async (ctx) => {
      await ctx.exec("bun test");
    }),
    run("build", async (ctx) => {
      await ctx.exec("bun run build");
    }),
  ],
});

Trigger a Run

Workflows run automatically on configured events (push, landing request opened, etc.). To manually trigger a workflow:
jjhub workflow run <workflow-id> --ref main

View Runs

# List runs for a workflow
jjhub run list <workflow-id>

# View a specific run
jjhub run view <run-id>

# Watch a run in real-time
jjhub run watch <run-id>

# Re-run a workflow
jjhub run rerun <run-id>

AI Agent Steps

Workflows can invoke AI agents as steps:
import { defineWorkflow, on, run, agent } from "@jjhub/workflow";

export default defineWorkflow({
  name: "Triage",
  triggers: [on.issue.opened()],
  steps: [
    agent("triage", async (ctx) => {
      await ctx.agent.run("Triage this issue and add appropriate labels");
    }),
  ],
});
You can also interact with agents directly from the CLI:
# Start an agent session
jjhub agent run "Triage any new issues and add labels" --repo username/my-project

# List agent sessions
jjhub agent list

# View a session
jjhub agent view <session-id> --messages

# Send a follow-up message to an existing session
jjhub agent chat <session-id> "Also check for duplicates"

Next Steps