@henols/c64-re-tools 2.3.0-rc.4 → 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.
- package/package.json +1 -1
- package/skills/c64-assembler/SKILL.md +149 -78
- package/skills/c64-assembler/scripts/assembler.ts +18 -11
- package/skills/c64-basic/SKILL.md +90 -52
- package/skills/c64-basic/scripts/basic.ts +15 -6
- package/skills/c64-development/SKILL.md +46 -73
- package/skills/c64-disk/SKILL.md +145 -73
- package/skills/c64-disk/scripts/disk.ts +11 -6
- package/skills/c64-docs/SKILL.md +199 -118
- package/skills/c64-docs/references/page-types.md +3 -3
- package/skills/c64-docs/references/style.md +9 -13
- package/skills/c64-docs/scripts/docs.ts +39 -15
- package/skills/c64-docs/scripts/lib/links.ts +1 -1
- package/skills/c64-docs/scripts/lib/reference.ts +2 -2
- package/skills/c64-docs/scripts/lib/source-map.ts +2 -2
- package/skills/c64-export/SKILL.md +21 -45
- package/skills/c64-knowledge/SKILL.md +489 -233
- package/skills/c64-knowledge/scripts/knowledge.ts +31 -26
- package/skills/c64-memory-map/SKILL.md +131 -65
- package/skills/c64-memory-map/scripts/memory-map.ts +19 -11
- package/skills/c64-packer/SKILL.md +120 -72
- package/skills/c64-packer/scripts/packer.ts +10 -3
- package/skills/c64-provenance/SKILL.md +301 -173
- package/skills/c64-provenance/scripts/lib/library.ts +6 -6
- package/skills/c64-provenance/scripts/provenance.ts +85 -36
- package/skills/c64-reverse-engineering/SKILL.md +55 -72
- package/skills/c64-source/SKILL.md +316 -224
- package/skills/c64-source/scripts/lib/export.ts +9 -14
- package/skills/c64-source/scripts/lib/loader.ts +5 -5
- package/skills/c64-source/scripts/lib/source.ts +5 -5
- package/skills/c64-source/scripts/source.ts +106 -21
- package/skills/c64-static-analysis/SKILL.md +188 -112
- package/skills/c64-static-analysis/scripts/static-analysis.ts +29 -9
- package/skills/c64-testing/SKILL.md +272 -166
- package/skills/c64-testing/references/recording-format.md +11 -12
- package/skills/c64-testing/references/scenario-format.md +20 -5
- package/skills/c64-testing/scripts/lib/diff-files.ts +8 -8
- package/skills/c64-testing/scripts/lib/play.ts +1 -1
- package/skills/c64-testing/scripts/lib/recording.ts +7 -7
- package/skills/c64-testing/scripts/lib/replay.ts +7 -7
- package/skills/c64-testing/scripts/lib/runs.ts +6 -7
- package/skills/c64-testing/scripts/lib/scenario.ts +12 -6
- package/skills/c64-testing/scripts/testing.ts +36 -16
- package/skills/c64-unpacker/SKILL.md +273 -127
- package/skills/c64-unpacker/scripts/lib/loads.ts +3 -3
- package/skills/c64-unpacker/scripts/unpacker.ts +70 -11
- package/skills/emulator/SKILL.md +12 -12
- package/src/errors.ts +22 -2
- package/src/host/vice/session.ts +1 -1
- package/src/host-client/entry-state.ts +1 -1
- package/src/host-client/image.ts +3 -3
- package/src/host-client/steps.ts +1 -1
- package/src/knowledge/expression.ts +1 -1
- package/src/knowledge/names.ts +2 -3
- package/src/knowledge/program.ts +2 -3
- package/src/knowledge/write.ts +2 -2
- package/src/mcp/inputs.ts +1 -1
- package/src/mcp/tools/input.ts +1 -1
- package/src/mcp/tools/media.ts +1 -1
- package/src/native/exomizer.ts +2 -2
- package/src/project.ts +2 -2
- package/src/script.ts +164 -75
package/skills/c64-docs/SKILL.md
CHANGED
|
@@ -1,159 +1,240 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: c64-docs
|
|
3
|
-
description:
|
|
3
|
+
description: Writes the documentation of a C64 program. You write the pages by the method of this skill. The script generates the reference pages from the project knowledge and the generated source. The pages put first the development of the program and its copy protection, in depth, with the findings and what each one means in practice. They explain how the program works, with links to the main parts of the source, and they list the releases in short. Use it to document a program after its rebuilt source is identical to the original. Use it to keep the documentation correct after a change to the project knowledge. It does not change the project knowledge, and it does not run the program.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# C64 documentation
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this script to generate the reference pages of a program, and to link the pages that you write to the source.
|
|
9
|
+
Use only the commands of the script. Do not generate the reference or write the links to the source in another way.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```bash
|
|
12
|
+
node <skill>/scripts/docs.ts <command>
|
|
13
|
+
```
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
`<skill>` is the base directory of this skill. Run the script with `node`. You can run it from any directory.
|
|
16
|
+
Each command in this skill, for example `generate src --out docs/reference`, goes in the place of `<command>`.
|
|
17
|
+
Each command prints one JSON envelope on stdout. See the section "JSON output".
|
|
18
|
+
To get the command list, run the script with no arguments.
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
---
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## Select the command
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
| Goal | Command |
|
|
25
|
+
|---|---|
|
|
26
|
+
| Generate the reference pages from the project knowledge and the source | `generate src --out docs/reference` |
|
|
27
|
+
| Link the names in the pages to the source, and check each link and image | `link README.md docs --source src` |
|
|
28
|
+
| Check that each link is up to date, and write nothing | `link README.md docs --source src --check` |
|
|
29
|
+
| Link the pages when the reference is in a folder with another name | `link README.md docs --source src --reference docs/lookup` |
|
|
30
|
+
| Link one page | `link docs/main_loop.md --source src` |
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
- The program in the knowledge. Put it in with `image` of the c64-knowledge skill. The reference decodes the tables and shows the graphics from it.
|
|
23
|
-
- The entry page `README.md` and the directory of the other pages, for example `docs`. The reference goes into a directory of its own, for example `docs/reference`.
|
|
32
|
+
---
|
|
24
33
|
|
|
25
|
-
##
|
|
34
|
+
## The documentation and the source
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
node <skill>/scripts/docs.ts generate src --out docs/reference
|
|
29
|
-
node <skill>/scripts/docs.ts link README.md docs --source src
|
|
30
|
-
node <skill>/scripts/docs.ts link README.md docs --source src --check
|
|
31
|
-
```
|
|
36
|
+
The documentation is Markdown in the project. It has two parts:
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
| `src` | `docs.ts generate`: the source directory of c64-source. The command reads `src/source-map.json`. |
|
|
36
|
-
| `--source src` | `docs.ts link`: the source directory of c64-source. The command reads `src/source-map.json`. |
|
|
37
|
-
| `--out docs/reference` | The directory of the reference. `docs.ts generate` writes only there. It refuses to start when the directory holds a page that it did not write. |
|
|
38
|
-
| `README.md docs` | The pages of the documentation: `.md` files and directories. `docs.ts link` reads each file and every `.md` file below each directory. It changes only the pages that you wrote. It checks the pages of the reference. |
|
|
39
|
-
| `--reference <dir>` | The directory of the reference for `docs.ts link`. The default is the first `reference` directory in a given directory or beside a given page, for example `docs/reference`. |
|
|
40
|
-
| `--check` | `docs.ts link` writes nothing. `result` is `FAIL` when a link is not up to date or a page has a problem. |
|
|
41
|
-
| `--max-listed 20` | List at most this number of items in each list. The default is 50. |
|
|
42
|
-
|
|
43
|
-
### Calling the script
|
|
44
|
-
|
|
45
|
-
- Call a script as `node <skill>/scripts/<script>.ts <command> [subjects] [options]`. The command comes first.
|
|
46
|
-
- `<script>.ts --help` lists the commands. `<script>.ts <command> --help` gives the subjects and the options of one command. The help is JSON: `{"text": "..."}`.
|
|
47
|
-
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Quote an address in a shell.
|
|
48
|
-
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
49
|
-
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
50
|
-
- The script examines each `--out` path before it starts work. It refuses a path in `.c64-re-tools/knowledge/` and the index of the knowledge, because only c64-knowledge writes them. It refuses a folder where the command writes a file, and a file where the command writes a folder.
|
|
51
|
-
- The result is one JSON object on one line. A file that the script writes shows as `{"out", "bytes", "sha256"}`. A list shows as `{"count", "listed"}`, and `rest` tells where to get the rest of a long list.
|
|
52
|
-
- An error is `{"error": {"code": "...", "message": "..."}}`. The message tells what is wrong and what to do.
|
|
53
|
-
- The exit status is 0 for done or PASS, 1 for FAIL, 2 for an error and 3 for INCONCLUSIVE.
|
|
38
|
+
- **The pages that you write.** The entry page is `README.md` in the project folder. The other pages are in `docs/`. They explain how the program works: the flows, the state machines, the data formats and the task of each part. Use the page types in `<skill>/references/page-types.md` and the rules in `<skill>/references/style.md`.
|
|
39
|
+
- **The reference.** `generate` writes it into a folder of its own, for example `docs/reference`. It is the lookup for each routine, table and variable. Do not edit these pages. The next `generate` writes over them.
|
|
54
40
|
|
|
55
|
-
|
|
41
|
+
Get the values for the commands from these places:
|
|
56
42
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
43
|
+
- `<source-dir>` and `--source`: the folder of the source that you generated from the project knowledge, for example `src`. It must hold `source-map.json`. The source must be from the current revision of the project knowledge.
|
|
44
|
+
- `--out`: a folder that holds only the reference, for example `docs/reference`. Keep the pages that you write outside it.
|
|
45
|
+
- `<page>`: the entry page `README.md` and the folder of the other pages, for example `docs`.
|
|
46
|
+
- The program bytes: put them into the project knowledge before `generate`. Then the reference decodes the tables and shows the graphics.
|
|
47
|
+
|
|
48
|
+
### Paths and the project folder
|
|
49
|
+
|
|
50
|
+
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
51
|
+
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
52
|
+
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
53
|
+
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
54
|
+
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
59
55
|
- Write each file that you make for your work in `.c64-re-tools/local/` of the project. Git ignores that folder. Examples are results, batches, step files, runs, snapshots and memory dumps.
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
56
|
+
- The script refuses an `--out` path in `.c64-re-tools/knowledge/` and the index of the knowledge. Change the project knowledge only with the commands that change it.
|
|
57
|
+
- The script refuses a folder where the command writes a file. It refuses a file where the command writes a folder.
|
|
58
|
+
- When a file is the evidence for a finding in the project knowledge, move it out of `.c64-re-tools/local/` first. The project knowledge refuses evidence in that folder.
|
|
59
|
+
- Do not move a coverage map after you put it into the project knowledge. The knowledge refers to the map by its path at that time.
|
|
60
|
+
- Put a run that is evidence in `runs/<name>/`, with its run file, its results and its snapshot files. Change the paths in the run file to the new paths. Then git keeps them, and another person can do the run again.
|
|
63
61
|
- A shell redirect (`>`) is relative to the working directory, not to the project folder. From the folder above the project, write `<folder>/.c64-re-tools/local/result.json`.
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
---
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
2. Generate the source with c64-source. Make sure that `check.identical` is `true`. The script also writes `source-map.json`.
|
|
69
|
-
3. Run `docs.ts generate`. Read `index.md` of the reference. A module with no routines, or a routine with no comment, shows what the knowledge does not have yet.
|
|
70
|
-
4. Make the plan of the pages. Start from the modules and the call graphs. Find the main loop, the interrupt chain, the dispatch tables, the state machines and the data formats. Each subsystem gets one page in `docs/`. The entry page `README.md` in the project folder lists the pages. Use the page types in `references/page-types.md`.
|
|
71
|
-
5. Collect the facts about the development and the copy protection. These facts are the most interesting parts for a reader, so look for them carefully. Read the leftover spaces and their comments in the knowledge. If the knowledge has none, run `provenance.ts leftovers` of c64-provenance. For two or more releases, run `provenance.ts compare` of c64-provenance to separate the program from the changes of each release. Find each check of the copy protection in the code, and the effect of a failed check. These facts go into the development section, the copy protection section and their pages. Do not examine the cracks in detail. They are not part of the program.
|
|
72
|
-
6. Write each page. Read the code and the knowledge for each fact. Run the program with c64-testing or the emulator skill when a fact needs a run. Explain each part before you name the code. Link only the main parts: write `` `draw_room` `$09BC` `` for a link, and `` `draw_room` `` for each other mention. Mark each fact with its evidence. Several subagents can write the pages at the same time, one page each. Give each subagent `references/page-types.md` and `references/style.md`.
|
|
73
|
-
7. Record each new fact in the knowledge first: a name, a comment, a region or a module. Then the source and the reference show it too. A fact only in a page is lost at the next change of the knowledge.
|
|
74
|
-
8. Run `docs.ts link`. Read `problems` and correct each one. Then run `docs.ts link --check`. Make sure that `result` is `PASS`.
|
|
75
|
-
9. When the project folder is in a workspace with other projects, find `README.md` at the root of the workspace. This page lists each program of the workspace. Add one row for the program, with a link to `<project>/README.md` and one sentence. If the page does not exist, make it. Use the workspace index in `references/page-types.md`. `docs.ts link` does not read this page, because the page is not in the project folder.
|
|
76
|
-
10. After each change to the knowledge, do steps 2, 3 and 8 again. The links then go to the new lines.
|
|
65
|
+
## Flags
|
|
77
66
|
|
|
78
|
-
|
|
67
|
+
Each flag applies only to the commands in the table. On another command, the script refuses the flag.
|
|
79
68
|
|
|
80
|
-
|
|
69
|
+
| Flag | Command | Effect |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `--out <dir>` | `generate` | Required. The folder of the reference, relative to the project folder. `generate` writes only there. It refuses to start when the folder holds a page that it did not write. |
|
|
72
|
+
| `--source <dir>` | `link` | Required. The folder of the generated source, with its `source-map.json`. |
|
|
73
|
+
| `--reference <dir>` | `link` | The folder of the reference. The default is the first `reference` folder in a given folder or beside a given page, for example `docs/reference`. |
|
|
74
|
+
| `--check` | `link` | Write nothing. `result` is `FAIL` when a link is not up to date or a page has a problem. Off by default. |
|
|
75
|
+
| `--max-listed <n>` | `generate`, `link` | List at most `n` items in each list. The default is 50. The count is always in the body. |
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Generate the reference
|
|
80
|
+
|
|
81
|
+
### `generate <source-dir>`
|
|
82
|
+
|
|
83
|
+
Writes the reference pages from the project knowledge, the source map and the program bytes in the project knowledge. Before it writes, it removes the pages of an earlier run in `--out`.
|
|
84
|
+
|
|
85
|
+
`body` holds:
|
|
86
|
+
|
|
87
|
+
- `out`: the folder of the reference. `index`: the path of `index.md`. `revision`: the revision of the project knowledge.
|
|
88
|
+
- `pages`, `entries`, `tables`, `images` and `edges`: the counts of the reference.
|
|
89
|
+
- `files`: the pages and images that it wrote, each with `out`, `bytes` and `sha256`.
|
|
90
|
+
- `program`: `the knowledge`, or `none` when the project knowledge has no program bytes. Without them, the tables are not decoded, and the graphics page has no images.
|
|
91
|
+
|
|
92
|
+
`hint` and `nextAction`:
|
|
89
93
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- A table gets no links. A name with its address in a table row is a `link-in-table` problem.
|
|
93
|
-
- `docs.ts link` writes a link again when its line moves. A link that you made to another target stays as you wrote it.
|
|
94
|
-
- `docs.ts link` checks every link and image: the file must exist, a `#anchor` must exist in the page, and a `#L` line must exist in the file.
|
|
94
|
+
- `hint` tells you to write the pages. `nextAction` is the `link` command for `README.md` and the folder above `--out`. Run it after you write the pages.
|
|
95
|
+
- When `program` is `none`, `hint` tells you to put the program bytes into the project knowledge. Then run `generate` again.
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
The reference has these pages:
|
|
97
98
|
|
|
98
|
-
- `index.md`: each file of the source with its range, title, the
|
|
99
|
-
- `modules/<file>.md`: a call graph of the file, its data regions with their readers and writers, and an entry for each name. An entry has the comment, the callers
|
|
100
|
-
- `tables.md`: each table of addresses, jumps and words, entry by entry, with its target. An RTS table holds each target minus 1. The
|
|
101
|
-
- `memory-map.md`: each region in address order. Then each variable outside the
|
|
102
|
-
- `graphics.md`: each `sprite`, `bitmap`, `charset` and `screen` region.
|
|
99
|
+
- `index.md`: each file of the source, with its range, its title, the count of routines and the count of names.
|
|
100
|
+
- `modules/<file>.md`: a call graph of the file, its data regions with their readers and writers, and an entry for each name. An entry has the comment, the callers and the table that holds the name. For a routine, it also has the calls, the jumps, the reads and the writes.
|
|
101
|
+
- `tables.md`: each table of addresses, jumps and words, entry by entry, with its target. An RTS table holds each target minus 1. The page gives the target.
|
|
102
|
+
- `memory-map.md`: each region in address order. Then each variable outside the program, with its comment and the routines that read it and write it.
|
|
103
|
+
- `graphics.md`: each `sprite`, `bitmap`, `charset` and `screen` region. The project knowledge has no graphics mode. Thus a sprite, a bitmap or a charset shows in hires and in multicolour. A charset shows 16 characters in each row. A screen shows as text.
|
|
104
|
+
|
|
105
|
+
In a call graph, a solid arrow is a call, a thick arrow is a table entry, and a dotted arrow is a jump. A table entry goes from each routine that reads the table to each target in code. A table of data addresses gives no arrow.
|
|
106
|
+
|
|
107
|
+
Errors and their actions:
|
|
108
|
+
|
|
109
|
+
- `not-found` for `source-map.json` or for the source folder: generate the source from the project knowledge. Then run `generate` again.
|
|
110
|
+
- `invalid-input` that names an old revision: the project knowledge changed after you generated the source. Generate the source again, then run `generate` again.
|
|
111
|
+
- `invalid-input` that names a page in `--out`: `generate` did not write that page. Move the page out of the folder.
|
|
112
|
+
- `conflict`: the project knowledge has conflicts from a git merge. Resolve the merge conflicts of the project knowledge. Then generate the source again, and run `generate` again.
|
|
103
113
|
|
|
104
114
|
### Images and assets
|
|
105
115
|
|
|
106
|
-
- The reference draws each sprite, bitmap and charset region, and it decodes each table. To get the image of a graphic or the entries of a table, classify its region
|
|
116
|
+
- The reference draws each sprite, bitmap and charset region, and it decodes each table. To get the image of a graphic or the entries of a table, classify its region in the project knowledge. Do not write a script that draws or decodes them.
|
|
107
117
|
- A script of the project decodes only a format of the program, for example a packed map or a music stream. Put the script in `tools/` of the project. Its output files are the assets, for example in `assets/rooms/`.
|
|
108
|
-
- When the code of the program makes the data, run that code
|
|
118
|
+
- When the code of the program makes the data, run that code in a test run. Read the memory, or capture the screen. Do not write a 6502 emulator in the script.
|
|
109
119
|
|
|
110
|
-
|
|
120
|
+
---
|
|
111
121
|
|
|
112
|
-
##
|
|
122
|
+
## Link the pages
|
|
113
123
|
|
|
114
|
-
|
|
115
|
-
- symbols, regions, comments, references and modules of the space of the source.
|
|
124
|
+
### `link <page>...`
|
|
116
125
|
|
|
117
|
-
|
|
118
|
-
- none.
|
|
126
|
+
Reads each `.md` file that you give, and each `.md` file below each folder that you give. It writes the links in the pages that you wrote. It only checks the pages of the reference. It does not change a code block, a mermaid diagram or an HTML comment.
|
|
119
127
|
|
|
120
|
-
|
|
121
|
-
- the pages, or the facts that are only in the pages. Record each fact with c64-knowledge.
|
|
128
|
+
These are the forms that it changes. The examples are for a page in `docs/`. In `README.md`, the links start with `src/`.
|
|
122
129
|
|
|
123
|
-
|
|
130
|
+
| You write | `link` writes |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `` `draw_room` `$09BC` `` | `` [`draw_room` `$09BC`](../src/room_draw.asm#L6) ``: one link to the line of the name. |
|
|
133
|
+
| `` `draw_room` `$0AAF` `` | `$0AAF` is a place inside `draw_room`. The link goes to the line of `$0AAF`. |
|
|
134
|
+
| `` `room_script_vars+3` `$4E9A` `` | A name with an offset. The address must be the address of the name plus the offset. The link goes to the line of `$4E9A`. |
|
|
135
|
+
| `` `draw_room` `` | No link. |
|
|
136
|
+
| `` `scroll_moves` = `$10` `` | No link. The value is not an address. |
|
|
124
137
|
|
|
125
|
-
|
|
138
|
+
- A name is a name of the project knowledge or of the source. A word in backticks that is not a name stays as it is.
|
|
139
|
+
- A name gets one link in each section. A section starts at a heading.
|
|
140
|
+
- A table gets no links.
|
|
141
|
+
- When the line of a name moves, `link` writes the link again. A link that you made to another target stays as you wrote it.
|
|
142
|
+
- `link` checks each link and image. The file must exist. A `#anchor` must exist in the page. A `#L` line must exist in the file.
|
|
126
143
|
|
|
127
|
-
|
|
128
|
-
- `pages`, `entries`, `tables`, `images` and `edges`: the counts of the reference.
|
|
129
|
-
- `files`: the pages that it wrote, each with `out`, `bytes` and `sha256`.
|
|
130
|
-
- `program`: `the knowledge`, or a note when the knowledge has no program. Without the program, the tables are not decoded and the graphics page has no images.
|
|
131
|
-
|
|
132
|
-
`docs.ts link`:
|
|
144
|
+
`body` holds:
|
|
133
145
|
|
|
134
146
|
- `result`: `PASS` when no page has a problem. `FAIL` when a page has a problem, or with `--check` when a link is not up to date.
|
|
135
147
|
- `pages`: the count of the pages that it read.
|
|
136
|
-
- `reference`: the
|
|
137
|
-
- `linked`: the count of the links that it wrote
|
|
138
|
-
- `problems`: `byKind` and
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- `
|
|
143
|
-
-
|
|
144
|
-
- `
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
- The source and
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
148
|
+
- `reference`: the folder of the reference, or `none`.
|
|
149
|
+
- `linked`: `links`, the count of the links that it wrote, and `pages`, the pages that it changed. With `--check`, `notUpToDate` has the same fields for the links that are not up to date.
|
|
150
|
+
- `problems`: `byKind`, `count`, `listed` and `rest`. Each item has `at` (the page and the line), `kind` and `message`.
|
|
151
|
+
|
|
152
|
+
`hint` and `nextAction`:
|
|
153
|
+
|
|
154
|
+
- A page has a problem: `hint` tells you to correct each problem. `nextAction` runs the same `link` command again.
|
|
155
|
+
- With `--check`, a link is not up to date and no page has a problem: `nextAction` runs `link` without `--check` to write the links.
|
|
156
|
+
- `reference` is `none`: no `reference` folder is in or beside the given pages. Give `--reference <dir>`, or run `generate` first.
|
|
157
|
+
|
|
158
|
+
Do this for each `kind` of problem:
|
|
159
|
+
|
|
160
|
+
| `kind` | Action |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `unknown-name` | The page gives an address after a name that the project knowledge does not have. Record the name in the project knowledge, or correct the page. |
|
|
163
|
+
| `wrong-address` | The address is not the address of the name, and it is not a place inside the name. `message` gives the routine that holds the address. Correct the name or the address. For a value, write `` `scroll_moves` = `$10` ``. `link` does not link the mention until it is correct. |
|
|
164
|
+
| `repeated-link` | The name has a link in the section already. Remove the address from this mention. |
|
|
165
|
+
| `link-in-table` | A name with its address is in a table row. Remove the address in the table. Link the name in the text above the table. |
|
|
166
|
+
| `missing-file`, `missing-anchor`, `missing-line` | The link goes to nothing. Correct the link. An image of an asset must exist in the project. |
|
|
167
|
+
| `outside-project` | The link goes out of the project folder. Correct the link. |
|
|
168
|
+
| `stale-reference` | The source or the reference is older than the project knowledge. Do steps 2 and 3 of the workflow again. |
|
|
169
|
+
|
|
170
|
+
Errors: `not-found` names a page or a folder that is not in the project folder. `invalid-input` names a file that is not a `.md` file, or a folder that goes out of the project folder through a symbolic link. Correct the paths.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Workflow
|
|
175
|
+
|
|
176
|
+
1. Read the project knowledge. The documentation can only be as good as the knowledge. Each routine needs a name and a comment. Each table needs a region and a name. Each file of the source needs a module with a title. Record what is missing in the project knowledge.
|
|
177
|
+
2. Generate the source from the project knowledge. Make sure that the check of the source gives identical bytes. This also writes `source-map.json`.
|
|
178
|
+
3. Run `generate`. Read `index.md` of the reference. A module with no routines, or a routine with no comment, shows what the knowledge does not have yet.
|
|
179
|
+
4. Make the plan of the pages. Start from the modules and the call graphs. Find the main loop, the interrupt chain, the dispatch tables, the state machines and the data formats. Each subsystem gets one page in `docs/`. The entry page `README.md` lists the pages. Use the page types in `<skill>/references/page-types.md`.
|
|
180
|
+
5. Collect the facts about the development and the copy protection. These facts are the most interesting parts for a reader, so look for them carefully.
|
|
181
|
+
- Read the leftover spaces and their comments in the project knowledge. If the knowledge has none, find the leftovers of the development in the program.
|
|
182
|
+
- For two or more releases, compare the releases. Then you can separate the program from the changes of each release.
|
|
183
|
+
- Find each check of the copy protection in the code, and the effect of a failed check.
|
|
184
|
+
- Do not examine the cracks in detail. They are not part of the program.
|
|
185
|
+
6. Write each page. Read the code and the knowledge for each fact. When a fact needs a run, run the program in a test run or in the emulator. Explain each part before you name the code. Link only the main parts. Mark each fact with its evidence. Several subagents can write the pages at the same time, one page each. Give each subagent `<skill>/references/page-types.md` and `<skill>/references/style.md`.
|
|
186
|
+
7. Record each new fact in the project knowledge first: a name, a comment, a region or a module. Then the source and the reference show it too. A fact that is only in a page is lost at the next change of the knowledge.
|
|
187
|
+
8. Run `link`. Correct each problem. Then run `link` with `--check`. Make sure that `result` is `PASS`.
|
|
188
|
+
9. When the project folder is in a workspace with other projects, find `README.md` at the root of the workspace. This page lists each program of the workspace. Add one row for the program, with a link to `<project>/README.md` and one sentence. If the page does not exist, make it. Use the workspace index in `<skill>/references/page-types.md`. `link` does not read this page, because the page is not in the project folder.
|
|
189
|
+
10. After each change to the project knowledge, do steps 2, 3 and 8 again. Then the links go to the new lines.
|
|
190
|
+
|
|
191
|
+
Do not keep the pages, or the facts that are only in the pages, in the project knowledge.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## JSON output
|
|
196
|
+
|
|
197
|
+
Each command prints one JSON envelope on one line on stdout. Notes go to stderr.
|
|
198
|
+
|
|
199
|
+
On success, the exit code is 0:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{"ok": true, "command": "<command>", "body": {}, "hint": "...", "nextAction": "..."}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
On failure, the exit code is 2:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{"ok": false, "command": "<command>", "code": "<code>", "error": "...", "hint": "...", "nextAction": "..."}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- `body` holds the result. The section of each command gives the fields of its body.
|
|
212
|
+
- A check gives its verdict in `body.result`: `PASS`, `FAIL` or `INCONCLUSIVE`. The exit code is 0 for each verdict. Thus read `body.result`, not the exit code.
|
|
213
|
+
- `error` is one sentence. It tells what is wrong.
|
|
214
|
+
- `hint` tells what to do or what to examine. Read it before your next step. Some envelopes have no `hint`.
|
|
215
|
+
- `nextAction` is a full command line. It runs from any directory. Run it when it agrees with your task. Some envelopes have no `nextAction`.
|
|
216
|
+
- `code` does not change between versions. Do the action for the code:
|
|
217
|
+
|
|
218
|
+
| `code` | Action |
|
|
219
|
+
|---|---|
|
|
220
|
+
| `installation-incomplete`, `machine-unavailable` | Stop the task. Give `error` and `hint` to the user and wait for the user. Do not install, start or change a tool. Do not make a replacement for the tool, for example your own disk parser, disassembler or emulator script. |
|
|
221
|
+
| `invalid-input`, `not-found` | Correct the call as `hint` tells. Then run the command again. |
|
|
222
|
+
| `operation-failed` | Give `error` and `hint` to the user. |
|
|
223
|
+
| Another code | Do as `hint` tells. |
|
|
224
|
+
|
|
225
|
+
These fields have the same meaning in each body:
|
|
226
|
+
|
|
227
|
+
| Field | Meaning |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `out`, `bytes`, `sha256` | A file that the command wrote: its path, its size and its SHA-256. |
|
|
230
|
+
| `count`, `listed`, `rest` | A list. `count` is the number of items. `listed` holds the first items, at most `--max-listed`. `rest` tells how to get the other items. |
|
|
231
|
+
|
|
232
|
+
To get the command list, run the script with no arguments. The envelope has `command: "help"`, and `body.commands` gives the name, the summary and the synopsis of each command.
|
|
233
|
+
To get the subjects and the flags of one command, run `<command> --help`. Then `body.subjects` and `body.options` give them.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Reference
|
|
238
|
+
|
|
239
|
+
- `<skill>/references/page-types.md`: the page types, with the parts of each type and a template. The types are the entry page, the workspace index, the subsystem page and the entity sections. Other types are the data-format page, the development page and the copy protection page. It also has the conventions block.
|
|
240
|
+
- `<skill>/references/style.md`: the rules for the text of the pages. They tell how to explain, and how to write the names and the links. They also give the evidence marks, the diagrams and the images.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Page types
|
|
2
2
|
|
|
3
|
-
Each page that you write is one of these types. Use the parts of a type that the program needs. Do not add a part with no content. Write each page by the rules in
|
|
3
|
+
Each page that you write is one of these types. Use the parts of a type that the program needs. Do not add a part with no content. Write each page by the rules in `<skill>/references/style.md`. The section "Workflow" of `<skill>/SKILL.md` gives the steps to plan and write the pages.
|
|
4
4
|
|
|
5
5
|
## 1. The entry page
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ The most interesting parts for a reader are the development of the program and i
|
|
|
15
15
|
5. **How the program works.** A short walk through the program, from the start to the main loop. Tell what the program does at each stage and why. Use one mermaid diagram of the layers and one of the flow of the player. Under the diagrams, a numbered list tells how the layers work together. Link only the entry of each layer, for example the cold start, the main loop and the interrupt. Use about 5 to 8 links in the full section.
|
|
16
16
|
6. **The pages.** A table with one row for each page: the link and one sentence about its content. The sentences have no links to the code.
|
|
17
17
|
7. **The releases.** A short section. A small table gives each known release: the label, the file and the SHA-256 of the file. Then one line for each crack tells what it adds around the program, and the bytes of the program that it changed. Do not describe the intro, the mover or the relocator of a crack in detail. They are not part of the program.
|
|
18
|
-
8. **The rebuild.** Which release is the base release, the program of the knowledge. Which changes of the release to the machine state stay, and how the loader sets them. A table of the switches
|
|
18
|
+
8. **The rebuild.** Which release is the base release, the program of the knowledge. Which changes of the release to the machine state stay, and how the loader sets them. A table of the switches of the project knowledge: the name, the kind, the default and the releases that have the switch on. How to build the default program and each release. Which scenarios compare the original with the rebuild.
|
|
19
19
|
9. **Still open.** What is not known yet, and which run can find it.
|
|
20
20
|
10. **The reference.** One line with a link to `docs/reference/index.md`.
|
|
21
21
|
|
|
@@ -159,7 +159,7 @@ One page for each format of data, for example a packed map, a music stream or a
|
|
|
159
159
|
|
|
160
160
|
## 6. The development page
|
|
161
161
|
|
|
162
|
-
One page, `docs/development.md`, that tells how the authors made the program. The facts come from the code, the texts and the leftovers. Get the leftovers from
|
|
162
|
+
One page, `docs/development.md`, that tells how the authors made the program. The facts come from the code, the texts and the leftovers. Get the leftovers from the leftover spaces of the project knowledge. If the knowledge has none, find the leftovers of the development in the program. This page is one of the most interesting pages for a reader. Explain each trace in depth: what the bytes are, how you identified them, and what they tell. Compare an old copy with the version that runs, byte by byte when it helps. Use the parts that the program has evidence for:
|
|
163
163
|
|
|
164
164
|
1. **The authors and the version.** The names, the dates and the version texts in the program, for example a credit line or "REV.2".
|
|
165
165
|
2. **The tools and the computer of the development.** The format of the source text in the leftovers, and the assembler. The computer that the authors used, for example an Apple II with a cross-assembler.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Style of the pages
|
|
2
2
|
|
|
3
|
-
These rules apply to each page that you write. `
|
|
3
|
+
These rules apply to each page that you write. The `link` command checks the rules that a script can check. The section "Link the pages" of `<skill>/SKILL.md` gives the forms of a link and the problems that `link` reports.
|
|
4
4
|
|
|
5
5
|
## Explain first
|
|
6
6
|
|
|
@@ -12,17 +12,13 @@ These rules apply to each page that you write. `docs.ts link` checks the rules t
|
|
|
12
12
|
|
|
13
13
|
## Names and links
|
|
14
14
|
|
|
15
|
-
- Write a name and its address
|
|
16
|
-
-
|
|
17
|
-
- Link a name the first time that a section needs the reader to open the code. A name gets one link in each section. Each heading starts a section, also a heading of level 3 or lower. `docs.ts link` reports a second link as `repeated-link`.
|
|
15
|
+
- Write a name and its address only for a link. Write the name without its address for each other mention.
|
|
16
|
+
- Link a name the first time that a section needs the reader to open the code. Each heading starts a section, also a heading of level 3 or lower.
|
|
18
17
|
- Put no more than about 3 links in a paragraph. Link the main parts, not each name.
|
|
19
|
-
- Put no links in a table.
|
|
20
|
-
- Use the name of the knowledge. Do not make a name that is only in the page. When a part has no good name, record a name
|
|
21
|
-
- For a place inside a routine, write the name of the routine and the address of the place: `` `draw_room` `$0A04` ``. The link goes to the line of the place.
|
|
22
|
-
- For a byte inside a table or a variable, write the name with an offset: `` `room_script_vars+3` `$4E9A` ``.
|
|
23
|
-
- For a value, write an equals sign: `` `scroll_moves` = `$10` ``. Without the sign, `docs.ts link` reads `$10` as an address.
|
|
18
|
+
- Put no links in a table. Link the important names in the text above the table.
|
|
19
|
+
- Use the name of the knowledge. Do not make a name that is only in the page. When a part has no good name, record a name in the project knowledge first.
|
|
24
20
|
- For a name and an address that is not the address of the name, put a word between them: `` `irq_vector` points to `$48C1` ``.
|
|
25
|
-
- `
|
|
21
|
+
- `link` knows only the names of the space of the source. For a name in another space, for example a leftover, write the name without its address. Then give the space and the address: `` `old_demo_input_stream` in bank3 at `$F300` ``.
|
|
26
22
|
- Write addresses with `$` and hex digits in upper case: `$09BC`. Write values in hex with `$`, or in decimal without `$`.
|
|
27
23
|
- Write a range with a hyphen: `` `$4E97-$4E9B` ``.
|
|
28
24
|
|
|
@@ -42,7 +38,7 @@ These rules apply to each page that you write. `docs.ts link` checks the rules t
|
|
|
42
38
|
- In a node, write what the step does in the words of the program. Add the name of the routine when the reader needs it: `"Draw the room (draw_room)"`.
|
|
43
39
|
- A diagram gets no links. Give the links in the text under the diagram.
|
|
44
40
|
- Keep a diagram small: at most about 12 nodes. Make two diagrams before one diagram that a reader cannot read.
|
|
45
|
-
- Embed an image only from the project. It can be an image of the reference (`reference/images/`) or a PNG
|
|
41
|
+
- Embed an image only from the project. It can be an image of the reference (`reference/images/`), or a PNG from a run or a screen capture. It can also be an asset that a script of the project made from a format of the program, for example `../assets/rooms/room00.png`. `link` checks that each image exists.
|
|
46
42
|
- Give each image one line of text that tells what it shows.
|
|
47
43
|
|
|
48
44
|
## Text
|
|
@@ -54,5 +50,5 @@ These rules apply to each page that you write. `docs.ts link` checks the rules t
|
|
|
54
50
|
|
|
55
51
|
## Generated pages
|
|
56
52
|
|
|
57
|
-
- Do not edit a page in the reference. Change the knowledge, generate the source, and run `
|
|
58
|
-
- Do not put a page that you write in the reference
|
|
53
|
+
- Do not edit a page in the reference. Change the knowledge, generate the source again, and run `generate` again.
|
|
54
|
+
- Do not put a page that you write in the folder of the reference. `generate` refuses to write when one is there.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The c64-docs script. generate writes the reference pages of a program from
|
|
2
|
-
// the knowledge, the source map
|
|
3
|
-
// knowledge; the pages are generated and
|
|
2
|
+
// the knowledge, the source map that c64-source writes next to the generated
|
|
3
|
+
// source, and the program bytes in the knowledge; the pages are generated and
|
|
4
|
+
// never edited. link links the name
|
|
4
5
|
// mentions of the documentation to the source and the reference, and checks
|
|
5
6
|
// every link and image of the pages.
|
|
6
7
|
|
|
@@ -15,7 +16,7 @@ import { openForRead } from "#src/knowledge/database.ts";
|
|
|
15
16
|
import { programImage, type ProgramImage } from "#src/knowledge/program.ts";
|
|
16
17
|
import { currentRevision, listComments, listModules, listReferences, listRegions, listSymbols } from "#src/knowledge/read.ts";
|
|
17
18
|
import { resolveProjectFile, resolveProjectPath } from "#src/project.ts";
|
|
18
|
-
import { listed, OPTIONS, runScript, UsageError, type Call } from "#src/script.ts";
|
|
19
|
+
import { listed, OPTIONS, reply, runScript, UsageError, type Call, type Reply } from "#src/script.ts";
|
|
19
20
|
import { checkLinks, linkPage, type Files, type Problem } from "./lib/links.ts";
|
|
20
21
|
import { buildReference, GENERATED_MARK } from "./lib/reference.ts";
|
|
21
22
|
import { readSourceMap } from "./lib/source-map.ts";
|
|
@@ -43,7 +44,7 @@ function oldFiles(out: string, directory: string): string[] {
|
|
|
43
44
|
return found;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
function generate(call: Call):
|
|
47
|
+
function generate(call: Call): Reply {
|
|
47
48
|
const source = call.subject(0);
|
|
48
49
|
const out = call.string("out")!;
|
|
49
50
|
// The files of an earlier run are deleted: only in a folder that is inside the project, also after its symbolic links.
|
|
@@ -62,11 +63,11 @@ function generate(call: Call): Record<string, unknown> {
|
|
|
62
63
|
try {
|
|
63
64
|
image = programImage(db, map.space);
|
|
64
65
|
const found = conflicts(db).length;
|
|
65
|
-
if (found > 0) throw new Refusal("conflict", `The knowledge has ${found} conflict${found === 1 ? "" : "s"} from a git merge. Nothing was written.
|
|
66
|
+
if (found > 0) throw new Refusal("conflict", `The knowledge has ${found} conflict${found === 1 ? "" : "s"} from a git merge. Nothing was written. Resolve the merge conflicts of the project knowledge. Then generate the source again from the knowledge, and run generate again.`);
|
|
66
67
|
const revision = currentRevision(db);
|
|
67
68
|
// A source of another revision has other lines: the links would point to the wrong code.
|
|
68
69
|
if (map.revision !== revision) {
|
|
69
|
-
throw new WireFailure("invalid-input", `${map.pathOf("source-map.json")} is from knowledge revision ${map.revision}, and the knowledge is at revision ${revision}. Nothing was written. Generate the source again
|
|
70
|
+
throw new WireFailure("invalid-input", `${map.pathOf("source-map.json")} is from knowledge revision ${map.revision}, and the knowledge is at revision ${revision}. Nothing was written. Generate the source again from the knowledge. Then run generate again.`);
|
|
70
71
|
}
|
|
71
72
|
knowledge = {
|
|
72
73
|
revision,
|
|
@@ -88,7 +89,17 @@ function generate(call: Call): Record<string, unknown> {
|
|
|
88
89
|
});
|
|
89
90
|
for (const path of old) rmSync(join(directory, path), { force: true });
|
|
90
91
|
const written = built.files.map((file) => writeReported(file.path, file.bytes, { what: "--out" }));
|
|
91
|
-
|
|
92
|
+
const files = listed(written, call.count("max-listed")!);
|
|
93
|
+
const hints: string[] = [];
|
|
94
|
+
if (image === undefined) hints.push("The knowledge has no program bytes. Thus the reference does not decode the tables and does not show the graphics. To get them, put the program bytes into the project knowledge and run generate again.");
|
|
95
|
+
if (files.rest !== undefined) hints.push(`files is cut. To list all files, give ${files.rest}.`);
|
|
96
|
+
hints.push("Write the pages of the documentation. Then run nextAction to link them to the source.");
|
|
97
|
+
// The next step links the entry page and the folder above the reference, with the reference given, so that it also finds a reference that is not named reference/.
|
|
98
|
+
const parent = posix.dirname(posix.normalize(out));
|
|
99
|
+
return reply(
|
|
100
|
+
{ out, revision: knowledge.revision, index: posix.join(posix.normalize(out), "index.md"), ...built.counts, files, program: image === undefined ? "none" : "the knowledge" },
|
|
101
|
+
{ hint: hints.join(" "), nextAction: call.next("link", "README.md", ...(parent === "." ? [] : [parent]), "--source", source, "--reference", posix.normalize(out)) },
|
|
102
|
+
);
|
|
92
103
|
}
|
|
93
104
|
|
|
94
105
|
// ---------------------------------------------------------------------------
|
|
@@ -159,7 +170,7 @@ const files: Files = {
|
|
|
159
170
|
/** A .md entry of a directory that is a symbolic link to no file, or to a file outside the project. */
|
|
160
171
|
const unreadable = (page: string): Problem => ({ page, line: 1, kind: "missing-file", message: `${page} is a symbolic link to no file or to a file outside the project folder.` });
|
|
161
172
|
|
|
162
|
-
function link(call: Call):
|
|
173
|
+
function link(call: Call): Reply {
|
|
163
174
|
const check = call.flag("check");
|
|
164
175
|
const given = [...new Set(call.subjects.map((path) => posix.normalize(path)))];
|
|
165
176
|
for (const path of given) if (!files.inside(path)) throw new UsageError(`<page> must be a path relative to the project folder that stays inside it, not ${path}`);
|
|
@@ -276,16 +287,29 @@ function link(call: Call): Record<string, unknown> {
|
|
|
276
287
|
}
|
|
277
288
|
const byKind: Record<string, number> = {};
|
|
278
289
|
for (const problem of problems) byKind[problem.kind] = (byKind[problem.kind] ?? 0) + 1;
|
|
290
|
+
const shownProblems = listed(problems, call.count("max-listed")!, (problem) => ({ at: `${problem.page}:${problem.line}`, kind: problem.kind, message: problem.message }));
|
|
279
291
|
const output: Record<string, unknown> = {
|
|
280
292
|
pages: pages.length,
|
|
281
|
-
|
|
293
|
+
reference: reference ?? "none",
|
|
282
294
|
...(check ? { notUpToDate: { links, pages: changedPages } } : { linked: { links, pages: changedPages } }),
|
|
283
|
-
problems: { byKind, ...
|
|
295
|
+
problems: { byKind, ...shownProblems },
|
|
284
296
|
};
|
|
285
|
-
|
|
297
|
+
const again = (withCheck: boolean) => call.next("link", ...call.subjects, "--source", call.string("source")!, ...(givenReference === undefined ? [] : ["--reference", givenReference]), ...(withCheck ? ["--check"] : []));
|
|
298
|
+
const hints: string[] = [];
|
|
299
|
+
let nextAction: string | undefined;
|
|
300
|
+
if (reference === undefined) hints.push("No reference/ folder is in or beside the given pages, so the links to the reference are not checked. Give --reference <dir>, or run generate first.");
|
|
301
|
+
if (problems.length > 0) {
|
|
302
|
+
hints.push("Correct each problem in problems.listed as its message tells. Then run nextAction.");
|
|
303
|
+
if (shownProblems.rest !== undefined) hints.push(`problems is cut. To list all problems, give ${shownProblems.rest}.`);
|
|
304
|
+
nextAction = again(check);
|
|
305
|
+
} else if (check && links > 0) {
|
|
306
|
+
hints.push("Some links are not up to date. Run nextAction to write them.");
|
|
307
|
+
nextAction = again(false);
|
|
308
|
+
}
|
|
309
|
+
return reply({ result: problems.length > 0 || (check && links > 0) ? "FAIL" : "PASS", ...output }, { ...(hints.length === 0 ? {} : { hint: hints.join(" ") }), nextAction });
|
|
286
310
|
}
|
|
287
311
|
|
|
288
|
-
const SOURCE = { kind: "path", value: "<dir>", help: "the
|
|
312
|
+
const SOURCE = { kind: "path", value: "<dir>", help: "the folder of the source that was generated from the knowledge, with its source-map.json, relative to the project folder" } as const;
|
|
289
313
|
|
|
290
314
|
await runScript({
|
|
291
315
|
name: "docs",
|
|
@@ -299,9 +323,9 @@ await runScript({
|
|
|
299
323
|
out: { ...OPTIONS.out, output: "folder", value: "<dir>", help: "the folder for the reference pages, relative to the project folder, for example docs/reference. generate writes only there and refuses a page in it that it did not write", required: true },
|
|
300
324
|
"max-listed": OPTIONS["max-listed"],
|
|
301
325
|
},
|
|
302
|
-
notes: "When the knowledge has the program
|
|
326
|
+
notes: "When the project knowledge has the program bytes, the reference decodes the tables and shows the graphics.",
|
|
303
327
|
run: (call) => {
|
|
304
|
-
if (!isDirectory(call.subject(0))) throw new Refusal("not-found", `There is no folder ${call.subject(0)} in the project folder. Give the
|
|
328
|
+
if (!isDirectory(call.subject(0))) throw new Refusal("not-found", `There is no folder ${call.subject(0)} in the project folder. Give the folder of the source that was generated from the knowledge.`);
|
|
305
329
|
return generate(call);
|
|
306
330
|
},
|
|
307
331
|
},
|
|
@@ -311,7 +335,7 @@ await runScript({
|
|
|
311
335
|
subjects: [{ name: "<page>", help: ".md files and folders of the documentation, relative to the project folder, for example README.md docs. link reads each file and every .md file below each folder", list: true }],
|
|
312
336
|
options: {
|
|
313
337
|
source: { ...SOURCE, required: true },
|
|
314
|
-
reference: { kind: "path", value: "<dir>", help: "the reference pages of
|
|
338
|
+
reference: { kind: "path", value: "<dir>", help: "the folder of the reference pages of generate. The default is the first reference/ folder in a given folder or beside a given page" },
|
|
315
339
|
check: { kind: "flag", help: "write nothing. FAIL when a link is not up to date or a page has a problem" },
|
|
316
340
|
"max-listed": OPTIONS["max-listed"],
|
|
317
341
|
},
|