proscenium-phlex 0.6.2 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 158d488f475dc828ca1a7b76aa570fb3a464caf5e5d95fabf5946dd7c86b7188
4
- data.tar.gz: df2cb3239e69fb998c903cbcb1cbd894fcd570e4d5d90646e3d7d56104832852
3
+ metadata.gz: df6115d20026dc696f5920cb6abd477395b67fd4e75aa2865c689b2da0d8f04c
4
+ data.tar.gz: 1d6e22163c6821e5c4da3004e4ad1d8e798ebe17bd6a8e407e760c4ef4c3a026
5
5
  SHA512:
6
- metadata.gz: f00c7dc4260b0174e674c9eb895bd8f6f483cc968d4cc69f4c69ff7cca86006bbb582f8d5aa0422e6dda43914fad42197a9efd7ae4c6db6c6c1dbf95d37f2ba0
7
- data.tar.gz: d3d317eef341c2e9a11c98d7ff92425041d1928cfd275ea588fc6a3eb6f2163a1b6307189b74925290815815a761763dd8ab71b0809f8e9cdbb587d51fd47cca
6
+ metadata.gz: b255e3d2a1d88f06e952b98a83bc2c414f6af365c54262b8171a704db5a3ed4d292eb13af2a9b793510bcc91d5f9da4fbb22ac80dbf2cb403829bcaaf25929a3
7
+ data.tar.gz: 163ac3ed9355884df2c02cc90904725e19689b6119e5cf7d5382e7d868547706653fb0950225b809bd36fef44bf320a7ec612b05727f949106badd1bc89c6f65
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ plugins:
7
7
  - rubocop-performance
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 3.3
10
+ TargetRubyVersion: 3.4
11
11
  NewCops: enable
12
12
  SuggestExtensions: false
13
13
  Exclude:
data/AGENTS.md ADDED
@@ -0,0 +1,15 @@
1
+ # AGENTS.md
2
+
3
+ ## Agent skills
4
+
5
+ ### Issue tracker
6
+
7
+ Issues tracked in GitHub Issues (joelmoss/proscenium-phlex) via `gh`. See `docs/agents/issue-tracker.md`.
8
+
9
+ ### Triage labels
10
+
11
+ Default five-role vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
12
+
13
+ ### Domain docs
14
+
15
+ Single-context: root `CONTEXT.md` + `docs/adr/`. See `docs/agents/domain.md`.
data/Appraisals CHANGED
@@ -19,3 +19,13 @@ appraise 'phlex2/rails8' do
19
19
  gem 'rails', '~> 8.0.1'
20
20
  gem 'phlex-rails', '~> 2.3'
21
21
  end
