@mingfuyun/star-allinone 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -75
- package/examples/AGENTS.md +14 -2
- package/package.json +4 -2
- package/scripts/cli.js +28 -1
- package/scripts/gen/doctor.js +293 -0
- package/scripts/gen/fields.js +118 -0
- package/scripts/gen/fixtures/run.js +75 -10
- package/scripts/gen/fixtures/widgets.openapi.json +2 -1
- package/scripts/gen/page.js +202 -43
- package/skills/README.md +16 -3
- package/skills/shared/design-to-page/SKILL.md +3 -3
- package/skills/shared/design-to-page/references/list-page-template.md +13 -3
- package/skills/shared/design-to-page/references/overlays.md +6 -0
- package/skills/shared/design-to-page/references/page-conventions.md +2 -1
- package/skills/shared/project-conventions/references/architecture.md +5 -2
- package/skills/shared/project-conventions/references/component-contract.md +38 -0
- package/skills/shared/project-conventions/references/mfprotable.md +59 -0
- package/skills/shared/project-conventions/references/quality-checklist.md +14 -0
- package/skills/shared/project-conventions/references/review-checklist.md +2 -2
- package/skills/shared/publish-test/SKILL.md +10 -0
- package/skills/shared/review-and-submit/references/ai-review.md +5 -1
- package/skills/shared/review-and-submit/references/verify.md +2 -0
|
@@ -48,8 +48,8 @@ pnpm exec star-allinone gen page \
|
|
|
48
48
|
Add `--permission-create`, `--permission-edit`, `--permission-delete` when codes are known.
|
|
49
49
|
|
|
50
50
|
2. If only services are missing, run `pnpm exec star-allinone gen service --operation "METHOD /path/"` first. Follow `.agents/skills/shared-api-to-service/SKILL.md`.
|
|
51
|
-
3.
|
|
52
|
-
4. If `src/components/Page/Container/config.tsx` exists,
|
|
51
|
+
3. The CLI fills columns and drawer fields from the OpenAPI schema (required, enum → `ProFormSelect`, dates/numbers). Review labels and permission codes; do not recreate the file tree. See [references/list-page-template.md](references/list-page-template.md).
|
|
52
|
+
4. If `src/components/Page/Container/config.tsx` exists, `gen page` writes a Container `index.tsx`, puts the table in `components/List.tsx`, and registers a Tab. Do not invent a second page shell.
|
|
53
53
|
5. Do not overwrite existing page files. Tell the user the CLI refused, then edit in place.
|
|
54
54
|
|
|
55
55
|
## Design path
|
|
@@ -67,7 +67,7 @@ For non-standard layouts:
|
|
|
67
67
|
## Hard rules
|
|
68
68
|
|
|
69
69
|
- React function components, TypeScript, Ant Design 5, Pro Components, Less.
|
|
70
|
-
- `ProForm` for business forms. `MFProTable`
|
|
70
|
+
- `ProForm` for business forms. `MFProTable` from `@/components/CommonTable/MFProTable` (not from the npm package).
|
|
71
71
|
- Overlays from `@mingfuyun/star-allinone`: `CustomDrawer`, `BaseModal`, `HocModal`.
|
|
72
72
|
- Pages consume `import Service from '@/services'` only.
|
|
73
73
|
- Keep columns and toolbar builders in `const.tsx`. Empty cells render as `-`.
|
|
@@ -13,9 +13,11 @@ src/pages/<Feature>/
|
|
|
13
13
|
└── <Feature>ConfirmModal.tsx
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
When `src/components/Page/Container/config.tsx` exists, `index.tsx` is a Container shell and the table lives in `components/List.tsx`. The CLI also registers a tab for the new route.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## index.tsx / List.tsx
|
|
19
|
+
|
|
20
|
+
- Wrap with `PageContainer` when `src/components/PageContainer` exists and the page is not a Container tab.
|
|
19
21
|
- `fetchData` is a `useCallback` that calls `Service.<listFn>`, maps pagination, and returns `{ code, data: { list, total } }`.
|
|
20
22
|
- Open the drawer with `drawerRef.current?.show({ record })`.
|
|
21
23
|
- Destructive actions go through the confirm modal ref, then `tableRef.current?.reload()`.
|
|
@@ -23,6 +25,7 @@ src/pages/<Feature>/
|
|
|
23
25
|
## const.tsx
|
|
24
26
|
|
|
25
27
|
- Export `columns`, `getActionColumn`, `getToolBarRender`.
|
|
28
|
+
- Columns come from the list item schema: types, enums, and the first string fields as search.
|
|
26
29
|
- Put permission strings on actions and toolbar items when the project uses them.
|
|
27
30
|
- Render empty cells as `'-'`.
|
|
28
31
|
|
|
@@ -30,6 +33,7 @@ src/pages/<Feature>/
|
|
|
30
33
|
|
|
31
34
|
- `CustomDrawer` + `HocModal`.
|
|
32
35
|
- `ProForm` with `submitter={false}` and `layout="horizontal"`.
|
|
36
|
+
- Fields come from the create/update body schema: required rules, `enum` → `ProFormSelect`, numbers → `ProFormDigit`, dates → date pickers.
|
|
33
37
|
- `validateFields()` in `try`. Create vs update from `record`.
|
|
34
38
|
- Reset fields when `visible` becomes true.
|
|
35
39
|
|
|
@@ -41,4 +45,10 @@ src/pages/<Feature>/
|
|
|
41
45
|
|
|
42
46
|
## Container tabs
|
|
43
47
|
|
|
44
|
-
If the project uses `src/components/Page/Container/config.tsx`, the
|
|
48
|
+
If the project uses `src/components/Page/Container/config.tsx`, the CLI:
|
|
49
|
+
|
|
50
|
+
1. Writes `index.tsx` as `import Container from '@/components/Page/Container'`.
|
|
51
|
+
2. Writes the table in `components/List.tsx`.
|
|
52
|
+
3. Registers `'<route>': [{ key, label, children: <List /> }]` in `config.tsx`.
|
|
53
|
+
|
|
54
|
+
Do not duplicate fetch logic inside Container. Do not wrap the List with a second `PageContainer`.
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Use this reference for every modal, confirmation dialog, and drawer. Import `@mingfuyun/star-allinone/dist/styles.css` once from the application entry, not from feature components.
|
|
4
4
|
|
|
5
|
+
Overlays belong to the npm package. Do not add `src/components/CustomDrawer`, `src/components/BaseModal`, or `src/components/HocModal`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { CustomDrawer, BaseModal, HocModal } from '@mingfuyun/star-allinone';
|
|
9
|
+
```
|
|
10
|
+
|
|
5
11
|
## Required components
|
|
6
12
|
|
|
7
13
|
- `CustomDrawer` for create, edit, detail, or configuration drawers.
|
|
@@ -31,7 +31,8 @@ Styles live in the current page directory. Reuse shared mixins such as `@/styles
|
|
|
31
31
|
|
|
32
32
|
## Tables
|
|
33
33
|
|
|
34
|
-
- Prefer `MFProTable` for management lists. Use Ant Design `Table` only for a deliberately simple static shell.
|
|
34
|
+
- Prefer `MFProTable` for management lists. Import it from `@/components/CommonTable/MFProTable`. See [mfprotable.md](../../project-conventions/references/mfprotable.md). Use Ant Design `Table` only for a deliberately simple static shell.
|
|
35
|
+
- Do not import `MFTablePro` or any table from `@mingfuyun/star-allinone`.
|
|
35
36
|
- Extract `fetchData` as an `async` method. Do not inline request logic in JSX props.
|
|
36
37
|
- Wrap `await` in `try-catch` and return a table-safe empty shape on failure.
|
|
37
38
|
- Adapt backend pagination to the table contract. Common backend shapes are `{ results, count }` or `{ list, total }`; the table adapter is typically `{ code, data: { list, total } }`. Follow the nearest page.
|
|
@@ -8,10 +8,11 @@ Apply these rules to every non-trivial frontend change. Shared review, commit, m
|
|
|
8
8
|
- Use React function components and TypeScript.
|
|
9
9
|
- Put transport code in `src/services`. Pages must not call axios or the request helper directly.
|
|
10
10
|
- Keep API DTOs in the domain `typings.d.ts`. Use named types and adapters instead of `any`.
|
|
11
|
-
- Reuse `MFProTable
|
|
11
|
+
- Reuse `MFProTable` from `@/components/CommonTable/MFProTable` (see [component-contract.md](./component-contract.md) and [mfprotable.md](./mfprotable.md)). It is not exported by `@mingfuyun/star-allinone`.
|
|
12
|
+
- Overlays (`CustomDrawer`, `BaseModal`, `HocModal`) and `ErrorBoundary` / `Cron` come from `@mingfuyun/star-allinone`. Do not keep local copies under `src/components`.
|
|
12
13
|
- Use `@/` imports for application modules and keep feature-local imports relative.
|
|
13
14
|
- Do not add a UI/state library or duplicate an existing component without explicit approval.
|
|
14
|
-
- Prefer feature-level code splitting for Excel, editors, charts, drag-and-drop, and other heavy modules.
|
|
15
|
+
- Prefer feature-level code splitting for Excel, editors, charts, drag-and-drop, and other heavy modules. `xlsx`, `@uiw/react-codemirror` / `@codemirror` / monaco, and chart libraries must use `import()`. Do not static-import them from `src/app.ts` or generated list pages.
|
|
15
16
|
|
|
16
17
|
## Business behavior
|
|
17
18
|
|
|
@@ -43,4 +44,6 @@ Prefer `pnpm typecheck` when that script exists.
|
|
|
43
44
|
|
|
44
45
|
Run `pnpm lint` for broad or shared changes. Run `pnpm run build` when routes, entry behavior, shared runtime, or multiple page modules change. If `.star-allinone.json` documents a TypeScript `baseUrl` or build script, use that command.
|
|
45
46
|
|
|
47
|
+
Yunxiao (and any CI without in-repo pipeline YAML) must run `pnpm typecheck && pnpm lint` as an explicit build step. `pnpm test` / `pnpm start:test` in business apps starts the test-env dev server; it is not a unit-test suite.
|
|
48
|
+
|
|
46
49
|
Distinguish failures introduced by the current change from pre-existing or environment failures.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Component contract
|
|
2
|
+
|
|
3
|
+
Use this file as the import source of truth. Do not invent package exports.
|
|
4
|
+
|
|
5
|
+
## From `@mingfuyun/star-allinone`
|
|
6
|
+
|
|
7
|
+
The npm package ships overlays, Cron, and ErrorBoundary. It does **not** export a table.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
BaseModal,
|
|
12
|
+
Cron,
|
|
13
|
+
CustomDrawer,
|
|
14
|
+
ErrorBoundary,
|
|
15
|
+
HocModal,
|
|
16
|
+
} from '@mingfuyun/star-allinone';
|
|
17
|
+
import '@mingfuyun/star-allinone/dist/styles.css';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Do not write any of the following:
|
|
21
|
+
|
|
22
|
+
- `import { MFTablePro } from '@mingfuyun/star-allinone'`
|
|
23
|
+
- `import { MFProTable } from '@mingfuyun/star-allinone'`
|
|
24
|
+
- `@mingfuyun/star-allinone/components/BaseModal` (use the main export)
|
|
25
|
+
|
|
26
|
+
## From the business app
|
|
27
|
+
|
|
28
|
+
Management lists use the local wrapper. Props and usage are in [mfprotable.md](./mfprotable.md).
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import MFProTable from '@/components/CommonTable/MFProTable';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Pages still consume APIs with `import Service from '@/services'`. Overlay shells come from the package above, not from `@/components/CustomDrawer` or `@/components/BaseModal`.
|
|
35
|
+
|
|
36
|
+
## Runtime
|
|
37
|
+
|
|
38
|
+
Peer React is **18.3.x**. Do not assume React 19 APIs. Ant Design 5 and Pro Components live in the business app.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# MFProTable contract
|
|
2
|
+
|
|
3
|
+
`MFProTable` lives in the **business app**, not in `@mingfuyun/star-allinone`. Do not invent `MFTablePro` and do not import a table from the npm package.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import MFProTable from '@/components/CommonTable/MFProTable';
|
|
7
|
+
import type { MFTableRef } from '@/components/CommonTable/type';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The capability package will not absorb this component until peer/externals/Umi versions are stable across apps.
|
|
11
|
+
|
|
12
|
+
## Required usage
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<MFProTable<Item, Query>
|
|
16
|
+
ref={tableRef}
|
|
17
|
+
actionColumn={{
|
|
18
|
+
actions: getActionColumn({ handleEdit, handleDelete }),
|
|
19
|
+
}}
|
|
20
|
+
bordered
|
|
21
|
+
columns={columns()}
|
|
22
|
+
fetchData={fetchData}
|
|
23
|
+
queryParams={{}}
|
|
24
|
+
rowKey="id"
|
|
25
|
+
scroll={{ x: 'max-content' }}
|
|
26
|
+
topTitle={false}
|
|
27
|
+
toolBarRender={getToolBarRender({ handleCreate })}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `fetchData` is an `async` callback. On failure return `{ code: 0, data: { list: [], total: 0 } }`.
|
|
32
|
+
- Adapt backend `{ results, count }` or `{ list, total }` to `{ code, data: { list, total } }`.
|
|
33
|
+
- Put columns, action builders, and toolbar items in `const.tsx`.
|
|
34
|
+
- Empty display values render as `'-'`.
|
|
35
|
+
- Open overlays through refs. Do not store drawer visibility on the page when `HocModal` owns it.
|
|
36
|
+
|
|
37
|
+
## Common props
|
|
38
|
+
|
|
39
|
+
These names match `src/components/CommonTable/type.ts` (`ITableProps` / `MFTableRef`):
|
|
40
|
+
|
|
41
|
+
| Prop | Role |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `columns` | `ProColumns<T>[]` from `const.tsx` |
|
|
44
|
+
| `fetchData` | `(params) => Promise<{ code, data: { list, total } }>` |
|
|
45
|
+
| `queryParams` | Extra query merged into requests |
|
|
46
|
+
| `rowKey` | Stable id field, usually `id` |
|
|
47
|
+
| `actionColumn.actions` | Row actions; `permission` when the project uses it |
|
|
48
|
+
| `toolBarRender` | Toolbar buttons (`TableSearchType[]`) |
|
|
49
|
+
| `scroll` | Wide tables: `{ x: 'max-content' }` |
|
|
50
|
+
| `columnsStateKey` | Persist column state via the project hook |
|
|
51
|
+
| `ref.reload` / `ref.reloadAndReset` | After mutations |
|
|
52
|
+
|
|
53
|
+
Permission filtering is implemented **in the app** (`useAuthFilter`, `withAuth`, `TableActions`). The package overlays do not wrap table permissions.
|
|
54
|
+
|
|
55
|
+
## Do not
|
|
56
|
+
|
|
57
|
+
- `import { MFTablePro } from '@mingfuyun/star-allinone'`
|
|
58
|
+
- `import { MFProTable } from '@mingfuyun/star-allinone'`
|
|
59
|
+
- Copy `MFProTable` into a second path and import both.
|
|
@@ -17,3 +17,17 @@ Check unsafe HTML, URL construction, upload/download names, sensitive logs/stora
|
|
|
17
17
|
## Testing
|
|
18
18
|
|
|
19
19
|
Request tests for concrete regression boundaries such as transformations, races, conditional validation, reusable hooks, complex transitions, or likely recurring bugs. Run focused Prettier, TypeScript, lint, `git diff --check`, and a production build in proportion to risk.
|
|
20
|
+
|
|
21
|
+
## CI / Yunxiao
|
|
22
|
+
|
|
23
|
+
These apps do not keep pipeline YAML in the repo. In the Yunxiao build step run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm typecheck && pnpm lint
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`pnpm test` is not a unit-test command in the business apps (use `start:test` / `dev:test` for the test-env dev server). `@mingfuyun/star-allinone` `npm test` only covers codegen fixtures.
|
|
30
|
+
|
|
31
|
+
## Performance
|
|
32
|
+
|
|
33
|
+
Flag new top-level imports of `xlsx`, `@uiw/react-codemirror` / CodeMirror, chart libraries, and similar heavy modules. They must be `import()` inside the feature that needs them. Generated pages must not pull them into `src/app.ts`.
|
|
@@ -19,8 +19,8 @@ This checklist is complete for shared review and commit. If `.agents/project/rev
|
|
|
19
19
|
|
|
20
20
|
## Pages and forms
|
|
21
21
|
|
|
22
|
-
- Management lists prefer `MFProTable`. Column and toolbar configuration belong outside the render function.
|
|
23
|
-
- Business forms use `ProForm`. Drawers use `CustomDrawer`. Dialogs use `BaseModal` / `HocModal`.
|
|
22
|
+
- Management lists prefer `MFProTable` from `@/components/CommonTable/MFProTable`. Column and toolbar configuration belong outside the render function.
|
|
23
|
+
- Business forms use `ProForm`. Drawers use `CustomDrawer`. Dialogs use `BaseModal` / `HocModal` from `@mingfuyun/star-allinone`.
|
|
24
24
|
- Successful mutations refresh the parent list. Closing an overlay clears form, loading, selected record, and other async state.
|
|
25
25
|
- Every `await` has error handling. Loading restores in `finally`.
|
|
26
26
|
- Check loading, empty, error, disabled, long content, and narrow-screen layout.
|
|
@@ -41,6 +41,16 @@ Read `.star-allinone.json` before running. `publishPipelineId` is required:
|
|
|
41
41
|
|
|
42
42
|
Never ask the user to repeat the pipeline ID. Never copy another project's pipeline ID.
|
|
43
43
|
|
|
44
|
+
## Yunxiao build gates
|
|
45
|
+
|
|
46
|
+
The pipeline lives in the Yunxiao console (there is no in-repo YAML). The build step must run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm typecheck && pnpm lint
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
before or as part of `max build`. Do not treat `pnpm test` as unit tests; in business apps that script was the test-env dev server and is now `start:test` / `dev:test`. `ANALYZE=1` is a manual pre-release chunk check, not a pipeline substitute.
|
|
53
|
+
|
|
44
54
|
## Preconditions
|
|
45
55
|
|
|
46
56
|
- Current HEAD is a named branch, not detached.
|
|
@@ -15,7 +15,11 @@ If `.agents/project/review-rules.md` exists, apply extra domain checks only; do
|
|
|
15
15
|
2. API contracts: method/path/params, response unwrapping, pagination, nullability, enum drift, error handling, DTO mismatch.
|
|
16
16
|
3. Permissions: route access, button visibility, mutation authorization, client-only enforcement.
|
|
17
17
|
4. Forms/tables: validation, reset, duplicate submit, refresh after mutation, column-state, long text, empty/error.
|
|
18
|
-
5. Performance
|
|
18
|
+
5. Performance (hard checks):
|
|
19
|
+
- New or changed files must not statically `import 'xlsx'`, `@uiw/react-codemirror`, `@codemirror/*`, `echarts`, `@ant-design/charts`, or `react-json-view` at module top level. Those must be `import()`.
|
|
20
|
+
- Do not add heavy modules to `src/app.ts`, `src/global.tsx`, or layout bootstrap.
|
|
21
|
+
- Flag generated list pages that pull Excel/editor/chart code into the route entry instead of a feature-level dynamic import.
|
|
22
|
+
- Also check duplicate libraries, large lists without virtualization, unstable columns/handlers, and avoidable requests.
|
|
19
23
|
6. Security/privacy: tokens, user data, URLs, unsafe HTML, sensitive logs, environment config.
|
|
20
24
|
7. Tests and accessibility: critical paths, failure states, keyboard labels, disabled/loading semantics.
|
|
21
25
|
|
|
@@ -16,6 +16,8 @@ Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain
|
|
|
16
16
|
3. Every `await` has `try-catch`; loading restores in `finally`; overlays clear state on close; successful mutations reload lists.
|
|
17
17
|
4. Scan new `any`, `as any`, `@ts-ignore`, direct Ant Design `Modal` / `Drawer` / `<Form>` containers, and production fake data.
|
|
18
18
|
5. Empty table values, duplicate-submit guards, permission wrappers, and narrow-screen overflow.
|
|
19
|
+
6. Heavy deps (`xlsx`, editors, charts) are `import()`; nothing new lands in `src/app.ts`.
|
|
20
|
+
7. No `MFTablePro` / table-from-package imports; overlays come from `@mingfuyun/star-allinone`.
|
|
19
21
|
|
|
20
22
|
## Commands
|
|
21
23
|
|