Skip to content

Commit d1db27c

Browse files
authored
feat(create-rslib): add conditional optional skills (#1600)
1 parent 4fe38f7 commit d1db27c

5 files changed

Lines changed: 168 additions & 18 deletions

File tree

packages/create-rslib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"type-check": "tsc --noEmit"
3030
},
3131
"dependencies": {
32-
"create-rstack": "1.9.1"
32+
"create-rstack": "2.0.0"
3333
},
3434
"devDependencies": {
3535
"@rslib/tsconfig": "workspace:*",

packages/create-rslib/src/index.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ create({
112112
{
113113
value: 'rspress',
114114
label: 'Rspress - documentation',
115-
when: (templateName) => templateName.startsWith('react-ts'),
115+
when: ({ templateName }) => templateName.startsWith('react-ts'),
116116
action: ({ templateName, distFolder, addAgentsMdSearchDirs }) => {
117117
const toolFolder = path.join(__dirname, '..', 'template-rspress');
118118
const subFolder = path.join(toolFolder, templateName);
@@ -136,7 +136,7 @@ create({
136136
{
137137
value: 'storybook',
138138
label: 'Storybook - component development',
139-
when: (templateName) =>
139+
when: ({ templateName }) =>
140140
templateName.startsWith('react') || templateName.startsWith('vue'),
141141
action: ({ templateName, distFolder, addAgentsMdSearchDirs }) => {
142142
const toolFolder = path.join(__dirname, '..', 'template-storybook');
@@ -170,8 +170,26 @@ create({
170170
extraSkills: [
171171
{
172172
value: 'rslib-best-practices',
173-
label: 'Rslib best practices',
173+
label: 'Rslib - best practices',
174174
source: 'rstackjs/agent-skills',
175175
},
176+
{
177+
value: 'rstest-best-practices',
178+
label: 'Rstest - best practices',
179+
source: 'rstackjs/agent-skills',
180+
when: ({ tools }) => tools.includes('rstest'),
181+
},
182+
{
183+
value: 'rspress-custom-theme',
184+
label: 'Rspress - custom theme',
185+
source: 'rstackjs/agent-skills',
186+
when: ({ tools }) => tools.includes('rspress'),
187+
},
188+
{
189+
value: 'rspress-description-generator',
190+
label: 'Rspress - description generator',
191+
source: 'rstackjs/agent-skills',
192+
when: ({ tools }) => tools.includes('rspress'),
193+
},
176194
],
177195
});

pnpm-lock.yaml

Lines changed: 126 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/docs/en/guide/start/quick-start.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,20 @@ Biome provides similar linting and formatting features to ESLint and Prettier. I
8080

8181
### Optional skills
8282

83-
`create-rslib` can also install optional skills for coding agents that support Skills. Currently, it provides `rslib-best-practices`, which gives agents Rslib-specific best practices for configuration, workflows, and common project setup decisions.
83+
`create-rslib` can install optional skills for coding agents that support Skills. In interactive mode, your selections in “Optional tools” affect the available skill options. The currently available skills are:
84+
85+
| Name | Condition |
86+
| ------------------------------------------------------------------------------------------------------- | ---------------- |
87+
| [rslib-best-practices](https://github.com/rstackjs/agent-skills#rslib-best-practices) | Default |
88+
| [rstest-best-practices](https://github.com/rstackjs/agent-skills#rstest-best-practices) | Choose `Rstest` |
89+
| [rspress-custom-theme](https://github.com/rstackjs/agent-skills#rspress-custom-theme) | Choose `Rspress` |
90+
| [rspress-description-generator](https://github.com/rstackjs/agent-skills#rspress-description-generator) | Choose `Rspress` |
8491

8592
Use the arrow keys to navigate and the space bar to select. Press Enter without selecting anything to skip.
8693

8794
```text
8895
◆ Select optional skills (Use <space> to select, <enter> to continue)
89-
│ ◻ Rslib best practices
96+
│ ◻ Rslib - best practices
9097
```
9198

9299
For more details about Agent Skills and other AI-related capabilities, see [AI](/guide/start/ai).
@@ -146,7 +153,7 @@ Optional tools:
146153
biome, eslint, prettier, rspress, storybook, rstest
147154
148155
Optional skills:
149-
rslib-best-practices
156+
rslib-best-practices, rstest-best-practices, rspress-custom-theme, rspress-description-generator
150157
```
151158

152159
## Migrate from existing projects

website/docs/zh/guide/start/quick-start.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,20 @@ Biome 提供与 ESLint 和 Prettier 相似的代码检查和格式化功能。
8080

8181
### 可选技能
8282

83-
`create-rslib` 也支持为支持 Skills 的 Coding Agents 安装可选技能。目前提供的技能是 `rslib-best-practices`,用于为 Agents 提供 Rslib 配置、工作流和常见项目设置方面的最佳实践。
83+
`create-rslib` 可以为支持 Skills 的 Coding Agents 安装可选技能。在交互模式下,“可选工具”的选择会影响可选技能的结果。目前提供的技能有:
84+
85+
| 名称 | 条件 |
86+
| ------------------------------------------------------------------------------------------------------- | -------------- |
87+
| [rslib-best-practices](https://github.com/rstackjs/agent-skills#rslib-best-practices) | 默认显示 |
88+
| [rstest-best-practices](https://github.com/rstackjs/agent-skills#rstest-best-practices) | 选择 `Rstest` |
89+
| [rspress-custom-theme](https://github.com/rstackjs/agent-skills#rspress-custom-theme) | 选择 `Rspress` |
90+
| [rspress-description-generator](https://github.com/rstackjs/agent-skills#rspress-description-generator) | 选择 `Rspress` |
8491

8592
你可以使用上下箭头和空格进行选择。如果不需要这些技能,可以直接按回车跳过。
8693

8794
```text
8895
◆ Select optional skills (Use <space> to select, <enter> to continue)
89-
│ ◻ Rslib best practices
96+
│ ◻ Rslib - best practices
9097
```
9198

9299
关于 Agent Skills 和其他 AI 相关能力的更多介绍,可参考 [AI](/guide/start/ai)
@@ -146,7 +153,7 @@ Optional tools:
146153
biome, eslint, prettier, rspress, storybook, rstest
147154
148155
Optional skills:
149-
rslib-best-practices
156+
rslib-best-practices, rstest-best-practices, rspress-custom-theme, rspress-description-generator
150157
```
151158

152159
## 从现有项目迁移

0 commit comments

Comments
 (0)