@bleedingdev/modern-js-create 3.2.0-ultramodern.6 → 3.2.0-ultramodern.8
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/dist/index.js +225 -34
- package/package.json +3 -3
- package/template/.agents/skills-lock.json +34 -0
- package/template/AGENTS.md +20 -0
- package/template/api/effect/index.ts.handlebars +7 -39
- package/template/modern.config.ts.handlebars +8 -7
- package/template/oxfmt.config.ts +7 -0
- package/template/oxlint.config.ts +12 -0
- package/template/package.json.handlebars +21 -11
- package/template/scripts/bootstrap-agent-skills.mjs +103 -0
- package/template/scripts/validate-ultramodern.mjs.handlebars +84 -0
- package/template/tsconfig.json +106 -2
- package/template-workspace/.agents/rstackjs-agent-skills-LICENSE +21 -0
- package/template-workspace/.agents/skills/rsbuild-best-practices/SKILL.md +57 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/SKILL.md +96 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/command-map.md +113 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/common-analysis-patterns.md +190 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +88 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +138 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +71 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor.md +39 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +103 -0
- package/template-workspace/.agents/skills/rslib-best-practices/SKILL.md +58 -0
- package/template-workspace/.agents/skills/rslib-modern-package/SKILL.md +173 -0
- package/template-workspace/.agents/skills/rspack-best-practices/SKILL.md +70 -0
- package/template-workspace/.agents/skills/rspack-tracing/SKILL.md +75 -0
- package/template-workspace/.agents/skills/rspack-tracing/references/bottlenecks.md +47 -0
- package/template-workspace/.agents/skills/rspack-tracing/references/tracing-guide.md +38 -0
- package/template-workspace/.agents/skills/rspack-tracing/scripts/analyze_trace.js +184 -0
- package/template-workspace/.agents/skills/rstest-best-practices/SKILL.md +133 -0
- package/template-workspace/.agents/skills-lock.json +95 -0
- package/template-workspace/AGENTS.md +45 -0
- package/template-workspace/oxfmt.config.ts +7 -0
- package/template-workspace/oxlint.config.ts +12 -0
- package/template-workspace/pnpm-workspace.yaml +0 -2
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +106 -0
- package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +127 -0
- package/template/biome.json +0 -41
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Parse duration string (e.g., "1.23ms", "456.78µs", "0.12s") to milliseconds
|
|
7
|
+
function parseDuration(durationStr) {
|
|
8
|
+
if (!durationStr) return 0;
|
|
9
|
+
|
|
10
|
+
const match = durationStr.match(/^([\d.]+)(ms|µs|s|ns)$/);
|
|
11
|
+
if (!match) return 0;
|
|
12
|
+
|
|
13
|
+
const value = parseFloat(match[1]);
|
|
14
|
+
const unit = match[2];
|
|
15
|
+
|
|
16
|
+
switch (unit) {
|
|
17
|
+
case 's':
|
|
18
|
+
return value * 1000;
|
|
19
|
+
case 'ms':
|
|
20
|
+
return value;
|
|
21
|
+
case 'µs':
|
|
22
|
+
return value / 1000;
|
|
23
|
+
case 'ns':
|
|
24
|
+
return value / 1000000;
|
|
25
|
+
default:
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Get trace file path
|
|
31
|
+
const tracePath = process.argv[2] || path.join(__dirname, 'trace.json');
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(tracePath)) {
|
|
34
|
+
console.error(`Error: Trace file not found at ${tracePath}`);
|
|
35
|
+
console.error('Usage: node analyze_trace.js <path-to-trace.json>');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log(`Analyzing trace file: ${tracePath}\n`);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const fileContent = fs.readFileSync(tracePath, 'utf8');
|
|
43
|
+
|
|
44
|
+
// Parse line-delimited JSON
|
|
45
|
+
const events = fileContent
|
|
46
|
+
.trim()
|
|
47
|
+
.split('\n')
|
|
48
|
+
.map(line => {
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(line);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
.filter(Boolean);
|
|
56
|
+
|
|
57
|
+
if (!events.length) {
|
|
58
|
+
console.error('No valid trace events found.');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('=== Rspack Build Performance Analysis ===\n');
|
|
63
|
+
console.log(`Total events: ${events.length}\n`);
|
|
64
|
+
|
|
65
|
+
// Categorize events by target
|
|
66
|
+
const pluginStats = new Map();
|
|
67
|
+
const loaderStats = new Map();
|
|
68
|
+
|
|
69
|
+
events.forEach(event => {
|
|
70
|
+
const target = event.target;
|
|
71
|
+
const timeField = event.fields?.['time.busy'];
|
|
72
|
+
|
|
73
|
+
if (!timeField) return;
|
|
74
|
+
|
|
75
|
+
const duration = parseDuration(timeField);
|
|
76
|
+
|
|
77
|
+
if (target === 'Plugin Analysis') {
|
|
78
|
+
// Plugin performance
|
|
79
|
+
const pluginName = event.span?.name;
|
|
80
|
+
if (!pluginName) return;
|
|
81
|
+
|
|
82
|
+
if (!pluginStats.has(pluginName)) {
|
|
83
|
+
pluginStats.set(pluginName, {
|
|
84
|
+
count: 0,
|
|
85
|
+
total: 0,
|
|
86
|
+
max: 0,
|
|
87
|
+
min: Infinity,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const stat = pluginStats.get(pluginName);
|
|
92
|
+
stat.count++;
|
|
93
|
+
stat.total += duration;
|
|
94
|
+
stat.max = Math.max(stat.max, duration);
|
|
95
|
+
stat.min = Math.min(stat.min, duration);
|
|
96
|
+
} else if (target === 'Loader Analysis') {
|
|
97
|
+
// Loader performance
|
|
98
|
+
let loaderName = event.span?.name;
|
|
99
|
+
|
|
100
|
+
// For pitch phase (span.name is null), use resource path
|
|
101
|
+
if (!loaderName) {
|
|
102
|
+
const resource = event.fields?.resource;
|
|
103
|
+
if (resource) {
|
|
104
|
+
// Extract filename from resource path
|
|
105
|
+
const cleanResource = resource.replace(/^"|"$/g, ''); // Remove quotes
|
|
106
|
+
const filename = cleanResource.split('/').pop();
|
|
107
|
+
loaderName = `Loader pitch for ${filename}`;
|
|
108
|
+
} else {
|
|
109
|
+
loaderName = 'Loader pitch (unknown resource)';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!loaderStats.has(loaderName)) {
|
|
114
|
+
loaderStats.set(loaderName, {
|
|
115
|
+
count: 0,
|
|
116
|
+
total: 0,
|
|
117
|
+
max: 0,
|
|
118
|
+
min: Infinity,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const stat = loaderStats.get(loaderName);
|
|
123
|
+
stat.count++;
|
|
124
|
+
stat.total += duration;
|
|
125
|
+
stat.max = Math.max(stat.max, duration);
|
|
126
|
+
stat.min = Math.min(stat.min, duration);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Display Plugin Analysis
|
|
131
|
+
if (pluginStats.size > 0) {
|
|
132
|
+
console.log('🔌 Plugin Analysis (by name):');
|
|
133
|
+
console.log('─'.repeat(80));
|
|
134
|
+
|
|
135
|
+
const sortedPlugins = [...pluginStats.entries()].sort(
|
|
136
|
+
(a, b) => b[1].total - a[1].total,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
sortedPlugins.forEach(([name, stat]) => {
|
|
140
|
+
const avg = stat.total / stat.count;
|
|
141
|
+
console.log(`${name}`);
|
|
142
|
+
console.log(
|
|
143
|
+
` Total: ${stat.total.toFixed(2)}ms | Count: ${stat.count} | ` +
|
|
144
|
+
`Avg: ${avg.toFixed(2)}ms | Max: ${stat.max.toFixed(2)}ms | Min: ${stat.min.toFixed(2)}ms`,
|
|
145
|
+
);
|
|
146
|
+
console.log('');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const totalPluginTime = [...pluginStats.values()].reduce(
|
|
150
|
+
(sum, stat) => sum + stat.total,
|
|
151
|
+
0,
|
|
152
|
+
);
|
|
153
|
+
console.log(`Total Plugin Time: ${totalPluginTime.toFixed(2)}ms\n`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Display Loader Analysis
|
|
157
|
+
if (loaderStats.size > 0) {
|
|
158
|
+
console.log('\n🔧 Loader Analysis (by name):');
|
|
159
|
+
console.log('─'.repeat(80));
|
|
160
|
+
|
|
161
|
+
const sortedLoaders = [...loaderStats.entries()].sort(
|
|
162
|
+
(a, b) => b[1].total - a[1].total,
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
sortedLoaders.forEach(([name, stat]) => {
|
|
166
|
+
const avg = stat.total / stat.count;
|
|
167
|
+
console.log(`${name}`);
|
|
168
|
+
console.log(
|
|
169
|
+
` Total: ${stat.total.toFixed(2)}ms | Count: ${stat.count} | ` +
|
|
170
|
+
`Avg: ${avg.toFixed(2)}ms | Max: ${stat.max.toFixed(2)}ms | Min: ${stat.min.toFixed(2)}ms`,
|
|
171
|
+
);
|
|
172
|
+
console.log('');
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const totalLoaderTime = [...loaderStats.values()].reduce(
|
|
176
|
+
(sum, stat) => sum + stat.total,
|
|
177
|
+
0,
|
|
178
|
+
);
|
|
179
|
+
console.log(`Total Loader Time: ${totalLoaderTime.toFixed(2)}ms\n`);
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
console.error('Error processing trace file:', err);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rstest-best-practices
|
|
3
|
+
description: Rstest best practices for config, CLI workflow, test writing, mocking, snapshot testing, DOM testing, coverage, multi-project setup, CI integration, performance and debugging. Use when writing, reviewing, or troubleshooting Rstest test projects.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rstest Best Practices
|
|
7
|
+
|
|
8
|
+
Apply these rules when writing or reviewing Rstest test projects.
|
|
9
|
+
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
- Use `rstest.config.ts` and `defineConfig` from `@rstest/core`
|
|
13
|
+
- Prefer explicit imports `import { test, expect, describe } from '@rstest/core'` over `globals: true`
|
|
14
|
+
- For Rsbuild projects, use `@rstest/adapter-rsbuild` with `extends: withRsbuildConfig()` to reuse build config
|
|
15
|
+
- For Rslib projects, use `@rstest/adapter-rslib` with `extends: withRslibConfig()` to reuse build config
|
|
16
|
+
- Use `setupFiles` for shared test setup (e.g., custom matchers, cleanup hooks)
|
|
17
|
+
- When using Rsbuild plugins (e.g., `@rsbuild/plugin-react`), add them via the `plugins` field
|
|
18
|
+
- For deep-level or advanced build configuration needs, use `tools.rspack` or `tools.bundlerChain`
|
|
19
|
+
|
|
20
|
+
## CLI
|
|
21
|
+
|
|
22
|
+
- Use `rstest` or `rstest run` to run tests (`run` disables watch mode, suitable for CI)
|
|
23
|
+
- Use `rstest --watch` or `rstest watch` for local development with file watching
|
|
24
|
+
- Use `rstest list` to list all test files and test names
|
|
25
|
+
- Use `rstest -u` to update snapshots
|
|
26
|
+
- Use `--reporter=verbose` when debugging test failures for detailed output
|
|
27
|
+
- Use `--config` (`-c`) to specify a custom config file path
|
|
28
|
+
|
|
29
|
+
## Test writing
|
|
30
|
+
|
|
31
|
+
- Import test APIs from `@rstest/core`: `test`, `describe`, `expect`, `beforeEach`, `afterEach`, etc.
|
|
32
|
+
- Use `test` or `it` for test cases; use `describe` for grouping related tests
|
|
33
|
+
- Use `.only` to focus on specific tests during development, but never commit `.only` to the codebase
|
|
34
|
+
- Use `.skip` or `.todo` to mark incomplete or temporarily skipped tests
|
|
35
|
+
- Prefer small, focused test cases that test a single behavior
|
|
36
|
+
- For async error paths, prefer `await expect(fn()).rejects.toThrow(ErrorClass)` (or `.rejects.toMatchObject({ ... })`) over `try/catch` with `expect.fail` or `.catch(e => e)` patterns — the matcher form fails clearly if the promise unexpectedly resolves, keeps the assertion in one chain, and avoids forgetting to assert the throw at all
|
|
37
|
+
- For async happy paths, use `await expect(fn()).resolves.toEqual(...)` for the same reason
|
|
38
|
+
- Use `includeSource` for in-source testing of small utility functions (Rust-style `import.meta.rstest`)
|
|
39
|
+
- For in-source tests, wrap test code in `if (import.meta.rstest) { ... }` and define `import.meta.rstest` as `false` in production build config
|
|
40
|
+
|
|
41
|
+
## Test environment
|
|
42
|
+
|
|
43
|
+
- Use `testEnvironment: 'node'` (default) for Node.js / server-side code
|
|
44
|
+
- Use `testEnvironment: 'jsdom'` or `testEnvironment: 'happy-dom'` for DOM / browser API testing
|
|
45
|
+
- Install `jsdom` or `happy-dom` as a dev dependency when using DOM environments
|
|
46
|
+
- Prefer `happy-dom` for faster DOM testing; use `jsdom` when better browser API compatibility is needed
|
|
47
|
+
- For real browser testing, use `@rstest/browser` with Playwright
|
|
48
|
+
- Use inline project configs to run different test environments within one project (e.g., `node` and `jsdom` projects)
|
|
49
|
+
|
|
50
|
+
## React / Vue testing
|
|
51
|
+
|
|
52
|
+
- For React: use `@rsbuild/plugin-react` plugin and `@testing-library/react` for component testing
|
|
53
|
+
- For Vue: use `@rsbuild/plugin-vue` plugin and `@testing-library/vue` for component testing
|
|
54
|
+
- Create a `rstest.setup.ts` with `expect.extend(jestDomMatchers)` and `afterEach(() => cleanup())` for Testing Library
|
|
55
|
+
- Add the setup file to `setupFiles` in config
|
|
56
|
+
- For SSR testing, use `testEnvironment: 'node'` and test with `react-dom/server` or framework-specific SSR APIs
|
|
57
|
+
|
|
58
|
+
## Mocking
|
|
59
|
+
|
|
60
|
+
- Use `rs.mock('./module')` to mock modules
|
|
61
|
+
- Use `rs.fn()` to create mock functions
|
|
62
|
+
- Use `rs.spyOn(object, 'method')` to spy on methods
|
|
63
|
+
- Prefer `clearMocks`, `resetMocks`, or `restoreMocks` config options to automatically clean up mocks between tests
|
|
64
|
+
- Use factory functions in `rs.mock('./module', () => ({ ... }))` to provide mock implementations
|
|
65
|
+
|
|
66
|
+
## Snapshot testing
|
|
67
|
+
|
|
68
|
+
- Use `toMatchSnapshot()` for general snapshot testing
|
|
69
|
+
- Use `toMatchInlineSnapshot()` for small, readable inline snapshots
|
|
70
|
+
- Use `toMatchFileSnapshot()` for large or structured outputs (e.g., HTML, generated code)
|
|
71
|
+
- Keep snapshots concise — only include relevant data, avoid timestamps and session IDs
|
|
72
|
+
- Use `expect.addSnapshotSerializer()` to mask paths or sensitive data in snapshots
|
|
73
|
+
- Use `path-serializer` to normalize file paths across platforms
|
|
74
|
+
- Review snapshot changes carefully in code review
|
|
75
|
+
|
|
76
|
+
## Coverage
|
|
77
|
+
|
|
78
|
+
- Enable coverage with `--coverage` CLI flag or `coverage.enabled: true` in config
|
|
79
|
+
- Install `@rstest/coverage-istanbul` for the Istanbul coverage provider
|
|
80
|
+
- Use `coverage.include` to specify source files for coverage (e.g., `['src/**/*.{js,ts,tsx}']`)
|
|
81
|
+
- Use `coverage.thresholds` to enforce minimum coverage requirements
|
|
82
|
+
- Use `coverage.reporters` to generate reports in different formats (e.g., `text`, `lcov`, `html`)
|
|
83
|
+
|
|
84
|
+
## Multi-project testing
|
|
85
|
+
|
|
86
|
+
- Use `projects` field in root config to define multiple test projects
|
|
87
|
+
- For monorepos, use glob patterns like `'packages/*'` to auto-discover sub-projects
|
|
88
|
+
- Use `defineProject` helper in sub-project configs
|
|
89
|
+
- Extract shared config and use `mergeRstestConfig` to compose project configs
|
|
90
|
+
- Global options (`reporters`, `pool`, `isolate`, `coverage`, `bail`) must be set at the root level, not in projects
|
|
91
|
+
|
|
92
|
+
## CI integration
|
|
93
|
+
|
|
94
|
+
- Use `rstest run` (not `rstest watch`) in CI
|
|
95
|
+
- Use `--shard` for parallel test execution across CI machines (e.g., `--shard 1/3`)
|
|
96
|
+
- Use `--reporter=blob` with `rstest merge-reports` to combine sharded results
|
|
97
|
+
- Use `--reporter=junit` with `outputPath` for CI report integration
|
|
98
|
+
- The `github-actions` reporter is auto-enabled in GitHub Actions for inline error annotations
|
|
99
|
+
- Use `--bail` to stop early on first failure when appropriate
|
|
100
|
+
|
|
101
|
+
## Performance
|
|
102
|
+
|
|
103
|
+
- Disable `isolate` (`--no-isolate`) when tests have no side effects for faster execution via module cache reuse
|
|
104
|
+
- Use `pool.maxWorkers` to control parallelism based on available resources
|
|
105
|
+
- Keep test build fast by avoiding unnecessary Rspack plugins in test config
|
|
106
|
+
- Use test filtering (`rstest <pattern>` or `-t <name>`) to run only relevant tests during development
|
|
107
|
+
- Leverage watch mode's incremental re-runs for fast local feedback
|
|
108
|
+
|
|
109
|
+
## Debugging
|
|
110
|
+
|
|
111
|
+
- Run with `DEBUG=rstest` to enable debug mode, which writes final configs and build outputs to disk
|
|
112
|
+
- Read generated files in `dist/.rstest-temp/.rsbuild/` to confirm final Rstest/Rsbuild/Rspack config
|
|
113
|
+
- Use VS Code's JavaScript Debug Terminal to run `rstest` with breakpoints
|
|
114
|
+
- Use `--reporter=verbose` for detailed per-test output
|
|
115
|
+
- Use `--printConsoleTrace` to trace console calls to their source
|
|
116
|
+
- Add VS Code launch config for debugging specific test files with `@rstest/core/bin/rstest.js`
|
|
117
|
+
|
|
118
|
+
## Profiling
|
|
119
|
+
|
|
120
|
+
- Use Rsdoctor with `RSDOCTOR=true rstest run` to analyze test build performance
|
|
121
|
+
- Use `samply` for native profiling of both main and worker processes
|
|
122
|
+
- Use Node.js `--heap-prof` for memory profiling
|
|
123
|
+
|
|
124
|
+
## Toolchain integration
|
|
125
|
+
|
|
126
|
+
- Use the official VS Code extension (`rstack.rstest`) for in-editor test running and debugging
|
|
127
|
+
- For Rslib libraries, use `@rstest/adapter-rslib` for config reuse
|
|
128
|
+
- For Rsbuild apps, use `@rstest/adapter-rsbuild` for config reuse
|
|
129
|
+
- Use `process.env.RSTEST` to detect test environment and apply test-specific config
|
|
130
|
+
|
|
131
|
+
## Documentation
|
|
132
|
+
|
|
133
|
+
- For the latest Rstest docs, read https://rstest.rs/llms.txt
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"source": {
|
|
4
|
+
"repository": "https://github.com/rstackjs/agent-skills",
|
|
5
|
+
"commit": "61c948b42512e223bad44b83af4080eba48b2677",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"licensePath": ".agents/rstackjs-agent-skills-LICENSE"
|
|
8
|
+
},
|
|
9
|
+
"installDir": ".agents/skills",
|
|
10
|
+
"sources": [
|
|
11
|
+
{
|
|
12
|
+
"id": "rstack-agent-skills",
|
|
13
|
+
"visibility": "public",
|
|
14
|
+
"repository": "https://github.com/rstackjs/agent-skills",
|
|
15
|
+
"commit": "61c948b42512e223bad44b83af4080eba48b2677",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"licensePath": ".agents/rstackjs-agent-skills-LICENSE",
|
|
18
|
+
"install": "vendored"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "techsiocz-private",
|
|
22
|
+
"visibility": "private",
|
|
23
|
+
"repository": "https://github.com/TechsioCZ/skills",
|
|
24
|
+
"install": "clone-if-authorized",
|
|
25
|
+
"baseline": [
|
|
26
|
+
{
|
|
27
|
+
"name": "plan-graph",
|
|
28
|
+
"reason": "Build and validate DAGs from .plan.md files"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "dag",
|
|
32
|
+
"reason": "Inspect current plan frontiers and blocked lanes"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "subagent-graph",
|
|
36
|
+
"reason": "Design dependency-aware multi-agent launch graphs"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "helm",
|
|
40
|
+
"reason": "Steer already-running multi-agent work"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "debugger-mode",
|
|
44
|
+
"reason": "Run hypothesis-driven debugging with runtime evidence"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"baseline": [
|
|
50
|
+
{
|
|
51
|
+
"name": "rsbuild-best-practices",
|
|
52
|
+
"path": ".agents/skills/rsbuild-best-practices",
|
|
53
|
+
"reason": "Modern.js application build configuration and Rsbuild troubleshooting"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "rspack-best-practices",
|
|
57
|
+
"path": ".agents/skills/rspack-best-practices",
|
|
58
|
+
"reason": "Rspack bundling, CSS, asset, profiling, and production behavior"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "rspack-tracing",
|
|
62
|
+
"path": ".agents/skills/rspack-tracing",
|
|
63
|
+
"reason": "Trace-backed Rspack failure and performance debugging"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "rsdoctor-analysis",
|
|
67
|
+
"path": ".agents/skills/rsdoctor-analysis",
|
|
68
|
+
"reason": "Evidence-backed bundle composition, duplication, and retained-module analysis"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "rslib-best-practices",
|
|
72
|
+
"path": ".agents/skills/rslib-best-practices",
|
|
73
|
+
"reason": "Rslib shared package and design-system library authoring"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "rslib-modern-package",
|
|
77
|
+
"path": ".agents/skills/rslib-modern-package",
|
|
78
|
+
"reason": "Modern package contracts, exports, declarations, side effects, and release readiness"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "rstest-best-practices",
|
|
82
|
+
"path": ".agents/skills/rstest-best-practices",
|
|
83
|
+
"reason": "Rstest configuration, test writing, mocking, snapshots, coverage, and CI behavior"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"excludedByDefault": [
|
|
87
|
+
"migrate-to-rsbuild",
|
|
88
|
+
"migrate-to-rslib",
|
|
89
|
+
"migrate-to-rslint",
|
|
90
|
+
"migrate-to-rstest",
|
|
91
|
+
"rsbuild-v2-upgrade",
|
|
92
|
+
"rspack-v2-upgrade",
|
|
93
|
+
"rspress-v2-upgrade"
|
|
94
|
+
]
|
|
95
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# UltraModern Agent Contract
|
|
2
|
+
|
|
3
|
+
This workspace is generated as an agent-ready UltraModern.js SuperApp. Agents should treat the files under `.agents/skills` as local project instructions, not optional reading.
|
|
4
|
+
|
|
5
|
+
## Quality Gates
|
|
6
|
+
|
|
7
|
+
- `pnpm lint` runs Oxlint with the Ultracite preset.
|
|
8
|
+
- `pnpm format` runs oxfmt.
|
|
9
|
+
- `pnpm typecheck` runs effect-tsgo as the TypeScript checker.
|
|
10
|
+
- `pnpm check` runs formatting, linting, effect-tsgo, private-skill availability checks, and the generated workspace contract.
|
|
11
|
+
|
|
12
|
+
## Required Skill Baseline
|
|
13
|
+
|
|
14
|
+
Use these skills when the task touches the matching subsystem:
|
|
15
|
+
|
|
16
|
+
- `rsbuild-best-practices`: Modern.js app build configuration, Rsbuild options, assets, type checking, and build debugging.
|
|
17
|
+
- `rspack-best-practices`: Rspack-level bundling, CSS, assets, profiling, and production build behavior.
|
|
18
|
+
- `rspack-tracing`: Rspack build failures, slow builds, crash localization, and trace analysis.
|
|
19
|
+
- `rsdoctor-analysis`: Evidence-based bundle analysis from `rsdoctor-data.json`, including duplicate packages, large chunks, and retained modules.
|
|
20
|
+
- `rslib-best-practices`: Shared packages, generated libraries, declaration output, and Rslib configuration.
|
|
21
|
+
- `rslib-modern-package`: Package contracts for shared libraries, exports, side effects, dependency placement, README, and release readiness.
|
|
22
|
+
- `rstest-best-practices`: Rstest configuration, test writing, mocking, snapshots, coverage, and CI test behavior.
|
|
23
|
+
|
|
24
|
+
## Private Skills
|
|
25
|
+
|
|
26
|
+
ScriptedAlchemy/TechsioCZ skills are private and are cloned only when the current developer is authorized for `TechsioCZ/skills`.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm skills:install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The installer copies only the allowlisted private skills from `.agents/skills-lock.json`: `plan-graph`, `dag`, `subagent-graph`, `helm`, and `debugger-mode`.
|
|
33
|
+
|
|
34
|
+
## Project Priorities
|
|
35
|
+
|
|
36
|
+
- Keep `presetUltramodern` as the single preset.
|
|
37
|
+
- Prefer Effect for BFF/service code.
|
|
38
|
+
- Prefer TanStack Router for app routing.
|
|
39
|
+
- Keep design-system code as a normal Micro Frontend or shared package, not a special core path.
|
|
40
|
+
- Keep generated packages explicit and publishable: stable `exports`, correct declarations, small public APIs, and clear ownership metadata.
|
|
41
|
+
- Do not add migration tooling or codemods unless the project owner explicitly asks for migration work.
|
|
42
|
+
|
|
43
|
+
## Skill Provenance
|
|
44
|
+
|
|
45
|
+
The vendored Rstack skills and private TechsioCZ skill allowlist are pinned in `.agents/skills-lock.json`. Do not update, remove, or replace them casually. If a skill needs updating, update the lock file and run `pnpm check`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
import core from "ultracite/oxlint/core";
|
|
3
|
+
import react from "ultracite/oxlint/react";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
env: {
|
|
7
|
+
browser: true,
|
|
8
|
+
node: true,
|
|
9
|
+
},
|
|
10
|
+
extends: [core, react],
|
|
11
|
+
ignorePatterns: ["dist", "node_modules", ".modern", ".modernjs", "**/routeTree.gen.ts"],
|
|
12
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const root = process.cwd();
|
|
7
|
+
const lockPath = path.join(root, '.agents/skills-lock.json');
|
|
8
|
+
const checkOnly = process.argv.includes('--check');
|
|
9
|
+
const force = process.argv.includes('--force');
|
|
10
|
+
|
|
11
|
+
function readJson(filePath) {
|
|
12
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function run(command, args, options = {}) {
|
|
16
|
+
return execFileSync(command, args, {
|
|
17
|
+
cwd: options.cwd ?? root,
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function cloneSource(source, targetDir) {
|
|
24
|
+
const repo = source.repository.replace(/^https:\/\/github.com\//, '');
|
|
25
|
+
try {
|
|
26
|
+
run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
} catch {
|
|
31
|
+
run('git', ['clone', '--depth', '1', source.repository, targetDir], {
|
|
32
|
+
stdio: 'inherit',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function resolveSkillDir(sourceRoot, skillName) {
|
|
38
|
+
const candidates = [
|
|
39
|
+
path.join(sourceRoot, skillName),
|
|
40
|
+
path.join(sourceRoot, 'skills', skillName),
|
|
41
|
+
path.join(sourceRoot, 'skills', 'engineering', skillName),
|
|
42
|
+
path.join(sourceRoot, 'skills', 'productivity', skillName),
|
|
43
|
+
];
|
|
44
|
+
return candidates.find(candidate =>
|
|
45
|
+
fs.existsSync(path.join(candidate, 'SKILL.md')),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!fs.existsSync(lockPath)) {
|
|
50
|
+
console.error('Missing .agents/skills-lock.json');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const lock = readJson(lockPath);
|
|
55
|
+
const installDir = path.join(root, lock.installDir ?? '.agents/skills');
|
|
56
|
+
const privateSources = (lock.sources ?? []).filter(
|
|
57
|
+
source => source.install === 'clone-if-authorized',
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (checkOnly) {
|
|
61
|
+
const missing = privateSources.flatMap(source =>
|
|
62
|
+
(source.baseline ?? [])
|
|
63
|
+
.map(skill => skill.name)
|
|
64
|
+
.filter(
|
|
65
|
+
skillName =>
|
|
66
|
+
!fs.existsSync(path.join(installDir, skillName, 'SKILL.md')),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
if (missing.length > 0) {
|
|
70
|
+
console.warn(
|
|
71
|
+
`Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
console.log('Agent skills are installed.');
|
|
75
|
+
}
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
80
|
+
|
|
81
|
+
for (const source of privateSources) {
|
|
82
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));
|
|
83
|
+
try {
|
|
84
|
+
cloneSource(source, tempDir);
|
|
85
|
+
for (const skill of source.baseline ?? []) {
|
|
86
|
+
const sourceSkillDir = resolveSkillDir(tempDir, skill.name);
|
|
87
|
+
if (!sourceSkillDir) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`Skill ${skill.name} not found in ${source.repository}`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
const targetSkillDir = path.join(installDir, skill.name);
|
|
93
|
+
if (fs.existsSync(targetSkillDir)) {
|
|
94
|
+
if (!force) {
|
|
95
|
+
console.log(`Skipping existing ${skill.name}`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
fs.rmSync(targetSkillDir, { recursive: true, force: true });
|
|
99
|
+
}
|
|
100
|
+
fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });
|
|
101
|
+
console.log(`Installed ${skill.name}`);
|
|
102
|
+
}
|
|
103
|
+
} finally {
|
|
104
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
105
|
+
}
|
|
106
|
+
}
|