@henols/vice-mcp 0.2.0 → 0.2.2

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 (49) hide show
  1. package/README.md +2 -1
  2. package/THIRD-PARTY-NOTICES.md +1 -1
  3. package/anno-acme-ident.ts +97 -0
  4. package/anno-cli.ts +1465 -0
  5. package/anno-confidence.ts +233 -0
  6. package/anno-coverage.ts +2465 -0
  7. package/anno-d64.ts +310 -0
  8. package/anno-derive.ts +590 -0
  9. package/anno-details.ts +169 -0
  10. package/anno-enum-gen.ts +533 -0
  11. package/anno-export-asm.ts +1310 -0
  12. package/anno-index.ts +150 -0
  13. package/anno-memmap-render.ts +672 -0
  14. package/anno-regbits-gen.ts +421 -0
  15. package/anno-regbits.json +1370 -0
  16. package/anno-register.ts +240 -0
  17. package/anno-store.ts +3486 -0
  18. package/anno-symbols.ts +266 -0
  19. package/anno-tools.ts +2111 -0
  20. package/anno-types.ts +1636 -0
  21. package/block-class.ts +201 -0
  22. package/build.ts +1 -1
  23. package/capability-registry.ts +3 -1
  24. package/disasm-decoder.ts +14 -14
  25. package/disasm-opcodes.ts +4 -4
  26. package/disasm-renderer.ts +2 -2
  27. package/hostpath.ts +1 -1
  28. package/install-resources.ts +1 -1
  29. package/package.json +23 -3
  30. package/prg-image.ts +119 -0
  31. package/repo-root.ts +20 -5
  32. package/resources/broker-launch.mjs +8 -4
  33. package/resources/vice-launcher.sh +3 -3
  34. package/stock-address.ts +5 -5
  35. package/stock-cia.ts +2 -2
  36. package/stock-condition.ts +7 -7
  37. package/stock-connect.ts +1 -1
  38. package/stock-dispatch.ts +35 -5
  39. package/stock-execution.ts +5 -3
  40. package/stock-input.ts +9 -9
  41. package/stock-machine.ts +17 -6
  42. package/stock-protocol.ts +16 -11
  43. package/stock-registers.ts +54 -29
  44. package/stock-sprites.ts +3 -3
  45. package/stock-symbols.ts +33 -9
  46. package/stock-timing.ts +1 -1
  47. package/stock-vicii.ts +1 -1
  48. package/version.ts +1 -1
  49. package/vice-proxy.ts +168 -0
package/README.md CHANGED
@@ -50,6 +50,7 @@ VICE MCP server.
50
50
  | `VICE_MCP_HOST` | Host to reach the VICE MCP server on. |
51
51
  | `VICE_SKIP_RESOURCE_INSTALL=1` | Disable deploying host launcher scripts into `<project>/tools/`. |
52
52
  | `MASTRA_TELEMETRY_DISABLED=1` | Disable Mastra telemetry. |
53
+ | `VICE_LIVE_STOCK_BIN` | Absolute path to a genuinely unpatched stock VICE binary; opts `stock-live.test.ts` in (default-skipped). |
53
54
 
54
55
  ## Development
55
56
 
@@ -64,7 +65,7 @@ export CONTAINER_WORKSPACE_PATH="$(git rev-parse --show-toplevel)"
64
65
  export HOST_WORKSPACE_PATH="/host$(git rev-parse --show-toplevel)"
65
66
  ```
66
67
 
67
- `npm run test:automated` is the subset of `npm test` that excludes the three
68
+ `npm run test:automated` is the subset of `npm test` that excludes the nine
68
69
  manual-only files (see `test-gate.mjs`'s own header).
69
70
 
70
71
  ```sh
@@ -72,7 +72,7 @@ availability gate; CI installs it via `apt-get install -y acme` in
72
72
  `.github/workflows/ci.yml`'s `build` job). **No ACME source, header, data
73
73
  table or output is included in this repository or in the published
74
74
  package**, so ACME's licence does not attach to anything shipped. ACME never
75
- appears in `.claude/mcp/vice/package.json`'s `files[]`, `dependencies`, or
75
+ appears in `src/mcp/vice/package.json`'s `files[]`, `dependencies`, or
76
76
  `devDependencies` — it is an apt/CI-installed tool, never an npm package.
77
77
 
