@workspacejson/rules
v0.5.0
Published
Deterministic reference behavior for workspace.json: AGENTS.md parser, repository scanner, validator and rule engine
Maintainers
Readme
@workspacejson/rules
Deterministic parser, scanner, validator and rule engine for consumers of
.agents/workspace.json.
This package is the reference behavior for the workspace.json
specification — it makes "what the specification means" executable. It is a
reference implementation, not a product, and it depends on
@workspacejson/spec for
the normative schema and types.
Source of truth: workspacejson/standard.
Install
npm install @workspacejson/rulesAPI
import {
AgentsMdParser,
RepoScanner,
RuleEngine,
WorkspaceJsonValidator,
computeHygieneScore,
} from '@workspacejson/rules';Contents
| Module | Responsibility |
| -- | -- |
| src/parser | Parses AGENTS.md |
| src/scanner | Walks repository structure |
| src/validator | Validates .agents/workspace.json |
| src/engine | Evaluates deterministic rules |
| src/testing | The published test-helper surface |
Public exports are kept stable through src/index.ts.
Writing rule tests
The ./testing entry point exports a RuleTester for authoring tests against
the shipped fixtures:
import { RuleTester } from '@workspacejson/rules/testing';It re-exports vitest helpers, so it must be imported from inside a vitest run. Importing it outside one throws about vitest's internal state — that is expected, not a packaging bug.
Requirements
Node.js >= 20.
