postnhost 0.1.0 → 0.2.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +22 -9
  4. data/Rakefile +28 -0
  5. data/app/assets/builds/postnhost/application.css +1 -1
  6. data/app/assets/stylesheets/application.tailwind.css +5 -1
  7. data/app/controllers/postnhost/api/base_controller.rb +29 -0
  8. data/app/controllers/postnhost/api/v1/commands_controller.rb +27 -0
  9. data/app/controllers/postnhost/api/v1/mcp_controller.rb +49 -0
  10. data/app/controllers/postnhost/api_tokens_controller.rb +34 -0
  11. data/app/controllers/postnhost/articles/translations_controller.rb +2 -9
  12. data/app/controllers/postnhost/categories/translations_controller.rb +2 -9
  13. data/app/controllers/postnhost/management_preview_controller.rb +17 -0
  14. data/app/controllers/postnhost/pages/translations_controller.rb +2 -9
  15. data/app/helpers/postnhost/application_helper.rb +0 -11
  16. data/app/models/postnhost/api_token.rb +26 -0
  17. data/app/models/postnhost/user.rb +2 -0
  18. data/app/services/postnhost/api/v1/openapi.rb +27 -0
  19. data/app/services/postnhost/management/catalog.rb +151 -0
  20. data/app/services/postnhost/management/command.rb +174 -0
  21. data/app/services/postnhost/management/content_actions.rb +75 -0
  22. data/app/services/postnhost/management/input.rb +49 -0
  23. data/app/services/postnhost/management/mcp.rb +54 -0
  24. data/app/services/postnhost/management/preview.rb +25 -0
  25. data/app/services/postnhost/management/resources.rb +30 -0
  26. data/app/services/postnhost/management/schema_fields.rb +25 -0
  27. data/app/services/postnhost/management/serializer.rb +40 -0
  28. data/app/services/postnhost/management/settings_actions.rb +64 -0
  29. data/app/services/postnhost/management/upload.rb +18 -0
  30. data/app/services/postnhost/translation/enqueue.rb +59 -0
  31. data/app/views/layouts/postnhost/_sidebar.html.erb +7 -0
  32. data/app/views/layouts/postnhost/application.html.erb +2 -2
  33. data/app/views/layouts/postnhost/articles.html.erb +3 -3
  34. data/app/views/layouts/postnhost/product.html.erb +3 -3
  35. data/app/views/layouts/postnhost/public/templates/default.html.erb +2 -2
  36. data/app/views/layouts/postnhost/public/templates/swiss-editorial.html.erb +2 -2
  37. data/app/views/layouts/postnhost/public/templates/workspace-journal.html.erb +2 -2
  38. data/app/views/postnhost/api_tokens/index.html.erb +92 -0
  39. data/app/views/postnhost/onboarding/_post_install_checklist.html.erb +8 -8
  40. data/app/views/postnhost/pages/index.html.erb +1 -1
  41. data/app/views/postnhost/templates/edit.html.erb +1 -1
  42. data/config/routes.rb +12 -0
  43. data/db/migrate/20261008120000_create_api_tokens.rb +12 -0
  44. data/lib/generators/postnhost/install/install_generator.rb +11 -12
  45. data/lib/generators/postnhost/locale/locale_generator.rb +1 -1
  46. data/lib/generators/postnhost/static_pages/static_pages_generator.rb +1 -1
  47. data/lib/generators/postnhost/tailwindcss/install_generator.rb +28 -25
  48. data/lib/generators/postnhost/tailwindcss/templates/host.tailwind.css +0 -3
  49. data/lib/generators/postnhost/user/user_generator.rb +1 -1
  50. data/lib/generators/postnhost/views/views_generator.rb +5 -7
  51. data/lib/postnhost/css_build.rb +68 -0
  52. data/lib/postnhost/css_scope.rb +77 -0
  53. data/lib/postnhost/sample_data.rb +1 -1
  54. data/lib/postnhost/tailwind_compiler.rb +75 -0
  55. data/lib/postnhost/tailwind_input.rb +32 -0
  56. data/lib/postnhost/version.rb +1 -1
  57. data/lib/tasks/postnhost_tasks.rake +40 -65
  58. metadata +40 -2
  59. data/lib/generators/postnhost/tailwindcss/templates/tailwind.config.js +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f12e20da143bbf828f95af42951dcfc1bbce4e9152dd47630ea8a668b73b8a6b
