generator-mico-cli 0.2.31 → 0.2.32

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 (162) hide show
  1. package/README.md +145 -18
  2. package/bin/mico.js +76 -0
  3. package/generators/h5-react/ignore-list.json +1 -0
  4. package/generators/h5-react/index.js +349 -0
  5. package/generators/h5-react/meta.json +11 -0
  6. package/generators/h5-react/templates/.commitlintrc.js +7 -0
  7. package/generators/h5-react/templates/.cursor/rules/cicd-deploy.mdc +104 -0
  8. package/generators/h5-react/templates/.cursor/rules/common-intl.mdc +42 -0
  9. package/generators/h5-react/templates/.cursor/rules/git-hooks.mdc +40 -0
  10. package/generators/h5-react/templates/.cursor/rules/internal-packages.mdc +46 -0
  11. package/generators/h5-react/templates/.cursor/rules/monorepo.mdc +64 -0
  12. package/generators/h5-react/templates/.cursor/rules/package-json.mdc +52 -0
  13. package/generators/h5-react/templates/.cursor/rules/tailwind-umi.mdc +60 -0
  14. package/generators/h5-react/templates/.cursor/rules/umi-app.mdc +74 -0
  15. package/generators/h5-react/templates/.cursor/rules/umi-config.mdc +86 -0
  16. package/generators/h5-react/templates/.cursor/rules/umi-mock.mdc +80 -0
  17. package/generators/h5-react/templates/.cursor/rules/workspace-request.mdc +52 -0
  18. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/SKILL.md +213 -0
  19. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/evals/evals.json +23 -0
  20. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/cursor-rule-template.md +60 -0
  21. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-1-scanning.md +102 -0
  22. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-2-context-analysis.md +102 -0
  23. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-3-pattern-extraction.md +105 -0
  24. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-4-module-mapping.md +65 -0
  25. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-5-glossary.md +63 -0
  26. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/DEV_PATTERNS.tpl.md +77 -0
  27. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/GLOSSARY.tpl.md +17 -0
  28. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/MODULE_MAP.tpl.md +45 -0
  29. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/PROJECT_CONTEXT.tpl.md +155 -0
  30. package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/update-mode.md +116 -0
  31. package/generators/h5-react/templates/.env.development +5 -0
  32. package/generators/h5-react/templates/.env.production +5 -0
  33. package/generators/h5-react/templates/.env.testing +5 -0
  34. package/generators/h5-react/templates/.husky/commit-msg +2 -0
  35. package/generators/h5-react/templates/.husky/pre-commit +2 -0
  36. package/generators/h5-react/templates/.lintstagedrc.js +8 -0
  37. package/generators/h5-react/templates/.prettierrc.json +7 -0
  38. package/generators/h5-react/templates/CICD/before_build.sh +76 -0
  39. package/generators/h5-react/templates/CICD/start_dev.sh +54 -0
  40. package/generators/h5-react/templates/CICD/start_local.sh +30 -0
  41. package/generators/h5-react/templates/CICD/start_prod.sh +53 -0
  42. package/generators/h5-react/templates/CICD/start_test.sh +55 -0
  43. package/generators/h5-react/templates/CICD/wangsu_fresh_dev.sh +19 -0
  44. package/generators/h5-react/templates/CICD/wangsu_fresh_prod.sh +19 -0
  45. package/generators/h5-react/templates/CICD/wangsu_fresh_test.sh +19 -0
  46. package/generators/h5-react/templates/README.md +301 -0
  47. package/generators/h5-react/templates/_gitignore +30 -0
  48. package/generators/h5-react/templates/_npmrc +6 -0
  49. package/generators/h5-react/templates/apps/.gitkeep +0 -0
  50. package/generators/h5-react/templates/dev.preset.json +10 -0
  51. package/generators/h5-react/templates/package.json +56 -0
  52. package/generators/h5-react/templates/packages/common-intl/README.md +180 -0
  53. package/generators/h5-react/templates/packages/common-intl/eslint.config.ts +12 -0
  54. package/generators/h5-react/templates/packages/common-intl/package.json +31 -0
  55. package/generators/h5-react/templates/packages/common-intl/src/index.ts +3 -0
  56. package/generators/h5-react/templates/packages/common-intl/src/intl.ts +100 -0
  57. package/generators/h5-react/templates/packages/common-intl/tsconfig.json +3 -0
  58. package/generators/h5-react/templates/packages/components/eslint.config.ts +12 -0
  59. package/generators/h5-react/templates/packages/components/package.json +32 -0
  60. package/generators/h5-react/templates/packages/components/src/Layout/ImmersiveHeader.tsx +126 -0
  61. package/generators/h5-react/templates/packages/components/src/Layout/LayoutFooter.tsx +72 -0
  62. package/generators/h5-react/templates/packages/components/src/Layout/index.tsx +121 -0
  63. package/generators/h5-react/templates/packages/components/src/assets/image/back.png +0 -0
  64. package/generators/h5-react/templates/packages/components/src/index.ts +0 -0
  65. package/generators/h5-react/templates/packages/components/tsconfig.json +13 -0
  66. package/generators/h5-react/templates/packages/components/typings.d.ts +1 -0
  67. package/generators/h5-react/templates/packages/constant/eslint.config.ts +12 -0
  68. package/generators/h5-react/templates/packages/constant/package.json +19 -0
  69. package/generators/h5-react/templates/packages/constant/src/index.ts +0 -0
  70. package/generators/h5-react/templates/packages/constant/src/member.ts +8 -0
  71. package/generators/h5-react/templates/packages/constant/tsconfig.json +3 -0
  72. package/generators/h5-react/templates/packages/deeplink/eslint.config.ts +12 -0
  73. package/generators/h5-react/templates/packages/deeplink/package.json +18 -0
  74. package/generators/h5-react/templates/packages/deeplink/src/index.ts +7 -0
  75. package/generators/h5-react/templates/packages/deeplink/tsconfig.json +3 -0
  76. package/generators/h5-react/templates/packages/domain/eslint.config.ts +12 -0
  77. package/generators/h5-react/templates/packages/domain/package.json +18 -0
  78. package/generators/h5-react/templates/packages/domain/src/index.ts +29 -0
  79. package/generators/h5-react/templates/packages/domain/tsconfig.json +3 -0
  80. package/generators/h5-react/templates/packages/domain/types.d.ts +11 -0
  81. package/generators/h5-react/templates/packages/eslint/eslint.config.base.ts +36 -0
  82. package/generators/h5-react/templates/packages/eslint/eslint.config.react.ts +33 -0
  83. package/generators/h5-react/templates/packages/eslint/package.json +22 -0
  84. package/generators/h5-react/templates/packages/js-bridge/eslint.config.ts +17 -0
  85. package/generators/h5-react/templates/packages/js-bridge/package.json +23 -0
  86. package/generators/h5-react/templates/packages/js-bridge/src/call.ts +126 -0
  87. package/generators/h5-react/templates/packages/js-bridge/src/closeH5Page.ts +9 -0
  88. package/generators/h5-react/templates/packages/js-bridge/src/getUserInfo.ts +96 -0
  89. package/generators/h5-react/templates/packages/js-bridge/src/index.ts +15 -0
  90. package/generators/h5-react/templates/packages/js-bridge/tsconfig.json +3 -0
  91. package/generators/h5-react/templates/packages/js-bridge/type.d.ts +24 -0
  92. package/generators/h5-react/templates/packages/request/axios.d.ts +42 -0
  93. package/generators/h5-react/templates/packages/request/eslint.config.ts +17 -0
  94. package/generators/h5-react/templates/packages/request/package.json +22 -0
  95. package/generators/h5-react/templates/packages/request/src/index.ts +165 -0
  96. package/generators/h5-react/templates/packages/request/src/interceptors.ts +126 -0
  97. package/generators/h5-react/templates/packages/request/src/types.ts +101 -0
  98. package/generators/h5-react/templates/packages/request/src/url-resolver.ts +66 -0
  99. package/generators/h5-react/templates/packages/request/src/utils.ts +12 -0
  100. package/generators/h5-react/templates/packages/request/tsconfig.json +3 -0
  101. package/generators/h5-react/templates/packages/request/umi.d.ts +94 -0
  102. package/generators/h5-react/templates/packages/typescript/package.json +11 -0
  103. package/generators/h5-react/templates/packages/typescript/tsconfig.base.json +23 -0
  104. package/generators/h5-react/templates/packages/typescript/tsconfig.react.json +7 -0
  105. package/generators/h5-react/templates/packages/umi-config/eslint.config.ts +12 -0
  106. package/generators/h5-react/templates/packages/umi-config/package.json +31 -0
  107. package/generators/h5-react/templates/packages/umi-config/src/config.dev.ts +34 -0
  108. package/generators/h5-react/templates/packages/umi-config/src/config.prod.development.ts +17 -0
  109. package/generators/h5-react/templates/packages/umi-config/src/config.prod.production.ts +42 -0
  110. package/generators/h5-react/templates/packages/umi-config/src/config.prod.testing.ts +17 -0
  111. package/generators/h5-react/templates/packages/umi-config/src/config.prod.ts +56 -0
  112. package/generators/h5-react/templates/packages/umi-config/src/config.ts +86 -0
  113. package/generators/h5-react/templates/packages/umi-config/src/index.ts +25 -0
  114. package/generators/h5-react/templates/packages/umi-config/src/plugins/apply-sentry-plugin.ts +57 -0
  115. package/generators/h5-react/templates/packages/umi-config/src/type.d.ts +3 -0
  116. package/generators/h5-react/templates/packages/umi-config/tsconfig.json +3 -0
  117. package/generators/h5-react/templates/packages/utils/eslint.config.ts +12 -0
  118. package/generators/h5-react/templates/packages/utils/package.json +27 -0
  119. package/generators/h5-react/templates/packages/utils/src/date.ts +21 -0
  120. package/generators/h5-react/templates/packages/utils/src/env.ts +40 -0
  121. package/generators/h5-react/templates/packages/utils/src/index.ts +3 -0
  122. package/generators/h5-react/templates/packages/utils/src/md5.ts +17 -0
  123. package/generators/h5-react/templates/packages/utils/src/mock.ts +83 -0
  124. package/generators/h5-react/templates/packages/utils/src/number.ts +23 -0
  125. package/generators/h5-react/templates/packages/utils/src/tailwind.ts +12 -0
  126. package/generators/h5-react/templates/packages/utils/src/url.ts +19 -0
  127. package/generators/h5-react/templates/packages/utils/tsconfig.json +9 -0
  128. package/generators/h5-react/templates/page.config.ts +1 -0
  129. package/generators/h5-react/templates/pnpm-workspace.yaml +17 -0
  130. package/generators/h5-react/templates/scripts/collect-dist.js +78 -0
  131. package/generators/h5-react/templates/scripts/dev-preset.js +265 -0
  132. package/generators/h5-react/templates/scripts/dev-preset.schema.json +39 -0
  133. package/generators/h5-react/templates/scripts/dev.js +133 -0
  134. package/generators/h5-react/templates/scripts/gateway.ts +241 -0
  135. package/generators/h5-react/templates/turbo.json +86 -0
  136. package/generators/subapp-h5/ignore-list.json +1 -0
  137. package/generators/subapp-h5/index.js +424 -0
  138. package/generators/subapp-h5/meta.json +10 -0
  139. package/generators/subapp-h5/templates/.env +1 -0
  140. package/generators/subapp-h5/templates/.stylelintrc.js +22 -0
  141. package/generators/subapp-h5/templates/config/config.dev.ts +7 -0
  142. package/generators/subapp-h5/templates/config/config.prod.development.ts +7 -0
  143. package/generators/subapp-h5/templates/config/config.prod.production.ts +10 -0
  144. package/generators/subapp-h5/templates/config/config.prod.testing.ts +7 -0
  145. package/generators/subapp-h5/templates/config/config.prod.ts +7 -0
  146. package/generators/subapp-h5/templates/config/config.ts +6 -0
  147. package/generators/subapp-h5/templates/config/routes.ts +13 -0
  148. package/generators/subapp-h5/templates/eslint.config.ts +12 -0
  149. package/generators/subapp-h5/templates/mock/user.ts +34 -0
  150. package/generators/subapp-h5/templates/package.json +42 -0
  151. package/generators/subapp-h5/templates/src/app.tsx +14 -0
  152. package/generators/subapp-h5/templates/src/assets/yay.jpg +0 -0
  153. package/generators/subapp-h5/templates/src/intl.ts +37 -0
  154. package/generators/subapp-h5/templates/src/layouts/index.tsx +10 -0
  155. package/generators/subapp-h5/templates/src/pages/index.tsx +22 -0
  156. package/generators/subapp-h5/templates/src/services/user.ts +38 -0
  157. package/generators/subapp-h5/templates/tailwind.config.js +16 -0
  158. package/generators/subapp-h5/templates/tailwind.css +7 -0
  159. package/generators/subapp-h5/templates/tsconfig.json +3 -0
  160. package/generators/subapp-h5/templates/typings.d.ts +1 -0
  161. package/lib/setup-multica-desktop.js +154 -0
  162. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ # Phase 4: Module Mapping
