@arcadia-eternity/content-sdk 0.0.0-stage → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -2
  3. package/dist/asset-inspect.mjs +67 -0
  4. package/dist/author-api.mjs +112 -0
  5. package/dist/author-reference.mjs +121 -0
  6. package/dist/build-content.mjs +30 -0
  7. package/dist/cli.mjs +74 -0
  8. package/dist/content-query.mjs +283 -0
  9. package/dist/content-workspace.d.mts +161 -0
  10. package/dist/content-workspace.mjs +936 -0
  11. package/dist/debug-environments.mjs +154 -0
  12. package/dist/demo.mjs +22 -0
  13. package/dist/environment-rules.d.mts +5 -0
  14. package/dist/environment-rules.mjs +92 -0
  15. package/dist/environment.mjs +183 -0
  16. package/dist/index.d.mts +1 -0
  17. package/dist/index.mjs +1 -0
  18. package/dist/job-journal.mjs +94 -0
  19. package/dist/jobs.mjs +579 -0
  20. package/dist/lib/content.mjs +95 -0
  21. package/dist/lib/presentation.mjs +240 -0
  22. package/dist/lib/yaml-sharing.mjs +101 -0
  23. package/dist/managed-projects.d.mts +35 -0
  24. package/dist/managed-projects.mjs +303 -0
  25. package/dist/managed-sources.d.mts +19 -0
  26. package/dist/managed-sources.mjs +503 -0
  27. package/dist/mcp-contracts.mjs +153 -0
  28. package/dist/mcp.mjs +369 -0
  29. package/dist/pack-project.mjs +156 -0
  30. package/dist/preview-control.mjs +260 -0
  31. package/dist/preview.mjs +313 -0
  32. package/dist/project-teams.mjs +98 -0
  33. package/dist/project.mjs +140 -0
  34. package/dist/rename.mjs +112 -0
  35. package/dist/setup.mjs +134 -0
  36. package/dist/source-lock.mjs +103 -0
  37. package/dist/template/LICENSE +21 -0
  38. package/dist/template/README.md +17 -0
  39. package/dist/template/arcadia.config.mjs +2 -0
  40. package/dist/template/assets/marks/slow.png +0 -0
  41. package/dist/template/assets/pets/frostling-battle.png +0 -0
  42. package/dist/template/assets/pets/frostling-icon.png +0 -0
  43. package/dist/template/assets/pets/frostling-portrait.png +0 -0
  44. package/dist/template/data/marks/slow.yaml +18 -0
  45. package/dist/template/data/presentations/main.yaml +34 -0
  46. package/dist/template/data/resources/main.yaml +21 -0
  47. package/dist/template/data/skills/rest.yaml +6 -0
  48. package/dist/template/data/skills/strike.yaml +14 -0
  49. package/dist/template/data/species/pet-swf.yaml +36 -0
  50. package/dist/template/data/species/pet.yaml +34 -0
  51. package/dist/template/debug/teams/blue.yaml +25 -0
  52. package/dist/template/debug/teams/orange.yaml +25 -0
  53. package/dist/template/docs/presentation.md +21 -0
  54. package/dist/template/locales/en/mark.yaml +5 -0
  55. package/dist/template/locales/en/skill.yaml +12 -0
  56. package/dist/template/locales/en/species.yaml +6 -0
  57. package/dist/template/locales/zh-CN/mark.yaml +4 -0
  58. package/dist/template/locales/zh-CN/skill.yaml +10 -0
  59. package/dist/template/locales/zh-CN/species.yaml +6 -0
  60. package/dist/template/package.json +44 -0
  61. package/dist/template/skills/arcadia-content-authoring/SKILL.md +23 -0
  62. package/dist/template/skills/arcadia-content-authoring/references/project-sources.md +15 -0
  63. package/dist/template/skills/arcadia-content-authoring/references/tool-workflows.md +37 -0
  64. package/dist/template/skills/seer2-recreate-pet/SKILL.md +82 -0
  65. package/dist/template/skills/seer2-recreate-pet/references/mechanics-and-validation.md +47 -0
  66. package/dist/template/skills/seer2-recreate-pet/references/project-conventions.md +32 -0
  67. package/dist/template/skills/seer2-recreate-pet/references/testing.md +50 -0
  68. package/dist/template/src/effects.ts +44 -0
  69. package/dist/template/test/pack.test.mjs +178 -0
  70. package/dist/template/tsconfig.json +15 -0
  71. package/dist/testing.mjs +204 -0
  72. package/dist/workbench-context.mjs +18 -0
  73. package/dist/workspace-cli.mjs +60 -0
  74. package/dist/workspace-materials.mjs +153 -0
  75. package/dist/workspace.mjs +684 -0
  76. package/package.json +68 -3