78
78
  ## Explicitly NOT a source: VICE
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ // anno-acme-ident.ts -- the ONE authoritative place in this repo for the
3
+ // ACME identifier policy (T-11-ENUM-NAME / T-11-NAME-INJECT): what makes a
4
+ // string a legal ACME symbol/label name, and the single check function that
5
+ // decides it.
6
+ //
7
+ // WHY THIS MODULE EXISTS: this policy started life inside anno-enum-gen.ts,
8
+ // consumed only by its own `createOrUpdateEnum()`/`sanitizeVariantMap()`.
9
+ // T-11-NAME-INJECT widened the finding to a SECOND entry route --
10
+ // `anno_set_label_name` (both outer and batch-inner) in anno-tools.ts, and
11
+ // `importLabels()` in anno-symbols.ts -- and `anno-enum-gen.ts` statically
12
+ // imports `runAnnoTool` FROM `anno-tools.ts`, so `anno-tools.ts` cannot
13
+ // import the policy back from `anno-enum-gen.ts` without forming a module
14
+ // cycle. This module has no import from anywhere else in this repo, so
15
+ // every one of those consumers (and any future one) can import it directly.
16
+ //
17
+ // WHAT THIS IS THE ONE AUTHORITATIVE PLACE FOR: `MAX_ACME_IDENTIFIER_LENGTH`,
18
+ // `ACME_IDENT_RE`, `ACME_RESERVED_MNEMONICS` and `assertLegalAcmeIdentifier()`
19
+ // -- the complete, only definition of "legal ACME identifier" in this repo.
20
+ // `anno-enum-gen.ts` re-exports `assertLegalAcmeIdentifier` /
21
+ // `MAX_ACME_IDENTIFIER_LENGTH` from here so its own existing consumers and
22
+ // tests keep their current import path; it does not hold a second copy.
23
+ //
24
+ // WHAT NOT TO DO, named concretely:
25
+ // - Never add a second identifier regex anywhere in this repo. The
26
+ // `anno-regbits-gen.ts` / `anno-regbits.test.ts` copies of
27
+ // `ACME_IDENT_RE` predate this module and are out of this plan's scope
28
+ // (260821-a86) to consolidate -- but no NEW copy should be added; import
29
+ // this module's `assertLegalAcmeIdentifier()` instead.
30
+ // - Never sanitize, quote, or auto-correct an illegal identifier here or
31
+ // in any caller. This function's contract is REJECT, per
32
+ // T-11-REGBITS-PROSE and T-11-ENUM-NAME precedent: a malformed name is a
33
+ // bug to surface, never silently rewritten into something else -- the
34
+ // caller-visible name must never diverge from what actually gets
35
+ // exported into ACME source.
36
+ // - Never import anything from this repo into this module. It must stay
37
+ // importable by both `anno-tools.ts` and `anno-enum-gen.ts` (which
38
+ // imports `runAnnoTool` FROM `anno-tools.ts`) without a cycle.
39
+ export const MAX_ACME_IDENTIFIER_LENGTH = 200;
40
+
41
+ const ACME_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
42
+
43
+ /**
44
+ * The 6502/6510 instruction mnemonics -- the ONLY category of reserved word
45
+ * actually measured to collide with a bare identifier in real ACME 0.97.
46
+ * Verified live on this host: `LDA = $05` is REJECTED ("No value given." /
47
+ * "Garbage data at end of statement" -- ACME parses `LDA` positionally as
48
+ * the opcode, not as an assignable symbol), while `A = $05` is ACCEPTED
49
+ * (register-letter shorthand is not reserved as a bare symbol name). This
50
+ * list is therefore a measured, not a guessed, reservation.
51
+ */
52
+ const ACME_RESERVED_MNEMONICS: ReadonlySet<string> = new Set([
53
+ "ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE", "BPL", "BRK", "BVC",
54
+ "BVS", "CLC", "CLD", "CLI", "CLV", "CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR",
55
+ "INC", "INX", "INY", "JMP", "JSR", "LDA", "LDX", "LDY", "LSR", "NOP", "ORA", "PHA",
56
+ "PHP", "PLA", "PLP", "ROL", "ROR", "RTI", "RTS", "SBC", "SEC", "SED", "SEI", "STA",
57
+ "STX", "STY", "TAX", "TAY", "TSX", "TXA", "TXS", "TYA",
58
+ ]);
59
+
60
+ /**
61
+ * Refuses `id` (naming it as `what` in the thrown message) unless it is a
62
+ * legal ACME identifier: matches `^[A-Za-z_][A-Za-z0-9_]*$`, is no longer
63
+ * than `MAX_ACME_IDENTIFIER_LENGTH`, and does not collide (case-
64
+ * insensitively) with a reserved 6502/6510 mnemonic (see
65
+ * `ACME_RESERVED_MNEMONICS`'s own header comment for how that specific list
66
+ * was measured, not assumed).
67
+ *
68
+ * T-11-ENUM-NAME (the highest-value threat in this phase): The external analyser
69
+ * validates only the ENUM name server-side
70
+ * (`app_state.rs:443`, `validate_new_enum_name`) and performs ZERO
71
+ * validation on variant names -- they flow straight into
72
+ * `format!("{}_{}", enum_name, variant)` at export time
73
+ * (`formatter_acme.rs:367-369`). This function is called on BOTH the enum
74
+ * name and every variant name, and is called BEFORE any
75
+ * `anno_create_project_enum`/`anno_update_project_enum` call reaches
76
+ * `runAnnoTool()` -- proven zero-spawn in `anno-enum-gen.test.ts`.
77
+ */
78
+ export function assertLegalAcmeIdentifier(id: string, what: string): void {
79
+ if (id.length === 0) {
80
+ throw new Error(`${what}: identifier must not be empty`);
81
+ }
82
+ if (id.length > MAX_ACME_IDENTIFIER_LENGTH) {
83
+ throw new Error(
84
+ `${what}: identifier "${id.slice(0, 40)}..." is ${id.length} characters, exceeding the ` +
85
+ `${MAX_ACME_IDENTIFIER_LENGTH}-character ceiling`,
86
+ );
87
+ }
88
+ if (!ACME_IDENT_RE.test(id)) {
89
+ throw new Error(`${what}: "${JSON.stringify(id)}" is not a legal ACME identifier -- must match ${ACME_IDENT_RE}`);
90
+ }
91
+ if (ACME_RESERVED_MNEMONICS.has(id.toUpperCase())) {
92
+ throw new Error(
93
+ `${what}: "${id}" collides with the reserved 6502/6510 mnemonic ${id.toUpperCase()} (verified rejected ` +
94
+ `by real ACME 0.97 -- see this module's ACME_RESERVED_MNEMONICS header comment)`,
95
+ );
96
+ }
97
+ }