4
- data.tar.gz: 8ae19423f07e68ec8fef6ba7a4014751b25b658e218a939bf802157247b96c05
3
+ metadata.gz: 627ae55fdce85eb1586f9dd686b9b637a83443c5b3752bb9b932f563d972cc72
4
+ data.tar.gz: 29b259e49deacd46af93786df0bb5ee347a91ebc5ec8902d1b56cceb16c0a7d7
5
5
  SHA512:
6
- metadata.gz: c40643ed0fd03ec5bc35a717c08a50a7942f9b64df50e397ab4de7217a46090c60d3ae2f25684fb8c5629bb264a1fb4ca87ab6119a819512db90eb84d0f6b2ff
7
- data.tar.gz: af8cd76fde91eaad7ac5c175721ca1b7b5a26a80caad882fcfe404ce5bd486252a57dd3681ed108fa51d90d8c500c969e05863b234c4034804502937971186db
6
+ metadata.gz: e163ba13b11fed2c1840ccedb5d48523f89ea9039f5bf3b2d9fccc3ca02f2c2d82ed1d25133d08b6c5a0856ad3ff1df4b8ef0ba168603d3c9600862317a15ad3
7
+ data.tar.gz: f85efaf4ef237bb6119101c673ef8f57f1623f79e94fd488637590342b58b2c8c994d8189436f41bb8a7be9e41d068d069cd6e5a683e9f005dc83d6e0f60af03
data/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  All notable changes to PostnHost are documented in this file.
4
4
 
5
+ ## [0.2.0] - 2026-10-24
6
+
7
+ ### Added
8
+
9
+ - Versioned JSON management API and Streamable HTTP MCP endpoint at `/api/v1/mcp`, relative to the engine mount path.
10
+ - 89 shared commands for CMS content, publishing, versions, uploads, translations, users, navigation, and settings, with command discovery and OpenAPI schemas.
11
+ - API & MCP dashboard for creating and revoking personal bearer tokens, with hashed token storage and one-time secret display.
12
+
13
+ ### Improved
14
+
15
+ - Paginated management lists use compact summaries and bounded database queries; full content remains available through individual record commands.
16
+ - UI and management commands share translation enqueueing, preserving successfully queued work and cleaning up placeholders when enqueueing fails.
17
+
18
+ ### Upgrading existing blogs
19
+
20
+ From your host application's directory, update any Gemfile constraint to allow PostnHost 0.2.0, then run:
21
+
22
+ ```bash
23
+ bundle update postnhost
24
+ bin/rails postnhost:install:migrations
25
+ bin/rails db:migrate
26
+ ```
27
+
28
+ Commit the copied `db/migrate/*_create_api_tokens.postnhost.rb` migration and updated schema with your application. During production deployment, run `RAILS_ENV=production bin/rails db:migrate` before restarting the app.
29
+
30
+ The new `CreateApiTokens` migration creates the `postnhost_api_tokens` table. Existing blog content requires no backfill.
31
+
32
+ ## [0.1.1] - 2026-08-31
33
+
34
+ ### Fixed
35
+
36
+ - Scoped packaged and host-generated CSS to PostnHost layouts and replaced competing stylesheets with one combined host build that transparently shadows the packaged logical asset.
37
+ - Corrected installer, template customization, Tailwind setup, and production checklist instructions.
38
+
5
39
  ## [0.1.0] - 2026-08-29
6
40
 
7
41
  First open source release of PostnHost.
@@ -22,4 +56,6 @@ First open source release of PostnHost.
22
56
 
23
57
  Authored by Kirill Shevchenko (Ruby/Rails engineering) and Maxim Sova (technical SEO expertise).
24
58
 
59
+ [0.2.0]: https://github.com/postnhost/postnhost/compare/v0.1.1...v0.2.0
60
+ [0.1.1]: https://github.com/postnhost/postnhost/compare/v0.1.0...v0.1.1
25
61
  [0.1.0]: https://github.com/postnhost/postnhost/releases/tag/v0.1.0
