lint#
Validate your agent.json (or a folder of manifests) against the AgentPM schema and common best practices.
Overview#
agentpm lint checks schema conformance and common pitfalls. It can print results in multiple formats, optionally treat warnings as errors, and (lightly) auto-fix a few safe issues.
Command synopsis#
agentpm lint [PATHS...] [--schema <URL|PATH>] [--strict] [--format <pretty|json|ndjson>] [--fix]Arguments#
PATHS(default:./agent.json). Files/dirs/globs to lint. Directories are scanned recursively foragent.json.--schema <URL|PATH>. Override the default schema URL (useful for pinning or testing a local schema).--strict. Treat warnings as errors (schema violations are always errors).--format <pretty|json|ndjson>(default:pretty). Choose human-readable output or machine-friendly JSON/NDJSON.--fix. Attempt non-invasive automatic fixes (currently: inject$schemaif missing).
Tip
Use --format=json or --format=ndjson in CI and parse the result for gating.
Examples#
Lint the current manifest#
agentpm lintSample output (missing description):
✗ agent.json
[ERROR] "description" is a required property
vs schema /required
Error: Lint failedLint multiple paths (file + directory + glob)#
agentpm lint agent.json .agentpm/tools/**/agent.jsonUse a custom schema#
agentpm lint --schema ./schemas/dev.agentpm.schema.jsonStrict mode (warnings become errors)#
agentpm lint --strictMachine-readable output#
agentpm lint --format=json[
{
"file": "agent.json",
"ok": false,
"issues": [
{
"file": "agent.json",
"level": "error",
"message": "\"description\" is a required property",
"instance_path": "",
"schema_path": "/required"
}
]
}
]
Error: Lint failedAuto-fix safe issues#
agentpm lint --fix
# currently adds a $schema field if it's missingHow lint classifies issues#
Always errors (schema violations):
- Any JSON Schema validation failure. (Example:
"description" is a required property)
Warnings (unless --strict):
- Missing
$schema. Message:Missing $schema; editors may lack IntelliSense. - Empty
description. Message:description should not be empty.
Semantic error checks (beyond schema):
- Interpreter mismatch between
runtime.typeandentrypoint.command. Error message example:runtime.type should match entrypoint.command (python vs node).
Why this matters
Lint catches issues early so installs and publishes are predictable. agentpm publish runs lint automatically and will block the publish on any lint errors.
Exit codes#
0— All checked manifests passed (no errors; warnings allowed unless--strict).1— Lint failed (any error, or any warning when--strictis set).
Recommended workflow#
- Run
agentpm lintlocally during development. - Use
agentpm lint --format=jsonin CI to gate merges. - Add
--strictfor release branches to enforce clean manifests. - Let
--fixadd$schemaautomatically; commit the change.
Notes & gotchas#
$schemafield. Including$schemaenables IDE IntelliSense and makes the schema version explicit. Lint will add it for you with--fix.- Globs & directories. When passing directories, ensure your shell doesn’t expand globs unexpectedly; quote them if needed (e.g.,
"tools/**/agent.json").