Skip to content

Commit 65a2702

Browse files
authored
chore(infra): add infra related (#4)
1 parent 765901a commit 65a2702

27 files changed

+1200
-48
lines changed

.github/renovate.json5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3+
extends: ['config:base', 'schedule:monthly', 'group:allNonMajor'],
4+
rangeStrategy: 'bump',
5+
packageRules: [{ depTypeList: ['peerDependencies'], enabled: false }],
6+
}

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os:
16+
- ubuntu-latest
17+
- macos-latest
18+
- windows-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v6
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 10.28.2
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: 24.13.0
33+
cache: pnpm
34+
35+
- name: Install dependencies
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Run build
39+
run: pnpm build

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.DS_Store
2+
*.log*
3+
*.cpuprofile
4+
node_modules/
5+
6+
dist/
7+
dist-*
8+
compiled/
9+
coverage/
10+
tsconfig.tsbuildinfo
11+
12+
# Test temp files
13+
test-temp-*
14+
15+
.vscode/**/*
16+
!.vscode/settings.json
17+
!.vscode/extensions.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry = 'https://registry.npmjs.org/'

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.13.0

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ignore artifacts:
2+
dist
3+
doc_build
4+
pnpm-lock.yaml
5+
6+
skills/**/scripts/*.js
7+
skills/**/scripts/*.cjs
8+
skills/**/scripts/*.mjs

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"plugins": ["prettier-plugin-packagejson"]
4+
}

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"biomejs.biome",
4+
"esbenp.prettier-vscode",
5+
"streetsidesoftware.code-spell-checker",
6+
"unifiedjs.vscode-mdx"
7+
]
8+
}

.vscode/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"search.useIgnoreFiles": true,
3+
"search.exclude": {
4+
"**/.git": true,
5+
"**/dist": true,
6+
"**/dist-*": true,
7+
"**/doc_build": true,
8+
"**/node_modules": true,
9+
"**/tsconfig.tsbuildinfo": true
10+
},
11+
"files.exclude": {
12+
"**/.DS_Store": true
13+
},
14+
"mdx.validate.validateFileLinks": "ignore",
15+
"editor.defaultFormatter": "esbenp.prettier-vscode",
16+
"typescript.tsdk": "node_modules/typescript/lib"
17+
}

