plutonium 0.44.1 → 0.45.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 +88 -11
- data/.claude/skills/plutonium-assets/SKILL.md +1 -1
- data/.claude/skills/plutonium-controller/SKILL.md +6 -2
- data/.claude/skills/plutonium-create-resource/SKILL.md +1 -1
- data/.claude/skills/plutonium-definition/SKILL.md +445 -53
- data/.claude/skills/plutonium-definition-actions/SKILL.md +2 -2
- data/.claude/skills/plutonium-definition-query/SKILL.md +2 -2
- data/.claude/skills/plutonium-forms/SKILL.md +6 -2
- data/.claude/skills/plutonium-installation/SKILL.md +3 -3
- data/.claude/skills/plutonium-interaction/SKILL.md +3 -3
- data/.claude/skills/plutonium-invites/SKILL.md +1 -1
- data/.claude/skills/plutonium-model/SKILL.md +228 -55
- data/.claude/skills/plutonium-nested-resources/SKILL.md +9 -2
- data/.claude/skills/plutonium-package/SKILL.md +3 -3
- data/.claude/skills/plutonium-policy/SKILL.md +6 -2
- data/.claude/skills/plutonium-portal/SKILL.md +97 -59
- data/.claude/skills/plutonium-profile/SKILL.md +2 -2
- data/.claude/skills/plutonium-rodauth/SKILL.md +1 -1
- data/.claude/skills/plutonium-theming/SKILL.md +1 -1
- data/.claude/skills/plutonium-views/SKILL.md +2 -2
- data/CHANGELOG.md +15 -0
- data/app/assets/plutonium.css +1 -1
- 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/invites/install_generator.rb +2 -2
- data/lib/generators/pu/invites/templates/packages/invites/app/views/invites/user_invitations/show.html.erb.tt +7 -7
- data/lib/generators/pu/saas/portal_generator.rb +17 -0
- data/lib/generators/pu/skills/sync/sync_generator.rb +21 -0
- data/lib/plutonium/engine.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/css/tokens.css +2 -0
- metadata +2 -6
- data/.claude/skills/plutonium-connect-resource/SKILL.md +0 -130
- data/.claude/skills/plutonium-definition-fields/SKILL.md +0 -535
- data/.claude/skills/plutonium-model-features/SKILL.md +0 -286
- data/.claude/skills/plutonium-resource/SKILL.md +0 -281
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1073fa6b607e230a752fac717f223a0b641179b3c2b93b67d941d40b6dea07e2
|
|
4
|
+
data.tar.gz: 28da869f69c58a437c102be436ddb31f4017795dba17b244a8f2db15a15c7bea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11b347e6f98eaeb7a3cc93c75d3c67483107ddc3d822780ce9bcb12901af3b3d9c7fe7996b7bacffc3ea32528ebbab5a9affb54d9bfb56dbeec49cb40da92f46
|
|
7
|
+
data.tar.gz: 5c0a5d6f4988980b8195cdd4d27d1c28189a8cc6d34c889136b73f512f6cd88ecaf2851af52ef666e68f1c5b66802fac570831ce6608c195d707871b5b35d899
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plutonium
|
|
3
|
-
description:
|
|
3
|
+
description: Use when starting work on a Plutonium app, unsure which skill to read, or need an overview of the resource architecture
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Plutonium Development Guide
|
|
@@ -20,29 +20,101 @@ Read this first when working on a Plutonium application.
|
|
|
20
20
|
rails g pu:res:scaffold Post title:string --dest=main_app # Create resource
|
|
21
21
|
rails g pu:res:conn Post --dest=admin_portal # Connect to portal
|
|
22
22
|
rails g pu:pkg:package blogging # Create feature package
|
|
23
|
-
rails g pu:pkg:portal
|
|
23
|
+
rails g pu:pkg:portal admin # Create portal
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Always specify `--dest` to avoid interactive prompts.
|
|
27
27
|
|
|
28
28
|
## Resource Architecture
|
|
29
29
|
|
|
30
|
-
A resource
|
|
30
|
+
A **resource** is four layers working together for full CRUD with minimal code:
|
|
31
31
|
|
|
32
|
-
| Layer | Purpose | Customize when... |
|
|
33
|
-
|
|
34
|
-
| Model | Data, validations, associations | Adding business logic |
|
|
35
|
-
| Definition | UI - fields, actions, filters | Changing how things look/behave |
|
|
36
|
-
| Policy | Authorization - who can do what | Restricting access |
|
|
37
|
-
| Controller | Request handling | Rarely - use hooks if needed |
|
|
32
|
+
| Layer | File | Purpose | Customize when... |
|
|
33
|
+
|-------|------|---------|-------------------|
|
|
34
|
+
| **Model** | `app/models/post.rb` | Data, validations, associations | Adding business logic |
|
|
35
|
+
| **Definition** | `app/definitions/post_definition.rb` | UI - fields, actions, filters | Changing how things look/behave |
|
|
36
|
+
| **Policy** | `app/policies/post_policy.rb` | Authorization - who can do what | Restricting access |
|
|
37
|
+
| **Controller** | `app/controllers/posts_controller.rb` | Request handling | Rarely - use hooks if needed |
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ Resource │
|
|
42
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
43
|
+
│ Model │ Definition │ Policy │ Controller│
|
|
44
|
+
│ (WHAT it is) │ (HOW it looks) │ (WHO can act) │ (HOW it │
|
|
45
|
+
│ │ │ │ responds) │
|
|
46
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
47
|
+
│ - attributes │ - field types │ - permissions │ - CRUD │
|
|
48
|
+
│ - associations │ - inputs/forms │ - scoping │ - redirects│
|
|
49
|
+
│ - validations │ - displays │ - attributes │ - params │
|
|
50
|
+
│ - scopes │ - actions │ │ │
|
|
51
|
+
│ - callbacks │ - filters │ │ │
|
|
52
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Auto-Detection
|
|
56
|
+
|
|
57
|
+
Plutonium automatically detects from your model:
|
|
58
|
+
- All database columns with appropriate field types
|
|
59
|
+
- Associations (belongs_to, has_one, has_many)
|
|
60
|
+
- Attachments (Active Storage)
|
|
61
|
+
- Enums
|
|
62
|
+
|
|
63
|
+
**You only need to declare when overriding defaults.**
|
|
64
|
+
|
|
65
|
+
## Creating Resources
|
|
66
|
+
|
|
67
|
+
### New Resources (from scratch)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
rails g pu:res:scaffold Post user:belongs_to title:string 'content:text?' published:boolean --dest=main_app
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See `plutonium-create-resource` skill for full generator options.
|
|
74
|
+
|
|
75
|
+
### From Existing Models
|
|
76
|
+
|
|
77
|
+
1. Include `Plutonium::Resource::Record` in your model (or inherit from a class that does)
|
|
78
|
+
2. Generate supporting files: `rails g pu:res:scaffold Post --no-migration`
|
|
79
|
+
3. Connect to a portal: `rails g pu:res:conn Post --dest=admin_portal`
|
|
80
|
+
|
|
81
|
+
## Connecting to Portals
|
|
82
|
+
|
|
83
|
+
Resources must be connected to a portal to be accessible:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
rails g pu:res:conn Post --dest=admin_portal
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See `plutonium-portal` skill for portal details.
|
|
90
|
+
|
|
91
|
+
## Portal-Specific Customization
|
|
92
|
+
|
|
93
|
+
Each portal can override the base definition, policy, and controller:
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
# Admin portal sees more
|
|
97
|
+
class AdminPortal::PostDefinition < ::PostDefinition
|
|
98
|
+
scope :draft
|
|
99
|
+
scope :pending_review
|
|
100
|
+
action :feature, interaction: FeaturePostInteraction
|
|
101
|
+
end
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Workflow Summary
|
|
105
|
+
|
|
106
|
+
1. **Generate** - `rails g pu:res:scaffold Model attributes... --dest=main_app`
|
|
107
|
+
2. **Migrate** - `rails db:migrate`
|
|
108
|
+
3. **Connect** - `rails g pu:res:conn Model --dest=portal_name`
|
|
109
|
+
4. **Customize** - Edit definition/policy as needed
|
|
38
110
|
|
|
39
111
|
## Skill Reference
|
|
40
112
|
|
|
41
113
|
| Topic | Skill |
|
|
42
114
|
|-------|-------|
|
|
43
115
|
| Creating resources | `plutonium-create-resource` |
|
|
44
|
-
|
|
|
45
|
-
| Field configuration | `plutonium-definition
|
|
116
|
+
| Models & features | `plutonium-model` |
|
|
117
|
+
| Field configuration | `plutonium-definition` |
|
|
46
118
|
| Actions & interactions | `plutonium-definition-actions` |
|
|
47
119
|
| Search, filters, scopes | `plutonium-definition-query` |
|
|
48
120
|
| Authorization | `plutonium-policy` |
|
|
@@ -51,3 +123,8 @@ A resource has four layers:
|
|
|
51
123
|
| Nested resources | `plutonium-nested-resources` |
|
|
52
124
|
| Packages & portals | `plutonium-package`, `plutonium-portal` |
|
|
53
125
|
| Authentication | `plutonium-rodauth` |
|
|
126
|
+
| Interactions | `plutonium-interaction` |
|
|
127
|
+
| Theming & assets | `plutonium-theming`, `plutonium-assets` |
|
|
128
|
+
| User profile | `plutonium-profile` |
|
|
129
|
+
| User invites | `plutonium-invites` |
|
|
130
|
+
| Installation | `plutonium-installation` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plutonium-assets
|
|
3
|
-
description:
|
|
3
|
+
description: Use when setting up TailwindCSS, registering Stimulus controllers, or theming Phlexi components in a Plutonium app
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Plutonium Assets & Setup
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plutonium-controller
|
|
3
|
-
description:
|
|
3
|
+
description: Use when customizing controller behavior, overriding CRUD actions, adding hooks, or changing redirect logic in Plutonium
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Plutonium Controllers
|
|
7
7
|
|
|
8
|
+
**Controllers are generated automatically** - never create them manually:
|
|
9
|
+
- `rails g pu:res:scaffold` creates the base controller
|
|
10
|
+
- `rails g pu:res:conn` creates portal-specific controllers
|
|
11
|
+
|
|
8
12
|
Controllers in Plutonium provide full CRUD functionality out of the box. You rarely need to customize them - definitions handle most UI configuration and policies handle authorization.
|
|
9
13
|
|
|
10
14
|
## Base Classes
|
|
@@ -377,7 +381,7 @@ end
|
|
|
377
381
|
|
|
378
382
|
## Related Skills
|
|
379
383
|
|
|
380
|
-
- `plutonium
|
|
384
|
+
- `plutonium` - How controllers fit in the resource architecture
|
|
381
385
|
- `plutonium-policy` - Authorization (used by controllers)
|
|
382
386
|
- `plutonium-definition-actions` - Interactive actions (preferred over custom controller actions)
|
|
383
387
|
- `plutonium-views` - Custom page, form, display, and table classes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plutonium-create-resource
|
|
3
|
-
description:
|
|
3
|
+
description: Use when creating a new Plutonium resource - covers the pu:res:scaffold generator, field type syntax, and generator options
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create Resource Skill
|