22
+
23
+ appraise 'phlex1/rails81' do
24
+ gem 'rails', '~> 8.1.0'
25
+ gem 'phlex-rails', '~> 1.2'
26
+ end
27
+
28
+ appraise 'phlex2/rails81' do
29
+ gem 'rails', '~> 8.1.0'
30
+ gem 'phlex-rails', '~> 2.3'
31
+ end
data/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  [Proscenium](https://proscenium.rocks/) integration for Phlex.
4
4
 
5
+ ## Requirements
6
+
7
+ - Ruby >= 3.4
8
+ - [Proscenium](https://github.com/joelmoss/proscenium) ~> 0.26
9
+ - Rails >= 7.2 and < 9.0
10
+ - Phlex Rails >= 1.2 and < 3.0
11
+
12
+ ## Upgrading to 0.7
13
+
14
+ - Ruby 3.3 is no longer supported. Upgrade to Ruby 3.4 or later.
15
+ - Proscenium 0.26 or later is required. Outside production, CSS module class names now end with the module's path (see [CSS Modules](#css-modules)), so tests that match exact class names need updating.
16
+ - `Proscenium::Phlex::React` has been removed. Remove any `include Proscenium::Phlex::React` from your components.
17
+
5
18
  ## Usage
6
19
 
7
20
  [Phlex](https://www.phlex.fun/) is a framework for building fast, reusable, testable views in pure Ruby. [Proscenium](https://proscenium.rocks/) works perfectly with [Phlex](https://www.phlex.fun), with support for side-loading, CSS modules, and more.
@@ -27,7 +40,7 @@ class ApplicationLayout < Phlex::HTML
27
40
  end
28
41
  ```
29
42
 
30
- You can specifically include CCS and JS assets using the `include_stylesheets` and `include_javascripts` helpers, allowing you to control where they are included in the HTML.
43
+ You can specifically include CSS and JS assets using the `include_stylesheets` and `include_javascripts` helpers, allowing you to control where they are included in the HTML.
31
44
 
32
45
  ### Side-loading
33
46
 
@@ -43,9 +56,11 @@ class MyComponent < Phlex::HTML
43
56
  end
44
57
  ```
45
58
 
59
+ Components are not side loaded when `Proscenium.config.side_load` is `false`. Otherwise, a controller's [`sideload_assets`](https://github.com/joelmoss/proscenium?tab=readme-ov-file#side-loading) options apply to the components it renders, just as they do to its views. A Proc given to the controller's `sideload_assets` is evaluated against the controller. A component can also call `sideload_assets` itself, and a Proc given there is evaluated against the component.
60
+
46
61
  ### CSS Modules
47
62
 
48
- [CSS Modules](https://github.com/joelmoss/proscenium?tab=readme-ov-file#css-modules) are fully supported in Phlex classes, with access to the [`css_module` helper](https://github.com/joelmoss/proscenium?tab=readme-ov-file#in-your-views) if you need it. However, there is a better and more seemless way to reference CSS module classes in your Phlex classes.
63
+ [CSS Modules](https://github.com/joelmoss/proscenium?tab=readme-ov-file#css-modules) are fully supported in Phlex classes, with access to the [`css_module` helper](https://github.com/joelmoss/proscenium?tab=readme-ov-file#in-your-views) if you need it. However, there is a better and more seamless way to reference CSS module classes in your Phlex classes.
49
64
 
50
65
  Within your Phlex classes, any class names that begin with `@` will be treated as a CSS module class.
51
66
 
@@ -64,44 +79,64 @@ end
64
79
 
65
80
  ```css
66
81
  /* /app/views/users/show_view.module.css */
67
- .userName {
82
+ .user_name {
68
83
  color: red;
69
84
  font-size: 50px;
70
85
  }
71
86
  ```
72
87
 
73
- In the above `Users::ShowView` Phlex class, the `@user_name` class will be resolved to the `userName` class in the `users/show_view.module.css` file.
88
+ In the above `Users::ShowView` Phlex class, the `@user_name` class will be resolved to the `user_name` class in the `users/show_view.module.css` file. Class names are used as written: `@user_name` does not match a `.userName` class.
74
89
 
75
- The view above will be rendered something like this:
90
+ In production, the view above will be rendered something like this:
76
91
 
77
92
  ```html
78
- <h1 class="user_name-ABCD1234"></h1>
93
+ <h1 class="user_name_abcd1234"></h1>
79
94
  ```
80
95
 
96
+ In development and test, or when `Proscenium.config.debug` is set, the module's path is appended, so you can see where a class comes from: `user_name_abcd1234_app-views-users-show_view-module`.
97
+
81
98
  You can of course continue to reference regular class names in your view, and they will be passed through as is. This will allow you to mix and match CSS modules and regular CSS classes in your views.
82
99
 
83
100
  ```ruby
84
101
  # /app/views/users/show_view.rb
85
102
  class Users::ShowView < Phlex::HTML
86
- include Proscenium::Phlex::Sideload
103
+ include Proscenium::Phlex::CssModules
87
104
 
88
105
  def view_template
89
- h1 class: :[@user_name, :title] do
106
+ h1 class: [:@user_name, :title] do
90
107
  @user.name
91
108
  end
92
109
  end
93
110
  end
94
111
  ```
95
112
 
113
+ In production, this renders:
114
+
96
115
  ```html
97
- <h1 class="user_name-ABCD1234 title">Joel Moss</h1>
116
+ <h1 class="user_name_abcd1234 title">Joel Moss</h1>
98
117
  ```
99
118
 
100
119
  ## Development
101
120
 
102
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
121
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rails test` to run the tests, or `bundle exec appraisal rails test` to run them against Rails 7.2, 8.0 and 8.1, each with Phlex 1 and Phlex 2. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
122
+
123
+ To install this gem onto your local machine, run `bundle exec rake install`.
124
+
125
+ ## Releasing
126
+
127
+ Releases are published to [rubygems.org](https://rubygems.org) by the `release` GitHub Actions workflow, using trusted publishing, so no API key or one-time code is needed.
128
+
129
+ 1. Update the version number in `lib/proscenium/phlex/version.rb`, run `bundle install && bundle exec appraisal install` to update every lockfile, and commit. CI installs gems in frozen mode, so a lockfile left on the old version fails the build.
130
+ 2. Push a tag matching the new version, replacing `X.Y.Z`:
131
+
132
+ ```sh
133
+ git tag vX.Y.Z
134
+ git push origin master vX.Y.Z
135
+ ```
136
+
137
+ The workflow checks that the tag matches the version, runs the tests, builds the gem and pushes it. If a run fails partway, re-run it: a version already on RubyGems is skipped.
103
138
 
104
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
139
+ Don't use `bundle exec rake release`. It pushes the gem from your machine, and the workflow then has nothing to publish.
105
140
 
106
141
  ## Contributing
107
142
 
@@ -0,0 +1,51 @@
1
+ # Domain Docs
2
+
3
+ How the engineering skills should consume this repo's domain documentation when exploring the codebase.
4
+
5
+ ## Before exploring, read these
6
+
7
+ - **`CONTEXT.md`** at the repo root, or
8
+ - **`CONTEXT-MAP.md`** at the repo root if it exists: it points at one `CONTEXT.md` per context. Read each one relevant to the topic.
9
+ - **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
10
+
11
+ If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
12
+
13
+ ## File structure
14
+
15
+ Single-context repo (most repos):
16
+
17
+ ```
18
+ /
19
+ ├── CONTEXT.md
20
+ ├── docs/adr/
21
+ │ ├── 0001-event-sourced-orders.md
22
+ │ └── 0002-postgres-for-write-model.md
23
+ └── src/
24
+ ```
25
+
26
+ Multi-context repo (presence of `CONTEXT-MAP.md` at the root):
27
+
28
+ ```
29
+ /
30
+ ├── CONTEXT-MAP.md
31
+ ├── docs/adr/ ← system-wide decisions
32
+ └── src/
33
+ ├── ordering/
34
+ │ ├── CONTEXT.md
35
+ │ └── docs/adr/ ← context-specific decisions
36
+ └── billing/
37
+ ├── CONTEXT.md
38
+ └── docs/adr/
39
+ ```
40
+
41
+ ## Use the glossary's vocabulary
42
+
43
+ When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `CONTEXT.md`. Don't drift to synonyms the glossary explicitly avoids.
44
+
45
+ If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`).
46
+
47
+ ## Flag ADR conflicts
48
+
49
+ If your output contradicts an existing ADR, surface it explicitly rather than silently overriding:
50
+
51
+ > _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_
@@ -0,0 +1,45 @@
1
+ # Issue tracker: GitHub
2
+
3
+ Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all operations.
4
+
5
+ ## Conventions
6
+
7
+ - **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies.
8
+ - **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.
9
+ - **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters.
10
+ - **Comment on an issue**: `gh issue comment <number> --body "..."`
11
+ - **Apply / remove labels**: `gh issue edit <number> --add-label "..."` / `--remove-label "..."`
12
+ - **Close**: `gh issue close <number> --comment "..."`
13
+
14
+ Infer the repo from `git remote -v`; `gh` does this automatically when run inside a clone.
15
+
16
+ ## Pull requests as a triage surface
17
+
18
+ **PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_
19
+
20
+ When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:
21
+
22
+ - **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.
23
+ - **List external PRs for triage**: `gh pr list --state open --json number,title,body,labels,author,authorAssociation,comments` then keep only `authorAssociation` of `CONTRIBUTOR`, `FIRST_TIME_CONTRIBUTOR`, or `NONE` (drop `OWNER`/`MEMBER`/`COLLABORATOR`).
24
+ - **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.
25
+
26
+ GitHub shares one number space across issues and PRs, so a bare `#42` may be either: resolve with `gh pr view 42` and fall back to `gh issue view 42`.
27
+
28
+ ## When a skill says "publish to the issue tracker"
29
+
30
+ Create a GitHub issue.
31
+
32
+ ## When a skill says "fetch the relevant ticket"
33
+
34
+ Run `gh issue view <number> --comments`.
35
+
36
+ ## Wayfinding operations
37
+
38
+ Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets.
39
+
40
+ - **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`.
41
+ - **Child ticket**: an issue linked to the map as a GitHub sub-issue (`gh api` on the sub-issues endpoint). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #<map>` at the top of the child body. Labels: `wayfinder:<type>` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev.
42
+ - **Blocking**: GitHub's **native issue dependencies**, the canonical, UI-visible representation. Add an edge with `gh api --method POST repos/<owner>/<repo>/issues/<child>/dependencies/blocked_by -F issue_id=<blocker-db-id>`, where `<blocker-db-id>` is the blocker's numeric **database id** (`gh api repos/<owner>/<repo>/issues/<n> --jq .id`, _not_ the `#number` or `node_id`). GitHub reports `issue_dependencies_summary.blocked_by` (open blockers only, the live gate). Where dependencies aren't available, fall back to a `Blocked by: #<n>, #<n>` line at the top of the child body. A ticket is unblocked when every blocker is closed.
43
+ - **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (`issue_dependencies_summary.blocked_by > 0`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins.
44
+ - **Claim**: `gh issue edit <n> --add-assignee @me`, the session's first write.
45
+ - **Resolve**: `gh issue comment <n> --body "<answer>"`, then `gh issue close <n>`, then append a context pointer (gist + link) to the map's Decisions-so-far.
@@ -0,0 +1,15 @@
1
+ # Triage Labels
2
+
3
+ The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
4
+
5
+ | Label in mattpocock/skills | Label in our tracker | Meaning |
6
+ | -------------------------- | -------------------- | ---------------------------------------- |
7
+ | `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
8
+ | `needs-info` | `needs-info` | Waiting on reporter for more information |
9
+ | `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
10
+ | `ready-for-human` | `ready-for-human` | Requires human implementation |
11
+ | `wontfix` | `wontfix` | Will not be actioned |
12
+
13
+ When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
14
+
15
+ Edit the right-hand column to match whatever vocabulary you actually use.
@@ -15,7 +15,7 @@ gem "rubocop-rails", require: false
15
15
  gem "rubocop-rake", require: false
16
16
  gem "capybara"
17
17
  gem "maxitest"
18
- gem "minitest", "~> 5.0"
18
+ gem "minitest"
19
19
  gem "minitest-difftastic"
20
20
  gem "minitest-focus"
21
21
  gem "minitest-spec-rails"