AGENTS.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI coding agents working with code in this repository.
4+
5+
## Repository Overview
6+
7+
A collection of Agent Skills for the Rspack ecosystem (Rspack, Rsbuild, Rslib, Rstest, Rsdoctor). Skills are packaged instructions and scripts that extend agent capabilities for debugging, profiling, and development workflows.
8+
9+
## Project Structure
10+
11+
```
12+
agent-skills/
13+
├── skills/ # Skills directory, contains all Skills
14+
├── packages/ # Source code projects for complex scripts
15+
├── scripts/ # Project-level configurations and tools
16+
│ └── config/ # Common configurations (rslib, tsconfig, etc.)
17+
├── biome.json # Biome code formatting configuration
18+
├── pnpm-workspace.yaml # pnpm workspace configuration
19+
├── pnpm-lock.yaml # Dependency lock file
20+
├── package.json # Project configuration file
21+
└── README.md # Project documentation
22+
```
23+
24+
### Directory Explanations
25+
26+
- **skills/**: Contains all Skills, each Skill is an independent folder
27+
- Each Skill includes `SKILL.md` (required), `scripts/` (optional), `references/` (optional), `assets/` (optional)
28+
- **packages/**: Contains source code for complex scripts that need compilation
29+
- Corresponds to Skills with the same name in the skills directory
30+
- Compiled by Rslib and output to the corresponding `skills/{skill-name}/scripts/` directory
31+
- **scripts/config/**: Contains project-level common configurations
32+
- `rslib.config.ts`: Rslib base configuration
33+
- `tsconfig.json`: TypeScript base configuration
34+
35+
## Creating a New Skill
36+
37+
### 1. Initialize Skill Template
38+
39+
Execute in the `skills/` directory:
40+
41+
```bash
42+
cd skills
43+
npx skills init my-skill
44+
```
45+
46+
This will generate a `SKILL.md` file with YAML front-matter and Markdown content.
47+
48+
### 2. Configure Front-matter
49+
50+
Configure in the YAML front-matter at the top of the `SKILL.md` file:
51+
52+
```yaml
53+
---
54+
name: my-skill
55+
description: Feature description and trigger scenarios, which is key for Agents to determine whether to use this Skill
56+
---
57+
```
58+
59+
**Field Descriptions**:
60+
61+
- **name** (required)
62+
- Unique identifier for the Skill
63+
- Maximum 64 characters
64+
- Only lowercase letters, numbers, and hyphens
65+
- Must not start or end with a hyphen
66+
- Example: `rspack-tracing`
67+
68+
- **description** (required)
69+
- Feature description and trigger scenarios
70+
- Maximum 1024 characters
71+
- Recommended to include trigger keywords, such as "when user encounters segmentation fault in Rspack"
72+
73+
### 3. Write Skill Content
74+
75+
Standard Skill structure:
76+
77+
```
78+
my-skill/
79+
├── SKILL.md # Required: instructions + metadata
80+
├── scripts/ # Optional: executable scripts
81+
├── references/ # Optional: reference documentation
82+
└── assets/ # Optional: templates, resource files
83+
```
84+
85+
Write in `SKILL.md`:
86+
87+
- **Use Cases**: Explain when to use this Skill
88+
- **Workflow**: Detailed operation steps
89+
- **Code Examples**: Provide code examples
90+
- **Reference Documentation**: Link to detailed documentation in the `references/` directory
91+
92+
## Writing Skill Scripts
93+
94+
### Simple Scripts
95+
96+
For simple scripts (such as single-file scripts), create them directly in the `skills/{skill-name}/scripts/` directory.
97+
98+
Example:
99+
100+
```javascript
101+
// skills/my-skill/scripts/simple.js
102+
console.log('Hello from simple script');
103+
```
104+
105+
### Complex Scripts (Requiring Bundling)
106+
107+
For complex scenarios requiring dependencies, TypeScript, etc.:
108+
109+
#### 1. Create a Project with the Same Name in packages Directory
110+
111+
```
112+
packages/my-skill/
113+
├── package.json
114+
├── rslib.config.ts
115+
├── tsconfig.json
116+
└── src/
117+
└── index.ts
118+
```
119+
120+
#### 2. Configure package.json
121+
122+
```json
123+
{
124+
"name": "@rstackjs/my-skill",
125+
"version": "0.0.0",
126+
"type": "module",
127+
"scripts": {
128+
"build": "rslib build",
129+
"test": "rstest"
130+
},
131+
"dependencies": {
132+
// Your dependencies
133+
}
134+
}
135+
```
136+
137+
#### 3. Configure rslib.config.ts
138+
139+
```typescript
140+
import { basename, join } from 'node:path';
141+
import { defineConfig } from '@rslib/core';
142+
import { baseConfig } from '@rstackjs/config/rslib.config.ts';
143+
144+
const pkgName = basename(import.meta.dirname);
145+
146+
export default defineConfig({
147+
lib: [
148+
{
149+
...baseConfig,
150+
output: {
151+
distPath: join(import.meta.dirname, `../../skills/${pkgName}/scripts`),
152+
},
153+
},
154+
],
155+
});
156+
```
157+
158+
#### 4. Configure tsconfig.json
159+
160+
```json
161+
{
162+
"extends": "@rstackjs/config/tsconfig",
163+
"compilerOptions": {},
164+
"include": ["src"]
165+
}
166+
```
167+
168+
#### 5. Write Source Code
169+
170+
Write code in `src/index.ts`:
171+
172+
```typescript
173+
export function myFunction() {
174+
// Your logic
175+
}
176+
```
177+
178+
#### 6. Build Script
179+
180+
```bash
181+
cd packages/my-skill
182+
pnpm build
183+
```
184+
185+
After building, the bundled files will be automatically output to the `skills/my-skill/scripts/` directory.
186+
187+
### Testing Scripts
188+
189+
Write tests using Rstest:
190+
191+
```typescript
192+
// packages/my-skill/src/index.test.ts
193+
import { describe, it, expect } from '@rstest/core';
194+
import { myFunction } from './index';
195+
196+
describe('myFunction', () => {
197+
it('should work correctly', () => {
198+
expect(myFunction()).toBe(expected);
199+
});
200+
});
201+
```
202+
203+
Run tests:
204+
205+
```bash
206+
pnpm test
207+
```
208+
209+
## Using Skills
210+
211+
Install a specific Skill:
212+
213+
```bash
214+
npx skills add rstackjs/agent-skills --skill my-skill
215+
```
216+
217+
## References
218+
219+
- [Agent Skills Specification](https://agentskills.io/specification)
220+
- [Skill Authoring Best Practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
221+
- [Rspack Documentation](https://rspack.rs)
222+
- [Rslib Documentation](https://rslib.rs)
223+
- [Rstest Documentation](https://rslib.rs)

0 commit comments

Comments
 (0)