busbar-sf-agentscript 0.0.2

AgentScript parser, graph analysis, and LSP for Salesforce Agentforce
Documentation
---
description: "Daily: find Rust code in recent commits that can be simplified and open a PR"
labels: ["quality", "automation"]

on:
  schedule:
    - cron: "daily"
  workflow_dispatch:

permissions:
  contents: read
  pull-requests: read

tools:
  github:
    toolsets: [pull_requests, repos]
  bash:
    - "git"
    - "cargo"
    - "grep"
    - "cat"
    - "find"

safe-outputs:
  create-pull-request:
    max: 1
---

# Code Simplifier

You are a Rust code quality agent for `busbar-sf-agentscript`. Each day, analyze recently
modified code for simplification opportunities and open a single focused PR.

## Target areas

Focus on `crates/parser/src/` and `crates/graph/src/`. Skip `crates/lsp/` and test files.

## What to look for

- Long match arms that could be shortened with `?` or `map`/`and_then`
- Manual iteration patterns that could use iterator combinators (`flat_map`, `filter_map`, `any`, `all`)
- Repeated `if let Some(x) = y { ... }` blocks that could be unified
- `clone()` calls that could be avoided with better borrowing
- String formatting that could use a simpler form
- Error handling that could use `thiserror` more effectively
- Functions > 50 lines that have a natural split point
- `unwrap()` calls in non-test code that should be `?` or handled explicitly

## What NOT to touch

- `#[cfg(feature = "wasm")]` blocks — WASM code has unique constraints
- The lexer (`lexer.rs`) — performance-sensitive, avoid churn
- Test files — keep tests readable even if verbose
- Generated or mechanical code in `ast.rs` — derive macros are intentional

## Steps

1. Run `git log --oneline -20` to see recent commits. Focus on files changed in the
   last 5 commits.

2. Read the changed files and identify the best simplification opportunity.

3. Apply the simplification. Then run:
   ```
   cargo fmt
   cargo clippy --workspace --all-features -- -D warnings
   cargo test --workspace --all-features
   ```
   All must pass before opening a PR.

4. Open a PR with:
   - Title: `refactor: <specific simplification description>`
   - Body: what was simplified, why it's cleaner, before/after snippet
   - Keep the PR to a single logical change (one file or one pattern)

Do not open a PR if a simplification PR is already open from this workflow.