energy-state-analyzer 0.23.2 → 0.23.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/CHANGELOG.md +17 -1
- package/dist/cli.js +1 -1
- package/docs/agent-integration.md +6 -3
- package/docs/cli.md +1 -1
- package/docs/detectors/file-coherence.md +2 -0
- package/package.json +1 -4
|
@@ -46,10 +46,13 @@ any medium/high-severity violation is found (`0` otherwise). That exit code lets
|
|
|
46
46
|
refinement loop; inspect the report to distinguish findings from analysis failures:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
npx energy-state-analyzer path/to/file.py --report json # or .fs / .
|
|
49
|
+
npx energy-state-analyzer path/to/file.py --report json # or .fs / .ts / .kt / .cpp / .cs / .erl / .rs
|
|
50
50
|
echo $? # 0 = no blocking findings; 1 = blocking findings or analysis failure
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
See [supported file suffixes](cli.md#supported-file-suffixes) for the complete list, including
|
|
54
|
+
Erlang headers, F# scripts, and C++ headers.
|
|
55
|
+
|
|
53
56
|
Findings live under `files[].violations` in the JSON report. Each finding includes its zero-based `line` and `column`, the violation `type`, its
|
|
54
57
|
`severity`, the detector `message` (which contains a concrete suggested fix), and any `hotspots`.
|
|
55
58
|
The agent uses the locations and suggested fixes to resolve valid findings, verifies behavior,
|
|
@@ -235,7 +238,7 @@ repos:
|
|
|
235
238
|
name: Energy State Analyzer
|
|
236
239
|
entry: npx energy-state-analyzer
|
|
237
240
|
language: system
|
|
238
|
-
files: '\.(py|fs|fsx|ts|kt|cpp|cs)$'
|
|
241
|
+
files: '\.(py|fs|fsx|fsi|ts|kt|kts|cpp|cppm|cc|ccm|cxx|cxxm|c\+\+|c\+\+m|hpp|hh|hxx|h\+\+|h|ii|ino|inl|ipp|ixx|mpp|mxx|tpp|txx|hpp\.in|h\.in|cs|csx|erl|hrl|rs)$'
|
|
239
242
|
pass_filenames: true
|
|
240
243
|
```
|
|
241
244
|
|
|
@@ -258,7 +261,7 @@ Merge these entries into `package.json`, preserving existing scripts. Husky init
|
|
|
258
261
|
"prepare": "husky"
|
|
259
262
|
},
|
|
260
263
|
"lint-staged": {
|
|
261
|
-
"*.{py,fs,fsx,ts,kt,cpp,cs}": ["energy-state-analyzer"]
|
|
264
|
+
"*.{py,fs,fsx,fsi,ts,kt,kts,cpp,cppm,cc,ccm,cxx,cxxm,c++,c++m,hpp,hh,hxx,h++,h,ii,ino,inl,ipp,ixx,mpp,mxx,tpp,txx,hpp.in,h.in,cs,csx,erl,hrl,rs}": ["energy-state-analyzer"]
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
267
|
```
|
package/docs/cli.md
CHANGED
|
@@ -75,7 +75,7 @@ npx energy-state-analyzer src --report sarif
|
|
|
75
75
|
|
|
76
76
|
Each SARIF result has a stable `ESA###` rule ID (for example, `ESA006` for magic literals), a one-based source location, a severity mapped to SARIF `error`/`warning`/`note`, and the detector message with its concrete remediation guidance. The default JSON report carries the same findings in a flat `files[].violations[]` shape at roughly half SARIF's size, so there is nothing to walk; use `md` or `human` for human-readable output. SARIF is available for scan mode; `--base-ref` continues to emit its score-delta JSON or Markdown report.
|
|
77
77
|
|
|
78
|
-
In VS Code, run **Energy State Analyzer: Export SARIF Report** to scan the open workspace and write `.energy-state/latest.sarif`.
|
|
78
|
+
In VS Code, run **Energy State Analyzer: Export SARIF Report** to scan the open workspace and write `.energy-state/latest.sarif`. Optionally install the [SARIF Viewer](https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer) and open that file for its report panel, grouping, and filtering.
|
|
79
79
|
|
|
80
80
|
Only one glob shape is supported: a trailing `**/*.ext` pattern on an otherwise literal directory prefix (e.g. `src/**/*.py`). There's no brace expansion, negation, or mid-path wildcards, pass explicit directories/files for anything more complex.
|
|
81
81
|
|
|
@@ -28,6 +28,8 @@ If a file is still going to be flagged and its type signal is confidently measur
|
|
|
28
28
|
|
|
29
29
|
The count is a dependency-surface signal, not proof that the file has multiple responsibilities. A cohesive cross-cutting test or composition root can legitimately use many dependencies, especially when one capability is exposed through several sibling modules. In that case, first consider a focused facade or qualified access through the common parent; do not split the file solely to reduce the count. A facade is appropriate only when its exports form a coherent capability — a catch-all re-export module just hides genuine coupling.
|
|
30
30
|
|
|
31
|
+
Recognized facade re-exports do not contribute to import breadth, member fan-out, or import scope pollution. Rust visibility-marked `pub use` declarations count as re-exports in declarative module facades; private `use` declarations and public uses alongside implementation work still count in `mod.rs`. Python relative `from` imports count as re-exports in an import-only `__init__.py` only when every binding appears in a static `__all__` or uses a same-name alias (`from .part import Name as Name`). Plain imports remain dependencies because tools using [mypy's `--no-implicit-reexport`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport) do not treat them as public exports. Absolute imports and initializers with executable work still count. TypeScript `export … from` declarations are already outside the import count, and an `import` followed by `export { … }` is treated as a re-export when every imported binding is exported and the file contains only imports and re-export statements. This syntax-level distinction does not establish that a public facade is cohesive or cheap to load; [Vite's barrel guidance](https://vite.dev/guide/performance#avoid-barrel-files) describes costs that depend on the consumer and its tooling.
|
|
32
|
+
|
|
31
33
|
**Import member fan-out.** Ten or more explicitly imported declarations from one source are flagged, even when that source counts as only one dependency. Kotlin uses a fixed threshold of 30 because one-declaration-per-import syntax is idiomatic for large external APIs. The configurable threshold applies to other languages. This signal can also arise from Python `from` imports or TypeScript named imports. The message asks whether the file is an intentional composition boundary; it does not prescribe a split or a wildcard import.
|
|
32
34
|
|
|
33
35
|
**Import scope pollution.** A wildcard import is flagged directly because it makes an external scope available without qualification. For F# specifically, the detector also reports **Import scope sprawl** when seven or more opened modules share a parent namespace: `open` brings each module's values into lexical scope, so names can shadow one another and an unqualified reference obscures its origin. Prefer qualified access (for example, `Energy.Languages.Python.pythonLanguageAdapter`) or a small named module alias. C++ `#include` does not have this meaning; `using namespace` is its corresponding scope construct and is outside this detector's current grammar coverage.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "energy-state-analyzer",
|
|
3
3
|
"displayName": "Energy State Analyzer",
|
|
4
4
|
"description": "Visualize code energy states in real-time (Python, F#, TypeScript, Kotlin, C++, C#, Erlang, Rust)",
|
|
5
|
-
"version": "0.23.
|
|
5
|
+
"version": "0.23.4",
|
|
6
6
|
"publisher": "cardamom-code",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"icon": "images/icon.png",
|
|
@@ -49,9 +49,6 @@
|
|
|
49
49
|
"energy-state-analyzer": "./dist/cli.js",
|
|
50
50
|
"energy-state-cli": "./dist/cli.js"
|
|
51
51
|
},
|
|
52
|
-
"extensionPack": [
|
|
53
|
-
"ms-sarifvscode.sarif-viewer"
|
|
54
|
-
],
|
|
55
52
|
"contributes": {
|
|
56
53
|
"languages": [
|
|
57
54
|
{
|