@legacycodehq/clarity 0.26.0 → 0.28.0
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/README.md +179 -80
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,146 +6,245 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@legacycodehq/clarity)
|
|
7
7
|
[](https://goreportcard.com/report/github.com/LegacyCodeHQ/clarity)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
See the structure of a code change before you commit it.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Clarity builds dependency impact graphs from source code. It shows how files,
|
|
12
|
+
modules, tests, and documentation connect so developers and coding agents can
|
|
13
|
+
reason about design changes with evidence instead of intuition.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Use it when you want to know:
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
- What does this change touch?
|
|
18
|
+
- Who depends on this file?
|
|
19
|
+
- Why are these two areas connected?
|
|
20
|
+
- Did this refactor cross a boundary?
|
|
21
|
+
- Did we introduce a cycle?
|
|
22
|
+
- What does this branch look like structurally?
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- Run repeatable design checks in developer and coding-agent workflows, with shareable visualization output when needed.
|
|
24
|
+
Clarity works at file granularity. It recovers coupling shape, not runtime
|
|
25
|
+
behavior or full API contracts.
|
|
20
26
|
|
|
21
27
|
## Quick Start
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Install with npm:
|
|
24
30
|
|
|
25
|
-
```
|
|
31
|
+
```sh
|
|
26
32
|
npm install -g @legacycodehq/clarity
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
Or
|
|
35
|
+
Or on macOS/Linux with Homebrew:
|
|
30
36
|
|
|
31
|
-
```
|
|
37
|
+
```sh
|
|
32
38
|
brew install LegacyCodeHQ/tap/clarity
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
Keep a live graph open while you code:
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
```sh
|
|
44
|
+
clarity watch
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Show the structural impact of your uncommitted work:
|
|
38
48
|
|
|
39
|
-
```
|
|
40
|
-
clarity
|
|
49
|
+
```sh
|
|
50
|
+
clarity show
|
|
41
51
|
```
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
Find what depends on a file before changing it:
|
|
44
54
|
|
|
45
|
-
```
|
|
46
|
-
clarity
|
|
55
|
+
```sh
|
|
56
|
+
clarity show path/to/file.go --reach up
|
|
47
57
|
```
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
Review the structural footprint of a branch:
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
```sh
|
|
62
|
+
clarity show -c main...HEAD
|
|
63
|
+
```
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
## The Model
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
- Review architecture and design impact quickly during feature work.
|
|
57
|
-
- Give coding agents concrete feedback grounded in actual low-level design.
|
|
67
|
+
Every graph answers four questions.
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
| Question | Meaning | Examples |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| Which snapshot? | working tree, commit, or range | `clarity show`, `-c HEAD`, `-c main...HEAD` |
|
|
72
|
+
| What anchor? | changed files, paths, modules, whole tree, paths between files | `src/auth`, `--module auth`, `--all`, `--between a,b` |
|
|
73
|
+
| What lens? | how much context or abstraction to apply | `--reach up`, `--reach down`, `--depth 2`, `--collapse` |
|
|
74
|
+
| What rendering? | how to output the graph | DOT, Mermaid, browser URL, live UI |
|
|
60
75
|
|
|
61
|
-
|
|
76
|
+
This makes Clarity useful for both quick local checks and repeatable agent
|
|
77
|
+
workflows.
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
## Core Use Cases
|
|
64
80
|
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
### Review a Change Before Commit
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
clarity show
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Shows the dependency graph around your uncommitted work.
|
|
88
|
+
|
|
89
|
+
Use it to check:
|
|
90
|
+
|
|
91
|
+
- whether the change stayed inside the intended area
|
|
92
|
+
- which neighboring files are affected
|
|
93
|
+
- whether tests are connected to the changed code
|
|
94
|
+
- whether new coupling appeared
|
|
95
|
+
|
|
96
|
+
### Review a Commit, Branch, or PR
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
clarity show -c HEAD
|
|
100
|
+
clarity show -c main...HEAD
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use commit and range snapshots to review structural impact after the fact. This
|
|
104
|
+
is useful for pull requests, regression windows, release reviews, and
|
|
105
|
+
agent-generated changes.
|
|
106
|
+
|
|
107
|
+
### Refactor Safely
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
clarity show path/to/file.go --reach up
|
|
111
|
+
clarity show path/to/file.go --reach both --depth 2
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Use upstream reach to answer "who imports this?" before changing a file. Use
|
|
115
|
+
bounded reach to estimate blast radius.
|
|
116
|
+
|
|
117
|
+
### Understand a Codebase
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
clarity show src/auth
|
|
121
|
+
clarity show src/auth --reach both
|
|
122
|
+
clarity show --all --collapse
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Use scoped graphs to explore unfamiliar code. Collapse configured modules when
|
|
126
|
+
the file-level graph is too noisy.
|
|
127
|
+
|
|
128
|
+
### Trace Unexpected Coupling
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
clarity show --between ui/login.ts,server/session.go
|
|
67
132
|
```
|
|
68
133
|
|
|
69
|
-
|
|
134
|
+
Shows the dependency paths connecting two files. Use this when you need to
|
|
135
|
+
explain why two areas are coupled or decide where to cut a dependency.
|
|
70
136
|
|
|
71
|
-
|
|
137
|
+
### Audit Module Boundaries
|
|
72
138
|
|
|
73
|
-
|
|
74
|
-
|
|
139
|
+
```sh
|
|
140
|
+
clarity modules
|
|
141
|
+
clarity show --module auth --reach both
|
|
142
|
+
clarity show --all --collapse
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Declare modules in `.clarity/modules.json`, inspect a module in context, or
|
|
146
|
+
collapse modules into architecture-level nodes.
|
|
75
147
|
|
|
76
|
-
|
|
148
|
+
### Find Circular Dependencies
|
|
77
149
|
|
|
78
|
-
```
|
|
79
|
-
clarity
|
|
80
|
-
clarity
|
|
81
|
-
clarity show -c HEAD~3...HEAD # Visualize a commit range
|
|
150
|
+
```sh
|
|
151
|
+
clarity cycles src
|
|
152
|
+
clarity cycles src --url
|
|
82
153
|
```
|
|
83
154
|
|
|
84
|
-
|
|
155
|
+
Lists circular dependencies within a scope and can produce focused
|
|
156
|
+
visualizations for each cycle.
|
|
85
157
|
|
|
86
|
-
|
|
158
|
+
### Keep Feedback Live While Coding
|
|
87
159
|
|
|
88
|
-
```
|
|
89
|
-
clarity
|
|
90
|
-
clarity
|
|
160
|
+
```sh
|
|
161
|
+
clarity watch
|
|
162
|
+
clarity watch src/auth --reach both
|
|
91
163
|
```
|
|
92
164
|
|
|
93
|
-
|
|
165
|
+
Runs a local live graph that updates as files change. Use it during refactors or
|
|
166
|
+
large agent edits to keep structural feedback visible.
|
|
94
167
|
|
|
95
|
-
|
|
168
|
+
### Support Coding Agents
|
|
96
169
|
|
|
97
|
-
|
|
170
|
+
```sh
|
|
171
|
+
clarity setup
|
|
172
|
+
```
|
|
98
173
|
|
|
99
|
-
|
|
174
|
+
Adds repository instructions so coding agents can use Clarity as part of their
|
|
175
|
+
normal loop.
|
|
100
176
|
|
|
101
|
-
|
|
102
|
-
|--------------------------------------------------------------|-------------------------|--------------------------------------------------------------------------------|
|
|
103
|
-
| You are actively coding and want continuous feedback | `clarity watch` | Keeps a live view updated as files change so you can catch design drift early. |
|
|
104
|
-
| You want a point-in-time view of current uncommitted work | `clarity show` | Produces a snapshot of what your current changes impact. |
|
|
105
|
-
| You are reviewing committed history (single commit or range) | `clarity show -c <rev>` | Focuses analysis on specific commits for review or debugging. |
|
|
106
|
-
| You want a shareable/browser-friendly view | `clarity show -u` | Generates a visualization URL you can open or share. |
|
|
177
|
+
Good agent patterns:
|
|
107
178
|
|
|
108
|
-
|
|
179
|
+
- inspect dependents before refactoring with `--reach up`
|
|
180
|
+
- run `clarity show -f mermaid` after edits
|
|
181
|
+
- generate `clarity show -u` for a shareable review artifact
|
|
182
|
+
- use the graph to catch unexpected coupling before commit
|
|
109
183
|
|
|
110
|
-
|
|
184
|
+
## Output
|
|
111
185
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
186
|
+
```sh
|
|
187
|
+
clarity show -f dot
|
|
188
|
+
clarity show -f mermaid
|
|
189
|
+
clarity show -u
|
|
190
|
+
```
|
|
115
191
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<small>Clarity highlights impacted files and related tests so you can review design impact before commit.</small>
|
|
119
|
-
</p>
|
|
192
|
+
DOT is the default. Mermaid works well in docs, IDEs, and agent UIs. `-u`
|
|
193
|
+
creates a browser-friendly visualization URL.
|
|
120
194
|
|
|
121
|
-
|
|
122
|
-
In desktop products, agents can render Mermaid diagrams inline.
|
|
123
|
-
In CLI workflows, agents are configured to open a generated visualization URL in a new browser tab when showing design output.
|
|
195
|
+
## Language Support
|
|
124
196
|
|
|
125
|
-
|
|
197
|
+
Clarity supports dependency extraction for:
|
|
126
198
|
|
|
127
|
-
- C
|
|
128
|
-
- C++
|
|
129
|
-
- C#
|
|
199
|
+
- C, C++, C#
|
|
130
200
|
- Dart
|
|
131
201
|
- Go
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
- Python
|
|
137
|
-
- Ruby
|
|
202
|
+
- Java, Kotlin, Scala
|
|
203
|
+
- JavaScript, TypeScript, Svelte
|
|
204
|
+
- Markdown
|
|
205
|
+
- Python, Ruby
|
|
138
206
|
- Rust
|
|
139
|
-
- Scala
|
|
140
|
-
- Svelte
|
|
141
207
|
- Swift
|
|
142
|
-
- TypeScript
|
|
143
208
|
- Zig
|
|
144
209
|
|
|
145
|
-
|
|
210
|
+
Support quality varies by language. Run:
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
clarity languages
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
to see the current maturity and extension list.
|
|
217
|
+
|
|
218
|
+
## Experimental Surfaces
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
clarity cycles
|
|
222
|
+
clarity workspace
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`cycles` reports circular file dependencies.
|
|
226
|
+
|
|
227
|
+
`workspace` builds Go module and Rust crate relationship graphs.
|
|
228
|
+
|
|
229
|
+
These surfaces are useful, but their output may change.
|
|
230
|
+
|
|
231
|
+
## What Clarity Is Not
|
|
232
|
+
|
|
233
|
+
Clarity is not a replacement for tests, type checks, linters, or code review.
|
|
234
|
+
|
|
235
|
+
It does not provide:
|
|
236
|
+
|
|
237
|
+
- full symbol-level call graphs
|
|
238
|
+
- runtime behavior analysis
|
|
239
|
+
- API contract verification
|
|
240
|
+
- semantic correctness guarantees
|
|
241
|
+
|
|
242
|
+
It is a structural verification tool: it shows coupling, impact, boundaries,
|
|
243
|
+
cycles, and change shape.
|
|
146
244
|
|
|
147
245
|
## License
|
|
148
246
|
|
|
149
247
|
This project is licensed under the [GNU Affero General Public License v3.0](LICENSE).
|
|
150
248
|
|
|
151
|
-
Copyright
|
|
249
|
+
Copyright (c) 2026-present, Legacy Code Headquarters (OPC) Private Limited. All
|
|
250
|
+
rights reserved.
|