rig-c 0.0.0-stage → 2.21.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/.claude-plugin/marketplace.json +19 -0
- package/.claude-plugin/plugin.json +13 -0
- package/LICENSE +30 -0
- package/NOTICE.md +145 -0
- package/README.md +817 -3
- package/bin/rigc.cjs +83 -0
- package/cli.ts +61 -0
- package/cli_core.ts +46 -0
- package/docs/AUTHORING.md +9923 -0
- package/docs/FACE.md +1948 -0
- package/docs/INGEST.md +1488 -0
- package/docs/MOTION.md +1241 -0
- package/docs/PROMPTING.md +109 -0
- package/docs/RIGGING.md +1441 -0
- package/docs/SPEC_COVERAGE.md +357 -0
- package/package.json +108 -4
- package/skills/rigc/SKILL.md +133 -0
- package/skills/rigc-face/SKILL.md +60 -0
- package/skills/rigc-ingest/SKILL.md +78 -0
- package/skills/rigc-motion/SKILL.md +51 -0
- package/skills/rigc-rigging/SKILL.md +49 -0
- package/src/areaband.ts +159 -0
- package/src/assertions/bodies/a01.ts +23 -0
- package/src/assertions/bodies/a02.ts +21 -0
- package/src/assertions/bodies/a03.ts +27 -0
- package/src/assertions/bodies/a04.ts +40 -0
- package/src/assertions/bodies/a05.ts +56 -0
- package/src/assertions/bodies/a06.ts +245 -0
- package/src/assertions/bodies/a07.ts +68 -0
- package/src/assertions/bodies/a08.ts +76 -0
- package/src/assertions/bodies/a09.ts +82 -0
- package/src/assertions/bodies/a10.ts +116 -0
- package/src/assertions/bodies/a11.ts +15 -0
- package/src/assertions/bodies/a12.ts +30 -0
- package/src/assertions/bodies/a13.ts +51 -0
- package/src/assertions/bodies/a14.ts +35 -0
- package/src/assertions/bodies/a15.ts +97 -0
- package/src/assertions/bodies/a16.ts +24 -0
- package/src/assertions/bodies/a17.ts +26 -0
- package/src/assertions/bodies/a18.ts +62 -0
- package/src/assertions/bodies/a19.ts +404 -0
- package/src/assertions/bodies/a20.ts +122 -0
- package/src/assertions/bodies/a21.ts +190 -0
- package/src/assertions/bodies/a22.ts +39 -0
- package/src/assertions/bodies/a23.ts +305 -0
- package/src/assertions/bodies/a24.ts +68 -0
- package/src/assertions/bodies/a25.ts +39 -0
- package/src/assertions/bodies/a26.ts +61 -0
- package/src/assertions/bodies/a27.ts +33 -0
- package/src/assertions/bodies/a28.ts +70 -0
- package/src/assertions/bodies/a29.ts +34 -0
- package/src/assertions/bodies/a30.ts +50 -0
- package/src/assertions/bodies/a31.ts +61 -0
- package/src/assertions/bodies/a32.ts +44 -0
- package/src/assertions/bodies/a33.ts +110 -0
- package/src/assertions/bodies/a34.ts +133 -0
- package/src/assertions/bodies/a35.ts +160 -0
- package/src/assertions/bodies/a36.ts +81 -0
- package/src/assertions/bodies/a37.ts +77 -0
- package/src/assertions/bodies/a38.ts +73 -0
- package/src/assertions/bodies/a39.ts +303 -0
- package/src/assertions/bodies/a40.ts +128 -0
- package/src/assertions/bodies/a42.ts +97 -0
- package/src/assertions/bodies/a43.ts +181 -0
- package/src/assertions/bodies/a44.ts +23 -0
- package/src/assertions/bodies/a45.ts +172 -0
- package/src/assertions/bodies/a46.ts +224 -0
- package/src/assertions/bodies/a47.ts +126 -0
- package/src/assertions/bodies/a48.ts +83 -0
- package/src/assertions/bodies/a49.ts +81 -0
- package/src/assertions/bodies/a50.ts +97 -0
- package/src/assertions/constraint_words.ts +169 -0
- package/src/assertions/emitted/index.ts +148 -0
- package/src/assertions/facts/animated_bones.ts +30 -0
- package/src/assertions/facts/animation_durations.ts +37 -0
- package/src/assertions/facts/atlas_pages.ts +19 -0
- package/src/assertions/facts/atlas_regions.ts +52 -0
- package/src/assertions/facts/bone_timelines.ts +37 -0
- package/src/assertions/facts/constraint_targets.ts +56 -0
- package/src/assertions/facts/constraints.ts +155 -0
- package/src/assertions/facts/deform_survey.ts +27 -0
- package/src/assertions/facts/event_keys.ts +55 -0
- package/src/assertions/facts/linked_meshes.ts +38 -0
- package/src/assertions/facts/mesh_attachments.ts +100 -0
- package/src/assertions/facts/region_joins.ts +34 -0
- package/src/assertions/facts/sequences.ts +85 -0
- package/src/assertions/facts/skeleton_roster.ts +45 -0
- package/src/assertions/facts/skin_entries.ts +37 -0
- package/src/assertions/facts/skin_members.ts +53 -0
- package/src/assertions/facts/slider_composition.ts +78 -0
- package/src/assertions/facts/slot_colour.ts +43 -0
- package/src/assertions/facts/stage.ts +27 -0
- package/src/assertions/facts/stage_box.ts +65 -0
- package/src/assertions/facts/stepped_poses.ts +74 -0
- package/src/assertions/facts/two_colour.ts +52 -0
- package/src/assertions/facts/vertex_polygons.ts +53 -0
- package/src/assertions/footprints.ts +367 -0
- package/src/assertions/harness.ts +109 -0
- package/src/assertions/inward_advance.ts +58 -0
- package/src/assertions/kinds.ts +105 -0
- package/src/assertions/mesh_kinds.ts +56 -0
- package/src/assertions/model/animated_bones.ts +38 -0
- package/src/assertions/model/animation_durations.ts +57 -0
- package/src/assertions/model/atlas_pages.ts +15 -0
- package/src/assertions/model/atlas_regions.ts +76 -0
- package/src/assertions/model/bone_timelines.ts +58 -0
- package/src/assertions/model/constraint_targets.ts +82 -0
- package/src/assertions/model/constraints.ts +233 -0
- package/src/assertions/model/declared.ts +125 -0
- package/src/assertions/model/deform_survey.ts +24 -0
- package/src/assertions/model/event_keys.ts +45 -0
- package/src/assertions/model/given.ts +45 -0
- package/src/assertions/model/index.ts +398 -0
- package/src/assertions/model/linked_meshes.ts +24 -0
- package/src/assertions/model/mesh_attachments.ts +119 -0
- package/src/assertions/model/parse.ts +146 -0
- package/src/assertions/model/region_joins.ts +67 -0
- package/src/assertions/model/runtime_timelines.ts +78 -0
- package/src/assertions/model/sequences.ts +157 -0
- package/src/assertions/model/skeleton_roster.ts +23 -0
- package/src/assertions/model/skin_entries.ts +69 -0
- package/src/assertions/model/skin_members.ts +64 -0
- package/src/assertions/model/slider_composition.ts +193 -0
- package/src/assertions/model/slot_colour.ts +81 -0
- package/src/assertions/model/stage.ts +28 -0
- package/src/assertions/model/stage_box.ts +51 -0
- package/src/assertions/model/stepped_poses.ts +105 -0
- package/src/assertions/model/two_colour.ts +61 -0
- package/src/assertions/model/vertex_polygons.ts +72 -0
- package/src/assertions/reasons.ts +129 -0
- package/src/assertions/region_lookups.ts +61 -0
- package/src/assertions/report.ts +189 -0
- package/src/assertions/values.ts +39 -0
- package/src/atlas.ts +2870 -0
- package/src/ballot.ts +866 -0
- package/src/bonedist.ts +643 -0
- package/src/chainfit.ts +2752 -0
- package/src/chains.ts +170 -0
- package/src/check.ts +4303 -0
- package/src/checkpics.ts +295 -0
- package/src/cli/core_commands.ts +1627 -0
- package/src/cli/repack.ts +414 -0
- package/src/cli/shared.ts +2776 -0
- package/src/cli/spine_commands.ts +820 -0
- package/src/compile.ts +9414 -0
- package/src/core/additive.ts +458 -0
- package/src/core/animation.ts +1050 -0
- package/src/core/clipping.ts +696 -0
- package/src/core/constraints.ts +1876 -0
- package/src/core/constraints_path.ts +964 -0
- package/src/core/constraints_physics.ts +881 -0
- package/src/core/constraints_slider.ts +635 -0
- package/src/core/deform.ts +613 -0
- package/src/core/draw_order.ts +125 -0
- package/src/core/events.ts +135 -0
- package/src/core/hooks.ts +249 -0
- package/src/core/index.ts +1400 -0
- package/src/core/raw.ts +739 -0
- package/src/core/skins.ts +129 -0
- package/src/core/uvs.ts +469 -0
- package/src/core/vertices.ts +490 -0
- package/src/core/walk.ts +197 -0
- package/src/core/world.ts +289 -0
- package/src/correspondence.ts +15 -0
- package/src/deformbuild.ts +60 -0
- package/src/deformgen.ts +630 -0
- package/src/deformmeasure.ts +732 -0
- package/src/deformreport.ts +373 -0
- package/src/deformstructure.ts +386 -0
- package/src/deformsurvey.ts +2162 -0
- package/src/depth.ts +784 -0
- package/src/diff.ts +2252 -0
- package/src/emit.ts +134 -0
- package/src/emit_spine.ts +854 -0
- package/src/errors.ts +53 -0
- package/src/framing.ts +819 -0
- package/src/generation.ts +139 -0
- package/src/ingest.ts +2293 -0
- package/src/json-position.ts +253 -0
- package/src/keyorder.ts +587 -0
- package/src/keys.ts +486 -0
- package/src/ladder.ts +121 -0
- package/src/mesh.ts +2382 -0
- package/src/meshcompare.ts +1191 -0
- package/src/meshquality.ts +2051 -0
- package/src/meshrasters.ts +944 -0
- package/src/meshreduce.ts +1444 -0
- package/src/model.ts +1245 -0
- package/src/motion.ts +809 -0
- package/src/nonfinite.ts +54 -0
- package/src/package_meta.ts +48 -0
- package/src/png.ts +297 -0
- package/src/pose.ts +2324 -0
- package/src/preview.ts +434 -0
- package/src/region_joins.ts +54 -0
- package/src/render.ts +1013 -0
- package/src/render_core.ts +871 -0
- package/src/render_shared.ts +2958 -0
- package/src/repack.ts +495 -0
- package/src/rig.ts +2941 -0
- package/src/slots.ts +892 -0
- package/src/spine_side.ts +138 -0
- package/src/timelines.ts +837 -0
- package/src/trackgen.ts +364 -0
- package/src/transform.ts +310 -0
- package/src/types.ts +1797 -0
- package/src/validate.ts +3875 -0
- package/tools/contact.ts +126 -0
- package/tools/editor_roundtrip.ts +1641 -0
- package/tools/font5x7.ts +101 -0
- package/tools/measure_contact_depth.ts +105 -0
- package/tools/plate.ts +508 -0
- package/tools/png_probe.mjs +72 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort line/column for a `JSON.parse` failure.
|
|
3
|
+
*
|
|
4
|
+
* Bun's `JSON.parse` (JavaScriptCore) names the fault — `JSON Parse error:
|
|
5
|
+
* Property name must be a string literal` — and never a position, so a caller
|
|
6
|
+
* only ever learns which file was bad, not where inside it. This module fills
|
|
7
|
+
* that gap without a dependency: it re-walks the text through a minimal,
|
|
8
|
+
* hand-written JSON grammar and stops at the first place that grammar
|
|
9
|
+
* disagrees with the text.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ This is not a JSON parser used to parse anything — `JSON.parse` still owns
|
|
12
|
+
* every successful parse and every error MESSAGE. `locateJsonError` only ever
|
|
13
|
+
* runs after `JSON.parse` has already thrown, purely to attribute a position to
|
|
14
|
+
* the failure it already found. That is why it does not have to be a complete,
|
|
15
|
+
* spec-perfect grammar: for the ordinary mistakes (an unquoted key, a trailing
|
|
16
|
+
* comma, a missing colon, an unterminated string) the two parsers diverge at
|
|
17
|
+
* the same character, so the position is exact. Wherever this scanner is
|
|
18
|
+
* looser or stricter than `JSON.parse` in some corner, the position can be
|
|
19
|
+
* early rather than exactly the runtime's own stopping point — which is why
|
|
20
|
+
* it is documented, and named, as best-effort rather than exact.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export interface JsonPosition {
|
|
24
|
+
/** 1-based, like every editor and every compiler diagnostic. */
|
|
25
|
+
line: number;
|
|
26
|
+
column: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Thrown internally the moment the grammar walk disagrees with the text. */
|
|
30
|
+
class ScanStopped {
|
|
31
|
+
constructor(readonly position: JsonPosition) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class Cursor {
|
|
35
|
+
private i = 0;
|
|
36
|
+
private line = 1;
|
|
37
|
+
private column = 1;
|
|
38
|
+
|
|
39
|
+
constructor(private readonly text: string) {}
|
|
40
|
+
|
|
41
|
+
get done(): boolean {
|
|
42
|
+
return this.i >= this.text.length;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
peek(): string | undefined {
|
|
46
|
+
return this.text[this.i];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
startsWith(s: string): boolean {
|
|
50
|
+
return this.text.startsWith(s, this.i);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
advance(): void {
|
|
54
|
+
if (this.text[this.i] === '\n') {
|
|
55
|
+
this.line++;
|
|
56
|
+
this.column = 1;
|
|
57
|
+
} else {
|
|
58
|
+
this.column++;
|
|
59
|
+
}
|
|
60
|
+
this.i++;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
position(): JsonPosition {
|
|
64
|
+
return { line: this.line, column: this.column };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isDigit(c: string | undefined): boolean {
|
|
69
|
+
return c !== undefined && c >= '0' && c <= '9';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isHexDigit(c: string | undefined): boolean {
|
|
73
|
+
return c !== undefined && ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isWhitespace(c: string | undefined): boolean {
|
|
77
|
+
return c === ' ' || c === '\t' || c === '\n' || c === '\r';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function stop(cur: Cursor): never {
|
|
81
|
+
throw new ScanStopped(cur.position());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function skipWhitespace(cur: Cursor): void {
|
|
85
|
+
while (!cur.done && isWhitespace(cur.peek())) cur.advance();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function skipLiteral(cur: Cursor, length: number): void {
|
|
89
|
+
for (let k = 0; k < length; k++) cur.advance();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const STRING_ESCAPES = new Set(['"', '\\', '/', 'b', 'f', 'n', 'r', 't']);
|
|
93
|
+
|
|
94
|
+
function scanString(cur: Cursor): void {
|
|
95
|
+
cur.advance(); // opening quote
|
|
96
|
+
for (;;) {
|
|
97
|
+
if (cur.done) stop(cur);
|
|
98
|
+
const c = cur.peek()!;
|
|
99
|
+
if (c === '"') {
|
|
100
|
+
cur.advance();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (c === '\\') {
|
|
104
|
+
cur.advance();
|
|
105
|
+
const esc = cur.peek();
|
|
106
|
+
if (esc !== undefined && STRING_ESCAPES.has(esc)) {
|
|
107
|
+
cur.advance();
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (esc === 'u') {
|
|
111
|
+
cur.advance();
|
|
112
|
+
for (let k = 0; k < 4; k++) {
|
|
113
|
+
if (!isHexDigit(cur.peek())) stop(cur);
|
|
114
|
+
cur.advance();
|
|
115
|
+
}
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
stop(cur); // unknown escape
|
|
119
|
+
}
|
|
120
|
+
if (c.charCodeAt(0) < 0x20) stop(cur); // raw control character in a string
|
|
121
|
+
cur.advance();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function scanNumber(cur: Cursor): void {
|
|
126
|
+
if (cur.peek() === '-') cur.advance();
|
|
127
|
+
if (cur.peek() === '0') {
|
|
128
|
+
cur.advance();
|
|
129
|
+
} else if (isDigit(cur.peek())) {
|
|
130
|
+
while (isDigit(cur.peek())) cur.advance();
|
|
131
|
+
} else {
|
|
132
|
+
stop(cur);
|
|
133
|
+
}
|
|
134
|
+
if (cur.peek() === '.') {
|
|
135
|
+
cur.advance();
|
|
136
|
+
if (!isDigit(cur.peek())) stop(cur);
|
|
137
|
+
while (isDigit(cur.peek())) cur.advance();
|
|
138
|
+
}
|
|
139
|
+
if (cur.peek() === 'e' || cur.peek() === 'E') {
|
|
140
|
+
cur.advance();
|
|
141
|
+
if (cur.peek() === '+' || cur.peek() === '-') cur.advance();
|
|
142
|
+
if (!isDigit(cur.peek())) stop(cur);
|
|
143
|
+
while (isDigit(cur.peek())) cur.advance();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function scanValue(cur: Cursor): void {
|
|
148
|
+
skipWhitespace(cur);
|
|
149
|
+
if (cur.done) stop(cur);
|
|
150
|
+
const c = cur.peek();
|
|
151
|
+
if (c === '{') return scanObject(cur);
|
|
152
|
+
if (c === '[') return scanArray(cur);
|
|
153
|
+
if (c === '"') return scanString(cur);
|
|
154
|
+
if (c === '-' || isDigit(c)) return scanNumber(cur);
|
|
155
|
+
if (cur.startsWith('true')) return skipLiteral(cur, 4);
|
|
156
|
+
if (cur.startsWith('false')) return skipLiteral(cur, 5);
|
|
157
|
+
if (cur.startsWith('null')) return skipLiteral(cur, 4);
|
|
158
|
+
stop(cur);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function scanObject(cur: Cursor): void {
|
|
162
|
+
cur.advance(); // '{'
|
|
163
|
+
skipWhitespace(cur);
|
|
164
|
+
if (cur.peek() === '}') {
|
|
165
|
+
cur.advance();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
for (;;) {
|
|
169
|
+
skipWhitespace(cur);
|
|
170
|
+
// The classic unquoted-key mistake stops here — this is
|
|
171
|
+
// "Property name must be a string literal" in JavaScriptCore's own words.
|
|
172
|
+
if (cur.peek() !== '"') stop(cur);
|
|
173
|
+
scanString(cur);
|
|
174
|
+
skipWhitespace(cur);
|
|
175
|
+
if (cur.peek() !== ':') stop(cur);
|
|
176
|
+
cur.advance();
|
|
177
|
+
scanValue(cur);
|
|
178
|
+
skipWhitespace(cur);
|
|
179
|
+
const c = cur.peek();
|
|
180
|
+
if (c === ',') {
|
|
181
|
+
cur.advance();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (c === '}') {
|
|
185
|
+
cur.advance();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
stop(cur);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function scanArray(cur: Cursor): void {
|
|
193
|
+
cur.advance(); // '['
|
|
194
|
+
skipWhitespace(cur);
|
|
195
|
+
if (cur.peek() === ']') {
|
|
196
|
+
cur.advance();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
for (;;) {
|
|
200
|
+
scanValue(cur);
|
|
201
|
+
skipWhitespace(cur);
|
|
202
|
+
const c = cur.peek();
|
|
203
|
+
if (c === ',') {
|
|
204
|
+
cur.advance();
|
|
205
|
+
skipWhitespace(cur);
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (c === ']') {
|
|
209
|
+
cur.advance();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
stop(cur);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Where, in `text`, a strict JSON parse first disagrees with it. Best-effort:
|
|
218
|
+
* see the module doc for what that means and why.
|
|
219
|
+
*/
|
|
220
|
+
export function locateJsonError(text: string): JsonPosition {
|
|
221
|
+
const cur = new Cursor(text);
|
|
222
|
+
try {
|
|
223
|
+
scanValue(cur);
|
|
224
|
+
skipWhitespace(cur);
|
|
225
|
+
if (!cur.done) stop(cur); // trailing content after the one top-level value
|
|
226
|
+
} catch (err) {
|
|
227
|
+
if (err instanceof ScanStopped) return err.position;
|
|
228
|
+
throw err;
|
|
229
|
+
}
|
|
230
|
+
// The grammar walk above found nothing wrong, even though `JSON.parse` did —
|
|
231
|
+
// this scanner is looser than the runtime parser in whatever way this file's
|
|
232
|
+
// fault is. Rather than claim a location it did not actually find, it points
|
|
233
|
+
// at the end of the file.
|
|
234
|
+
return cur.position();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* `JSON.parse`, with a `(line N, column N)` suffix appended to the message
|
|
239
|
+
* whenever it throws a `SyntaxError` — the runtime's own message, positioned.
|
|
240
|
+
* Any other error (a non-JSON exception `JSON.parse` never actually throws,
|
|
241
|
+
* kept here only for type safety) passes through unchanged.
|
|
242
|
+
*/
|
|
243
|
+
export function parseJsonWithPosition(text: string): unknown {
|
|
244
|
+
try {
|
|
245
|
+
return JSON.parse(text);
|
|
246
|
+
} catch (err) {
|
|
247
|
+
if (err instanceof SyntaxError) {
|
|
248
|
+
const { line, column } = locateJsonError(text);
|
|
249
|
+
throw new SyntaxError(`${err.message} (line ${line}, column ${column})`);
|
|
250
|
+
}
|
|
251
|
+
throw err;
|
|
252
|
+
}
|
|
253
|
+
}
|