create-lego-one 2.0.10 → 2.0.13
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.cjs +179 -0
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -3
- package/template/.cursor/rules/rules.mdc +639 -0
- package/template/.dockerignore +58 -0
- package/template/.env.example +18 -0
- package/template/.eslintignore +5 -0
- package/template/.eslintrc.js +28 -0
- package/template/.prettierignore +6 -0
- package/template/.prettierrc +11 -0
- package/template/CLAUDE.md +634 -0
- package/template/Dockerfile +67 -0
- package/template/PROMPT.md +457 -0
- package/template/README.md +325 -0
- package/template/docker-compose.yml +48 -0
- package/template/docker-entrypoint.sh +23 -0
- package/template/docs/checkpoints/.template.md +64 -0
- package/template/docs/checkpoints/framework/01-infrastructure-setup.md +132 -0
- package/template/docs/checkpoints/framework/02-pocketbase-setup.md +155 -0
- package/template/docs/checkpoints/framework/03-host-kernel.md +170 -0
- package/template/docs/checkpoints/framework/04-auth-system.md +163 -0
- package/template/docs/checkpoints/framework/phase-05-multitenancy-rbac.md +223 -0
- package/template/docs/checkpoints/framework/phase-06-ui-components.md +260 -0
- package/template/docs/checkpoints/framework/phase-07-communication-system.md +276 -0
- package/template/docs/checkpoints/framework/phase-08-plugin-system.md +91 -0
- package/template/docs/checkpoints/framework/phase-09-dashboard-plugin.md +111 -0
- package/template/docs/checkpoints/framework/phase-10-todo-plugin.md +169 -0
- package/template/docs/checkpoints/framework/phase-11-testing.md +264 -0
- package/template/docs/checkpoints/framework/phase-12-deployment.md +294 -0
- package/template/docs/checkpoints/framework/phase-13-documentation.md +312 -0
- package/template/docs/framework/plans/00-index.md +164 -0
- package/template/docs/framework/plans/01-infrastructure-setup.md +855 -0
- package/template/docs/framework/plans/02-pocketbase-setup.md +1374 -0
- package/template/docs/framework/plans/03-host-kernel.md +1518 -0
- package/template/docs/framework/plans/04-auth-system.md +1466 -0
- package/template/docs/framework/plans/05-multitenancy-rbac.md +1527 -0
- package/template/docs/framework/plans/06-ui-components.md +1478 -0
- package/template/docs/framework/plans/07-communication-system.md +1106 -0
- package/template/docs/framework/plans/08-plugin-system.md +1179 -0
- package/template/docs/framework/plans/09-dashboard-plugin.md +1137 -0
- package/template/docs/framework/plans/10-todo-plugin.md +1343 -0
- package/template/docs/framework/plans/11-testing.md +935 -0
- package/template/docs/framework/plans/12-deployment.md +896 -0
- package/template/docs/framework/prompts/0-boilerplate-modernjs.md +151 -0
- package/template/docs/framework/research/00-modernjs-audit.md +488 -0
- package/template/docs/framework/research/01-system-blueprint.md +721 -0
- package/template/docs/framework/research/02-data-migration-protocol.md +699 -0
- package/template/docs/framework/research/03-host-setup.md +714 -0
- package/template/docs/framework/research/04-plugin-architecture.md +645 -0
- package/template/docs/framework/research/05-slot-injection-pattern.md +671 -0
- package/template/docs/framework/research/06-cli-strategy.md +615 -0
- package/template/docs/framework/research/07-deployment.md +629 -0
- package/template/docs/framework/research/README.md +282 -0
- package/template/docs/framework/setup/00-index.md +210 -0
- package/template/docs/framework/setup/01-framework-structure.md +308 -0
- package/template/docs/framework/setup/02-development-workflow.md +405 -0
- package/template/docs/framework/setup/03-environment-setup.md +215 -0
- package/template/docs/framework/setup/04-kernel-architecture.md +499 -0
- package/template/docs/framework/setup/05-plugin-system.md +620 -0
- package/template/docs/framework/setup/06-communication-patterns.md +451 -0
- package/template/docs/framework/setup/07-plugin-development.md +582 -0
- package/template/docs/framework/setup/08-component-library.md +658 -0
- package/template/docs/framework/setup/09-data-integration.md +609 -0
- package/template/docs/framework/setup/10-auth-rbac.md +497 -0
- package/template/docs/framework/setup/11-hooks-api.md +393 -0
- package/template/docs/framework/setup/12-components-api.md +665 -0
- package/template/docs/framework/setup/13-deployment-guide.md +566 -0
- package/template/docs/framework/setup/README.md +548 -0
- package/template/host/e2e/auth.spec.ts +38 -0
- package/template/host/e2e/layout.spec.ts +38 -0
- package/template/host/modern.config.ts +19 -0
- package/template/host/package.json +71 -0
- package/template/host/playwright.config.ts +34 -0
- package/template/host/postcss.config.mjs +6 -0
- package/template/host/src/App.tsx +6 -0
- package/template/host/src/bootstrap.tsx +74 -0
- package/template/host/src/global.css +59 -0
- package/template/host/src/index.ts +2 -0
- package/template/host/src/kernel/__tests__/lib-utils.test.ts +32 -0
- package/template/host/src/kernel/__tests__/rbac-hooks.test.tsx +114 -0
- package/template/host/src/kernel/__tests__/rbac-utils.test.ts +108 -0
- package/template/host/src/kernel/auth/ProtectedRoute.tsx +41 -0
- package/template/host/src/kernel/auth/components/LoginForm.tsx +97 -0
- package/template/host/src/kernel/auth/components/LogoutButton.tsx +79 -0
- package/template/host/src/kernel/auth/hooks.ts +174 -0
- package/template/host/src/kernel/auth/index.ts +5 -0
- package/template/host/src/kernel/auth/schemas.ts +27 -0
- package/template/host/src/kernel/auth/service.ts +197 -0
- package/template/host/src/kernel/auth/types.ts +36 -0
- package/template/host/src/kernel/channels/ChannelBus.ts +181 -0
- package/template/host/src/kernel/channels/ChannelProvider.tsx +57 -0
- package/template/host/src/kernel/channels/events.ts +27 -0
- package/template/host/src/kernel/channels/hooks.ts +168 -0
- package/template/host/src/kernel/channels/index.ts +6 -0
- package/template/host/src/kernel/channels/integrations/ToastIntegration.tsx +60 -0
- package/template/host/src/kernel/channels/plugin-hooks.ts +72 -0
- package/template/host/src/kernel/channels/types.ts +112 -0
- package/template/host/src/kernel/components/__tests__/Badge.test.tsx +35 -0
- package/template/host/src/kernel/components/__tests__/Button.test.tsx +63 -0
- package/template/host/src/kernel/components/__tests__/Input.test.tsx +64 -0
- package/template/host/src/kernel/components/index.ts +32 -0
- package/template/host/src/kernel/components/ui/alert.tsx +58 -0
- package/template/host/src/kernel/components/ui/avatar.tsx +47 -0
- package/template/host/src/kernel/components/ui/badge.tsx +35 -0
- package/template/host/src/kernel/components/ui/button.tsx +50 -0
- package/template/host/src/kernel/components/ui/card.tsx +78 -0
- package/template/host/src/kernel/components/ui/dialog.tsx +116 -0
- package/template/host/src/kernel/components/ui/dropdown-menu.tsx +192 -0
- package/template/host/src/kernel/components/ui/index.ts +7 -0
- package/template/host/src/kernel/components/ui/input.tsx +24 -0
- package/template/host/src/kernel/components/ui/label.tsx +21 -0
- package/template/host/src/kernel/components/ui/popover.tsx +28 -0
- package/template/host/src/kernel/components/ui/progress.tsx +25 -0
- package/template/host/src/kernel/components/ui/scroll-area.tsx +45 -0
- package/template/host/src/kernel/components/ui/select.tsx +155 -0
- package/template/host/src/kernel/components/ui/separator.tsx +28 -0
- package/template/host/src/kernel/components/ui/skeleton.tsx +15 -0
- package/template/host/src/kernel/components/ui/switch.tsx +26 -0
- package/template/host/src/kernel/components/ui/table.tsx +116 -0
- package/template/host/src/kernel/components/ui/tabs.tsx +52 -0
- package/template/host/src/kernel/components/ui/toast.tsx +126 -0
- package/template/host/src/kernel/components/ui/toaster.tsx +34 -0
- package/template/host/src/kernel/components/ui/tooltip.tsx +27 -0
- package/template/host/src/kernel/components/ui/use-toast.ts +183 -0
- package/template/host/src/kernel/index.ts +48 -0
- package/template/host/src/kernel/lib/cn.ts +1 -0
- package/template/host/src/kernel/lib/utils.ts +36 -0
- package/template/host/src/kernel/plugins/Slot.tsx +41 -0
- package/template/host/src/kernel/plugins/SlotProvider.tsx +88 -0
- package/template/host/src/kernel/plugins/index.ts +23 -0
- package/template/host/src/kernel/plugins/loader.ts +122 -0
- package/template/host/src/kernel/plugins/schemas.ts +54 -0
- package/template/host/src/kernel/plugins/store.ts +185 -0
- package/template/host/src/kernel/plugins/types.ts +103 -0
- package/template/host/src/kernel/providers/PocketBaseProvider.tsx +70 -0
- package/template/host/src/kernel/providers/QueryProvider.tsx +28 -0
- package/template/host/src/kernel/providers/ThemeProvider.tsx +25 -0
- package/template/host/src/kernel/providers/index.ts +3 -0
- package/template/host/src/kernel/rbac/components/OrganizationSelector.tsx +69 -0
- package/template/host/src/kernel/rbac/components/PermissionGate.tsx +43 -0
- package/template/host/src/kernel/rbac/hooks.ts +379 -0
- package/template/host/src/kernel/rbac/index.ts +6 -0
- package/template/host/src/kernel/rbac/service.ts +504 -0
- package/template/host/src/kernel/rbac/types.ts +164 -0
- package/template/host/src/kernel/rbac/utils.ts +34 -0
- package/template/host/src/kernel/shared-state/bridge.ts +31 -0
- package/template/host/src/kernel/shared-state/index.ts +3 -0
- package/template/host/src/kernel/shared-state/store.ts +62 -0
- package/template/host/src/kernel/shared-state/types.ts +60 -0
- package/template/host/src/kernel/use-migrations.ts +72 -0
- package/template/host/src/layout/MobileMenu.tsx +61 -0
- package/template/host/src/layout/Shell.tsx +42 -0
- package/template/host/src/layout/Sidebar.tsx +178 -0
- package/template/host/src/layout/Topbar.tsx +50 -0
- package/template/host/src/layout/index.ts +4 -0
- package/template/host/src/lib/pocketbase/client.ts +38 -0
- package/template/host/src/lib/pocketbase/collections/audit_logs.ts +87 -0
- package/template/host/src/lib/pocketbase/collections/index.ts +19 -0
- package/template/host/src/lib/pocketbase/collections/organizations.ts +63 -0
- package/template/host/src/lib/pocketbase/collections/permissions.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/roles.ts +55 -0
- package/template/host/src/lib/pocketbase/collections/todos.ts +74 -0
- package/template/host/src/lib/pocketbase/collections/user_roles.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/users.ts +43 -0
- package/template/host/src/lib/pocketbase/index.ts +5 -0
- package/template/host/src/lib/pocketbase/migrations.ts +44 -0
- package/template/host/src/lib/pocketbase/seed/permissions.ts +8 -0
- package/template/host/src/lib/pocketbase/seed/roles.ts +22 -0
- package/template/host/src/lib/pocketbase/seed.ts +113 -0
- package/template/host/src/lib/pocketbase/types.ts +102 -0
- package/template/host/src/modern.runtime.ts +26 -0
- package/template/host/src/plugins.d.ts +9 -0
- package/template/host/src/providers/PocketBaseProvider.tsx +30 -0
- package/template/host/src/routes/_.tsx +6 -0
- package/template/host/src/routes/dashboard._.tsx +41 -0
- package/template/host/src/routes/index.tsx +93 -0
- package/template/host/src/routes/login.tsx +36 -0
- package/template/host/src/saas.config.ts +52 -0
- package/template/host/src/test/setup.ts +65 -0
- package/template/host/src/test/utils.tsx +69 -0
- package/template/host/src/test/vitest-globals.d.ts +19 -0
- package/template/host/src/vite-env.d.ts +16 -0
- package/template/host/tailwind.config.ts +77 -0
- package/template/host/tsconfig.json +19 -0
- package/template/host/vitest.config.ts +30 -0
- package/template/nginx.conf +72 -0
- package/template/package.json +44 -0
- package/template/packages/plugins/@lego/plugin-dashboard/modern.config.ts +19 -0
- package/template/packages/plugins/@lego/plugin-dashboard/package.json +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/App.tsx +27 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/ActivityFeed.tsx +63 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActionSlot.tsx +11 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActions.tsx +68 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/SidebarWidget.tsx +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/StatCard.tsx +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/global.css +24 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useChannelIntegration.ts +43 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useDashboardStats.ts +65 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/usePocketBase.ts +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useRecentActivity.ts +55 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/lib/utils.ts +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/pages/DashboardPage.tsx +105 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.config.ts +121 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.ts +18 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/vite-env.d.ts +32 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tailwind.config.ts +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tsconfig.json +18 -0
- package/template/packages/plugins/@lego/plugin-todo/modern.config.ts +18 -0
- package/template/packages/plugins/@lego/plugin-todo/package.json +41 -0
- package/template/packages/plugins/@lego/plugin-todo/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/App.tsx +12 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/SidebarWidget.tsx +16 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoDialog.tsx +55 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoFilters.tsx +79 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoForm.tsx +94 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoItem.tsx +121 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoList.tsx +41 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/index.ts +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/global.css +59 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useCreateTodo.ts +62 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useDeleteTodo.ts +46 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/usePocketBase.ts +38 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useTodos.ts +64 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useUpdateTodo.ts +35 -0
- package/template/packages/plugins/@lego/plugin-todo/src/index.tsx +5 -0
- package/template/packages/plugins/@lego/plugin-todo/src/lib/utils.ts +20 -0
- package/template/packages/plugins/@lego/plugin-todo/src/pages/TodoPage.tsx +89 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.config.ts +104 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.ts +13 -0
- package/template/packages/plugins/@lego/plugin-todo/src/schemas.ts +37 -0
- package/template/packages/plugins/@lego/plugin-todo/src/types.ts +42 -0
- package/template/packages/plugins/@lego/plugin-todo/src/vite-env.d.ts +31 -0
- package/template/packages/plugins/@lego/plugin-todo/tailwind.config.ts +51 -0
- package/template/packages/plugins/@lego/plugin-todo/tsconfig.json +18 -0
- package/template/pnpm-workspace.yaml +4 -0
- package/template/pocketbase/CHANGELOG.md +911 -0
- package/template/pocketbase/LICENSE.md +17 -0
- package/template/scripts/create-plugin.js +221 -0
- package/template/scripts/deploy.sh +56 -0
- package/template/tsconfig.base.json +26 -0
- package/template/tsconfig.json +8 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Framework Structure
|
|
2
|
+
|
|
3
|
+
**Lego-One Architecture and File Organization**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Lego-One uses a **microkernel architecture** where the Host (Kernel) provides core services and plugins provide features. This separation enables independent plugin development and deployment.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Project Structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
lego-one/
|
|
17
|
+
├── host/ # Kernel application (main app)
|
|
18
|
+
│ ├── src/
|
|
19
|
+
│ │ ├── kernel/ # Core systems
|
|
20
|
+
│ │ │ ├── shared-state/ # Zustand store + window bridge
|
|
21
|
+
│ │ │ ├── providers/ # PocketBase, Query, Theme
|
|
22
|
+
│ │ │ ├── plugins/ # Plugin system, slots
|
|
23
|
+
│ │ │ ├── channels/ # Garfish channel bus
|
|
24
|
+
│ │ │ ├── auth/ # Authentication logic
|
|
25
|
+
│ │ │ ├── rbac/ # Multitenancy, permissions
|
|
26
|
+
│ │ │ ├── lib/ # Utilities (cn, formatDate)
|
|
27
|
+
│ │ │ └── components/ # Shared UI components
|
|
28
|
+
│ │ ├── layout/ # Layout components
|
|
29
|
+
│ │ │ ├── Shell.tsx # Main app shell
|
|
30
|
+
│ │ │ ├── Sidebar.tsx # Left sidebar
|
|
31
|
+
│ │ │ └── Topbar.tsx # Top navigation bar
|
|
32
|
+
│ │ ├── routes/ # Page routes
|
|
33
|
+
│ │ │ ├── index.tsx # Home/landing
|
|
34
|
+
│ │ │ ├── login.tsx # Sign in page
|
|
35
|
+
│ │ │ ├── dashboard.tsx # Dashboard (placeholder)
|
|
36
|
+
│ │ │ └── settings/ # Settings pages
|
|
37
|
+
│ │ ├── bootstrap.tsx # App entry point
|
|
38
|
+
│ │ ├── modern.runtime.ts # Garfish plugin config
|
|
39
|
+
│ │ └── saas.config.ts # Plugin enable/disable config
|
|
40
|
+
│ ├── modern.config.ts # Modern.js configuration
|
|
41
|
+
│ ├── tailwind.config.ts # Tailwind CSS configuration
|
|
42
|
+
│ └── package.json
|
|
43
|
+
│
|
|
44
|
+
├── packages/
|
|
45
|
+
│ ├── plugins/
|
|
46
|
+
│ │ └── @lego/
|
|
47
|
+
│ │ ├── plugin-dashboard/ # Dashboard plugin example
|
|
48
|
+
│ │ │ ├── src/
|
|
49
|
+
│ │ │ │ ├── components/ # Dashboard components
|
|
50
|
+
│ │ │ │ ├── hooks/ # Data fetching hooks
|
|
51
|
+
│ │ │ │ ├── pages/ # Dashboard page
|
|
52
|
+
│ │ │ │ ├── plugin.config.ts # Plugin configuration
|
|
53
|
+
│ │ │ │ └── plugin.ts # Entry export
|
|
54
|
+
│ │ │ ├── modern.config.ts
|
|
55
|
+
│ │ │ └── package.json
|
|
56
|
+
│ │ │
|
|
57
|
+
│ │ └── plugin-todo/ # Todo plugin example
|
|
58
|
+
│ │ ├── src/
|
|
59
|
+
│ │ │ ├── components/ # Todo components
|
|
60
|
+
│ │ │ ├── hooks/ # CRUD operations
|
|
61
|
+
│ │ │ ├── pages/ # Todo page
|
|
62
|
+
│ │ │ ├── plugin.config.ts # Plugin configuration
|
|
63
|
+
│ │ │ └── plugin.ts # Entry export
|
|
64
|
+
│ │ ├── modern.config.ts
|
|
65
|
+
│ │ └── package.json
|
|
66
|
+
│ │
|
|
67
|
+
│ └── create-lego-one/ # CLI tool for `pnpm create`
|
|
68
|
+
│ ├── src/
|
|
69
|
+
│ │ └── index.ts # CLI entry point
|
|
70
|
+
│ ├── template/ # Template files (copied to new projects)
|
|
71
|
+
│ └── package.json
|
|
72
|
+
│
|
|
73
|
+
├── pocketbase/ # PocketBase data directory
|
|
74
|
+
│ ├── pb_data/ # SQLite database files
|
|
75
|
+
│ ├── pb_migrations/ # Database migrations
|
|
76
|
+
│ └── pocketbase # PocketBase binary
|
|
77
|
+
│
|
|
78
|
+
├── scripts/ # Automation scripts
|
|
79
|
+
│ ├── create-plugin.js # Plugin scaffolding script
|
|
80
|
+
│ ├── version.js # Version management script
|
|
81
|
+
│ └── deploy.sh # Deployment script
|
|
82
|
+
│
|
|
83
|
+
├── docs/
|
|
84
|
+
│ ├── framework/ # Architecture docs
|
|
85
|
+
│ │ ├── setup/ # AI documentation (read this!)
|
|
86
|
+
│ │ ├── plans/ # Implementation plans
|
|
87
|
+
│ │ └── research/ # Architecture research
|
|
88
|
+
│ ├── checkpoints/ # Progress tracking
|
|
89
|
+
│ │ ├── bugfixes/ # Bug fix documentation
|
|
90
|
+
│ │ ├── features/ # Feature implementation docs
|
|
91
|
+
│ │ └── enhancements/ # Enhancement documentation
|
|
92
|
+
│ └── guides/ # User guides
|
|
93
|
+
│
|
|
94
|
+
├── .env.example # Environment variables template
|
|
95
|
+
├── Dockerfile # Multi-stage Docker build
|
|
96
|
+
├── docker-compose.yml # Local development stack
|
|
97
|
+
├── pnpm-workspace.yaml # pnpm workspace configuration
|
|
98
|
+
├── CLAUDE.md # AI workflow rules
|
|
99
|
+
└── package.json # Root package configuration
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Architecture Layers
|
|
105
|
+
|
|
106
|
+
### Layer 1: Host (Kernel)
|
|
107
|
+
|
|
108
|
+
**Purpose:** Provide core infrastructure and services
|
|
109
|
+
|
|
110
|
+
**Location:** `host/`
|
|
111
|
+
|
|
112
|
+
**Responsibilities:**
|
|
113
|
+
- User authentication and sessions
|
|
114
|
+
- Multi-tenancy and RBAC
|
|
115
|
+
- Global state management
|
|
116
|
+
- Plugin loading and lifecycle
|
|
117
|
+
- UI layout (sidebar, topbar)
|
|
118
|
+
- Route management
|
|
119
|
+
- Data providers (PocketBase, Query)
|
|
120
|
+
|
|
121
|
+
**Key Files:**
|
|
122
|
+
```
|
|
123
|
+
host/src/kernel/
|
|
124
|
+
├── shared-state/store.ts # Zustand global store
|
|
125
|
+
├── providers/PocketBaseProvider.tsx # PocketBase client
|
|
126
|
+
├── providers/QueryProvider.tsx # TanStack Query client
|
|
127
|
+
├── auth/ # Authentication hooks
|
|
128
|
+
├── rbac/ # Authorization hooks
|
|
129
|
+
├── channels/ # Event bus
|
|
130
|
+
└── plugins/ # Plugin system
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Layer 2: Plugins
|
|
134
|
+
|
|
135
|
+
**Purpose:** Provide feature modules
|
|
136
|
+
|
|
137
|
+
**Location:** `packages/plugins/@lego/`
|
|
138
|
+
|
|
139
|
+
**Responsibilities:**
|
|
140
|
+
- Feature-specific UI
|
|
141
|
+
- Feature-specific data operations
|
|
142
|
+
- Feature-specific business logic
|
|
143
|
+
|
|
144
|
+
**Communication:** Via window bridge (`window.__LEGO_KERNEL_STATE__`, `window.__LEGO_CHANNEL_BUS__`)
|
|
145
|
+
|
|
146
|
+
### Layer 3: Data Layer
|
|
147
|
+
|
|
148
|
+
**Purpose:** Backend persistence and API
|
|
149
|
+
|
|
150
|
+
**Technology:** PocketBase (SQLite with REST API)
|
|
151
|
+
|
|
152
|
+
**Location:** `pocketbase/`
|
|
153
|
+
|
|
154
|
+
**Features:**
|
|
155
|
+
- Multi-tenant data isolation
|
|
156
|
+
- User authentication
|
|
157
|
+
- Organization management
|
|
158
|
+
- Role-based access control
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Dev vs Production Mode
|
|
163
|
+
|
|
164
|
+
### Development Mode
|
|
165
|
+
|
|
166
|
+
Each plugin runs on independent dev server:
|
|
167
|
+
|
|
168
|
+
| Service | URL | Port |
|
|
169
|
+
|---------|-----|------|
|
|
170
|
+
| Host | http://localhost:8080 | 8080 |
|
|
171
|
+
| Dashboard Plugin | http://localhost:3001 | 3001 |
|
|
172
|
+
| Todo Plugin | http://localhost:3002 | 3002 |
|
|
173
|
+
|
|
174
|
+
**Benefits:**
|
|
175
|
+
- Hot module replacement (HMR)
|
|
176
|
+
- Independent plugin debugging
|
|
177
|
+
- Fast iteration
|
|
178
|
+
|
|
179
|
+
### Production Mode
|
|
180
|
+
|
|
181
|
+
All plugins bundled into host application:
|
|
182
|
+
|
|
183
|
+
**Output:** `host/dist/` (single bundle)
|
|
184
|
+
|
|
185
|
+
**Benefits:**
|
|
186
|
+
- One deployment artifact
|
|
187
|
+
- Optimized and minified
|
|
188
|
+
- Code-split by route
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Communication Patterns
|
|
193
|
+
|
|
194
|
+
### Host → Plugin
|
|
195
|
+
|
|
196
|
+
**Via Window Bridge:**
|
|
197
|
+
```typescript
|
|
198
|
+
// In plugin, access host state
|
|
199
|
+
const kernelState = window.__LEGO_KERNEL_STATE__;
|
|
200
|
+
const user = kernelState?.user;
|
|
201
|
+
const organization = kernelState?.organization;
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Plugin → Host
|
|
205
|
+
|
|
206
|
+
**Via Channel Bus:**
|
|
207
|
+
```typescript
|
|
208
|
+
// In plugin, publish events
|
|
209
|
+
const channelBus = window.__LEGO_CHANNEL_BUS__;
|
|
210
|
+
channelBus?.publish('lego:toast', {
|
|
211
|
+
type: 'success',
|
|
212
|
+
title: 'Success!',
|
|
213
|
+
description: 'Operation completed',
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Plugin ↔ Plugin
|
|
218
|
+
|
|
219
|
+
**Via Channel Bus:**
|
|
220
|
+
```typescript
|
|
221
|
+
// Subscribe to events
|
|
222
|
+
const unsubscribe = channelBus?.subscribe('custom:event', (data) => {
|
|
223
|
+
console.log('Received:', data);
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Slot Injection System
|
|
230
|
+
|
|
231
|
+
**Available Slots:**
|
|
232
|
+
|
|
233
|
+
| Slot | Location | Purpose |
|
|
234
|
+
|------|----------|---------|
|
|
235
|
+
| `sidebar:top` | Top of sidebar | User menu, logo |
|
|
236
|
+
| `sidebar:nav` | Main navigation | Plugin navigation links |
|
|
237
|
+
| `sidebar:bottom` | Bottom of sidebar | Logout, settings |
|
|
238
|
+
| `topbar:left` | Left side | Breadcrumbs, back button |
|
|
239
|
+
| `topbar:center` | Center | Page title, search |
|
|
240
|
+
| `topbar:right` | Right side | Notifications, user menu |
|
|
241
|
+
| `dashboard:widgets` | Dashboard | Statistics, activity feeds |
|
|
242
|
+
|
|
243
|
+
**Injection Example:**
|
|
244
|
+
```typescript
|
|
245
|
+
// In plugin.config.ts
|
|
246
|
+
export const pluginConfig: PluginConfig = {
|
|
247
|
+
slots: [
|
|
248
|
+
{
|
|
249
|
+
slot: 'sidebar:nav',
|
|
250
|
+
component: () => import('./components/SidebarWidget').then(m => m.default),
|
|
251
|
+
order: 100,
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
};
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Configuration Files
|
|
260
|
+
|
|
261
|
+
### host/saas.config.ts
|
|
262
|
+
|
|
263
|
+
**Purpose:** Enable/disable plugins
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
export const saasConfig = {
|
|
267
|
+
plugins: [
|
|
268
|
+
{ name: '@lego/plugin-dashboard', enabled: true },
|
|
269
|
+
{ name: '@lego/plugin-todo', enabled: true },
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### host/src/modern.runtime.ts
|
|
275
|
+
|
|
276
|
+
**Purpose:** Register plugins with Garfish
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
export default defineRuntimeConfig({
|
|
280
|
+
masterApp: {
|
|
281
|
+
apps: [
|
|
282
|
+
{
|
|
283
|
+
name: '@lego/plugin-dashboard',
|
|
284
|
+
entry: isDev
|
|
285
|
+
? 'http://localhost:3001'
|
|
286
|
+
: () => import('@lego/plugin-dashboard'),
|
|
287
|
+
activeWhen: '/dashboard',
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Key Files to Reference
|
|
297
|
+
|
|
298
|
+
| Purpose | File |
|
|
299
|
+
|---------|------|
|
|
300
|
+
| Kernel hooks | `host/src/kernel/hooks/` |
|
|
301
|
+
| Kernel components | `host/src/kernel/components/` |
|
|
302
|
+
| Plugin examples | `packages/plugins/@lego/plugin-dashboard/`, `packages/plugins/@lego/plugin-todo/` |
|
|
303
|
+
| Window bridge types | `packages/plugins/@lego/plugin-todo/src/vite-env.d.ts` |
|
|
304
|
+
| Plugin config | `packages/plugins/@lego/plugin-*/src/plugin.config.ts` |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
**Next:** Read [`02-development-workflow.md`](./02-development-workflow.md) to understand how to work on this framework.
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Development Workflow
|
|
2
|
+
|
|
3
|
+
**How to Work on the Lego-One Framework**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This guide covers the complete development workflow for Lego-One, including running, building, testing, and debugging the framework.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Start everything (host + all plugins)
|
|
17
|
+
pnpm run dev:all
|
|
18
|
+
|
|
19
|
+
# Start host only
|
|
20
|
+
pnpm run dev:host
|
|
21
|
+
|
|
22
|
+
# Start specific plugin
|
|
23
|
+
cd packages/plugins/@lego/plugin-dashboard && pnpm run dev
|
|
24
|
+
|
|
25
|
+
# Build everything
|
|
26
|
+
pnpm run build
|
|
27
|
+
|
|
28
|
+
# Run tests
|
|
29
|
+
pnpm test
|
|
30
|
+
|
|
31
|
+
# E2E tests
|
|
32
|
+
pnpm test:e2e
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Development Servers
|
|
38
|
+
|
|
39
|
+
### Running All Services
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pnpm run dev:all
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Service URLs:**
|
|
46
|
+
- **Host:** http://localhost:8080
|
|
47
|
+
- **Dashboard Plugin:** http://localhost:3001
|
|
48
|
+
- **Todo Plugin:** http://localhost:3002
|
|
49
|
+
- **PocketBase Admin:** http://localhost:8090/_/
|
|
50
|
+
|
|
51
|
+
### Running Individual Services
|
|
52
|
+
|
|
53
|
+
**Host only:**
|
|
54
|
+
```bash
|
|
55
|
+
pnpm run dev:host
|
|
56
|
+
# or
|
|
57
|
+
cd host && pnpm run dev
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Dashboard plugin only:**
|
|
61
|
+
```bash
|
|
62
|
+
cd packages/plugins/@lego/plugin-dashboard
|
|
63
|
+
pnpm run dev
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Todo plugin only:**
|
|
67
|
+
```bash
|
|
68
|
+
cd packages/plugins/@lego/plugin-todo
|
|
69
|
+
pnpm run dev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### PocketBase Setup
|
|
73
|
+
|
|
74
|
+
Start PocketBase in a separate terminal:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd pocketbase
|
|
78
|
+
|
|
79
|
+
# Start PocketBase (development mode)
|
|
80
|
+
./pocketbase serve
|
|
81
|
+
|
|
82
|
+
# Or in production mode
|
|
83
|
+
./pocketbase serve --prod
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Default Admin Credentials:**
|
|
87
|
+
- Email: `admin@example.com`
|
|
88
|
+
- Password: `admin123`
|
|
89
|
+
|
|
90
|
+
⚠️ **Important:** Change default credentials in production!
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Building for Production
|
|
95
|
+
|
|
96
|
+
### Build Commands
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Build all (recommended)
|
|
100
|
+
pnpm run build
|
|
101
|
+
|
|
102
|
+
# Build host only
|
|
103
|
+
pnpm run build:host
|
|
104
|
+
# or
|
|
105
|
+
pnpm --filter './host' build
|
|
106
|
+
|
|
107
|
+
# Build specific plugin
|
|
108
|
+
pnpm --filter './packages/plugins/@lego/plugin-dashboard' build
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Build Output
|
|
112
|
+
|
|
113
|
+
Output directory: `host/dist/`
|
|
114
|
+
|
|
115
|
+
**Production mode characteristics:**
|
|
116
|
+
- All plugins bundled into host
|
|
117
|
+
- Code-split by route
|
|
118
|
+
- Optimized and minified
|
|
119
|
+
- Source maps included
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Testing
|
|
124
|
+
|
|
125
|
+
### Unit and Component Tests
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Run all tests
|
|
129
|
+
pnpm test
|
|
130
|
+
|
|
131
|
+
# Run tests in watch mode
|
|
132
|
+
pnpm --filter './host' test
|
|
133
|
+
|
|
134
|
+
# Test with coverage
|
|
135
|
+
pnpm test:coverage
|
|
136
|
+
|
|
137
|
+
# Test UI mode
|
|
138
|
+
pnpm --filter './host' test:ui
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### E2E Tests
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Run E2E tests (requires dev server running)
|
|
145
|
+
pnpm test:e2e
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Test Files Location
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
host/src/
|
|
152
|
+
├── kernel/
|
|
153
|
+
│ └── __tests__/ # Unit tests for kernel modules
|
|
154
|
+
├── components/
|
|
155
|
+
│ └── __tests__/ # Component tests
|
|
156
|
+
└── test/
|
|
157
|
+
├── setup.ts # Test setup and mocks
|
|
158
|
+
└── utils.tsx # Test utilities
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Common Development Tasks
|
|
164
|
+
|
|
165
|
+
### Adding a New Plugin
|
|
166
|
+
|
|
167
|
+
1. **Use the CLI** (if available):
|
|
168
|
+
```bash
|
|
169
|
+
pnpm run create-plugin my-plugin
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. **Or create manually:**
|
|
173
|
+
```bash
|
|
174
|
+
mkdir -p packages/plugins/@lego/plugin-my-plugin
|
|
175
|
+
cd packages/plugins/@lego/plugin-my-plugin
|
|
176
|
+
# Create plugin structure (see file 07: Plugin Development)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
3. **Register plugin:**
|
|
180
|
+
- Add to `host/src/modern.runtime.ts`
|
|
181
|
+
- Add to `host/src/saas.config.ts`
|
|
182
|
+
|
|
183
|
+
### Adding a New PocketBase Collection
|
|
184
|
+
|
|
185
|
+
1. **Define collection schema** in `pocketbase/pb_migrations/`
|
|
186
|
+
2. **Include multi-tenancy fields:**
|
|
187
|
+
```javascript
|
|
188
|
+
{
|
|
189
|
+
name: 'mycollection',
|
|
190
|
+
fields: [
|
|
191
|
+
{ name: 'organizationId', type: 'relation', required: true },
|
|
192
|
+
{ name: 'ownerId', type: 'relation', required: true },
|
|
193
|
+
// ... your fields
|
|
194
|
+
],
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
3. **Set API rules** for organization isolation:
|
|
198
|
+
```
|
|
199
|
+
listRule: '@request.auth.id != "" && organizationId = @request.auth.membership.organizations'
|
|
200
|
+
viewRule: '@request.auth.id != "" && organizationId = @request.auth.membership.organizations'
|
|
201
|
+
createRule: '@request.auth.id != "" && organizationId = @request.auth.membership.organizations'
|
|
202
|
+
updateRule: '@request.auth.id != "" && organizationId = @request.auth.membership.organizations && ownerId = @request.auth.id'
|
|
203
|
+
deleteRule: '@request.auth.id != "" && organizationId = @request.auth.membership.organizations && ownerId = @request.auth.id'
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Debugging Plugin Not Loading
|
|
207
|
+
|
|
208
|
+
**Symptoms:** Plugin doesn't appear in navigation
|
|
209
|
+
|
|
210
|
+
**Solutions:**
|
|
211
|
+
1. Check plugin is enabled in `host/src/saas.config.ts`
|
|
212
|
+
2. Check `plugin.config.ts` has correct structure
|
|
213
|
+
3. Check browser console for errors
|
|
214
|
+
4. Verify plugin dev server is running (dev mode)
|
|
215
|
+
5. Check `modern.runtime.ts` has plugin registered
|
|
216
|
+
6. Verify `activeWhen` path matches route
|
|
217
|
+
|
|
218
|
+
### Hot Module Replacement Not Working
|
|
219
|
+
|
|
220
|
+
**Solutions:**
|
|
221
|
+
1. Clear browser cache
|
|
222
|
+
2. Restart dev server
|
|
223
|
+
3. Check for syntax errors in your code
|
|
224
|
+
4. Verify Modern.js config includes `@modern-js/plugin-garfish`
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Environment Variables
|
|
229
|
+
|
|
230
|
+
### Development (.env.development)
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# PocketBase (local)
|
|
234
|
+
VITE_POCKETBASE_URL=http://127.0.0.1:8090
|
|
235
|
+
|
|
236
|
+
# Application
|
|
237
|
+
VITE_APP_URL=http://localhost:8080
|
|
238
|
+
|
|
239
|
+
# Features
|
|
240
|
+
VITE_ENABLE_DEV_TOOLS=true
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Production (.env.production)
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# PocketBase (production)
|
|
247
|
+
VITE_POCKETBASE_URL=https://pb.yourdomain.com
|
|
248
|
+
|
|
249
|
+
# Application
|
|
250
|
+
VITE_APP_URL=https://yourdomain.com
|
|
251
|
+
|
|
252
|
+
# Features
|
|
253
|
+
VITE_ENABLE_DEV_TOOLS=false
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Troubleshooting
|
|
259
|
+
|
|
260
|
+
### "Cannot connect to PocketBase"
|
|
261
|
+
|
|
262
|
+
**Solutions:**
|
|
263
|
+
1. Ensure PocketBase is running: `./pocketbase serve`
|
|
264
|
+
2. Check `VITE_POCKETBASE_URL` in .env file
|
|
265
|
+
3. Verify no firewall blocking port 8090
|
|
266
|
+
|
|
267
|
+
### "Module not found" errors
|
|
268
|
+
|
|
269
|
+
**Solutions:**
|
|
270
|
+
1. Clear cache: `pnpm run clean`
|
|
271
|
+
2. Reinstall: `rm -rf node_modules && pnpm install`
|
|
272
|
+
|
|
273
|
+
### "Port already in use"
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Find and kill process on port 8080
|
|
277
|
+
lsof -ti:8080 | xargs kill -9 # macOS/Linux
|
|
278
|
+
netstat -ano | findstr :8080 # Windows
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### TypeScript Errors
|
|
282
|
+
|
|
283
|
+
**Common Issues:**
|
|
284
|
+
- Test files included in build → Add to `tsconfig.json` exclude
|
|
285
|
+
- Import path incorrect → Check path mapping in tsconfig
|
|
286
|
+
- Missing type definitions → Create `.d.ts` file
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Linting and Formatting
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Lint all code
|
|
294
|
+
pnpm run lint
|
|
295
|
+
|
|
296
|
+
# Format code
|
|
297
|
+
pnpm run format
|
|
298
|
+
|
|
299
|
+
# Type check
|
|
300
|
+
pnpm run typecheck
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Performance Tips
|
|
306
|
+
|
|
307
|
+
### During Development
|
|
308
|
+
|
|
309
|
+
1. **Close unused browser tabs** - Reduces memory usage
|
|
310
|
+
2. **Restart dev server periodically** - Prevents memory leaks
|
|
311
|
+
3. **Use code splitting** - Lazy load routes
|
|
312
|
+
|
|
313
|
+
### For Production
|
|
314
|
+
|
|
315
|
+
1. **Analyze bundle size:**
|
|
316
|
+
```bash
|
|
317
|
+
pnpm run build
|
|
318
|
+
# Check dist/static/js/ sizes
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
2. **Enable compression** in nginx:
|
|
322
|
+
```nginx
|
|
323
|
+
gzip on;
|
|
324
|
+
gzip_types text/plain text/css application/json application/javascript;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
3. **Implement caching:**
|
|
328
|
+
```nginx
|
|
329
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
330
|
+
expires 1y;
|
|
331
|
+
add_header Cache-Control "public, immutable";
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Debug Mode
|
|
338
|
+
|
|
339
|
+
### Enable Debug Logging
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
// In development, log everything
|
|
343
|
+
if (import.meta.env.DEV) {
|
|
344
|
+
console.log('Debug info:', data);
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Browser DevTools
|
|
349
|
+
|
|
350
|
+
1. **React DevTools** - Component tree inspection
|
|
351
|
+
2. **Redux DevTools** - State inspection (if using Redux)
|
|
352
|
+
3. **Network tab** - API request debugging
|
|
353
|
+
4. **Console** - Error messages and warnings
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Version Management
|
|
358
|
+
|
|
359
|
+
### Bumping Version
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Patch release (bug fixes)
|
|
363
|
+
pnpm run version:patch
|
|
364
|
+
|
|
365
|
+
# Minor release (new features)
|
|
366
|
+
pnpm run version:minor
|
|
367
|
+
|
|
368
|
+
# Major release (breaking changes)
|
|
369
|
+
pnpm run version:major
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Publishing
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Publish CLI to npm
|
|
376
|
+
pnpm run publish:cli
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Checkpoint Workflow
|
|
382
|
+
|
|
383
|
+
**IMPORTANT:** For every task, bugfix, or feature, create a checkpoint file:
|
|
384
|
+
|
|
385
|
+
1. **Create checkpoint** in appropriate directory:
|
|
386
|
+
```bash
|
|
387
|
+
# For bugfixes
|
|
388
|
+
docs/checkpoints/bugfixes/01-issue-description.md
|
|
389
|
+
|
|
390
|
+
# For features
|
|
391
|
+
docs/checkpoints/features/01-feature-name.md
|
|
392
|
+
|
|
393
|
+
# For enhancements
|
|
394
|
+
docs/checkpoints/enhancements/01-enhancement-name.md
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
2. **Use the template** from `docs/checkpoints/.template.md`
|
|
398
|
+
|
|
399
|
+
3. **Update status** as you progress
|
|
400
|
+
|
|
401
|
+
4. **Mark complete** when done
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
**Next:** Read [`03-environment-setup.md`](./03-environment-setup.md) for environment configuration.
|