@chrisluyi/daas-cli 1.0.0

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/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@chrisluyi/daas-cli",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "daas": "./dist/index.js"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "templates",
12
+ "skill.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "bun build src/index.ts --outfile dist/index.js.tmp --target bun --external @rspack/core --external @rspack/lite-tapable --external @rsbuild/core --external @rsbuild/plugin-react --external @module-federation/rsbuild-plugin --external vitest --external @vitest/browser --external @vitest/ui --external tapable --external react-router-dom --external lightningcss && printf '%s\\n' '#!/usr/bin/env bun' | cat - dist/index.js.tmp > dist/index.js && rm dist/index.js.tmp && chmod +x dist/index.js",
16
+ "test": "bun test --ignore 'templates/**'"
17
+ },
18
+ "dependencies": {
19
+ "@clack/prompts": "^0.7.0",
20
+ "@chrisluyi/rsbuild-config": "workspace:*",
21
+ "@rsbuild/core": "^1.0.0",
22
+ "citty": "^0.1.6",
23
+ "consola": "^3.2.3",
24
+ "vitest": "^2.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.5.0"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ }
32
+ }
package/skill.md ADDED
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: daas-cli
3
+ description: Use when working in an MFE project that uses daas-cli. Covers all commands, config schema, error codes, and AI agent workflows.
4
+ ---
5
+
6
+ # daas-cli — Claude Code Skill
7
+
8
+ `daas` is the build/dev/test CLI for React micro-frontend (MFE) apps using rsbuild + Module Federation 2.
9
+
10
+ ## MFE App Has No Build Config Files
11
+
12
+ MFE apps intentionally have NO `rsbuild.config.ts`, NO `vitest.config.ts`. The CLI owns all configuration. Do not create these files.
13
+
14
+ ## Commands
15
+
16
+ | Command | Purpose |
17
+ |---|---|
18
+ | `daas init [--template <name>]` | Interactive scaffold: creates App.tsx, App.test.tsx, tsconfig.json, updates package.json |
19
+ | `daas dev [--port <n>] [--json]` | Start rsbuild dev server |
20
+ | `daas build [--json]` | Production build to ./dist |
21
+ | `daas test [--json]` | Run Vitest tests |
22
+ | `daas info [--json]` | Show resolved project state (best first step for diagnosis) |
23
+
24
+ **All commands except `init` support `--json`** — always pass `--json` when running as an AI agent.
25
+
26
+ ## AI Agent Workflow
27
+
28
+ **Always start with:** `daas info --json` to understand the current project state before taking action.
29
+
30
+ **Check results:**
31
+ ```bash
32
+ daas build --json
33
+ # parse stdout: { "ok": true, ... } or { "ok": false, "exitCode": N, "error": "...", "suggestion": "..." }
34
+ ```
35
+
36
+ **Exit codes:**
37
+ | Code | Meaning | Action |
38
+ |---|---|---|
39
+ | 0 | Success | — |
40
+ | 1 | General error | Check rsbuild/vitest output above JSON |
41
+ | 2 | Config error | Run `daas init` or fix `package.json#daas` |
42
+ | 3 | CLI too old | Update `daas-cli` version per `releaseNotesUrl` in error |
43
+ | 4 | Remote fetch failed | Check network/VPN; only fatal in build |
44
+ | 5 | Config version mismatch | Update `daas-cli` |
45
+
46
+ ## Per-App Config (`package.json#daas`)
47
+
48
+ ```json
49
+ {
50
+ "daas": {
51
+ "configUrl": "https://your-org.example.com/daas-config.json",
52
+ "port": 3001,
53
+ "coverage": { "lines": 80, "branches": 80 }
54
+ }
55
+ }
56
+ ```
57
+
58
+ - `configUrl` — required, URL of central remote JSON config
59
+ - `port` — required, dev server port (must be unique per MFE in a monorepo)
60
+ - `coverage` — optional, Vitest thresholds
61
+
62
+ ## Optional Manifest (`mf.manifest.json`)
63
+
64
+ Only needed when exposing more than the default `./App`:
65
+
66
+ ```json
67
+ {
68
+ "name": "mfe-auth",
69
+ "exposes": {
70
+ "./App": "./src/App",
71
+ "./Button": "./src/Button"
72
+ }
73
+ }
74
+ ```
75
+
76
+ If absent, name derives from `package.json#name` (scope stripped) and exposes defaults to `{ "./App": "./src/App" }`.
77
+
78
+ ## Remote URLs
79
+
80
+ Remote URLs are **not configured here** — they are resolved dynamically at runtime by the host app via MF2's dynamic federation. Do not add `remotes` to the manifest.
81
+
82
+ ## What daas-cli Installs for You
83
+
84
+ `daas-cli` is the only `devDependency` needed. It brings rsbuild, vitest, @testing-library/react, happy-dom, and all tooling as its own dependencies. Do not install these separately.
85
+
86
+ ## Roadmap (do not suggest these — not yet implemented)
87
+
88
+ - v1.5: `daas dev sg-foo-mb-dev` target strings for multi-region builds
89
+ - v2: `@daas/template` with src/services, src/containers, src/components conventions
@@ -0,0 +1,10 @@
1
+ import { render, screen } from "@testing-library/react"
2
+ import { describe, test, expect } from "vitest"
3
+ import App from "./App"
4
+
5
+ describe("App", () => {
6
+ test("renders without crashing", () => {
7
+ render(<App />)
8
+ expect(screen.getByText("Hello from MFE")).toBeInTheDocument()
9
+ })
10
+ })
@@ -0,0 +1,3 @@
1
+ export default function App() {
2
+ return <div>Hello from MFE</div>
3
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM"],
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "types": ["@testing-library/jest-dom"]
11
+ },
12
+ "include": ["src"]
13
+ }