Automation orchestration
Automation orchestration is the set of command-line and GitHub Action entrypoints that turns a repository path into an AgentShield security analysis run. Both entrypoints share the scanner and result model, then send the outcome to reports, policy and drift checks, supply-chain checks, evidence bundles, or optional deeper analysis.
Orchestration model
The system accepts repository material through one of two automation boundaries. The command line is suited to local use and exposes the full scan lifecycle. The GitHub Action adapts the same work to a workflow by reading action inputs and publishing annotations, outputs, summaries, files, and a job status.
This diagram shows how both entrypoints converge on one scan and then split into optional checks and delivery paths.
flowchart LR
R[Repository path] --> E{Automation entrypoint}
E --> C[agentshield scan]
E --> A[GitHub Action]
C --> S[Static scan]
A --> S
S --> F[Severity-filtered findings]
F --> Q[Score and security report]
Q --> O[Optional analysis and governance]
O --> P[Policy, baseline, supply-chain, evidence, or deeper analysis]
Q --> D[Reports and status]
P --> D
D --> X[Files, summaries, outputs, and exit status]
Analysis run
An analysis run starts by resolving a target path and checking that it exists. The scanner discovers analyzable configuration files, applies the built-in security rules, adds related scan summaries, and returns a ScanResult; the orchestration layer then turns that result into a scored SecurityReport. This keeps repository discovery and security checks below the automation boundary while allowing each entrypoint to choose its own delivery and failure rules.
References: src/index.ts• L318-379 src/action.ts• L133-193 src/…/index.ts• L17-34
Automation entrypoints
The command entrypoint is the agentshield program exposed by src/index.ts and built as dist/index.js. Its scan command can run static analysis, optional active checks, governance checks, evidence creation, and deeper analysis in one local process. The action entrypoint is dist/action.js; action.yml maps workflow inputs to that process and makes the repository workspace the path base.
The two entrypoints are related but are not interchangeable configuration surfaces:
| Boundary | Main input | Main delivery | Main control signal |
|---|---|---|---|
| Command line | Flags on agentshield scan | Terminal or report files | Process exit code |
| GitHub Action | with: values declared in action.yml | Annotations, job summary, outputs, and optional SARIF or evidence files | Action failure status |
The detailed action modes are described in GitHub Action entrypoints. The optional AI stage is described in Opus analysis orchestration.
References: package.json• L7-34 src/index.ts• L209-297 action.yml• L1-25 action.yml• L153-155 src/action.ts• L1-7
Shared analysis contracts
The shared types define the handoff between repository analysis and automation. They give both entrypoints the same vocabulary for findings, targets, reports, optional analysis results, and scan logs without forcing the command and action to use the same presentation.
Scan and report data
ScanTarget represents the path and discovered configuration files that form the input to analysis. A Finding carries a stable identifier, severity, category, location, evidence, and an optional safe fix. A SecurityReport adds the score and severity counts that automation uses for display and gates.
This contract lets downstream systems compare findings or route them to a policy without re-reading repository files. It also keeps the source confidence of a finding available when repository examples or plugin content need different treatment from active configuration.
References: src/types.ts• L15-29 src/types.ts• L60-84 src/types.ts• L100-110 src/types.ts• L112-162
Optional result boundaries
Optional capabilities attach their results to the scan flow instead of replacing the static report. Baseline comparison describes change from an accepted result. Policy evaluation describes organizational compliance. Supply-chain verification describes package risk. Evidence packs combine these results for audit handoff. Deeper analysis adds taint, injection, sandbox, corpus, or AI results when the command enables those modes.
The command and action can enable these capabilities at different points, but they pass the same broad report and finding data into them. This is the main boundary to preserve when a new analysis mode is added: the static result remains useful even when an optional stage is not requested or cannot complete.
References: src/types.ts• L202-221 src/types.ts• L352-469 src/action.ts• L244-251 src/index.ts• L334-387 src/index.ts• L459-513
Configuration boundaries
Configuration enters the system at the automation boundary and is resolved before analysis begins. The repository path selects the material to inspect. Severity and feature controls decide which results are visible or which optional stages run. Gate controls decide whether a result changes the status of the run.
Command configuration
The scan command uses local flags for the target path, output format, severity filter, external rule packs, optional analysis, baseline and policy inputs, compliance mapping, remediation, evidence output, and gate behavior. The --deep flag is a group control that enables taint, injection, sandbox, and Opus analysis together. The command reports the primary scan through the selected renderer, then runs requested supporting stages in a defined lifecycle.
The command uses info as its default minimum severity. It normally exits non-zero for critical findings, while explicit policy, baseline, corpus, or supply-chain gates can add their own failure conditions. This makes local use useful for inspection without making every finding an automatic process failure.
References: src/index.ts• L281-317 src/index.ts• L305-317 src/index.ts• L329-364 src/index.ts• L516-665
Action configuration
The action exposes workflow-safe inputs for path, severity, failure on findings, format, baseline, policy, supply-chain checks, evidence packs, and policy promotion. action.yml is the public contract: its input names and defaults must match the values read by the action process. The action resolves relative paths from GITHUB_WORKSPACE and uses GITHUB_OUTPUT and GITHUB_STEP_SUMMARY when the runner provides them.
The action defaults to a medium minimum severity, fails when findings exist, and requests offline supply-chain verification. It publishes scores and counts even when a later optional check fails. This gives dependent workflow steps machine-readable state while preserving the action status as the final enforcement signal.
References: action.yml• L9-85 action.yml• L87-151 src/action.ts• L48-69 src/action.ts• L135-180 src/action.ts• L195-243
Configuration ownership
Each configuration class has one clear owner at the boundary:
| Configuration | Owner | Effect on the run |
|---|---|---|
| Target path | Command flag or action path input | Selects the repository material to scan |
| Minimum severity | Command flag or action input | Filters findings before scoring and reporting |
| Policy file | Command --policy or action policy input | Adds a compliance decision and optional failure |
| Baseline file | Command --baseline or action baseline input | Adds drift counts and regression handling |
| External service key | Process environment | Allows the optional AI review |
| Output destination | Renderer flags or action output inputs | Selects human, machine, SARIF, or evidence delivery |
Repository configuration files remain analysis inputs. They do not control the automation gates. This separation prevents a scanned repository from changing how the workflow decides whether the run passes.
References: src/index.ts• L281-295 src/index.ts• L349-387 src/index.ts• L441-465 src/action.ts• L136-161 src/…/pipeline.ts• L357-365
Run lifecycle
The lifecycle starts with a static result because all later checks need a common set of findings and a common score. Optional stages enrich or compare that result. Delivery then exposes the result to a person, a workflow step, or an audit process.
Static analysis stage
Both entrypoints resolve and validate the target before calling scan. The scanner discovers configuration files and runs the built-in rules across them. The command can add external rule packs to that scan. It then filters findings by minimum severity before it calculates the score, so the configured severity threshold affects the report and any gate that consumes that filtered report.
References: src/…/index.ts• L24-34 src/index.ts• L298-379 src/action.ts• L159-193
Enrichment and governance stages
After the static report, the run may perform active validation, automatic fixes, compliance mapping, policy evaluation, remediation planning, baseline comparison, supply-chain verification, evidence creation, and deeper analysis. The action supports policy promotion, policy evaluation, supply-chain verification, baseline comparison, evidence creation, and package-manager hardening summaries. These stages produce separate status signals so a report can distinguish a security finding from a policy failure, drift regression, package risk, evidence error, or unavailable optional analysis.
The Opus pipeline is a child system rather than part of the core static scan. When enabled, it receives the scan result and returns a separate assessment. Read Opus analysis orchestration for its role stages and model result contract.
References: src/index.ts• L334-513 src/index.ts• L520-733 src/action.ts• L254-372 src/action.ts• L402-531
Delivery and gate stage
The command sends a primary report to the terminal or a selected file. It uses exit codes to tell a shell or CI wrapper whether a path, gate, or finding caused failure. The action sends finding annotations to the workflow, writes a Markdown job summary, sets named outputs, and can write SARIF or an evidence pack. It evaluates policy, promotion, baseline, and supply-chain gates before applying the final finding gate.
This ordering matters because a workflow can consume outputs such as score, grade, baseline status, policy status, supply-chain status, and evidence digest even when the final action status is failed. The outputs describe what happened; the exit status enforces the configured decision.
References: src/index.ts• L389-410 src/index.ts• L456-465 src/index.ts• L623-747 src/action.ts• L374-400 src/action.ts• L451-559
Related pages
- GitHub Action entrypoints explains the primary action and its specialized baseline, hardening, policy, promotion, and supply-chain modes.
- Opus analysis orchestration explains the prompts, role stages, structured results, and rendering for AI-assisted review.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep action.yml input names and defaults aligned with the action's
getInputcalls. A mismatch can silently select the wrong path, threshold, or gate behavior. - Keep action.yml output names and status values aligned with the action's
setOutputcalls and the helper modules that calculate those statuses. - Keep
Finding,ScanResult, andSecurityReportchanges aligned with severity filtering, scoring, renderers, optional checks, and evidence-pack summaries. - Keep local path resolution separate from workspace-relative action paths. A change in one boundary must not change the meaning of the other.
- Keep provider selection and its required environment key aligned with the optional Opus and injection paths.
- Keep dist/action.js and dist/index.js aligned with the TypeScript entrypoints because action.yml runs the built action while the package command points to the built CLI.
- Keep new optional stages non-blocking unless their gate is explicit. The core static report must remain usable when an external or optional stage fails.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The target path does not exist | The command exits before scanning. The action emits an error and sets a failing process status. | Resolve the path from the correct boundary: local command path or GITHUB_WORKSPACE for the action. |
| The action input name or default differs from action.yml | A workflow can run with an unintended threshold, path, or gate without a type error. | Treat action.yml and getInput names as one public contract. |
| An external rule pack cannot load | The command exits before the static scan. | Make each rule-pack path available to the command process and validate it before use. |
| A policy file cannot load | Policy status becomes an error and the action can fail when fail-on-policy is enabled. | Ship a valid policy path and inspect the policy status output. |
| A baseline file cannot load | Drift comparison is skipped and the action reports a missing baseline. | Create or publish the baseline before enabling drift enforcement. |
| The selected AI provider key is missing | The optional AI review does not run. A deep CLI run can still retain its other results. | Set the selected provider's key only in the environment that is allowed to call the external service. |
| Evidence-pack verification fails | The action stops with a failed evidence status even when the scan report exists. | Keep verification enabled and treat the digest as the trust check for the bundle. |
| Built files do not match the source entrypoints | The package or GitHub Action can run older orchestration behavior. | Rebuild the distributable files whenever an entrypoint or its shared contract changes. |
Key files
| File | Why to read it |
|---|---|
| src/index.ts | Shows the command boundary, scan lifecycle, optional stages, output selection, and exit decisions. |
| src/action.ts | Shows how workflow inputs become a scan and how annotations, outputs, summaries, artifacts, and failures are produced. |
| action.yml | Defines the public GitHub Action input, output, runtime, and built-entrypoint contract. |
| src/…/index.ts | Shows the shared handoff from a repository path to a scan result. |
| src/types.ts | Defines the shared finding, target, report, optional-result, deep-scan, and command option vocabulary. |
| src/action-baseline.ts | Defines baseline status and job-summary behavior used by the action boundary. |
| src/action-policy.ts | Defines policy status and job-summary behavior used by the action boundary. |
| src/action-supply-chain.ts | Defines supply-chain status and gate behavior used by the action boundary. |
| src/…/index.ts | Shows how scan, governance, package, CI, and remediation results become a verified handoff bundle. |
| src/…/pipeline.ts | Shows the boundary where a completed scan becomes an optional AI analysis request and result. |
| package.json | Shows the built CLI and action entrypoints and the build contract that creates their distributable files. |