@@ -0,0 +1,36 @@
1
+ # Optional visual variant. Select example-pack:pet-swf in a team to try it.
2
+ # Reuses the starter's stats and skills; these URLs only demonstrate hosted resources.
3
+ id: pet-swf
4
+ num: 2
5
+ element: Normal
6
+ baseStats:
7
+ hp: 100
8
+ atk: 100
9
+ def: 100
10
+ spa: 100
11
+ spd: 100
12
+ spe: 100
13
+ genderRatio: null
14
+ heightRange:
15
+ - 1
16
+ - 2
17
+ weightRange:
18
+ - 1
19
+ - 2
20
+ ability: []
21
+ emblem: []
22
+ learnable_skills:
23
+ - skill_id:
24
+ $ref:
25
+ projectId: example-content-pack
26
+ kind: skill
27
+ id: strike
28
+ level: 1
29
+ hidden: false
30
+ - skill_id:
31
+ $ref:
32
+ projectId: example-content-pack
33
+ kind: skill
34
+ id: rest
35
+ level: 1
36
+ hidden: false
@@ -0,0 +1,34 @@
1
+ id: pet
2
+ num: 1
3
+ element: Normal
4
+ baseStats:
5
+ hp: 100
6
+ atk: 100
7
+ def: 100
8
+ spa: 100
9
+ spd: 100
10
+ spe: 100
11
+ genderRatio: null
12
+ heightRange:
13
+ - 1
14
+ - 2
15
+ weightRange:
16
+ - 1
17
+ - 2
18
+ ability: []
19
+ emblem: []
20
+ learnable_skills:
21
+ - skill_id:
22
+ $ref:
23
+ projectId: example-content-pack
24
+ kind: skill
25
+ id: strike
26
+ level: 1
27
+ hidden: false
28
+ - skill_id:
29
+ $ref:
30
+ projectId: example-content-pack
31
+ kind: skill
32
+ id: rest
33
+ level: 1
34
+ hidden: false
@@ -0,0 +1,25 @@
1
+ schemaVersion: 1
2
+ id: blue
3
+ name: Blue
4
+ team:
5
+ - name: Frostling
6
+ species: example-pack:pet
7
+ level: 100
8
+ nature: Hardy
9
+ skills:
10
+ - example-pack:strike
11
+ - example-pack:rest
12
+ evs:
13
+ hp: 0
14
+ atk: 0
15
+ def: 0
16
+ spa: 0
17
+ spd: 0
18
+ spe: 0
19
+ ivs:
20
+ hp: 31
21
+ atk: 31
22
+ def: 31
23
+ spa: 31
24
+ spd: 31
25
+ spe: 31
@@ -0,0 +1,25 @@
1
+ schemaVersion: 1
2
+ id: orange
3
+ name: Orange
4
+ team:
5
+ - name: Frostling
6
+ species: example-pack:pet
7
+ level: 100
8
+ nature: Hardy
9
+ skills:
10
+ - example-pack:strike
11
+ - example-pack:rest
12
+ evs:
13
+ hp: 0
14
+ atk: 0
15
+ def: 0
16
+ spa: 0
17
+ spd: 0
18
+ spe: 0
19
+ ivs:
20
+ hp: 31
21
+ atk: 31
22
+ def: 31
23
+ spa: 31
24
+ spd: 31
25
+ spe: 31
@@ -0,0 +1,21 @@
1
+ # 形象、声音与多语言
2
+
3
+ 本包采用分离的表现格式 v2。精灵、技能和印记规则保存在 `data/species`、`data/skills`、`data/marks`;表现关联保存在 `data/presentations`;资源身份和位置保存在 `data/resources`。素材仍可与规则放在同一个 npm 包里。
4
+
5
+ 以 `data/presentations/main.yaml` 和 `data/resources/main.yaml` 为例:表现的 `target` 指向本包内容,`icon`、`portrait`、`battle.source`、`sfx` 等字段引用资源 ID。资源记录的 `source` 才填写包根目录相对路径或 HTTP(S) URL。跨包素材写 `{namespace: other-pack, id: shared-icon}`,并声明对应 npm 依赖。
6
+
7
+ 资源 ID 应保持稳定。移动素材后更新资源记录的 `source`,对象关联不变;移动定义文件不会改变 ID。不要通过改 ID 修复路径。工作台会保留缺失引用并提示重新定位。
8
+
9
+ 默认把素材放在 `assets/`;允许其他包内普通目录,但必须加入 `package.json.files`。不允许符号链接或路径穿越。`kind` 为 image、audio、swf;战斗 `renderer` 明确为 image 或 seer2-swf。图片与音频用途不能混用。
10
+
11
+ 名称与 ICU 描述继续放在 `locales/<language>/<namespace>.yaml`,使用相同内容 ID。工作台把规则、资源和多语言组合为对象页面;外部 AI 应分别编辑对应源记录。
12
+
13
+ 描述中的印记名称用 `<markName>名称</markName>`,不良/异常印记属于同一个展示子类,使用 `<status>名称</status>`;其他印记不自动归入此类。需要可导航的对象引用时用 `<mark>namespace:id</mark>`,界面根据目标现有的 `status` / `exceptional` 标签统一配色。不要为了颜色修改战斗规则标签。技能性质“必中”用 `<guaranteedHit>必中</guaranteedHit>`,数值写 `{power}` / `{stack}`;不使用 HTML 属性、双大括号或 `[颜色]文字[-]`。
14
+
15
+ 这是固定的宿主展示约定:普通印记青色(浅色 `cyan-700`/深色 `cyan-300`),不良/异常子类橙色(`orange-700`/`orange-300`),技能性质“必中”黄绿色(`lime-700`/`lime-300`)。恢复、怒气和数值增减继续用其语义标签,不能据此反推印记分类。颜色由宿主渲染器维护,包内不自定义。完整约定见宿主仓库 `docs/guides/content-presentation.md` 的“固定配色约定”。
16
+
17
+ 描述引用保存命名空间和稳定 ID,不保存翻译名或文件路径;同名对象不能自动互换。后续将完善统一引用规范、联想和跨工具检查,目前不要假定格式检查已经证明所有目标存在,也不要使用尚未支持的精灵/技能/资源引用语法。
18
+
19
+ `npm run build` 生成 `dist/content.json` 和 `dist/presentation.json`。前者只有规则,后者包含表现关联、资源索引与语言。不要编辑生成物。HTTP 地址不会在构建或安装时下载;包内素材会记录哈希和大小。旧的内嵌 presentation、assets.json 映射不再支持。
20
+
21
+ 修改后运行 `npm test` 和 `npm run pack`。发布前确保 SDK 与表现格式 v2 匹配。
@@ -0,0 +1,5 @@
1
+ slow:
2
+ name: Slow
3
+ description: >-
4
+ <debuff>Reduces</debuff> the owner's speed. Reapplying refreshes the duration;
5
+ speed returns when the mark expires or is removed.
@@ -0,0 +1,12 @@
1
+ strike:
2
+ name: Frost Strike
3
+ description: >-
4
+ Attack with {power, plural, =0 {no power} one {<damage>#</damage> power point} other {<damage>#</damage> power points}}
5
+ and <strong>{accuracy}%</strong> accuracy.
6
+ {category, select, Physical {Deals physical damage.} Special {Deals special damage.} other {}}
7
+ On hit, apply <mark>example-pack:slow</mark>; reapplying refreshes its duration.
8
+ rest:
9
+ name: Soft Tap
10
+ description: >-
11
+ Tap the opponent with <damage>{power}</damage> power and <strong>{accuracy}%</strong> accuracy.
12
+ This skill neither applies Slow nor restores HP.
@@ -0,0 +1,6 @@
1
+ pet:
2
+ name: Frostling
3
+ description: A sample pet with separate packaged icon, portrait and <emphasis>static battle artwork</emphasis>.
4
+ pet-swf:
5
+ name: Hosted Appearance Example
6
+ description: Uses remote images and a <strong>seer2-swf</strong> battle resource, with packaged fallback artwork.
@@ -0,0 +1,4 @@
1
+ slow:
2
+ name: 减速
3
+ description: >-
4
+ 使持有者速度<debuff>降低</debuff>。重复施加只刷新持续时间;到期或被移除时恢复。
@@ -0,0 +1,10 @@
1
+ strike:
2
+ name: 霜击
3
+ description: >-
4
+ {power, plural, =0 {发动不带威力的} other {以 <damage>#</damage> 威力发动}}{category, select, Physical {物理} Special {特殊} other {}}攻击,命中率 <strong>{accuracy}%</strong>。
5
+ 命中后施加 <mark>example-pack:slow</mark>,重复施加刷新持续时间。
6
+ rest:
7
+ name: 轻触
8
+ description: >-
9
+ 以 <damage>{power}</damage> 威力轻触对手,命中率 <strong>{accuracy}%</strong>。
10
+ 此技能不施加减速,也不回复体力。
@@ -0,0 +1,6 @@
1
+ pet:
2
+ name: 霜团
3
+ description: 使用包内独立头像、立绘与<emphasis>静态战斗形象</emphasis>的示例精灵。
4
+ pet-swf:
5
+ name: 远程外观示例
6
+ description: 使用远程图片与<strong>seer2-swf</strong>战斗资源;加载失败时显示包内图片。
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@arcadia-eternity/content-pack-template",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "files": [
7
+ "data",
8
+ "dist",
9
+ "src",
10
+ "assets",
11
+ "locales",
12
+ "docs"
13
+ ],
14
+ "scripts": {
15
+ "rename": "arcadia-content rename",
16
+ "check": "arcadia-content check",
17
+ "build": "arcadia-content build",
18
+ "test": "npm run build && node --test test/*.test.mjs",
19
+ "demo": "npm run build && arcadia-content demo",
20
+ "preview": "npm run build && arcadia-content preview",
21
+ "pack": "arcadia-content pack",
22
+ "workspace": "arcadia-content workspace . describe",
23
+ "mcp": "arcadia-content-mcp ."
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "25.6.0",
27
+ "typescript": "6.0.3",
28
+ "@arcadia-eternity/content-sdk": "4.2.0"
29
+ },
30
+ "arcadia": {
31
+ "formatVersion": 1,
32
+ "projectId": "example-content-pack",
33
+ "namespace": "example-pack",
34
+ "content": "dist/content.json",
35
+ "effects": "dist/effects.js",
36
+ "sdkApi": 2,
37
+ "presentation": "dist/presentation.json"
38
+ },
39
+ "description": "A runnable Arcadia Eternity user-defined content pack: species, skills, marks and TypeScript effects.",
40
+ "license": "MIT",
41
+ "engines": {
42
+ "node": ">=24 <25"
43
+ }
44
+ }
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: arcadia-content-authoring
3
+ description: Build or debug an Arcadia Eternity npm content pack with TypeScript effects and real-engine tests. Use when creating or modifying a content pack, its effects, or its local test and preview workflow.
4
+ ---
5
+
6
+ # Arcadia content authoring
7
+
8
+ Work in the author's content project. Ask for the desired game behavior when its trigger, target or lifetime is ambiguous. Use the SDK and host version actually available to the project; `arcadia.sdkApi` is an API compatibility version, not an engine build identity.
9
+
10
+ 1. Read `package.json` and the actual source layout: `data/species`, `data/skills`, `data/marks`, `src`, `assets`, `locales`, `test` and `arcadia.config.mjs`. Some older projects still use a root `content.json`; follow their manifest rather than assuming it. Do not edit generated `dist` as source. If the host repository is available, consult `docs/guides/npm-content.md` and `docs/guides/effect-sdk.md`. Do not assume SDK packages have been published merely because a version is in a manifest.
11
+ 2. Use `createEffects({ sdk, marks, id })` and `sdk.defineCodeEffect` for new behavior; use injected SDK objects and canonical prototypes. Keep `projectId`, namespace, use IDs and binding keys stable unless a breaking identity change is intended. Cross-package data references require npm dependencies.
12
+ 3. Implement parameters with `numberParam`, `booleanParam` or `stringParam` when battle effects must read or modify them. Use the declared source scope and capture/follow semantics; do not require a parameter editing form. Keep per-battle state in engine instances, parameters and bindings rather than module-global mutable variables. Use the battle RNG instead of `Math.random()` for battle decisions.
13
+ 4. Build and run the project's own scenario tests against the real engine. For a slow effect cover hit, miss, repeated application, removal and natural expiry; exercise supported waiting-point snapshot restoration if relevant. Preserve meaningful existing assertions and run independent host contract tests when available. The starter's `npm test` covers hit, miss, refresh, removal, natural expiry and restoration at a supported selection waiting point. Fix implementation failures rather than weakening unrelated tests.
14
+ 5. Pack with `npm run pack` / `arcadia-content pack`, inspect the actual artifact and validate it in a separate npm installation. The author tool stages `arcadia.effectArtifact` and a closed effect module before its internal `npm pack --ignore-scripts`; plain npm pack does not generate this prebuilt artifact. Validate distributed code packages with prebuilt-only preparation so consumers need no author compilation or development dependencies. Installing, code admission and selecting a server environment are separate steps. Use the local development approval profile only for an explicitly approved local environment. Never treat a content hash, package install or client acknowledgement as permission to run code.
15
+ 6. Run `check_start` and `test_start`, poll `job_get`, and fix reported file/line diagnostics with version-checked writes. Then use `preview_start` for a captured npm candidate and the full battle client. Poll `job_get` for `result.preview.url` or `clientPath`; desktop users can open that same task from the workbench. Compare the task's source revision and candidate identity with the tested revision. `demo` remains the headless demonstration. Use `job_cancel` to stop the preview from any entry point; interrupted tasks need a new run. Keep active matches on their existing candidate. The browser consumes public metadata, on-demand resources and battle messages; effects execute in the local Node host.
16
+
17
+ For CLI/MCP operations, file conflicts and desktop project locations, read [tool workflows](references/tool-workflows.md). For media, locale and cross-package references, read [project sources](references/project-sources.md). The content library supports independent species, skills and marks; ability and emblem are mark tags. Authors can create objects, pick existing references, edit scoped multilingual names/descriptions, import media and preview bindings. Creation and field edits enter drafts and require reviewed saving. Drafts survive object navigation; shared YAML fields stay read-only in forms. Use external tools for TypeScript, file organization and intentional shared-definition edits.
18
+
19
+ When connected through the desktop MCP configuration, call `workspace_context` to understand the current package, view, focused object/resource, locale, unsaved drafts and conflicts. No explicit object selection is required. Focus is context, not an edit scope or authorization; follow the user's task and use `content_query` to discover related objects as needed. `focus.visible` distinguishes the visible object from the last focused object while another tool page is open. Draft values are unsaved; do not mistake their `expectedVersion` for a revision containing those values. Read disk sources before writing, preserve unrelated user changes and leave conflicting drafts for desktop reconciliation. If context is disconnected, expired or from another project, use source inspection and conversation rather than treating old UI state as current. Do not invent a skill-to-mark field: effects connect those through actual behavior definitions and parameters.
20
+
21
+ Report the behavior changed, tests actually run, build/environment identity when available and any unmet validation. Publishing, registry credentials and deployment remain under the author's control; do not publish or deploy as a side effect of testing.
22
+
23
+ 资源采用分离定义:规则位于 data/species、skills、marks;data/presentations 通过 target.kind/id 关联对象,用途字段引用稳定资源 ID;data/resources 定义 id/kind/source。不要把 presentation、assetRef/iconRef/sfxRef 写入规则。移动素材只改 source;表现、资源和语言同样需要版本检查、草稿保护及锚点保护。content_query 的 presentations/resources 可直接查询这些记录。
@@ -0,0 +1,15 @@
1
+ # Project sources
2
+
3
+ JSON/YAML content can contain one record or an array. Preserve unknown fields, comments and stable content IDs when making focused changes. Names, paths, namespace, projectId and useId are separate identities. A file rename does not rename a content ID.
4
+
5
+ Species learn skills; skills and marks reference effects defined in `createEffects`. Traits and emblems use mark references. Cross-package references use the dependency's projectId and require declared npm dependencies; resource namespace references have a separate shape. Consult actual nearby examples and types instead of inventing either format.
6
+
7
+ Keep rules media-free. Define stable resources in `data/resources` with `id`, `kind`, `source`; associate content through `data/presentations` with `target.kind/id`. Usage slots reference resource IDs. `assets` is the default media directory; other ordinary package directories are supported. Species may use icon, portrait and battle; battle renderer is explicitly `image` or `seer2-swf`. Skills use sfx, marks use icon. HTTP(S) references are not downloaded by authoring tools. Source media replacement changes the next build, not an existing battle. When media moves, update its resource source without changing its ID. Cross-package references use `{namespace, id}` and require an installed dependency.
8
+
9
+ Language files live in `locales/<language>/<namespace>.json|yaml`. Reuse the project's i18next namespaces and FormatJS variable contract. Plain template text in the workspace is not a rendered battle description; dynamic values require real battle context. Missing references and partial drafts may remain on disk, but checking, building and testing must report their errors.
10
+
11
+ Follow the host's fixed description color convention (canonical source: `docs/guides/content-presentation.md`, section 固定配色约定, when the host repository is available). Ordinary mark names are cyan (`markName`); adverse and exceptional marks form ONE orange display subtype (`status`), not all marks or all negative effects. A `<mark>namespace:id</mark>` reference uses the target's existing `status` / `exceptional` tags to select that subtype. Do not modify gameplay tags to obtain a color. `markName` and `status` wrap literal text, not IDs; use `mark` for an actual object reference. The guaranteed-hit property uses `guaranteedHit`, distinct from the rule variable `sureHit` and from receiving a guaranteed-hit mark. Never replace semantic categories with arbitrary hex colors or generic emphasis during a format repair.
12
+
13
+ Resolve references from actual project/dependency records, preserving namespace and stable ID. A localized name or filename is not an identity. Do not infer a reference or gameplay effect from descriptive text. Query available context and content before suggesting a target, and report unresolved or ambiguous references without silently rebinding them. A future shared reference/variable schema and cross-tool diagnostics are design requirements recorded in that document under 描述引用的后续规范方向, not capabilities that the current SDK/MCP already guarantees. Passing the current formatting tests alone does not prove reference integrity.
14
+
15
+ For sustained effects, use the existing template test as a starting point: miss/hit, repeated application, parameter change, source transfer/removal, natural expiry, supported waiting-point restore and deterministic full battles. Tests should run the actual npm artifact in an independent installation. Keep media/package-content assertions: they catch source-only files omitted by the npm files list.
@@ -0,0 +1,37 @@
1
+ # Author tool workflows
2
+
3
+ Start with `arcadia-content workspace <directory> describe` or MCP `workspace_describe`. Use the returned SDK API, capabilities and source revision. Opening or inspecting a project does not import its effect code.
4
+
5
+ The CLI emits JSON. `query`, `read`, `write` and `save` take JSON on stdin:
6
+
7
+ ```sh
8
+ printf '%s' '{"file":"data/skills/strike.yaml"}' | arcadia-content workspace . read
9
+ arcadia-content workspace . check
10
+ arcadia-content workspace . test --execute
11
+ arcadia-content workspace . demo --execute
12
+ arcadia-content workspace . pack --execute
13
+ ```
14
+
15
+ For file writes, pass `file`, `expectedVersion` and `text`; null version expects a new file. Prefer the coding assistant's normal file editing tools for TypeScript. The workspace watches the same directory, so changes become visible in the game. A failed version check means re-read the source and reconsider the change; do not retry a stale overwrite. Unsaved game forms remain in memory across object navigation. External changes require explicit field reconciliation followed by a separate save; the author can also discard drafts.
16
+
17
+ For structured edits, query content rows or `kind: locales` with `detail: full` first, then use MCP `content_apply` or CLI `save` with `{ changes: [...] }`. Each change includes `kind: record | locale | create-record`, `file`, `expectedVersion` and the complete `record` value. `create-record` uses a new file under the corresponding data directory, a new ID and `expectedVersion: null`; it never overwrites an existing file. New locale files also use null, and may refer to an object created in the same batch. Definition changes retain their `index` (null for a single-object file); locale changes use the content `id`. Preserve unknown fields. `sharedFields` describes read-only YAML anchors, aliases and inherited values; do not detach them to bypass the guard. Edit shared definitions through an intentional external source change. Inspect `complete` and each file in `results`: same-file edits are grouped, but multiple files do not commit as one transaction. On partial success, retain uncommitted work and re-read before retrying.
18
+
19
+ MCP configuration launches the installed `arcadia-content-mcp` executable with the explicit project directory. `--execute` enables tests, demonstration battles and packaging for a trusted local project; `--read-only` hides writes and tasks that generate files, including checks. The official base package is always read-only in author sessions, even without the flag. Its legacy `pack.json` source layout is indexed directly. Desktop installed-package browsing uses `--published`: this forces read-only access and follows the package manifest’s built content/presentation artifacts, including embedded locales, instead of assuming editable source files are shipped. Inspect capabilities before proposing edits. The default transport is stdio. No external server or model account is required.
20
+
21
+ Use discovered tool names. Core tools include `workspace_describe`, `workspace_context`, `content_query`, `source_read`, `source_apply`, `content_apply`, `check_start`, `job_get` and `job_cancel`. Execution-enabled sessions also expose `test_start`, `preview_start` and `package_build`. Start returns a job ID. Discover retained jobs with `job_list`; `job_get` returns compact state, diagnostics and candidate metadata, with optional `waitMs` up to 10000. Logs are omitted by default: read `job_output` chunks, reuse `nextCursor`, inspect `hasMore` and `truncated`. Query until a terminal state. `stale: true` is an old-source result, not proof the current files pass. Cancel stops the task, not source edits.
22
+
23
+ Standalone MCP and desktop both operate on the same disk files. The desktop connection configuration supplies `--context-file` for live `workspace_context` reads; this optional file is outside the project under Electron userData. It refreshes on navigation/form changes and every 30 seconds, is removed when the workspace closes, and expires after 90 seconds without a refresh. The reader verifies the bound project root. Without this option, `workspace_context` reports `not-configured`. Source reads still return disk files. Live context identifies unsaved drafts but does not lock the project: MCP writes update disk, and the desktop preserves dirty drafts and their original base versions for explicit reconciliation. File versions remain authoritative. Cooperating desktop, CLI and MCP saves serialize version checks and writes within each project; arbitrary external editors do not participate. Multi-file saves are not transactional. Partial `content_apply` results carry `isError` and per-file results, so retain uncommitted changes.
24
+
25
+ Desktop projects default to the Electron userData `ugc/projects` directory; existing directories are opened in place. Use the returned root rather than guessing a platform path. Moving a project to another machine requires its SDK/dependencies there; source export does not bundle node_modules. Source project export and an npm content tgz have different purposes.
26
+
27
+ Build/check/test use the fixed author commands. A headless demo proves engine execution, not image/audio playback or interactive UI acceptance. npm publication and production deployment are separate tasks.
28
+
29
+ ## Discovery, teams and isolated battle checks
30
+
31
+ `content_query` searches localized names and accepts exact `id`, `contentKind`, `locale`, `namespace`, `packageName` and `scope: project | dependencies | all`. Default summaries omit the full record. Request `detail: full` before editing; use `nextOffset` to continue. Locale pages contain individual objects, not whole files. Declared installed dependencies are read without executing effects and return read-only provenance. Their file paths are relative to those packages, not valid bound-project edit targets. Missing or ambiguous dependencies are diagnostics, not permission to guess a target.
32
+
33
+ Use `team_list`/`team_save`/`team_remove` and `environment_list`/`environment_save` for saved project data. Saves require `expectedVersion`; null creates a file. These operations never select a team/environment, overwrite local drafts, or mutate a running match. Desktop file-change notifications refresh clean views promptly without focus changes; dirty drafts retain their base and show external-change conflicts. Users explicitly reload or resolve drafts. Environment changes require preparing a new candidate before a new battle.
34
+
35
+ `author_reference` and `arcadia://authoring/<topic>` expose actual SDK schemas/examples. Topics are species, skills, marks, team, environment, descriptions and effects. Read schema stage notes: linked-runtime schema is not source syntax. `asset_inspect` takes a declared resource ID; `includeImage: true` returns local image bytes up to 2 MiB as standard MCP image content. Use an image filename extension: MIME types follow filenames, and unknown extensions remain metadata-only. The client handles decoding/display; this tool does not validate image integrity or report dimensions. Large images remain metadata-only; no automatic thumbnail is generated. HTTP assets are not downloaded; audio/SWF are metadata only.
36
+
37
+ For behavioral verification, `battle_create` takes a live preview `jobId`, two saved `teamIds`, and a fixed `seed`. It creates an independent automation battle; the user's manual match remains untouched. `battle_read` returns its `sessionId`, `revision`, state and legal `selections`. Submit a returned selection with `battle_action` and `expectedRevision`; never retry a timed-out action without re-reading. `battle_events` reads bounded event pages. `battle_reset` and `battle_close` also require the observed revision. At most four automation battles exist per preview. An engine failure returns `failure` and `stateCurrent: false` with a usable revision for reset/close; cached state is not current proof. Create/reset snapshots the latest saved team files and records their versions while retaining the captured candidate rules; team-only edits do not require rebuilding. Existing battles retain their own team snapshots. These tools never read unsaved UI values.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: seer2-recreate-pet
3
+ description: 根据任务提供的资料,将赛尔号2精灵、技能、特性、纹章及表现复刻到 Arcadia Eternity 原生内容包。适用于按精灵名称或编号还原原作、补齐技能机制及资源表现。
4
+ ---
5
+
6
+ # 赛尔号2精灵复刻
7
+
8
+ 默认目标是当前作者内容项目;先读当前 AGENTS.md 和 package.json,确认安装的 SDK。只查资料时不修改内容包;要求复刻时完成数据、效果、表现和针对性验证。本 skill 随 content-dev SDK 模板分发,也可从仓库文档目录读取。
9
+
10
+ ## 输入与采用口径
11
+
12
+ 使用用户为当前任务提供的精灵资料、数值和素材;资料不随 skill 分发,不预设下载站点、备份仓库或本机位置。资料不足时先完成可确认部分,再集中说明影响玩法的缺口。
13
+
14
+ 项目种族值换算:HP 保持输入原值;物攻、物防、特攻、特防、速度各加50。若输入使用 Atk/Def/SpAtk/SpDef/Spd,分别映射 atk/def/spa/spd/spe;特别注意输入 Spd 是速度,项目 spd 是特防。仅对未换算的值使用公式,不二次加50;已有精灵不在无关任务中批量改值。
15
+
16
+ 机制可查询社区说明,具体数值按用户指定的版本。逐技能核对主效果和附加效果,不能只抄威力、命中、怒气。后来补充的描述可能来自实测,早期描述省略不等于机制不存在;未取得实测记录时注明证据层级。
17
+
18
+ 异常、冲突或极端描述应结合机制判断,不机械照搬。多个有依据且自洽的候选通常采用综合技能强度最高的方案;不得叠加互不兼容的效果或凭空抬高数值。该选择不是原作事实证明。细则见 [机制考据与验证](references/mechanics-and-validation.md)。
19
+
20
+ ## 快速调查
21
+
22
+ 1. 用中文名、别名和图鉴编号查当前包 locales、species、skills,建立原版编号 → 当前内容 ID 对照。区分进化阶段、皮肤、形态和活动版本。系统精灵(包括系统/BOSS 专用数据)不在复刻范围内;过高编号是排查线索,结合同名记录、图鉴、获取途径和用途确认,不设未经证实的统一编号阈值。只接入玩家可获得的正常形态。默认沿 EvolvesFrom 回溯并补齐点名形态的完整正常玩家前置进化链,逐形态接入种族值、各自学习列表、特性/纹章、文本、资源和进化关系;不能只继承前置技能却漏掉前置精灵。仅在用户明确限定单一形态时缩小范围。分支、皮肤与系统形态不自动纳入。
23
+ 2. `rg --files` 按目录与扩展名筛选,先查 XML/JSON/AS 文本,再查 SWF。搜索编号时用边界或结构化字段,避免把 1 匹配为 1001。保留原始字段名和值,先确认属性枚举、倍率和单位再转换。
24
+ 3. 跟踪配置消费代码,确认字段语义及资源 URL 拼接规则。客户端描述只能证明文本,不自动证明服务端伤害公式、概率、触发顺序或隐藏条件。
25
+ 4. 为目标整理小型证据表:种族/技能/特性/纹章、原始 ID、源文件及字段或代码位置、目标 ID、已确认行为、待核实项。记录本地源文件哈希或远端 SHA。冲突资料并列注明版本,不能默默混用。
26
+
27
+ ## 接入当前引擎
28
+
29
+ 实施前阅读 [当前项目的内容约定](references/project-conventions.md),复用已核实的表示方式,并区分项目适配与原作机制。
30
+
31
+ ### 独立 SDK 内容包(默认)
32
+
33
+ 不要求主仓库存在。读取项目 manifest、安装的 SDK 参考与邻近示例,以 `data/species`、`data/skills`、`data/marks`、`src/effects.ts`、`locales`、`data/presentations`、`data/resources` 和 `test/*.test.mjs` 组织。进化链共享种族文件,效果按精灵或机制分组;以实际 manifest 为准,不凭空创建 base 专用注册文件。
34
+
35
+ 使用 `createEffects({ sdk, marks, id })`、`sdk.defineCodeEffect` 与 SDK 的 `defineEffect`;通过项目 namespace 和显式引用连接数据。复用外部技能、印记或资源须声明运行时 dependencies,开发工具放 devDependencies。不得修改安装的不可变包、node_modules,或为实验重写加载器。
36
+
37
+ 测试使用 `@arcadia-eternity/content-sdk/testing` 的 `prepareContentPack` 和标准依赖装配,不限制只能依赖 base。打包使用 `arcadia-content pack` 或项目对应脚本,检查生成预编译效果工件;在独立安装目录通过标准 `prebuilt-only` 准备验证分发产物。安装与执行准入分开,不能因为装包成功就推定允许执行。
38
+
39
+ 有 MCP 时先查询工作区与 `author_reference`,版本检查后使用 `source_apply`/`content_apply` 保存,运行 `check_start`、`test_start`、`package_build`,轮询 `job_get` 并增量读取 `job_output`。仅 CLI 时用项目脚本完成同等检查。遇到 SDK 缺口,记录最小复现与阻塞,继续独立内容工作;不要自行扩展为 SDK、前端或宿主修复任务。
40
+
41
+ ### 主仓库 base(仅在任务指定时)
42
+
43
+ 先查看 `packs/base/pack.json`、`packs/base/content-groups.yaml`、当前格式文档和相近精灵。种族与专属效果单独存放,技能、印记、翻译和资源按现有公共表组织:
44
+
45
+ | 内容 | 默认位置(相对 `packs/base/`) | 职责 |
46
+ | ---------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
47
+ | 种族 | `data/groups/<group>/species.*.yaml` | 种族值、学习列表、特性与纹章引用;沿用当前文件编号约定,不照抄实验的序号 |
48
+ | 技能 | `data/skill.yaml` | 分类、威力、命中、怒气、目标与效果 ID |
49
+ | 印记 | `data/mark.yaml`、`mark_ability.yaml`、`mark_emblem.yaml` | 状态、特性、纹章定义及持续、叠加、换场规则 |
50
+ | 专属效果 | `src/effects/<pet-or-group>.ts` | 集中维护该精灵或分组的原生 TypeScript 效果 |
51
+ | 文本 | `locales/zh-CN/` 下对应的 species、skill、mark、mark_ability、mark_emblem 表 | 名称和描述 |
52
+ | 表现与资源 | `data/presentations/main.yaml`、`data/resources/main.yaml` | 表现绑定与资源地址;核实当前 manifest,玩法记录不写资源路径 |
53
+ | 专项测试 | 仓库 `packages/battle/test/engine/<pet-or-group>.test.ts` | 该精灵的新机制及关键联动 |
54
+
55
+ 同名且同机制的技能、印记和公共效果优先复用,保持稳定 ID;语义不同再建立独立定义。专属效果遵循 `defineEffect` 的 triggers/apply 和 SDK 契约,优先参照已验证的 authored 效果;不要为集中到一个文件而复制公共机制。修改生成文件前追查生成来源,不恢复 DSL、Rule Graph 或 V2 实现。
56
+
57
+ 修改主仓库 base 时检查两条注册链(独立包使用自己的 manifest/SDK 注册方式):
58
+
59
+ - 数据:种族文件加入 `pack.json`,分组加入 `content-groups.yaml`;只有本次确实实现的进化关系才登记。
60
+ - 效果:专属文件可导出 `create<Pet>Effects(marks)`,在 `src/effects/candidate-catalog.ts` 汇入当前效果目录;按现有导出约定更新 `effects.ts`。技能和印记通过效果 ID 引用实现,仅导出函数不等于完成注册。
61
+
62
+ 这套结构中,一只精灵的完整实现会跨多个文件,不能只复制种族 YAML 和效果 TS 就视为迁移完成。交付时简要列出新增文件、追加到公共表的定义及注册入口;不要新增写死精灵、技能、印记或效果总数的校验;验证引用完整性、加载一致性和实际行为。文件数量不是目标,不为单只精灵另建一套目录结构。精灵展示沿用现有 icon、portrait、battle(`seer2-swf`、source、fallback)、cry 结构。
63
+
64
+ 本系统中,特性和纹章都建模为战斗开始时每只精灵自带的印记。复刻时将它们映射到 mark 定义及对应效果,并通过种族的 ability/emblem 引用及队伍装备接入现有战斗初始化流程;不是只有首发精灵才拥有,也不要改成首次上场才创建。印记已存在与效果何时触发是两回事:具体效果仍遵守原作的触发条件。先核对现有初始化实现:特性可由种族补齐,纹章需要队伍显式装备。测试首发和后备成员,不重复添加印记或另建运行机制。
65
+
66
+ 逐个确认技能威力、怒气、命中、优先级、目标、次数、概率,以及特性/纹章的条件、持续时间、叠层、清除、换场和结算时机。原表未说明的机制,主动搜索社区攻略、实测与对战录像补全;阅读 [机制考据与验证](references/mechanics-and-validation.md),区分社区直接说明、推断和项目约定。有适用且可信的社区依据即可继续实现,并保留出处;仅对查证后仍影响玩法的关键歧义集中询问用户,继续完成不受影响的部分。
67
+
68
+ 原作能与 Effect 类伤害交互的机制较少,这是逐项核实的背景,不代表一律不交互。不要仅凭“所有伤害”“减伤”等描述就把效果扩展到 Effect 伤害,也不要仅因当前引擎的 Effect 路径绕过某钩子便判定引擎缺陷。只有原作代码、社区实测等证据支持具体交互时才接入并验证;未证实的交互保持未确认,不擅自扩大范围。
69
+
70
+ 使用引擎提供的随机数和状态 API,保持确定性和快照恢复;跨触发状态不放模块变量或闭包。不要为单只精灵引入未经需要的引擎重构。
71
+
72
+ 资源按已确认编号与加载规则逐项匹配,不能凭文件名就认定同一形态。优先复用已有导出图和 SWF 播放链;需要转换时保留透明度、帧、尺寸和朝向。遵循项目资源按需加载与 HTTP(S) 直连约定,不新增预取或共享缓存。只复制实际所需资源到用户指定的可编辑包,不改已安装的不可变包,也不把本机绝对路径写进可分发配置。
73
+
74
+ ## 验证与交付
75
+
76
+ 编写或修改测试前阅读 [测试组织与写法](references/testing.md)。独立内容包使用 `test/*.test.mjs` 和包自身脚本;主仓库 base 使用 `packages/battle/test/engine/<group>.test.ts`,并执行专用类型与 lint 检查。同进化链复用同一测试文件;实验材料留在指定临时目录,不混入正式测试或分发包。
77
+
78
+ - 检查 manifest/分组注册、所有技能/印记/效果/翻译/资源引用、ID 唯一性和资源实际存在。
79
+ - 修改内容包后先按当前 package scripts 重建该包,再运行读取其 dist 的战斗测试,避免测到旧效果。base 包可核实并使用 `pnpm --filter @arcadia-eternity/data-pack-base build`。依赖产物过期时按 AGENTS.md 先 frozen install 和相关依赖构建,再判断类型错误。
80
+ - 新机制用固定随机输入验证关键触发、边界、持续与换场;持久状态涉及快照时验证恢复前后一致性。已有机制复用不机械增加重复测试。
81
+ - 默认实验验证内容数据、效果、构建/类型及战斗测试;客户端试玩与 Web UI 测试仅在用户要求时执行,不让前端排错阻塞内容实验。未运行的视觉/音频验收如实标明。
82
+ - 交付简短说明:已复刻形态、数据来源、复用/新增机制、验证结果及尚缺原作证据。资料不足也交付已确认数据和具体缺口,不编造“完整还原”。除非用户要求,不提交、推送或发布。
@@ -0,0 +1,47 @@
1
+ # 机制考据与验证
2
+
3
+ ## 原表没有说明时
4
+
5
+ 以任务提供的资料确认身份、关联和字段语义;技能/效果数值按用户指定版本取值。机制缺失时,搜索精灵名、技能名或印记名加具体疑问(如回血比例、换场、持续回合、固定伤害),查阅社区攻略、论坛实测和对战录像。4399 等攻略可作为入口,搜索摘要只用于定位,结论应来自实际读到的页面或录像。不要因为 buff 描述为空就停止实现,也不要拿社区种族值替换已确认的 HP 不变、其余五项 +50 公式。
6
+
7
+ 只记录影响实现的证据:
8
+
9
+ | 类型 | 记录方式 |
10
+ | ------------------ | ------------------------------------------------------------------------------ |
11
+ | 任务输入 | 资料标识、字段与版本,区分配置和描述文字;不在公开报告暴露未授权的来源定位信息 |
12
+ | 社区直接说明或实测 | 页面标题和 URL、发布日期/适用版本(可得时)、相关短摘录或录像时间点 |
13
+ | 社区推断 | 出处、推导过程及未排除的解释,不写成原表事实 |
14
+ | 项目约定 | 当前实现位置及采用理由,不称原作设定 |
15
+ | 尚未确认 | 具体缺失条件、影响哪个行为、已查线索 |
16
+
17
+ 优先采用条件清楚、版本吻合且可复核的实测;多个转载不视为多个独立证据。若社区描述与客户端冲突,先排查版本、形态和描述省略,不固定认定某一方必然正确。按以下用户确认的口径作出实现选择,不因来源冲突就一律退回旧表或暂停:
18
+
19
+ - 机制解释可采用社区说明;具体技能/效果数值以用户指定版本为准。明确的数值差异不属于待修错误,记录版本与采用值即可。种族值沿用主文固定换算公式。
20
+ - 指定版本新增文字可能记录了后续实测发现的原有附加效果。先区分旧表省略、后来查明、明确改版三种情况;仅有描述差异不能证明是指定版本原创或加强。明确且自洽的补充按当前采用口径实现,查不到原始测试也不自动丢弃,但如实标明证据层级。
21
+ - 对照时逐项列出主效果与副效果、概率、目标、幅度和触发条件,给每项标注复用或新增实现,防止只比较基础数值而漏掉副效果。例如卡顿嘟嘟的红心射线 10% 降速、群心满天 10% 加物攻,旧表未写不能成为省略理由;此例不表示其他技能自动具备同样副效果。
22
+ - 指定版本描述出现极端倍率、范围、时长或前后矛盾时,检查是否可能是测试改写;结合其他说明、对应配置与可得实测判断。数值大本身不证明错误,不自行编造上限,也不一概抛弃指定版本数据。
23
+ - 存在多个有依据且可成立的机制解释时,通常选择综合技能强度最高的自洽方案;综合考虑收益、触发条件、概率、消耗、持续与联动,不能只取每个字段的最大数拼成新技能。若强弱随场景变化,说明采用判断即可;确实无法据此作出合理选择时才集中询问。
24
+ - 用一句话或小表记录“输入资料/社区/指定版本说法 → 采用数值与机制 → 理由”。这种取舍标为用户授权的实现选择,不伪称原作已证实。复用公共技能时也核对它是否符合选定口径;语义不同则独立定义,避免改坏其他精灵。
25
+
26
+ 测试应证明所选方案及关键边界,不能仅因与旧表逐字段不一致就判失败,也不能用占位效果宣称完成。
27
+
28
+ ## 伤害交互的范围
29
+
30
+ 先分清技能物理/特殊伤害、固定或比例伤害、持续伤害、直接扣血,再检查当前引擎如何表示它们。原作类别与项目 `Effect` 枚举不是天然一一对应;应根据产生伤害的代码和具体效果确认,不能只按技能文本归类。
31
+
32
+ 用户明确指出原作与 Effect 类伤害交互的机制不多。对减伤、护盾、免伤、吸血、反伤、受击触发等,逐项确定其适用来源;“受到伤害”“所有伤害”这样的简写不足以证明覆盖所有引擎路径。既不要默认全覆盖,也不要默认全部排除。
33
+
34
+ 只有“该精灵在原作确实需要此交互”的证据与“当前执行路径不支持”的代码证据同时成立,才把它列为实现缺口,并选择最小适配。缺少原作证据时记录范围未确认,不为此扩展通用伤害管线。测试覆盖已证实的交互及有依据的排除项;测试通过只能证明实现符合所选规则,不能替代原作考据。
35
+
36
+ ## 从机制到验证
37
+
38
+ - 为新机制挑出会改变结果的触发条件、目标、数值、持续/清除时机和换场行为;从证据写预期,不照抄实现生成断言。随机效果用固定输入,持久状态验证快照恢复。复用成熟机制时避免逐技能重复同一套测试。
39
+ - 分数阈值按原始数学条件比较:例如“低于最大生命的 1/8”可比较 `hp * 8 < maxHp`,不要先向下取整阈值。用不能整除的最大生命验证边界。
40
+ - 检查待机精灵的印记持续时间是否暂停、切换是否清除等当前运行规则,再与原作证据比较;不能将项目现状自动当成原作规则。特性/纹章仍按 skill 主文约定在战斗开始时给每只精灵创建。
41
+ - 修改 authored 效果或数据后,先重建对应内容包,再运行消费 dist 的测试;数据字段比对、战斗机制测试、客户端表现验收分别报告,不能互相代替。
42
+ - 仅在用户要求客户端验收时,优先复用当前仓库本地战斗的端到端测试助手,在独立浏览器上下文准备队伍,检查实际技能结算和战斗记录。避免修改用户正在使用的队伍存储。
43
+ - 精灵战斗 SWF、技能特效、音效分别核验。原表有 EffectID 不表示当前配置已经绑定技能动画;静态截图也不能证明动画完整或音频可播放。交付时只声称实际观察到的结果。
44
+
45
+ ## 推定结算时机
46
+
47
+ “消耗印记获得先制/威力”不自动意味着命中后才消耗。先制收益在命中前已取得,应分别说明增益生效、移除印记、命中与行动取消的时点,以及提前失去防御效果的后果。接受的实现取舍与原作实测事实分开记录;不能只因 MISS 返还更强就自动采用返还。
@@ -0,0 +1,32 @@
1
+ # 当前项目的内容约定
2
+
3
+ 这些是当前 base 包的适配方式与调查入口,不是原作服务端规则。目标仓库发生变化时以当前定义和实现为准;机制与数值来源仍遵循 SKILL.md 的采用口径。
4
+
5
+ ## 技能与学习列表
6
+
7
+ - 必杀技:当前 `data/skill.yaml` 中 Climax 技能统一配置 `sureHit: true`。接入时沿用明确的必中字段,不用把 accuracy 写成 999 来替代;旧表命中 100 本身不能证明必中。具体技能存在相反证据时单独说明。
8
+ - 隐藏技能:当前种族学习列表以 `hidden: true`、`level: 60` 表示。原表特殊学习条件编码不能直接当作实际等级;将原作解锁条件留在来源记录,不在单只精灵任务中扩建解锁系统。
9
+ - 默认补齐目标形态的完整正常玩家前置进化链,各阶段使用自己的原表学习列表;进化形态另外继承前置技能,保留学习等级并按技能 ID 去重。为每个阶段接入种族、文本、资源和进化关系,不向幼体直接复制进化后的技能。用户明确只要单一形态时才仅继承技能而不接入前置种族。搭档、同系列或同名形态不自动属于进化链。
10
+
11
+ ## 复用前查清语义
12
+
13
+ - 建立本次目标的小型对照:原始精灵/技能/buff/道具 ID → 当前 species/skill/mark/effect ID。原始编号属于不同命名空间,不能直接互换。
14
+ - 同名技能先核对当前实现的触发条件、阶段变化、概率和数值;已有实现可能包含项目修订,不能仅凭同名就宣称与原作一致。共享定义与目标需求冲突时明确取舍,避免顺手改变所有使用者。
15
+ - 除名称搜索外,按机制找现有实现。例如跨精灵印记联动可调查极光/绝影相关效果,比较印记归属、触发时机、消耗和换场行为后再决定复用。存在类似机制不代表语义相同。
16
+ - 联动涉及队友时,专项测试尽量通过队友实际技能产生印记,再换场触发目标效果,覆盖完整联动链。
17
+
18
+ ## 不能从一个案例推广的配置
19
+
20
+ 印记层数上限、换场是否清除、重复施加是刷新还是叠加、替代印记是否消耗、持续回合及伤害类别都影响玩法,必须逐项按资料确定。不要把实验中的“最多 5 层”“换场清除”或“不消耗”写成默认规则,也不要以“配置保护”为理由添加未获依据的玩法上限。
21
+
22
+ 配置了 refresh 等策略只能证明实现选择;当重复施加会改变核心机制时,应验证实际效果。报告区分资料明确说明、当前项目适配和本次实现取舍。
23
+
24
+ ## 验证边界
25
+
26
+ 不维护写死的全包精灵、技能、印记或效果总数。验证 ID 唯一、引用可解析、注册完整及实际行为;比较两条加载路径时可比较内容 ID,验证新增一个模板时可比较相对增量。CLI 展示内容数量可以保留,展示值不作为固定内容规模的验收门槛。
27
+
28
+ 默认不运行客户端试玩或 Web UI 测试;按 SKILL.md 进行内容与战斗验证。
29
+
30
+ ## 已确认的项目统一行为
31
+
32
+ 基础不良状态复用 SDK/base 的公共印记。冻伤降低特攻能力是项目有意统一的行为,不因资料使用“特攻伤害降低”的文字就重复判为复刻缺陷。其他共享定义仍逐项核对,不将这个决定推广到所有差异。
@@ -0,0 +1,50 @@
1
+ # 精灵复刻的测试组织与写法
2
+
3
+ 以下路径相对 Arcadia 仓库根目录。适用于当前 base 内容包;用户明确要求独立内容包时,遵循目标包现有测试入口,不把外部包测试塞入主仓库。
4
+
5
+ ## 独立 SDK 包
6
+
7
+ 测试放在包内 `test/*.test.mjs`,使用 Node test runner 和 `prepareContentPack`,跟随模板现有 npm scripts。使用真实依赖闭包,不借主仓库 node_modules 或自写 base 专用加载器。包内构建后执行 check/test/pack;主仓库的 pnpm 命令不适用于独立包。测试与 debug 队伍不进入运行时 tarball。
8
+
9
+ ## 主仓库测试放在哪里
10
+
11
+ | 内容 | 位置与范围 |
12
+ | ------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
13
+ | 精灵技能、印记、特性、纹章及联动 | `packages/battle/test/engine/<group>.test.ts`;名称与内容分组或效果模块对应,例如 `kadundudu.test.ts` |
14
+ | 同一进化链的幼体与进化形态 | 扩充同一个分组测试文件,不逐形态另建目录或重复整套测试 |
15
+ | 已有共享机制的缺陷回归 | 放入负责该机制的既有 测试文件;只有新增通用机制才建立对应机制测试文件 |
16
+ | 多个测试确实共享的稳定辅助函数 | 优先复用当前 `test/engine/` 辅助模块;需要提取时用清晰名称的普通 `.ts` 文件,不命名为 `.test.ts` |
17
+ | 测试所需的最小静态输入 | 沿用 `packages/battle/test/fixtures/`;小型输入优先就地定义,不复制完整内容包或原始资产库 |
18
+ | 考据、下载、费用报告、一次性调试与资源探测 | 实验临时目录或个人缓存,留在仓库外,不交付成正式测试 |
19
+
20
+ 先查是否已有对应分组或机制测试,再决定新增文件。不要为精灵复刻在仓库根、`packs/base/src/`、`bin/__tests__/` 或 `packages/web-ui/` 散放测试。只有本次确实修改了 CLI、加载器或客户端行为时,才修改该模块的测试;单纯增加精灵不构成修改其他模块测试的理由。
21
+
22
+ 新 测试默认直接放在 `test/engine/` 下。当前 Vitest、类型检查和 `lint:battle` 都递归覆盖测试目录。不要为单只精灵新建测试运行器、package script 或独立配置。
23
+
24
+ ## 测试怎么写
25
+
26
+ - 使用 Vitest 和当前 官方内容加载/战斗接口,从真实内容注册入口取得技能与效果。测试不能另写一份效果算法替代待测实现;先查看相近测试与 `base-metadata.ts`,只复用所需部分,避免整份复制大型辅助代码。
27
+ - 用例名称写清条件和结果,例如“有红心时强化两级并消耗一层”。按机制分组,必要时参数化成功/失败、无印记/有印记、首发/后备、不同形态;不要求每只精灵凑固定测试数量。
28
+ - 预期值来自已采用的资料与规则。断言具体伤害、回复、能力等级、印记消耗、持续/换场结果;只断言“造成了伤害”不能证明倍率、概率或副效果正确。
29
+ - 优先通过合法技能选择、回合推进和换场驱动真实行为。联动至少覆盖一条由队友实际技能产生印记的完整流程;局部边界测试可用现有公开战斗 API 准备状态,不能用手工状态注入取代全部联动验证。
30
+ - 固定 RNG seed;概率边界用受控随机输入覆盖触发与不触发,必要时单独覆盖未命中。替换随机函数或 spy 要局限于本测试实例并清理,不修改全局随机数或生产概率来让断言通过。
31
+ - 战斗、监听器、计时器、异步任务和 mock 沿用测试生命周期清理;不要吞掉待断言流程中的异常,也不要用任意 sleep 等待结算,优先等待明确的回合/消息事件。
32
+ - 只对新增或变化的机制补有价值的测试。复用效果、纯元数据补齐通常用既有验证及代表场景即可,不为每个 YAML 字段机械复制断言。禁止固定全包内容总数、源码文本匹配或为追随实现而改预期掩盖错误。
33
+ - 测试夹具必须符合实际接口合同。涉及 npm 工作区时,package.json、锁文件根记录与安装依赖元数据应一致;不要以简化夹具为由放宽生产校验。
34
+
35
+ ## 验证与交付
36
+
37
+ 从仓库根目录运行,分组名替换为实际文件名:
38
+
39
+ ```sh
40
+ pnpm --filter @arcadia-eternity/data-pack-base build
41
+ pnpm test:battle <group>.test.ts
42
+ pnpm typecheck:battle
43
+ pnpm lint:battle
44
+ ```
45
+
46
+ 改动共享效果或引擎行为时再运行相关回归或完整 套件。依赖声明过期按 AGENTS.md 刷新构建后重查。默认不运行 Web UI、浏览器或 Playwright;需要时由用户明确指定。
47
+
48
+ 根 lint 和提交钩子可能忽略 测试文件,不能据其成功宣称专用 lint 通过。交付前确认新增测试被现有配置收集,报告实际执行的文件、命令、通过/失败/跳过与未测项;临时日志、截图、调试脚本和整套实验副本不进入提交。
49
+
50
+ 报告严格区分数据断言、直接触发某钩子和完整战斗场景。没有强制 MISS 用例时,不声称已实测未命中边界;免疫状态和属性免疫分别验证,添加印记尝试不等于成功。