Specialized Script Adaptation
Specialized script adaptation must connect configuration, schema, API, task scheduling, frontend entry points, and runtime verification. The detailed engineering rules for the current project are defined by the Skill built into the main repository at .agents/skills/mas-script-specialized-adapter. This document keeps only the workflow entry points most likely to be missed by developers.
Confirm the Architecture First
Before adding or refactoring a ScriptType, identify which architecture line the external script belongs to:
| Architecture line | Typical shape | Reference in this repository |
|---|---|---|
| MAA line | MAA-style configuration sessions, plans, stage/sanity configuration | MAA |
| SRC line | Alas / SRC-style large forms and sections | SRC |
| MXU line | MaaEnd + MXU, mxu-*.json, ScriptConfig overlay | MaaEnd |
| MFAA line | M9A / MFAA task queue JSON without ScriptConfig wrapper | M9A |
| General | Generic paths, processes, and log monitoring | General |
| ok-script line | -t / -e CLI plus form-based configuration editor | Okww |
Ask the user for the upstream script or GUI wrapper repository URL first. Then determine the architecture line based on README, launch arguments, configuration persistence method, and release artifacts. If no repository is available, confirm the script shape, formal ScriptType, display text, icon source, startup method, and configuration persistence method with the user.
Implementation Order
Specialized adaptation should follow the order "frontend surface first, then backend completion":
Architecture confirmation
- Confirm upstream repository, formal
ScriptType, route segment, user-visible text, and icon. - Confirm whether automatic tasks run through CLI arguments, JSON writes, or an external configuration session.
- Confirm upstream repository, formal
Frontend surface
Scripts.vueandScriptTable.vue: Hub entry, cards, icons, and action buttons.router/index.ts: add a route segment consistent with the Hub.frontend/src/types/script.ts: addScriptTypeand default structure.frontend/src/composables/useScriptApi.ts: complete script type branches andUserConfig -> users[]branch.EditView/Script/,EditView/User/: add or adjust script edit pages, user edit pages, and sections.
Backend registration
app/models/config.py: addXxxConfig/XxxUserConfigand register them to the corresponding configuration collections.app/models/schema.py: complete API schema.app/core/config.py,app/api/scripts.py,app/utils/constants.py: complete configuration, API, display text, and type mapping.- After backend schema changes, start the current local backend and run
yarn openapiinfrontend. Do not manually edit the generatedfrontend/src/apidirectory.
Task module
app/task/Xxx/: implementManagerandAutoProxyaccording to the architecture line, and addconfig_schema.pyorScriptConfig.pywhen needed.Managerand task execution classes must implementfinal_task/on_crash.check()return messages should tell users how to resolve the issue, not just provide technical descriptions.
Verification and cleanup
- If
Generalwas used first to verify startup, logs, and configuration feasibility, remove the temporary entry after specialized adaptation lands. - Before committing, self-check against
.agents/skills/mas-script-specialized-adapter/references/adapter-code-norms.mdin the main repository. - Confirm that Hub, routes, edit pages, API, task scheduling, logs, and history records all work.
- If
Code Quality Baseline
- Do not copy
app/task/generaland globally replace variable names. Align with the closest architecture line and existing surface template. - Configuration writes and restores should use an atomic mindset to avoid corrupting configuration after task interruption.
- Recovery logic shared by
final_taskandon_crashshould be extracted and reused. - Side effects such as process cleanup and file cleanup should catch exceptions separately, preventing one failure from blocking later cleanup.
- Instance attributes should be explicitly initialized with type annotations in
__init__, not patched withhasattr()fallbacks. - Status, logs, process management, and pre/post scripts should align with
Generalfirst. Introduce specialized differences only after the architecture is confirmed.
Further Reading
When an AI assistant performs specialized adaptation, it should load .agents/skills/mas-script-specialized-adapter/SKILL.md from the main repository and read the following as needed:
references/script-frontend-architectures.mdreferences/adapter-code-norms.mdreferences/examples-frontend-surfaces.mdexamples-*.mdfor the corresponding architecture line