nitro_kit 2.0.0.alpha.4 → 2.0.0.alpha.6
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/CHANGELOG.md +35 -0
- data/README.md +17 -2
- data/STYLE_GUIDE.md +2 -2
- data/app/assets/stylesheets/nitro_kit.css +298 -115
- data/app/components/nitro_kit/app_shell.rb +1 -1
- data/app/components/nitro_kit/dialog.rb +5 -3
- data/app/components/nitro_kit/dropzone.rb +18 -2
- data/app/components/nitro_kit/form_builder.rb +2 -0
- data/app/javascript/controllers/nk/dropzone_controller.js +20 -0
- data/docs/agent_guide.md +27 -0
- data/docs/component_contracts.md +53 -47
- data/docs/customization.md +3 -4
- data/docs/hotwire.md +2 -2
- data/docs/initialization_prompt.md +12 -6
- data/docs/migration_1_to_2.md +1 -1
- data/docs/patterns/application_foundation.md +20 -2
- data/docs/patterns/crud_resource.md +19 -4
- data/docs/patterns/destructive_action.md +31 -17
- data/docs/patterns/inset_workspace.md +178 -0
- data/docs/patterns/queryable_collection.md +104 -44
- data/docs/patterns/resource_form.md +16 -12
- data/docs/rails_integration.md +1 -1
- data/lib/nitro_kit/installation.rb +8 -0
- data/lib/nitro_kit/version.rb +1 -1
- data/plugins/nitro-kit/.codex-plugin/plugin.json +4 -4
- data/plugins/nitro-kit/skills/nitro-kit-hotwire/SKILL.md +18 -1
- data/plugins/nitro-kit/skills/nitro-kit-hotwire/agents/openai.yaml +1 -1
- data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +16 -1
- data/plugins/nitro-kit/skills/nitro-kit-rails/agents/openai.yaml +1 -1
- data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +28 -5
- data/plugins/nitro-kit/skills/nitro-kit-ui/agents/openai.yaml +1 -1
- data/src/stylesheets/nitro_kit/components/app_shell.css +1 -19
- data/src/stylesheets/nitro_kit/components/dialog.css +18 -1
- data/src/stylesheets/nitro_kit/components/dropzone.css +276 -72
- data/src/stylesheets/nitro_kit/components/pagination.css +1 -12
- data/src/stylesheets/nitro_kit/components/table.css +2 -1
- data/src/stylesheets/nitro_kit/components/toolbar.css +0 -10
- metadata +2 -1
|
@@ -23,6 +23,14 @@ module NitroKit
|
|
|
23
23
|
Each skill resolves the installed gem with `bundle show nitro_kit` and reads
|
|
24
24
|
its version-matched documentation.
|
|
25
25
|
|
|
26
|
+
For greenfield planning or broad product work, check whether Nitro Kit
|
|
27
|
+
catalog or MCP tools are available. When they are, inventory and search the
|
|
28
|
+
catalog by product workflow, retrieve the relevant patterns, and state what
|
|
29
|
+
will be used, adapted, or deferred before implementation. When they are not,
|
|
30
|
+
continue with the bundled skills, documentation, and component contracts;
|
|
31
|
+
catalog access is optional and must never block the work. Nitro Kit Doctor
|
|
32
|
+
verifies integration health, not product completeness.
|
|
33
|
+
|
|
26
34
|
In a greenfield application, run `bin/rails generate phlex:install` and use
|
|
27
35
|
Phlex for the application layout, route views, and reusable UI. In an
|
|
28
36
|
established application, preserve its existing view architecture and
|
data/lib/nitro_kit/version.rb
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"interface": {
|
|
15
15
|
"displayName": "Nitro Kit",
|
|
16
16
|
"shortDescription": "Build Rails UI with Nitro Kit and Hotwire",
|
|
17
|
-
"longDescription": "Model conventional Rails resources, compose Nitro Kit components,
|
|
17
|
+
"longDescription": "Model conventional Rails resources, compose Nitro Kit components, implement Hotwire interactions from the installed gem version, and use optional catalog guidance when available.",
|
|
18
18
|
"developerName": "Mikkel Malmberg",
|
|
19
19
|
"category": "Developer",
|
|
20
20
|
"capabilities": ["Read", "Write"],
|
|
21
21
|
"websiteURL": "https://nitrokit.dev",
|
|
22
22
|
"defaultPrompt": [
|
|
23
|
-
"Build this Rails feature on the Nitro Kit Rails path.",
|
|
24
|
-
"Build this Rails interface with Nitro Kit components.",
|
|
25
|
-
"Implement this interaction with Nitro Kit and
|
|
23
|
+
"Build this Rails feature on the Nitro Kit Rails path, using relevant catalog guidance when available.",
|
|
24
|
+
"Build this Rails interface with Nitro Kit components and any relevant catalog guidance available.",
|
|
25
|
+
"Implement this interaction with Nitro Kit, conventional Hotwire, and relevant catalog guidance when available."
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -25,6 +25,18 @@ Make the server response and stable DOM boundary the interaction API. Add Stimul
|
|
|
25
25
|
7. Read `NITRO_KIT_ROOT/docs/browser_support.md` for the canonical
|
|
26
26
|
full/reduced/unavailable no-JavaScript classification.
|
|
27
27
|
|
|
28
|
+
## Discover optional catalog guidance
|
|
29
|
+
|
|
30
|
+
For a broad product workflow, check whether Nitro Kit catalog or MCP tools are
|
|
31
|
+
available. When they are, inventory and search by workflow, retrieve relevant
|
|
32
|
+
patterns, and state what will be used, adapted, or deferred before
|
|
33
|
+
implementation. When they are not, continue with the installed Hotwire recipes,
|
|
34
|
+
component contracts, and source. Catalog access is optional and must never
|
|
35
|
+
block the work or be implied in the result.
|
|
36
|
+
|
|
37
|
+
For a focused interaction, use the catalog only when it is already available
|
|
38
|
+
and a higher-level pattern would materially help.
|
|
39
|
+
|
|
28
40
|
Do not proceed with a remembered Nitro Kit 1.x API. Do not copy or recreate
|
|
29
41
|
the installed gem's `nk--*` controllers under `app/javascript/controllers/nk`.
|
|
30
42
|
|
|
@@ -46,7 +58,7 @@ Keep frames around complete resource or collection regions, not individual butto
|
|
|
46
58
|
- Do not describe that HTML branch as a JavaScript-free interaction when its
|
|
47
59
|
control still depends on Turbo or a closed overlay.
|
|
48
60
|
- Let GET query parameters be the source of truth for filtering, sorting, and pagination.
|
|
49
|
-
- Use
|
|
61
|
+
- Use Nitro Dialog for destructive confirmations, including short delete, remove, and revoke flows. Put the real Rails form inside the dialog; do not add `turbo_confirm`. Follow `docs/patterns/destructive_action.md`.
|
|
50
62
|
- Render flash through `NitroKit::Toast::FlashMessages`; the application owns setting the flash.
|
|
51
63
|
|
|
52
64
|
## Preserve ownership
|
|
@@ -69,3 +81,8 @@ before changing application code. Disable Chrome's background throttling or
|
|
|
69
81
|
use a test-only `requestAnimationFrame` shim when necessary. Never ship that
|
|
70
82
|
workaround in the application or replace a conventional Turbo flow to satisfy
|
|
71
83
|
one browser driver.
|
|
84
|
+
|
|
85
|
+
For a full-page CRUD index, default to ordinary GET forms and links with Turbo
|
|
86
|
+
Drive and normal caching. Use Frames for independently navigable regions.
|
|
87
|
+
History tests must check restored rows and controls, not just the URL, and
|
|
88
|
+
wait past `html[data-turbo-preview]` before interacting with a new page.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Nitro Kit Hotwire"
|
|
3
3
|
short_description: "Build conventional Nitro Kit Hotwire flows"
|
|
4
|
-
default_prompt: "Use $nitro-kit-hotwire to build this interaction with Nitro Kit and
|
|
4
|
+
default_prompt: "Use $nitro-kit-hotwire to build this interaction with Nitro Kit, conventional Hotwire, and relevant catalog guidance when available."
|
|
@@ -24,6 +24,18 @@ established application outside the requested scope.
|
|
|
24
24
|
9. Read `NITRO_KIT_ROOT/docs/browser_support.md` before claiming an
|
|
25
25
|
interaction works without JavaScript.
|
|
26
26
|
|
|
27
|
+
## Discover optional catalog guidance
|
|
28
|
+
|
|
29
|
+
For greenfield planning or broad product work, check whether Nitro Kit catalog
|
|
30
|
+
or MCP tools are available. When they are, inventory and search by product
|
|
31
|
+
workflow, retrieve the relevant patterns, and state what will be used, adapted,
|
|
32
|
+
or deferred before implementation. When they are not, continue with the
|
|
33
|
+
installed skills, documentation, component contracts, and source. Catalog
|
|
34
|
+
access is optional and must never block the work or be implied in the result.
|
|
35
|
+
|
|
36
|
+
For a focused Rails change, use the catalog only when it is already available
|
|
37
|
+
and the task could benefit from a higher-level product pattern.
|
|
38
|
+
|
|
27
39
|
Never use a Nitro Kit 1.x helper, copied component, controller, or Tailwind
|
|
28
40
|
contract as a substitute for the installed API.
|
|
29
41
|
|
|
@@ -53,7 +65,7 @@ contract as a substitute for the installed API.
|
|
|
53
65
|
- Render HTML on the server and add Hotwire progressively.
|
|
54
66
|
- Set the document language on the root `html` element.
|
|
55
67
|
- Test with Minitest and fixtures, including tenancy and unhappy paths.
|
|
56
|
-
- In authenticated admin areas, default to a
|
|
68
|
+
- In authenticated admin areas, default to a sidebar `AppShell` with the route's
|
|
57
69
|
one `h1` and basic actions in its `Toolbar`. Keep one page gutter and avoid
|
|
58
70
|
repeated headings or automatic Card wrappers. At narrow widths, let trailing
|
|
59
71
|
actions stack below a Back affordance and title instead of clipping the title
|
|
@@ -70,3 +82,6 @@ Nitro Kit owns component contracts and focused progressive behavior.
|
|
|
70
82
|
Run focused model and request tests first. Add a system test only where browser
|
|
71
83
|
behavior is part of the contract. Assert status, visibility, authorization,
|
|
72
84
|
and stable DOM boundaries rather than implementation trivia.
|
|
85
|
+
|
|
86
|
+
Nitro Kit Doctor verifies integration and runtime contracts, not product
|
|
87
|
+
completeness. For broad work, verify the agreed workflow coverage separately.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Nitro Kit Rails"
|
|
3
3
|
short_description: "Build conventional Rails applications with Nitro Kit"
|
|
4
|
-
default_prompt: "Use $nitro-kit-rails to build this feature on the Nitro Kit Rails path."
|
|
4
|
+
default_prompt: "Use $nitro-kit-rails to build this feature on the Nitro Kit Rails path, using relevant catalog guidance when available."
|
|
@@ -18,14 +18,25 @@ Use the documentation shipped with the application's installed gem as the source
|
|
|
18
18
|
classifications in `NITRO_KIT_ROOT/docs/browser_support.md`.
|
|
19
19
|
7. Inspect the installed component source when constructor or compound-slot details remain unclear. Never guess a component API from memory.
|
|
20
20
|
|
|
21
|
+
## Discover optional catalog guidance
|
|
22
|
+
|
|
23
|
+
For greenfield planning or broad product UI work, check whether Nitro Kit
|
|
24
|
+
catalog or MCP tools are available. When they are, inventory and search by
|
|
25
|
+
product workflow, retrieve the relevant patterns, and state what will be used,
|
|
26
|
+
adapted, or deferred before implementation. When they are not, continue with
|
|
27
|
+
the installed skills, documentation, component contracts, and source. Catalog
|
|
28
|
+
access is optional and must never block the work or be implied in the result.
|
|
29
|
+
|
|
30
|
+
For a focused component change, use the catalog only when it is already
|
|
31
|
+
available and a higher-level composition would materially help.
|
|
32
|
+
|
|
21
33
|
For a Nitro Kit 1.x migration, read
|
|
22
34
|
`NITRO_KIT_ROOT/docs/migration_1_to_2.md` before editing. Inventory product
|
|
23
35
|
flows, behavior, application-owned button classes and Rails button helpers,
|
|
24
36
|
joined controls, and the existing semantic color, focus, radius, density, and
|
|
25
37
|
typography tokens first. Capture representative wide and narrow screenshots.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
atoms.
|
|
38
|
+
Apply the optional catalog process above, searching by workflow rather than old
|
|
39
|
+
component name and selecting high-level compositions before replacing atoms.
|
|
29
40
|
|
|
30
41
|
If the gem is not installed, say that the skill requires Nitro Kit and follow the application's requested installation scope. Do not substitute APIs from an older Nitro Kit release.
|
|
31
42
|
|
|
@@ -44,9 +55,13 @@ If the gem is not installed, say that the skill requires Nitro Kit and follow th
|
|
|
44
55
|
5. Keep routes, authorization, records, query policy, DOM IDs, Turbo boundaries, and response semantics in the application.
|
|
45
56
|
6. Translate the application's semantic theme into documented `--nk-*` properties instead of choosing similar raw palette values. Use `--nk-button-radius` when Button shape intentionally differs from inputs and surfaces.
|
|
46
57
|
7. Verify closed options and required compound declarations before rendering.
|
|
47
|
-
8. For authenticated CRUD, prefer a
|
|
58
|
+
8. For authenticated CRUD, prefer a sidebar `AppShell` with a `Toolbar` that
|
|
48
59
|
owns the route's single `h1` and basic actions. The shell main region owns
|
|
49
|
-
one content gutter
|
|
60
|
+
one content gutter, not a universal maximum width. Tables fill the canvas;
|
|
61
|
+
form and reading pages may use a centered Container inside that gutter.
|
|
62
|
+
Simple resource forms use a single-column Fieldset in Container lg so fields
|
|
63
|
+
use the available width; reserve split SettingsSections for roomy settings pages.
|
|
64
|
+
Do not repeat that heading in `PageHeader`, or wrap each
|
|
50
65
|
table, form, and detail region in another Card. At narrow widths, preserve
|
|
51
66
|
the full title and persistent actions by stacking the trailing actions below
|
|
52
67
|
the title rather than clipping either region.
|
|
@@ -76,4 +91,12 @@ If the gem is not installed, say that the skill requires Nitro Kit and follow th
|
|
|
76
91
|
|
|
77
92
|
Run the smallest relevant application tests. For component rendering, assert semantic elements and owned `data-nk` or slot attributes rather than private implementation helpers. Exercise invalid and empty states when the UI accepts user input or collections.
|
|
78
93
|
|
|
94
|
+
Nitro Kit Doctor verifies integration and runtime contracts, not product
|
|
95
|
+
completeness. Do not use a green Doctor result as proof that every relevant
|
|
96
|
+
screen, state, or catalog workflow has been implemented.
|
|
97
|
+
|
|
79
98
|
For a migration, Doctor is an inventory, not visual proof. Run representative form and component rendering with `ActiveModel::Translation.raise_on_missing_translations` enabled when the application uses strict i18n. Compare the same representative flows in a browser at wide and narrow widths, exercise keyboard focus, and inspect computed styles for missing application classes, stacked Button content, broken compound corners, double focus rings, clipping, and theme drift. Re-audit rendered native buttons, Rails button helpers, and application-owned button classes before declaring the conversion complete. Search the whole application for `desperately_need_a_class:` and review every result, aiming for zero. Move layout and visual treatment to application-owned wrappers, remove generic class forwarding, accept incidental Nitro defaults, and keep unmatched product UI application-owned; retain only documented external-integration hooks.
|
|
99
|
+
|
|
100
|
+
Use Nitro Dialog for destructive confirmations, including simple deletion,
|
|
101
|
+
member removal, and invitation revocation. Read `docs/patterns/destructive_action.md`;
|
|
102
|
+
do not substitute native browser confirmation for short messages.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Nitro Kit UI"
|
|
3
3
|
short_description: "Build Rails interfaces with Nitro Kit components"
|
|
4
|
-
default_prompt: "Use $nitro-kit-ui to build this Rails interface with the installed Nitro Kit components."
|
|
4
|
+
default_prompt: "Use $nitro-kit-ui to build this Rails interface with the installed Nitro Kit components and any relevant catalog guidance available."
|
|
@@ -179,25 +179,7 @@
|
|
|
179
179
|
|
|
180
180
|
@layer nitro-kit.variant {
|
|
181
181
|
:where(
|
|
182
|
-
[data-nk="app-shell"][data-layout="sidebar"]
|
|
183
|
-
> [data-slot="app-shell-header"]
|
|
184
|
-
> [data-slot="app-shell-topbar"]
|
|
185
|
-
) {
|
|
186
|
-
display: none;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:where(
|
|
190
|
-
[data-nk="app-shell"][data-layout="sidebar"]
|
|
191
|
-
> [data-slot="app-shell-main"]
|
|
192
|
-
) {
|
|
193
|
-
grid-row: 1 / 3;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
:where(
|
|
197
|
-
[data-nk="app-shell"]:is(
|
|
198
|
-
[data-layout="sidebar"],
|
|
199
|
-
[data-layout="hybrid"]
|
|
200
|
-
):not(
|
|
182
|
+
[data-nk="app-shell"][data-layout="sidebar"]:not(
|
|
201
183
|
:has(> [data-slot="app-shell-header"] > [data-slot="app-shell-brand"])
|
|
202
184
|
)
|
|
203
185
|
> [data-slot="app-shell-sidebar"]
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
margin: auto;
|
|
11
11
|
padding: calc(var(--nk-space) * 6);
|
|
12
12
|
overflow: auto;
|
|
13
|
+
text-align: start;
|
|
13
14
|
color: var(--nk-color-foreground);
|
|
14
15
|
background: var(--nk-color-surface);
|
|
15
16
|
border: var(--nk-border-width) solid var(--nk-color-border);
|
|
@@ -27,6 +28,23 @@
|
|
|
27
28
|
position: static;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
:where(
|
|
32
|
+
[data-nk="dialog"]
|
|
33
|
+
> [data-slot="dialog-panel"]
|
|
34
|
+
> [data-slot="dialog-header"]
|
|
35
|
+
) {
|
|
36
|
+
display: flow-root;
|
|
37
|
+
margin-block-end: calc(var(--nk-space) * 4);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(
|
|
41
|
+
[data-nk="dialog"]
|
|
42
|
+
> [data-slot="dialog-panel"]
|
|
43
|
+
> [data-slot="dialog-body"]
|
|
44
|
+
) {
|
|
45
|
+
clear: both;
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
:where([data-nk="dialog"] [data-slot="dialog-title"]) {
|
|
31
49
|
font-size: var(--nk-title-surface-size);
|
|
32
50
|
font-weight: var(--nk-title-surface-weight);
|
|
@@ -36,7 +54,6 @@
|
|
|
36
54
|
|
|
37
55
|
:where([data-nk="dialog"] [data-slot="dialog-description"]) {
|
|
38
56
|
margin-block-start: calc(var(--nk-space) * 2);
|
|
39
|
-
margin-block-end: calc(var(--nk-space) * 4);
|
|
40
57
|
color: var(--nk-color-muted-foreground);
|
|
41
58
|
font-size: var(--nk-text-sm);
|
|
42
59
|
line-height: var(--nk-leading-relaxed);
|