plutonium 0.33.1 → 0.34.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/# Plutonium: The pre-alpha demo.md +4 -2
- data/.claude/skills/assets/SKILL.md +416 -0
- data/.claude/skills/connect-resource/SKILL.md +112 -0
- data/.claude/skills/controller/SKILL.md +302 -0
- data/.claude/skills/create-resource/SKILL.md +240 -0
- data/.claude/skills/definition/SKILL.md +218 -0
- data/.claude/skills/definition-actions/SKILL.md +386 -0
- data/.claude/skills/definition-fields/SKILL.md +474 -0
- data/.claude/skills/definition-query/SKILL.md +334 -0
- data/.claude/skills/forms/SKILL.md +439 -0
- data/.claude/skills/installation/SKILL.md +300 -0
- data/.claude/skills/interaction/SKILL.md +382 -0
- data/.claude/skills/model/SKILL.md +267 -0
- data/.claude/skills/model-features/SKILL.md +286 -0
- data/.claude/skills/nested-resources/SKILL.md +274 -0
- data/.claude/skills/package/SKILL.md +191 -0
- data/.claude/skills/policy/SKILL.md +352 -0
- data/.claude/skills/portal/SKILL.md +400 -0
- data/.claude/skills/resource/SKILL.md +281 -0
- data/.claude/skills/rodauth/SKILL.md +452 -0
- data/.claude/skills/views/SKILL.md +563 -0
- data/Appraisals +46 -4
- data/CHANGELOG.md +32 -1
- data/app/assets/plutonium.css +2 -2
- data/config/brakeman.ignore +239 -0
- data/config/initializers/action_policy.rb +1 -1
- data/docs/.vitepress/config.ts +132 -47
- data/docs/concepts/architecture.md +226 -0
- data/docs/concepts/auto-detection.md +254 -0
- data/docs/concepts/index.md +61 -0
- data/docs/concepts/packages-portals.md +304 -0
- data/docs/concepts/resources.md +224 -0
- data/docs/cookbook/blog.md +412 -0
- data/docs/cookbook/index.md +289 -0
- data/docs/cookbook/saas.md +481 -0
- data/docs/getting-started/index.md +56 -0
- data/docs/getting-started/installation.md +146 -0
- data/docs/getting-started/tutorial/01-setup.md +118 -0
- data/docs/getting-started/tutorial/02-first-resource.md +180 -0
- data/docs/getting-started/tutorial/03-authentication.md +246 -0
- data/docs/getting-started/tutorial/04-authorization.md +170 -0
- data/docs/getting-started/tutorial/05-custom-actions.md +202 -0
- data/docs/getting-started/tutorial/06-nested-resources.md +147 -0
- data/docs/getting-started/tutorial/07-customizing-ui.md +254 -0
- data/docs/getting-started/tutorial/index.md +64 -0
- data/docs/guides/adding-resources.md +420 -0
- data/docs/guides/authentication.md +551 -0
- data/docs/guides/authorization.md +468 -0
- data/docs/guides/creating-packages.md +380 -0
- data/docs/guides/custom-actions.md +523 -0
- data/docs/guides/index.md +45 -0
- data/docs/guides/multi-tenancy.md +302 -0
- data/docs/guides/nested-resources.md +411 -0
- data/docs/guides/search-filtering.md +266 -0
- data/docs/guides/theming.md +321 -0
- data/docs/index.md +67 -26
- data/docs/public/CLAUDE.md +64 -21
- data/docs/reference/assets/index.md +496 -0
- data/docs/reference/controller/index.md +363 -0
- data/docs/reference/definition/actions.md +400 -0
- data/docs/reference/definition/fields.md +350 -0
- data/docs/reference/definition/index.md +252 -0
- data/docs/reference/definition/query.md +342 -0
- data/docs/reference/generators/index.md +469 -0
- data/docs/reference/index.md +49 -0
- data/docs/reference/interaction/index.md +445 -0
- data/docs/reference/model/features.md +248 -0
- data/docs/reference/model/index.md +219 -0
- data/docs/reference/policy/index.md +385 -0
- data/docs/reference/portal/index.md +382 -0
- data/docs/reference/views/forms.md +396 -0
- data/docs/reference/views/index.md +479 -0
- data/gemfiles/rails_7.gemfile +9 -2
- data/gemfiles/rails_7.gemfile.lock +146 -111
- data/gemfiles/rails_8.0.gemfile +20 -0
- data/gemfiles/rails_8.0.gemfile.lock +417 -0
- data/gemfiles/rails_8.1.gemfile +20 -0
- data/gemfiles/rails_8.1.gemfile.lock +419 -0
- data/lib/generators/pu/gem/dotenv/templates/.env +2 -0
- data/lib/generators/pu/gem/dotenv/templates/config/initializers/001_ensure_required_env.rb +3 -1
- data/lib/generators/pu/lib/plutonium_generators/model_generator_base.rb +13 -16
- data/lib/generators/pu/pkg/portal/USAGE +65 -0
- data/lib/generators/pu/pkg/portal/portal_generator.rb +22 -9
- data/lib/generators/pu/res/conn/USAGE +71 -0
- data/lib/generators/pu/res/model/USAGE +106 -110
- data/lib/generators/pu/res/model/templates/model.rb.tt +6 -2
- data/lib/generators/pu/res/scaffold/USAGE +85 -0
- data/lib/generators/pu/rodauth/install_generator.rb +2 -6
- data/lib/generators/pu/rodauth/templates/config/initializers/url_options.rb +17 -0
- data/lib/generators/pu/skills/sync/USAGE +14 -0
- data/lib/generators/pu/skills/sync/sync_generator.rb +66 -0
- data/lib/plutonium/action_policy/sti_policy_lookup.rb +1 -1
- data/lib/plutonium/core/controller.rb +2 -2
- data/lib/plutonium/interaction/base.rb +1 -0
- data/lib/plutonium/package/engine.rb +2 -2
- data/lib/plutonium/query/adhoc_block.rb +6 -2
- data/lib/plutonium/query/model_scope.rb +1 -1
- data/lib/plutonium/railtie.rb +4 -0
- data/lib/plutonium/resource/controllers/crud_actions/index_action.rb +1 -1
- data/lib/plutonium/resource/query_object.rb +38 -8
- data/lib/plutonium/ui/table/components/scopes_bar.rb +39 -34
- data/lib/plutonium/version.rb +1 -1
- data/lib/tasks/release.rake +19 -4
- data/package.json +1 -1
- metadata +76 -39
- data/brakeman.ignore +0 -28
- data/docs/api-examples.md +0 -49
- data/docs/guide/claude-code-guide.md +0 -74
- data/docs/guide/deep-dive/authorization.md +0 -189
- data/docs/guide/deep-dive/multitenancy.md +0 -256
- data/docs/guide/deep-dive/resources.md +0 -390
- data/docs/guide/getting-started/01-installation.md +0 -165
- data/docs/guide/index.md +0 -28
- data/docs/guide/introduction/01-what-is-plutonium.md +0 -211
- data/docs/guide/introduction/02-core-concepts.md +0 -440
- data/docs/guide/tutorial/01-project-setup.md +0 -75
- data/docs/guide/tutorial/02-creating-a-feature-package.md +0 -45
- data/docs/guide/tutorial/03-defining-resources.md +0 -90
- data/docs/guide/tutorial/04-creating-a-portal.md +0 -101
- data/docs/guide/tutorial/05-customizing-the-ui.md +0 -128
- data/docs/guide/tutorial/06-adding-custom-actions.md +0 -101
- data/docs/guide/tutorial/07-implementing-authorization.md +0 -90
- data/docs/markdown-examples.md +0 -85
- data/docs/modules/action.md +0 -244
- data/docs/modules/authentication.md +0 -236
- data/docs/modules/configuration.md +0 -599
- data/docs/modules/controller.md +0 -443
- data/docs/modules/core.md +0 -316
- data/docs/modules/definition.md +0 -1308
- data/docs/modules/display.md +0 -759
- data/docs/modules/form.md +0 -495
- data/docs/modules/generator.md +0 -400
- data/docs/modules/index.md +0 -167
- data/docs/modules/interaction.md +0 -642
- data/docs/modules/package.md +0 -151
- data/docs/modules/policy.md +0 -176
- data/docs/modules/portal.md +0 -710
- data/docs/modules/query.md +0 -297
- data/docs/modules/resource_record.md +0 -618
- data/docs/modules/routing.md +0 -690
- data/docs/modules/table.md +0 -301
- data/docs/modules/ui.md +0 -631
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
# Generators Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for Plutonium CLI generators.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Plutonium provides generators for scaffolding:
|
|
8
|
+
- Resources (model, controller, definition, policy)
|
|
9
|
+
- Packages (feature and portal)
|
|
10
|
+
- Authentication (Rodauth)
|
|
11
|
+
- Assets and configuration
|
|
12
|
+
|
|
13
|
+
## Resource Generators
|
|
14
|
+
|
|
15
|
+
### pu:res:scaffold
|
|
16
|
+
|
|
17
|
+
Generate a complete resource with model, controller, definition, and policy.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
rails generate pu:res:scaffold Post title:string body:text published:boolean
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### Options
|
|
24
|
+
|
|
25
|
+
| Option | Description |
|
|
26
|
+
|--------|-------------|
|
|
27
|
+
| `--dest NAME` | Destination package (prompted if not provided) |
|
|
28
|
+
| `--no-model` | Skip model generation (use for existing models) |
|
|
29
|
+
|
|
30
|
+
#### Examples
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Basic resource (prompts for destination)
|
|
34
|
+
rails generate pu:res:scaffold Post title:string body:text
|
|
35
|
+
|
|
36
|
+
# Import existing model (no attributes needed)
|
|
37
|
+
rails generate pu:res:scaffold Post
|
|
38
|
+
|
|
39
|
+
# With associations
|
|
40
|
+
rails generate pu:res:scaffold Comment body:text user:belongs_to post:belongs_to
|
|
41
|
+
|
|
42
|
+
# Skip model generation for existing models
|
|
43
|
+
rails generate pu:res:scaffold Post title:string --no-model
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Field Types
|
|
47
|
+
|
|
48
|
+
| Type | Example | Database Type |
|
|
49
|
+
|------|---------|---------------|
|
|
50
|
+
| `string` | `title:string` | `string` |
|
|
51
|
+
| `text` | `body:text` | `text` |
|
|
52
|
+
| `integer` | `count:integer` | `integer` |
|
|
53
|
+
| `float` | `rating:float` | `float` |
|
|
54
|
+
| `decimal` | `price:decimal` | `decimal` |
|
|
55
|
+
| `boolean` | `active:boolean` | `boolean` |
|
|
56
|
+
| `date` | `published_on:date` | `date` |
|
|
57
|
+
| `datetime` | `published_at:datetime` | `datetime` |
|
|
58
|
+
| `time` | `starts_at:time` | `time` |
|
|
59
|
+
| `json` | `metadata:json` | `json` |
|
|
60
|
+
| `belongs_to` | `user:belongs_to` | `references` |
|
|
61
|
+
| `references` | `user:references` | `references` |
|
|
62
|
+
| `rich_text` | `content:rich_text` | Action Text |
|
|
63
|
+
|
|
64
|
+
#### Nullable Fields
|
|
65
|
+
|
|
66
|
+
Append `?` to make a field nullable:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
rails generate pu:res:scaffold Post title:string description:text?
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Money Fields (has_cents)
|
|
73
|
+
|
|
74
|
+
Integer fields ending in `_cents` are treated as money fields:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
rails generate pu:res:scaffold Product name:string price_cents:integer
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### pu:res:conn
|
|
81
|
+
|
|
82
|
+
Connect a resource to a portal.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
rails generate pu:res:conn Post --dest=admin_portal
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Creates portal-specific controller, definition, and policy (if needed) and registers the resource in the portal routes.
|
|
89
|
+
|
|
90
|
+
#### Examples
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Connect a resource to a portal
|
|
94
|
+
rails generate pu:res:conn Post --dest=admin_portal
|
|
95
|
+
|
|
96
|
+
# Connect multiple resources
|
|
97
|
+
rails generate pu:res:conn Post Comment --dest=admin_portal
|
|
98
|
+
|
|
99
|
+
# Interactive mode (prompts for resource and portal)
|
|
100
|
+
rails generate pu:res:conn
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
::: tip Nested Resources
|
|
104
|
+
Nesting is automatic based on `belongs_to` associations. If `Comment` belongs to `Post`, nested routes are created automatically when both are registered in the same portal.
|
|
105
|
+
:::
|
|
106
|
+
|
|
107
|
+
### pu:res:model
|
|
108
|
+
|
|
109
|
+
Generate just a model with migration.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
rails generate pu:res:model Post title:string body:text
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Package Generators
|
|
116
|
+
|
|
117
|
+
### pu:pkg:package
|
|
118
|
+
|
|
119
|
+
Generate a feature package for organizing domain code.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
rails generate pu:pkg:package blogging
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Generated Structure
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
packages/blogging/
|
|
129
|
+
├── app/
|
|
130
|
+
│ ├── controllers/blogging/
|
|
131
|
+
│ ├── definitions/blogging/
|
|
132
|
+
│ ├── interactions/blogging/
|
|
133
|
+
│ ├── models/blogging/
|
|
134
|
+
│ ├── policies/blogging/
|
|
135
|
+
│ └── views/blogging/
|
|
136
|
+
└── lib/
|
|
137
|
+
└── engine.rb
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### pu:pkg:portal
|
|
141
|
+
|
|
142
|
+
Generate a portal package (web interface).
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
rails generate pu:pkg:portal admin
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Options
|
|
149
|
+
|
|
150
|
+
| Option | Description |
|
|
151
|
+
|--------|-------------|
|
|
152
|
+
| `--auth NAME` | Rodauth account to authenticate with (e.g., `--auth=user`) |
|
|
153
|
+
| `--public` | Grant public access (no authentication) |
|
|
154
|
+
| `--byo` | Bring your own authentication |
|
|
155
|
+
|
|
156
|
+
#### Examples
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Interactive mode (prompts for auth choice)
|
|
160
|
+
rails generate pu:pkg:portal admin
|
|
161
|
+
|
|
162
|
+
# Non-interactive with Rodauth account
|
|
163
|
+
rails generate pu:pkg:portal admin --auth=admin
|
|
164
|
+
|
|
165
|
+
# Public access portal
|
|
166
|
+
rails generate pu:pkg:portal api --public
|
|
167
|
+
|
|
168
|
+
# Bring your own authentication
|
|
169
|
+
rails generate pu:pkg:portal custom --byo
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Without flags, the generator prompts for authentication configuration:
|
|
173
|
+
- Select a Rodauth account (if Rodauth is installed)
|
|
174
|
+
- Grant public access (no authentication)
|
|
175
|
+
- Bring your own auth (configure manually)
|
|
176
|
+
|
|
177
|
+
#### Generated Structure
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
packages/admin_portal/
|
|
181
|
+
├── app/
|
|
182
|
+
│ ├── controllers/admin_portal/
|
|
183
|
+
│ │ ├── concerns/controller.rb
|
|
184
|
+
│ │ ├── plutonium_controller.rb
|
|
185
|
+
│ │ ├── resource_controller.rb
|
|
186
|
+
│ │ └── dashboard_controller.rb
|
|
187
|
+
│ ├── definitions/admin_portal/
|
|
188
|
+
│ ├── policies/admin_portal/
|
|
189
|
+
│ └── views/admin_portal/
|
|
190
|
+
├── config/
|
|
191
|
+
│ └── routes.rb
|
|
192
|
+
└── lib/
|
|
193
|
+
└── engine.rb
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Authentication Generators
|
|
197
|
+
|
|
198
|
+
### pu:rodauth:install
|
|
199
|
+
|
|
200
|
+
Install Rodauth authentication framework.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
rails generate pu:rodauth:install
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This creates:
|
|
207
|
+
- `app/rodauth/rodauth_app.rb` - Main Roda app
|
|
208
|
+
- `app/rodauth/rodauth_plugin.rb` - Base plugin
|
|
209
|
+
- `app/controllers/rodauth_controller.rb` - Base controller
|
|
210
|
+
- `config/initializers/rodauth.rb` - Configuration
|
|
211
|
+
- PostgreSQL extension migration (if using PostgreSQL)
|
|
212
|
+
|
|
213
|
+
### pu:rodauth:account
|
|
214
|
+
|
|
215
|
+
Generate a user account with configurable features.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
rails generate pu:rodauth:account user
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Options
|
|
222
|
+
|
|
223
|
+
| Option | Description |
|
|
224
|
+
|--------|-------------|
|
|
225
|
+
| `--primary` | Mark as primary account (no URL prefix) |
|
|
226
|
+
| `--no-mails` | Skip mailer setup |
|
|
227
|
+
| `--argon2` | Use Argon2 for password hashing |
|
|
228
|
+
| `--api_only` | Configure for JSON API only |
|
|
229
|
+
| `--defaults` | Enable default features (default: true) |
|
|
230
|
+
| `--kitchen_sink` | Enable ALL features |
|
|
231
|
+
|
|
232
|
+
#### Feature Options
|
|
233
|
+
|
|
234
|
+
Default features (enabled with `--defaults`):
|
|
235
|
+
|
|
236
|
+
| Feature | Description |
|
|
237
|
+
|---------|-------------|
|
|
238
|
+
| `--login` | Login functionality |
|
|
239
|
+
| `--logout` | Logout functionality |
|
|
240
|
+
| `--remember` | "Remember me" cookies |
|
|
241
|
+
| `--create_account` | User registration |
|
|
242
|
+
| `--verify_account` | Email verification |
|
|
243
|
+
| `--verify_account_grace_period` | Grace period for verification |
|
|
244
|
+
| `--reset_password` | Password reset via email |
|
|
245
|
+
| `--reset_password_notify` | Notify on password reset |
|
|
246
|
+
| `--change_login` | Change email address |
|
|
247
|
+
| `--verify_login_change` | Verify email changes |
|
|
248
|
+
| `--change_password` | Change password |
|
|
249
|
+
| `--change_password_notify` | Notify on password change |
|
|
250
|
+
| `--case_insensitive_login` | Case insensitive email |
|
|
251
|
+
| `--internal_request` | Internal request support |
|
|
252
|
+
|
|
253
|
+
Additional features:
|
|
254
|
+
|
|
255
|
+
| Feature | Description |
|
|
256
|
+
|---------|-------------|
|
|
257
|
+
| `--otp` | TOTP two-factor auth |
|
|
258
|
+
| `--recovery_codes` | Recovery codes for 2FA |
|
|
259
|
+
| `--sms_codes` | SMS-based 2FA |
|
|
260
|
+
| `--webauthn` | WebAuthn/passkeys |
|
|
261
|
+
| `--lockout` | Account lockout |
|
|
262
|
+
| `--active_sessions` | Track active sessions |
|
|
263
|
+
| `--audit_logging` | Log auth events |
|
|
264
|
+
| `--close_account` | Allow account deletion |
|
|
265
|
+
| `--email_auth` | Passwordless email login |
|
|
266
|
+
| `--jwt` | JWT authentication |
|
|
267
|
+
| `--jwt_refresh` | JWT refresh tokens |
|
|
268
|
+
| `--password_expiration` | Force password changes |
|
|
269
|
+
| `--disallow_password_reuse` | Prevent password reuse |
|
|
270
|
+
|
|
271
|
+
#### Examples
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Basic account with defaults
|
|
275
|
+
rails generate pu:rodauth:account user
|
|
276
|
+
|
|
277
|
+
# Primary account (no /users prefix)
|
|
278
|
+
rails generate pu:rodauth:account user --primary
|
|
279
|
+
|
|
280
|
+
# With 2FA features
|
|
281
|
+
rails generate pu:rodauth:account user --otp --recovery_codes
|
|
282
|
+
|
|
283
|
+
# API-only with JWT
|
|
284
|
+
rails generate pu:rodauth:account api_user --api_only --jwt --jwt_refresh
|
|
285
|
+
|
|
286
|
+
# Everything enabled
|
|
287
|
+
rails generate pu:rodauth:account user --kitchen_sink
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### pu:rodauth:admin
|
|
291
|
+
|
|
292
|
+
Generate an admin account with enhanced security.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
rails generate pu:rodauth:admin admin
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Pre-configured with:
|
|
299
|
+
- Multi-phase login (email first, then password)
|
|
300
|
+
- TOTP two-factor authentication (required)
|
|
301
|
+
- Recovery codes
|
|
302
|
+
- Account lockout
|
|
303
|
+
- Active sessions tracking
|
|
304
|
+
- Audit logging
|
|
305
|
+
- No public signup
|
|
306
|
+
|
|
307
|
+
Creates a rake task for account creation:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
rails rodauth_admin:create[admin@example.com,password123]
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### pu:rodauth:customer
|
|
314
|
+
|
|
315
|
+
Generate a customer account with entity (organization) association.
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
rails generate pu:rodauth:customer customer
|
|
319
|
+
rails generate pu:rodauth:customer customer --entity=Organization
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Creates:
|
|
323
|
+
- Customer account model
|
|
324
|
+
- Entity model (default: "Entity")
|
|
325
|
+
- Membership join model
|
|
326
|
+
- Has-many-through associations
|
|
327
|
+
|
|
328
|
+
## Core Generators
|
|
329
|
+
|
|
330
|
+
### pu:core:install
|
|
331
|
+
|
|
332
|
+
Install Plutonium in an existing Rails app.
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
rails generate pu:core:install
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Creates:
|
|
339
|
+
- `config/initializers/plutonium.rb` - Configuration
|
|
340
|
+
- Base classes (ResourceRecord, ResourcePolicy, etc.)
|
|
341
|
+
- Package loading configuration
|
|
342
|
+
|
|
343
|
+
### pu:core:assets
|
|
344
|
+
|
|
345
|
+
Setup custom TailwindCSS and Stimulus assets.
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
rails generate pu:core:assets
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
This:
|
|
352
|
+
1. Installs npm packages (`@radioactive-labs/plutonium`, TailwindCSS plugins)
|
|
353
|
+
2. Creates `tailwind.config.js` extending Plutonium's config
|
|
354
|
+
3. Imports Plutonium CSS into your stylesheet
|
|
355
|
+
4. Registers Plutonium's Stimulus controllers
|
|
356
|
+
5. Updates Plutonium config to use your assets
|
|
357
|
+
|
|
358
|
+
## Eject Generators
|
|
359
|
+
|
|
360
|
+
### pu:eject:layout
|
|
361
|
+
|
|
362
|
+
Eject layout views for customization.
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
rails generate pu:eject:layout
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Copies layout files to your portal for customization.
|
|
369
|
+
|
|
370
|
+
### pu:eject:shell
|
|
371
|
+
|
|
372
|
+
Eject shell components (sidebar, header).
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
rails generate pu:eject:shell
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Common Patterns
|
|
379
|
+
|
|
380
|
+
### Full Application Setup
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
# Create Rails app with Plutonium template
|
|
384
|
+
rails new myapp -m https://radioactive-labs.github.io/plutonium-core/templates/plutonium.rb
|
|
385
|
+
|
|
386
|
+
# Or add to existing app
|
|
387
|
+
rails generate pu:core:install
|
|
388
|
+
rails generate pu:rodauth:install
|
|
389
|
+
|
|
390
|
+
# Create admin account type
|
|
391
|
+
rails generate pu:rodauth:admin admin
|
|
392
|
+
|
|
393
|
+
# Create resources
|
|
394
|
+
rails generate pu:res:scaffold Post title:string body:text
|
|
395
|
+
rails generate pu:res:scaffold Comment body:text post:belongs_to
|
|
396
|
+
|
|
397
|
+
# Create portal (prompts for auth)
|
|
398
|
+
rails generate pu:pkg:portal admin
|
|
399
|
+
|
|
400
|
+
# Connect resources
|
|
401
|
+
rails generate pu:res:conn Post Comment --dest=admin_portal
|
|
402
|
+
|
|
403
|
+
# Run migrations
|
|
404
|
+
rails db:migrate
|
|
405
|
+
|
|
406
|
+
# Create admin account
|
|
407
|
+
rails rodauth_admin:create[admin@example.com,password123]
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Adding a New Resource
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
# Generate the resource
|
|
414
|
+
rails generate pu:res:scaffold Product name:string price_cents:integer
|
|
415
|
+
|
|
416
|
+
# Connect to portal
|
|
417
|
+
rails generate pu:res:conn Product --dest=admin_portal
|
|
418
|
+
|
|
419
|
+
# Run migration
|
|
420
|
+
rails db:migrate
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Adding a New Portal
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Create customer account type
|
|
427
|
+
rails generate pu:rodauth:customer customer
|
|
428
|
+
|
|
429
|
+
# Create portal
|
|
430
|
+
rails generate pu:pkg:portal customer
|
|
431
|
+
|
|
432
|
+
# Connect resources
|
|
433
|
+
rails generate pu:res:conn Order --dest=customer_portal
|
|
434
|
+
|
|
435
|
+
# Run migrations
|
|
436
|
+
rails db:migrate
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Undoing Generators
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
rails destroy pu:res:scaffold Post
|
|
443
|
+
rails destroy pu:pkg:portal admin
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Troubleshooting
|
|
447
|
+
|
|
448
|
+
### Generator Not Found
|
|
449
|
+
|
|
450
|
+
Ensure Plutonium is installed:
|
|
451
|
+
|
|
452
|
+
```ruby
|
|
453
|
+
# Gemfile
|
|
454
|
+
gem "plutonium"
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Package Not Found
|
|
458
|
+
|
|
459
|
+
Generators run from Rails root. Package names are case-sensitive.
|
|
460
|
+
|
|
461
|
+
### Migration Already Exists
|
|
462
|
+
|
|
463
|
+
If a migration with the same timestamp exists, wait a second and retry.
|
|
464
|
+
|
|
465
|
+
## Related
|
|
466
|
+
|
|
467
|
+
- [Adding Resources Guide](/guides/adding-resources)
|
|
468
|
+
- [Creating Packages Guide](/guides/creating-packages)
|
|
469
|
+
- [Authentication Guide](/guides/authentication)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Reference Documentation
|
|
2
|
+
|
|
3
|
+
Complete API documentation for all Plutonium components.
|
|
4
|
+
|
|
5
|
+
## Core Components
|
|
6
|
+
|
|
7
|
+
### [Model](/reference/model/)
|
|
8
|
+
Resource model configuration, features, and database integration.
|
|
9
|
+
|
|
10
|
+
### [Definition](/reference/definition/)
|
|
11
|
+
How resources render - fields, columns, actions, search, and filters.
|
|
12
|
+
|
|
13
|
+
### [Policy](/reference/policy/)
|
|
14
|
+
Authorization control - action permissions, attribute filtering, scoping.
|
|
15
|
+
|
|
16
|
+
### [Controller](/reference/controller/)
|
|
17
|
+
HTTP handling, CRUD customization, and hooks.
|
|
18
|
+
|
|
19
|
+
### [Interaction](/reference/interaction/)
|
|
20
|
+
Business logic encapsulation for custom actions.
|
|
21
|
+
|
|
22
|
+
## UI Components
|
|
23
|
+
|
|
24
|
+
### [Views](/reference/views/)
|
|
25
|
+
Page classes, forms, tables, and display components.
|
|
26
|
+
|
|
27
|
+
### [Assets](/reference/assets/)
|
|
28
|
+
TailwindCSS configuration, theming, and Stimulus controllers.
|
|
29
|
+
|
|
30
|
+
## Infrastructure
|
|
31
|
+
|
|
32
|
+
### [Generators](/reference/generators/)
|
|
33
|
+
CLI generators for scaffolding resources, packages, and portals.
|
|
34
|
+
|
|
35
|
+
### [Portal](/reference/portal/)
|
|
36
|
+
Portal configuration, authentication, and entity scoping.
|
|
37
|
+
|
|
38
|
+
## Quick Reference
|
|
39
|
+
|
|
40
|
+
| I need to... | See |
|
|
41
|
+
|--------------|-----|
|
|
42
|
+
| Configure form fields | [Definition Fields](/reference/definition/fields) |
|
|
43
|
+
| Add search/filters | [Definition Query](/reference/definition/query) |
|
|
44
|
+
| Add custom buttons | [Definition Actions](/reference/definition/actions) |
|
|
45
|
+
| Control access | [Policy](/reference/policy/) |
|
|
46
|
+
| Create business logic | [Interaction](/reference/interaction/) |
|
|
47
|
+
| Customize pages | [Views](/reference/views/) |
|
|
48
|
+
| Style the UI | [Assets](/reference/assets/) |
|
|
49
|
+
| Generate code | [Generators](/reference/generators/) |
|