From 5162f0d77eff0c036184daabb214ec257e010d66 Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Thu, 5 Mar 2026 17:43:06 +0800 Subject: [PATCH 1/2] feat: optimiz workflows for release --- .cursor/commands/speckit.aftercode.md | 35 ++++++++--- .cursor/commands/speckit.skilltypesync.md | 76 +++++++++++++++++++++++ .github/workflows/post-release.yml | 63 +++++++++++++------ 3 files changed, 145 insertions(+), 29 deletions(-) create mode 100644 .cursor/commands/speckit.skilltypesync.md diff --git a/.cursor/commands/speckit.aftercode.md b/.cursor/commands/speckit.aftercode.md index f1db46544b..18b15d1408 100644 --- a/.cursor/commands/speckit.aftercode.md +++ b/.cursor/commands/speckit.aftercode.md @@ -1,5 +1,5 @@ --- -description: 'Automatically execute the subsequent code delivery pipeline: changelog → commit → prgenerate, in strict sequential order.' +description: 'Automatically execute the subsequent code delivery pipeline: skilltypesync → changelog → commit → prgenerate, in strict sequential order.' handoffs: - label: 'Create Pull Request' agent: 'speckit.prcreate' @@ -15,13 +15,30 @@ $ARGUMENTS ## Outline -This command orchestrates the code delivery pipeline, executing the `changelog`, `commit`, and `prgenerate` phases in a strict, sequential, and non-interactive flow. It ensures that the entire process, from generating change files to preparing the PR body, is automated while maintaining the precise behavior of each individual step. +This command orchestrates the code delivery pipeline, executing the `skilltypesync`, `changelog`, `commit`, and `prgenerate` phases in a strict, sequential, and non-interactive flow. It ensures that the entire process, from synchronizing skill type resources to preparing the PR body, is automated while maintaining the precise behavior of each individual step. **Execution is strictly sequential. No steps will be skipped or run in parallel.** -### Phase 1: Generate Changelog (`/speckit.changelog`) +### Phase 1: Sync Skill Type Resources (`/speckit.skilltypesync`) -- **Action**: Initiates the delivery pipeline by invoking `/speckit.changelog`. +- **Action**: Initiates the delivery pipeline by invoking `/speckit.skilltypesync`. +- **Process**: + - Detects whether this feature includes user-facing config/API/type changes. + - If required, synchronizes skill reference assets under: + - `skills/vchart-development-assistant/references/type-meta/` + - `skills/vchart-development-assistant/references/type-details/` + - Runs consistency checks to prevent broken type references in the skill resources. + - Any parameters provided in `$ARGUMENTS` will be passed through (for example: `--base`, `--force`, `--types`). +- **Handoff**: Upon successful completion, automatically triggers the `changelog` phase. +- **Output Report**: + - "Phase 1 (Skill Type Sync) completed." + - `SYNC_TRIGGER`: [auto-detected | forced] + - `UPDATED_TYPE_META`: [List of updated files or empty] + - `UPDATED_TYPE_DETAILS`: [List of updated files or empty] + +### Phase 2: Generate Changelog (`/speckit.changelog`) + +- **Action**: Triggered automatically after `skilltypesync` completes. - **Process**: - Collects commits since a base branch (defaulting to `develop`). - Infers the version bump type (`patch`, `minor`, `major`) automatically from commit messages unless an explicit `bumpType` is passed in `$ARGUMENTS`. @@ -29,11 +46,11 @@ This command orchestrates the code delivery pipeline, executing the `changelog`, - Any parameters provided in `$ARGUMENTS` will be passed through to override default behavior. - **Handoff**: Upon successful completion, automatically triggers the `commit` phase. - **Output Report**: - - "Phase 1 (Changelog) completed." + - "Phase 2 (Changelog) completed." - `CREATED_FILES`: [List of paths to generated files in `common/changes/`] - `VALIDATION`: "Changelog message conforms to Conventional Commits standards." -### Phase 2: Create Commit (`/speckit.commit`) +### Phase 3: Create Commit (`/speckit.commit`) - **Action**: Triggered automatically after `changelog` completes. - **Process**: @@ -44,11 +61,11 @@ This command orchestrates the code delivery pipeline, executing the `changelog`, - The `message` and `pushAfterCommit` behaviors can be overridden via `$ARGUMENTS`. - **Handoff**: Upon successful completion, automatically triggers the `prgenerate` phase. - **Output Report**: - - "Phase 2 (Commit) completed." + - "Phase 3 (Commit) completed." - `COMMIT_MESSAGE`: [The full commit message used] - `PUSH_STATUS`: "Branch [branch-name] pushed to origin." -### Phase 3: Generate PR Body (`/speckit.prgenerate`) +### Phase 4: Generate PR Body (`/speckit.prgenerate`) - **Action**: The final phase, realized via the native `handoff` from `/speckit.commit` to `/speckit.prgenerate` after `commit` completes. This `/speckit.aftercode` command does not declare its own `handoff` entry for `/speckit.prgenerate` to avoid duplicate execution. - **Process**: @@ -57,7 +74,7 @@ This command orchestrates the code delivery pipeline, executing the `changelog`, - Saves the final, populated PR body to `.trae/output/pr.body.local.md`. - **Handoff**: This step retains its original `handoff` to `speckit.prcreate`. The `/speckit.aftercode` command depends strictly on the original single-step handoff chain and does **not** introduce any additional handoffs, preventing `prgenerate` (or downstream steps) from running more than once. - **Output Report**: - - "Phase 3 (PR Generate) completed." + - "Phase 4 (PR Generate) completed." - `OUTPUT_FILE`: ".trae/output/pr.body.local.md" - `VALIDATION_SUMMARY`: "PR body generated. Please review the file before creating the pull request." - `NEXT_STEPS`: "The `speckit.prcreate` command may have been triggered automatically. If not, you can run it manually to create the GitHub Pull Request." diff --git a/.cursor/commands/speckit.skilltypesync.md b/.cursor/commands/speckit.skilltypesync.md new file mode 100644 index 0000000000..090c4f9083 --- /dev/null +++ b/.cursor/commands/speckit.skilltypesync.md @@ -0,0 +1,76 @@ +--- +description: "After feature development, detect user-config/API changes and synchronize skill type resources under skills/vchart-development-assistant/references/type-meta and type-details." +--- + +## User Input + +```text +$ARGUMENTS +``` + +You **MUST** consider user input if provided. Treat it as optional CLI-style overrides only (for example: `--base develop`, `--force`, `--types ILabelSpec,IData`). + +## Outline + +1. **Resolve diff scope**: + - Default base branch is `develop`. + - If `$ARGUMENTS` contains `--base `, use that branch as comparison base. + - Collect changed files from: + - staged + unstaged local changes, and + - branch diff against base (`...HEAD`). + - De-duplicate all changed paths. + +2. **Determine whether sync is required**: + - Mark as **requires sync** when changes affect user-facing configuration or API/type definitions, including (but not limited to): + - `packages/vchart/src/typings/**` + - `packages/vchart/src/chart/**/interface/**` + - `packages/vchart/src/component/**/interface/**` + - `packages/vchart/src/series/**/interface/**` + - `packages/vchart/src/theme/**` + - any public API or option schema files referenced by VChart docs. + - If no matching files and no `--force`, stop with a clear summary: "No user config/API changes detected, skill type sync skipped." + +3. **Identify impacted type entities**: + - From changed TypeScript definitions, extract impacted type/interface names (for example `ILabelSpec`, `IData`, `ITheme`). + - Build two impact sets: + - **Meta impact**: chart/common entries that need `type-meta/*.json` updates. + - **Detail impact**: concrete types needing `type-details/*-Type-Definition.md` updates. + - If `$ARGUMENTS` includes `--types`, merge explicit type names into the detail impact set. + +4. **Update `type-meta` resources**: + - Target directory: `skills/vchart-development-assistant/references/type-meta/`. + - For each impacted chart/common meta file: + - sync user-visible property paths, + - sync `required` flags, + - sync `type` and `isSimple` fields, + - remove stale keys that no longer exist in source typings. + - Keep JSON valid and stable (no duplicated keys, deterministic field ordering where possible). + +5. **Update `type-details` resources**: + - Target directory: `skills/vchart-development-assistant/references/type-details/`. + - For each impacted type: + - create or update `[TypeName]-Type-Definition.md` (for example `ILabelSpec-Type-Definition.md`), + - ensure definitions reflect latest fields, value types, optional/required semantics, and usage notes, + - include concise, runnable-style code examples that match current VChart API behavior. + - Keep naming aligned with `references/FILE_NAMING_CONVENTIONS.md`. + +6. **Consistency checks**: + - Verify every complex type referenced in `type-meta` (`isSimple: false`) has a corresponding `type-details` document. + - Verify removed/renamed types no longer leave broken references in `type-meta`. + - Validate JSON syntax for all changed files under `type-meta`. + - Ensure Markdown files under `type-details` are non-empty and include the target type name in title/content. + +7. **Output report**: + - Print: + - base branch used, + - whether sync was triggered by auto-detection or `--force`, + - changed source files that triggered sync, + - updated `type-meta` files, + - updated `type-details` files, + - unresolved gaps (if any manual follow-up is required). + - If unresolved gaps exist, fail with actionable errors instead of silently succeeding. + +## Notes + +- This command only synchronizes skill reference assets; it does not commit, push, or create PR content. +- Preferred execution point is after implementation is complete and before `/speckit.changelog` or `/speckit.aftercode`. diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 401d7f3ea4..c64de57548 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -74,31 +74,28 @@ jobs: echo "skip=false" >> "$GITHUB_OUTPUT" - - name: Fetch develop changelog + - name: Ensure main changelog exists if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' run: | set -euo pipefail - git fetch origin develop:refs/remotes/origin/develop --depth=1 - git show origin/develop:docs/assets/changelog/en/release.md > release-develop.md + if [ ! -f "docs/assets/changelog/en/release.md" ]; then + echo "Error: docs/assets/changelog/en/release.md not found in main." + exit 1 + fi - - name: Extract release body from develop changelog + - name: Extract release body from main changelog id: body if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' env: VERSION: ${{ steps.meta.outputs.version }} run: | set -euo pipefail - if [ ! -f "release-develop.md" ]; then - echo "develop changelog file not found, skip post-release." - echo "has_body=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - if node <<'NODE' + node <<'NODE' const fs = require('fs'); const version = process.env.VERSION; - const content = fs.readFileSync('release-develop.md', 'utf8'); + const changelogPath = 'docs/assets/changelog/en/release.md'; + const content = fs.readFileSync(changelogPath, 'utf8'); function escapeRegExp(str) { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); @@ -108,27 +105,53 @@ jobs: const match = headerPattern.exec(content); if (!match) { - console.log('No changelog block for version', version, 'found in develop.'); + console.error('No changelog block for version', version, 'found in main changelog.'); process.exit(1); } const startIndex = match.index; const rest = content.slice(startIndex); - const nextHeaderPattern = /^#\s*v?\d+\.\d+\.\d+[^\n]*$/gm; + // Find the next release header after the current one. + const nextHeaderPattern = /^#\s*v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?[^\n]*$/gm; let nextIndex = rest.length; let m; - if ((m = nextHeaderPattern.exec(rest)) !== null && m.index !== 0) { - nextIndex = m.index; + while ((m = nextHeaderPattern.exec(rest)) !== null) { + if (m.index > 0) { + nextIndex = m.index; + break; + } } const block = rest.slice(0, nextIndex).trimEnd() + '\n'; + if (!block.trim()) { + console.error('Extracted changelog block is empty for version', version); + process.exit(1); + } fs.writeFileSync('release-body.md', block, 'utf8'); NODE - then - echo "has_body=true" >> "$GITHUB_OUTPUT" - else - echo "has_body=false" >> "$GITHUB_OUTPUT" + echo "has_body=true" >> "$GITHUB_OUTPUT" + + - name: Validate extracted release body + if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' && steps.body.outputs.has_body == 'true' + env: + VERSION: ${{ steps.meta.outputs.version }} + run: | + set -euo pipefail + if [ ! -s "release-body.md" ]; then + echo "Error: release-body.md is missing or empty." + exit 1 + fi + + if ! grep -Eq "^#\\s*v?${VERSION}\\b" release-body.md; then + echo "Error: release-body.md does not start with expected version header v${VERSION}." + exit 1 + fi + + HEADER_COUNT="$(grep -Ec '^#\s*v?[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?\b' release-body.md || true)" + if [ "${HEADER_COUNT}" -ne 1 ]; then + echo "Error: extracted release body contains ${HEADER_COUNT} release headers, expected exactly 1." + exit 1 fi - name: Verify gh identity From b0a0d508be6159199b76a1f59eadec185afdbe96 Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Thu, 5 Mar 2026 17:46:30 +0800 Subject: [PATCH 2/2] docs: update changlog of rush --- .../feat-optimiz-post-release_2026-03-05-09-46.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/feat-optimiz-post-release_2026-03-05-09-46.json diff --git a/common/changes/@visactor/vchart/feat-optimiz-post-release_2026-03-05-09-46.json b/common/changes/@visactor/vchart/feat-optimiz-post-release_2026-03-05-09-46.json new file mode 100644 index 0000000000..ce0180fc48 --- /dev/null +++ b/common/changes/@visactor/vchart/feat-optimiz-post-release_2026-03-05-09-46.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "feat: optimiz workflows for release\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "lixuef1313@163.com" +} \ No newline at end of file