@henols/c64-re-tools 2.3.0-rc.5 → 2.3.0-rc.6

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 (61) hide show
  1. package/package.json +1 -1
  2. package/skills/c64-assembler/SKILL.md +149 -78
  3. package/skills/c64-assembler/scripts/assembler.ts +18 -11
  4. package/skills/c64-basic/SKILL.md +90 -52
  5. package/skills/c64-basic/scripts/basic.ts +15 -6
  6. package/skills/c64-development/SKILL.md +46 -73
  7. package/skills/c64-disk/SKILL.md +145 -73
  8. package/skills/c64-disk/scripts/disk.ts +11 -6
  9. package/skills/c64-docs/SKILL.md +199 -118
  10. package/skills/c64-docs/references/page-types.md +3 -3
  11. package/skills/c64-docs/references/style.md +9 -13
  12. package/skills/c64-docs/scripts/docs.ts +39 -15
  13. package/skills/c64-docs/scripts/lib/links.ts +1 -1
  14. package/skills/c64-docs/scripts/lib/reference.ts +2 -2
  15. package/skills/c64-docs/scripts/lib/source-map.ts +2 -2
  16. package/skills/c64-export/SKILL.md +21 -45
  17. package/skills/c64-knowledge/SKILL.md +489 -233
  18. package/skills/c64-knowledge/scripts/knowledge.ts +31 -26
  19. package/skills/c64-memory-map/SKILL.md +131 -65
  20. package/skills/c64-memory-map/scripts/memory-map.ts +19 -11
  21. package/skills/c64-packer/SKILL.md +120 -72
  22. package/skills/c64-packer/scripts/packer.ts +10 -3
  23. package/skills/c64-provenance/SKILL.md +301 -173
  24. package/skills/c64-provenance/scripts/lib/library.ts +6 -6
  25. package/skills/c64-provenance/scripts/provenance.ts +85 -36
  26. package/skills/c64-reverse-engineering/SKILL.md +55 -72
  27. package/skills/c64-source/SKILL.md +316 -224
  28. package/skills/c64-source/scripts/lib/export.ts +9 -14
  29. package/skills/c64-source/scripts/lib/loader.ts +5 -5
  30. package/skills/c64-source/scripts/lib/source.ts +5 -5
  31. package/skills/c64-source/scripts/source.ts +106 -21
  32. package/skills/c64-static-analysis/SKILL.md +188 -112
  33. package/skills/c64-static-analysis/scripts/static-analysis.ts +29 -9
  34. package/skills/c64-testing/SKILL.md +272 -166
  35. package/skills/c64-testing/references/recording-format.md +11 -12
  36. package/skills/c64-testing/references/scenario-format.md +20 -5
  37. package/skills/c64-testing/scripts/lib/diff-files.ts +8 -8
  38. package/skills/c64-testing/scripts/lib/recording.ts +7 -7
  39. package/skills/c64-testing/scripts/lib/replay.ts +7 -7
  40. package/skills/c64-testing/scripts/lib/runs.ts +6 -7
  41. package/skills/c64-testing/scripts/lib/scenario.ts +12 -6
  42. package/skills/c64-testing/scripts/testing.ts +35 -15
  43. package/skills/c64-unpacker/SKILL.md +273 -127
  44. package/skills/c64-unpacker/scripts/lib/loads.ts +3 -3
  45. package/skills/c64-unpacker/scripts/unpacker.ts +70 -11
  46. package/skills/emulator/SKILL.md +12 -12
  47. package/src/errors.ts +22 -2
  48. package/src/host/vice/session.ts +1 -1
  49. package/src/host-client/entry-state.ts +1 -1
  50. package/src/host-client/image.ts +3 -3
  51. package/src/host-client/steps.ts +1 -1
  52. package/src/knowledge/expression.ts +1 -1
  53. package/src/knowledge/names.ts +2 -3
  54. package/src/knowledge/program.ts +2 -3
  55. package/src/knowledge/write.ts +2 -2
  56. package/src/mcp/inputs.ts +1 -1
  57. package/src/mcp/tools/input.ts +1 -1
  58. package/src/mcp/tools/media.ts +1 -1
  59. package/src/native/exomizer.ts +2 -2
  60. package/src/project.ts +2 -2
  61. package/src/script.ts +164 -75
