aicommunicator-plugin-check 0.1.0 → 0.2.1
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/README.md +35 -35
- package/dist/bundle.d.ts +7 -4
- package/dist/bundle.js +50 -35
- package/dist/icon.d.ts +10 -0
- package/dist/icon.js +61 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.js +41 -37
- package/dist/messages.js +33 -33
- package/dist/sample.d.ts +5 -2
- package/dist/sample.js +73 -64
- package/dist/state.js +7 -7
- package/package.json +2 -2
package/dist/manifest.js
CHANGED
|
@@ -46,17 +46,17 @@ function chars(s) {
|
|
|
46
46
|
/** 비어 있지 않은 글이고 한도 안인가. 문제가 있으면 그 설명이다. */
|
|
47
47
|
function textProblem(where, value, max) {
|
|
48
48
|
if (typeof value !== 'string' || value.trim() === '')
|
|
49
|
-
return `${where}
|
|
49
|
+
return `${where} must be non-empty text`;
|
|
50
50
|
if (chars(value) > max)
|
|
51
|
-
return `${where}
|
|
51
|
+
return `${where} is over ${max.toLocaleString('en-US')} characters (${chars(value)} characters)`;
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
/** 칸을 모두 아는 객체인가. 칸 이름을 잘못 적으면 조용히 빠지므로 모르는 칸은 받지 않는다. */
|
|
55
55
|
function objectProblem(where, value, known) {
|
|
56
56
|
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
57
|
-
return `${where}
|
|
57
|
+
return `${where} must be an object`;
|
|
58
58
|
const extra = Object.keys(value).filter((k) => !known.includes(k));
|
|
59
|
-
return extra.length > 0 ? `${where}
|
|
59
|
+
return extra.length > 0 ? `${where} has unknown fields: ${extra.join(', ')}` : null;
|
|
60
60
|
}
|
|
61
61
|
function requiresProblem(value) {
|
|
62
62
|
const problem = objectProblem('requires', value, ['os', 'external']);
|
|
@@ -65,18 +65,18 @@ function requiresProblem(value) {
|
|
|
65
65
|
const r = value;
|
|
66
66
|
if (r.os !== undefined && r.os !== 'any') {
|
|
67
67
|
if (!Array.isArray(r.os) || r.os.length === 0)
|
|
68
|
-
return 'requires.os
|
|
68
|
+
return 'requires.os must be "any" or a list of windows, macos, linux';
|
|
69
69
|
const bad = r.os.filter((o) => typeof o !== 'string' || !OS_NAMES.includes(o));
|
|
70
70
|
if (bad.length > 0)
|
|
71
|
-
return `requires.os
|
|
71
|
+
return `requires.os has an unknown operating system: ${bad.map((o) => JSON.stringify(o)).join(', ')}`;
|
|
72
72
|
if (new Set(r.os).size !== r.os.length)
|
|
73
|
-
return 'requires.os
|
|
73
|
+
return 'requires.os repeats the same operating system';
|
|
74
74
|
}
|
|
75
75
|
if (r.external !== undefined) {
|
|
76
76
|
if (!Array.isArray(r.external))
|
|
77
|
-
return 'requires.external
|
|
77
|
+
return 'requires.external must be a list of external tools';
|
|
78
78
|
if (r.external.length > 10)
|
|
79
|
-
return `requires.external
|
|
79
|
+
return `requires.external can have up to 10 entries (${r.external.length} given)`;
|
|
80
80
|
for (const [i, t] of r.external.entries()) {
|
|
81
81
|
const where = `requires.external[${i}]`;
|
|
82
82
|
const shape = objectProblem(where, t, ['name', 'kind', 'account', 'install', 'note']);
|
|
@@ -87,11 +87,11 @@ function requiresProblem(value) {
|
|
|
87
87
|
if (name)
|
|
88
88
|
return name;
|
|
89
89
|
if (typeof tool.kind !== 'string' || !TOOL_KINDS.includes(tool.kind))
|
|
90
|
-
return `${where}.kind
|
|
90
|
+
return `${where}.kind must be one of program, web, mcp`;
|
|
91
91
|
if (typeof tool.account !== 'string' || !ACCOUNTS.includes(tool.account))
|
|
92
|
-
return `${where}.account
|
|
92
|
+
return `${where}.account must be one of none, free, paid`;
|
|
93
93
|
if (typeof tool.install !== 'boolean')
|
|
94
|
-
return `${where}.install
|
|
94
|
+
return `${where}.install must be true or false`;
|
|
95
95
|
if (tool.note !== undefined) {
|
|
96
96
|
const note = textProblem(`${where}.note`, tool.note, 200);
|
|
97
97
|
if (note)
|
|
@@ -107,14 +107,14 @@ function requiresProblem(value) {
|
|
|
107
107
|
*/
|
|
108
108
|
function manualProblem(m) {
|
|
109
109
|
if (m.manual !== undefined && (!isPluginPath(m.manual) || !m.manual.endsWith('.md'))) {
|
|
110
|
-
return `manual ${JSON.stringify(m.manual)}
|
|
110
|
+
return `manual ${JSON.stringify(m.manual)} must be a relative path to a Markdown file (.md) inside the plugin folder (for example docs/manual.md)`;
|
|
111
111
|
}
|
|
112
112
|
if (m.samples === undefined)
|
|
113
113
|
return null;
|
|
114
114
|
if (!Array.isArray(m.samples))
|
|
115
|
-
return 'samples
|
|
115
|
+
return 'samples must be a list of { id, title, about, file }';
|
|
116
116
|
if (m.samples.length > MAX_SAMPLES)
|
|
117
|
-
return `samples
|
|
117
|
+
return `samples can have up to 5 entries (${m.samples.length} given)`;
|
|
118
118
|
const ids = new Set();
|
|
119
119
|
const files = new Set();
|
|
120
120
|
for (const [i, s] of m.samples.entries()) {
|
|
@@ -124,16 +124,16 @@ function manualProblem(m) {
|
|
|
124
124
|
return shape;
|
|
125
125
|
const sample = s;
|
|
126
126
|
if (typeof sample.id !== 'string' || !SAMPLE_ID.test(sample.id))
|
|
127
|
-
return `${where}.id
|
|
127
|
+
return `${where}.id must be 1 to 40 characters of lowercase English letters, digits, and -`;
|
|
128
128
|
const text = textProblem(`${where}.title`, sample.title, 100) ?? textProblem(`${where}.about`, sample.about, 300);
|
|
129
129
|
if (text)
|
|
130
130
|
return text;
|
|
131
131
|
if (!isPluginPath(sample.file) || !sample.file.endsWith('.json'))
|
|
132
|
-
return `${where}.file ${JSON.stringify(sample.file)}
|
|
132
|
+
return `${where}.file ${JSON.stringify(sample.file)} must be a relative path to a sample file (.json) inside the plugin folder (for example samples/first.json)`;
|
|
133
133
|
if (ids.has(sample.id))
|
|
134
|
-
return `samples
|
|
134
|
+
return `samples has the id ${sample.id} twice`;
|
|
135
135
|
if (files.has(sample.file))
|
|
136
|
-
return `samples
|
|
136
|
+
return `samples has the file ${sample.file} twice`;
|
|
137
137
|
ids.add(sample.id);
|
|
138
138
|
files.add(sample.file);
|
|
139
139
|
}
|
|
@@ -141,19 +141,19 @@ function manualProblem(m) {
|
|
|
141
141
|
}
|
|
142
142
|
function dependenciesProblem(id, value) {
|
|
143
143
|
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
144
|
-
return 'dependencies
|
|
144
|
+
return 'dependencies must be an object { "<id>": "<version range>" }';
|
|
145
145
|
const entries = Object.entries(value);
|
|
146
146
|
if (entries.length > MAX_DEPENDENCIES)
|
|
147
|
-
return `dependencies
|
|
147
|
+
return `dependencies can have up to ${MAX_DEPENDENCIES} entries (${entries.length} given)`;
|
|
148
148
|
for (const [dep, range] of entries) {
|
|
149
149
|
if (!isPluginId(dep))
|
|
150
|
-
return
|
|
150
|
+
return `${JSON.stringify(dep)} in dependencies is not shaped like a plugin id`;
|
|
151
151
|
if (RESERVED_IDS.includes(dep))
|
|
152
|
-
return `
|
|
152
|
+
return `Do not list ${dep} in dependencies. It is a name built into the core`;
|
|
153
153
|
if (dep === id)
|
|
154
|
-
return '
|
|
154
|
+
return 'Do not list the plugin itself in dependencies';
|
|
155
155
|
if (!isRange(range))
|
|
156
|
-
return
|
|
156
|
+
return `${JSON.stringify(range)} in dependencies.${dep} must have one of the shapes 1.2.3, ^1.2.3, ~1.2.3, >=1.2.3`;
|
|
157
157
|
}
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
@@ -163,25 +163,29 @@ function dependenciesProblem(id, value) {
|
|
|
163
163
|
*/
|
|
164
164
|
export function checkManifest(manifest) {
|
|
165
165
|
if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest))
|
|
166
|
-
return 'manifest
|
|
166
|
+
return 'manifest must be an object';
|
|
167
167
|
const m = manifest;
|
|
168
168
|
for (const key of ['id', 'version', 'logic']) {
|
|
169
169
|
if (typeof m[key] !== 'string')
|
|
170
|
-
return `manifest
|
|
170
|
+
return `manifest has no ${key}`;
|
|
171
171
|
}
|
|
172
172
|
const id = m.id;
|
|
173
173
|
if (!isPluginId(id))
|
|
174
|
-
return `id ${JSON.stringify(id)}
|
|
174
|
+
return `id ${JSON.stringify(id)} must look like account.plugin-name. Each part is 2 to 40 characters of lowercase English letters, digits, and -`;
|
|
175
175
|
if (RESERVED_IDS.includes(id))
|
|
176
|
-
return `id ${id}
|
|
176
|
+
return `id ${id} is a name built into the core, so it cannot be used as a plugin id`;
|
|
177
177
|
if (!isVersion(m.version))
|
|
178
|
-
return `version ${JSON.stringify(m.version)}
|
|
178
|
+
return `version ${JSON.stringify(m.version)} must be semver (number.number.number, optionally followed by -prerelease-name)`;
|
|
179
179
|
if (typeof m.dataVersion !== 'number' || !Number.isInteger(m.dataVersion) || m.dataVersion < 1)
|
|
180
|
-
return 'dataVersion
|
|
180
|
+
return 'dataVersion must be an integer of 1 or more';
|
|
181
181
|
if (!isPluginPath(m.logic))
|
|
182
|
-
return `logic ${JSON.stringify(m.logic)}
|
|
182
|
+
return `logic ${JSON.stringify(m.logic)} must be a relative path inside the plugin folder (.. and absolute paths are not accepted)`;
|
|
183
183
|
if (m.ui !== undefined && !isUiPath(m.ui))
|
|
184
|
-
return `ui ${JSON.stringify(m.ui)}
|
|
184
|
+
return `ui ${JSON.stringify(m.ui)} must be a file directly under ui/ (for example ui/index.html)`;
|
|
185
|
+
// 아이콘은 코어가 내보내는 ui/ 의 파일이어야 화면이 읽는다. icon.ts 의 isIconPath 와 같은 모양이다(서로 불러오지 않게 여기에 적는다)
|
|
186
|
+
if (m.icon !== undefined && (!isUiPath(m.icon) || !m.icon.toLowerCase().endsWith('.svg'))) {
|
|
187
|
+
return `icon ${JSON.stringify(m.icon)} must be an SVG file (.svg) directly under ui/ (for example ui/icon.svg)`;
|
|
188
|
+
}
|
|
185
189
|
if (m.title !== undefined) {
|
|
186
190
|
const problem = textProblem('title', m.title, 100);
|
|
187
191
|
if (problem)
|
|
@@ -199,9 +203,9 @@ export function checkManifest(manifest) {
|
|
|
199
203
|
}
|
|
200
204
|
if (m.examples !== undefined) {
|
|
201
205
|
if (!Array.isArray(m.examples))
|
|
202
|
-
return 'examples
|
|
206
|
+
return 'examples must be a list of { ask, does }';
|
|
203
207
|
if (m.examples.length > 5)
|
|
204
|
-
return `examples
|
|
208
|
+
return `examples can have up to 5 entries (${m.examples.length} given)`;
|
|
205
209
|
for (const [i, e] of m.examples.entries()) {
|
|
206
210
|
const where = `examples[${i}]`;
|
|
207
211
|
const problem = objectProblem(where, e, ['ask', 'does']) ??
|
|
@@ -217,7 +221,7 @@ export function checkManifest(manifest) {
|
|
|
217
221
|
return problem;
|
|
218
222
|
}
|
|
219
223
|
if (m.protocol !== undefined && !isProtocolRange(m.protocol)) {
|
|
220
|
-
return `protocol ${JSON.stringify(m.protocol)}
|
|
224
|
+
return `protocol ${JSON.stringify(m.protocol)} must look like 0.<number> (for example "0.1")`;
|
|
221
225
|
}
|
|
222
226
|
if (m.dependencies !== undefined) {
|
|
223
227
|
const problem = dependenciesProblem(id, m.dependencies);
|
|
@@ -236,5 +240,5 @@ export function checkForRegistry(manifest) {
|
|
|
236
240
|
return problem;
|
|
237
241
|
const m = manifest;
|
|
238
242
|
const missing = ['protocol', 'license', 'title', 'about'].filter((k) => m[k] === undefined);
|
|
239
|
-
return missing.length > 0 ?
|
|
243
|
+
return missing.length > 0 ? `To upload to the site, the manifest needs the field(s) ${missing.join(', ')}` : null;
|
|
240
244
|
}
|
package/dist/messages.js
CHANGED
|
@@ -55,7 +55,7 @@ function valueEdgeProblems(text) {
|
|
|
55
55
|
const beforeOk = before === null || VALUE_EDGE.test(before);
|
|
56
56
|
const afterOk = after === null || VALUE_EDGE.test(after) || (after === '.' && (end + 1 >= text.length || text[end + 1] === ' '));
|
|
57
57
|
if (!beforeOk || !afterOk) {
|
|
58
|
-
out.push(`{${m[1]}}
|
|
58
|
+
out.push(`The characters right before and after {${m[1]}} must be a space or punctuation (, ; ! ? ( ) ' "). A period may follow it only at the end of a sentence (followed by a space or the end of the text)`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
return out;
|
|
@@ -67,33 +67,33 @@ function valueEdgeProblems(text) {
|
|
|
67
67
|
*/
|
|
68
68
|
function textProblems(text, names) {
|
|
69
69
|
if (typeof text !== 'string' || text === '')
|
|
70
|
-
return ['text
|
|
70
|
+
return ['text must be non-empty text'];
|
|
71
71
|
const out = [];
|
|
72
72
|
if (text.length > MESSAGE_TEXT_MAX)
|
|
73
|
-
out.push(
|
|
73
|
+
out.push(`The text is over ${MESSAGE_TEXT_MAX} characters (${text.length} characters)`);
|
|
74
74
|
if ([...text].some((c) => c.charCodeAt(0) < 0x20 || c.charCodeAt(0) > 0x7e))
|
|
75
|
-
out.push('
|
|
75
|
+
out.push('The text may only use visible ASCII (0x20 to 0x7E). Line breaks and non-English characters are not accepted');
|
|
76
76
|
if (!/[A-Za-z]/.test(text))
|
|
77
|
-
out.push('
|
|
77
|
+
out.push('The text must be an English sentence');
|
|
78
78
|
if (hasAddress(text))
|
|
79
|
-
out.push('
|
|
79
|
+
out.push('The text cannot contain addresses (://, www., a period between letters, and @ are not accepted)');
|
|
80
80
|
if (/[<>[\]`\\]/.test(text))
|
|
81
|
-
out.push('
|
|
81
|
+
out.push('The text must not use < > [ ] backticks or backslashes');
|
|
82
82
|
out.push(...valueEdgeProblems(text));
|
|
83
83
|
const used = new Set();
|
|
84
84
|
for (const m of text.matchAll(PLACEHOLDER)) {
|
|
85
85
|
const name = m[1];
|
|
86
86
|
if (!VALUE_NAME.test(name))
|
|
87
|
-
out.push(`{${name}}
|
|
87
|
+
out.push(`{${name}} is not shaped like a value name (starts with a lowercase English letter, up to 32 lowercase letters, digits, and _)`);
|
|
88
88
|
else if (!names.includes(name))
|
|
89
|
-
out.push(`{${name}}
|
|
89
|
+
out.push(`{${name}} is not in values`);
|
|
90
90
|
used.add(name);
|
|
91
91
|
}
|
|
92
92
|
if (/[{}]/.test(text.replace(PLACEHOLDER, '')))
|
|
93
|
-
out.push('
|
|
93
|
+
out.push('There is an unmatched { or }');
|
|
94
94
|
for (const n of names)
|
|
95
95
|
if (!used.has(n))
|
|
96
|
-
out.push(
|
|
96
|
+
out.push(`${n} in values does not appear in the text`);
|
|
97
97
|
return out;
|
|
98
98
|
}
|
|
99
99
|
/** values 의 까닭들. 이름마다 종류 하나이고, enum 은 낱말 목록을 함께 적는다. */
|
|
@@ -101,34 +101,34 @@ function valuesProblems(values) {
|
|
|
101
101
|
if (values === undefined)
|
|
102
102
|
return [];
|
|
103
103
|
if (!isPlainObject(values))
|
|
104
|
-
return ['values
|
|
104
|
+
return ['values must be an object that gives a type for each name'];
|
|
105
105
|
const out = [];
|
|
106
106
|
for (const [name, spec] of Object.entries(values)) {
|
|
107
|
-
const at =
|
|
107
|
+
const at = `value ${name}`;
|
|
108
108
|
if (!VALUE_NAME.test(name))
|
|
109
|
-
out.push(`${at}:
|
|
109
|
+
out.push(`${at}: the name starts with a lowercase English letter and has up to 32 lowercase letters, digits, and _`);
|
|
110
110
|
if (!isPlainObject(spec) || !MESSAGE_VALUE_TYPES.includes(spec.type)) {
|
|
111
|
-
out.push(`${at}: type
|
|
111
|
+
out.push(`${at}: type must be one of ${MESSAGE_VALUE_TYPES.join(', ')}. There is no free text value`);
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
114
|
const extra = Object.keys(spec).filter((k) => k !== 'type' && !(spec.type === 'enum' && k === 'values'));
|
|
115
115
|
if (extra.length)
|
|
116
|
-
out.push(`${at}:
|
|
116
|
+
out.push(`${at}: unknown fields ${extra.join(', ')}`);
|
|
117
117
|
if (spec.type !== 'enum')
|
|
118
118
|
continue;
|
|
119
119
|
const words = spec.values;
|
|
120
120
|
if (!Array.isArray(words) || words.length === 0 || words.length > MESSAGE_ENUM_MAX_VALUES) {
|
|
121
|
-
out.push(`${at}: enum
|
|
121
|
+
out.push(`${at}: the values of an enum must be a list of 1 to ${MESSAGE_ENUM_MAX_VALUES} words`);
|
|
122
122
|
continue;
|
|
123
123
|
}
|
|
124
124
|
for (const w of words) {
|
|
125
125
|
if (typeof w !== 'string' || w.length > MESSAGE_ENUM_WORD_MAX || !ENUM_WORD.test(w)) {
|
|
126
|
-
out.push(`${at}: enum
|
|
126
|
+
out.push(`${at}: an enum word has up to ${MESSAGE_ENUM_WORD_MAX} English letters, digits, spaces, and _-`);
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
if (new Set(words).size !== words.length)
|
|
131
|
-
out.push(`${at}: enum
|
|
131
|
+
out.push(`${at}: enum words repeat`);
|
|
132
132
|
}
|
|
133
133
|
return out;
|
|
134
134
|
}
|
|
@@ -139,7 +139,7 @@ function valuesProblems(values) {
|
|
|
139
139
|
export function checkMessageTable(data) {
|
|
140
140
|
const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data;
|
|
141
141
|
if (bytes.byteLength > MESSAGE_TABLE_MAX_BYTES)
|
|
142
|
-
return { ok: false, problems: [
|
|
142
|
+
return { ok: false, problems: [`The table file is over ${MESSAGE_TABLE_MAX_BYTES} bytes (${bytes.byteLength} bytes)`] };
|
|
143
143
|
let raw;
|
|
144
144
|
try {
|
|
145
145
|
const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
@@ -147,38 +147,38 @@ export function checkMessageTable(data) {
|
|
|
147
147
|
}
|
|
148
148
|
catch {
|
|
149
149
|
// 해석기의 글은 파일의 일부를 옮겨 적을 수 있어 까닭은 적지 않는다.
|
|
150
|
-
return { ok: false, problems: ['
|
|
150
|
+
return { ok: false, problems: ['The table file is not UTF-8 JSON'] };
|
|
151
151
|
}
|
|
152
152
|
if (!isPlainObject(raw))
|
|
153
|
-
return { ok: false, problems: ['
|
|
153
|
+
return { ok: false, problems: ['The table must be an object with format, version, and messages'] };
|
|
154
154
|
const problems = [];
|
|
155
155
|
const extra = Object.keys(raw).filter((k) => !['format', 'version', 'messages'].includes(k));
|
|
156
156
|
if (extra.length)
|
|
157
|
-
problems.push(
|
|
157
|
+
problems.push(`Unknown fields: ${extra.join(', ')}`);
|
|
158
158
|
if (raw.format !== MESSAGE_TABLE_FORMAT)
|
|
159
|
-
problems.push(`format
|
|
159
|
+
problems.push(`format must be ${MESSAGE_TABLE_FORMAT}`);
|
|
160
160
|
if (!isVersion(raw.version))
|
|
161
|
-
problems.push('version
|
|
161
|
+
problems.push('version must be semver such as 1.0.0');
|
|
162
162
|
if (!isPlainObject(raw.messages)) {
|
|
163
|
-
problems.push('messages
|
|
163
|
+
problems.push('messages must be an object that gives text for each message id');
|
|
164
164
|
return { ok: false, problems };
|
|
165
165
|
}
|
|
166
166
|
const entries = Object.entries(raw.messages);
|
|
167
167
|
if (entries.length === 0)
|
|
168
|
-
problems.push('messages
|
|
168
|
+
problems.push('messages is empty');
|
|
169
169
|
if (entries.length > MESSAGE_TABLE_MAX_MESSAGES)
|
|
170
|
-
problems.push(
|
|
170
|
+
problems.push(`There are more than ${MESSAGE_TABLE_MAX_MESSAGES} messages (${entries.length})`);
|
|
171
171
|
for (const [id, def] of entries) {
|
|
172
|
-
const at =
|
|
172
|
+
const at = `message ${MESSAGE_ID.test(id) ? id : '(malformed id)'}`;
|
|
173
173
|
if (!MESSAGE_ID.test(id))
|
|
174
|
-
problems.push(`${at}: id
|
|
174
|
+
problems.push(`${at}: the id starts with a lowercase English letter and has up to 64 lowercase letters, digits, and _`);
|
|
175
175
|
if (!isPlainObject(def)) {
|
|
176
|
-
problems.push(`${at}:
|
|
176
|
+
problems.push(`${at}: must be an object with text and values`);
|
|
177
177
|
continue;
|
|
178
178
|
}
|
|
179
179
|
const unknown = Object.keys(def).filter((k) => k !== 'text' && k !== 'values');
|
|
180
180
|
if (unknown.length)
|
|
181
|
-
problems.push(`${at}:
|
|
181
|
+
problems.push(`${at}: unknown fields ${unknown.join(', ')}`);
|
|
182
182
|
const vp = valuesProblems(def.values);
|
|
183
183
|
for (const p of vp)
|
|
184
184
|
problems.push(`${at}: ${p}`);
|
|
@@ -189,7 +189,7 @@ export function checkMessageTable(data) {
|
|
|
189
189
|
if (problems.length > 0) {
|
|
190
190
|
const shown = problems.slice(0, MAX_PROBLEMS);
|
|
191
191
|
if (problems.length > MAX_PROBLEMS)
|
|
192
|
-
shown.push(
|
|
192
|
+
shown.push(`${problems.length - MAX_PROBLEMS} more`);
|
|
193
193
|
return { ok: false, problems: shown };
|
|
194
194
|
}
|
|
195
195
|
return { ok: true, table: raw };
|
package/dist/sample.d.ts
CHANGED
|
@@ -3,7 +3,10 @@ export declare const SAMPLE_FORMAT = "aic-sample/1";
|
|
|
3
3
|
export declare const MANUAL_MAX_CHARS = 50000;
|
|
4
4
|
/** 예제 파일 하나의 한도(글자, 037 7절 4번). */
|
|
5
5
|
export declare const SAMPLE_MAX_CHARS = 200000;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* 예제를 쓴 참여자. 실제 이름 대신 "Person", "AI" 이고, 같은 종류가 여럿이면 "Person 2" 처럼 번호를 붙인다. 참여자가 없는 revision 은 "Core" 다.
|
|
8
|
+
* 새로 내보내는 파일은 영어로 쓰고, 옛 파일의 "사람", "코어" 도 읽는다(999 4.2절, rawdev 2026-11-30).
|
|
9
|
+
*/
|
|
7
10
|
export declare const SAMPLE_WHO: RegExp;
|
|
8
11
|
/** 예제가 쓴 플러그인 하나. version 은 그 작업에 적힌 가장 높은 버전이다. */
|
|
9
12
|
export interface SamplePlugin {
|
|
@@ -132,7 +135,7 @@ export declare function charCount(s: string): number;
|
|
|
132
135
|
/**
|
|
133
136
|
* 예제 파일(aic-sample/1)의 검사. 문제의 설명이고 없으면 null 이다. 맨 위 층과 revision 과 원인에 모르는 칸이 있으면 거절한다.
|
|
134
137
|
* 예제는 실제 작업을 내보낸 것이어야 하고(037 7절 2번), 내보낼 때 지운 것(참여자 이름, 도구, 시각, 연결 정의)이 다시 들어가지
|
|
135
|
-
* 않게 하려는 것이다. 참여자는 "
|
|
138
|
+
* 않게 하려는 것이다. 참여자는 "Person", "AI", "Core" 로만 적는다(옛 파일의 "사람", "코어" 도 받는다).
|
|
136
139
|
*/
|
|
137
140
|
export declare function checkSample(value: unknown): string | null;
|
|
138
141
|
/** 예제 파일의 글(바이트)을 풀고 검사한다. 맞으면 { ok: true, sample }, 틀리면 까닭이다. 글자 한도도 본다. */
|