Skip to content

Commit 0aba481

Browse files
committed
chore: adjust agents.md slightly from latest approaches
1 parent 2b5ca1a commit 0aba481

4 files changed

Lines changed: 59 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,34 @@
33
## Project rules
44

55
- **Use nextest**: `cargo nextest run` for tests, `cargo test --doc` for doctests
6-
- **Always `--all-features`**: all test/build/clippy commands
7-
- **Clippy pedantic**: `cargo clippy --all-targets --all-features -- --deny clippy::pedantic`
6+
- **Product spelling**: always write the product name as `acdc`, lowercase. Preserve other casing only in exact external quotations or case-sensitive identifiers and test inputs.
7+
- **Worktree ownership**: inspect `git status --short` before editing. Preserve unrelated and staged work, and do not stage or commit unless the user explicitly asks.
8+
- **Feature coverage**: use `--all-features` for standard test/build/clippy commands. When a task changes supported feature-off behavior, also run the applicable documented `--no-default-features` configuration.
9+
- **Clippy pedantic**: `cargo clippy --all-targets --all-features -- --deny clippy::pedantic --deny clippy::todo`
810
- **Format before committing**: `cargo fmt --all`
911
- **Compact imports**: merge imports from the same crate/module into one `use` with braces, e.g. `use std::{borrow::Cow, io::Write};` — not separate `use std::borrow::Cow;` / `use std::io::Write;` lines
1012
- **Update changelogs**: each crate has its own `CHANGELOG.md`; update `[Unreleased]` for affected crates. Entries describe what a user sees or is affected by — the new behavior, the attribute/option to reach it, and any divergence from `asciidoctor`. Never regurgitate internal mechanics (function/field names, struct changes, control flow); those belong in code/commits, not the changelog.
1113
- **Surface converter warnings structurally**: user-relevant converter warnings should use `Warning` / `Diagnostics`, not `tracing::warn!`
1214
- **Never use CLI for fixtures**: use the examples directly (CLI adds `last_updated` timestamps)
13-
- **asciidoctor is reference**: when output differs, use `compare-asciidoc-output` agent
15+
- **asciidoctor is reference**: compare one source using the built `acdc` CLI and the matching asciidoctor backend first. Compare observable behavior, not byte-identical output, and avoid temporary Rust harnesses. Use the `compare-asciidoc-output` agent only after a direct comparison confirms a divergence or deeper research is needed. For PDF comparisons, keep clearly named `*-acdc.pdf` and `*-asciidoctor.pdf` outputs; do not create raster previews unless the user asks.
16+
17+
## Validation workflow
18+
19+
- Never run Cargo commands concurrently against the same target directory.
20+
- During implementation, run the smallest relevant package, test, or stable nextest expression, such as `-E 'test(/name/)'` rather than a generated fixture number.
21+
- Use `--all-features` for standard validation. When changing feature-off behavior, also run the applicable documented `--no-default-features` checks.
22+
- At a cross-crate, public-API, checklist, or commit boundary, run:
23+
24+
```console
25+
cargo fmt --all -- --check
26+
cargo nextest run --workspace --all-features
27+
cargo test --doc --workspace --all-features
28+
cargo clippy --all-targets --all-features -- --deny clippy::pedantic --deny clippy::todo
29+
git diff --check
30+
```
31+
32+
- Report whether a broad command failed during compilation or after tests began.
33+
- Do not rerun Rust checks after a documentation-only wording change when the relevant code checks have already passed.
1434

1535
## Workspace features
1636

@@ -32,7 +52,7 @@ New code that gates parsing or rendering on a specific substitution belongs behi
3252

3353
When tests fail, identify the category and follow the appropriate path:
3454

35-
- **Fixture mismatches** → run `regen-fixtures` skill (ask first)
55+
- **Fixture mismatches** → run the `regen-fixtures` skill (ask first). If the skill is unavailable, ask before using the documented scoped generator.
3656
- **Parser / grammar / preprocessor failures**`acdc-parser/AGENTS.md`
3757
- **Converter failures**`converters/AGENTS.md`
3858

acdc-cli/AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
`setext` is default-on as a build feature and exposes the runtime `--setext` compatibility flag. `highlighting` forwards to whichever of the HTML and terminal backends are selected without enabling either backend itself.
1010

