energy-state-analyzer 0.8.0 → 0.9.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.
Files changed (33) hide show
  1. package/.vscodeignore +2 -0
  2. package/AGENTS.md +5 -4
  3. package/CHANGELOG.md +21 -1
  4. package/README.md +5 -4
  5. package/dist/cli.js +1 -1
  6. package/docs/architecture.md +8 -3
  7. package/docs/cli.md +15 -1
  8. package/docs/detectors/README.md +6 -0
  9. package/docs/detectors/cognitive-complexity.md +4 -0
  10. package/docs/detectors/cyclomatic-complexity.md +6 -1
  11. package/docs/detectors/excessive-nesting.md +4 -1
  12. package/docs/detectors/file-coherence.md +4 -2
  13. package/docs/detectors/inversion-opportunities.md +1 -1
  14. package/docs/detectors/logical-operator-control-flow.md +2 -1
  15. package/docs/detectors/magic-numbers.md +8 -2
  16. package/docs/detectors/magic-strings.md +1 -1
  17. package/docs/detectors/match-opportunities.md +5 -2
  18. package/docs/detectors/opaque-boolean-literal.md +5 -0
  19. package/docs/detectors/parameter-explosion.md +1 -1
  20. package/docs/detectors/primitive-obsession.md +4 -4
  21. package/docs/fable-rewrite-plan.md +9 -5
  22. package/grammars/tree-sitter-cpp.LICENSE +21 -0
  23. package/grammars/tree-sitter-cpp.NOTICE.md +7 -0
  24. package/grammars/tree-sitter-cpp.wasm +0 -0
  25. package/grammars/tree-sitter-fsharp.LICENSE +21 -0
  26. package/grammars/tree-sitter-fsharp.NOTICE.md +7 -0
  27. package/grammars/tree-sitter-kotlin.LICENSE +21 -0
  28. package/grammars/tree-sitter-kotlin.NOTICE.md +11 -0
  29. package/grammars/tree-sitter-python.LICENSE +21 -0
  30. package/grammars/tree-sitter-python.NOTICE.md +7 -0
  31. package/grammars/tree-sitter-typescript.LICENSE +21 -0
  32. package/grammars/tree-sitter-typescript.NOTICE.md +7 -0
  33. package/package.json +8 -6
package/.vscodeignore CHANGED
@@ -18,6 +18,8 @@ vsc-extension-quickstart.md
18
18
  **/obj/**
19
19
  **/fable_modules/**
20
20
  **/.vscode-test.*
