spec-guard
v0.35.0Hold your code to what your Markdown says: the rules on a path, asked before an agent writes it.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_architectural_rules Architectural rules for a path
Lists the architecture rules in force for a file or directory, grouped by the ADR or spec that states them: modules it must not import, the layer it belongs to and the layers it must not depend on, import cycles, what it must be named and the partner files it needs, and text or symbols it must not contain, each with the reason the document gives. Answers from the specs without reading the codebase, so it works for a file that does not exist yet. Rules in documents that are not in force are counted and named but not listed unless include_inactive is true.
| Parameter | Type | Description |
|---|---|---|
include_inactive | boolean | Also list rules from draft, proposed, rejected, deprecated, superseded and archived documents, the status written in English. |
path | string | A file or directory, relative to the project root or absolute inside it. Give this or paths. |
paths | array | Several files or directories, each answered in turn. Give this or path. |
check_architecture Check the architecture rules
Runs the architecture rules in force against the files on disk and reports every violation, as CI would. Given paths, runs only the rules that govern them - each over its whole scope, so a count or a cycle is judged exactly as CI judges it - and marks which violations lie in those paths. A path that is a spec document runs the rules it states too, so a directive just written can be seen to hold. A file not saved yet is checked from contents, in memory; a path that is neither on disk nor in contents is refused, since no rule can be checked for it.
| Parameter | Type | Description |
|---|---|---|
contents | object | Files as they would be saved, by path relative to the project root, read in place of what is on disk. Nothing is written. |
paths | array | Files or directories to check the rules of, relative to the project root. Omit to run every rule, or the rules of the files in contents. |
get_dependents Files that depend on a path
Lists the files that import each given file or directory, directly or through other files, each with how many imports away it is and the import that leads there, and the architecture rules in force that govern the paths or any of those files. Call it before changing a file that other files import - renaming or removing an export, changing a signature - to see everything the change can reach. Relative JavaScript, TypeScript and Python imports are followed; an import that cannot be resolved is listed, and Go, Rust, C# and absolute Python imports, which name modules rather than files, are counted…
| Parameter | Type | Description |
|---|---|---|
paths * | array | Files or directories that exist, relative to the project root or absolute inside it. |
depth | integer | Follow dependents at most this many imports away. Omit to follow every one. |
include_inactive | boolean | Also list rules from draft, proposed, rejected, deprecated, superseded and archived documents, the status written in English. |
max_files | integer | List at most this many dependents of each path, the nearest first, and count the rest in truncated. Default 200. |
summary | boolean | Count the dependents of each path in truncated and list none of them. |
check_claims Check the labelled claims
Holds each claim the project's specifications label - Implemented, Specified and the rest, as the configuration's "claims" names them - to the evidence its label asks for: a directive under it that names a test and can be shown to fail, a criterion, one label each. Reports every claim that falls short, with what to do. Refused where the project configures no claims.