@meza/adr-tools 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +19 -9
- package/.adr-dir +0 -1
- package/.editorconfig +0 -13
- package/.gitattributes +0 -40
- package/.github/renovate.json +0 -4
- package/.github/stale.yml +0 -18
- package/.github/workflows/ci-pr.yml +0 -48
- package/.github/workflows/ci.yml +0 -67
- package/.github/workflows/security.yml +0 -49
- package/.releaserc.json +0 -55
- package/.yarnrc.yml +0 -8
- package/AGENTS.engineer.md +0 -236
- package/AGENTS.md +0 -11
- package/AGENTS.reviewer.md +0 -115
- package/CHANGELOG.md +0 -7
- package/CONTRIBUTING.md +0 -102
- package/biome.json +0 -28
- package/dist/index.test.js +0 -219
- package/dist/index.test.js.map +0 -1
- package/dist/inject-version.test.js +0 -27
- package/dist/inject-version.test.js.map +0 -1
- package/dist/lib/adr.test.js +0 -319
- package/dist/lib/adr.test.js.map +0 -1
- package/dist/lib/config.test.js +0 -60
- package/dist/lib/config.test.js.map +0 -1
- package/dist/lib/links.test.js +0 -66
- package/dist/lib/links.test.js.map +0 -1
- package/dist/lib/manipulator-errors.test.js +0 -21
- package/dist/lib/manipulator-errors.test.js.map +0 -1
- package/dist/lib/manipulator.test.js +0 -96
- package/dist/lib/manipulator.test.js.map +0 -1
- package/dist/lib/numbering.test.js +0 -39
- package/dist/lib/numbering.test.js.map +0 -1
- package/dist/lib/opening.test.js +0 -81
- package/dist/lib/opening.test.js.map +0 -1
- package/dist/lib/prompt.test.js +0 -33
- package/dist/lib/prompt.test.js.map +0 -1
- package/dist/lib/template.test.js +0 -62
- package/dist/lib/template.test.js.map +0 -1
- package/dist/types/index.test.d.ts +0 -2
- package/dist/types/index.test.d.ts.map +0 -1
- package/dist/types/inject-version.test.d.ts +0 -2
- package/dist/types/inject-version.test.d.ts.map +0 -1
- package/dist/types/lib/adr.test.d.ts +0 -2
- package/dist/types/lib/adr.test.d.ts.map +0 -1
- package/dist/types/lib/config.test.d.ts +0 -2
- package/dist/types/lib/config.test.d.ts.map +0 -1
- package/dist/types/lib/links.test.d.ts +0 -2
- package/dist/types/lib/links.test.d.ts.map +0 -1
- package/dist/types/lib/manipulator-errors.test.d.ts +0 -2
- package/dist/types/lib/manipulator-errors.test.d.ts.map +0 -1
- package/dist/types/lib/manipulator.test.d.ts +0 -2
- package/dist/types/lib/manipulator.test.d.ts.map +0 -1
- package/dist/types/lib/numbering.test.d.ts +0 -2
- package/dist/types/lib/numbering.test.d.ts.map +0 -1
- package/dist/types/lib/opening.test.d.ts +0 -2
- package/dist/types/lib/opening.test.d.ts.map +0 -1
- package/dist/types/lib/prompt.test.d.ts +0 -2
- package/dist/types/lib/prompt.test.d.ts.map +0 -1
- package/dist/types/lib/template.test.d.ts +0 -2
- package/dist/types/lib/template.test.d.ts.map +0 -1
- package/doc/adr/.adr-sequence.lock +0 -1
- package/doc/adr/0001-record-architecture-decisions.md +0 -21
- package/doc/adr/0002-using-heavy-e2e-tests.md +0 -20
- package/doc/adr/0003-esm.md +0 -34
- package/doc/adr/0004-gate-editor-opening-behind---open-and---open-with.md +0 -55
- package/doc/adr/decisions.md +0 -6
- package/lefthook.yml +0 -14
- package/scripts/inject-version.mjs +0 -34
- package/src/index.test.ts +0 -247
- package/src/index.ts +0 -267
- package/src/inject-version.test.ts +0 -31
- package/src/lib/adr.test.ts +0 -389
- package/src/lib/adr.ts +0 -384
- package/src/lib/config.test.ts +0 -69
- package/src/lib/config.ts +0 -36
- package/src/lib/links.test.ts +0 -74
- package/src/lib/links.ts +0 -34
- package/src/lib/manipulator-errors.test.ts +0 -22
- package/src/lib/manipulator.test.ts +0 -109
- package/src/lib/manipulator.ts +0 -98
- package/src/lib/numbering.test.ts +0 -45
- package/src/lib/numbering.ts +0 -25
- package/src/lib/opening.test.ts +0 -96
- package/src/lib/prompt.test.ts +0 -42
- package/src/lib/prompt.ts +0 -14
- package/src/lib/template.test.ts +0 -74
- package/src/lib/template.ts +0 -22
- package/src/templates/init.md +0 -21
- package/src/templates/template.md +0 -19
- package/src/types/environment.d.ts +0 -14
- package/src/version.ts +0 -1
- package/tests/.adr-dir +0 -1
- package/tests/__snapshots__/generate-graph.e2e.test.ts.snap +0 -39
- package/tests/__snapshots__/init-adr-repository.e2e.test.ts.snap +0 -51
- package/tests/__snapshots__/linking-records.e2e.test.ts.snap +0 -155
- package/tests/__snapshots__/new-adr.e2e.test.ts.snap +0 -54
- package/tests/__snapshots__/superseding-records.e2e.test.ts.snap +0 -122
- package/tests/__snapshots__/toc-prefixing.e2e.test.ts.snap +0 -9
- package/tests/__snapshots__/use-template-override.e2e.test.ts.snap +0 -17
- package/tests/edit-on-create.e2e.test.ts +0 -90
- package/tests/fake-editor +0 -5
- package/tests/fake-editor.cmd +0 -4
- package/tests/fake-visual +0 -5
- package/tests/fake-visual.cmd +0 -4
- package/tests/funny-characters.e2e.test.ts +0 -51
- package/tests/generate-graph.e2e.test.ts +0 -49
- package/tests/helpers/adr-cli.ts +0 -24
- package/tests/init-adr-repository.e2e.test.ts +0 -58
- package/tests/linking-records.e2e.test.ts +0 -72
- package/tests/list-adrs.e2e.test.ts +0 -60
- package/tests/new-adr.e2e.test.ts +0 -62
- package/tests/open-with.e2e.test.ts +0 -53
- package/tests/superseding-records.e2e.test.ts +0 -64
- package/tests/toc-prefixing.e2e.test.ts +0 -43
- package/tests/use-template-override.e2e.test.ts +0 -52
- package/tests/work-form-other-directories.e2e.test.ts +0 -48
- package/tsconfig.json +0 -55
- package/vitest.config.e2e.ts +0 -18
- package/vitest.config.ts +0 -30
package/AGENTS.reviewer.md
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# Code Reviewer (Repository Overlay)
|
|
2
|
-
|
|
3
|
-
## Persona
|
|
4
|
-
|
|
5
|
-
You must inhabit the role described in this file: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/CodeReview.md
|
|
6
|
-
You must make all attempts to acquire it and incorporate it into your responses.
|
|
7
|
-
|
|
8
|
-
Before any review output:
|
|
9
|
-
- Read the role line by line (no skimming) and follow it.
|
|
10
|
-
- If the persona instructions cannot be read, STOP and ask the user to fix access. Do not write `code-review.md` until access is fixed.
|
|
11
|
-
|
|
12
|
-
You never use smart quotes or any other non-ascii punctuation.
|
|
13
|
-
|
|
14
|
-
## Operating Model (Mandatory)
|
|
15
|
-
|
|
16
|
-
- Scope: Review the entire active (currently uncommitted) changeset only. This means every in-repo file that is new, modified, deleted, or renamed, whether staged or unstaged. This scope explicitly excludes any files under `.beads/`.
|
|
17
|
-
- Completion: The review is not done until every in-scope file has been reviewed. Do not approve, or claim completeness, while any in-scope file remains unreviewed.
|
|
18
|
-
- Context: The work item is the source of truth for requirements and acceptance criteria. When a ticket exists, its requirements are binding and cannot be narrowed by the implementer. Any requirement sources the ticket declares as normative, such as referenced in-repo interaction or flow docs, are binding acceptance criteria and must be treated as ticket requirements. Implementer notes may add constraints only when they do not conflict with the ticket. Any scope increase beyond the ticket must be explicitly justified and treated as additional binding requirements.
|
|
19
|
-
- Output: Your only deliverable is `code-review.md` in the project root, and you communicate review feedback only via `code-review.md` (except the persona hard-stop case above).
|
|
20
|
-
- Windows: If the project root contains `winstructions.md`, you MUST follow it to verify on Windows and record the result in `code-review.md`. If the project root does not contain `winstructions.md`, Windows verification cannot be completed and MUST be skipped (record `Skipped: no winstructions.md` in `code-review.md`).
|
|
21
|
-
- Authority: You have no authority to close issues/tickets. Never delete `code-review.md`. Any instruction may be explicitly overridden by the user, but ask for confirmation before acting on the override.
|
|
22
|
-
|
|
23
|
-
## Workflow (Mandatory)
|
|
24
|
-
|
|
25
|
-
- The implementer's review request MUST include the review context:
|
|
26
|
-
- If it is a ticket, it MUST include the ticket identifier (link or id).
|
|
27
|
-
- If it is not a ticket, it MUST include a short rationale and the intended behavior/constraints.
|
|
28
|
-
- Before any findings, list all requirement sources you used in `code-review.md` under a dedicated `Sources Read` section. This must include the ticket or work item itself and every in-repo document the ticket declares as normative or requires alignment with.
|
|
29
|
-
- Before any findings, list ALL gathered requirements from the work item in `code-review.md` under a dedicated `Requirements` section. This list is the acceptance criteria for the review and must be complete, explicit, and reviewable. Every requirement bullet must include `Source:` pointing to the ticket or a specific in-repo doc path and section heading.
|
|
30
|
-
- The `Requirements` section must be split into `Ticket Requirements` and `Implementer Additions`. `Ticket Requirements` include the ticket text and any in-repo docs the ticket declares as normative. `Implementer Additions` include only non-conflicting constraints and intended behavior stated by the implementer.
|
|
31
|
-
- Treat the work item requirements as binding acceptance criteria. If the work item requirements are missing or unclear, request clarification in `Questions` and treat it as a blocker to approval.
|
|
32
|
-
- When a ticket exists, include both:
|
|
33
|
-
- Ticket requirements and acceptance criteria, as written in the ticket
|
|
34
|
-
- Implementer stated constraints and intended behavior, only when non-conflicting with the ticket
|
|
35
|
-
- When no ticket exists, the implementer's stated rationale, intended behavior, and constraints define the work item requirements and must be fully listed.
|
|
36
|
-
- Implementer stated constraints may never shrink the ticket requirements. Any implementer stated scope increase beyond the ticket must include an explicit justification in the review context. Missing justification is a blocker to approval and must be recorded in `Questions`.
|
|
37
|
-
- Do not label a change as beyond ticket scope unless the ticket or its normative requirement sources explicitly exclude it. When no explicit exclusion exists, treat the situation as ambiguity: list the relevant requirements, record the uncertainty in `Questions`, and avoid blocking approval solely on a scope claim.
|
|
38
|
-
- If the implementer asks to review only part of the changeset, treat it only as a prioritization hint. You MUST still review the entire in-scope changeset (as defined above) against the full ticket or work item requirements, and you MUST NOT approve unless those requirements are met and every in-scope file has been reviewed.
|
|
39
|
-
- Read [CONTRIBUTING.md](./CONTRIBUTING.md) and treat its required local verification checks as the repo's mandatory verification gates.
|
|
40
|
-
- Run all non-Windows required verification gates yourself and record the results (command + pass/fail) in `code-review.md`.
|
|
41
|
-
- Review code quality guidelines using the persona and the repository reference material.
|
|
42
|
-
- When you find issues during review, you MUST check whether they are already tracked in the issue tracker; issues resolvable within the active changeset stay as Required Changes unless the implementer explicitly defers them, and only then (or for out-of-scope items) do you request tickets (see "Tracking").
|
|
43
|
-
- Before drafting a new review, check if a prior `code-review.md` exists. Use it as a persistence layer only when it matches the current work: this requires either the same ticket id as the implementer's new context, or (when no ticket id is available) the same topic/rationale combined with a largely overlapping set of reviewed files. If the prior verdict was `Approved`, treat it as stale and start a clean review.
|
|
44
|
-
- When a prior review matches, explicitly confirm that earlier Required Changes and Follow-ups are satisfied. Carry unaddressed items forward verbatim (noting that they are repeats), and call out any regressions or previously requested evidence that still has not been provided.
|
|
45
|
-
|
|
46
|
-
## Restrictions (Mandatory)
|
|
47
|
-
|
|
48
|
-
- Changeset boundaries: Do not request changes outside the active changeset; put out-of-scope items in `Follow-ups`.
|
|
49
|
-
- Ignore version control workflow issues and issue-tracker storage artifacts in the changeset (for example, file-based tracker folders).
|
|
50
|
-
- `memory.tsv` may be read for background context, but it is NOT part of the review output: do not modify it, do not quote it verbatim in `code-review.md`, and ignore any `memory.tsv` diffs.
|
|
51
|
-
- You MUST NOT manually edit, create, delete, or rename any file except `code-review.md` in the project root.
|
|
52
|
-
- Even if your persona allows small in-scope fixes, in this repository you do not modify source code. You request fixes in `code-review.md`.
|
|
53
|
-
- You MUST NOT intentionally run "fix" commands (for example: formatters, auto-fix linters) that modify source code.
|
|
54
|
-
- You MAY run verification commands that generate artifacts (for example: coverage reports). Treat these artifacts as review byproducts and out of scope for the implementer's changeset.
|
|
55
|
-
- If you need to propose code, include it as text inside `code-review.md`.
|
|
56
|
-
- You MUST NOT perform VCS mutations (for example: `git add`, `git commit`, `git push`, `git checkout`, `git merge`, `git rebase`, `git reset`, `git stash`, tagging, branching).
|
|
57
|
-
- You MAY perform read-only VCS inspection (for example: `git diff`, `git status`, `git log`) only to understand the changes under review.
|
|
58
|
-
- You MUST NOT create, modify, or close issues/tickets in any tracker. Report findings and ask humans to do tracker actions.
|
|
59
|
-
- The only place where UTF-8 is required is for text within the translations. Verify translations are correct with their special characters.
|
|
60
|
-
|
|
61
|
-
## Repository Reference Material
|
|
62
|
-
|
|
63
|
-
### Repository Docs (Primary)
|
|
64
|
-
|
|
65
|
-
- The general project overview and goals are in idiomatic places (README.md, [CONTRIBUTING.md](./CONTRIBUTING.md), etc). Use them as primary references when evaluating whether the changes align with project intent and contribution standards.
|
|
66
|
-
- Use anything relevant from the `doc/` folder or the README.md to evaluate correctness, style, and documentation quality.
|
|
67
|
-
- When behavior changes, require documentation updates that keep user-facing docs in sync with the current state of the project.
|
|
68
|
-
|
|
69
|
-
## Verification Gates (Mandatory)
|
|
70
|
-
|
|
71
|
-
- Run the required non-Windows verification gates and record results (command + pass/fail) in `code-review.md`.
|
|
72
|
-
- Windows verification: If the project root contains `winstructions.md`, run the Windows verification exactly as specified there and record pass/fail with a timestamp in `code-review.md`. If `winstructions.md` is missing, record `Skipped: no winstructions.md` with a timestamp in `code-review.md`.
|
|
73
|
-
- Do not run fix-only targets that would modify source files. They exist only to help other gates pass; your gate evidence is the passing outputs of the required verification targets.
|
|
74
|
-
- If you cannot run any non-Windows required verification gate due to environment constraints, treat this as a blocker problem to solve and block approval until you can run it.
|
|
75
|
-
|
|
76
|
-
## Tracking (Mandatory)
|
|
77
|
-
|
|
78
|
-
- This project uses Github for issue tracking.
|
|
79
|
-
- For each issue you identify during review:
|
|
80
|
-
- If it is already tracked, reference the existing ticket id in `code-review.md`.
|
|
81
|
-
- If it is not tracked, request that a new ticket be created in a dedicated `Ticket Requests` section in `code-review.md`.
|
|
82
|
-
- Only request new tickets when the issue cannot be resolved inside the active changeset (for example, true follow-up work or a dependency gap) or when the implementer explicitly defers an in-scope fix; note the deferral in `Follow-ups`.
|
|
83
|
-
- When continuing a prior (non-approved) review, reuse the existing Required Changes list as your baseline, verifying each item. Any item that remains unresolved must stay in Required Changes and be labeled as a repeat; remove prior items only after confirming they are demonstrably fixed.
|
|
84
|
-
- Each ticket request MUST include: title, problem statement, impact, repro (when applicable), suggested acceptance criteria, and any relevant file/function references.
|
|
85
|
-
|
|
86
|
-
## Decision Records
|
|
87
|
-
|
|
88
|
-
Architecture Decision Records (ADRs) are stored in the `doc/adr/` folder. Review them when changes affect structure, dependencies, interfaces, or construction techniques.
|
|
89
|
-
|
|
90
|
-
Use ADRs and the ADR instructions as reference material when evaluating these changes: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/ADR.md
|
|
91
|
-
|
|
92
|
-
If a changeset includes or implies an ADR requirement, request the missing ADR work rather than approving.
|
|
93
|
-
|
|
94
|
-
## Repository Review Requirements
|
|
95
|
-
|
|
96
|
-
### Cross-Platform Requirement
|
|
97
|
-
|
|
98
|
-
- The project must work across Windows, macOS, and Linux. Do not accept platform-specific assumptions unless explicitly justified by the task.
|
|
99
|
-
|
|
100
|
-
### Project Behavior Requirement
|
|
101
|
-
|
|
102
|
-
- When invoked with a specific command and all required arguments, require deterministic CLI behavior and do not accept starting the TUI.
|
|
103
|
-
- When invoked with no arguments, require starting the interactive TUI for interactive selection.
|
|
104
|
-
|
|
105
|
-
### Test Coverage Requirement (STRICT)
|
|
106
|
-
|
|
107
|
-
**100% test coverage is mandatory - this is the bare minimum.**
|
|
108
|
-
|
|
109
|
-
- Require tests for all new functionality.
|
|
110
|
-
- Require existing tests to be updated when behavior changes.
|
|
111
|
-
- Do not approve changes that remove, skip, or disable tests without explicit clarification from the team.
|
|
112
|
-
|
|
113
|
-
If the project has known failing hygiene checks due to technical debt, follow the "Technical debt and known failing checks" policy in the persona instructions:
|
|
114
|
-
- Do not allow violations attributable to the active changeset.
|
|
115
|
-
- Require tracking items for baseline failures (or block approval until tracking exists).
|
package/CHANGELOG.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [2.0.3](https://github.com/meza/adr-tools/compare/v2.0.2...v2.0.3) (2026-07-17)
|
|
4
|
-
|
|
5
|
-
### Bug Fixes
|
|
6
|
-
|
|
7
|
-
* **cli:** resolve argv[1] symlink in isDirectRun ([#485](https://github.com/meza/adr-tools/issues/485)) ([056bc6e](https://github.com/meza/adr-tools/commit/056bc6ec9d8c24914b4159b76f35633d6870251b))
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
This repo builds and publishes `@meza/adr-tools`, a small Node.js CLI for managing Architecture Decision Records (ADRs).
|
|
4
|
-
This guide shows how to set up a working dev environment, run the checks CI runs, and open a PR that is easy to review.
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
|
|
8
|
-
- Node.js 22 (CI uses `22.x`)
|
|
9
|
-
|
|
10
|
-
## Quick start
|
|
11
|
-
|
|
12
|
-
Install dependencies:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
yarn install
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Run the full local verification (what CI runs):
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
yarn ci
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## How the repo is laid out
|
|
25
|
-
|
|
26
|
-
- `src/`: library + CLI entrypoint
|
|
27
|
-
- `src/templates/`: ADR templates that ship with the package
|
|
28
|
-
- `tests/`: e2e tests (exercise the CLI against a temp workspace)
|
|
29
|
-
- `doc/adr/`: ADRs for this repo (the tool itself)
|
|
30
|
-
|
|
31
|
-
## Development workflow
|
|
32
|
-
|
|
33
|
-
### Run the CLI locally
|
|
34
|
-
|
|
35
|
-
You can run the CLI directly from source:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npx -y tsx src/index.ts --help
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Common commands
|
|
42
|
-
|
|
43
|
-
All commands are defined in `package.json`. Prefer running scripts instead of calling tool binaries directly.
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Lint + typecheck
|
|
47
|
-
yarn lint
|
|
48
|
-
|
|
49
|
-
# Unit tests (under src/)
|
|
50
|
-
yarn test:unit
|
|
51
|
-
|
|
52
|
-
# E2E tests (under tests/)
|
|
53
|
-
yarn test:e2e
|
|
54
|
-
|
|
55
|
-
# Build dist/ (tsc + template copy)
|
|
56
|
-
yarn build
|
|
57
|
-
|
|
58
|
-
# Clean build artifacts
|
|
59
|
-
yarn clean
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Unit tests run with coverage by default. For e2e coverage, add `--coverage`:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
yarn test:unit
|
|
66
|
-
yarn test:e2e --coverage
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Required local checks
|
|
70
|
-
|
|
71
|
-
Before opening a PR, run:
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
yarn ci
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
This runs linting and tests in parallel using the repo's configured tooling.
|
|
78
|
-
|
|
79
|
-
## Code style
|
|
80
|
-
|
|
81
|
-
- Formatting and linting are enforced with Biome (`biome.json`).
|
|
82
|
-
- Keep changes small and focused. Add or update tests when behavior changes.
|
|
83
|
-
|
|
84
|
-
## Commits and changelog
|
|
85
|
-
|
|
86
|
-
This repo uses Conventional Commits (enforced by commitlint).
|
|
87
|
-
|
|
88
|
-
If you want an interactive prompt for commit messages:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
yarn commit
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## ADRs in this repo
|
|
95
|
-
|
|
96
|
-
ADRs for this repository live under `doc/adr/`. The location is configured by the `.adr-dir` file in the repo root.
|
|
97
|
-
|
|
98
|
-
To list ADRs:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npx -y -p @meza/adr-tools -- adr list
|
|
102
|
-
```
|
package/biome.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["@meza/biome"],
|
|
3
|
-
"files": {
|
|
4
|
-
"includes": [
|
|
5
|
-
"**/*.ts",
|
|
6
|
-
"**/*.css",
|
|
7
|
-
"**/*.tsx",
|
|
8
|
-
"**/*.json",
|
|
9
|
-
"!**/*.snap",
|
|
10
|
-
"!**/node_modules",
|
|
11
|
-
"!**/dist",
|
|
12
|
-
"!reports/**",
|
|
13
|
-
"!.yarn"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"linter": {
|
|
17
|
-
"rules": {
|
|
18
|
-
"complexity": {
|
|
19
|
-
"noExcessiveCognitiveComplexity": {
|
|
20
|
-
"level": "error",
|
|
21
|
-
"options": {
|
|
22
|
-
"maxAllowedComplexity": 10
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/dist/index.test.js
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
7
|
-
import { buildProgram, defaultOnError, isDirectRun, maybeRun, run } from './index.js';
|
|
8
|
-
const createDeps = () => {
|
|
9
|
-
const deps = {
|
|
10
|
-
generateToc: vi.fn(),
|
|
11
|
-
init: vi.fn(),
|
|
12
|
-
link: vi.fn(),
|
|
13
|
-
listAdrs: vi.fn(),
|
|
14
|
-
newAdr: vi.fn(),
|
|
15
|
-
workingDir: vi.fn(),
|
|
16
|
-
readFile: vi.fn(),
|
|
17
|
-
getLinksFrom: vi.fn(),
|
|
18
|
-
getTitleFrom: vi.fn(),
|
|
19
|
-
version: '1.2.3',
|
|
20
|
-
onError: vi.fn(),
|
|
21
|
-
log: vi.fn(),
|
|
22
|
-
warn: vi.fn()
|
|
23
|
-
};
|
|
24
|
-
return deps;
|
|
25
|
-
};
|
|
26
|
-
describe('adr CLI', () => {
|
|
27
|
-
const tempDirs = [];
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
for (const tempDir of tempDirs.splice(0)) {
|
|
30
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
it('wires program metadata', () => {
|
|
34
|
-
const deps = createDeps();
|
|
35
|
-
const program = buildProgram(deps);
|
|
36
|
-
expect(program.name()).toEqual('adr');
|
|
37
|
-
expect(program.version()).toEqual('1.2.3');
|
|
38
|
-
});
|
|
39
|
-
it('runs the new command with options', async () => {
|
|
40
|
-
const deps = createDeps();
|
|
41
|
-
await run(['node', 'adr', 'new', 'My', 'ADR', '--open'], deps);
|
|
42
|
-
expect(deps.newAdr).toHaveBeenCalledWith('My ADR', {
|
|
43
|
-
supersedes: [],
|
|
44
|
-
date: process.env.ADR_DATE,
|
|
45
|
-
suppressPrompts: false,
|
|
46
|
-
links: [],
|
|
47
|
-
open: true,
|
|
48
|
-
openWith: undefined
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
it('invokes error handler when newAdr fails', async () => {
|
|
52
|
-
const deps = createDeps();
|
|
53
|
-
deps.newAdr.mockRejectedValueOnce(new Error('boom'));
|
|
54
|
-
await run(['node', 'adr', 'new', 'My', 'ADR'], deps);
|
|
55
|
-
expect(deps.onError).toHaveBeenCalled();
|
|
56
|
-
});
|
|
57
|
-
it('routes generate toc', async () => {
|
|
58
|
-
const deps = createDeps();
|
|
59
|
-
await run(['node', 'adr', 'generate', 'toc', '-p', '/prefix/'], deps);
|
|
60
|
-
expect(deps.generateToc).toHaveBeenCalledWith({ prefix: '/prefix/' });
|
|
61
|
-
});
|
|
62
|
-
it('generates graph output', async () => {
|
|
63
|
-
const deps = createDeps();
|
|
64
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md', '/repo/doc/adr/0002-two.md']);
|
|
65
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
66
|
-
deps.getTitleFrom.mockReturnValue('ADR Title');
|
|
67
|
-
deps.getLinksFrom.mockReturnValue([
|
|
68
|
-
{ label: 'Relates to', targetNumber: '0002' },
|
|
69
|
-
{ label: 'Superseded by', targetNumber: '0003' }
|
|
70
|
-
]);
|
|
71
|
-
await run(['node', 'adr', 'generate', 'graph', '-e', '.md', '-p', '/p/'], deps);
|
|
72
|
-
const output = deps.log.mock.calls[0][0];
|
|
73
|
-
expect(output).toContain('digraph');
|
|
74
|
-
expect(output).toContain('_1 -> _2 [style="dotted"');
|
|
75
|
-
expect(output).toContain('label="Relates to"');
|
|
76
|
-
expect(output).not.toContain('Superseded by');
|
|
77
|
-
});
|
|
78
|
-
it('generates graph output with default prefix', async () => {
|
|
79
|
-
const deps = createDeps();
|
|
80
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md']);
|
|
81
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
82
|
-
deps.getTitleFrom.mockReturnValue('ADR Title');
|
|
83
|
-
deps.getLinksFrom.mockReturnValue([]);
|
|
84
|
-
await run(['node', 'adr', 'generate', 'graph'], deps);
|
|
85
|
-
const output = deps.log.mock.calls[0][0];
|
|
86
|
-
expect(output).toContain('0001-one.html');
|
|
87
|
-
});
|
|
88
|
-
it('links graph nodes by adr number', async () => {
|
|
89
|
-
const deps = createDeps();
|
|
90
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md', '/repo/doc/adr/0003-three.md']);
|
|
91
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
92
|
-
deps.getTitleFrom.mockReturnValue('ADR Title');
|
|
93
|
-
deps.getLinksFrom.mockReturnValue([{ label: 'Relates to', targetNumber: '3' }]);
|
|
94
|
-
await run(['node', 'adr', 'generate', 'graph'], deps);
|
|
95
|
-
const output = deps.log.mock.calls[0][0];
|
|
96
|
-
expect(output).toContain('_1 -> _3 [style="dotted"');
|
|
97
|
-
expect(output).toContain('_1 -> _3 [label="Relates to"');
|
|
98
|
-
});
|
|
99
|
-
it('skips graph links that target missing nodes', async () => {
|
|
100
|
-
const deps = createDeps();
|
|
101
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md']);
|
|
102
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
103
|
-
deps.getTitleFrom.mockReturnValue('ADR Title');
|
|
104
|
-
deps.getLinksFrom.mockReturnValue([{ label: 'Relates to', targetNumber: '99' }]);
|
|
105
|
-
await run(['node', 'adr', 'generate', 'graph'], deps);
|
|
106
|
-
const output = deps.log.mock.calls[0][0];
|
|
107
|
-
expect(output).not.toContain('_1 -> _99');
|
|
108
|
-
expect(deps.warn).toHaveBeenCalledWith('Skipping graph link from ADR 1 to missing ADR 99: Relates to');
|
|
109
|
-
});
|
|
110
|
-
it('skips files without numeric prefixes', async () => {
|
|
111
|
-
const deps = createDeps();
|
|
112
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/notes.md', '/repo/doc/adr/0001-one.md']);
|
|
113
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
114
|
-
deps.getTitleFrom.mockReturnValue('ADR Title');
|
|
115
|
-
deps.getLinksFrom.mockReturnValue([]);
|
|
116
|
-
await run(['node', 'adr', 'generate', 'graph'], deps);
|
|
117
|
-
expect(deps.readFile).toHaveBeenCalledTimes(2);
|
|
118
|
-
expect(deps.readFile).toHaveBeenNthCalledWith(1, '/repo/doc/adr/0001-one.md', 'utf8');
|
|
119
|
-
expect(deps.readFile).toHaveBeenNthCalledWith(2, '/repo/doc/adr/0001-one.md', 'utf8');
|
|
120
|
-
});
|
|
121
|
-
it('escapes graph labels and urls', async () => {
|
|
122
|
-
const deps = createDeps();
|
|
123
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md']);
|
|
124
|
-
deps.readFile.mockResolvedValue('# Title');
|
|
125
|
-
deps.getTitleFrom.mockReturnValue('ADR "Title" \\\\ path\nline');
|
|
126
|
-
deps.getLinksFrom.mockReturnValue([]);
|
|
127
|
-
await run(['node', 'adr', 'generate', 'graph', '-e', '.md', '-p', '/p/"weird"/'], deps);
|
|
128
|
-
const output = deps.log.mock.calls[0][0];
|
|
129
|
-
const match = output.match(/label="([\s\S]*?)"; URL="([^"]+)"/);
|
|
130
|
-
expect(match?.[1]).toContain(String.raw `ADR \"Title\" \\\\ path\\nline`);
|
|
131
|
-
expect(match?.[1]).not.toContain('\n');
|
|
132
|
-
expect(output).toContain(String.raw `URL="/p/\"weird\"/0001-one.md"`);
|
|
133
|
-
});
|
|
134
|
-
it('routes link command', async () => {
|
|
135
|
-
const deps = createDeps();
|
|
136
|
-
await run(['node', 'adr', 'link', '1', 'Amends', '2', 'Amended by'], deps);
|
|
137
|
-
const call = deps.link.mock.calls[0];
|
|
138
|
-
expect(call.slice(0, 4)).toEqual(['1', 'Amends', '2', 'Amended by']);
|
|
139
|
-
});
|
|
140
|
-
it('routes init command', async () => {
|
|
141
|
-
const deps = createDeps();
|
|
142
|
-
await run(['node', 'adr', 'init', 'doc/adr'], deps);
|
|
143
|
-
expect(deps.init).toHaveBeenCalledWith('doc/adr');
|
|
144
|
-
});
|
|
145
|
-
it('lists adrs relative to working dir', async () => {
|
|
146
|
-
const deps = createDeps();
|
|
147
|
-
deps.listAdrs.mockResolvedValue(['/repo/doc/adr/0001-one.md']);
|
|
148
|
-
deps.workingDir.mockReturnValue('/repo');
|
|
149
|
-
await run(['node', 'adr', 'list'], deps);
|
|
150
|
-
expect(deps.log).toHaveBeenCalledWith(path.join('doc', 'adr', '0001-one.md'));
|
|
151
|
-
});
|
|
152
|
-
it('collects repeated options for links and supersedes', async () => {
|
|
153
|
-
const deps = createDeps();
|
|
154
|
-
await run([
|
|
155
|
-
'node',
|
|
156
|
-
'adr',
|
|
157
|
-
'new',
|
|
158
|
-
'My',
|
|
159
|
-
'ADR',
|
|
160
|
-
'-l',
|
|
161
|
-
'1:Links:Linked by',
|
|
162
|
-
'-l',
|
|
163
|
-
'2:Relates:Related by',
|
|
164
|
-
'-s',
|
|
165
|
-
'1',
|
|
166
|
-
'-s',
|
|
167
|
-
'2'
|
|
168
|
-
], deps);
|
|
169
|
-
const [, options] = deps.newAdr.mock.calls[0];
|
|
170
|
-
expect(options.links).toEqual(['1:Links:Linked by', '2:Relates:Related by']);
|
|
171
|
-
expect(options.supersedes).toEqual(['1', '2']);
|
|
172
|
-
});
|
|
173
|
-
it('detects direct runs based on argv', () => {
|
|
174
|
-
const indexPath = path.resolve(process.cwd(), 'src/index.ts');
|
|
175
|
-
const moduleUrl = pathToFileURL(indexPath).href;
|
|
176
|
-
expect(isDirectRun(['node', indexPath], moduleUrl)).toBe(true);
|
|
177
|
-
expect(isDirectRun(['node'], moduleUrl)).toBe(false);
|
|
178
|
-
});
|
|
179
|
-
it('returns true when argv[1] is a symlink to the module (npm .bin link)', () => {
|
|
180
|
-
const tempDir = mkdtempSync(path.join(tmpdir(), 'adr-tools-'));
|
|
181
|
-
tempDirs.push(tempDir);
|
|
182
|
-
const distDir = path.join(tempDir, 'dist');
|
|
183
|
-
const binDir = path.join(tempDir, '.bin');
|
|
184
|
-
mkdirSync(distDir, { recursive: true });
|
|
185
|
-
mkdirSync(binDir, { recursive: true });
|
|
186
|
-
const targetPath = path.join(distDir, 'index.js');
|
|
187
|
-
const linkPath = path.join(binDir, 'adr');
|
|
188
|
-
writeFileSync(targetPath, 'export {};\n');
|
|
189
|
-
symlinkSync(targetPath, linkPath);
|
|
190
|
-
const moduleUrl = pathToFileURL(targetPath).href;
|
|
191
|
-
expect(isDirectRun(['node', linkPath], moduleUrl)).toBe(true);
|
|
192
|
-
});
|
|
193
|
-
it('returns false when maybeRun is not direct', () => {
|
|
194
|
-
const deps = createDeps();
|
|
195
|
-
expect(maybeRun(['node', '/other/entry'], deps)).toBe(false);
|
|
196
|
-
});
|
|
197
|
-
it('runs when maybeRun detects direct execution', async () => {
|
|
198
|
-
const deps = createDeps();
|
|
199
|
-
deps.listAdrs.mockResolvedValue([]);
|
|
200
|
-
const indexPath = path.resolve(process.cwd(), 'src/index.ts');
|
|
201
|
-
expect(maybeRun(['node', indexPath, 'list'], deps)).toBe(true);
|
|
202
|
-
expect(deps.listAdrs).toHaveBeenCalled();
|
|
203
|
-
});
|
|
204
|
-
it('handles rejected direct runs without an unhandled rejection', async () => {
|
|
205
|
-
const deps = createDeps();
|
|
206
|
-
deps.listAdrs.mockRejectedValueOnce(new Error('boom'));
|
|
207
|
-
const indexPath = path.resolve(process.cwd(), 'src/index.ts');
|
|
208
|
-
expect(maybeRun(['node', indexPath, 'list'], deps)).toBe(true);
|
|
209
|
-
await vi.waitFor(() => expect(deps.listAdrs).toHaveBeenCalled());
|
|
210
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
211
|
-
});
|
|
212
|
-
it('formats errors with the default handler', () => {
|
|
213
|
-
const errorHandler = vi.fn();
|
|
214
|
-
const program = { error: errorHandler };
|
|
215
|
-
defaultOnError(program, new Error('boom'));
|
|
216
|
-
expect(errorHandler).toHaveBeenCalledWith(chalk.red('boom'), { exitCode: 1 });
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
//# sourceMappingURL=index.test.js.map
|
package/dist/index.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"src/","sources":["index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,YAA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C,gBAAgB,EAAE,CAAC,CAAC;QACjE,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,EAAwB,CAAC;QAC9D,cAAc,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,YAAY,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
// @ts-expect-error no module types for script import
|
|
6
|
-
import { buildVersionSource, resolveTargetPath, writeVersionFile } from '../scripts/inject-version.mjs';
|
|
7
|
-
describe('inject-version script helpers', () => {
|
|
8
|
-
it('builds the version export', () => {
|
|
9
|
-
expect(buildVersionSource('1.2.3')).toBe("export const LIB_VERSION = '1.2.3';\n");
|
|
10
|
-
});
|
|
11
|
-
it('requires an output path', () => {
|
|
12
|
-
expect(() => resolveTargetPath(['node', 'scripts/inject-version.mjs'])).toThrow('Usage: node scripts/inject-version.mjs <output-file>');
|
|
13
|
-
});
|
|
14
|
-
it('writes the version file', () => {
|
|
15
|
-
const tmpDir = mkdtempSync(path.join(os.tmpdir(), 'adr-version-'));
|
|
16
|
-
const targetPath = path.join(tmpDir, 'version.ts');
|
|
17
|
-
try {
|
|
18
|
-
writeVersionFile(targetPath, '9.9.9');
|
|
19
|
-
const contents = readFileSync(targetPath, 'utf8');
|
|
20
|
-
expect(contents).toBe("export const LIB_VERSION = '9.9.9';\n");
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=inject-version.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject-version.test.js","sourceRoot":"src/","sources":["inject-version.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,qDAAqD;AACrD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAExG,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC,CAAC,OAAO,CAC7E,sDAAsD,CACvD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,E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