lyrashield
v0.2.16
Published
LyraShield AI CLI — install, scan, and gate your AI coding agents.
Maintainers
Readme
LyraShield CLI 0.2.14
The lyrashield command-line interface installs, configures, and drives LyraShield scans from a terminal or CI pipeline. Scans started here produce the same evidence-backed record as the dashboard: explicit evidence states, coverage receipts, approval-gated fix proposals and server-owned retests — never a bare confidence score.
Quick start
npx -y [email protected] login --oauth # hosted PKCE OAuth login (recommended)
npx -y [email protected] use <workspace>
npx -y [email protected] project use # detect the current git repo and set it as the default project
npx -y [email protected] scan # scan the default project (uses default mode)
npx -y [email protected] pr-scan --auto # run a bounded PR check on the current repoYou can also set LYRASHIELD_API_KEY (and optionally LYRASHIELD_API_URL) in the environment. LYRASHIELD_API_URL defaults to https://app.lyrashieldai.com.
Usage
lyrashield <command> [args] [--json]Commands
Authentication and setup
login --oauth— connect through hosted OAuth consent using PKCE, then save the token and selected workspace to~/.lyrashield/credentials.jsonwith0o600permissions. Failed login preserves existing credentials.login— securely enter or pipe a workspace API key. Environment credentials retain precedence; OAuth failures never silently switch authentication methods.logout— remove stored credentialsuse <workspace>— set the default workspace for subsequent commandsdoctor— diagnose credentials, API reachability, and locally detected agents
Agent installation
agents— list the complete registry with detection state, evidence-backed support tier, and verification metadatainit— detect and configure all installed agents using that client's documented transport and install path. When a client requires its own marketplace, UI, or config merge,initprints the exact next step instead of copying files into an unrecognized directory.install <agent> [--transport stdio|remote-http] [--global|--project] [--inline-secret] [--dry-run]— add LyraShield to a single agent. For clients without a reviewed, supported plugin install path, the CLI provides direct-MCP guidance; Kiro uses its documented MCP settings file.--dry-runpreviews every path without executing vendor CLIs or writing files.uninstall <agent>— remove a CLI-managed LyraShield config or plugin. Marketplace and UI installs return client-specific removal guidance.rules add <agent>|remove <agent>|check— add, remove, or validate an agent rules file (AGENTS.md,CLAUDE.md, etc.)skills install|remove <agent> [--project|--global] [--dry-run] [--project-root <dir>]— install shared LyraShield skills at a documented client path, or remove only unchanged LyraShield-owned files. Installing files does not confirm client discovery; reload the client and verify its skill list.
CLI 0.2.14 includes the config writers and shared-skill installer described above. Pin setup to
this CLI version and the matching MCP package:
npx -y [email protected] login --oauth
npx -y [email protected] install <agent> --project --dry-run
npx -y [email protected] skills install <agent> --project --dry-runRemove --dry-run only after reviewing the preview. Use --global instead of --project for a
user-level install. The direct MCP configuration uses @lyrashield/[email protected], matching this
CLI release. Follow the current client guides
for client-specific plugin, MCP and skill discovery. Marketplace listing and authenticated client
runtime acceptance are separate from npm package availability; use direct-MCP guidance when a
client-owned plugin install path has not been verified. Do not install from a mutable marketplace
preparation branch.
install refuses to write raw secrets into shared-by-convention files unless you pass --inline-secret and the file is gitignored. Use --dry-run to preview the config change without writing it.
Project defaults
project use [path] [--repo <repo>] [--name <name>]— detect the current git repo (or use the given path, owner/repo, HTTPS URL, or SSH URL) and set it as the default projectproject list— list workspace targets; the default project is marked with*project switch <targetId>— switch the default project to an existing targetproject current— show the current default projectproject clear— clear the default project
The default project is stored in ~/.lyrashield/project.json (mode 0o600). Once set, lyrashield scan can run without --target. The default project is workspace-scoped; if you switch workspace with lyrashield use <workspace>, a saved default from another workspace is ignored.
Targets and scans
scan [--target <targetId>] [--goal <goal>] [--mode <mode>] [--auto] [--repo <repo>] [--attachment <id>] [--wait|--watch] [--timeout <s>] [--poll-interval <s>]— start a scan- Default mode is
STANDARD; usepr-scanfor a boundedQUICKpre-PR check.SAFEremains an accepted compatibility alias for repository targets. - Goals:
CHECK_PR,TEST_APP,LAUNCH_REVIEW,WEEKLY_MONITOR,FULL_PENTEST,COMPLIANCE_REVIEW - Modes:
SAFE,QUICK,STANDARD,DEEP,CUSTOM - With no target and no default project, pass
--autoto detect the current git repo and create or reuse a target - Pass
--repoasowner/repo, an HTTPS URL, or an SSH URL (e.g.ecryptoguru/lyrashield-ai,https://github.com/ecryptoguru/lyrashield-ai.git,[email protected]:ecryptoguru/lyrashield-ai.git) - Pass one or more
--attachment <id>flags to include already-uploaded workspace evidence in the immutable scan plan; upload and list files withlyrashield attachmentsfirst --wait/--watchpolls the scan until a terminal state;--timeoutbounds the wait in seconds (default 1800, max 86400) and--poll-intervalsets seconds between polls (default 5, minimum 1). The scan id is printed to stderr immediately on acceptance; status transitions go to stderr while waiting, including in--jsonmode (stdout stays a single final document).Ctrl+Cstops waiting only — the scan keeps running and the printedstatus <id> --watchcommand resumes it. A scan that ends other thanCOMPLETEDexits7; the deadline exits8;SIGINTexits130.COMPLETEDmeans execution finished — it is not a security verdict.
- Default mode is
preflight [--target <targetId>] [--goal <goal>] [--mode <mode>] [--workspace <workspaceId>] [--workflow <workflow> --base <ref> --head <ref>] [--attachment <id>]— advisory read-only check of whetherscanwould currently be admitted for the target. It evaluates the same permission, plan, domain-proof and entitlement gates server-side without starting a scan, claiming a trial, or consuming the free-URL allowance; the authoritative check still runs at scan creation. Exit0when allowed, exit1on an eligibility denial (allowed:false— a successful read), and the usual codes for usage (2), auth (3), network (4), rate-limit (5) and plan refusal (6). Supports--json; with no--target, the saved default project is used when it matches the workspace.pr-scan [--auto] [--repo <owner/repo>] [--mode <mode>] [--wait|--watch] [--timeout <s>]— shortcut forscan --goal CHECK_PR --mode QUICK; supports the same wait flagsstatus [scanId] [--operation <operationId>] [--watch|--wait] [--timeout <s>] [--poll-interval <s>]— list scans or inspect one scan.--watchfollows a scan to its terminal state;--operation <id> --watchwaits on a durable submission operation and follows the recorded scan reference it produced, within the same timeout budget.cancel <scanId> [--idempotency-key <key>]— request cancellation of a queued or running scan. If the scan is already terminal or finalizing (HTTP 409), the command re-reads and reports the true status: exit0when alreadyCANCELLED, exit1otherwise.targets [--name ... --type ... --url ... --repo ...]— list or create targetstargets remove <targetId>— soft-delete a target; its history is retained, it is hidden from readers and the plan cap slot is freedtargets verify-domain <targetId> [--issue|--check]— show domain-control status for a WEB_APP/API target in the configured workspace.--issuereturns the DNS TXT host, value, and challenge expiry; publish that record, then use--check. Issuing replaces the previous token and verified status. The TXT value is returned only on issue; save it before exiting. All proof operations require target validation permission. Supports--json; invalid targets, permission failures, missing/expired proofs, and failed DNS checks exit nonzero. DNS control does not establish application security.readiness [--target <targetId>]— workspace launch-readiness report: every gate target's state (READY,NOT_READYorINSUFFICIENT_EVIDENCE), findings rollup and optional release-identity check. For the enforceable single-target release gate usegate --verdict --target <id>(below).
Scan mode guide
Deeper modes consume more compute and take longer. Choose the least intensive mode that answers the question.
| Intent | Goal | Mode |
| ----------------------------- | ------------------- | ---------- |
| Pre-PR check | CHECK_PR | QUICK |
| Quick check | TEST_APP | QUICK |
| Standard repo review | TEST_APP | STANDARD |
| Launch review | LAUNCH_REVIEW | STANDARD |
| Authorized repository pentest | FULL_PENTEST | DEEP |
| Compliance review | COMPLIANCE_REVIEW | DEEP |
| Weekly monitor | WEEKLY_MONITOR | QUICK |
Findings and fixes
findings [--severity ...] [--status ...] [--target ...] [--scan ...] [--verified ...] [--stats]— list findingsexplain <findingId>— show full finding detail and plain-language guidancefix-plan <findingId>— read-only remediation plan assembled from the finding's recorded detailfix-plan create <findingId> --summary <summary>— record a fix proposal on a finding (summary must be ≥ 10 characters)fix-plan create-pr <proposalId> --idempotency-key <key>— request a fix pull request; reportspending_approval(with the approval URL) or the opened PR. Nothing is merged automatically and rejected/failed outcomes exit non-zero.attachments list|upload <path>|remove <attachmentId>— manage workspace scan attachments (input evidence for scans). Upload requires--idempotency-key, accepts.txt/.md/.markdown/.json/.yaml/.ymlfiles up to 1 MiB, and takes the attachment filename from the file path's basename.verify <findingId>— queue a retest of a finding
Local checks and CI
check-diff [--staged] [--base <ref>] [--head <ref>] [--sarif <file>]— fast advisory diff check for obvious risky patterns; not a substitute for a full recorded scangate [--fail-on HIGH|MEDIUM|LOW] [--staged] [--base <ref>] [--head <ref>] [--sarif <file>] [--target <targetId>]— combine local diff patterns with that target's open findings and fail at the chosen severity threshold. Without--target(or a saved default project fromproject use), only the local diff checks gate the PR — never the whole workspace's findings.gate --verdict [--target <id>]— return the target's versioned release-gate state instead of the diff-severity gate, with exit code0(READY),1(NOT_READY), or2(insufficient evidence or error — fails closed). This is the single-target gate, distinct from the workspace-widereadinessreport above.
The root GitHub Action v2 source supports local SAFE and AGGRESSIVE modes only. It rejects DEEP with directions to the hosted app, MCP server, or REST API instead of silently reducing coverage.
Reports and approvals
report [--title ... --scan <scanId> --type executive|developer|compliance]— list or create reportsapprovals list|create <actionName>|approve <approvalId>|deny <approvalId>— manage agent-approval requestsmcp call <tool> [--input '{...}']— call a remote MCP toolhook install|remove— optionally install or remove LyraShield's marked advisory block in Git's activepre-commithook, including worktrees andcore.hooksPathconfigurations. Existing hook commands, comments, line endings and permissions are preserved.
The hook runs the local lyrashield check-diff --staged command only when lyrashield is available on PATH; otherwise it prints a skip message and allows the commit. It does not use npx, access the network, or start a paid scan. The hook is opt-in. hook remove removes only LyraShield's intact marked block and leaves other hook content in place. hook install migrates the exact legacy LyraShield network hook in place; if that legacy command appears alongside custom content, installation stops and asks you to remove only the old LyraShield lines manually. Installation refuses existing non-shell shebangs; a hook without a shebang must already be POSIX shell-compatible (Git's shell fallback can vary by host). Existing file permissions are preserved, and the command warns when the hook is not executable.
Exit codes
0— success1— command failed, orgatefound findings at/above the threshold;gate --verdictreturns NOT_READY;cancelreturns it when the scan is already terminal or finalizing (the true status is reported);preflightreturns it when the eligibility read succeeds but the scan would be denied (allowed:false)2— usage or validation error;gate --verdictreturns it on insufficient evidence or any error (fail-closed)3— authentication or authorization error (HTTP 401/403)4— network or other API error5— rate limited (HTTP 429)6— plan or agent-minute balance refusal (HTTP 402); prints "Plan or agent-minute balance does not allow this. Open Billing."7— watched work ended without success: a scan reached a terminal state other thanCOMPLETED(FAILED,CANCELLED,PARTIAL,STOPPED_BUDGET,TIMED_OUT), or a watched operation endedFAILED/CONFLICT8—--wait/--watchdeadline elapsed before a terminal state; the scan keeps running and the printedstatus <id> --watchcommand resumes the wait130—SIGINT(Ctrl+C) while waiting; the scan keeps running server-side and the recovery hint on stderr says how to resume or cancel
Global flags
--json— machine-readable output ({ ok: true/false, data|error })--version— print version--help/-h— show usageNO_COLOR=1— disable ANSI colors
Environment
LYRASHIELD_API_KEY— optional workspace API key (lsk_...); the CI/headless path. Not needed afterlyrashield login --oauth(orlyrashield login) stores a credential in~/.lyrashield/credentials.json— either works.LYRASHIELD_OAUTH_ACCESS_TOKEN— optional OAuth bearer alternative to an API key.LYRASHIELD_API_URL— optional; defaults tohttps://app.lyrashieldai.comNO_COLOR=1— optional; disables colored terminal output
Environment credentials take precedence over the stored credentials file. With no environment credential, the CLI uses the stored OAuth/API-key credential; an explicit LYRASHIELD_API_URL override binds stored credentials only to a matching origin (see lyrashield doctor to diagnose resolution).
Importing SARIF
lyrashield scan --target <targetId> --sarif <report.sarif> validates the file before submitting a scan and imports third-party detections through POST /api/v1/scans/{id}/artifacts/sarif. Imports never establish scanner coverage or independently verified findings. If import fails after submission, retry with lyrashield scan --scan-id <existingScanId> --sarif <report.sarif>; this does not create or charge for another scan.
Retrying a scan safely
Supply --idempotency-key <request-id> when a request may be retried across CLI invocations. Reuse the same key and inputs after a lost response. Changed inputs with the same key conflict; an uncertain failed operation is not automatically resubmitted. Without this flag, each invocation is a new request.
Use lyrashield status --operation <operationId> (with --json for scripts) to read the server's current status, result reference, and permitted recovery. This reports submission state; follow the returned scan ID to inspect scan completion. Access remains bound to the originating credential and workspace.
