Files
YGChatCS/docs/superpowers/plans/2026-09-22-yangmadao-aigc.md
T

5.2 KiB

Yangmadao AIGC Migration Implementation Plan

For agentic workers: Use subagent-driven-development for the isolated AIGC subtree and requesting-code-review for final review. Keep all mutations outside that subtree with the root agent.

Goal: 将 duohua-new 的完整 AIGC 迁入养马岛独立客户端,接入旅行记录入口及 Tailwind,客户端配置不变。 Architecture: 通过 Git 指定来源提交迁移 AIGC,复用目标认证和请求;受控隐私、导航封装在分包中,Tailwind 使用 tw: 前缀隔离旧工具类。 Tech Stack: Existing uni-app/Vue 3/Vite 5, Tailwind CSS 4, weapp-tailwindcss, Yarn 1, node:test.

Task 1: Baseline and immutable client configuration

  • Read both branch versions and compare package versions and component contracts.
  • Run node --test scripts/update-appid.test.cjs (5 passing).
  • Confirm target branch clean and record source/target commit hashes in design.

Task 2: AIGC subtree

  • Copy every tracked file below src/pages-aigc/ from source commit using git show <source>:<path> and preserve UTF-8.
  • Copy source src/components/Privacy/ to src/pages-aigc/components/Privacy/; copy source src/components/TopNavBar/ to src/pages-aigc/components/TopNavBar/; update only AIGC imports.
  • Convert existing Tailwind template utilities in transferred files to complete tw: prefixed classes, adding explicit box sizing where preflight was relied upon. Preserve component-specific CSS selectors and state classes.
  • Adapt recharge footer $theme-color-600 to $theme-color-500; leave src/uni.scss unchanged.
  • Keep task creation, polling, payment recovery, sharing and image upload behavior from source.

Task 3: Integration and build pipeline

  • Add nine source AIGC page registrations to target src/pages.json without altering existing routes.
  • Add travelAIGC: "Command.travelAIGC" to target src/model/ChatModel.js; change first quick access title/type and login-gated destination.
  • Transfer source GeneratorPhotoComponent Vue and styles, prefix Tailwind classes; retain ChatMainList's existing generator render branch.
  • Add source Tailwind dependencies and postinstall to package.json, retain target scripts. Update Yarn lock consistently, do not regenerate package-lock.json.
  • Add src/app.css with theme and utilities imports using prefix(tw), omit global preflight, scan only application source, import from main.js.
  • Add PostCSS Tailwind and UnifiedViteWeappTailwindcssPlugin in vite.config.js; set cssEntries, rem2rpx and disable injected global cssPreflight; retain original assetFileNames.
  • Add sensitive request logging support without changing base URL, token selection or clientId; import existing removeAccessToken function used on 424.

Task 4: Behavior checks and review

  • Before integration code changes, add node:test execution tests for quick access entry, generator data variants and request confidentiality; run to see intended failures.
  • Run node --test scripts/update-appid.test.cjs scripts/aigc-migration.test.cjs after edits.
  • Run yarn build:mp-weixin, inspect all AIGC routes and generated prefixed utility selectors, check no unprefixed Tailwind spacing and global reset override legacy SCSS.
  • Run development compile once if production class conversion requires comparison.
  • Run git diff --check and compare protected client files with target baseline.
  • Request independent review while root performs final build/artifact inspection; resolve findings and rerun affected checks.
  • Leave completed changes on yangmadao-zhinian-8 for user inspection; report actual validation and external integration limits.

Completion evidence

  • Completed in the existing clean yangmadao-zhinian-8 checkout after the user switched branches; no additional worktree was created and no changes were made to duohua-new.
  • Added 87 AIGC files (83 original plus isolated Privacy/TopNavBar components).
  • Review identified target router lacked internal path support. Added source-equivalent HTTP(S)/internal routing and a real router regression test.
  • Fixed inherited share initial null rendering and waited for the target's existing getEvnUrl() before requesting the shared work. Environment configuration files and addresses remain unchanged.
  • Fixed navbar deep selectors after class prefixing using a stable semantic class.
  • node --test scripts/update-appid.test.cjs scripts/aigc-migration.test.cjs: 14 passed.
  • yarn build:mp-weixin: passed; complete output for all nine AIGC pages verified.
  • yarn dev:mp-weixin: initial compilation passed; watcher stopped after verification.
  • Generated CSS verified: legacy .m-4 remains 4px and .w-50 remains 50%; tw: utilities are escaped correctly; no global box-sizing reset was introduced.
  • git diff --check: passed. New source files also pass UTF-8/LF/trailing whitespace checks.
  • Protected client files are byte-identical to target baseline. No versions changed for pre-existing ranges retained in yarn.lock; package-lock.json is untouched.
  • Final independent review found no remaining blocking issues.
  • Changes are uncommitted on the requested target branch. Actual generation, WeChat authorization, sharing and payment still need target-client device/backend testing.