@@ -88,7 +88,7 @@ export function linkPage(text: string, context: LinkContext): { text: string; ch
88
88
  const report = (kind: ProblemKind, message: string) => problems.push({ page: context.page, line: index + 1, kind, message });
89
89
  const shown = `${TICK}${name}${offset ?? ""}${TICK}${space}${TICK}${addressText}${TICK}`;
90
90
  if (address === undefined) {
91
- report("unknown-name", `\`${name}\` is no name of the knowledge or the source. Apply the name to the knowledge, or correct the page.`);
91
+ report("unknown-name", `\`${name}\` is no name of the knowledge or the source. Record the name in the project knowledge, or correct the page.`);
92
92
  return whole;
93
93
  }
94
94
  const delta = offset === undefined ? 0 : offset.startsWith("+$") ? Number.parseInt(offset.slice(2), 16) : Number.parseInt(offset.slice(1), 10);
@@ -297,7 +297,7 @@ export function buildReference(input: ReferenceInput): { files: ReferenceFile[];
297
297
  {
298
298
  const page = posix.join(out, "tables.md");
299
299
  const lines = ["# Tables", "", `Each table of addresses, jumps and words, entry by entry. An RTS table holds each target minus 1; the target column gives the target. Index: [the reference](${rel(page, posix.join(out, "index.md"))}).`];
300
- if (input.image === undefined) lines.push("", "Put the program into the knowledge with knowledge.ts image, then generate the reference again to decode the tables.");
300
+ if (input.image === undefined) lines.push("", "Put the program bytes into the project knowledge. Then generate the reference again to decode the tables.");
301
301
  for (const table of tables) {
302
302
  const name = entryAt.get(table.start);
303
303
  lines.push("", `<a id="${tableAnchor(table)}"></a>`, `## ${name === undefined ? `\`${range(table.start, table.end)}\`` : `${codeOfName(page, name.name)} \`${range(table.start, table.end)}\``}`, "", `*${table.type}*`);
@@ -327,7 +327,7 @@ export function buildReference(input: ReferenceInput): { files: ReferenceFile[];
327
327
  "",
328
328
  `Each sprite, bitmap, charset and screen region of the knowledge. The knowledge gives no display mode and no colours, so a sprite, bitmap or charset shows in hires and in multicolour, in pattern colours: black is pixel value 0, white is 1 in hires; in multicolour light grey is 1, grey is 2 and yellow is 3. Index: [the reference](${rel(page, posix.join(out, "index.md"))}).`,
329
329
  ];
330
- if (input.image === undefined && graphics.length > 0) lines.push("", "Put the program into the knowledge with knowledge.ts image, then generate the reference again to show the graphics.");
330
+ if (input.image === undefined && graphics.length > 0) lines.push("", "Put the program bytes into the project knowledge. Then generate the reference again to show the graphics.");
331
331
  for (const region of graphics) {
332
332
  const anchor = entryAt.get(region.start)?.name ?? `${region.type}_${region.start.toString(16).padStart(4, "0")}`;
333
333
  const name = entryAt.get(region.start);
@@ -38,12 +38,12 @@ export function readSourceMap(directory: string): SourceMap {
38
38
  text = readProjectFile(path).bytes.toString("utf8");
39
39
  } catch (error) {
40
40
  if (error instanceof WireFailure && error.code === "not-found") {
41
- throw new WireFailure("not-found", `There is no ${path}. Generate the source with c64-source source.ts generate --out ${directory}: it writes the source map.`);
41
+ throw new WireFailure("not-found", `There is no ${path}. Generate the source from the project knowledge into ${directory}. That also writes the source map.`);
42
42
  }
43
43
  throw error;
44
44
  }
45
45
  const fail = (what: string): never => {
46
- throw new WireFailure("invalid-input", `${path} is not a source map of c64-source: ${what}. Generate the source again.`);
46
+ throw new WireFailure("invalid-input", `${path} is not a source map of the generated source: ${what}. Generate the source again from the project knowledge.`);
47
47
  };
48
48
  let raw: Record<string, unknown>;
49
49
  try {
@@ -1,50 +1,39 @@
1
1
  ---
2
2
  name: c64-export
3
- description: Use this skill to export a rebuilt C64 program as the start of a new program. The export sets each switch to one value in the code. Corrections, trainers and cheats are in, and copy protection and crack changes are out. It removes code and data that nothing uses. It writes a new project folder with the source, a baseline program, the tests and a small knowledge, and a zip file of the folder. Use it for requests such as "export the project", "start a new game from this rebuild" or "make a clean package of the code". Do not use it to change the rebuild. Use c64-development for that.
3
+ description: Exports a rebuilt C64 program as the start of a new program. The export sets each switch to one value in the code. Corrections, trainers and cheats are in, and copy protection and crack changes are out. It removes code and data that nothing uses. It writes a new project folder with the source, a baseline program, the tests and a small knowledge, and a zip file of the folder. Use it when the user asks to "export the project", "start a new game from this rebuild" or "make a clean package of the code". It does not change the rebuilt project or its knowledge.
4
4
  ---
5
5
 
6
- # c64-export
6
+ # C64 export
7
7
 
8
8
  ## Purpose
9
9
 
10
10
  Make the start of a new program from a rebuilt program. The new program is a new project. A person changes its source directly.
11
11
 
12
- This skill does not change the rebuilt project or its knowledge.
12
+ Do not change the rebuilt project or its knowledge.
13
13
 
14
14
  ## Inputs
15
15
 
16
- - A rebuilt project: `source.ts generate` of the c64-source skill gives PASS.
16
+ - A rebuilt project: the generation of its source from the project knowledge gives PASS.
17
17
  - The folder of the new project. It must be new or empty, and no project can hold it. Use a folder beside the project, for example `../game-new`.
18
18
  - Optional: the coverage of the runs in the knowledge. Without coverage, nothing becomes free by itself.
19
19
 
20
- ## Tools
21
-
22
- This skill uses the other skills.
23
-
24
- | Work | Skill |
25
- |---|---|
26
- | The export | c64-source: `source.ts export` |
27
- | The switches and the code at an address | c64-knowledge |
28
- | The build of the new project | c64-assembler |
29
- | The tests of the new project | c64-testing |
30
-
31
20
  ## Workflow
32
21
 
33
- 1. Run `source.ts generate --out src` of c64-source. It must give PASS. If it does not, stop and complete the rebuild with the c64-reverse-engineering skill.
34
- 2. Read the switches with `knowledge.ts switches` of c64-knowledge. Tell the user the export value of each switch:
22
+ 1. Generate the source from the project knowledge into `src`. Continue only when the result is PASS. If it is not PASS, stop. Complete the rebuild of the program first.
23
+ 2. Read the switches in the project knowledge. Tell the user the export value of each switch:
35
24
  - `fix`, `trainer` and `cheat`: 1. The code becomes a part of the new program.
36
25
  - `protection` and `crack`: 0.
37
26
  - `change`: its default.
38
27
 
39
- If the user wants another value for a switch, change its kind or its default with `knowledge.ts switch` first.
40
- 3. Run `source.ts export --to <folder>` of c64-source.
41
- 4. Read `unreachableExecuted`. Each range is code that a run executed and that the entry does not get to now. For each range, find the code that calls it with c64-knowledge:
42
- - Only code that the export removed calls it, for example a copy check: drop it.
43
- - Code that the knowledge does not show can call it, for example through a pointer: keep it.
28
+ If the user wants another value for a switch, change its kind or its default in the project knowledge first.
29
+ 3. Export the program of the project knowledge to the folder of the new project.
30
+ 4. Read `unreachableExecuted` in the result of the export. Each range is code that a run executed and that the entry does not get to now. For each range, find the code that calls it in the project knowledge:
31
+ - Only code that the export removed calls it, for example a copy check: drop the range.
32
+ - Code that the knowledge does not show can call it, for example through a pointer: keep the range.
44
33
  - If you are not sure, ask the user.
45
- 5. To drop a range, remove the folder and the zip file of the export. Then run `source.ts export` again with `--drop '<range>'` for each range.
46
- 6. Build the new project with c64-assembler. Give `--project <folder>`. Use the build commands in its `README.md`. The build with `--compare` must give PASS.
47
- 7. Run each test of the new project with c64-testing. Give `--project <folder>`. Use the test commands in its `README.md`. Each test must give PASS.
34
+ 5. To drop a range, remove the folder and the zip file of the export. Then export again, and drop each range.
35
+ 6. Build the new project with the build commands in its `README.md`. Use the new folder as the project. The build that compares with the baseline must give PASS.
36
+ 7. Run each test of the new project with the test commands in its `README.md`. Use the new folder as the project. Each test must give PASS.
48
37
 
49
38
  ### The answer
50
39
 
@@ -54,17 +43,13 @@ Give the user a short answer at the end:
54
43
  2. The value of each switch.
55
44
  3. The free ranges, with their bytes.
56
45
  4. Each test and its result, and the tests that the export left out, with the reason.
57
- 5. The next step: the c64-development skill, path B.
46
+ 5. The next step: develop features and fixes in the source of the new project.
58
47
 
59
48
  ## Knowledge
60
49
 
61
- Read:
62
-
63
- - the switches, and the code at the addresses of `unreachableExecuted`.
50
+ Read the switches, and the code at the addresses of `unreachableExecuted`.
64
51
 
65
- Automatic write:
66
-
67
- - none in the rebuilt project. The export writes the knowledge of the new project.
52
+ Do not write to the knowledge of the rebuilt project. The export writes the knowledge of the new project.
68
53
 
69
54
  ## Result
70
55
 
@@ -72,16 +57,7 @@ A new project folder and a zip file of it. Its build is identical to its baselin
72
57
 
73
58
  ## Failure and conflicts
74
59
 
75
- - `export` gives FAIL with `stage`: read `reason`. The c64-source skill tells what to do for each stage.
76
- - `export` refuses the folder: give a new or empty folder outside every project. Remove a folder or a zip file of an earlier export only when this task made it.
77
- - A test of the new project gives FAIL: the export dropped a range that the program uses. Remove the folder and the zip file. Run `export` again with `--keep` for the range, then test again.
78
- - A skill reports `installation-incomplete` or `machine-unavailable`: stop the whole task. Give the message to the user and wait for the user. Do not continue with other skills. Do not install, start or change a tool yourself. Do not make a replacement for the tool.
79
-
80
- ## Handoffs
81
-
82
- - The rebuild is not complete → c64-reverse-engineering
83
- - The export → c64-source
84
- - Switches and the code at an address → c64-knowledge
85
- - The build of the new project → c64-assembler
86
- - The tests of the new project → c64-testing
87
- - A new feature or a correction in the new project → c64-development
60
+ - The export gives FAIL: read `stage` and `reason`. Do as `reason` tells.
61
+ - The export refuses the folder: give a new or empty folder outside every project. Remove a folder or a zip file of an earlier export only when this task made it.
62
+ - A test of the new project gives FAIL: the export dropped a range that the program uses. Remove the folder and the zip file. Export again and keep the range. Then test again.
63
+ - A task reports `installation-incomplete` or `machine-unavailable`: stop the whole task. Give the message to the user and wait for the user. Do not continue with other tasks.