Documentation
¶
Overview ¶
Package audit holds the `forge project audit` command group — a comprehensive snapshot of project state designed to orient an LLM (or human) without forcing them to grep ten different directories. It rolls up:
- Forge version pin (forge.yaml forge_version vs binary buildinfo).
- Project shape (kind, services + RPC counts, workers, operators, frontends).
- Convention compliance (rolled up forge lint counts per category).
- Codegen state (certified-file census via the embedded forge:hash markers, orphan _gen files, uncommitted user edits to forge-space files).
- Proto-vs-migration alignment (entity tables vs db/migrations/).
- Migration safety summary (allowed_destructive count, latest migration timestamp, destructive_change severity).
- FORGE_SCAFFOLD marker counts (P0 sharpening surface).
- Deps health (go.sum freshness vs go.mod, gen/ presence).
JSON output groups checks by category with status: ok|warn|error so a sub-agent can branch on `.codegen.status == "warn"` directly.
It is a dir-nested command group (the devspace idiom). The few categories it cannot compute without package-cli internals — the KCL-entity-typed ingress / external-builds categories, plus the service-registry / env-discovery / drift helpers — are reached through factory.AuditAPI (function values internal/cli registers via SetAuditAPI). The group never imports internal/cli, so the registry indirection in the factory package keeps the dependency one-directional (group → factory) and the import cycle broken. init() self-registers the command with the factory.
Index ¶
Constants ¶
const AuthUnscopedOKDirective = "forge:auth-unscoped-ok:"
AuthUnscopedOKDirective is the in-code acknowledgement that an authenticated RPC is intentionally global. It must be followed by a reason: the directive alone re-creates the unfalsifiable comment this category exists to replace.
Variables ¶
This section is empty.
Functions ¶
func CategoryNames ¶ added in v0.1.45
func CategoryNames() []string
CategoryNames returns every key `forge project audit --json` can put under `.categories`, in print order. It is the authoritative category set: buildAuditReport assigns exactly these keys, and auditCategoryOrder above pins their order. Exported so docs about the JSON shape (the `audit-json` skill) can be fact-checked against the code that emits it rather than against a hand-copied list that silently rots.
Types ¶
type Report ¶
type Report struct {
ProjectName string `json:"project_name"`
ProjectKind string `json:"project_kind"`
BinaryVersion string `json:"binary_version"`
GeneratedAt time.Time `json:"generated_at"`
Categories map[string]audittype.Category `json:"categories"`
OverallStatus audittype.Status `json:"overall_status"`
}
Report is the top-level JSON structure emitted by `forge project audit --json`. Field order is stable so diffing two audits is human-readable.