plutonium 0.34.1 → 0.35.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.
- checksums.yaml +4 -4
- data/.claude/skills/plutonium/skill.md +53 -0
- data/.claude/skills/{assets → plutonium-assets}/SKILL.md +13 -8
- data/.claude/skills/{connect-resource → plutonium-connect-resource}/SKILL.md +1 -1
- data/.claude/skills/{controller → plutonium-controller}/SKILL.md +27 -13
- data/.claude/skills/{create-resource → plutonium-create-resource}/SKILL.md +1 -1
- data/.claude/skills/{definition → plutonium-definition}/SKILL.md +10 -10
- data/.claude/skills/{definition-actions → plutonium-definition-actions}/SKILL.md +34 -9
- data/.claude/skills/{definition-fields → plutonium-definition-fields}/SKILL.md +38 -10
- data/.claude/skills/plutonium-definition-query/SKILL.md +356 -0
- data/.claude/skills/{forms → plutonium-forms}/SKILL.md +6 -6
- data/.claude/skills/{installation → plutonium-installation}/SKILL.md +9 -9
- data/.claude/skills/{interaction → plutonium-interaction}/SKILL.md +20 -19
- data/.claude/skills/{model → plutonium-model}/SKILL.md +3 -3
- data/.claude/skills/{model-features → plutonium-model-features}/SKILL.md +3 -3
- data/.claude/skills/{nested-resources → plutonium-nested-resources}/SKILL.md +5 -5
- data/.claude/skills/{package → plutonium-package}/SKILL.md +7 -8
- data/.claude/skills/{policy → plutonium-policy}/SKILL.md +26 -4
- data/.claude/skills/{portal → plutonium-portal}/SKILL.md +33 -31
- data/.claude/skills/{resource → plutonium-resource}/SKILL.md +27 -27
- data/.claude/skills/{rodauth → plutonium-rodauth}/SKILL.md +5 -5
- data/.claude/skills/plutonium-theming/SKILL.md +424 -0
- data/.claude/skills/{views → plutonium-views}/SKILL.md +7 -7
- data/CHANGELOG.md +52 -0
- data/CLAUDE.md +215 -0
- data/CONTRIBUTING.md +72 -18
- data/README.md +100 -19
- data/app/assets/plutonium.css +1 -11
- data/app/assets/plutonium.js +1685 -1146
- data/app/assets/plutonium.js.map +4 -4
- data/app/assets/plutonium.min.js +70 -70
- data/app/assets/plutonium.min.js.map +4 -4
- data/app/views/resource/interactive_bulk_action.html.erb +1 -5
- data/app/views/rodauth/_email_auth_request_form.html.erb +1 -1
- data/app/views/rodauth/_login_form.html.erb +15 -55
- data/app/views/rodauth/_login_form_footer.html.erb +2 -2
- data/app/views/rodauth/_password_visibility.html.erb +2 -8
- data/app/views/rodauth/add_recovery_codes.html.erb +2 -2
- data/app/views/rodauth/change_login.html.erb +36 -19
- data/app/views/rodauth/change_password.html.erb +34 -10
- data/app/views/rodauth/close_account.html.erb +12 -4
- data/app/views/rodauth/confirm_password.html.erb +19 -17
- data/app/views/rodauth/create_account.html.erb +30 -109
- data/app/views/rodauth/email_auth.html.erb +1 -1
- data/app/views/rodauth/logout.html.erb +4 -4
- data/app/views/rodauth/otp_auth.html.erb +13 -4
- data/app/views/rodauth/otp_disable.html.erb +12 -4
- data/app/views/rodauth/otp_setup.html.erb +29 -12
- data/app/views/rodauth/otp_unlock.html.erb +19 -10
- data/app/views/rodauth/otp_unlock_not_available.html.erb +7 -7
- data/app/views/rodauth/recovery_auth.html.erb +12 -4
- data/app/views/rodauth/recovery_codes.html.erb +12 -4
- data/app/views/rodauth/remember.html.erb +7 -7
- data/app/views/rodauth/reset_password.html.erb +23 -7
- data/app/views/rodauth/reset_password_request.html.erb +14 -10
- data/app/views/rodauth/sms_auth.html.erb +13 -4
- data/app/views/rodauth/sms_confirm.html.erb +13 -4
- data/app/views/rodauth/sms_disable.html.erb +12 -4
- data/app/views/rodauth/sms_request.html.erb +1 -1
- data/app/views/rodauth/sms_setup.html.erb +23 -7
- data/app/views/rodauth/two_factor_auth.html.erb +2 -2
- data/app/views/rodauth/two_factor_disable.html.erb +12 -4
- data/app/views/rodauth/two_factor_manage.html.erb +7 -7
- data/app/views/rodauth/unlock_account.html.erb +13 -5
- data/app/views/rodauth/unlock_account_request.html.erb +2 -2
- data/app/views/rodauth/verify_account.html.erb +25 -7
- data/app/views/rodauth/verify_account_resend.html.erb +14 -10
- data/app/views/rodauth/verify_login_change.html.erb +1 -1
- data/app/views/rodauth/webauthn_auth.html.erb +1 -1
- data/app/views/rodauth/webauthn_remove.html.erb +18 -8
- data/app/views/rodauth/webauthn_setup.html.erb +12 -4
- data/docs/.vitepress/config.ts +15 -26
- data/docs/.vitepress/theme/custom.css +388 -29
- data/docs/getting-started/index.md +1 -1
- data/docs/getting-started/tutorial/02-first-resource.md +9 -0
- data/docs/getting-started/tutorial/06-nested-resources.md +2 -2
- data/docs/getting-started/tutorial/07-author-portal.md +191 -0
- data/docs/getting-started/tutorial/{07-customizing-ui.md → 08-customizing-ui.md} +7 -7
- data/docs/getting-started/tutorial/index.md +5 -2
- data/docs/guides/authorization.md +33 -0
- data/docs/guides/creating-packages.md +12 -16
- data/docs/guides/custom-actions.md +36 -0
- data/docs/guides/search-filtering.md +121 -42
- data/docs/guides/theming.md +232 -36
- data/docs/index.md +203 -57
- data/docs/public/og-image.png +0 -0
- data/docs/reference/controller/index.md +14 -16
- data/docs/reference/definition/actions.md +38 -3
- data/docs/reference/definition/fields.md +3 -3
- data/docs/reference/definition/index.md +2 -2
- data/docs/reference/generators/index.md +0 -1
- data/docs/reference/interaction/index.md +14 -10
- data/docs/reference/model/index.md +0 -1
- data/docs/reference/portal/index.md +13 -27
- data/gemfiles/rails_7.gemfile.lock +1 -1
- data/gemfiles/rails_8.0.gemfile.lock +1 -1
- data/gemfiles/rails_8.1.gemfile.lock +1 -1
- data/lib/generators/pu/pkg/portal/portal_generator.rb +0 -2
- data/lib/generators/pu/pkg/portal/templates/app/views/package/dashboard/index.html.erb +28 -72
- data/lib/plutonium/action/interactive.rb +2 -2
- data/lib/plutonium/core/controller.rb +2 -1
- data/lib/plutonium/definition/actions.rb +2 -2
- data/lib/plutonium/lib/deep_freezer.rb +3 -7
- data/lib/plutonium/query/filter.rb +14 -0
- data/lib/plutonium/query/filters/association.rb +49 -0
- data/lib/plutonium/query/filters/boolean.rb +35 -0
- data/lib/plutonium/query/filters/date.rb +97 -0
- data/lib/plutonium/query/filters/date_range.rb +58 -0
- data/lib/plutonium/query/filters/select.rb +55 -0
- data/lib/plutonium/resource/controllers/crud_actions.rb +24 -6
- data/lib/plutonium/resource/controllers/interactive_actions.rb +76 -58
- data/lib/plutonium/resource/controllers/queryable.rb +4 -2
- data/lib/plutonium/resource/query_object.rb +1 -1
- data/lib/plutonium/ui/action_button.rb +23 -65
- data/lib/plutonium/ui/actions_dropdown.rb +103 -0
- data/lib/plutonium/ui/block.rb +1 -1
- data/lib/plutonium/ui/breadcrumbs.rb +12 -19
- data/lib/plutonium/ui/color_mode_selector.rb +1 -1
- data/lib/plutonium/ui/component/kit.rb +6 -0
- data/lib/plutonium/ui/component_classes.rb +102 -0
- data/lib/plutonium/ui/display/base.rb +15 -0
- data/lib/plutonium/ui/display/components/attachment.rb +6 -5
- data/lib/plutonium/ui/display/components/boolean.rb +23 -0
- data/lib/plutonium/ui/display/components/color.rb +23 -0
- data/lib/plutonium/ui/display/resource.rb +1 -1
- data/lib/plutonium/ui/display/theme.rb +29 -15
- data/lib/plutonium/ui/empty_card.rb +3 -3
- data/lib/plutonium/ui/form/base.rb +20 -0
- data/lib/plutonium/ui/form/components/key_value_store.rb +11 -11
- data/lib/plutonium/ui/form/components/resource_select.rb +31 -0
- data/lib/plutonium/ui/form/components/secure_association.rb +1 -2
- data/lib/plutonium/ui/form/components/uppy.rb +5 -4
- data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +4 -4
- data/lib/plutonium/ui/form/interaction.rb +17 -1
- data/lib/plutonium/ui/form/query.rb +133 -80
- data/lib/plutonium/ui/form/theme.rb +50 -35
- data/lib/plutonium/ui/frame_navigator_panel.rb +2 -2
- data/lib/plutonium/ui/layout/base.rb +1 -1
- data/lib/plutonium/ui/layout/header.rb +4 -7
- data/lib/plutonium/ui/layout/rodauth_layout.rb +7 -7
- data/lib/plutonium/ui/layout/sidebar.rb +1 -1
- data/lib/plutonium/ui/nav_grid_menu.rb +7 -6
- data/lib/plutonium/ui/nav_user.rb +9 -8
- data/lib/plutonium/ui/page/interactive_action.rb +5 -5
- data/lib/plutonium/ui/page_header.rb +29 -10
- data/lib/plutonium/ui/panel.rb +4 -4
- data/lib/plutonium/ui/sidebar_menu.rb +8 -8
- data/lib/plutonium/ui/skeleton_table.rb +7 -8
- data/lib/plutonium/ui/tab_list.rb +5 -5
- data/lib/plutonium/ui/table/base.rb +3 -0
- data/lib/plutonium/ui/table/components/attachment.rb +4 -3
- data/lib/plutonium/ui/table/components/bulk_actions_toolbar.rb +82 -0
- data/lib/plutonium/ui/table/components/pagy_info.rb +2 -2
- data/lib/plutonium/ui/table/components/pagy_pagination.rb +13 -8
- data/lib/plutonium/ui/table/components/row_actions_dropdown.rb +101 -0
- data/lib/plutonium/ui/table/components/scopes_bar.rb +2 -2
- data/lib/plutonium/ui/table/components/selection_column.rb +100 -0
- data/lib/plutonium/ui/table/display_theme.rb +6 -6
- data/lib/plutonium/ui/table/resource.rb +93 -52
- data/lib/plutonium/ui/table/theme.rb +28 -15
- data/lib/plutonium/version.rb +1 -1
- data/package.json +2 -2
- data/plutonium.gemspec +5 -4
- data/src/css/components.css +471 -0
- data/src/css/intl_tel_input.css +2 -2
- data/src/css/plutonium.css +2 -0
- data/src/css/tokens.css +149 -0
- data/src/js/controllers/bulk_actions_controller.js +109 -0
- data/src/js/controllers/filter_panel_controller.js +35 -0
- data/src/js/controllers/register_controllers.js +5 -1
- data/src/js/controllers/resource_drop_down_controller.js +25 -1
- data/src/js/controllers/slim_select_controller.js +6 -2
- data/src/js/turbo/turbo_actions.js +1 -1
- metadata +52 -39
- data/.claude/skills/definition-query/SKILL.md +0 -334
- data/docs/concepts/architecture.md +0 -226
- data/docs/concepts/auto-detection.md +0 -254
- data/docs/concepts/index.md +0 -61
- data/docs/concepts/packages-portals.md +0 -304
- data/docs/concepts/resources.md +0 -224
- data/docs/cookbook/blog.md +0 -411
- data/docs/cookbook/index.md +0 -289
- data/docs/cookbook/saas.md +0 -481
- data/docs/public/CLAUDE.md +0 -578
- data/lib/generators/pu/pkg/portal/templates/app/controllers/resource_controller.rb.tt +0 -5
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
## [0.35.0] - 2026-01-20
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Add demo_features package and demo_portal for testing
|
|
6
|
+
- Implement bulk actions for resource tables
|
|
7
|
+
- Modernize UI with design token system and component classes
|
|
8
|
+
- Add actions dropdown for secondary and danger actions
|
|
9
|
+
- Add form input type aliases for explicit field type declarations
|
|
10
|
+
- Add built-in filter types with dropdown filter panel UI
|
|
11
|
+
- *(display)* Add boolean and color components with type aliases
|
|
12
|
+
- *(filters)* Add clear all button with filter-panel controller
|
|
13
|
+
|
|
14
|
+
### 🐛 Bug Fixes
|
|
15
|
+
|
|
16
|
+
- Use turbo stream redirect action instead of HTTP 302 for form submissions
|
|
17
|
+
- Exclude turbo_stream format from URL preservation
|
|
18
|
+
- Improve table container scroll and telephone input padding
|
|
19
|
+
- Pass unwrapped record into custom column blocks
|
|
20
|
+
- *(docs)* Prevent h2 text cutoff in VitePress docs
|
|
21
|
+
|
|
22
|
+
### 🚜 Refactor
|
|
23
|
+
|
|
24
|
+
- Remove ResourceController from portal generator
|
|
25
|
+
- Rename skills with plutonium- prefix to avoid conflicts
|
|
26
|
+
- Simplify dashboard templates with design system classes
|
|
27
|
+
- *(ui)* Update auth pages with new design tokens
|
|
28
|
+
|
|
29
|
+
### 📚 Documentation
|
|
30
|
+
|
|
31
|
+
- Improve interaction docs
|
|
32
|
+
- Overhaul README, CONTRIBUTING, and add CLAUDE.md for development
|
|
33
|
+
- Redesign landing page with modern layout and AI messaging
|
|
34
|
+
- Unify branding and add social preview meta tags
|
|
35
|
+
- Fix broken links
|
|
36
|
+
- Add Author Portal tutorial chapter
|
|
37
|
+
- Fix minimum rails version
|
|
38
|
+
- Fix drafts scope for posts
|
|
39
|
+
- Remove cookbooks
|
|
40
|
+
- Reorganize features section of homepage
|
|
41
|
+
- Clean up docs and fix misc issues
|
|
42
|
+
- Rewrite theming guide with design tokens and component classes
|
|
43
|
+
- Removed potentially misleading section on per portal themes
|
|
44
|
+
- Document authorization methods
|
|
45
|
+
- Add skills for themeing specifically
|
|
46
|
+
|
|
47
|
+
### ⚙️ Miscellaneous Tasks
|
|
48
|
+
|
|
49
|
+
- Optimize og graph title and images
|
|
50
|
+
- Realign marketing material
|
|
51
|
+
- Add seeds for demo models and fix foreign keys
|
|
52
|
+
- Standardrb
|
|
1
53
|
## [0.34.1] - 2026-01-18
|
|
2
54
|
|
|
3
55
|
### 🐛 Bug Fixes
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Plutonium Core Development Guide
|
|
2
|
+
|
|
3
|
+
This guide helps AI assistants contribute to the Plutonium framework itself.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Plutonium is a Rails RAD framework distributed as a Ruby gem. It provides resource-oriented architecture with automatic CRUD, policies, definitions, and multi-tenancy.
|
|
8
|
+
|
|
9
|
+
## Repository Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
plutonium-core/
|
|
13
|
+
├── lib/plutonium/ # Core framework code
|
|
14
|
+
│ ├── resource/ # Resource system (controllers, policies, definitions)
|
|
15
|
+
│ ├── portal/ # Portal engines and multi-tenancy
|
|
16
|
+
│ ├── interaction/ # Business logic encapsulation
|
|
17
|
+
│ ├── ui/ # Phlex view components
|
|
18
|
+
│ ├── definition/ # Definition DSL and field types
|
|
19
|
+
│ ├── query/ # Search, filters, scopes
|
|
20
|
+
│ ├── auth/ # Authentication (Rodauth integration)
|
|
21
|
+
│ ├── routing/ # Route helpers and extensions
|
|
22
|
+
│ └── generators/ # Rails generators (pu:res:scaffold, etc.)
|
|
23
|
+
├── app/ # Rails app components
|
|
24
|
+
│ ├── assets/ # JavaScript, CSS
|
|
25
|
+
│ ├── controllers/ # Base controllers
|
|
26
|
+
│ └── views/ # Phlex components
|
|
27
|
+
├── test/ # Test suite
|
|
28
|
+
│ ├── plutonium/ # Unit tests mirroring lib/ structure
|
|
29
|
+
│ ├── dummy/ # Test Rails app
|
|
30
|
+
│ └── system/ # System/integration tests
|
|
31
|
+
├── docs/ # VitePress documentation site
|
|
32
|
+
│ ├── getting-started/
|
|
33
|
+
│ ├── guides/
|
|
34
|
+
│ └── reference/
|
|
35
|
+
└── .claude/skills/ # AI assistant skills (documentation for Claude)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Key Abstractions
|
|
39
|
+
|
|
40
|
+
### Resource System
|
|
41
|
+
- `Plutonium::Resource::Record` - Model mixin with `associated_with` scopes
|
|
42
|
+
- `Plutonium::Resource::Policy` - ActionPolicy-based authorization
|
|
43
|
+
- `Plutonium::Resource::Definition` - Declarative UI configuration
|
|
44
|
+
- `Plutonium::Resource::Controller` - CRUD controller mixin
|
|
45
|
+
- `Plutonium::Resource::Interaction` - Business logic encapsulation
|
|
46
|
+
|
|
47
|
+
### Portal System
|
|
48
|
+
- `Plutonium::Portal::Engine` - Rails engine mixin for web interfaces
|
|
49
|
+
- `Plutonium::Package::Engine` - Rails engine mixin for feature packages
|
|
50
|
+
- Entity scoping for multi-tenancy (path or custom strategy)
|
|
51
|
+
|
|
52
|
+
### UI Components
|
|
53
|
+
Located in `lib/plutonium/ui/` - Phlex-based components:
|
|
54
|
+
- `page/` - Page layouts (index, show, new, edit)
|
|
55
|
+
- `form/` - Form builders and field components
|
|
56
|
+
- `table/` - Data tables with sorting, pagination
|
|
57
|
+
- `display/` - Field display components
|
|
58
|
+
|
|
59
|
+
## Development Workflow
|
|
60
|
+
|
|
61
|
+
### Environment Setup
|
|
62
|
+
|
|
63
|
+
When working on Plutonium itself, set:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export PLUTONIUM_DEV=1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This enables development mode which:
|
|
70
|
+
- Uses local assets instead of packaged ones
|
|
71
|
+
- Enables hot reloading of components
|
|
72
|
+
- Shows more detailed error messages
|
|
73
|
+
|
|
74
|
+
### Building Assets
|
|
75
|
+
|
|
76
|
+
When working on JavaScript or CSS in `src/`:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Watch mode (rebuilds on changes to src/build/)
|
|
80
|
+
npm run dev
|
|
81
|
+
|
|
82
|
+
# Production build (to app/assets/)
|
|
83
|
+
npm run build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- `npm run dev` - watches and rebuilds to `src/build/` for development
|
|
87
|
+
- `npm run build` - compiles to `app/assets/` for release
|
|
88
|
+
|
|
89
|
+
**Always run `npm run dev`** in a terminal when working on frontend code.
|
|
90
|
+
|
|
91
|
+
### Running Tests
|
|
92
|
+
|
|
93
|
+
Tests use [Appraisal](https://github.com/thoughtbot/appraisal) for multiple Rails versions:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Full test suite (all Rails versions)
|
|
97
|
+
bundle exec appraisal rake test
|
|
98
|
+
|
|
99
|
+
# Specific Rails version
|
|
100
|
+
bundle exec appraisal rails-8.1 rake test
|
|
101
|
+
|
|
102
|
+
# Specific test file
|
|
103
|
+
bundle exec appraisal rails-8.1 ruby -Itest test/plutonium/resource/policy_test.rb
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Available: `rails-7`, `rails-8.0`, `rails-8.1`
|
|
107
|
+
|
|
108
|
+
### Testing Generators
|
|
109
|
+
|
|
110
|
+
Generators are in `lib/generators/pu/`. Test by:
|
|
111
|
+
1. Running in the dummy app: `cd test/dummy && rails g pu:res:scaffold ...`
|
|
112
|
+
2. Generator tests in `test/generators/`
|
|
113
|
+
|
|
114
|
+
### Documentation
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd docs
|
|
118
|
+
pnpm install
|
|
119
|
+
pnpm dev # Local preview at localhost:5173
|
|
120
|
+
pnpm build # Build for production
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Code Conventions
|
|
124
|
+
|
|
125
|
+
### Ruby Style
|
|
126
|
+
- Follow Rails conventions
|
|
127
|
+
- Use `with_connection` for database operations (fiber-safe)
|
|
128
|
+
- Avoid excessive defensive programming (no `respond_to?` checks)
|
|
129
|
+
- Use `Rails.logger.warn { "message" }` block syntax in production code
|
|
130
|
+
|
|
131
|
+
### Generators
|
|
132
|
+
- Always provide `--dest=` flag support to avoid interactive prompts
|
|
133
|
+
- Use `--dest=main_app` for main application, `--dest=package_name` for packages
|
|
134
|
+
- Quote shell arguments with special characters: `'field:type?'`, `'field:decimal{10,2}'`
|
|
135
|
+
|
|
136
|
+
### Migrations
|
|
137
|
+
- Inline indexes and constraints in `create_table` blocks
|
|
138
|
+
- Use `foreign_key: {on_delete: :cascade}` where appropriate
|
|
139
|
+
|
|
140
|
+
### Frontend
|
|
141
|
+
- Stimulus controllers for interactivity (always register controllers)
|
|
142
|
+
- TailwindCSS 4 for styling
|
|
143
|
+
- Phlex for view components
|
|
144
|
+
|
|
145
|
+
## Adding New Features
|
|
146
|
+
|
|
147
|
+
### New Field Type
|
|
148
|
+
1. Add renderer in `lib/plutonium/ui/display/components/`
|
|
149
|
+
2. Add input in `lib/plutonium/ui/form/components/`
|
|
150
|
+
3. Register in field type mappings
|
|
151
|
+
4. Add tests and documentation
|
|
152
|
+
|
|
153
|
+
### New Generator
|
|
154
|
+
1. Create in `lib/generators/pu/category/name_generator.rb`
|
|
155
|
+
2. Add templates in `lib/generators/pu/category/name/templates/`
|
|
156
|
+
3. Add tests in `test/generators/`
|
|
157
|
+
4. Document in `docs/reference/generators/`
|
|
158
|
+
|
|
159
|
+
### New Interaction Response
|
|
160
|
+
1. Add response class in `lib/plutonium/interaction/response/`
|
|
161
|
+
2. Add helper method in `Plutonium::Interaction::Outcome::Success`
|
|
162
|
+
3. Document usage
|
|
163
|
+
|
|
164
|
+
## Skills System
|
|
165
|
+
|
|
166
|
+
The `.claude/skills/` directory contains documentation for AI assistants:
|
|
167
|
+
- Each skill is a focused guide on one concept
|
|
168
|
+
- Skills are loaded based on user queries
|
|
169
|
+
- Update skills when changing related functionality
|
|
170
|
+
- Skills require a gem release to take effect
|
|
171
|
+
|
|
172
|
+
## Release Process
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
bundle exec rake release:full
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This:
|
|
179
|
+
1. Checks npm authentication
|
|
180
|
+
2. Bumps version
|
|
181
|
+
3. Builds and publishes npm package
|
|
182
|
+
4. Builds and publishes gem
|
|
183
|
+
5. Pushes git tags
|
|
184
|
+
|
|
185
|
+
## Key Files Reference
|
|
186
|
+
|
|
187
|
+
| Purpose | Location |
|
|
188
|
+
|---------|----------|
|
|
189
|
+
| Gem version | `lib/plutonium/version.rb` |
|
|
190
|
+
| Main entry | `lib/plutonium.rb` |
|
|
191
|
+
| Configuration | `lib/plutonium/configuration.rb` |
|
|
192
|
+
| Base controller | `lib/plutonium/resource/controller.rb` |
|
|
193
|
+
| Base policy | `lib/plutonium/resource/policy.rb` |
|
|
194
|
+
| Base definition | `lib/plutonium/resource/definition.rb` |
|
|
195
|
+
| Interactions | `lib/plutonium/interaction/base.rb` |
|
|
196
|
+
| Generators | `lib/generators/pu/` |
|
|
197
|
+
|
|
198
|
+
## Common Tasks
|
|
199
|
+
|
|
200
|
+
### Fix a bug in policies
|
|
201
|
+
1. Find the issue in `lib/plutonium/resource/policy.rb` or related
|
|
202
|
+
2. Write a failing test in `test/plutonium/resource/policy_test.rb`
|
|
203
|
+
3. Fix the bug
|
|
204
|
+
4. Update docs if behavior changed
|
|
205
|
+
|
|
206
|
+
### Add a generator option
|
|
207
|
+
1. Add option in generator class
|
|
208
|
+
2. Update templates to use option
|
|
209
|
+
3. Test with dummy app
|
|
210
|
+
4. Document in `docs/reference/generators/`
|
|
211
|
+
|
|
212
|
+
### Update documentation
|
|
213
|
+
1. Edit files in `docs/`
|
|
214
|
+
2. If user-facing behavior, update relevant skill in `.claude/skills/`
|
|
215
|
+
3. Run `pnpm build` to verify no broken links
|
data/CONTRIBUTING.md
CHANGED
|
@@ -92,29 +92,83 @@ git push origin main --tags
|
|
|
92
92
|
# 4. GitHub Actions will automatically publish to RubyGems
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
##
|
|
96
|
-
|
|
97
|
-
Following semantic versioning:
|
|
95
|
+
## Development Setup
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
- **MINOR** (0.X.0): New features (backwards compatible)
|
|
101
|
-
- **PATCH** (0.0.X): Bug fixes (backwards compatible)
|
|
97
|
+
### Prerequisites
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
- Any `fix:` commits → PATCH
|
|
99
|
+
- Ruby 3.2+
|
|
100
|
+
- Node.js 18+
|
|
101
|
+
- PostgreSQL (for tests)
|
|
107
102
|
|
|
108
|
-
|
|
103
|
+
### Install Dependencies
|
|
109
104
|
|
|
110
105
|
```bash
|
|
111
|
-
# Install dependencies
|
|
112
106
|
bundle install
|
|
107
|
+
npm install
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Environment
|
|
111
|
+
|
|
112
|
+
Set this when working on Plutonium:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
export PLUTONIUM_DEV=1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This uses local assets and enables hot reloading.
|
|
119
|
+
|
|
120
|
+
### Building Assets
|
|
121
|
+
|
|
122
|
+
Frontend source is in `src/`. When making JS or CSS changes:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Watch mode - keeps rebuilding as you edit
|
|
126
|
+
npm run dev
|
|
127
|
+
|
|
128
|
+
# Production build - run before committing
|
|
129
|
+
npm run build
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Running Tests
|
|
113
133
|
|
|
114
|
-
|
|
115
|
-
bundle exec rspec
|
|
134
|
+
Tests run via [Appraisal](https://github.com/thoughtbot/appraisal) against multiple Rails versions:
|
|
116
135
|
|
|
117
|
-
|
|
136
|
+
```bash
|
|
137
|
+
# Full test suite (all Rails versions)
|
|
138
|
+
bundle exec appraisal rake test
|
|
139
|
+
|
|
140
|
+
# Specific Rails version
|
|
141
|
+
bundle exec appraisal rails-8.1 rake test
|
|
142
|
+
|
|
143
|
+
# Specific test file
|
|
144
|
+
bundle exec appraisal rails-8.1 ruby -Itest test/plutonium/resource/policy_test.rb
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Available appraisals: `rails-7`, `rails-8.0`, `rails-8.1`
|
|
148
|
+
|
|
149
|
+
### Testing Generators
|
|
150
|
+
|
|
151
|
+
Use the dummy app:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cd test/dummy
|
|
155
|
+
rails g pu:res:scaffold TestModel name:string --dest=main_app
|
|
156
|
+
rails db:migrate
|
|
157
|
+
bin/dev
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Documentation
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
cd docs
|
|
164
|
+
pnpm install
|
|
165
|
+
pnpm dev # Preview at localhost:5173
|
|
166
|
+
pnpm build # Check for errors
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Changelog Generation (optional)
|
|
170
|
+
|
|
171
|
+
```bash
|
|
118
172
|
brew install git-cliff # macOS
|
|
119
173
|
# or
|
|
120
174
|
cargo install git-cliff # via Rust
|
|
@@ -125,9 +179,9 @@ cargo install git-cliff # via Rust
|
|
|
125
179
|
1. Fork the repository
|
|
126
180
|
2. Create a feature branch: `git checkout -b feat/my-feature`
|
|
127
181
|
3. Make your changes with conventional commits
|
|
128
|
-
4. Run tests: `bundle exec
|
|
129
|
-
5.
|
|
130
|
-
6.
|
|
182
|
+
4. Run tests: `bundle exec appraisal rake test`
|
|
183
|
+
5. Build assets: `npm run build`
|
|
184
|
+
6. Push and create a pull request
|
|
131
185
|
|
|
132
186
|
## Questions?
|
|
133
187
|
|
data/README.md
CHANGED
|
@@ -1,33 +1,114 @@
|
|
|
1
|
-
# Plutonium
|
|
1
|
+
# Plutonium
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/plutonium)
|
|
3
4
|
[](https://github.com/radioactive-labs/plutonium-core/actions/workflows/main.yml)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Build production-ready Rails apps in minutes, not days. Convention-driven, fully customizable, and AI-ready. Plutonium picks up where Rails left off, adding application-level concepts that make building complex apps faster.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Quick Start
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
```bash
|
|
11
|
+
rails new myapp -a propshaft -j esbuild -c tailwind \
|
|
12
|
+
-m https://radioactive-labs.github.io/plutonium-core/templates/plutonium.rb
|
|
13
|
+
```
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
- **Complete CRUD Operations**: Rich fields, forms, tables, and nested resources out of the box
|
|
13
|
-
- **Modular Architecture**: Package system based on Rails engines for better organization
|
|
14
|
-
- **Entity Scoping**: Built-in multi-tenancy support that "just works"
|
|
15
|
-
- **Smart Generators**: Eliminate boilerplate while maintaining flexibility
|
|
16
|
-
- **Modern UI**: Beautiful, responsive interface powered by Tailwind CSS and Hotwire
|
|
15
|
+
Then create your first resource:
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
```bash
|
|
18
|
+
cd myapp
|
|
19
|
+
rails g pu:res:scaffold Post title:string body:text --dest=main_app
|
|
20
|
+
rails db:migrate
|
|
21
|
+
bin/dev
|
|
22
|
+
```
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
Visit `http://localhost:3000` - you have a complete CRUD interface.
|
|
25
|
+
|
|
26
|
+
## What You Get
|
|
27
|
+
|
|
28
|
+
**Resource-oriented architecture** - Models, policies, definitions, and controllers that work together:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
# Policy controls WHO can do WHAT
|
|
32
|
+
class PostPolicy < ResourcePolicy
|
|
33
|
+
def create? = user.present?
|
|
34
|
+
def update? = record.author == user || user.admin?
|
|
35
|
+
|
|
36
|
+
def permitted_attributes_for_create
|
|
37
|
+
%i[title body]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Definition controls HOW it renders
|
|
42
|
+
class PostDefinition < ResourceDefinition
|
|
43
|
+
input :body, as: :markdown
|
|
44
|
+
search { |scope, q| scope.where("title ILIKE ?", "%#{q}%") }
|
|
45
|
+
scope :published
|
|
46
|
+
scope :drafts
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Packages for organization** - Split your app into feature packages and portals:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
rails g pu:pkg:package blogging # Business logic
|
|
54
|
+
rails g pu:pkg:portal admin # Web interface
|
|
55
|
+
rails g pu:res:conn Post --dest=admin_portal
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Built-in authentication** via Rodauth:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rails g pu:rodauth:install
|
|
62
|
+
rails g pu:rodauth:account user
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Multi-tenancy** with entity scoping:
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
# In portal engine
|
|
69
|
+
scope_to_entity Organization, strategy: :path
|
|
70
|
+
# Routes become /organizations/:organization_id/posts
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Custom actions** with interactions:
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
class PublishInteraction < ResourceInteraction
|
|
77
|
+
attribute :resource
|
|
78
|
+
attribute :publish_at, :datetime
|
|
79
|
+
|
|
80
|
+
def execute
|
|
81
|
+
resource.update!(published_at: publish_at)
|
|
82
|
+
succeed(resource).with_message("Published!")
|
|
83
|
+
rescue ActiveRecord::RecordInvalid => e
|
|
84
|
+
failed(e.record.errors)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
22
88
|
|
|
23
89
|
## Documentation
|
|
24
90
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- Installation
|
|
28
|
-
-
|
|
29
|
-
-
|
|
91
|
+
Full documentation at **[radioactive-labs.github.io/plutonium-core](https://radioactive-labs.github.io/plutonium-core/)**
|
|
92
|
+
|
|
93
|
+
- [Installation](https://radioactive-labs.github.io/plutonium-core/getting-started/installation)
|
|
94
|
+
- [Tutorial](https://radioactive-labs.github.io/plutonium-core/getting-started/tutorial/)
|
|
95
|
+
- [Guides](https://radioactive-labs.github.io/plutonium-core/guides/)
|
|
96
|
+
- [Reference](https://radioactive-labs.github.io/plutonium-core/reference/)
|
|
97
|
+
|
|
98
|
+
## Requirements
|
|
99
|
+
|
|
100
|
+
- Ruby 3.2+
|
|
101
|
+
- Rails 7.1+ (Rails 8 recommended)
|
|
102
|
+
- Node.js 18+
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
107
|
+
|
|
108
|
+
## Status
|
|
109
|
+
|
|
110
|
+
Plutonium is used in production but still evolving. APIs may change between minor versions. Pin your version in Gemfile.
|
|
30
111
|
|
|
31
112
|
## License
|
|
32
113
|
|
|
33
|
-
|
|
114
|
+
MIT License - see [LICENSE](LICENSE).
|