move-doctor 0.2.0-dev.1d29f2d

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 ADDED
@@ -0,0 +1,51 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b750e20`](https://github.com/notmatical/move-doctor/commit/b750e206ac81077dd751e1b71096becad88b9750) Thanks [@notmatical](https://github.com/notmatical)! - Citations now link to their exact source. Every rule carries a `citationUrl` pointing at the precise Move Book code-quality-checklist anchor (e.g. `#capabilities-go-second`) or concept page, and citation labels use descriptive headings ("Move Book: Capabilities Go Second") instead of opaque section numbers. The URL flows through to `--json` diagnostics, the website rule pages, and the generated rule playbooks.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1](https://github.com/notmatical/move-doctor/pull/1) [`e133e5e`](https://github.com/notmatical/move-doctor/commit/e133e5e12856a77cbafaf71575c5f0f981f5ad44) Thanks [@notmatical](https://github.com/notmatical)! - Refresh package branding: new tagline "A deterministic linter for Sui Move", a clearer npm `description`, tidied `keywords` (dropped the inaccurate `audit` tag), and a README with up-to-date sample output and source-linked rule buckets.
12
+
13
+ All notable changes to the `move-doctor` package will be documented here. This project follows [Semantic Versioning](https://semver.org/).
14
+
15
+ ## [Unreleased]
16
+
17
+ ### Added
18
+
19
+ - **AST rules via tree-sitter.** move-doctor now parses Move with [MystenLabs' tree-sitter grammar](https://github.com/MystenLabs/sui/tree/main/external-crates/move/tooling/tree-sitter), loaded in-process from a committed WebAssembly build (`web-tree-sitter`). New `defineAstRule` API; the engine parses each file once and shares the tree across AST rules. A missing/broken grammar degrades gracefully — regex rules are unaffected. See [docs/authoring-rules.md](../../docs/authoring-rules.md). The grammar wasm is committed; `bun run grammar:build` refreshes it (no Docker/Emscripten).
20
+ - **Setup wizard: agent hooks + additional-setup step.** After picking agents, the wizard offers a multiselect (Agent hooks · GitHub Actions workflow). Agent hooks install a post-edit scan hook for Claude Code (`PostToolBatch`) and Cursor (`postToolUse`).
21
+ - **4 audit-informed rules** (patterns recurring across published Sui audits): `conventions/duplicate-error-code` (error constants sharing an abort code), `conventions/unused-const` (dead module constants), `security/mut-uid-accessor-leak` (`public fun` returning `&mut UID`), and `functions/recursive-function-call` (direct self-recursion — a recurring always-aborts footgun).
22
+
23
+ ### Changed
24
+
25
+ - **Migrated all structural rules to the AST** — they now match Move's parse tree (via tree-sitter) instead of regex: abilities, struct/const naming, function signatures, call/macro idioms, loop macros, capability rules, and test-attribute rules. This eliminates comment/string false-matches and handles multi-line / postfix forms robustly; detection semantics are preserved (the regression suite locks identical scores). The layout/comment/import-line rules and the `Move.toml` manifest rules deliberately stay on regex — the AST can't express them.
26
+
27
+ ## [0.1.0] — initial release
28
+
29
+ ### Added
30
+
31
+ - Deterministic Sui Move scanner with a 0–100 health score.
32
+ - Rules across 7 buckets (`conventions`, `functions`, `idioms`, `macros`, `testing`, `abilities`, `security`), each citing its source — [The Move Book Code Quality Checklist](https://move-book.com/guides/code-quality-checklist/), the Sui compiler's `--lint` pass, or documented Sui Move best practices.
33
+ - **Pass-through of Sui compiler `--lint`** when the `sui` CLI is on PATH (W00001 share_owned, W01001 self_transfer, W02001 custom_state_change, W03001 coin_field, W04001 freeze_wrapped, W05001 collection_equality).
34
+ - CLI flags: `--verbose`, `--diff[=base]`, `--score`, `--json`, `--no-tests`.
35
+ - `move-doctor install` command — writes the agent SKILL.md to `<cwd>/.claude/skills/move-doctor/SKILL.md`.
36
+ - Bundled single-file distribution via tsup. No runtime dependencies, ~60 kB tarball.
37
+ - Friendly error messages for: missing `Move.toml`, malformed `Move.toml`, `--diff` outside a git repo, `--diff` against a non-existent revision, empty project (no `.move` files).
38
+ - Per-rule hosted playbooks at `https://move.doctor/prompts/rules/<bucket>/<rule>.md` for agent fetch.
39
+ - Canonical agent playbook at `https://move.doctor/prompts/move-doctor-agent.md`.
40
+
41
+ ### Score model
42
+
43
+ - Start at 100, deduct per-severity weight per finding: `error` -8, `warning` -3, `info` -1.
44
+ - Per-rule cap: -25 (a single noisy rule cannot tank the score).
45
+ - Floor: 0.
46
+
47
+ ### Known limits (deferred to v0.2+)
48
+
49
+ - Text/regex scanning only — no AST. Rules requiring scope or type information (e.g. reference-vs-value assignment, type-parameter-vs-config-index mismatch) are deferred until move-doctor wraps `sui-move-analyzer` or a tree-sitter grammar.
50
+ - `cap-struct-missing-suffix` flags any `key` struct whose only field is `id: UID` as a potential capability; can false-positive on asset-shaped game items (e.g. an NFT with a single `id` field). Distinguishing a capability from a minimal asset needs type/ownership info, so it's bound to the no-AST limit above. Severity is `info` so the score impact is minimal; add a `Cap` suffix or a non-`id` field to silence.
51
+ - Aptos Move and Movement Move support not included.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 notmatical
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Move Doctor
2
+
3
+ > A deterministic linter for Sui Move.
4
+
5
+ Deterministic Sui Move scanner. Rules grounded in [The Move Book](https://move-book.com/guides/code-quality-checklist/), the Sui compiler's `--lint` pass, and documented Sui Move best practices. Outputs a 0–100 health score with file/line refs and fix recipes.
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ npx move-doctor@latest
11
+ ```
12
+
13
+ Scans the current directory and prints a 0–100 health score, a severity breakdown by area, and next steps. Add `--verbose` for file/line refs and fix hints. With the Sui CLI on `PATH`, its `sui move build --lint` pass runs alongside and feeds the same score.
14
+
15
+ ## Install as an agent skill
16
+
17
+ ```bash
18
+ npx move-doctor@latest install
19
+ ```
20
+
21
+ Writes `<cwd>/.claude/skills/move-doctor/SKILL.md`. Claude Code picks it up automatically — type `/movedoctor` or ask it to "run move doctor" and it'll scan, group findings, and fix them.
22
+
23
+ ## CI
24
+
25
+ `npx move-doctor@latest install` can set up a GitHub Actions workflow that scores every push and pull request. To gate by hand, fail the build below a score budget:
26
+
27
+ ```bash
28
+ SCORE=$(npx move-doctor@latest . --score)
29
+ [ "$SCORE" -ge 80 ] || exit 1
30
+ ```
31
+
32
+ ## Source
33
+
34
+ - Source code: [github.com/notmatical/move-doctor](https://github.com/notmatical/move-doctor)
35
+ - Issues: [github.com/notmatical/move-doctor/issues](https://github.com/notmatical/move-doctor/issues)
36
+ - Agent prompt: [move.doctor/prompts/move-doctor-agent.md](https://move.doctor/prompts/move-doctor-agent.md)
37
+
38
+ ## License
39
+
40
+ MIT