@legacycodehq/clarity 0.27.0 → 0.28.1

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.
Files changed (2) hide show
  1. package/README.md +179 -80
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,146 +6,245 @@
6
6
  [![npm version](https://img.shields.io/npm/v/@legacycodehq/clarity)](https://www.npmjs.com/package/@legacycodehq/clarity)
7
7
  [![Go Report Card](https://goreportcard.com/badge/github.com/LegacyCodeHQ/clarity)](https://goreportcard.com/report/github.com/LegacyCodeHQ/clarity)
8
8
 
9
- Clarity is a software design tool for AI-native developers and coding agents.
9
+ See the structure of a code change before you commit it.
10
10
 
11
- **Note:** Clarity supports [**17 languages**](#supported-languages) (parsing quality may vary by language).
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
- ## What You Get
15
+ Use it when you want to know:
14
16
 
15
- Clarity generates impact graphs from your code so you can review design effects before commit.
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
- - Keep a live impact view while coding with `clarity watch`.
18
- - Generate focused snapshots for uncommitted changes, commits, commit ranges, and file-to-file paths with `clarity show`.
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
- **Step 1:** Install with npm (cross-platform):
29
+ Install with npm:
24
30
 
25
- ```bash
31
+ ```sh
26
32
  npm install -g @legacycodehq/clarity
27
33
  ```
28
34
 
29
- Or install on macOS/Linux using Homebrew:
35
+ Or on macOS/Linux with Homebrew:
30
36
 
31
- ```bash
37
+ ```sh
32
38
  brew install LegacyCodeHQ/tap/clarity
33
39
  ```
34
40
 
35
- For more install options see the [installation guide](docs/usage/installation.md).
41
+ Keep a live graph open while you code:
36
42
 
37
- **Step 2:** Inside your project:
43
+ ```sh
44
+ clarity watch
45
+ ```
46
+
47
+ Show the structural impact of your uncommitted work:
38
48
 
39
- ```bash
40
- clarity setup # Configures AGENTS.md for your coding agent to use Clarity
49
+ ```sh
50
+ clarity show
41
51
  ```
42
52
 
43
- **Step 3:** Start with a live impact view while you code:
53
+ Find what depends on a file before changing it:
44
54
 
45
- ```bash
46
- clarity watch
55
+ ```sh
56
+ clarity show path/to/file.go --reach up
47
57
  ```
48
58
 
49
- ## Developers & Agents
59
+ Review the structural footprint of a branch:
50
60
 
51
- Clarity helps teams using coding agents make safer, faster design changes.
61
+ ```sh
62
+ clarity show -c main...HEAD
63
+ ```
52
64
 
53
- **For developers**, the value is practical:
65
+ ## The Model
54
66
 
55
- - Understand what a change will affect before commit.
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
- **For agents**, Clarity provides a deterministic and repeatable way to verify and validate their design changes.
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
- ### Developer Workflows
76
+ This makes Clarity useful for both quick local checks and repeatable agent
77
+ workflows.
62
78
 
63
- #### 1) During development: keep impact visible while making changes
79
+ ## Core Use Cases
64
80
 
65
- ```bash
66
- clarity watch
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
- Use `clarity watch` during active development to keep design impact visible as the codebase evolves.
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
- #### 2) Before committing: generate focused change context
137
+ ### Audit Module Boundaries
72
138
 
73
- If your coding agent is already configured with Clarity via `clarity setup` (one-time), the agent can run these commands and render
74
- a diagram for you.
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
- If not, run them manually as part of your development flow.
148
+ ### Find Circular Dependencies
77
149
 
78
- ```bash
79
- clarity show # Visualize uncommitted changes
80
- clarity show -c HEAD # Visualize the latest commit
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
- Use this output to answer: "What did we actually touch?", "What does the solution look like?" and "Which parts of the system are now coupled?"
155
+ Lists circular dependencies within a scope and can produce focused
156
+ visualizations for each cycle.
85
157
 
86
- #### 3) Explore the codebase and debug design decisions: trace specific relationships
158
+ ### Keep Feedback Live While Coding
87
159
 
88
- ```bash
89
- clarity show -i src,tests # Build graph from specific files/directories
90
- clarity show -w a.go,b.go # Show all paths between files
160
+ ```sh
161
+ clarity watch
162
+ clarity watch src/auth --reach both
91
163
  ```
92
164
 
93
- **Note:** Use the `-u` flag, as in `clarity show -u` to generate a shareable visualization URL.
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
- > **💡 Tip:** During design discussions, use actual graphs to explain or challenge design decisions with evidence instead of intuition.
168
+ ### Support Coding Agents
96
169
 
97
- #### When to Use `watch` vs `show`
170
+ ```sh
171
+ clarity setup
172
+ ```
98
173
 
99
- If your coding agent is configured using `clarity setup`, running `clarity show` manually is optional.
174
+ Adds repository instructions so coding agents can use Clarity as part of their
175
+ normal loop.
100
176
 
101
- | Use case | Command | Why |
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
- ### Agent Workflow
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
- If you use a coding agent, set up Clarity once so the agent can include design checks in its normal loop.
184
+ ## Output
111
185
 
112
- 1. Run `clarity setup` in your repository.
113
- 2. Confirm `AGENTS.md` includes Clarity instructions.
114
- 3. Ask your agent to run `clarity show` after meaningful changes and use the output in its review.
186
+ ```sh
187
+ clarity show -f dot
188
+ clarity show -f mermaid
189
+ clarity show -u
190
+ ```
115
191
 
116
- <p align="center">
117
- <img src="docs/images/clarity+codex-app.png" alt="Clarity graph in Codex app">
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
- Clarity works across desktop and CLI-based agent workflows.
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
- ## Supported Languages
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
- - JavaScript
133
- - Java
134
- - Kotlin
135
- - Markdown (`.md`, `.markdown`) — relative and site-absolute links between docs
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 © 2026-present, Legacy Code Headquarters (OPC) Private Limited. All rights reserved.
249
+ Copyright (c) 2026-present, Legacy Code Headquarters (OPC) Private Limited. All
250
+ rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legacycodehq/clarity",
3
- "version": "0.27.0",
3
+ "version": "0.28.1",
4
4
  "description": "Clarity CLI npm wrapper package",
5
5
  "license": "AGPL-3.0-only",
6
6
  "homepage": "https://github.com/LegacyCodeHQ/clarity-cli",