21
+ *.tgz
22
+ *.vsix
21
23
  .claude/**
22
24
  CLAUDE.md
23
25
  energy-state.md
package/AGENTS.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Project overview
4
4
 
5
- Energy State Analyzer is a VS Code extension and CLI that analyze Python, F#, TypeScript, and
6
- Kotlin through `web-tree-sitter` grammars in `grammars/`. Product source is F# and is compiled
5
+ Energy State Analyzer is a VS Code extension and CLI that analyze Python, F#, TypeScript, Kotlin,
6
+ and C++ through `web-tree-sitter` grammars in `grammars/`. Product source is F# and is compiled
7
7
  by Fable 5 to JavaScript before webpack packages the extension and CLI.
8
8
 
9
9
  See `energy-state.md` for the original design rationale and `docs/fable-rewrite-plan.md` for the
@@ -43,7 +43,7 @@ order.
43
43
  - **`src/Core/`**: host-independent synchronous detector pipeline, tree-sitter facade,
44
44
  suppression, scanning, and report rendering. `Analyze.fs` is the one detector composition
45
45
  point shared by extension and CLI.
46
- - **`src/Languages/`**: grammar-specific `LanguageAdapter` records for the four supported
46
+ - **`src/Languages/`**: grammar-specific `LanguageAdapter` records for the five supported
47
47
  analyzed languages.
48
48
  - **`src/Extension/`**: VS Code Fable facade, configuration boundary, grammar cache, analysis
49
49
  orchestration, editor/Problems presentation, and `Extension.fs` composition root. The narrow
@@ -56,7 +56,8 @@ order.
56
56
  bindings, and Fable entry point. Scan, legacy single-file, `--report`, `--base-ref`, and
57
57
  thresholds share the Core pipeline.
58
58
  - **`tests/`**: F# Scriptorium suites. `src/test/fixtures/` is retained only as multi-language
59
- analyzer input, including `.ts` fixtures; it is not TypeScript product or test code.
59
+ analyzer input, including `.ts` and `.cpp` fixtures; it is not product or test implementation
60
+ source in those languages.
60
61
 
61
62
  The extension composition root owns lifecycle state, grammar caches, decorations, diagnostics,
62
63
  commands, and editor/document/configuration event subscriptions. Presentation never leaks into
package/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 01777cc27c9c08136661a2f1e21409cdf94f05ce
2
+ last_commit_released: 49ef35194407cbc9ca2f63e4248fd1683e03a3f6
3
3
  name: energy-state-analyzer
4
4
  updaters:
5
5
  - command: npm version {version} --no-git-tag-version --allow-same-version
@@ -11,6 +11,26 @@ All notable changes to the "energy-state-analyzer" extension are generated by
11
11
  [EasyBuild.ShipIt](https://github.com/easybuild-org/EasyBuild.ShipIt) from
12
12
  [Conventional Commits](https://www.conventionalcommits.org/).
13
13
 
14
+ ## 0.9.0 - 2026-09-01
15
+
16
+ ### 🚀 Features
17
+
18
+ * *(cpp)* Add C++ analysis support (#61) ([8a81808](https://github.com/cardamomcode/energy-state-analyzer/commit/8a818080a901b0a93d5b2c55ba75f30e36391133))
19
+
20
+ ### 🐞 Bug Fixes
21
+
22
+ * *(ci)* Handle energy diff reports from forks (#63) ([3ac23aa](https://github.com/cardamomcode/energy-state-analyzer/commit/3ac23aa0f1167ec2d96aae7f75e5518587097c12))
23
+
24
+ <strong><small>[View changes on Github](https://github.com/cardamomcode/energy-state-analyzer/compare/db726199ca6214ebdf2da5fa0a73d4f29bf6be97..49ef35194407cbc9ca2f63e4248fd1683e03a3f6)</small></strong>
25
+
26
+ ## 0.8.1 - 2026-08-31
27
+
28
+ ### 🐞 Bug Fixes
29
+
30
+ * *(extension)* Preserve VS Code allowlist values (#59) ([db72619](https://github.com/cardamomcode/energy-state-analyzer/commit/db726199ca6214ebdf2da5fa0a73d4f29bf6be97))
31
+
32
+ <strong><small>[View changes on Github](https://github.com/cardamomcode/energy-state-analyzer/compare/01777cc27c9c08136661a2f1e21409cdf94f05ce..db726199ca6214ebdf2da5fa0a73d4f29bf6be97)</small></strong>
33
+
14
34
  ## 0.8.0 - 2026-08-31
15
35
 
16
36
  ### 🚀 Features
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Energy State Analyzer
2
2
 
3
- Visualizes "energy states" in Python, F#, TypeScript, and Kotlin code as you edit: parts of a file that are complex, deeply nested, or otherwise harder to understand and maintain get highlighted with colored gutter icons, inline decorations, and entries in the Problems panel.
3
+ Visualizes "energy states" in Python, F#, TypeScript, Kotlin, and C++ code as you edit: parts of a file that are complex, deeply nested, or otherwise harder to understand and maintain get highlighted with colored gutter icons, inline decorations, and entries in the Problems panel.
4
4
 
5
5
  ## Features
6
6
 
7
- Real-time analysis of the active Python, F#, TypeScript, or Kotlin file, re-run on every edit and on editor focus change, via these detectors (see [docs/detectors](docs/detectors/README.md) for full detail on each):
7
+ Real-time analysis of the active Python, F#, TypeScript, Kotlin, or C++ file, re-run on every edit and on editor focus change, via these detectors (see [docs/detectors](docs/detectors/README.md) for full detail on each):
8
8
 
9
9
  - [Cyclomatic complexity](docs/detectors/cyclomatic-complexity.md), too many independent execution paths.
10
10
  - [Cognitive complexity](docs/detectors/cognitive-complexity.md), too hard to read due to nesting.
@@ -36,14 +36,14 @@ The name is a deliberate analogy to thermodynamics: a function's "energy" is its
36
36
  The same detectors also run headlessly, without VS Code, useful for CI or for an AI coding agent that wants to check the complexity of code it just generated and keep refactoring until it's clean:
37
37
 
38
38
  ```bash
39
- npx energy-state-analyzer path/to/file.py # or .fs / .fsx / .ts / .kt
39
+ npx energy-state-analyzer path/to/file.py # or .fs / .fsx / .ts / .kt / .cpp / .hpp
40
40
  ```
41
41
 
42
42
  See [docs/cli.md](docs/cli.md) for scanning a whole repo, aggregated markdown/JSON/human reports, and diffing a PR against a base branch.
43
43
 
44
44
  ## Requirements
45
45
 
46
- The extension activates automatically when you open a Python, F#, TypeScript, or Kotlin file; it bundles its own grammars for parsing (via `web-tree-sitter`), so no external tools are required. F# files only get a `fsharp` language ID (and so trigger analysis) if you have an F# language extension installed (e.g. [Ionide](https://ionide.io/)), VS Code otherwise treats `.fs` files as plain text.
46
+ The extension activates automatically when you open a Python, F#, TypeScript, Kotlin, or C++ file; it bundles its own grammars for parsing (via `web-tree-sitter`), so no compiler or external parser is required. F# files only get a `fsharp` language ID (and so trigger analysis) if you have an F# language extension installed (e.g. [Ionide](https://ionide.io/)), VS Code otherwise treats `.fs` files as plain text. The CLI recognizes the full VS Code C++ suffix set, including compound template suffixes such as `.hpp.in`; see [Command-Line Usage](docs/cli.md#supported-file-suffixes).
47
47
 
48
48
  ## Development
49
49
 
@@ -91,4 +91,5 @@ To exclude files/folders (e.g. test fixtures, generated code) from both the exte
91
91
  ## Known Issues
92
92
 
93
93
  - TypeScript arrow functions aren't analyzed by complexity/parameter-count/coherence (same limitation Python already has for `lambda`), only named `function` declarations and class methods are.
94
+ - C++ analysis is syntax-only: it does not preprocess macros, resolve includes, instantiate templates, or perform type checking. C++ lambdas are not treated as standalone functions by function-level detectors.
94
95
  - Several detectors have per-language gaps beyond the above, see the "Known limitations" section of the relevant [detector doc](docs/detectors/README.md).