data/README.md CHANGED
@@ -42,8 +42,9 @@ Mount this engine into an existing Rails app, or use the <a href="https://github
42
42
  - [Replacing favicon](#replacing-favicon)
43
43
  - [Host app i18n](#host-app-i18n-optional)
44
44
  - [Static pages](#static-pages-terms-privacy-etc)
45
+ - [API and MCP](#api-and-mcp)
45
46
  - [Routes](#routes)
46
- - [Manual configuration](#manual-configuration)
47
+ - [Production checklist](#production-checklist)
47
48
  - [Development](#development)
48
49
  - [License](#license)
49
50
 
@@ -194,7 +195,6 @@ bin/dev
194
195
 
195
196
  This generator creates:
196
197
 
197
- - `postnhost.tailwind.config.js`
198
198
  - `app/assets/stylesheets/postnhost/host.tailwind.css`
199
199
  - `Procfile.dev` watcher entry:
200
200
  - `postnhost_css: bundle exec rails postnhost:tailwindcss:watch`
@@ -202,8 +202,9 @@ This generator creates:
202
202
  - `postnhost:tailwindcss`
203
203
  - `postnhost:tailwindcss:watch`
204
204
 
205
- When host-tailwind mode files are present, PostnHost layouts automatically include `postnhost/host.css` after `postnhost/application.css`.
206
- You do not need to edit layout tags.
205
+ Host-tailwind mode builds one combined stylesheet from the engine and host view sources at `app/assets/builds/postnhost/application.css`. That host-owned file transparently overrides the packaged asset with the same logical path; the engine always requests `postnhost/application`. This avoids competing Tailwind builds and lets copied views use ordinary classes such as `bg-red-500` or `md:grid`.
206
+
207
+ If the host build is absent, Rails uses the packaged engine asset automatically. Both packaged and combined stylesheets are limited to PostnHost layouts through the `data-postnhost` root attribute. You do not need to edit layout tags or prefix Tailwind classes. Host customization requires Tailwind CSS 4.
207
208
 
208
209
  ### Robots.txt sitemap URL (required)
209
210
 
@@ -295,6 +296,16 @@ Link helpers:
295
296
  <%= link_to "Terms", postnhost.public_static_page_path(slug: "terms") %>
296
297
  ```
297
298
 
299
+ ## API and MCP
300
+
301
+ Manage CMS content and settings through the versioned JSON command API and the
302
+ Streamable HTTP MCP endpoint. Open **API & MCP** in the CMS to create or revoke
303
+ bearer tokens. The API and MCP share the same discoverable commands, input schemas,
304
+ and publishing workflows.
305
+
306
+ Discover commands at `/api/v1/commands`, OpenAPI at `/api/v1/openapi`, and
307
+ connect MCP clients to `/api/v1/mcp`, relative to the engine mount path.
308
+
298
309
  ## Routes
299
310
 
300
311
  The engine mounts at `/blog` by default. You can change this in `config/routes.rb`:
@@ -319,13 +330,15 @@ mount Postnhost::Engine, at: "/blog"
319
330
  - `GET /sitemap.xml` - XML sitemap
320
331
  - `GET /sitemap.xsl` - Sitemap stylesheet
321
332
 
322
- ## Manual configuration
333
+ ## Production checklist
323
334
 
324
- Some parts must still be configured manually in code:
335
+ Review these host-application settings before deployment:
325
336
 
326
- - Favicons
327
- - Robots.txt
328
- - Error pages 404/500 etc.
337
+ - Replace the host app’s favicon and related icon files if needed.
338
+ - Update `public/robots.txt` so its sitemap URL matches the production domain and engine mount path.
339
+ - Review the host app’s static `public/404.html` and `public/500.html` pages.
340
+ - Configure the generated CarrierWave initializer for S3-compatible production storage, or replace it with another storage configuration.
341
+ - If you customize the public templates, copy the required views and enable host Tailwind support when your changes introduce new utility classes.
329
342
 
330
343
  ## Development
331
344
 
data/Rakefile CHANGED
@@ -2,6 +2,34 @@ require "bundler/setup"
2
2
  require "fileutils"
3
3
 
4
4
  require "bundler/gem_tasks"
5
+ require_relative "lib/postnhost/css_build"
6
+
7
+ css_build = lambda do |watch:|
8
+ root = __dir__
9
+ unscoped_path = File.join(root, "app/assets/builds/postnhost/application.unscoped.css")
10
+ output_path = File.join(root, "app/assets/builds/postnhost/application.css")
11
+ command = [
12
+ File.join(root, "node_modules/.bin/tailwindcss"),
13
+ "-i", File.join(root, "app/assets/stylesheets/application.tailwind.css"),
14
+ "-o", unscoped_path,
15
+ "--minify"
16
+ ]
17
+ command << "--watch" if watch
18
+
19
+ Postnhost::CssBuild.run(command:, unscoped_path:, output_path:, watch:)
20
+ end
21
+
22
+ namespace :css do
23
+ desc "Build the engine stylesheet"
24
+ task build: :environment do
25
+ css_build.call(watch: false)
26
+ end
27
+
28
+ desc "Build the engine stylesheet and watch for changes"
29
+ task watch: :environment do
30
+ css_build.call(watch: true)
31
+ end
32
+ end
5
33
 
6
34
  # Load dummy app so the Rails `environment` task exists (required by prepare_test_db).
7
35
  require_relative "spec/dummy/config/application"