qzkpwoxtl 0.1.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/README.md +378 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +4214 -0
- package/package.json +49 -0
- package/registry.json +61 -0
- package/templates/api-nest/.editorconfig +15 -0
- package/templates/api-nest/.env.example +12 -0
- package/templates/api-nest/CHANGELOG.md +59 -0
- package/templates/api-nest/README.md +443 -0
- package/templates/api-nest/ai/common.md +6 -0
- package/templates/api-nest/drizzle/seed.ts +30 -0
- package/templates/api-nest/drizzle.config.ts +13 -0
- package/templates/api-nest/images/architecture.png +0 -0
- package/templates/api-nest/nest-cli.json +8 -0
- package/templates/api-nest/package.json +110 -0
- package/templates/api-nest/public/.gitkeep +0 -0
- package/templates/api-nest/scripts/start.sh +7 -0
- package/templates/api-nest/src/app.controller.ts +55 -0
- package/templates/api-nest/src/app.module.ts +58 -0
- package/templates/api-nest/src/core/config/configuration.ts +42 -0
- package/templates/api-nest/src/core/constants/error-code.ts +101 -0
- package/templates/api-nest/src/core/constants/index.ts +1 -0
- package/templates/api-nest/src/core/decorators/current-user.decorator.ts +9 -0
- package/templates/api-nest/src/core/decorators/public.decorators.ts +31 -0
- package/templates/api-nest/src/core/exceptions/business.exception.spec.ts +165 -0
- package/templates/api-nest/src/core/exceptions/business.exception.ts +157 -0
- package/templates/api-nest/src/core/exceptions/index.ts +1 -0
- package/templates/api-nest/src/core/filters/http-exception.filter.spec.ts +137 -0
- package/templates/api-nest/src/core/filters/http-exception.filter.ts +133 -0
- package/templates/api-nest/src/core/interceptors/logging.interceptor.spec.ts +125 -0
- package/templates/api-nest/src/core/interceptors/logging.interceptor.ts +50 -0
- package/templates/api-nest/src/core/interceptors/metrics.interceptor.ts +43 -0
- package/templates/api-nest/src/core/interceptors/response.interceptor.spec.ts +105 -0
- package/templates/api-nest/src/core/interceptors/response.interceptor.ts +43 -0
- package/templates/api-nest/src/dao/entities/user.entity.ts +7 -0
- package/templates/api-nest/src/dao/repositories/user.repository.spec.ts +119 -0
- package/templates/api-nest/src/dao/repositories/user.repository.ts +36 -0
- package/templates/api-nest/src/main.ts +86 -0
- package/templates/api-nest/src/modules/auth/auth.controller.spec.ts +56 -0
- package/templates/api-nest/src/modules/auth/auth.controller.ts +70 -0
- package/templates/api-nest/src/modules/auth/auth.guard.spec.ts +118 -0
- package/templates/api-nest/src/modules/auth/auth.guard.ts +57 -0
- package/templates/api-nest/src/modules/auth/auth.module.ts +30 -0
- package/templates/api-nest/src/modules/auth/auth.service.spec.ts +73 -0
- package/templates/api-nest/src/modules/auth/auth.service.ts +27 -0
- package/templates/api-nest/src/modules/auth/dto/login.dto.ts +12 -0
- package/templates/api-nest/src/modules/auth/dto/refresh.dto.ts +12 -0
- package/templates/api-nest/src/modules/common/common.controller.spec.ts +49 -0
- package/templates/api-nest/src/modules/common/common.controller.ts +64 -0
- package/templates/api-nest/src/modules/common/common.module.ts +9 -0
- package/templates/api-nest/src/modules/common/common.service.spec.ts +23 -0
- package/templates/api-nest/src/modules/common/common.service.ts +8 -0
- package/templates/api-nest/src/modules/common/dto/hello.dto.ts +12 -0
- package/templates/api-nest/src/modules/health/health.controller.spec.ts +44 -0
- package/templates/api-nest/src/modules/health/health.controller.ts +12 -0
- package/templates/api-nest/src/modules/health/health.module.ts +9 -0
- package/templates/api-nest/src/modules/health/health.service.spec.ts +50 -0
- package/templates/api-nest/src/modules/health/health.service.ts +27 -0
- package/templates/api-nest/src/modules/metrics/metrics.module.ts +34 -0
- package/templates/api-nest/src/modules/user/dto/create-user.dto.ts +17 -0
- package/templates/api-nest/src/modules/user/user.controller.spec.ts +54 -0
- package/templates/api-nest/src/modules/user/user.controller.ts +40 -0
- package/templates/api-nest/src/modules/user/user.module.ts +22 -0
- package/templates/api-nest/src/modules/user/user.service.spec.ts +51 -0
- package/templates/api-nest/src/modules/user/user.service.ts +22 -0
- package/templates/api-nest/src/service/drizzle/drizzle.module.ts +9 -0
- package/templates/api-nest/src/service/drizzle/drizzle.service.ts +52 -0
- package/templates/api-nest/src/service/drizzle/schema.ts +18 -0
- package/templates/api-nest/src/shared/dto/pagination.dto.ts +33 -0
- package/templates/api-nest/src/shared/interfaces/.gitkeep +0 -0
- package/templates/api-nest/src/shared/types/.gitkeep +0 -0
- package/templates/api-nest/src/shared/utils/index.spec.ts +28 -0
- package/templates/api-nest/src/shared/utils/index.ts +14 -0
- package/templates/api-nest/src/shared/utils/logger.ts +84 -0
- package/templates/api-nest/test/app.e2e-spec.ts +31 -0
- package/templates/api-nest/test/jest-e2e.json +9 -0
- package/templates/api-nest/tsconfig.build.json +11 -0
- package/templates/api-nest/tsconfig.json +26 -0
- package/templates/library-ts/README.md +36 -0
- package/templates/library-ts/ai/common.md +6 -0
- package/templates/library-ts/package.json +49 -0
- package/templates/library-ts/src/index.test.ts +21 -0
- package/templates/library-ts/src/index.ts +24 -0
- package/templates/library-ts/tsconfig.json +16 -0
- package/templates/library-ts/tsdown.config.ts +8 -0
- package/templates/library-ts/vitest.config.ts +12 -0
- package/templates/mobile-rn-expo/.env.example +2 -0
- package/templates/mobile-rn-expo/README.md +118 -0
- package/templates/mobile-rn-expo/ai/common.md +6 -0
- package/templates/mobile-rn-expo/app.json +48 -0
- package/templates/mobile-rn-expo/babel.config.js +6 -0
- package/templates/mobile-rn-expo/global.css +77 -0
- package/templates/mobile-rn-expo/images/architecture.png +0 -0
- package/templates/mobile-rn-expo/jest.config.cjs +6 -0
- package/templates/mobile-rn-expo/metro.config.js +11 -0
- package/templates/mobile-rn-expo/nativewind-env.d.ts +1 -0
- package/templates/mobile-rn-expo/package.json +91 -0
- package/templates/mobile-rn-expo/scripts/reset-project.js +112 -0
- package/templates/mobile-rn-expo/src/api/auth.ts +9 -0
- package/templates/mobile-rn-expo/src/api/common.ts +15 -0
- package/templates/mobile-rn-expo/src/api/index.ts +0 -0
- package/templates/mobile-rn-expo/src/api/token.ts +22 -0
- package/templates/mobile-rn-expo/src/app/(tabs)/_layout.tsx +40 -0
- package/templates/mobile-rn-expo/src/app/(tabs)/explore.tsx +18 -0
- package/templates/mobile-rn-expo/src/app/(tabs)/index.tsx +83 -0
- package/templates/mobile-rn-expo/src/app/+not-found.tsx +30 -0
- package/templates/mobile-rn-expo/src/app/_layout.tsx +61 -0
- package/templates/mobile-rn-expo/src/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/templates/mobile-rn-expo/src/assets/images/adaptive-icon.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/favicon.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/icon.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/partial-react-logo.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/react-logo.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/react-logo@2x.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/react-logo@3x.png +0 -0
- package/templates/mobile-rn-expo/src/assets/images/splash-icon.png +0 -0
- package/templates/mobile-rn-expo/src/components/Collapsible.tsx +47 -0
- package/templates/mobile-rn-expo/src/components/ExternalLink.tsx +25 -0
- package/templates/mobile-rn-expo/src/components/HapticTab.tsx +19 -0
- package/templates/mobile-rn-expo/src/components/HelloWave.tsx +41 -0
- package/templates/mobile-rn-expo/src/components/ThemedText.tsx +64 -0
- package/templates/mobile-rn-expo/src/components/ThemedView.tsx +15 -0
- package/templates/mobile-rn-expo/src/components/__tests__/ThemedText-test.tsx +9 -0
- package/templates/mobile-rn-expo/src/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +24 -0
- package/templates/mobile-rn-expo/src/components/ui/IconSymbol.ios.tsx +33 -0
- package/templates/mobile-rn-expo/src/components/ui/IconSymbol.tsx +42 -0
- package/templates/mobile-rn-expo/src/components/ui/TabBarBackground.ios.tsx +23 -0
- package/templates/mobile-rn-expo/src/components/ui/TabBarBackground.tsx +6 -0
- package/templates/mobile-rn-expo/src/constants/api.ts +1 -0
- package/templates/mobile-rn-expo/src/constants/colors.ts +26 -0
- package/templates/mobile-rn-expo/src/hooks/setup/index.ts +48 -0
- package/templates/mobile-rn-expo/src/hooks/setup/swr.ts +64 -0
- package/templates/mobile-rn-expo/src/hooks/useAuth.ts +38 -0
- package/templates/mobile-rn-expo/src/hooks/useColorScheme.ts +1 -0
- package/templates/mobile-rn-expo/src/hooks/useThemeColor.ts +21 -0
- package/templates/mobile-rn-expo/src/lib/auth/jwt.ts +104 -0
- package/templates/mobile-rn-expo/src/lib/axios.ts +80 -0
- package/templates/mobile-rn-expo/src/lib/error.ts +19 -0
- package/templates/mobile-rn-expo/src/lib/helper.ts +15 -0
- package/templates/mobile-rn-expo/src/lib/index.ts +0 -0
- package/templates/mobile-rn-expo/src/lib/mmkv.ts +3 -0
- package/templates/mobile-rn-expo/src/store/config.ts +38 -0
- package/templates/mobile-rn-expo/src/store/index.ts +0 -0
- package/templates/mobile-rn-expo/src/store/secure.ts +39 -0
- package/templates/mobile-rn-expo/src/store/session.ts +18 -0
- package/templates/mobile-rn-expo/src/types/auth.ts +3 -0
- package/templates/mobile-rn-expo/src/types/common.ts +3 -0
- package/templates/mobile-rn-expo/src/types/index.ts +5 -0
- package/templates/mobile-rn-expo/tailwind.config.js +182 -0
- package/templates/mobile-rn-expo/tsconfig.json +11 -0
- package/templates/web-csr-react/.editorconfig +52 -0
- package/templates/web-csr-react/.env.example +4 -0
- package/templates/web-csr-react/README.md +104 -0
- package/templates/web-csr-react/ai/common.md +6 -0
- package/templates/web-csr-react/components.json +21 -0
- package/templates/web-csr-react/index.html +13 -0
- package/templates/web-csr-react/package.json +58 -0
- package/templates/web-csr-react/public/vite.svg +1 -0
- package/templates/web-csr-react/src/App.tsx +53 -0
- package/templates/web-csr-react/src/api/auth.ts +37 -0
- package/templates/web-csr-react/src/api/demo.ts +19 -0
- package/templates/web-csr-react/src/api/users.ts +44 -0
- package/templates/web-csr-react/src/assets/react.svg +1 -0
- package/templates/web-csr-react/src/components/ErrorBoundary.tsx +151 -0
- package/templates/web-csr-react/src/components/ui/alert.tsx +43 -0
- package/templates/web-csr-react/src/components/ui/badge.tsx +30 -0
- package/templates/web-csr-react/src/components/ui/button.tsx +48 -0
- package/templates/web-csr-react/src/components/ui/card.tsx +62 -0
- package/templates/web-csr-react/src/components/ui/input.tsx +23 -0
- package/templates/web-csr-react/src/components/ui/label.tsx +17 -0
- package/templates/web-csr-react/src/components/ui/sonner.tsx +17 -0
- package/templates/web-csr-react/src/hooks/useToast.ts +3 -0
- package/templates/web-csr-react/src/lib/app-info.ts +43 -0
- package/templates/web-csr-react/src/lib/http.ts +114 -0
- package/templates/web-csr-react/src/lib/index.ts +3 -0
- package/templates/web-csr-react/src/lib/stores/index.ts +1 -0
- package/templates/web-csr-react/src/lib/stores/theme.ts +34 -0
- package/templates/web-csr-react/src/lib/stores/toast.ts +224 -0
- package/templates/web-csr-react/src/lib/toast.ts +222 -0
- package/templates/web-csr-react/src/lib/utils.ts +43 -0
- package/templates/web-csr-react/src/main.tsx +22 -0
- package/templates/web-csr-react/src/pages/Home.tsx +581 -0
- package/templates/web-csr-react/src/providers/SWRProvider.tsx +20 -0
- package/templates/web-csr-react/src/providers/ThemeProvider.tsx +24 -0
- package/templates/web-csr-react/src/router/routes.tsx +10 -0
- package/templates/web-csr-react/src/styles/index.css +5 -0
- package/templates/web-csr-react/src/styles/reset.css +114 -0
- package/templates/web-csr-react/src/styles/tailwind.css +153 -0
- package/templates/web-csr-react/src/styles/tokens.css +201 -0
- package/templates/web-csr-react/src/types/api.ts +35 -0
- package/templates/web-csr-react/src/types/env.d.ts +12 -0
- package/templates/web-csr-react/src/vite-env.d.ts +1 -0
- package/templates/web-csr-react/tsconfig.app.json +39 -0
- package/templates/web-csr-react/tsconfig.json +4 -0
- package/templates/web-csr-react/tsconfig.node.json +25 -0
- package/templates/web-csr-react/vite.config.ts +42 -0
- package/templates/web-docs-starlight/README.md +30 -0
- package/templates/web-docs-starlight/ai/common.md +6 -0
- package/templates/web-docs-starlight/astro.config.mjs +24 -0
- package/templates/web-docs-starlight/package.json +31 -0
- package/templates/web-docs-starlight/public/favicon.svg +1 -0
- package/templates/web-docs-starlight/src/assets/houston.webp +0 -0
- package/templates/web-docs-starlight/src/content/docs/guides/example.md +11 -0
- package/templates/web-docs-starlight/src/content/docs/index.mdx +37 -0
- package/templates/web-docs-starlight/src/content/docs/reference/example.md +11 -0
- package/templates/web-docs-starlight/src/content.config.ts +7 -0
- package/templates/web-docs-starlight/src/styles/custom.css +65 -0
- package/templates/web-docs-starlight/tsconfig.json +5 -0
- package/templates/web-ssg-astro/.env.example +3 -0
- package/templates/web-ssg-astro/README.md +77 -0
- package/templates/web-ssg-astro/ai/common.md +6 -0
- package/templates/web-ssg-astro/astro.config.mjs +10 -0
- package/templates/web-ssg-astro/package.json +39 -0
- package/templates/web-ssg-astro/public/favicon.svg +9 -0
- package/templates/web-ssg-astro/src/api/demo.ts +30 -0
- package/templates/web-ssg-astro/src/assets/astro.svg +1 -0
- package/templates/web-ssg-astro/src/assets/background.svg +1 -0
- package/templates/web-ssg-astro/src/components/ErrorBoundary.astro +146 -0
- package/templates/web-ssg-astro/src/components/Welcome.astro +387 -0
- package/templates/web-ssg-astro/src/layouts/Layout.astro +39 -0
- package/templates/web-ssg-astro/src/pages/404.astro +171 -0
- package/templates/web-ssg-astro/src/pages/index.astro +8 -0
- package/templates/web-ssg-astro/src/styles/global.css +13 -0
- package/templates/web-ssg-astro/src/styles/tokens.css +96 -0
- package/templates/web-ssg-astro/src/utils/api.ts +127 -0
- package/templates/web-ssg-astro/src/utils/toast.ts +234 -0
- package/templates/web-ssg-astro/tsconfig.json +5 -0
- package/templates/web-ssr-next/.editorconfig +32 -0
- package/templates/web-ssr-next/.env.example +3 -0
- package/templates/web-ssr-next/README.md +86 -0
- package/templates/web-ssr-next/ai/common.md +6 -0
- package/templates/web-ssr-next/components.json +21 -0
- package/templates/web-ssr-next/next-env.d.ts +6 -0
- package/templates/web-ssr-next/next.config.ts +8 -0
- package/templates/web-ssr-next/package.json +58 -0
- package/templates/web-ssr-next/postcss.config.mjs +5 -0
- package/templates/web-ssr-next/public/file.svg +1 -0
- package/templates/web-ssr-next/public/globe.svg +1 -0
- package/templates/web-ssr-next/public/next.svg +1 -0
- package/templates/web-ssr-next/public/vercel.svg +1 -0
- package/templates/web-ssr-next/public/window.svg +1 -0
- package/templates/web-ssr-next/src/api/hello.ts +21 -0
- package/templates/web-ssr-next/src/app/api/hello/route.ts +32 -0
- package/templates/web-ssr-next/src/app/favicon.ico +0 -0
- package/templates/web-ssr-next/src/app/global-error.tsx +18 -0
- package/templates/web-ssr-next/src/app/globals.css +152 -0
- package/templates/web-ssr-next/src/app/layout.tsx +45 -0
- package/templates/web-ssr-next/src/app/page.tsx +176 -0
- package/templates/web-ssr-next/src/components/counter-demo.tsx +29 -0
- package/templates/web-ssr-next/src/components/optimized-swr-demo-new.tsx +285 -0
- package/templates/web-ssr-next/src/components/ssr-comparison.tsx +67 -0
- package/templates/web-ssr-next/src/components/theme-provider.tsx +8 -0
- package/templates/web-ssr-next/src/components/theme-toggle.tsx +33 -0
- package/templates/web-ssr-next/src/components/toast-demo.tsx +190 -0
- package/templates/web-ssr-next/src/components/ui/avatar.tsx +47 -0
- package/templates/web-ssr-next/src/components/ui/badge.tsx +40 -0
- package/templates/web-ssr-next/src/components/ui/button.tsx +53 -0
- package/templates/web-ssr-next/src/components/ui/card.tsx +56 -0
- package/templates/web-ssr-next/src/components/ui/dropdown-menu.tsx +188 -0
- package/templates/web-ssr-next/src/components/ui/input.tsx +24 -0
- package/templates/web-ssr-next/src/components/ui/label.tsx +21 -0
- package/templates/web-ssr-next/src/components/ui/skeleton.tsx +13 -0
- package/templates/web-ssr-next/src/components/ui/sonner.tsx +25 -0
- package/templates/web-ssr-next/src/lib/http.ts +64 -0
- package/templates/web-ssr-next/src/lib/server-data.ts +49 -0
- package/templates/web-ssr-next/src/lib/utils.ts +16 -0
- package/templates/web-ssr-next/src/stores/use-counter-store.ts +18 -0
- package/templates/web-ssr-next/src/styles/tokens.css +93 -0
- package/templates/web-ssr-next/tsconfig.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# one cli
|
|
2
|
+
|
|
3
|
+
面向团队工作区的脚手架与治理工具,用于创建 workspace 骨架、添加模板化子项目,并持续同步 Docker、K8s、GitHub Actions、manifest 与 secrets。
|
|
4
|
+
|
|
5
|
+
> 本工具发布在 npm 上的包名是 `qzkpwoxtl`(故意取了一个无意义名字以避免被外部用户偶然发现,仅供团队内部使用)。命令行入口仍然是 `one`。
|
|
6
|
+
|
|
7
|
+
## 快速开始
|
|
8
|
+
|
|
9
|
+
### 从 npm 安装(推荐)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 全局安装
|
|
13
|
+
pnpm add -g qzkpwoxtl
|
|
14
|
+
# 或 npm install -g qzkpwoxtl
|
|
15
|
+
# 或 yarn global add qzkpwoxtl
|
|
16
|
+
|
|
17
|
+
one --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
一次性使用而不全局安装:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm dlx qzkpwoxtl --help
|
|
24
|
+
# 或 npx qzkpwoxtl --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 从源码本地开发
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm install
|
|
31
|
+
pnpm one --help
|
|
32
|
+
pnpm test
|
|
33
|
+
pnpm test:e2e
|
|
34
|
+
pnpm typecheck
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
将本地源码 link 为全局 `one`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm install
|
|
41
|
+
pnpm build
|
|
42
|
+
pnpm link --global
|
|
43
|
+
one --help
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Skill
|
|
47
|
+
|
|
48
|
+
仓库内置了可复用的 Codex skill,和源码一起版本化维护:
|
|
49
|
+
|
|
50
|
+
- `skills/one-cli/SKILL.md`
|
|
51
|
+
- `skills/one-cli/agents/openai.yaml`
|
|
52
|
+
|
|
53
|
+
## 产品边界
|
|
54
|
+
|
|
55
|
+
`one-cli` 负责的是工作区初始化与治理:
|
|
56
|
+
|
|
57
|
+
- 创建根骨架:`create`
|
|
58
|
+
- 添加 / 移除子项目:`add` / `remove`
|
|
59
|
+
- 同步与检查基础设施:`sync` / `doctor` / `report`
|
|
60
|
+
- 管理 manifest、模板契约、安装、升级与 secrets
|
|
61
|
+
- 管理工作区级 AI 指南与 skills 入口
|
|
62
|
+
|
|
63
|
+
`one-cli` 不负责代理子项目日常开发命令。各模板自己的 `dev` / `build` / `test` / `lint` 仍由子项目内脚本负责,CLI 只做编排与治理,不替代这些工具链。
|
|
64
|
+
|
|
65
|
+
## 命令总览
|
|
66
|
+
|
|
67
|
+
所有命令统一通过全局 `one` 执行。
|
|
68
|
+
|
|
69
|
+
### 1. 创建骨架
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
one create [project-name] [-d <parent-dir>]
|
|
73
|
+
# 直接 one 也等价于 one create
|
|
74
|
+
one [project-name] [-d <parent-dir>]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
说明:
|
|
78
|
+
- `one` 工作区统一只支持 `pnpm`。
|
|
79
|
+
- 根目录会自动生成 `pnpm-workspace.yaml`。
|
|
80
|
+
- `-d, --dir`:指定创建父目录。
|
|
81
|
+
- 创建流程会询问是否启用 Docker / K8s。
|
|
82
|
+
- 会初始化 `one.manifest.json`。
|
|
83
|
+
|
|
84
|
+
### 2. 添加子项目
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
one add [template-id] -n <subproject-name> [-d <one-project-root>]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
说明:
|
|
91
|
+
- 子项目统一使用 `pnpm`,不支持在同一工作区混用 `npm` / `yarn`。
|
|
92
|
+
- `-d, --dir`:显式指定骨架项目根目录(可在任意目录执行)。
|
|
93
|
+
- 模板渲染会自动忽略 `.git`。
|
|
94
|
+
- 完成后自动同步:
|
|
95
|
+
- 子项目 `Dockerfile`
|
|
96
|
+
- 根目录 `docker-compose.yml`
|
|
97
|
+
- 根目录 `k8s/deployment.yaml`
|
|
98
|
+
- 根目录 `.github/workflows/ci-*.yml`
|
|
99
|
+
- 根目录 `one.manifest.json`
|
|
100
|
+
|
|
101
|
+
### 3. 查看模板
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
one list
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 4. 私有模板认证
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
one auth
|
|
111
|
+
one auth --clear
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 5. 移除子项目
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
one remove [name-or-relative-path] [-d <one-project-root>] [-f] [--dry-run]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
说明:
|
|
121
|
+
- `-f, --force`:跳过确认。
|
|
122
|
+
- `--dry-run`:仅预览,不做写入。
|
|
123
|
+
- 自动清理对应 Docker/K8s/Actions/manifest。
|
|
124
|
+
|
|
125
|
+
### 6. 一键同步配置
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
one sync [-d <one-project-root>] [--dry-run]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
说明:
|
|
132
|
+
- 扫描 `apps/`、`services/`、`packages/` 并补齐配置。
|
|
133
|
+
- `--dry-run`:仅预览缺失项。
|
|
134
|
+
|
|
135
|
+
### 7. 健康检查
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
one doctor [-d <one-project-root>] [--fix] [--json]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
检查项:
|
|
142
|
+
- 子项目 `Dockerfile`
|
|
143
|
+
- `docker-compose` 服务项
|
|
144
|
+
- `k8s` 工作负载
|
|
145
|
+
- 子项目 GitHub Actions workflow
|
|
146
|
+
- `one.manifest.json` 与实际目录一致性
|
|
147
|
+
|
|
148
|
+
说明:
|
|
149
|
+
- `--fix`:自动修复可修复项(等价于 sync + manifest rebuild)。
|
|
150
|
+
- `--json`:输出机器可读结果,适合 CI。
|
|
151
|
+
|
|
152
|
+
### 8. Manifest 管理
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
one manifest show [-d <one-project-root>]
|
|
156
|
+
one manifest rebuild [-d <one-project-root>]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 9. 依赖安装
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
one install [-d <one-project-root>] [--roots <dir1,dir2,...>]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
说明:
|
|
166
|
+
- 默认扫描 `apps/`、`services/`、`packages/` 下的所有子项目;
|
|
167
|
+
- `--roots` 可覆盖扫描目录(例如 `--roots apps,services,modules`);
|
|
168
|
+
- 也支持在 `package.json` 配置扫描目录(`one.install.roots`);
|
|
169
|
+
- 优先级:`--roots` > `one.install.roots` > 默认目录;
|
|
170
|
+
- 在项目根目录以及各子项目目录里执行对应包管理器的 install(按检测到的 lockfile 决定)。
|
|
171
|
+
|
|
172
|
+
`package.json` 示例:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"one": {
|
|
177
|
+
"install": {
|
|
178
|
+
"roots": ["apps", "services", "modules"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 10. 模板契约检查
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
one template check [--id <template-id>] [--strict]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
检查项:
|
|
191
|
+
- 禁止项目级配置:`.github/.vscode/.husky/.changeset/commitlint/docker-compose/k8s/nginx`
|
|
192
|
+
- 必需脚本:`lint`、`format`、`check`
|
|
193
|
+
- 约束:`lint` 使用 `oxlint`,`format` 使用 `oxfmt`,`check` 同时包含 `lint` + `format`
|
|
194
|
+
- 至少一个可运行脚本:`dev/start/preview/web`
|
|
195
|
+
- lockfile:模板不应打包 lockfile(拉下后由用户自行 install);存在则给 warning
|
|
196
|
+
|
|
197
|
+
说明:
|
|
198
|
+
- `--id`:仅检查指定模板。
|
|
199
|
+
- `--strict`:warning 也视为失败(返回非 0)。
|
|
200
|
+
|
|
201
|
+
### 11. AI 指南与 Skills
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
one ai init [-d <one-project-root>] [--ai <providers>] [--roots <dir1,dir2,...>] [--force] [--dry-run]
|
|
205
|
+
one ai skills [-d <one-project-root>] [<skills-command...>]
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
说明:
|
|
209
|
+
- `one ai init` 会扫描当前工作区子项目,按模板聚合最佳实践,生成 `AGENTS.md` 和 / 或 `CLAUDE.md`;
|
|
210
|
+
- `codex` 对应 `AGENTS.md`,`claude-code` 对应 `CLAUDE.md`;
|
|
211
|
+
- provider 默认读取 `package.json#one.ai.providers`,也可通过 `--ai codex,claude-code` 临时覆盖;
|
|
212
|
+
- `--roots` 优先级与 `one install` 一致:`--roots` > `one.install.roots` > 默认目录;
|
|
213
|
+
- 如果目标文件已存在但不包含 `one ai init` 管理标记,默认拒绝覆盖,需显式传 `--force`;
|
|
214
|
+
- `one ai skills` 默认包装 `npx -y skills`,也可用 `one.ai.skillsCommand` 改写上游命令;
|
|
215
|
+
- 执行 `add` / `remove` / `sync` 时,会自动对 `one.ai.providers` 中的所有 provider 注入 `--agent`;
|
|
216
|
+
- 项目配置只记录已安装 skill name:`one.ai.skills.installed`。
|
|
217
|
+
|
|
218
|
+
`package.json` 示例:
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"one": {
|
|
223
|
+
"ai": {
|
|
224
|
+
"providers": ["codex", "claude-code"],
|
|
225
|
+
"skillsCommand": "npx -y skills",
|
|
226
|
+
"skills": {
|
|
227
|
+
"installed": ["one-cli"]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
示例:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
one ai skills add vercel-labs/agent-skills --skill web-design-guidelines
|
|
238
|
+
one ai skills remove web-design-guidelines
|
|
239
|
+
one ai skills sync
|
|
240
|
+
one ai skills -- add vercel-labs/agent-skills --help
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 12. Secrets(SOPS + age,方案2)
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
one secrets init [-d <one-project-root>]
|
|
247
|
+
one secrets set <KEY> [VALUE] [--env <env>] [--yes] [-d <one-project-root>]
|
|
248
|
+
one secrets import-key [--from <key-path>] [-d <one-project-root>]
|
|
249
|
+
one secrets export-key [--to <key-path>] [-d <one-project-root>]
|
|
250
|
+
one secrets materialize [env] [-d <one-project-root>] [--force]
|
|
251
|
+
one secrets edit [env] [-d <one-project-root>]
|
|
252
|
+
one secrets doctor [-d <one-project-root>]
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
默认路径:
|
|
256
|
+
- `export-key` 默认导出到本机项目密钥库:`$HOME/.config/one-cli/secrets/<project-id>/age.txt`;
|
|
257
|
+
- `import-key` 默认从同一路径导入;
|
|
258
|
+
- Windows 对应路径:`%USERPROFILE%\\.config\\one-cli\\secrets\\<project-id>\\age.txt`。
|
|
259
|
+
|
|
260
|
+
推荐流程(已有历史密钥):
|
|
261
|
+
1. 在已有可解密工作区执行:`one secrets export-key`
|
|
262
|
+
2. 新 worktree 执行:`one secrets import-key`
|
|
263
|
+
3. 执行 `one secrets doctor`
|
|
264
|
+
4. 执行 `one secrets materialize dev`
|
|
265
|
+
5. 之后直接运行:`npx prisma migrate deploy` / `pnpm dev`
|
|
266
|
+
|
|
267
|
+
推荐流程(全新项目):
|
|
268
|
+
1. `one secrets init`
|
|
269
|
+
2. `one secrets set DATABASE_URL --env dev`
|
|
270
|
+
3. `one secrets materialize dev`
|
|
271
|
+
4. `one secrets export-key`
|
|
272
|
+
|
|
273
|
+
补充说明:
|
|
274
|
+
- `one secrets set <KEY> [VALUE]` 用于单个变量的精确新增/更新;
|
|
275
|
+
- 未传 `VALUE` 时会走隐藏输入;
|
|
276
|
+
- 如果 key 已存在且新值不同,交互终端会提示 `y/N` 确认,脚本场景可配合 `--yes` 使用;
|
|
277
|
+
- 显式传入 `""` 时可将变量写为空字符串。
|
|
278
|
+
|
|
279
|
+
注意:
|
|
280
|
+
- 请将 `.secrets/.env.*.enc` 提交到 Git(它是密文),否则新 worktree 无法 `materialize`;
|
|
281
|
+
- 不要提交 `.secrets/keys/age.txt`、`.env`、`*.plain.env`、`*.dec.env`;
|
|
282
|
+
- `materialize` 默认不会覆盖内容不同的已有 `.env`,如需覆盖请使用 `--force`;
|
|
283
|
+
- `one secrets doctor` 会检查“是否有可用解密身份源”。
|
|
284
|
+
|
|
285
|
+
前置依赖:
|
|
286
|
+
- 需要系统已安装 `sops` 与 `age`(提供 `age-keygen`)。
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# macOS (Homebrew)
|
|
290
|
+
brew install sops age
|
|
291
|
+
|
|
292
|
+
# 验证
|
|
293
|
+
sops --version
|
|
294
|
+
age-keygen --version
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
常见报错:
|
|
298
|
+
- `spawn sops ENOENT` / `spawn age-keygen ENOENT`:表示命令不存在(不在 `PATH` 中),不是 `one` 本身故障。先安装依赖并重新打开终端后重试。
|
|
299
|
+
- `导入密钥与现有加密文件不匹配`:当前导入的私钥无法解密仓库内已有 `*.enc`。请在可解密工作区重新执行 `one secrets export-key`,再回到目标 worktree 执行 `one secrets import-key`。
|
|
300
|
+
- `检测到现有 .env 与解密内容不一致`:`materialize` 默认保护本地已有 `.env`。确认可覆盖后执行 `one secrets materialize <env> --force`。
|
|
301
|
+
- 可用 `one secrets doctor` 快速检查 secrets 相关环境是否齐全。
|
|
302
|
+
|
|
303
|
+
### 13. 依赖升级
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
one upgrade [name-or-relative-path] [-d <one-project-root>] [--latest] [--test] [--build] [--dry-run]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
说明:
|
|
310
|
+
- 默认执行:依赖升级 + `check`(若存在)。
|
|
311
|
+
- `--latest`:尽可能升级到最新(`npm` 仍使用 `npm update`,major 需手动调整)。
|
|
312
|
+
- `--test`:升级后执行 `test`(若存在)。
|
|
313
|
+
- `--build`:升级后执行 `build`(若存在)。
|
|
314
|
+
- `--dry-run`:只预览命令,不执行升级。
|
|
315
|
+
|
|
316
|
+
### 13. 状态报告
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
one report [-d <one-project-root>] [--json]
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
说明:
|
|
323
|
+
- 汇总子项目、manifest、Docker/K8s、GitHub Actions 覆盖率和问题列表。
|
|
324
|
+
- `--json`:输出机器可读报告。
|
|
325
|
+
|
|
326
|
+
## 推荐工作流
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
one create my-workspace -d .
|
|
330
|
+
one add api-nest -n backend-api -d ./my-workspace
|
|
331
|
+
one add web-csr-react -n web-app -d ./my-workspace
|
|
332
|
+
one doctor -d ./my-workspace --fix
|
|
333
|
+
one report -d ./my-workspace
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## CI 示例
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
one template check --strict
|
|
340
|
+
one doctor --json -d <one-project-root>
|
|
341
|
+
one report --json -d <one-project-root>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
建议:
|
|
345
|
+
- 将 `doctor --json` 的 `ok=false` 作为流水线失败条件。
|
|
346
|
+
|
|
347
|
+
## 私有仓库权限说明
|
|
348
|
+
|
|
349
|
+
`one add` 使用 `giget` 通过 GitHub API 下载模板 tarball,不是 `git clone`。
|
|
350
|
+
因此本机 `gh auth login` 后,CLI 不会自动复用 git 凭据,私有仓库可能出现 404/无权限。
|
|
351
|
+
|
|
352
|
+
`one auth` 会自动:
|
|
353
|
+
1. 调用 `gh auth token`
|
|
354
|
+
2. 保存 token 到本地认证文件(默认 `~/.one-cli/auth.json`)
|
|
355
|
+
3. 后续 `list/add` 自动携带认证访问私有仓库
|
|
356
|
+
|
|
357
|
+
认证优先级:
|
|
358
|
+
1. `GIGET_AUTH` 环境变量(最高)
|
|
359
|
+
2. 本地认证文件(`one auth` 保存)
|
|
360
|
+
3. 匿名访问(仅公开仓库)
|
|
361
|
+
|
|
362
|
+
## 常见排查
|
|
363
|
+
|
|
364
|
+
如果已登录 GitHub 仍无法访问私有模板:
|
|
365
|
+
1. 执行 `gh auth status` 检查账号和 scope。
|
|
366
|
+
2. 若模板在组织私有仓库,确认 token 已通过组织 SSO 授权。
|
|
367
|
+
3. 确认 token 具备私有仓库读取权限(通常至少 `repo`)。
|
|
368
|
+
|
|
369
|
+
也可临时设置:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
export GIGET_AUTH="$(gh auth token)"
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## 注册表来源
|
|
376
|
+
|
|
377
|
+
- 默认使用仓库内置并随 npm 包一起分发的 `registry.json`。
|
|
378
|
+
- 可通过 `ONE_REGISTRY_URL` 指向自定义注册表。
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|