2
+
3
+ The goal of this phase is to build a lookup index — when an AI needs to work on a specific page or module, it can check this index to immediately see what routes, APIs, stores, and components are involved.
4
+
5
+ ## Strategy: Breadth Over Depth
6
+
7
+ Unlike Phase 3 which reads a few pages deeply, this phase scans many pages shallowly. For each page, you only need to extract its dependency fingerprint — not understand its business logic.
8
+
9
+ ## How to Scan Efficiently
10
+
11
+ For each page file in the views/pages directory:
12
+
13
+ 1. **Read the `<script>` or `<script setup>` section only.** Skip the template and style — they don't contain dependency information that isn't already visible in the script.
14
+
15
+ 2. **Read import statements.** These reveal component, store, hook, and utility dependencies.
16
+
17
+ 3. **Scan for API calls.** Look for HTTP function invocations (axios calls, fetch calls, project-specific request helpers). Extract the URL/endpoint being called.
18
+
19
+ 4. **Check the route configuration.** Cross-reference with the route files from Phase 2 to find this page's route path.
20
+
21
+ 5. **Note any page-specific sub-components.** If the page directory contains additional `.vue`/`.tsx` files beyond the main page, note them as "local components" — they indicate the page is complex enough to warrant splitting.
22
+
23
+ ## What to Record Per Page
24
+
25
+ For each page, capture:
26
+
27
+ - **Route path:** The URL path this page responds to
28
+ - **APIs:** The endpoint URLs or function calls the page makes
29
+ - **Stores:** Which stores the page imports and uses
30
+ - **Shared components:** Which project-level shared components are imported
31
+ - **Local components:** Any sub-components defined alongside this page
32
+ - **Hooks/composables:** Which shared hooks the page uses
33
+
34
+ Keep the format compact. This is a reference index, not documentation.
35
+
36
+ ## Grouping
37
+
38
+ Organize pages by **business module** — the top-level directory within views/pages. Each module gets its own section. Within a module, list pages in a logical order (typically matching the route/menu order, or alphabetically if no clear order exists).
39
+
40
+ For each module, add a one-line summary of what business domain it covers, drawn from your Phase 2 and Phase 3 analysis.
41
+
42
+ ## Handling Scale
43
+
44
+ For small projects (under 30 pages), map every page.
45
+
46
+ For medium projects (30-80 pages), map every page but allow brief entries for simple pages (just route + API + key components).
47
+
48
+ For large projects (80+ pages), map all modules but within each module, focus on the 3-5 most important pages. Add a note like "This module contains 12 additional pages following the standard CRUD pattern" to cover the rest.
49
+
50
+ ## Cross-Referencing
51
+
52
+ This document becomes significantly more useful when it connects to the other documents:
53
+
54
+ - When a page follows a pattern from `DEV_PATTERNS.md`, note it: "Follows Pattern A: CRUD Management"
55
+ - When a page uses a shared component in a non-obvious way, reference the component's documentation in `PROJECT_CONTEXT.md`
56
+ - When a page involves domain terms, use the terms defined in `GLOSSARY.md`
57
+
58
+ ## Phase 4 Output
59
+
60
+ Fill in the `MODULE_MAP.md` template with:
61
+
62
+ - One section per business module
63
+ - Each section has a one-line module description
64
+ - Each page within the module has its dependency fingerprint (route, APIs, stores, components, hooks)
65
+ - Pattern references where applicable
@@ -0,0 +1,63 @@
1
+ # Phase 5: Glossary Generation
2
+
3
+ The goal of this phase is to extract and define the vocabulary that is specific to this project. Without this glossary, an AI encountering the term "guild" in a route path has no way to know it means "a group of livestream hosts organized under a manager" rather than its common English meaning.
4
+
5
+ ## What Belongs in the Glossary
6
+
7
+ Include terms that meet **at least one** of these criteria:
8
+
9
+ 1. **Business domain terms** that a newcomer would not understand. These come from the industry or product domain — terms like "anchor" (meaning livestream host), "deco" (meaning virtual decoration), "settlement" (meaning payment processing for hosts).
10
+
11
+ 2. **Project-specific technical terms** that differ from their common meaning or are unique to this codebase. Examples: a function named `pruneVnode` that controls UI permission filtering, a parameter called `readParam` that drives auto-fetching in CustomTable, an API prefix like `proxy/maidocha_svr/` that routes through a backend gateway.
12
+
13
+ 3. **Abbreviations and acronyms** used in the codebase. `bizId`, `oid`, `opTypes` — these are meaningless without expansion.
14
+
15
+ 4. **PRD-to-code mappings** where the product team uses different vocabulary than the code. If PRDs say "streamer" but the code says "anchor", both terms need to be in the glossary with a cross-reference.
16
+
17
+ ## What Does NOT Belong
18
+
19
+ Exclude terms that are:
20
+
21
+ - **General programming concepts**: "component", "store", "router", "hook" — unless the project uses these words with a non-standard meaning
22
+ - **Framework-standard vocabulary**: "defineProps", "reactive", "middleware" — unless the project has a custom implementation that changes expected behavior
23
+ - **Self-explanatory names**: `userList`, `isLoading`, `handleSubmit` — these don't need definitions
24
+
25
+ ## Where to Find Terms
26
+
27
+ Draw from all previous phases:
28
+
29
+ - **Phase 1**: Directory names, dependency names, environment variable names
30
+ - **Phase 2**: Store names and their data fields, API path segments, component names, permission-related terms
31
+ - **Phase 3**: Pattern names, business module names discovered during page sampling
32
+ - **Phase 4**: Route path segments, API endpoint segments, business module descriptions
33
+
34
+ Also scan for:
35
+ - **Enum files**: These often contain domain vocabulary (status names, type names, category names)
36
+ - **Constant files**: Named constants often encode domain concepts
37
+ - **i18n files**: Translation keys and values reveal how the product talks about its features
38
+
39
+ ## Structure
40
+
41
+ Organize the glossary into two sections:
42
+
43
+ ### Business Terms
44
+
45
+ These are terms from the product/business domain. For each term:
46
+ - The term as it appears in code (e.g., `guild`)
47
+ - Its meaning in the product context (e.g., "An organization of livestream hosts managed by a guild leader")
48
+ - Alternative names if the PRD or users call it differently (e.g., "Also called 'agency' in some PRDs")
49
+
50
+ ### Technical Terms
51
+
52
+ These are codebase-specific technical terms. For each term:
53
+ - The term (e.g., `readParam`)
54
+ - What it means/does (e.g., "The reactive parameter object that drives CustomTable's auto-fetch behavior. When any field in readParam changes, CustomTable re-fetches data from readURL.")
55
+ - Where it's used (e.g., "Seen in every CRUD list page")
56
+
57
+ ## Quality Check
58
+
59
+ A good glossary passes this test: take any term from it, imagine an AI encountering that term in the codebase for the first time, and ask — would the definition give enough context to use it correctly? If not, the definition needs more specificity.
60
+
61
+ ## Phase 5 Output
62
+
63
+ Fill in the `GLOSSARY.md` template with the two sections above. Aim for 15-40 terms for a typical project — enough to cover the non-obvious vocabulary without becoming an exhaustive dictionary.
@@ -0,0 +1,77 @@
1
+ # {Project Name} — Development Patterns
2
+
3
+ <!-- This document bridges understanding and action. An AI reading a PRD should be able to match the requirement to a pattern here and know exactly what to do. -->
4
+
5
+ ## New Page Checklist
6
+
7
+ Every new page in this project requires the following steps, regardless of the page type:
8
+
9
+ <!-- List all side-effects. Adapt this list based on what Phase 3 analysis discovers. -->
10
+
11
+ 1. **Create the page file:** {Where, naming convention}
12
+ 2. **Register the route:** {Which file, what fields are required}
13
+ 3. **Add i18n entries:** {Which language files, key naming convention}
14
+ 4. **Configure permissions:** {If applicable — where and how}
15
+ 5. **Add menu entry:** {If menu is separate from routes — where and how}
16
+ 6. {Any other project-specific setup steps}
17
+
18
+ ---
19
+
20
+ ## Pattern A: {Pattern Name}
21
+
22
+ <!-- Most common pattern first. -->
23
+
24
+ **When to use:** {PRD keywords or requirement characteristics that signal this pattern. Write in terms of product language, not code language.}
25
+
26
+ **File structure:**
27
+ ```
28
+ {directory}/{FeatureName}/
29
+ ├── {main file}
30
+ └── {sub-components if applicable}
31
+ ```
32
+
33
+ **Standard structure:**
34
+
35
+ <!-- Describe the page's component composition and data flow in narrative form. Don't write code — describe the architecture. -->
36
+
37
+ {Description of the page skeleton — what components form the layout, how they're connected, what drives data fetching, how user actions flow through the system.}
38
+
39
+ **Data flow:**
40
+
41
+ 1. {Page mount → initial data loading}
42
+ 2. {User interaction → data fetch/mutation}
43
+ 3. {Submit/save → API call → refresh}
44
+
45
+ **Reference page:** `{exact file path of a real page that exemplifies this pattern}`
46
+
47
+ ---
48
+
49
+ ## Pattern B: {Pattern Name}
50
+
51
+ **When to use:** {trigger conditions}
52
+
53
+ **File structure:**
54
+ ```
55
+ {…}
56
+ ```
57
+
58
+ **Standard structure:**
59
+
60
+ {…}
61
+
62
+ **Data flow:**
63
+
64
+ 1. {…}
65
+
66
+ **Reference page:** `{path}`
67
+
68
+ ---
69
+
70
+ <!-- Repeat for each identified pattern. Typical projects have 3-5 patterns. -->
71
+
72
+ ## Variations & Edge Cases
73
+
74
+ <!-- Note any common deviations from the patterns above. -->
75
+
76
+ - {Variation description, e.g., "Some CRUD pages use a drawer instead of a dialog for editing large forms"}
77
+ - {…}
@@ -0,0 +1,17 @@
1
+ # {Project Name} — Glossary
2
+
3
+ <!-- Terms that a newcomer (human or AI) would not immediately understand when encountering them in this codebase. -->
4
+
5
+ ## Business Terms
6
+
7
+ | Term | Meaning | Also Known As |
8
+ |------|---------|---------------|
9
+ | {term} | {definition in the product context} | {alternative names in PRDs or user-facing text, if any} |
10
+ | {…} | {…} | |
11
+
12
+ ## Technical Terms
13
+
14
+ | Term | Meaning | Where Used |
15
+ |------|---------|-----------|
16
+ | {term} | {what it means/does in this codebase} | {where you'll encounter it — e.g., "CRUD list pages", "route guards"} |
17
+ | {…} | {…} | |
@@ -0,0 +1,45 @@
1
+ # {Project Name} — Module Map
2
+
3
+ <!-- This is a lookup index. When an AI needs to work on a specific page, it checks here to see the full dependency picture. -->
4
+
5
+ ## {Module Name}
6
+
7
+ {One-line description of what business domain this module covers.}
8
+
9
+ ### {PageName}
10
+
11
+ - **Route:** `{/path/to/page}`
12
+ - **Pattern:** {Pattern name from DEV_PATTERNS.md, if applicable}
13
+ - **APIs:** {List of endpoint URLs or API function calls}
14
+ - **Stores:** {List of stores used}
15
+ - **Components:** {List of shared components imported}
16
+ - **Hooks:** {List of hooks/composables used}
17
+ - **Local sub-components:** {Any page-specific components, or "none"}
18
+
19
+ ### {PageName}
20
+
21
+ - **Route:** `{/path}`
22
+ - **Pattern:** {…}
23
+ - **APIs:** {…}
24
+ - **Stores:** {…}
25
+ - **Components:** {…}
26
+ - **Hooks:** {…}
27
+
28
+ <!-- Repeat for each page in this module -->
29
+
30
+ ---
31
+
32
+ ## {Module Name}
33
+
34
+ {One-line description.}
35
+
36
+ ### {PageName}
37
+
38
+ - **Route:** `{/path}`
39
+ - **Pattern:** {…}
40
+ - **APIs:** {…}
41
+ - **Stores:** {…}
42
+ - **Components:** {…}
43
+ - **Hooks:** {…}
44
+
45
+ <!-- Repeat for each module -->
@@ -0,0 +1,155 @@
1
+ # {Project Name} — Project Context
2
+
3
+ <!-- This is the core knowledge document. An AI reading only this file should understand 80% of what it needs to work effectively in this project. -->
4
+
5
+ ## Project Overview
6
+
7
+ <!-- What the product does, who uses it, and why it exists. Write for someone who has never seen this codebase. -->
8
+
9
+ **Product:** {One-sentence description of what the product is}
10
+
11
+ **Users:** {Who uses this application — internal team? End users? Admins?}
12
+
13
+ **Business domain:** {What industry/domain — e-commerce, social platform, fintech, SaaS, etc.}
14
+
15
+ ## Tech Stack
16
+
17
+ | Layer | Technology | Version |
18
+ |-------|-----------|---------|
19
+ | Framework | {e.g., Vue} | {e.g., 3.5.13} |
20
+ | Language | {e.g., TypeScript} | {e.g., 5.7} |
21
+ | Build tool | {e.g., Vite} | {e.g., 6.x} |
22
+ | UI library | {e.g., Element Plus} | {e.g., 2.8} |
23
+ | State management | {e.g., Pinia} | |
24
+ | Router | {e.g., Vue Router, hash mode} | |
25
+ | HTTP client | {e.g., Axios} | |
26
+ | i18n | {e.g., vue-i18n} | |
27
+ | Other notable | {e.g., Sentry, echarts, etc.} | |
28
+
29
+ ## Environment Configuration
30
+
31
+ | Variable | Purpose |
32
+ |----------|---------|
33
+ | {VITE_API_BASE_URL} | {Main API endpoint} |
34
+ | {…} | {…} |
35
+
36
+ **Dev proxy rules:**
37
+ <!-- List dev server proxy paths and their targets -->
38
+
39
+ ## Directory Structure
40
+
41
+ ```
42
+ src/
43
+ ├── {directory}/ # {role description}
44
+ ├── {directory}/ # {role description}
45
+ └── ...
46
+ ```
47
+
48
+ <!-- Annotate every top-level source directory with its role. -->
49
+
50
+ **Path aliases:**
51
+ - `{@/}` → `{src/}`
52
+ - {…}
53
+
54
+ ## Request Mechanisms
55
+
56
+ <!-- Describe each HTTP request pattern as a flow. Include: base URL strategy, auth injection, success/error handling, when to use this pattern. -->
57
+
58
+ ### {Pattern Name, e.g., "Main Business API"}
59
+
60
+ {Narrative flow description — see Phase 2 instructions for the level of detail expected.}
61
+
62
+ ### {Pattern Name, e.g., "Activity API"}
63
+
64
+ {If there are multiple request patterns, describe each one.}
65
+
66
+ ## Routing & Navigation
67
+
68
+ **Mode:** {hash / history}
69
+
70
+ **Layout structure:** {Describe the page shell — header, sidebar, content area, tabs, etc.}
71
+
72
+ **Route organization:** {How routes are split — one file per module, etc.}
73
+
74
+ **Navigation guard flow:**
75
+ <!-- Describe the guard chain: what checks happen before a page renders -->
76
+
77
+ 1. {First check, e.g., "White-listed routes bypass all checks"}
78
+ 2. {Second check, e.g., "Fetch user info if not loaded"}
79
+ 3. {Third check, e.g., "Verify route is in user's permitted menu list"}
80
+ 4. {Fallback, e.g., "Redirect to 404 if not permitted"}
81
+
82
+ ## State Management
83
+
84
+ <!-- For each store, describe its responsibility, key data, core methods, and how pages consume it. -->
85
+
86
+ ### {Store Name}
87
+
88
+ **Responsibility:** {What domain this store owns}
89
+
90
+ **Key state:**
91
+ - `{field}`: {type and purpose}
92
+ - {…}
93
+
94
+ **Core methods:**
95
+ - `{method}()`: {what it does}
96
+ - {…}
97
+
98
+ **Used by:** {Which modules/pages depend on this store}
99
+
100
+ <!-- Repeat for each store -->
101
+
102
+ ## Auth & Permissions
103
+
104
+ **Authentication:** {How users prove identity — token type, storage location, refresh mechanism}
105
+
106
+ **Route-level control:** {How the system decides if a user can access a page}
107
+
108
+ **In-page control:** {How the system controls actions within a page — button visibility, tab filtering, etc.}
109
+
110
+ **Permission data source:** {Where permission data comes from and its structure}
111
+
112
+ ## Shared Components
113
+
114
+ <!-- For each significant shared component, document its purpose, key interface, collaboration pattern, and gotchas. -->
115
+
116
+ ### {ComponentName}
117
+
118
+ **Purpose:** {When to use this component}
119
+
120
+ **Key Props:**
121
+ - `{prop}` ({type}): {what it controls}
122
+ - {…}
123
+
124
+ **Key Events:**
125
+ - `{event}`: {when it fires, what payload}
126
+ - {…}
127
+
128
+ **Collaboration:** {How this component works with other components, hooks, or APIs}
129
+
130
+ <!-- Repeat for each shared component -->
131
+
132
+ ## Hooks / Composables
133
+
134
+ <!-- For each shared hook, document what problem it solves, its interface, and typical usage. -->
135
+
136
+ ### {hookName}
137
+
138
+ **Solves:** {What repetitive problem this hook eliminates}
139
+
140
+ **Parameters:** {Key parameters and types}
141
+
142
+ **Returns:** {Key return values and types}
143
+
144
+ **Typical usage:** {One-sentence description of how pages use it}
145
+
146
+ <!-- Repeat for each hook -->
147
+
148
+ ## Utility Functions
149
+
150
+ <!-- Brief listing of key utility modules and their most-used functions. Only detail functions that are widely used or have non-obvious behavior. -->
151
+
152
+ ### {utils/fileName}
153
+
154
+ - `{functionName}()`: {what it does}
155
+ - {…}
@@ -0,0 +1,116 @@
1
+ # Update Mode: Incremental Document Refresh
2
+
3
+ Instead of re-analyzing the entire project, compare the current state against the last-known snapshot and update only what changed.
4
+
5
+ ## Step 1: Load the Baseline
6
+
7
+ Read `.ai-docs-meta.json` from the project's `.ai-docs/` directory. This file was written during the last full generation or update. It contains:
8
+
9
+ - `generated_at`: when the documents were last generated
10
+ - `files_snapshot.views_modules`: the list of business modules (top-level dirs under views/)
11
+ - `files_snapshot.pages`: all page file paths
12
+ - `files_snapshot.components`: all shared component entries
13
+ - `files_snapshot.hooks`: all hook/composable files
14
+ - `files_snapshot.stores`: all store files
15
+ - `files_snapshot.critical_files`: key mechanism files with their last-modified timestamps
16
+
17
+ If `.ai-docs-meta.json` doesn't exist, the documents were generated by an older version of this skill. Suggest a full regeneration instead of incremental update.
18
+
19
+ ## Step 2: Scan Current State
20
+
21
+ Collect the same information from the live project:
22
+
23
+ 1. List top-level directories under views/ (or pages/) → current modules
24
+ 2. List all `.vue`/`.tsx`/`.jsx` files under views/ → current pages
25
+ 3. List entries under components/ → current components
26
+ 4. List files under hooks/ (or composables/) → current hooks
27
+ 5. List files under store/ (or stores/) → current stores
28
+ 6. Stat the modification time of each file listed in `critical_files`
29
+
30
+ This step should only use directory listing and file stat operations — no file content reading yet.
31
+
32
+ ## Step 3: Compute the Diff
33
+
34
+ Compare current state against the baseline snapshot:
35
+
36
+ **Module diff:**
37
+ - `added_modules`: directories in current but not in snapshot
38
+ - `removed_modules`: directories in snapshot but not in current
39
+
40
+ **Page diff:**
41
+ - `added_pages`: page files in current but not in snapshot
42
+ - `removed_pages`: page files in snapshot but not in current
43
+
44
+ **Shared capability diff:**
45
+ - `added_components`: new entries in components/
46
+ - `removed_components`: entries missing from components/
47
+ - `added_hooks`: new files in hooks/
48
+ - `removed_hooks`: files missing from hooks/
49
+ - `added_stores`: new files in store/
50
+ - `removed_stores`: files missing from store/
51
+
52
+ **Critical file diff:**
53
+ - `modified_critical_files`: files whose modification time is newer than the snapshot timestamp
54
+
55
+ **Staleness:**
56
+ - `days_since_generation`: days between now and `generated_at`
57
+
58
+ ## Step 4: Determine Response Tier
59
+
60
+ Apply these rules in order:
61
+
62
+ ### Tier 3: Full Regeneration Recommended
63
+
64
+ Trigger if **any** of these are true:
65
+ - `added_modules` is non-empty (a whole new business domain appeared)
66
+ - `modified_critical_files` is non-empty (architecture-level code changed)
67
+ - `days_since_generation` exceeds 30
68
+ - `package.json` modification time is newer than snapshot (dependencies may have changed)
69
+
70
+ **Action:** Inform the user what changed and recommend running the full analysis. Example:
71
+
72
+ > "Detected changes since the last analysis: new module 'liveRoom' added, router/index.ts modified, and it's been 45 days since generation. These changes likely affect architecture documentation. I recommend running a full project analysis to regenerate the knowledge base."
73
+
74
+ If the user agrees, run the full five-phase flow from the main SKILL.md. If the user declines, proceed with Tier 2/1 updates for the non-critical changes, but add a warning note at the top of each updated document that architectural sections may be outdated.
75
+
76
+ ### Tier 2: Targeted Update
77
+
78
+ Trigger if `added_components`, `added_hooks`, or `added_stores` are non-empty (and Tier 3 was not triggered).
79
+
80
+ **Action for each new component/hook/store:**
81
+ 1. Read the file content
82
+ 2. Analyze its purpose, interface, and collaboration patterns (same approach as Phase 2, Mechanism E)
83
+ 3. Append a new entry to the corresponding section in `PROJECT_CONTEXT.md`
84
+
85
+ **Action for removed components/hooks/stores:**
86
+ 1. Remove the corresponding entry from `PROJECT_CONTEXT.md`
87
+ 2. Check if any pattern in `DEV_PATTERNS.md` references the removed item — if so, flag it for the user
88
+
89
+ After updates, show the user what was added/removed and ask for confirmation.
90
+
91
+ ### Tier 1: Auto-fixable
92
+
93
+ Trigger if `added_pages` or `removed_pages` are non-empty (and neither Tier 3 nor Tier 2 was triggered, or as an additional step alongside Tier 2).
94
+
95
+ **Action for each new page:**
96
+ 1. Read the `<script>` / `<script setup>` section of the page file
97
+ 2. Extract its dependency fingerprint: route path (from router config), API calls, store imports, component imports, hook usage
98
+ 3. Determine which module it belongs to based on its directory
99
+ 4. Append an entry to the corresponding module section in `MODULE_MAP.md`
100
+ 5. If the page follows a recognized pattern from `DEV_PATTERNS.md`, note the pattern reference
101
+
102
+ **Action for each removed page:**
103
+ 1. Remove its entry from `MODULE_MAP.md`
104
+ 2. Check if it was the reference page for any pattern in `DEV_PATTERNS.md` — if so, suggest a replacement reference page from the same module
105
+
106
+ ## Step 5: Update the Meta File
107
+
108
+ After all updates are complete, rewrite `.ai-docs-meta.json` with the current project state. This becomes the new baseline for the next update cycle.
109
+
110
+ ## Edge Cases
111
+
112
+ **Multiple changes across tiers:** If the diff contains both Tier 1 and Tier 2 changes, process Tier 2 first (since it updates `PROJECT_CONTEXT.md` which provides context), then Tier 1 (which updates `MODULE_MAP.md`).
113
+
114
+ **Renamed files:** A file appearing in both `removed` and `added` with similar names is likely a rename, not a delete+create. Note this to the user but process it as a removal and addition — the content may have changed along with the name.
115
+
116
+ **Large batch of new pages:** If more than 10 pages were added since the last snapshot, it may be more efficient to re-run Phase 4 (Module Mapping) entirely rather than adding pages one by one.
@@ -0,0 +1,5 @@
1
+ CHECK_TIMEOUT=10
2
+ UMI_APP_API_BASE_URL=/api
3
+ UMI_APP_CDN_BASE_URL=//cdn.micoplatform.com
4
+ UMI_APP_LANG_BASE_URL=https://api-test.micoplatform.com/lang_server/pull
5
+ UMI_APP_ENV=development
@@ -0,0 +1,5 @@
1
+ CHECK_TIMEOUT=10
2
+ UMI_APP_API_BASE_URL=https://api.micoplatform.com
3
+ UMI_APP_CDN_BASE_URL=//cdn.micoplatform.com
4
+ UMI_APP_LANG_BASE_URL=https://api.micoplatform.com/lang_server/pull
5
+ UMI_APP_ENV=production
@@ -0,0 +1,5 @@
1
+ CHECK_TIMEOUT=10
2
+ UMI_APP_API_BASE_URL=https://api-test.micoplatform.com
3
+ UMI_APP_CDN_BASE_URL=//cdn.micoplatform.com
4
+ UMI_APP_LANG_BASE_URL=https://api-test.micoplatform.com/lang_server/pull
5
+ UMI_APP_ENV=testing
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ pnpm exec commitlint --edit "$1"
@@ -0,0 +1,2 @@
1
+ pnpm run lint-staged
2
+ git add .
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import('lint-staged').Configuration}
3
+ */
4
+ module.exports = {
5
+ 'apps/*/**/*.{js,jsx,ts,tsx}': 'eslint --flag v10_config_lookup_from_file --fix',
6
+ 'apps/*/**/*.{css,less}': 'stylelint --fix',
7
+ 'packages/!(eslint)/**/*.{js,jsx,ts,tsx}': 'eslint --flag v10_config_lookup_from_file --fix',
8
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "printWidth": 80,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "proseWrap": "never",
6
+ "plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
7
+ }
@@ -0,0 +1,76 @@
1
+ #!/bin/bash
2
+
3
+ # 计算当前构建分支的 BASE_REF,并为 Turbo 增量构建准备 TURBO_FILTER
4
+ # 该脚本会被其他脚本 source 调用,不要在这里直接 exit 1
5
+
6
+ set -e
7
+
8
+ # 获取项目根目录(如果调用方已设置 PROJECT_ROOT,则使用;否则使用当前工作目录)
9
+ PROJECT_ROOT="${PROJECT_ROOT:-$(pwd)}"
10
+
11
+ # 获取当前构建的分支(去掉 origin/ 前缀,用于比较)
12
+ # 优先使用环境变量 CURRENT_BRANCH(Jenkins 传入,格式可能是 origin/main、origin/feat/xxx)
13
+ # 其次使用 BRANCH_OR_TAG,最后从 git 获取
14
+ if [ -n "${CURRENT_BRANCH}" ]; then
15
+ CURRENT_BRANCH_NAME="${CURRENT_BRANCH#origin/}" # 去掉 origin/ 前缀
16
+ elif [ -n "${BRANCH_OR_TAG}" ]; then
17
+ CURRENT_BRANCH_NAME="${BRANCH_OR_TAG#origin/}" # 去掉 origin/ 前缀
18
+ else
19
+ CURRENT_BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
20
+ fi
21
+
22
+ echo "[before_build] Current branch (without origin/): ${CURRENT_BRANCH_NAME}"
23
+
24
+ # 比较当前分支和上次成功构建的分支是否一致
25
+ # LAST_SUCCESS_BRANCH 由 Jenkins 在构建时设置(从上次构建的结果中获取,格式可能是 origin/main、origin/feat/xxx)
26
+ if [ -n "${LAST_SUCCESS_BRANCH}" ]; then
27
+ # 去掉 LAST_SUCCESS_BRANCH 的 origin/ 前缀,用于比较
28
+ LAST_SUCCESS_BRANCH_NAME="${LAST_SUCCESS_BRANCH#origin/}"
29
+ echo "[before_build] Last success branch (without origin/): ${LAST_SUCCESS_BRANCH_NAME}"
30
+
31
+ if [ "${CURRENT_BRANCH_NAME}" != "${LAST_SUCCESS_BRANCH_NAME}" ]; then
32
+ # 分支不一致,需要全量构建
33
+ echo "[before_build] Branch changed: ${LAST_SUCCESS_BRANCH_NAME} -> ${CURRENT_BRANCH_NAME}, will perform full build (no filter)"
34
+ unset TURBO_FILTER
35
+ else
36
+ # 分支一致,尝试使用 PREVIOUS_COMMIT 进行增量构建
37
+ echo "[before_build] Branch unchanged: ${CURRENT_BRANCH_NAME}, checking PREVIOUS_COMMIT for incremental build"
38
+ if [ -n "${PREVIOUS_COMMIT}" ]; then
39
+ # 验证 commit 是否存在且有效
40
+ if git rev-parse --verify "${PREVIOUS_COMMIT}" >/dev/null 2>&1; then
41
+ # 关键检查:验证 PREVIOUS_COMMIT 是否是当前 HEAD 的祖先
42
+ # 这可以避免以下问题:
43
+ # 1. Rebase/Force push:PREVIOUS_COMMIT 不再是当前分支的祖先
44
+ # 2. Tag 被其他分支更新:PREVIOUS_COMMIT 不是当前分支的祖先
45
+ CURRENT_HEAD="$(git rev-parse HEAD)"
46
+ if git merge-base --is-ancestor "${PREVIOUS_COMMIT}" "${CURRENT_HEAD}" 2>/dev/null; then
47
+ # PREVIOUS_COMMIT 是当前 HEAD 的祖先,可以安全使用
48
+ BASE_REF="${PREVIOUS_COMMIT}"
49
+ echo "[before_build] Use PREVIOUS_COMMIT as BASE_REF: ${BASE_REF} (ancestor check passed)"
50
+ # 为 turbo --filter 准备语法形如 ...[<BASE_REF>]
51
+ TURBO_FILTER="...[${BASE_REF}]"
52
+ export TURBO_FILTER
53
+ echo "[before_build] TURBO_FILTER=${TURBO_FILTER} (incremental build)"
54
+ else
55
+ # PREVIOUS_COMMIT 不是当前 HEAD 的祖先,降级为全量构建
56
+ echo "[before_build] Warning: PREVIOUS_COMMIT=${PREVIOUS_COMMIT} is not an ancestor of HEAD=${CURRENT_HEAD}"
57
+ echo "[before_build] Possible reasons: rebase/force-push, tag updated by another branch, or shallow clone issue"
58
+ echo "[before_build] Falling back to full build (no filter)"
59
+ unset TURBO_FILTER
60
+ fi
61
+ else
62
+ echo "[before_build] Warning: PREVIOUS_COMMIT=${PREVIOUS_COMMIT} is not a valid commit, will perform full build"
63
+ unset TURBO_FILTER
64
+ fi
65
+ else
66
+ # PREVIOUS_COMMIT 未设置,进行全量构建
67
+ echo "[before_build] PREVIOUS_COMMIT not set, will perform full build (no filter)"
68
+ unset TURBO_FILTER
69
+ fi
70
+ fi
71
+ else
72
+ # LAST_SUCCESS_BRANCH 未设置,说明是第一次构建或 Jenkins 未配置该环境变量
73
+ echo "[before_build] LAST_SUCCESS_BRANCH not set, will perform full build (no filter)"
74
+ # 不设置 TURBO_FILTER,这样 package.json 中的 ${TURBO_FILTER:+--filter=${TURBO_FILTER}} 不会生效
75
+ unset TURBO_FILTER
76
+ fi