@mingfuyun/star-allinone 0.1.7 → 0.1.9

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.
@@ -0,0 +1,43 @@
1
+ # Architecture
2
+
3
+ Apply these rules to every non-trivial frontend change. Shared review, commit, mock, and service generation do not require a project-local conventions file.
4
+
5
+ ## Architecture
6
+
7
+ - Use React function components and TypeScript.
8
+ - Put transport code in `src/services`. Pages must not call axios or the request helper directly.
9
+ - Keep API DTOs in the domain `typings.d.ts`. Use named types and adapters instead of `any`.
10
+ - Reuse `MFProTable`, `BaseModal`, `CustomDrawer`, `HocModal`, permission wrappers, table cells, hooks, and shared styles before adding abstractions.
11
+ - Use `@/` imports for application modules and keep feature-local imports relative.
12
+ - Do not add a UI/state library or duplicate an existing component without explicit approval.
13
+ - Prefer feature-level code splitting for Excel, editors, charts, drag-and-drop, and other heavy modules.
14
+
15
+ ## Business behavior
16
+
17
+ - Every async page handles loading, empty, error, retry, and unauthorized states where applicable.
18
+ - Mutations disable or guard duplicate submission, show a user-facing result, and refresh affected data.
19
+ - Destructive actions require confirmation and must not silently discard edits.
20
+ - Preserve backend field names in service types; convert only at a clear adapter boundary.
21
+ - Permission checks exist in the UI and remain enforced by the backend. Never infer permission from button visibility alone.
22
+ - Tables that persist columns use the project's column-state hook and register the key in the project's cache-reset UI when one exists.
23
+
24
+ ## Type and quality
25
+
26
+ - Do not introduce new `Record<string, any>`, `Promise<any>`, or unexplained `any` / `as any` / `@ts-ignore` when the contract is known.
27
+ - Do not leave `console.log` or sensitive payloads in production paths.
28
+ - Keep constants, columns, schemas, and render adapters outside large render functions.
29
+ - Make the smallest scoped change. Do not refactor unrelated code.
30
+
31
+ ## Validation
32
+
33
+ Identify commands that prove the changed surface is valid. At minimum:
34
+
35
+ ```bash
36
+ git diff --check
37
+ pnpm exec prettier --check <changed-files>
38
+ pnpm exec tsc --noEmit
39
+ ```
40
+
41
+ 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.
42
+
43
+ Distinguish failures introduced by the current change from pre-existing or environment failures.
@@ -0,0 +1,19 @@
1
+ # Quality Checklist
2
+
3
+ ## Correctness and TypeScript
4
+
5
+ Check null/undefined access, partial responses, pagination, truthiness errors, enum drift, stale field names, state mutation, date/timezone handling, number/string ID comparison, and unsafe non-null assertions. Flag `any`, `@ts-ignore`, broad records, and repeated casts when a project or API type can express the boundary.
6
+
7
+ ## Resilience, accessibility, styling, and security
8
+
9
+ Review loading, empty, partial, error, retry, permissions, network failure, and malformed responses. Avoid duplicate error toasts when `MFRequest` already reports the same failure.
10
+
11
+ Check semantic controls, keyboard access, focus return, labels, disabled/loading behavior, color-only status, tooltip-only information, and destructive confirmations. Prefer Ant Design primitives over clickable `div` or `span`.
12
+
13
+ Follow scoped Less and nearby conventions. Flag global leakage, arbitrary z-index escalation, long-text breakage, missing overflow, and hardcoded values where theme constants exist.
14
+
15
+ Check unsafe HTML, URL construction, upload/download names, sensitive logs/storage, visual-only permissions, redirects, and dynamic scripts.
16
+
17
+ ## Testing
18
+
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.
@@ -0,0 +1,42 @@
1
+ # Review Checklist
2
+
3
+ This checklist is complete for shared review and commit. If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken the rules below.
4
+
5
+ ## Permissions
6
+
7
+ - New routes, menus, and action buttons must stay in sync with the project's permission source.
8
+ - Destructive actions (delete, disable, export, assign, recycle) go through the project's permission wrappers.
9
+ - Do not treat hidden buttons as authorization. Review both the request and the UI permission.
10
+
11
+ ## API and types
12
+
13
+ - Production requests go through `MFRequest` in `src/services/request.tsx`.
14
+ - Types live in `src/services/<Domain>/typings.d.ts`. Pages must not redefine DTOs.
15
+ - Changing a service or type requires checking `src/services/index.ts`, callers, and mocks.
16
+ - Do not invent fields, HTTP methods, or response shapes when OpenAPI/Swagger is unclear.
17
+ - Do not add unexplained `any`, `as any`, or `@ts-ignore`.
18
+ - Service callers are typed against unwrapped `data`. Mock JSON keeps the full `{ code, message, data }` envelope unless the project documents another envelope.
19
+
20
+ ## Pages and forms
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`.
24
+ - Successful mutations refresh the parent list. Closing an overlay clears form, loading, selected record, and other async state.
25
+ - Every `await` has error handling. Loading restores in `finally`.
26
+ - Check loading, empty, error, disabled, long content, and narrow-screen layout.
27
+ - Table empty values render `'-'` unless the design requires another value.
28
+
29
+ ## Shared components and regression
30
+
31
+ - Changes to `MFProTable`, permission components, the request wrapper, or shared hooks must list direct callers.
32
+ - A shared-component change must not be verified on a single page. Cover at least two unrelated features.
33
+ - Separate correctness issues from optional refactors. Report P0/P1/P2 with reproduction or contract evidence.
34
+
35
+ ## Severity
36
+
37
+ - **P0**: security/privacy breach, data loss, critical crash, or destructive behavior.
38
+ - **P1**: user-visible regression, broken primary workflow, invalid API/auth contract, stale submitted data, or reliable runtime exception.
39
+ - **P2**: credible performance, accessibility, type-safety, lifecycle, race, or maintainability defect.
40
+ - **P3**: minor actionable cleanup; include only when useful.
41
+
42
+ Do not inflate style preferences or speculative memoization into bugs.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: {{sharedSkillName}}
3
+ description: Publish the current frontend Git branch to the project's Yunxiao test pipeline only after explicit confirmation such as 确认推送流水线 or 发布测试环境. Never run the pipeline automatically after git push.
4
+ ---
5
+
6
+ # Publish Test Environment
7
+
8
+ This skill is fully shared. The only project-specific value is `publishPipelineId` in `.star-allinone.json`.
9
+
10
+ Do not run the pipeline script after a git push. Git push, `确认提交并推送`, and `确认` are not pipeline authorization.
11
+
12
+ Run the script only after an explicit pipeline confirmation in this conversation, such as:
13
+
14
+ - `确认推送流水线`
15
+ - `发布测试环境`
16
+ - `发布测试云效流水线`
17
+ - `以当前分支发布`
18
+
19
+ If the user has not said one of these, stop and ask whether to publish the test pipeline. Do not infer yes from a prior commit or push.
20
+
21
+ From the business repository root, run:
22
+
23
+ ```bash
24
+ bash .agents/skills/{{sharedSkillName}}/scripts/publish-current-branch.sh
25
+ ```
26
+
27
+ Do not look for a project-local deploy script under `scripts/`. Do not substitute another pipeline. Do not use or merge `rancher-test`.
28
+
29
+ ## Config
30
+
31
+ Read `.star-allinone.json` before running. `publishPipelineId` is required:
32
+
33
+ ```json
34
+ {
35
+ "project": "starscope-frontend",
36
+ "publishPipelineId": "5108336"
37
+ }
38
+ ```
39
+
40
+ Never ask the user to repeat the pipeline ID. Never copy another project's pipeline ID.
41
+
42
+ ## Preconditions
43
+
44
+ - Current HEAD is a named branch, not detached.
45
+ - `origin/<branch>` exists and matches local `HEAD`. Push first when it does not.
46
+ - `YUNXIAO_ACCESS_TOKEN` is available. Request approval for the external Yunxiao CLI call.
47
+ - Never print access tokens.
48
+
49
+ ## After the run
50
+
51
+ Report branch, commit subject, pipeline ID, run ID, status, and commit verification. Do not expose the full commit SHA in the dashboard comment or final report.
52
+
53
+ If Yunxiao selected a different branch or commit, the script stops the run. That is a failure; do not claim publication succeeded.
54
+
55
+ A missing current-commit field is not a failure. `commit_verification=unavailable` is acceptable when Yunxiao has not yet returned a commit.
56
+
57
+ The dashboard comment is `BUILD_REMARK` and contains branch, commit subject, and `来源: Codex`. A missing top-level `comment` field is not a publication failure.
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ DEFAULT_ORG_ID="61762c5110204867ecfd5ca4"
5
+
6
+ root="$(git rev-parse --show-toplevel)"
7
+ config_file="$root/.star-allinone.json"
8
+ if [[ ! -f "$config_file" ]]; then
9
+ echo "error: missing project config: $config_file" >&2
10
+ exit 1
11
+ fi
12
+
13
+ pipeline_id="$(python3 - "$config_file" <<'PY'
14
+ import json
15
+ import sys
16
+
17
+ cfg = json.load(open(sys.argv[1]))
18
+ variables = cfg.get("variables") or {}
19
+ value = cfg.get("publishPipelineId") or variables.get("publishPipelineId") or ""
20
+ print(str(value).strip())
21
+ PY
22
+ )"
23
+ if [[ -z "$pipeline_id" ]]; then
24
+ echo "error: .star-allinone.json is missing publishPipelineId" >&2
25
+ exit 1
26
+ fi
27
+
28
+ organization_id="$(python3 - "$config_file" "$DEFAULT_ORG_ID" <<'PY'
29
+ import json
30
+ import sys
31
+
32
+ cfg = json.load(open(sys.argv[1]))
33
+ variables = cfg.get("variables") or {}
34
+ value = cfg.get("yunxiaoOrganizationId") or variables.get("yunxiaoOrganizationId") or sys.argv[2]
35
+ print(str(value).strip())
36
+ PY
37
+ )"
38
+
39
+ repository_url="$(python3 - "$(git remote get-url origin)" <<'PY'
40
+ import sys
41
+
42
+ url = sys.argv[1].strip()
43
+ if url.startswith("git@"):
44
+ host, path = url.split(":", 1)
45
+ host = host.split("@", 1)[1]
46
+ print(f"https://{host}/{path}")
47
+ else:
48
+ print(url)
49
+ PY
50
+ )"
51
+
52
+ branch="${1:-$(git branch --show-current)}"
53
+ if [[ -z "$branch" ]]; then
54
+ echo "error: detached HEAD; check out the branch to publish" >&2
55
+ exit 1
56
+ fi
57
+
58
+ local_commit="$(git rev-parse HEAD)"
59
+ if ! remote_commit="$(git ls-remote origin "refs/heads/$branch" | awk 'NR == 1 { print $1 }')"; then
60
+ echo "error: failed to query origin/$branch" >&2
61
+ exit 1
62
+ fi
63
+ if [[ -z "$remote_commit" ]]; then
64
+ echo "error: origin/$branch is unavailable; push it before publishing" >&2
65
+ exit 1
66
+ fi
67
+ if [[ "$local_commit" != "$remote_commit" ]]; then
68
+ echo "error: branch '$branch' is not synchronized with 'origin/$branch'" >&2
69
+ exit 1
70
+ fi
71
+
72
+ if [[ -z "${YUNXIAO_ACCESS_TOKEN:-}" ]]; then
73
+ echo "error: YUNXIAO_ACCESS_TOKEN is unavailable" >&2
74
+ exit 1
75
+ fi
76
+
77
+ commit_message="$(git log -1 --format='%s')"
78
+ run_comment="发布分支: $branch | 提交内容: $commit_message | 来源: Codex"
79
+ params="$(python3 -c 'import json,sys; print(json.dumps({"runningBranchs": {sys.argv[1]: sys.argv[2]}, "branchModeBranchs": sys.argv[2], "comment": sys.argv[3]}))' "$repository_url" "$branch" "$run_comment")"
80
+
81
+ export ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN="$YUNXIAO_ACCESS_TOKEN"
82
+ export ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID="$organization_id"
83
+
84
+ run_id="$(aliyun devops flow-create-pipeline-run \
85
+ --pipeline-id "$pipeline_id" \
86
+ --params "$params")"
87
+ run_id="$(printf '%s' "$run_id" | tr -d '[:space:]')"
88
+
89
+ details=""
90
+ for _ in {1..20}; do
91
+ details="$(aliyun devops flow-get-pipeline-run \
92
+ --pipeline-id "$pipeline_id" \
93
+ --pipeline-run-id "$run_id")"
94
+ has_source="$(DETAILS="$details" python3 - <<'PY'
95
+ import json
96
+ import os
97
+
98
+ details = json.loads(os.environ["DETAILS"])
99
+ params = {item.get("key"): item.get("value") for item in details.get("globalParams", [])}
100
+ if params.get("CI_SOURCE_BRANCHES"):
101
+ print("yes")
102
+ elif details.get("sources"):
103
+ print("yes")
104
+ else:
105
+ print("no")
106
+ PY
107
+ )"
108
+ [[ "$has_source" == "yes" ]] && break
109
+ sleep 3
110
+ done
111
+
112
+ source_result="$(DETAILS="$details" python3 - "$branch" <<'PY'
113
+ import json
114
+ import os
115
+ import sys
116
+
117
+ details = json.loads(os.environ["DETAILS"])
118
+ wanted = sys.argv[1]
119
+ params = {item.get("key"): item.get("value") for item in details.get("globalParams", [])}
120
+ branches_raw = params.get("CI_SOURCE_BRANCHES") or "[]"
121
+ try:
122
+ branches = json.loads(branches_raw)
123
+ except json.JSONDecodeError:
124
+ branches = []
125
+ item = branches[0] if branches else {}
126
+ actual_branch = item.get("CI_COMMIT_REF_NAME") or ""
127
+ actual_commit = str(item.get("CI_COMMIT_ID") or "")
128
+
129
+ if not actual_branch:
130
+ sources = details.get("sources") or []
131
+ source = next((entry for entry in sources if (entry.get("data") or {}).get("branch") == wanted), sources[0] if sources else None)
132
+ data = (source or {}).get("data") or {}
133
+ actual_branch = str(data.get("branch") or "")
134
+ actual_commit = next(
135
+ (str(data[key]) for key in ("commit", "commitId", "revision", "checkoutCommit", "checkoutCommitId") if data.get(key)),
136
+ "",
137
+ )
138
+
139
+ print(f"{actual_branch}\t{actual_commit}")
140
+ PY
141
+ )"
142
+ IFS=$'\t' read -r actual_branch actual_commit <<<"$source_result"
143
+
144
+ stop_run() {
145
+ aliyun devops flow-update-pipeline-run \
146
+ --pipeline-id "$pipeline_id" \
147
+ --pipeline-run-id "$run_id" >/dev/null || true
148
+ }
149
+
150
+ if [[ -n "$actual_branch" && "$actual_branch" != "$branch" ]]; then
151
+ stop_run
152
+ echo "error: stopped run $run_id because Yunxiao selected '${actual_branch}' instead of '$branch'" >&2
153
+ exit 2
154
+ fi
155
+
156
+ commit_verification="unavailable"
157
+ short_commit="$(git rev-parse --short=8 HEAD)"
158
+ if [[ -n "$actual_commit" ]]; then
159
+ if [[ "$actual_commit" == "$local_commit" || "$actual_commit" == "$short_commit"* ]]; then
160
+ commit_verification="verified"
161
+ else
162
+ stop_run
163
+ echo "error: stopped run $run_id because Yunxiao selected a different commit" >&2
164
+ exit 4
165
+ fi
166
+ fi
167
+
168
+ status="$(aliyun devops flow-get-pipeline-run \
169
+ --pipeline-id "$pipeline_id" \
170
+ --pipeline-run-id "$run_id" \
171
+ --cli-query 'status' | tr -d '"[:space:]')"
172
+
173
+ printf 'branch=%s\ncommit_message=%s\ncomment=%s\npipeline_id=%s\nrun_id=%s\nstatus=%s\ncommit_verification=%s\n' \
174
+ "$branch" "$commit_message" "$run_comment" "$pipeline_id" "$run_id" "$status" "$commit_verification"
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: {{sharedSkillName}}
3
+ description: Run the frontend pre-submit workflow: impact analysis, verification, then confirmation-gated commit review. Use when the user asks for the full submit flow or says 使用完整流程提交代码. Never stage, commit, or push before explicit confirmation.
4
+ ---
5
+
6
+ # Review and Submit
7
+
8
+ This is the unified pre-submit entry and is fully shared. Do not mutate Git until the user confirms the exact reviewed scope.
9
+
10
+ If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken shared hard rules.
11
+
12
+ ## Workflow
13
+
14
+ Execute in this order.
15
+
16
+ ### 1. Impact analysis
17
+
18
+ Follow `.agents/skills/shared-impact-analysis/SKILL.md`. Output:
19
+
20
+ - Change summary
21
+ - Direct callers and affected pages
22
+ - Related services, types, mocks, routes, and permissions
23
+ - Shared-component blast radius
24
+ - Recommended automated and manual regression paths
25
+
26
+ ### 2. Verification
27
+
28
+ Follow `.agents/skills/shared-verify/SKILL.md`. Output:
29
+
30
+ - P0/P1/P2 blockers
31
+ - Completeness of route, permission, API, types, mock, and page states
32
+ - Async, loading, overlay, and list-reload behavior
33
+ - Prettier, TypeScript, lint, and build results
34
+ - Uncovered risks
35
+
36
+ If the current change introduced P0/P1 issues or validation failures, stop. Do not enter commit review.
37
+
38
+ ### 3. Commit review
39
+
40
+ Follow `.agents/skills/shared-commit-current-changes/SKILL.md`. Output:
41
+
42
+ - Findings sorted P0–P2
43
+ - Optional improvements
44
+ - Validation results and residual risk
45
+ - Change summary
46
+ - Suggested Chinese Conventional Commit message
47
+ - Current branch and target remote
48
+ - Exact file paths to submit
49
+
50
+ Then stop and wait. Do not run Git writes.
51
+
52
+ ## Confirmation gate
53
+
54
+ Execute the commit phase only after an explicit reply such as `确认` or `确认提交并推送` that authorizes the latest proposal.
55
+
56
+ 1. Re-check branch, status, and full diff.
57
+ 2. Confirm the review scope did not change.
58
+ 3. Stage only the confirmed paths.
59
+ 4. Create the confirmed commit message.
60
+ 5. Push only if the user asked to push.
61
+ 6. Report commit, remote branch, and workspace status.
62
+ 7. Stop. Do not run `$shared-publish-test` or the pipeline script after git push.
63
+
64
+ Git push confirmation is not pipeline confirmation. Run the pipeline only after a separate explicit reply such as `确认推送流水线` or `发布测试环境`. Then follow `.agents/skills/shared-publish-test/SKILL.md`.
65
+
66
+ If the user only says `确认` but the scope is unclear, do not commit; ask for the exact files and message.
67
+
68
+ If the user says `提交代码` before a review proposal exists, run the three steps above first. Do not skip review.
69
+
70
+ ## Related skills
71
+
72
+ | Skill | Purpose |
73
+ | --- | --- |
74
+ | `$shared-impact-analysis` | Read-only impact analysis |
75
+ | `$shared-verify` | Convention and command verification |
76
+ | `$shared-commit-current-changes` | Review plus confirmation-gated commit |
77
+ | `$shared-ai-review` | Standalone review without commit |
78
+ | `$shared-publish-test` | Publish to the test pipeline only after a separate `确认推送流水线`. Never run it automatically after git push. |
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: {{sharedSkillName}}
3
+ description: Verify generated or manually changed frontend code against shared conventions, API contracts, permissions, async behavior, and validation commands. Use after API, mock, page, or refactor work. Do not generate business code.
4
+ ---
5
+
6
+ # Frontend Verification
7
+
8
+ This skill is fully shared. Read the current diff, related callers, and:
9
+
10
+ 1. `.agents/skills/shared-project-conventions/references/review-checklist.md`
11
+ 2. `.agents/skills/shared-project-conventions/references/architecture.md`
12
+
13
+ Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain checks only.
14
+
15
+ ## Checks
16
+
17
+ 1. Route, service, namespace types, `src/services/index.ts`, mocks, and permissions updated as a set.
18
+ 2. Pages follow `MFProTable`, `ProForm`, `CustomDrawer` / `BaseModal` / `HocModal`, and `@/services`.
19
+ 3. Every `await` has `try-catch`; loading restores in `finally`; overlays clear state on close; successful mutations reload lists.
20
+ 4. Scan new `any`, `as any`, `@ts-ignore`, direct Ant Design `Modal` / `Drawer` / `<Form>` containers, and production fake data.
21
+ 5. Empty table values, duplicate-submit guards, permission wrappers, and narrow-screen overflow.
22
+
23
+ ## Commands
24
+
25
+ Choose by risk. Do not auto-fix to make a command pass.
26
+
27
+ ```bash
28
+ git diff --check
29
+ pnpm exec prettier --check <changed-files>
30
+ pnpm exec eslint <changed-files>
31
+ pnpm exec tsc --noEmit
32
+ pnpm lint
33
+ ```
34
+
35
+ Run the project's build script when routes, entry, or shared runtime change.
36
+
37
+ ## Output
38
+
39
+ 1. Blocking issues P0–P2, with file, line, impact, and fix direction.
40
+ 2. Completeness: route, permission, API, types, mock, page states.
41
+ 3. Command results, distinguishing new, existing, and environment failures.
42
+ 4. Regression list: affected pages, suggested manual paths, uncovered risks.
43
+
44
+ If there are no blockers, write `未发现阻断问题`. Do not report only that commands passed.