toko-atlas 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD_PARTY_NOTICES.md +58 -0
- package/atlas.config.json +7 -0
- package/data/api-index.json +1 -0
- package/data/lint-rules.json +299 -0
- package/data/search-index.json +1 -0
- package/dist/src/api-map.js +21 -0
- package/dist/src/check.js +23 -0
- package/dist/src/cli.js +191 -0
- package/dist/src/config.js +23 -0
- package/dist/src/files.js +260 -0
- package/dist/src/index/load.js +12 -0
- package/dist/src/index/resolve.js +33 -0
- package/dist/src/index/types.js +5 -0
- package/dist/src/index-checks.js +122 -0
- package/dist/src/lexer.js +202 -0
- package/dist/src/lint.js +18 -0
- package/dist/src/lookup.js +81 -0
- package/dist/src/notes.js +104 -0
- package/dist/src/paths.js +15 -0
- package/dist/src/rules/load.js +101 -0
- package/dist/src/rules/run.js +134 -0
- package/dist/src/rules/types.js +1 -0
- package/dist/src/search-options.js +25 -0
- package/dist/src/search.js +13 -0
- package/dist/src/types.js +1 -0
- package/dist/src/usage-log.js +18 -0
- package/package.json +49 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 muloka
|
|
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
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Toko Atlas
|
|
2
|
+
|
|
3
|
+
> Toko Atlas works on its own: it doesn't need figma-console-mcp or its Toko Relay plugin, whatever the shared name suggests.
|
|
4
|
+
|
|
5
|
+
A lookup and script-check tool for agents that write Figma Plugin API code. It combines what [`@figma/plugin-typings`](https://www.npmjs.com/package/@figma/plugin-typings) says the API offers with what the field notes found actually breaks at runtime. The plan is one npm package that runs as a command-line tool and as an MCP server, next to any Figma tool that runs Plugin API code.
|
|
6
|
+
|
|
7
|
+
**Status:** stage 1, a command-line tool on npm. The MCP server is stage 3.
|
|
8
|
+
|
|
9
|
+
## Use
|
|
10
|
+
|
|
11
|
+
Node 22 or later.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g toko-atlas # or run it without installing: npx toko-atlas <command>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
toko-atlas lookup figma.variables.setBoundVariableForPaint InstanceNode.mainComponent
|
|
19
|
+
toko-atlas search bind a variable to a fill
|
|
20
|
+
toko-atlas check path/to/plugin # a plugin folder, or files
|
|
21
|
+
echo 'figma.getNodeById("1:2")' | toko-atlas check # a script on stdin, as sent to figma_execute
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
From a clone, `npm install && npm run build && npm link` does the same. The build clones field-notes at its pinned release, so it needs `git` and network access.
|
|
25
|
+
|
|
26
|
+
| Command | Does | Exit code |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `lookup <name>...` | What the typings say about `figma.a.b`, `Type.member`, `Type` or a member name, with linked field-notes entries | 1 if a name isn't in the typings |
|
|
29
|
+
| `search <question...>` | The 5 API members that best match a plain-language question, deprecated ones left out | 0 |
|
|
30
|
+
| `check [path...]` | field-notes' lint rules, plus calls the typings don't have or mark deprecated. With no path or `-`, checks a script read from stdin | 1 if it finds anything, 2 if it couldn't check everything |
|
|
31
|
+
|
|
32
|
+
All three take `--json`. `check` also takes `--manifest <file>`, for paths only. Every command exits 2 on a usage error or a path that doesn't exist. `check` also exits 2 when it couldn't check a file, such as one it can't read or a named file that isn't JS/TS or HTML (it lists them on stderr), or when it found no JS/TS or HTML files at all. An incomplete check isn't a clean one. `lookup` accepts names as code writes them, such as `figma.loadFontAsync()` or `selection[0].fills`.
|
|
33
|
+
|
|
34
|
+
`check` labels each finding with its rule, such as `[sync-get-node-by-id]` for a field-notes rule. The typings checks use three labels:
|
|
35
|
+
|
|
36
|
+
- `[unknown-api]`: the typings don't have it, such as `figma.variables.getVariableByName`.
|
|
37
|
+
- `[throws-under-dynamic-page]`: deprecated, and the typings say it will throw when the manifest has `"documentAccess": "dynamic-page"`, such as `figma.variables.getVariableById`. With no manifest, as for a script on stdin, `check` assumes `dynamic-page`, like field-notes' linter. `lookup` marks these members, and single overloads like the string-ID form of `createVariable`, with "throws under dynamic-page".
|
|
38
|
+
- `[deprecated-api]`: any other deprecated call, such as `figma.getSlideGrid`. It still works, but has a replacement.
|
|
39
|
+
|
|
40
|
+
- [Vision and prototype results](docs/2026-12-05-vision.md)
|
|
41
|
+
- [Spike 00: index and search prototype](spikes/00-index-prototype/)
|
|
42
|
+
- [Spec: files and roles](spec/files-and-roles.md), meaning which code `atlas_check` checks and as what
|
|
43
|
+
|
|
44
|
+
### Logging what agents ask (optional)
|
|
45
|
+
|
|
46
|
+
Set `TOKO_ATLAS_LOG` to a file path, and each command appends one JSON line to it: the `search` question and its results, each `lookup` name and what it resolved to, and `check`'s finding ids and lines. It never records a checked script's code or file paths. It's off by default, and a log that can't be written never changes a command's result. Real questions from this log become stage 2's search tests.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
export TOKO_ATLAS_LOG="$HOME/.toko-atlas/usage.jsonl"
|
|
50
|
+
```
|
|
2
51
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The data files in `data/` are built from two MIT-licensed sources and include parts of them:
|
|
4
|
+
|
|
5
|
+
- `data/api-index.json` and `data/search-index.json` include declarations and documentation comments from [`@figma/plugin-typings`](https://www.npmjs.com/package/@figma/plugin-typings).
|
|
6
|
+
- `data/api-index.json` and `data/lint-rules.json` include notes and lint rules from [figma-plugin-field-notes](https://github.com/muloka/figma-plugin-field-notes), at the release pinned in `atlas.config.json`.
|
|
7
|
+
|
|
8
|
+
## @figma/plugin-typings
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2021 Figma, Inc.
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## figma-plugin-field-notes
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
MIT License
|
|
38
|
+
|
|
39
|
+
Copyright (c) 2026 muloka
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
SOFTWARE.
|
|
58
|
+
```
|