11+
## Attribute overrides
12+
13+
- The CLI owns parsing of `-a` syntax only. Parser `Options` owns protected and caller-locked attribute decisions.
14+
- Preserve the distinction between locked defaults and soft `@` assignments and unsets.
15+
- Do not add CLI-only lock exceptions.
16+
- Changes require CLI tests plus parser policy fixture and API tests.
17+
1118
## TCK compliance
1219

1320
The CLI supports the AsciiDoc TCK (Test Compatibility Kit) behind a feature flag.

acdc-parser/AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ The default-on `pre-spec-subs` feature governs whether `[subs="..."]` block attr
2323

2424
Converter-side plumbing (`SubsFlags`, `effective_subs`, fixture naming) lives in `converters/AGENTS.md`.
2525

26+
## Document attribute policy
27+
28+
- `constants.rs` owns the static built-in read-only and API-only attribute protection.
29+
- `Options` combines built-in protection with locks supplied by the caller.
30+
- The CLI parses attribute assignment syntax, and converters may add unlocked defaults. Neither duplicates the parser's lock policy.
31+
- Keep the policy internal. The public parser API should expose only stable caller intent, never converter-specific or test-specific fields and functions.
32+
- When changing the policy, test document entries, parser `Options` and builder input, CLI `-a` input, locked and soft `@` assignments and unsets, and header/body exceptions. Compare both the official attribute documentation and the current asciidoctor implementation.
33+
2634
## Debugging
2735

2836
- **Grammar failures** → use `trace-parse` skill, then check `src/grammar/`
@@ -40,6 +48,8 @@ Regenerate parser fixtures:
4048
cargo run -p acdc-parser --example generate_parser_fixtures --all-features
4149
```
4250

51+
The generator rewrites all parser JSON fixtures. Record `git status --short` before running it and inspect every changed fixture afterward. Treat the `.adoc` file as the test input and the generated `.json` file as expected output. Use stable nextest expressions instead of generated fixture numbers when running one fixture test.
52+
4353
## Property tests
4454

4555
```bash

converters/AGENTS.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,23 @@ Shared utilities in `core/`:
4343
explicitly, and `test_fixture` has the matching `.contains("subs")`
4444
early-return.
4545

46+
## Test placement
47+
48+
- Use source and expected-output fixtures for rendered HTML, text, Typst, and other snapshot-like converter output.
49+
- Use integration tests for properties that snapshots cannot prove, including structured diagnostics, PDF annotations, PDF objects and metadata, warnings, and end-to-end behavior.
50+
4651
## Debugging
4752

48-
- Use `compare-asciidoc-output` agent to diff converter output against asciidoctor
53+
- Compare the same source with the built `acdc` CLI and the matching asciidoctor backend before using the `compare-asciidoc-output` agent. Compare observable behavior rather than byte-identical output.
4954
- For fixture mismatches, run `regen-fixtures` skill (ask first)
5055

5156
## Fixture regeneration
5257

58+
- Get approval before regenerating fixtures.
59+
- Record `git status --short` before regeneration.
60+
- Run one generator at a time. Each generator may rewrite its full fixture corpus.
61+
- Inspect status and the diff immediately afterward. Keep only intended changes or explicitly approved new baselines, and reject environment-only changes.
62+
5363
```bash
5464
cargo run -p acdc-converters-html --example generate_html_fixtures --all-features
5565
cargo run -p acdc-converters-terminal --example generate_terminal_fixtures --all-features
@@ -61,3 +71,10 @@ bash converters/markdown/tests/regenerate_expected.sh
6171
# Regenerate a single fixture:
6272
bash converters/markdown/tests/regenerate_expected.sh <fixture_name>
6373
```
74+
75+
### Terminal capability fixtures
76+
77+
- The terminal fixture macro's boolean argument controls whether the test reads `.osc8.txt`. When it is `true`, the generic harness skips the fixture for terminals without OSC 8 support.
78+
- A plain `.txt` file for that same fixture is unused unless a separate no-OSC8 assertion reads it.
79+
- If both `.txt` and `.osc8.txt` are retained, add explicit coverage for both outputs.
80+
- Test terminal capability-dependent behavior with both `TERM=dumb` and `TERM=xterm-ghostty`.

0 commit comments

Comments
 (0)