@arcadia-eternity/content-sdk 4.5.3 → 4.7.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 +2 -2
- package/dist/author-api.d.ts +12 -2
- package/dist/author-api.js +11 -2
- package/dist/author-git.d.ts +63 -0
- package/dist/author-git.js +324 -0
- package/dist/author-reference.d.ts +15 -1
- package/dist/author-reference.js +20 -1
- package/dist/cli.js +5 -4
- package/dist/content-query.d.ts +15 -1
- package/dist/content-query.js +53 -11
- package/dist/content-workspace.d.ts +435 -6
- package/dist/content-workspace.js +238 -77
- package/dist/debug-environments.d.ts +393 -33
- package/dist/debug-environments.js +10 -50
- package/dist/demo.js +1 -1
- package/dist/effect-declarations.d.ts +14 -0
- package/dist/effect-declarations.js +103 -0
- package/dist/environment-host-base.d.ts +175 -0
- package/dist/environment-host-base.js +86 -0
- package/dist/environment-member-transfer.d.ts +5 -0
- package/dist/environment-member-transfer.js +95 -0
- package/dist/environment-rules.d.ts +728 -3
- package/dist/environment-rules.js +158 -74
- package/dist/environment-sharing.d.ts +51 -0
- package/dist/environment-sharing.js +321 -0
- package/dist/environment.d.ts +2 -0
- package/dist/environment.js +32 -9
- package/dist/jobs.d.ts +5 -0
- package/dist/jobs.js +59 -10
- package/dist/learnsets.d.ts +47 -0
- package/dist/learnsets.js +124 -0
- package/dist/lib/content.d.ts +1 -1
- package/dist/lib/content.js +26 -2
- package/dist/lib/presentation.js +5 -11
- package/dist/managed-projects.d.ts +6 -0
- package/dist/managed-projects.js +137 -45
- package/dist/managed-sources.d.ts +17 -0
- package/dist/managed-sources.js +28 -10
- package/dist/mcp-contracts.d.ts +405 -12
- package/dist/mcp-contracts.js +3 -1
- package/dist/mcp.js +23 -1
- package/dist/pack-project.d.ts +2 -1
- package/dist/pack-project.js +40 -5
- package/dist/prepared-document.d.ts +476 -0
- package/dist/prepared-document.js +47 -0
- package/dist/preview.js +5 -5
- package/dist/project.d.ts +3 -1
- package/dist/project.js +47 -4
- package/dist/rule-composition.d.ts +290 -0
- package/dist/rule-composition.js +267 -0
- package/dist/template/.github/scripts/release-payload.mjs +91 -0
- package/dist/template/.github/scripts/release-test-npm.mjs +27 -0
- package/dist/template/.github/scripts/verify-release.mjs +138 -0
- package/dist/template/.github/workflows/release-pack.yml +77 -0
- package/dist/template/README.md +15 -2
- package/dist/template/gitignore-template +7 -0
- package/dist/template/npm-lock-template.json +2319 -0
- package/dist/template/package.json +4 -2
- package/dist/template/skills/arcadia-content-authoring/references/tool-workflows.md +1 -1
- package/dist/template/skills/arcadia-content-git/SKILL.md +14 -0
- package/dist/template/skills/arcadia-content-release/SKILL.md +29 -0
- package/dist/template/test/pack.test.mjs +24 -5
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +26 -7
- package/dist/workspace-cli.js +2 -2
- package/dist/workspace-materials.d.ts +4 -1
- package/dist/workspace-materials.js +8 -2
- package/dist/workspace.d.ts +11 -0
- package/dist/workspace.js +191 -31
- package/package.json +16 -4
- package/release-payload.mjs +91 -0
- package/release-test-npm.mjs +27 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { type UnknownRecord } from './types.js';
|
|
2
|
+
export declare function parseManifestDraft(text: string): {
|
|
3
|
+
document: {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
packages: Record<string, string>;
|
|
7
|
+
sources: string[];
|
|
8
|
+
schemaVersion: 2;
|
|
9
|
+
rules: {
|
|
10
|
+
schemaVersion: 1 | 2;
|
|
11
|
+
mechanics?: {
|
|
12
|
+
skillSlots?: {
|
|
13
|
+
normalMax: number;
|
|
14
|
+
climaxMax: number;
|
|
15
|
+
climaxMin?: number | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
individualValueDefault?: number | undefined;
|
|
18
|
+
individualValues?: {
|
|
19
|
+
max: number;
|
|
20
|
+
} | undefined;
|
|
21
|
+
allowFaintSwitch?: boolean | undefined;
|
|
22
|
+
inheritance?: {
|
|
23
|
+
eligible: "all" | "off" | "species" | string[];
|
|
24
|
+
pool?: {
|
|
25
|
+
mode: "append" | "fallback" | "replace";
|
|
26
|
+
skills: string[];
|
|
27
|
+
} | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
enhancement?: {
|
|
30
|
+
mode: "active" | "forbidden" | "suppressed";
|
|
31
|
+
stages?: string[] | undefined;
|
|
32
|
+
species?: string[] | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
secondGenerationNatures?: "all" | "off" | "species" | string[] | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
skillParameters?: {
|
|
37
|
+
profile?: string | undefined;
|
|
38
|
+
groups?: Record<string, number> | undefined;
|
|
39
|
+
overrides?: {
|
|
40
|
+
skill: string;
|
|
41
|
+
useId: string;
|
|
42
|
+
parameter: string;
|
|
43
|
+
value: number;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
matchups?: {
|
|
47
|
+
table?: string | undefined;
|
|
48
|
+
adjustments?: {
|
|
49
|
+
attack: string;
|
|
50
|
+
defense: string;
|
|
51
|
+
multiplier: number;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
learnsetAdjustments?: {
|
|
55
|
+
species: string;
|
|
56
|
+
source: "inherited" | "normal";
|
|
57
|
+
skill: string;
|
|
58
|
+
action: "add" | "remove";
|
|
59
|
+
level?: number | undefined;
|
|
60
|
+
}[] | undefined;
|
|
61
|
+
tier?: "standard" | undefined;
|
|
62
|
+
allow?: {
|
|
63
|
+
species?: string[] | undefined;
|
|
64
|
+
skills?: string[] | undefined;
|
|
65
|
+
marks?: string[] | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
deny?: {
|
|
68
|
+
species?: string[] | undefined;
|
|
69
|
+
skills?: string[] | undefined;
|
|
70
|
+
marks?: string[] | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
team?: {
|
|
73
|
+
minSize?: number | undefined;
|
|
74
|
+
maxSize?: number | undefined;
|
|
75
|
+
uniqueSpecies?: boolean | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
constraints?: ({
|
|
78
|
+
id: string;
|
|
79
|
+
allOf: {
|
|
80
|
+
kind: "mark" | "skill" | "species";
|
|
81
|
+
ids: string[];
|
|
82
|
+
fromCollections?: string[] | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
kind: "ban";
|
|
85
|
+
scope: "pet" | "team";
|
|
86
|
+
exceptWhen?: {
|
|
87
|
+
kind: "mark" | "skill" | "species";
|
|
88
|
+
ids: string[];
|
|
89
|
+
fromCollections?: string[] | undefined;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
exceptAny?: {
|
|
92
|
+
kind: "mark" | "skill" | "species";
|
|
93
|
+
ids: string[];
|
|
94
|
+
fromCollections?: string[] | undefined;
|
|
95
|
+
}[][] | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
id: string;
|
|
98
|
+
allOf: {
|
|
99
|
+
kind: "mark" | "skill" | "species";
|
|
100
|
+
ids: string[];
|
|
101
|
+
fromCollections?: string[] | undefined;
|
|
102
|
+
}[];
|
|
103
|
+
kind: "memberLimit";
|
|
104
|
+
max: number;
|
|
105
|
+
})[] | undefined;
|
|
106
|
+
collections?: {
|
|
107
|
+
id: string;
|
|
108
|
+
kind: "mark" | "skill" | "species";
|
|
109
|
+
ids: string[];
|
|
110
|
+
}[] | undefined;
|
|
111
|
+
include?: string[] | undefined;
|
|
112
|
+
constraintEdits?: {
|
|
113
|
+
remove?: string[] | undefined;
|
|
114
|
+
replace?: ({
|
|
115
|
+
id: string;
|
|
116
|
+
allOf: {
|
|
117
|
+
kind: "mark" | "skill" | "species";
|
|
118
|
+
ids: string[];
|
|
119
|
+
fromCollections?: string[] | undefined;
|
|
120
|
+
}[];
|
|
121
|
+
kind: "ban";
|
|
122
|
+
scope: "pet" | "team";
|
|
123
|
+
exceptWhen?: {
|
|
124
|
+
kind: "mark" | "skill" | "species";
|
|
125
|
+
ids: string[];
|
|
126
|
+
fromCollections?: string[] | undefined;
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
exceptAny?: {
|
|
129
|
+
kind: "mark" | "skill" | "species";
|
|
130
|
+
ids: string[];
|
|
131
|
+
fromCollections?: string[] | undefined;
|
|
132
|
+
}[][] | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
id: string;
|
|
135
|
+
allOf: {
|
|
136
|
+
kind: "mark" | "skill" | "species";
|
|
137
|
+
ids: string[];
|
|
138
|
+
fromCollections?: string[] | undefined;
|
|
139
|
+
}[];
|
|
140
|
+
kind: "memberLimit";
|
|
141
|
+
max: number;
|
|
142
|
+
})[] | undefined;
|
|
143
|
+
clearExceptions?: string[] | undefined;
|
|
144
|
+
exceptions?: {
|
|
145
|
+
target: string;
|
|
146
|
+
allOf: {
|
|
147
|
+
kind: "mark" | "skill" | "species";
|
|
148
|
+
ids: string[];
|
|
149
|
+
fromCollections?: string[] | undefined;
|
|
150
|
+
}[];
|
|
151
|
+
}[] | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
};
|
|
154
|
+
requires: {
|
|
155
|
+
engine?: string | undefined;
|
|
156
|
+
sdk?: string | undefined;
|
|
157
|
+
capabilities?: string[] | undefined;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
revision: string;
|
|
161
|
+
};
|
|
162
|
+
export declare function preparedDocument(metadata: UnknownRecord, legacyManifest: string): {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
packages: Record<string, string>;
|
|
166
|
+
sources: string[];
|
|
167
|
+
schemaVersion: 2;
|
|
168
|
+
rules: {
|
|
169
|
+
schemaVersion: 1 | 2;
|
|
170
|
+
mechanics?: {
|
|
171
|
+
skillSlots?: {
|
|
172
|
+
normalMax: number;
|
|
173
|
+
climaxMax: number;
|
|
174
|
+
climaxMin?: number | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
individualValueDefault?: number | undefined;
|
|
177
|
+
individualValues?: {
|
|
178
|
+
max: number;
|
|
179
|
+
} | undefined;
|
|
180
|
+
allowFaintSwitch?: boolean | undefined;
|
|
181
|
+
inheritance?: {
|
|
182
|
+
eligible: "all" | "off" | "species" | string[];
|
|
183
|
+
pool?: {
|
|
184
|
+
mode: "append" | "fallback" | "replace";
|
|
185
|
+
skills: string[];
|
|
186
|
+
} | undefined;
|
|
187
|
+
} | undefined;
|
|
188
|
+
enhancement?: {
|
|
189
|
+
mode: "active" | "forbidden" | "suppressed";
|
|
190
|
+
stages?: string[] | undefined;
|
|
191
|
+
species?: string[] | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
secondGenerationNatures?: "all" | "off" | "species" | string[] | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
skillParameters?: {
|
|
196
|
+
profile?: string | undefined;
|
|
197
|
+
groups?: Record<string, number> | undefined;
|
|
198
|
+
overrides?: {
|
|
199
|
+
skill: string;
|
|
200
|
+
useId: string;
|
|
201
|
+
parameter: string;
|
|
202
|
+
value: number;
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
matchups?: {
|
|
206
|
+
table?: string | undefined;
|
|
207
|
+
adjustments?: {
|
|
208
|
+
attack: string;
|
|
209
|
+
defense: string;
|
|
210
|
+
multiplier: number;
|
|
211
|
+
}[] | undefined;
|
|
212
|
+
} | undefined;
|
|
213
|
+
learnsetAdjustments?: {
|
|
214
|
+
species: string;
|
|
215
|
+
source: "inherited" | "normal";
|
|
216
|
+
skill: string;
|
|
217
|
+
action: "add" | "remove";
|
|
218
|
+
level?: number | undefined;
|
|
219
|
+
}[] | undefined;
|
|
220
|
+
tier?: "standard" | undefined;
|
|
221
|
+
allow?: {
|
|
222
|
+
species?: string[] | undefined;
|
|
223
|
+
skills?: string[] | undefined;
|
|
224
|
+
marks?: string[] | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
deny?: {
|
|
227
|
+
species?: string[] | undefined;
|
|
228
|
+
skills?: string[] | undefined;
|
|
229
|
+
marks?: string[] | undefined;
|
|
230
|
+
} | undefined;
|
|
231
|
+
team?: {
|
|
232
|
+
minSize?: number | undefined;
|
|
233
|
+
maxSize?: number | undefined;
|
|
234
|
+
uniqueSpecies?: boolean | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
constraints?: ({
|
|
237
|
+
id: string;
|
|
238
|
+
allOf: {
|
|
239
|
+
kind: "mark" | "skill" | "species";
|
|
240
|
+
ids: string[];
|
|
241
|
+
fromCollections?: string[] | undefined;
|
|
242
|
+
}[];
|
|
243
|
+
kind: "ban";
|
|
244
|
+
scope: "pet" | "team";
|
|
245
|
+
exceptWhen?: {
|
|
246
|
+
kind: "mark" | "skill" | "species";
|
|
247
|
+
ids: string[];
|
|
248
|
+
fromCollections?: string[] | undefined;
|
|
249
|
+
}[] | undefined;
|
|
250
|
+
exceptAny?: {
|
|
251
|
+
kind: "mark" | "skill" | "species";
|
|
252
|
+
ids: string[];
|
|
253
|
+
fromCollections?: string[] | undefined;
|
|
254
|
+
}[][] | undefined;
|
|
255
|
+
} | {
|
|
256
|
+
id: string;
|
|
257
|
+
allOf: {
|
|
258
|
+
kind: "mark" | "skill" | "species";
|
|
259
|
+
ids: string[];
|
|
260
|
+
fromCollections?: string[] | undefined;
|
|
261
|
+
}[];
|
|
262
|
+
kind: "memberLimit";
|
|
263
|
+
max: number;
|
|
264
|
+
})[] | undefined;
|
|
265
|
+
collections?: {
|
|
266
|
+
id: string;
|
|
267
|
+
kind: "mark" | "skill" | "species";
|
|
268
|
+
ids: string[];
|
|
269
|
+
}[] | undefined;
|
|
270
|
+
include?: string[] | undefined;
|
|
271
|
+
constraintEdits?: {
|
|
272
|
+
remove?: string[] | undefined;
|
|
273
|
+
replace?: ({
|
|
274
|
+
id: string;
|
|
275
|
+
allOf: {
|
|
276
|
+
kind: "mark" | "skill" | "species";
|
|
277
|
+
ids: string[];
|
|
278
|
+
fromCollections?: string[] | undefined;
|
|
279
|
+
}[];
|
|
280
|
+
kind: "ban";
|
|
281
|
+
scope: "pet" | "team";
|
|
282
|
+
exceptWhen?: {
|
|
283
|
+
kind: "mark" | "skill" | "species";
|
|
284
|
+
ids: string[];
|
|
285
|
+
fromCollections?: string[] | undefined;
|
|
286
|
+
}[] | undefined;
|
|
287
|
+
exceptAny?: {
|
|
288
|
+
kind: "mark" | "skill" | "species";
|
|
289
|
+
ids: string[];
|
|
290
|
+
fromCollections?: string[] | undefined;
|
|
291
|
+
}[][] | undefined;
|
|
292
|
+
} | {
|
|
293
|
+
id: string;
|
|
294
|
+
allOf: {
|
|
295
|
+
kind: "mark" | "skill" | "species";
|
|
296
|
+
ids: string[];
|
|
297
|
+
fromCollections?: string[] | undefined;
|
|
298
|
+
}[];
|
|
299
|
+
kind: "memberLimit";
|
|
300
|
+
max: number;
|
|
301
|
+
})[] | undefined;
|
|
302
|
+
clearExceptions?: string[] | undefined;
|
|
303
|
+
exceptions?: {
|
|
304
|
+
target: string;
|
|
305
|
+
allOf: {
|
|
306
|
+
kind: "mark" | "skill" | "species";
|
|
307
|
+
ids: string[];
|
|
308
|
+
fromCollections?: string[] | undefined;
|
|
309
|
+
}[];
|
|
310
|
+
}[] | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
};
|
|
313
|
+
requires: {
|
|
314
|
+
engine?: string | undefined;
|
|
315
|
+
sdk?: string | undefined;
|
|
316
|
+
capabilities?: string[] | undefined;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
/** Plain npm projects use compatibility defaults. Managed projects must have prepared rules. */
|
|
320
|
+
export declare function readInstalledEnvironmentDocument(directory: string, contentRevision?: string): Promise<{
|
|
321
|
+
id: string;
|
|
322
|
+
name: string;
|
|
323
|
+
packages: Record<string, string>;
|
|
324
|
+
sources: string[];
|
|
325
|
+
schemaVersion: 2;
|
|
326
|
+
rules: {
|
|
327
|
+
schemaVersion: 1 | 2;
|
|
328
|
+
mechanics?: {
|
|
329
|
+
skillSlots?: {
|
|
330
|
+
normalMax: number;
|
|
331
|
+
climaxMax: number;
|
|
332
|
+
climaxMin?: number | undefined;
|
|
333
|
+
} | undefined;
|
|
334
|
+
individualValueDefault?: number | undefined;
|
|
335
|
+
individualValues?: {
|
|
336
|
+
max: number;
|
|
337
|
+
} | undefined;
|
|
338
|
+
allowFaintSwitch?: boolean | undefined;
|
|
339
|
+
inheritance?: {
|
|
340
|
+
eligible: "all" | "off" | "species" | string[];
|
|
341
|
+
pool?: {
|
|
342
|
+
mode: "append" | "fallback" | "replace";
|
|
343
|
+
skills: string[];
|
|
344
|
+
} | undefined;
|
|
345
|
+
} | undefined;
|
|
346
|
+
enhancement?: {
|
|
347
|
+
mode: "active" | "forbidden" | "suppressed";
|
|
348
|
+
stages?: string[] | undefined;
|
|
349
|
+
species?: string[] | undefined;
|
|
350
|
+
} | undefined;
|
|
351
|
+
secondGenerationNatures?: "all" | "off" | "species" | string[] | undefined;
|
|
352
|
+
} | undefined;
|
|
353
|
+
skillParameters?: {
|
|
354
|
+
profile?: string | undefined;
|
|
355
|
+
groups?: Record<string, number> | undefined;
|
|
356
|
+
overrides?: {
|
|
357
|
+
skill: string;
|
|
358
|
+
useId: string;
|
|
359
|
+
parameter: string;
|
|
360
|
+
value: number;
|
|
361
|
+
}[] | undefined;
|
|
362
|
+
} | undefined;
|
|
363
|
+
matchups?: {
|
|
364
|
+
table?: string | undefined;
|
|
365
|
+
adjustments?: {
|
|
366
|
+
attack: string;
|
|
367
|
+
defense: string;
|
|
368
|
+
multiplier: number;
|
|
369
|
+
}[] | undefined;
|
|
370
|
+
} | undefined;
|
|
371
|
+
learnsetAdjustments?: {
|
|
372
|
+
species: string;
|
|
373
|
+
source: "inherited" | "normal";
|
|
374
|
+
skill: string;
|
|
375
|
+
action: "add" | "remove";
|
|
376
|
+
level?: number | undefined;
|
|
377
|
+
}[] | undefined;
|
|
378
|
+
tier?: "standard" | undefined;
|
|
379
|
+
allow?: {
|
|
380
|
+
species?: string[] | undefined;
|
|
381
|
+
skills?: string[] | undefined;
|
|
382
|
+
marks?: string[] | undefined;
|
|
383
|
+
} | undefined;
|
|
384
|
+
deny?: {
|
|
385
|
+
species?: string[] | undefined;
|
|
386
|
+
skills?: string[] | undefined;
|
|
387
|
+
marks?: string[] | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
team?: {
|
|
390
|
+
minSize?: number | undefined;
|
|
391
|
+
maxSize?: number | undefined;
|
|
392
|
+
uniqueSpecies?: boolean | undefined;
|
|
393
|
+
} | undefined;
|
|
394
|
+
constraints?: ({
|
|
395
|
+
id: string;
|
|
396
|
+
allOf: {
|
|
397
|
+
kind: "mark" | "skill" | "species";
|
|
398
|
+
ids: string[];
|
|
399
|
+
fromCollections?: string[] | undefined;
|
|
400
|
+
}[];
|
|
401
|
+
kind: "ban";
|
|
402
|
+
scope: "pet" | "team";
|
|
403
|
+
exceptWhen?: {
|
|
404
|
+
kind: "mark" | "skill" | "species";
|
|
405
|
+
ids: string[];
|
|
406
|
+
fromCollections?: string[] | undefined;
|
|
407
|
+
}[] | undefined;
|
|
408
|
+
exceptAny?: {
|
|
409
|
+
kind: "mark" | "skill" | "species";
|
|
410
|
+
ids: string[];
|
|
411
|
+
fromCollections?: string[] | undefined;
|
|
412
|
+
}[][] | undefined;
|
|
413
|
+
} | {
|
|
414
|
+
id: string;
|
|
415
|
+
allOf: {
|
|
416
|
+
kind: "mark" | "skill" | "species";
|
|
417
|
+
ids: string[];
|
|
418
|
+
fromCollections?: string[] | undefined;
|
|
419
|
+
}[];
|
|
420
|
+
kind: "memberLimit";
|
|
421
|
+
max: number;
|
|
422
|
+
})[] | undefined;
|
|
423
|
+
collections?: {
|
|
424
|
+
id: string;
|
|
425
|
+
kind: "mark" | "skill" | "species";
|
|
426
|
+
ids: string[];
|
|
427
|
+
}[] | undefined;
|
|
428
|
+
include?: string[] | undefined;
|
|
429
|
+
constraintEdits?: {
|
|
430
|
+
remove?: string[] | undefined;
|
|
431
|
+
replace?: ({
|
|
432
|
+
id: string;
|
|
433
|
+
allOf: {
|
|
434
|
+
kind: "mark" | "skill" | "species";
|
|
435
|
+
ids: string[];
|
|
436
|
+
fromCollections?: string[] | undefined;
|
|
437
|
+
}[];
|
|
438
|
+
kind: "ban";
|
|
439
|
+
scope: "pet" | "team";
|
|
440
|
+
exceptWhen?: {
|
|
441
|
+
kind: "mark" | "skill" | "species";
|
|
442
|
+
ids: string[];
|
|
443
|
+
fromCollections?: string[] | undefined;
|
|
444
|
+
}[] | undefined;
|
|
445
|
+
exceptAny?: {
|
|
446
|
+
kind: "mark" | "skill" | "species";
|
|
447
|
+
ids: string[];
|
|
448
|
+
fromCollections?: string[] | undefined;
|
|
449
|
+
}[][] | undefined;
|
|
450
|
+
} | {
|
|
451
|
+
id: string;
|
|
452
|
+
allOf: {
|
|
453
|
+
kind: "mark" | "skill" | "species";
|
|
454
|
+
ids: string[];
|
|
455
|
+
fromCollections?: string[] | undefined;
|
|
456
|
+
}[];
|
|
457
|
+
kind: "memberLimit";
|
|
458
|
+
max: number;
|
|
459
|
+
})[] | undefined;
|
|
460
|
+
clearExceptions?: string[] | undefined;
|
|
461
|
+
exceptions?: {
|
|
462
|
+
target: string;
|
|
463
|
+
allOf: {
|
|
464
|
+
kind: "mark" | "skill" | "species";
|
|
465
|
+
ids: string[];
|
|
466
|
+
fromCollections?: string[] | undefined;
|
|
467
|
+
}[];
|
|
468
|
+
}[] | undefined;
|
|
469
|
+
} | undefined;
|
|
470
|
+
};
|
|
471
|
+
requires: {
|
|
472
|
+
engine?: string | undefined;
|
|
473
|
+
sdk?: string | undefined;
|
|
474
|
+
capabilities?: string[] | undefined;
|
|
475
|
+
};
|
|
476
|
+
} | undefined>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { sha256Hex } from '@arcadia-eternity/const';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { normalizeEnvironmentDocument } from './debug-environments.js';
|
|
5
|
+
import { contentError, readJson } from './workspace-materials.js';
|
|
6
|
+
import { errorCode, isRecord } from './types.js';
|
|
7
|
+
export function parseManifestDraft(text) {
|
|
8
|
+
const manifest = JSON.parse(text);
|
|
9
|
+
if (!isRecord(manifest.arcadiaEnvironment) || !isRecord(manifest.dependencies))
|
|
10
|
+
throw contentError('ENVIRONMENT_MANIFEST_INVALID');
|
|
11
|
+
const sources = manifest.arcadiaEnvironment.sources;
|
|
12
|
+
if (!Array.isArray(sources))
|
|
13
|
+
throw contentError('ENVIRONMENT_MANIFEST_INVALID');
|
|
14
|
+
const document = normalizeEnvironmentDocument({
|
|
15
|
+
...manifest.arcadiaEnvironment,
|
|
16
|
+
packages: Object.fromEntries(Object.entries(manifest.dependencies).filter(([name]) => !sources.includes(name))),
|
|
17
|
+
});
|
|
18
|
+
return { document, revision: sha256Hex(text) };
|
|
19
|
+
}
|
|
20
|
+
export function preparedDocument(metadata, legacyManifest) {
|
|
21
|
+
if (metadata.format !== 'arcadia.environment-installation/1')
|
|
22
|
+
throw contentError('ENVIRONMENT_INSTALLATION_INVALID');
|
|
23
|
+
if (metadata.document !== undefined) {
|
|
24
|
+
const document = normalizeEnvironmentDocument(metadata.document);
|
|
25
|
+
if (document.id !== metadata.installationId)
|
|
26
|
+
throw contentError('ENVIRONMENT_ID_MISMATCH');
|
|
27
|
+
return document;
|
|
28
|
+
}
|
|
29
|
+
const draft = parseManifestDraft(legacyManifest);
|
|
30
|
+
if (draft.revision !== metadata.draftRevision || draft.document.id !== metadata.installationId)
|
|
31
|
+
throw contentError('ENVIRONMENT_PREPARATION_REQUIRED');
|
|
32
|
+
return draft.document;
|
|
33
|
+
}
|
|
34
|
+
/** Plain npm projects use compatibility defaults. Managed projects must have prepared rules. */
|
|
35
|
+
export async function readInstalledEnvironmentDocument(directory, contentRevision) {
|
|
36
|
+
const manifest = await readFile(join(directory, 'package.json'), 'utf8');
|
|
37
|
+
const receipt = await readJson(join(directory, '.arcadia-prepared.json')).catch(error => {
|
|
38
|
+
if (errorCode(error) !== 'ENOENT')
|
|
39
|
+
throw error;
|
|
40
|
+
if (JSON.parse(manifest).arcadiaEnvironment)
|
|
41
|
+
throw contentError('ENVIRONMENT_PREPARATION_REQUIRED');
|
|
42
|
+
return undefined;
|
|
43
|
+
});
|
|
44
|
+
if (receipt && contentRevision !== undefined && receipt.contentRevision !== contentRevision)
|
|
45
|
+
throw contentError('ENVIRONMENT_PREPARATION_REQUIRED');
|
|
46
|
+
return receipt && preparedDocument(receipt, manifest);
|
|
47
|
+
}
|
package/dist/preview.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
3
|
import { createServer } from 'node:http';
|
|
4
|
-
import { randomBytes
|
|
4
|
+
import { randomBytes } from 'node:crypto';
|
|
5
5
|
import { createReadStream } from 'node:fs';
|
|
6
6
|
import { setGlobalLogger } from '@arcadia-eternity/battle/engine';
|
|
7
7
|
import { buildDisplayCatalog, buildDisplayLocales, mapPresentationResources, } from '@arcadia-eternity/pack-loader/native';
|
|
8
|
+
import { sha256Hex } from '@arcadia-eternity/const';
|
|
8
9
|
import { prepareContentPack } from './testing.js';
|
|
9
10
|
import { PreviewAutomation } from './preview-control.js';
|
|
10
11
|
import { AuthorWorkspace } from './workspace.js';
|
|
@@ -170,11 +171,10 @@ export async function startPreview(root, { clientUrl, signal, ...environmentOpti
|
|
|
170
171
|
if (request.method === 'GET' && route === 'content')
|
|
171
172
|
return json(200, {
|
|
172
173
|
content: publicContent(),
|
|
174
|
+
rules: prepared.effectiveRules,
|
|
173
175
|
candidate: prepared.candidate,
|
|
174
176
|
teams: prepared.teams,
|
|
175
|
-
draftKey:
|
|
176
|
-
.update(resolve(environmentOptions.lockRoot ?? root))
|
|
177
|
-
.digest('hex'),
|
|
177
|
+
draftKey: sha256Hex(resolve(environmentOptions.lockRoot ?? root)),
|
|
178
178
|
...manualSetup(),
|
|
179
179
|
active: !!system,
|
|
180
180
|
});
|
|
@@ -273,7 +273,7 @@ export async function startPreview(root, { clientUrl, signal, ...environmentOpti
|
|
|
273
273
|
await close();
|
|
274
274
|
throw new Error('PREVIEW_CANCELLED');
|
|
275
275
|
}
|
|
276
|
-
const clientPath = `/
|
|
276
|
+
const clientPath = `/creation/preview?endpoint=${encodeURIComponent(endpoint)}`;
|
|
277
277
|
return {
|
|
278
278
|
endpoint,
|
|
279
279
|
clientPath,
|
package/dist/project.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthorWorkspace } from './workspace.js';
|
|
1
2
|
export declare function authorConnection(root: string, execute?: boolean, env?: NodeJS.ProcessEnv, readOnly?: boolean, contextFile?: string, published?: boolean): {
|
|
2
3
|
mcpServers: {
|
|
3
4
|
arcadia: {
|
|
@@ -15,4 +16,5 @@ export declare function authorConnection(root: string, execute?: boolean, env?:
|
|
|
15
16
|
export declare function connectDevelopmentSdk(root: string): Promise<{
|
|
16
17
|
linked: string[];
|
|
17
18
|
}>;
|
|
18
|
-
export declare function createSourceProject(directory: string, identity: string): Promise<string>;
|
|
19
|
+
export declare function createSourceProject(directory: string, identity: string, arcadiaRange?: string): Promise<string>;
|
|
20
|
+
export declare function updateAuthorLock(workspace: AuthorWorkspace): Promise<void>;
|
package/dist/project.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { cp, lstat, mkdir, readFile, realpath, readdir, symlink, writeFile } from 'node:fs/promises';
|
|
1
|
+
import { cp, lstat, mkdir, mkdtemp, rm, readFile, realpath, readdir, symlink, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { ManagedProjects } from './managed-projects.js';
|
|
2
4
|
import { dirname, join } from 'node:path';
|
|
3
5
|
import { fileURLToPath } from 'node:url';
|
|
4
6
|
import { createRequire } from 'node:module';
|
|
5
|
-
import { WorkspaceError } from './workspace.js';
|
|
7
|
+
import { WorkspaceError, normalizeArcadiaRange } from './workspace.js';
|
|
6
8
|
import { siblingModulePath } from './module-path.js';
|
|
7
9
|
import { errorCode } from './types.js';
|
|
8
10
|
const require = createRequire(import.meta.url);
|
|
@@ -113,9 +115,10 @@ export async function connectDevelopmentSdk(root) {
|
|
|
113
115
|
}
|
|
114
116
|
return { linked };
|
|
115
117
|
}
|
|
116
|
-
export async function createSourceProject(directory, identity) {
|
|
118
|
+
export async function createSourceProject(directory, identity, arcadiaRange = '^' + require('../package.json').version) {
|
|
117
119
|
if (!/^[a-z0-9][a-z0-9-]{0,79}$/.test(identity))
|
|
118
120
|
throw new WorkspaceError('PROJECT_INVALID', '项目 ID 无效');
|
|
121
|
+
const range = normalizeArcadiaRange(arcadiaRange);
|
|
119
122
|
await mkdir(directory); // No overwrite or merge with existing directories.
|
|
120
123
|
let template = fileURLToPath(new URL('./template/', import.meta.url));
|
|
121
124
|
try {
|
|
@@ -125,7 +128,15 @@ export async function createSourceProject(directory, identity) {
|
|
|
125
128
|
template = fileURLToPath(new URL('../template/', import.meta.url));
|
|
126
129
|
}
|
|
127
130
|
for (const entry of await readdir(template))
|
|
128
|
-
await cp(join(template, entry), join(directory, entry
|
|
131
|
+
await cp(join(template, entry), join(directory, entry === 'gitignore-template'
|
|
132
|
+
? '.gitignore'
|
|
133
|
+
: entry === 'npm-lock-template.json'
|
|
134
|
+
? 'package-lock.json'
|
|
135
|
+
: entry), {
|
|
136
|
+
recursive: true,
|
|
137
|
+
force: false,
|
|
138
|
+
errorOnExist: true,
|
|
139
|
+
});
|
|
129
140
|
async function renameText(root) {
|
|
130
141
|
for (const entry of await readdir(root, { withFileTypes: true })) {
|
|
131
142
|
const file = join(root, entry.name);
|
|
@@ -138,9 +149,41 @@ export async function createSourceProject(directory, identity) {
|
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
await renameText(directory);
|
|
152
|
+
for (const script of ['release-payload.mjs', 'release-test-npm.mjs'])
|
|
153
|
+
await cp(fileURLToPath(new URL('../' + script, import.meta.url)), join(directory, '.github/scripts', script));
|
|
141
154
|
const manifest = JSON.parse(await readFile(join(directory, 'package.json'), 'utf8'));
|
|
155
|
+
if (range)
|
|
156
|
+
manifest.engines.arcadia = range;
|
|
157
|
+
else
|
|
158
|
+
delete manifest.engines.arcadia;
|
|
142
159
|
manifest.name = `@arcadia-local/${identity}`;
|
|
143
160
|
await writeFile(join(directory, 'package.json'), JSON.stringify(manifest, null, 2) + '\n');
|
|
161
|
+
const lockPath = join(directory, 'package-lock.json');
|
|
162
|
+
const lock = JSON.parse(await readFile(lockPath, 'utf8'));
|
|
163
|
+
lock.name = lock.packages[''].name = manifest.name;
|
|
164
|
+
lock.packages[''].engines = manifest.engines;
|
|
165
|
+
await writeFile(lockPath, JSON.stringify(lock, null, 2) + '\n');
|
|
144
166
|
await connectDevelopmentSdk(directory);
|
|
145
167
|
return directory;
|
|
146
168
|
}
|
|
169
|
+
export async function updateAuthorLock(workspace) {
|
|
170
|
+
await workspace.assertWritable();
|
|
171
|
+
const manifest = await workspace.read('package.json');
|
|
172
|
+
const previous = await workspace.read('package-lock.json').catch(error => {
|
|
173
|
+
if (errorCode(error) !== 'ENOENT')
|
|
174
|
+
throw error;
|
|
175
|
+
return undefined;
|
|
176
|
+
});
|
|
177
|
+
const root = await mkdtemp(join(tmpdir(), 'arcadia-author-lock-'));
|
|
178
|
+
const installer = new ManagedProjects(root);
|
|
179
|
+
try {
|
|
180
|
+
const text = await installer.authorLock(JSON.parse(manifest.text), previous?.text);
|
|
181
|
+
if ((await workspace.read('package.json')).version !== manifest.version)
|
|
182
|
+
throw new WorkspaceError('REVISION_CONFLICT', '生成锁文件期间包声明已改变,请重试');
|
|
183
|
+
await workspace.write({ file: 'package-lock.json', expectedVersion: previous?.version ?? null, text });
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
await installer.close();
|
|
187
|
+
await rm(root, { recursive: true, force: true });
|
|
188
|
+
}
|
|
189
|
+
}
|