@clipkit/lint 1.0.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 +201 -0
- package/README.md +32 -0
- package/dist/describe.d.ts +3 -0
- package/dist/describe.d.ts.map +1 -0
- package/dist/describe.js +67 -0
- package/dist/describe.js.map +1 -0
- package/dist/dropped-keys.d.ts +2 -0
- package/dist/dropped-keys.d.ts.map +1 -0
- package/dist/dropped-keys.js +38 -0
- package/dist/dropped-keys.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/lint.d.ts +8 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +75 -0
- package/dist/lint.js.map +1 -0
- package/dist/schema-keys.d.ts +2 -0
- package/dist/schema-keys.d.ts.map +1 -0
- package/dist/schema-keys.js +35 -0
- package/dist/schema-keys.js.map +1 -0
- package/dist/suggest.d.ts +4 -0
- package/dist/suggest.d.ts.map +1 -0
- package/dist/suggest.js +48 -0
- package/dist/suggest.js.map +1 -0
- package/dist/unknown-keys.d.ts +9 -0
- package/dist/unknown-keys.d.ts.map +1 -0
- package/dist/unknown-keys.js +105 -0
- package/dist/unknown-keys.js.map +1 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Clipkit Contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @clipkit/lint
|
|
2
|
+
|
|
3
|
+
Protocol-aware *soft* checks and plain-language summaries for Clipkit Sources.
|
|
4
|
+
|
|
5
|
+
These are pure functions over a validated `Source` — no I/O, no rendering. They catch the things
|
|
6
|
+
that pass schema validation but still surprise you at render time, and they describe a project in
|
|
7
|
+
words so a human or an agent can sanity-check it without rendering. Shared by `@clipkit/cli`
|
|
8
|
+
(`explain`, `validate --explain`) and `@clipkit/mcp-server` (`validate_project`,
|
|
9
|
+
`describe_project`).
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { lintSource, describe } from '@clipkit/lint';
|
|
13
|
+
|
|
14
|
+
for (const w of lintSource(source)) console.log(`${w.where}: ${w.message}`);
|
|
15
|
+
console.log(describe(source));
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## `lintSource(source) → LintWarning[]`
|
|
19
|
+
|
|
20
|
+
Returns warnings for things the runtime will silently drop or clip:
|
|
21
|
+
|
|
22
|
+
- **No top-level `duration`** — the runtime can't tell how long the composition is.
|
|
23
|
+
- **Element runs past the composition end** — it'll be cut off.
|
|
24
|
+
- **Non-ASCII text / caption words** — the runtime text atlas is a fixed ASCII coverage font, so
|
|
25
|
+
emoji, accents, smart quotes, and CJK are silently dropped.
|
|
26
|
+
|
|
27
|
+
`LintWarning` is `{ where: string; message: string }` — `where` is an element id or `(source)`.
|
|
28
|
+
|
|
29
|
+
## `describe(source) → string`
|
|
30
|
+
|
|
31
|
+
A plain-language read-back: dimensions · fps · duration · format, an element breakdown by type, a
|
|
32
|
+
per-track timeline (paint order low→high), and the `lintSource` warnings.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAgE1C"}
|
package/dist/describe.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// A plain-language read-back of a Source so a human or an agent can sanity-check
|
|
2
|
+
// what was authored WITHOUT rendering: dimensions, fps, duration, a per-track
|
|
3
|
+
// timeline, an element breakdown, plus the protocol-aware warnings from lint.ts.
|
|
4
|
+
// The fast inner loop of an author→verify→fix cycle.
|
|
5
|
+
import { lintSource } from './lint.js';
|
|
6
|
+
export function describe(s) {
|
|
7
|
+
const c = s;
|
|
8
|
+
const out = [];
|
|
9
|
+
out.push(`${c.width ?? '?'}×${c.height ?? '?'} · ${c.frame_rate ?? '?'}fps · ${c.duration ?? '?'}s · ${c.output_format ?? 'mp4'}` +
|
|
10
|
+
(c.background_color ? ` · bg ${c.background_color}` : ''));
|
|
11
|
+
const els = c.elements ?? [];
|
|
12
|
+
const byType = new Map();
|
|
13
|
+
for (const e of els) {
|
|
14
|
+
const t = String(e.type ?? 'unknown');
|
|
15
|
+
byType.set(t, (byType.get(t) ?? 0) + 1);
|
|
16
|
+
}
|
|
17
|
+
out.push(`${els.length} element${els.length === 1 ? '' : 's'}` +
|
|
18
|
+
(byType.size ? ` (${[...byType].map(([t, n]) => `${n} ${t}`).join(', ')})` : ''));
|
|
19
|
+
// Timeline grouped by layer, each layer ordered by start time.
|
|
20
|
+
const layers = new Map();
|
|
21
|
+
for (const e of els) {
|
|
22
|
+
const ly = typeof e.layer === 'number' ? e.layer : 0;
|
|
23
|
+
if (!layers.has(ly))
|
|
24
|
+
layers.set(ly, []);
|
|
25
|
+
layers.get(ly).push(e);
|
|
26
|
+
}
|
|
27
|
+
if (layers.size) {
|
|
28
|
+
out.push('');
|
|
29
|
+
out.push('Timeline (by layer, 1 = top/front):');
|
|
30
|
+
for (const ly of [...layers.keys()].sort((a, b) => a - b)) {
|
|
31
|
+
out.push(` layer ${ly}`);
|
|
32
|
+
const items = layers
|
|
33
|
+
.get(ly)
|
|
34
|
+
.slice()
|
|
35
|
+
.sort((a, b) => num(a.time) - num(b.time));
|
|
36
|
+
for (const e of items) {
|
|
37
|
+
const t = num(e.time);
|
|
38
|
+
const d = typeof e.duration === 'number' ? e.duration : undefined;
|
|
39
|
+
const span = d !== undefined ? `${t.toFixed(2)}–${(t + d).toFixed(2)}s` : `${t.toFixed(2)}s →`;
|
|
40
|
+
const label = e.id ? `${String(e.type)} #${String(e.id)}` : String(e.type);
|
|
41
|
+
out.push(` ${span.padEnd(16)} ${label}${textPreview(e)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const warnings = lintSource(s);
|
|
46
|
+
out.push('');
|
|
47
|
+
if (warnings.length === 0) {
|
|
48
|
+
out.push('✓ No warnings.');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
out.push(`⚠ ${warnings.length} warning${warnings.length === 1 ? '' : 's'}:`);
|
|
52
|
+
for (const w of warnings)
|
|
53
|
+
out.push(` - ${w.where}: ${w.message}`);
|
|
54
|
+
}
|
|
55
|
+
return out.join('\n') + '\n';
|
|
56
|
+
}
|
|
57
|
+
function num(v) {
|
|
58
|
+
return typeof v === 'number' ? v : 0;
|
|
59
|
+
}
|
|
60
|
+
function textPreview(e) {
|
|
61
|
+
if (e.type === 'text' && typeof e.text === 'string' && e.text.length) {
|
|
62
|
+
const t = e.text.length > 32 ? `${e.text.slice(0, 32)}…` : e.text;
|
|
63
|
+
return ` "${t}"`;
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,8EAA8E;AAC9E,iFAAiF;AACjF,qDAAqD;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,MAAM,CAAC,GAAG,CAQT,CAAC;IACF,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,GAAG,CAAC,IAAI,CACN,GAAG,CAAC,CAAC,K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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,WAAW,CAAC,CAA0B;IAC7C,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClE,OAAO,MAAM,CAAC,GAAG,CAAC;IACpB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropped-keys.d.ts","sourceRoot":"","sources":["../src/dropped-keys.ts"],"names":[],"mappings":"AAkBA,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,MAAM,EAAE,CAuBnF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// droppedKeys — keys present in the input but missing from the schema-validated
|
|
2
|
+
// output, i.e. STRIPPED. The "closed" sub-objects (effects, paths, gradients,
|
|
3
|
+
// mask, animations, keyframes) are plain Zod objects that silently drop unknown
|
|
4
|
+
// keys on parse, so a wrong key there validates fine and vanishes. This diff
|
|
5
|
+
// finds them. Complements unknownKeys, which handles the PASSTHROUGH objects
|
|
6
|
+
// (source, elements) where unknown keys instead SURVIVE validation. Together they
|
|
7
|
+
// flag unrecognized keys at every depth, whichever way the schema disposes of them.
|
|
8
|
+
//
|
|
9
|
+
// Best-effort structural diff; arrays are compared by index (the validator never
|
|
10
|
+
// reorders or filters), so the paths line up.
|
|
11
|
+
import { hint } from './suggest.js';
|
|
12
|
+
import { ALL_SCHEMA_KEYS } from './schema-keys.js';
|
|
13
|
+
function isPlainObject(v) {
|
|
14
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
15
|
+
}
|
|
16
|
+
export function droppedKeys(input, validated, path = '') {
|
|
17
|
+
const out = [];
|
|
18
|
+
if (Array.isArray(input) && Array.isArray(validated)) {
|
|
19
|
+
const n = Math.min(input.length, validated.length);
|
|
20
|
+
for (let i = 0; i < n; i++) {
|
|
21
|
+
out.push(...droppedKeys(input[i], validated[i], `${path}[${i}]`));
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
if (isPlainObject(input) && isPlainObject(validated)) {
|
|
26
|
+
for (const key of Object.keys(input)) {
|
|
27
|
+
const childPath = path ? `${path}.${key}` : key;
|
|
28
|
+
if (!(key in validated)) {
|
|
29
|
+
out.push(childPath + hint(key, ALL_SCHEMA_KEYS));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
out.push(...droppedKeys(input[key], validated[key], childPath));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=dropped-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropped-keys.js","sourceRoot":"","sources":["../src/dropped-keys.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,kFAAkF;AAClF,oFAAoF;AACpF,EAAE;AACF,iFAAiF;AACjF,8CAA8C;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CA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ED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { lintSource, type LintWarning } from './lint.js';
|
|
2
|
+
export { describe } from './describe.js';
|
|
3
|
+
export { unknownKeys, unknownElementKeys, unrecognizedKeys, unrecognizedElementKeys, } from './unknown-keys.js';
|
|
4
|
+
export { droppedKeys } from './dropped-keys.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @clipkit/lint — protocol-aware soft checks + plain-language summaries.
|
|
2
|
+
// Pure functions over a validated Source; no I/O. Shared by the CLI and MCP server.
|
|
3
|
+
export { lintSource } from './lint.js';
|
|
4
|
+
export { describe } from './describe.js';
|
|
5
|
+
export { unknownKeys, unknownElementKeys, unrecognizedKeys, unrecognizedElementKeys, } from './unknown-keys.js';
|
|
6
|
+
export { droppedKeys } from './dropped-keys.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oFAAoF;AAEpF,OAAO,EAAE,UAAU,EAAoB,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/lint.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Source } from '@clipkit/protocol';
|
|
2
|
+
export interface LintWarning {
|
|
3
|
+
/** Element id, or '(source)' for composition-level issues. */
|
|
4
|
+
where: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function lintSource(source: Source): LintWarning[];
|
|
8
|
+
//# sourceMappingURL=lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAWD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAmExD"}
|
package/dist/lint.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Protocol-aware "soft" checks — things that pass schema validation but will
|
|
2
|
+
// surprise you at render time. Shared by the CLI (`explain`, `validate --explain`)
|
|
3
|
+
// and the MCP server (`validate_project`, `describe_project`).
|
|
4
|
+
// The runtime text/caption renderer uses a fixed ASCII coverage-font atlas;
|
|
5
|
+
// any non-ASCII glyph (emoji, accents, smart quotes, CJK) is silently dropped.
|
|
6
|
+
const NON_ASCII = /[^\x00-\x7F]/;
|
|
7
|
+
function firstNonAscii(s) {
|
|
8
|
+
const m = NON_ASCII.exec(s);
|
|
9
|
+
return m ? m[0] : null;
|
|
10
|
+
}
|
|
11
|
+
export function lintSource(source) {
|
|
12
|
+
const warnings = [];
|
|
13
|
+
const comp = source;
|
|
14
|
+
const compDuration = typeof comp.duration === 'number' ? comp.duration : undefined;
|
|
15
|
+
if (compDuration === undefined) {
|
|
16
|
+
warnings.push({
|
|
17
|
+
where: '(source)',
|
|
18
|
+
message: "No top-level `duration` — the runtime can't tell how long the composition is. Set `duration` (seconds).",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const elements = Array.isArray(comp.elements) ? comp.elements : [];
|
|
22
|
+
for (const el of elements) {
|
|
23
|
+
const e = el;
|
|
24
|
+
const id = typeof e.id === 'string' ? e.id : `(${String(e.type ?? 'element')})`;
|
|
25
|
+
const time = typeof e.time === 'number' ? e.time : 0;
|
|
26
|
+
const dur = typeof e.duration === 'number' ? e.duration : undefined;
|
|
27
|
+
// Runs past the composition's end → it'll be cut off.
|
|
28
|
+
if (compDuration !== undefined && dur !== undefined && time + dur > compDuration + 1e-6) {
|
|
29
|
+
warnings.push({
|
|
30
|
+
where: id,
|
|
31
|
+
message: `Ends at ${(time + dur).toFixed(2)}s, past the composition's ${compDuration}s — it'll be cut off.`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// Non-ASCII in text-bearing fields (dropped by the ASCII atlas).
|
|
35
|
+
if (e.type === 'text') {
|
|
36
|
+
const texts = [];
|
|
37
|
+
if (typeof e.text === 'string')
|
|
38
|
+
texts.push(e.text);
|
|
39
|
+
if (Array.isArray(e.spans)) {
|
|
40
|
+
for (const sp of e.spans) {
|
|
41
|
+
const t = sp?.text;
|
|
42
|
+
if (typeof t === 'string')
|
|
43
|
+
texts.push(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const t of texts) {
|
|
47
|
+
const ch = firstNonAscii(t);
|
|
48
|
+
if (ch) {
|
|
49
|
+
warnings.push({
|
|
50
|
+
where: id,
|
|
51
|
+
message: `Text has a non-ASCII character ("${ch}") — the runtime's ASCII font atlas drops these (emoji, accents, smart quotes, CJK). Use plain ASCII.`,
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (e.type === 'caption' && Array.isArray(e.words)) {
|
|
58
|
+
for (const w of e.words) {
|
|
59
|
+
const t = w?.text;
|
|
60
|
+
if (typeof t === 'string') {
|
|
61
|
+
const ch = firstNonAscii(t);
|
|
62
|
+
if (ch) {
|
|
63
|
+
warnings.push({
|
|
64
|
+
where: id,
|
|
65
|
+
message: `Caption word has a non-ASCII character ("${ch}") — dropped by the runtime's ASCII atlas.`,
|
|
66
|
+
});
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return warnings;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=lint.js.map
|
package/dist/lint.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,mFAAmF;AACnF,+DAA+D;AAU/D,4EAA4E;AAC5E,+EAA+E;AAC/E,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,SAAS,aAAa,CAAC,CAAS;IAC9B,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,MAAM,IAAI,GAAG,MAAgE,CAAC;IAC9E,MAAM,YAAY,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAEnF,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC;Y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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-keys.d.ts","sourceRoot":"","sources":["../src/schema-keys.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,eAAe,EAAE,MAAM,EAQhC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Every property name anywhere in the protocol schema — the candidate pool for
|
|
2
|
+
// "did you mean?" suggestions on unrecognized keys (so a camelCase field at any
|
|
3
|
+
// depth, e.g. `blurRadius` inside a glass effect, can be matched to its real
|
|
4
|
+
// snake_case name). Built once by walking the generated JSON Schema for all
|
|
5
|
+
// `properties` blocks. Best-effort: on any failure it's empty → no suggestions.
|
|
6
|
+
import { sourceSchema } from '@clipkit/protocol';
|
|
7
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
8
|
+
function collect(node, out) {
|
|
9
|
+
if (Array.isArray(node)) {
|
|
10
|
+
for (const x of node)
|
|
11
|
+
collect(x, out);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (node && typeof node === 'object') {
|
|
15
|
+
const o = node;
|
|
16
|
+
const props = o.properties;
|
|
17
|
+
if (props && typeof props === 'object' && !Array.isArray(props)) {
|
|
18
|
+
for (const k of Object.keys(props))
|
|
19
|
+
out.add(k);
|
|
20
|
+
}
|
|
21
|
+
for (const v of Object.values(o))
|
|
22
|
+
collect(v, out);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const ALL_SCHEMA_KEYS = (() => {
|
|
26
|
+
const out = new Set();
|
|
27
|
+
try {
|
|
28
|
+
collect(zodToJsonSchema(sourceSchema, { name: 'ClipkitSource', $refStrategy: 'root' }), out);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
/* leave empty — never crash the linter over a suggestion */
|
|
32
|
+
}
|
|
33
|
+
return [...out];
|
|
34
|
+
})();
|
|
35
|
+
//# sourceMappingURL=schema-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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C;IAAC,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function suggest(bad: string, candidates: readonly string[]): string | undefined;
|
|
2
|
+
/** ` (did you mean X?)` if a close valid key exists, else ''. */
|
|
3
|
+
export declare function hint(bad: string, candidates: readonly string[]): string;
|
|
4
|
+
//# sourceMappingURL=suggest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../src/suggest.ts"],"names":[],"mappings":"AAwBA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAgBtF;AAED,iEAAiE;AACjE,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAGvE"}
|
package/dist/suggest.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Suggest the closest valid key for a mistyped one. Targets the dominant LLM
|
|
2
|
+
// mistake — camelCase vs the protocol's snake_case — via a NORMALIZED match
|
|
3
|
+
// (case- and underscore-insensitive), plus 1-char typos via edit distance.
|
|
4
|
+
// Conservative: returns nothing unless a candidate is clearly close, so it never
|
|
5
|
+
// invents a misleading "did you mean".
|
|
6
|
+
function normalize(s) {
|
|
7
|
+
return s.toLowerCase().replace(/[_-]/g, '');
|
|
8
|
+
}
|
|
9
|
+
function editDistance(a, b) {
|
|
10
|
+
const m = a.length;
|
|
11
|
+
const n = b.length;
|
|
12
|
+
let prev = Array.from({ length: n + 1 }, (_, j) => j);
|
|
13
|
+
for (let i = 1; i <= m; i++) {
|
|
14
|
+
const cur = [i];
|
|
15
|
+
for (let j = 1; j <= n; j++) {
|
|
16
|
+
cur[j] = Math.min(prev[j] + 1, cur[j - 1] + 1, prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
17
|
+
}
|
|
18
|
+
prev = cur;
|
|
19
|
+
}
|
|
20
|
+
return prev[n];
|
|
21
|
+
}
|
|
22
|
+
export function suggest(bad, candidates) {
|
|
23
|
+
if (bad.length < 3)
|
|
24
|
+
return undefined;
|
|
25
|
+
const nb = normalize(bad);
|
|
26
|
+
let best;
|
|
27
|
+
let bestScore = Infinity;
|
|
28
|
+
for (const c of candidates) {
|
|
29
|
+
if (c === bad)
|
|
30
|
+
continue;
|
|
31
|
+
const score = normalize(c) === nb ? 0 : editDistance(nb, normalize(c));
|
|
32
|
+
if (score < bestScore) {
|
|
33
|
+
bestScore = score;
|
|
34
|
+
best = c;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (bestScore === 0)
|
|
38
|
+
return best; // normalized-exact: camelCase ↔ snake_case
|
|
39
|
+
if (bestScore === 1 && nb.length >= 4)
|
|
40
|
+
return best; // a single-char typo
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/** ` (did you mean X?)` if a close valid key exists, else ''. */
|
|
44
|
+
export function hint(bad, candidates) {
|
|
45
|
+
const s = suggest(bad, candidates);
|
|
46
|
+
return s ? ` (did you mean ${s}?)` : '';
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=suggest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../src/suggest.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,iFAAiF;AACjF,uCAAuC;AAEvC,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS;IACxC,MAAM,CAAC,GAAG,CAAC,CA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xB,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;YACtB,SAAS,GAAG,KAAK,CAAC;YAClB,IAAI,GAAG,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,2CAA2C;IAC7E,IAAI,SAAS,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,qBAAqB;IACzE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,IAAI,CAAC,GAAW,EAAE,UAA6B;IAC7D,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACnC,OAAO,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Unrecognized keys anywhere in a Source: top-level + every element. */
|
|
2
|
+
export declare function unknownKeys(source: unknown): string[];
|
|
3
|
+
/** Unrecognized keys on a single element (recursing into group children). */
|
|
4
|
+
export declare function unknownElementKeys(element: unknown): string[];
|
|
5
|
+
/** All unrecognized keys in a Source (pass `validated` = the validate() output). */
|
|
6
|
+
export declare function unrecognizedKeys(input: unknown, validated: unknown): string[];
|
|
7
|
+
/** All unrecognized keys on one element (pass `validated` = its validated form). */
|
|
8
|
+
export declare function unrecognizedElementKeys(element: unknown, validated: unknown): string[];
|
|
9
|
+
//# sourceMappingURL=unknown-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown-keys.d.ts","sourceRoot":"","sources":["../src/unknown-keys.ts"],"names":[],"mappings":"AA+DA,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAYrD;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAI7D;AAYD,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAE7E;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAEtF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// unknownKeys — element/source keys the Clipkit schema doesn't define.
|
|
2
|
+
//
|
|
3
|
+
// The protocol validator PASSES unknown keys through (it does not strip them),
|
|
4
|
+
// and the runtime simply ignores fields it doesn't implement — so a misspelled
|
|
5
|
+
// or unsupported field (e.g. `fillColour`, or the unimplemented `text_template`)
|
|
6
|
+
// validates fine and then renders wrong, with no signal. This compares the
|
|
7
|
+
// authored keys against the schema's KNOWN keys (introspected from the Zod
|
|
8
|
+
// source of truth) so an authoring tool can say "that key isn't recognized."
|
|
9
|
+
//
|
|
10
|
+
// Scope: top-level Source keys and each element's own keys (recursing into group
|
|
11
|
+
// children). It does NOT descend into nested sub-objects (effects, paths,
|
|
12
|
+
// keyframes) — those would need per-schema introspection; this catches the
|
|
13
|
+
// common top-level mistakes, including the whole text_template class.
|
|
14
|
+
import { elementSchema, sourceSchema } from '@clipkit/protocol';
|
|
15
|
+
import { droppedKeys } from './dropped-keys.js';
|
|
16
|
+
import { hint } from './suggest.js';
|
|
17
|
+
import { ALL_SCHEMA_KEYS } from './schema-keys.js';
|
|
18
|
+
function isObj(v) {
|
|
19
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
20
|
+
}
|
|
21
|
+
// Unwrap ZodEffects/optional/default/etc. to the underlying object's shape keys.
|
|
22
|
+
function shapeKeys(schema) {
|
|
23
|
+
let s = schema;
|
|
24
|
+
for (let i = 0; i < 6 && s; i++) {
|
|
25
|
+
if (s.shape)
|
|
26
|
+
return Object.keys(s.shape);
|
|
27
|
+
const d = s._def;
|
|
28
|
+
if (!d)
|
|
29
|
+
break;
|
|
30
|
+
s = (d.schema ?? d.innerType ?? d.type);
|
|
31
|
+
}
|
|
32
|
+
const shape = s && s.shape;
|
|
33
|
+
return shape ? Object.keys(shape) : [];
|
|
34
|
+
}
|
|
35
|
+
const SOURCE_KEYS = new Set(shapeKeys(sourceSchema));
|
|
36
|
+
const ELEMENT_KEYS_BY_TYPE = {};
|
|
37
|
+
{
|
|
38
|
+
const u = elementSchema;
|
|
39
|
+
const opts = u._def?.options ?? u.options ?? [];
|
|
40
|
+
for (const opt of opts) {
|
|
41
|
+
const shape = opt.shape;
|
|
42
|
+
if (!shape)
|
|
43
|
+
continue;
|
|
44
|
+
const typeLit = shape.type?._def?.value ?? shape.type?.value;
|
|
45
|
+
if (typeof typeLit === 'string')
|
|
46
|
+
ELEMENT_KEYS_BY_TYPE[typeLit] = new Set(Object.keys(shape));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function collectUnknown(el, prefix, out) {
|
|
50
|
+
const type = typeof el.type === 'string' ? el.type : '';
|
|
51
|
+
const known = ELEMENT_KEYS_BY_TYPE[type];
|
|
52
|
+
if (known) {
|
|
53
|
+
for (const k of Object.keys(el))
|
|
54
|
+
if (!known.has(k))
|
|
55
|
+
out.push(prefix + k + hint(k, ALL_SCHEMA_KEYS));
|
|
56
|
+
}
|
|
57
|
+
if (type === 'group' && Array.isArray(el.elements)) {
|
|
58
|
+
el.elements.forEach((c, i) => {
|
|
59
|
+
if (isObj(c))
|
|
60
|
+
collectUnknown(c, `${prefix}elements[${i}].`, out);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Unrecognized keys anywhere in a Source: top-level + every element. */
|
|
65
|
+
export function unknownKeys(source) {
|
|
66
|
+
const out = [];
|
|
67
|
+
if (!isObj(source))
|
|
68
|
+
return out;
|
|
69
|
+
if (SOURCE_KEYS.size) {
|
|
70
|
+
for (const k of Object.keys(source))
|
|
71
|
+
if (!SOURCE_KEYS.has(k))
|
|
72
|
+
out.push(k + hint(k, ALL_SCHEMA_KEYS));
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(source.elements)) {
|
|
75
|
+
source.elements.forEach((el, i) => {
|
|
76
|
+
if (isObj(el))
|
|
77
|
+
collectUnknown(el, `elements[${i}].`, out);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
/** Unrecognized keys on a single element (recursing into group children). */
|
|
83
|
+
export function unknownElementKeys(element) {
|
|
84
|
+
const out = [];
|
|
85
|
+
if (isObj(element))
|
|
86
|
+
collectUnknown(element, '', out);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
function union(a, b) {
|
|
90
|
+
return [...new Set([...a, ...b])];
|
|
91
|
+
}
|
|
92
|
+
// ── Combined detectors ──────────────────────────────────────────────────────
|
|
93
|
+
// The schema disposes of unrecognized keys two ways: passthrough objects (source,
|
|
94
|
+
// elements) KEEP them (→ unknownKeys, via schema introspection); closed objects
|
|
95
|
+
// (effects, paths, gradients, mask, animations) STRIP them (→ droppedKeys, via a
|
|
96
|
+
// diff against the validated output). Union both for complete coverage at any depth.
|
|
97
|
+
/** All unrecognized keys in a Source (pass `validated` = the validate() output). */
|
|
98
|
+
export function unrecognizedKeys(input, validated) {
|
|
99
|
+
return union(unknownKeys(input), droppedKeys(input, validated));
|
|
100
|
+
}
|
|
101
|
+
/** All unrecognized keys on one element (pass `validated` = its validated form). */
|
|
102
|
+
export function unrecognizedElementKeys(element, validated) {
|
|
103
|
+
return union(unknownElementKeys(element), droppedKeys(element, validated));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=unknown-keys.js.map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CAAC,OAAO,CAAC;QAAE,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,KAAK,CAAC,CAAW,EAAE,CAAW;IACrC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,+EAA+E;AAC/E,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,qFAAqF;AAErF,oFAAoF;AACpF,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,SAAkB;IACjE,OAAO,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,SAAkB;IAC1E,OAAO,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clipkit/lint",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Protocol-aware soft checks and plain-language summaries for Clipkit Sources. Shared by the CLI and the MCP server.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": { "type": "git", "url": "git+https://github.com/clipkit-video/clipkit.git", "directory": "packages/lint" },
|
|
7
|
+
"homepage": "https://clipkit.dev",
|
|
8
|
+
"bugs": "https://github.com/clipkit-video/clipkit/issues",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"test": "node --test test/*.test.mjs"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@clipkit/protocol": "^1.0.0",
|
|
32
|
+
"zod": "^3.24.1",
|
|
33
|
+
"zod-to-json-schema": "^3.24.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"typescript": "^5.7.3"
|
|
37
|
+
}
|
|
38
|
+
}
|