holivia 0.9.0 → 0.10.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: db5748262c860764f5d29eb0fc184f3a1af3eb5bfb0456f11d51b0b0b42cb4ef
4
- data.tar.gz: e4acfa1c1ffa4994f9bc5244be6e306e680a2dbed9605db234c1cb197e63f896
3
+ metadata.gz: 649b14e43fe74902dab26504ac1eb2ec403d3f7de0357283fb16393cd95e4d84
4
+ data.tar.gz: da1363943075ffbab5fa664434666202bc5654785a2e83083e6894c52d270baa
5
5
  SHA512:
6
- metadata.gz: 557e344b1c20c531f9261345f7697ab404c660d3da956649b5912d5b095222c5eac68eb46883b66a6bd1b4b816cc62fdb6ce01896b52bbacd060cdafc01507dc
7
- data.tar.gz: 74c71712389a8b2c9ce184e5385a3011cf3f2fc26304605bd23c996d862e1321c6be2cbb508b971b5df15b5a4be98bb0fb4c6f788e547a2bcdd616726cfdb0f0
6
+ metadata.gz: 497030e934ea60e03348f922f809811ef2f1d1172cd90c9a1b96533a26461d82a2dc6e2938cacf9a4e982ba30de93004edfb9e3f2ac79b9abc27247517312d2c
7
+ data.tar.gz: c36fa00ac0e7d9979ab1502a08143795b6ee7b97d3bafee411778d018c5ba96c34074a728cba00d4a44463de43bc96dc2724a6bc32065ea595da049079da491e
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: add-holivia-cli-endpoint
3
+ description: Add, extend, or review Holivia Ruby CLI commands that expose API endpoints while preserving the repository's routing, option parsing, HTTP, JSON output, help, and Minitest conventions. Use when implementing a new top-level CLI resource, adding an action or CRUD endpoint to an existing resource, exposing filters or request fields, adding multipart uploads, or checking an endpoint implementation for architectural consistency.
4
+ ---
5
+
6
+ # Add a Holivia CLI Endpoint
7
+
8
+ Read `../../../ai-skills/add-holivia-cli-endpoint.md` completely before taking any task action. Treat that file as the canonical workflow and follow it for the rest of the task.
9
+
10
+ If the file cannot be read, stop and report that the canonical guide is unavailable instead of reconstructing its instructions from memory.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Add Holivia CLI Endpoint"
3
+ short_description: "Add API endpoints using the existing CLI design"
4
+ default_prompt: "Use $add-holivia-cli-endpoint to add this API endpoint consistently to the Holivia CLI."
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.0] - 2026-07-17
4
+
5
+ - Add repeatable `--topic-id` support to replace or clear topics assigned to selfcare content
6
+ - Add CLI endpoint development skill documentation
7
+
3
8
  ## [0.9.0] - 2026-07-11
4
9
 
5
10
  - Add `holivia highlight` commands for HR home highlight CRUD, publishing, schema discovery, and cover/document uploads
data/README.md CHANGED
@@ -148,6 +148,18 @@ Create and update commands also accept JSON from standard input:
148
148
  printf '{"title":"Breathing exercise","locale":"fr"}' | holivia selfcare create
149
149
  ```
150
150
 
151
+ Replace the topics assigned to an existing content by repeating `--topic-id`:
152
+
153
+ ```bash
154
+ holivia selfcare update 123 --topic-id topic-id-1 --topic-id topic-id-2
155
+ ```
156
+
157
+ Pass an empty `topic_ids` array through stdin to remove every assigned topic. Omitting topic IDs leaves existing assignments unchanged:
158
+
159
+ ```bash
160
+ printf '{"topic_ids":[]}' | holivia selfcare update 123
161
+ ```
162
+
151
163
  List objectives:
152
164
 
153
165
  ```bash
data/SKILL.md CHANGED
@@ -179,6 +179,14 @@ Update a content:
179
179
  holivia selfcare update 123 --title "Updated title" --state published
180
180
  ```
181
181
 
182
+ Replace the topics assigned to an existing content by repeating `--topic-id`:
183
+
184
+ ```bash
185
+ holivia selfcare update 123 --topic-id topic-id-1 --topic-id topic-id-2
186
+ ```
187
+
188
+ Pass `{"topic_ids":[]}` through stdin to clear all topic assignments. Omit topic IDs to leave assignments unchanged.
189
+
182
190
  Upload or replace an image:
183
191
 
184
192
  ```bash
@@ -0,0 +1,124 @@
1
+ # Add a Holivia CLI Endpoint
2
+
3
+ Keep endpoint commands thin and consistent with the nearest existing resource. Implement the API contract at the command layer; reuse the shared client for transport, authentication, retries, response parsing, and API errors.
4
+
5
+ ## Inspect Before Editing
6
+
7
+ 1. Read `CLAUDE.md` and check the worktree for user changes.
8
+ 2. Establish the endpoint contract from the request or authoritative API material: HTTP verb, exact path, path parameters, query parameters, body keys and types, file fields, response shape, and required CLI name. Do not invent missing contract details.
9
+ 3. Read these architecture files:
10
+ - `lib/holivia/cli.rb` for top-level registration.
11
+ - `lib/holivia/commands/base.rb` for the shared client, JSON output, and piped JSON.
12
+ - `lib/holivia/client.rb` for supported HTTP methods and request behavior.
13
+ - `lib/holivia/cli/help.rb` for user-facing discovery.
14
+ - `test/holivia/test_cli.rb` for routing and help expectations.
15
+ 4. Choose the closest command and test pair as the implementation model:
16
+ - Read-only collection/member: `objective.rb` or `enterprise.rb`.
17
+ - Single member action: `appointment.rb`.
18
+ - CRUD with filters and nested JSON: `crisis.rb`.
19
+ - CRUD, schema, transitions, and uploads: `communication_item.rb`, `intervention_item.rb`, or `hr_home_highlight.rb`.
20
+ - Nested CLI namespace: `selfcare_objective.rb`, routed by `selfcare.rb`.
21
+ 5. Prefer extending the selected pattern over introducing an abstraction for one endpoint. Refactor shared behavior only when the task requires it or repetition has become material.
22
+
23
+ ## Place the Endpoint
24
+
25
+ For a new top-level resource:
26
+
27
+ 1. Add `lib/holivia/commands/<resource>.rb` with `# frozen_string_literal: true` and `require_relative "base"`.
28
+ 2. Define `Holivia::Commands::<Resource> < Base` and an exact `BASE_PATH`, normally under `/api/v1/backoffice`.
29
+ 3. Add `.route(args)`: shift the subcommand, dispatch with a `case`, pass the remaining array to the instance method, and warn plus `exit 1` for unknown commands.
30
+ 4. Require the command in `lib/holivia/cli.rb` and route its public top-level name in `CLI.start`.
31
+ 5. Add aliases only when the product vocabulary requires them; test each intentional alias.
32
+
33
+ For an endpoint belonging to an existing resource, add a subcommand and instance method to that command class. For a nested namespace, route through its parent command rather than adding another top-level command.
34
+
35
+ Use kebab-case for multiword CLI tokens, snake_case for Ruby filenames, constants, API paths, and request keys, and PascalCase for command classes. Follow existing public vocabulary when it differs from the API resource name.
36
+
37
+ ## Implement Command Behavior
38
+
39
+ Use these mappings:
40
+
41
+ - Collection read: `client.get(BASE_PATH, params: params)`.
42
+ - Member read: `client.get("#{BASE_PATH}/#{id}")`.
43
+ - Create: `client.post(BASE_PATH, body: options)`.
44
+ - Update: `client.patch("#{BASE_PATH}/#{id}", body: options)`.
45
+ - Member action: call the contract's verb on `"#{BASE_PATH}/#{id}/<action>"`.
46
+ - Delete: call `client.delete`, then print `output(deleted: true, id: id.to_i)` when the server has no useful body.
47
+ - Schema/discovery: `client.get("#{BASE_PATH}/schema")`.
48
+
49
+ Do not instantiate Faraday directly in a command. Do not add authentication headers, retry logic, response parsing, or `ApiError` rescue there; `Client` and `exe/holivia` already own those concerns. Extend `Client` and its tests only if the API requires an unsupported HTTP capability.
50
+
51
+ Always pass successful API responses to `output`, which preserves pretty-printed JSON as the CLI's machine-readable interface. Do not reshape a response unless the endpoint contract explicitly calls for it.
52
+
53
+ ### Parse arguments
54
+
55
+ - Accept positional member IDs first with `id = args.shift`.
56
+ - Abort missing IDs with the full command usage, for example `abort "Usage: holivia widget show <id>" unless id`.
57
+ - Use `OptionParser` and set a complete `opts.banner`.
58
+ - Map `--kebab-case` flags to snake_case symbol keys.
59
+ - Apply `Integer` converters to numeric identifiers, pagination, counts, and durations. Preserve strings such as UUIDs, codes, timestamps, states, and locales.
60
+ - Collect repeatable array flags by appending to an initialized array. Parse explicitly JSON-valued flags with `JSON.parse(..., symbolize_names: true)` when the resulting object is part of a symbol-keyed body.
61
+ - Keep collection filters in `params`; keep create/update values in `options`.
62
+ - For create and update, merge `piped_json` after flags with `options.merge(piped_json)`. This intentionally makes stdin JSON win on duplicate keys.
63
+ - Abort an empty create/update body with `No options provided. Use --help for usage.`
64
+ - Let the server validate domain rules and enums unless the repository already performs that validation. Expose a schema endpoint when the API provides one.
65
+
66
+ Extract a shared private `add_write_options` method when create and update accept the same fields. Keep action helpers such as `transition(args, event)` private when several subcommands share the same shape.
67
+
68
+ ### Handle uploads
69
+
70
+ Convert file paths to `Faraday::Multipart::FilePart` in a private body builder. Duplicate the options hash before replacing paths so the parser result is not mutated unexpectedly. Use a frozen extension-to-MIME map and fall back to `application/octet-stream`. Reuse the existing multipart-enabled `Client`; do not set the content type manually.
71
+
72
+ Test every supported MIME mapping, the fallback, and each file field's conversion. Do not add client-side size or presence validation unless requested; API validation remains authoritative.
73
+
74
+ ## Update Discovery Surfaces
75
+
76
+ Add the command, its arguments, and a concise description to the appropriate section of `lib/holivia/cli/help.rb`. Add or adjust the help assertions in `test/holivia/test_cli.rb`.
77
+
78
+ Update `README.md` and the root operational `SKILL.md` only when the endpoint changes the documented primary workflow or should be available to agents operating the released CLI. Do not bump the gem version or edit release notes unless the user requests release preparation.
79
+
80
+ ## Test at the Command Boundary
81
+
82
+ Create or update `test/holivia/commands/test_<resource>.rb`. Follow the nearest test file rather than introducing a new framework.
83
+
84
+ 1. Require `test_helper`, the command file, and `tmpdir` when used.
85
+ 2. Stub `$stdin` as a TTY in setup for commands that call `piped_json`; restore it in teardown.
86
+ 3. Stub `Holivia::Client.new` with a small object and restore the original method in `ensure`.
87
+ 4. Assert the exact HTTP method, endpoint path, query params or body, and representative JSON output.
88
+ 5. Cover every added behavior that applies:
89
+ - routing and unknown subcommand failure;
90
+ - filters and OptionParser type conversion;
91
+ - missing member ID;
92
+ - create/update with flags;
93
+ - piped JSON and its precedence when relevant;
94
+ - empty write rejection;
95
+ - member actions;
96
+ - delete confirmation;
97
+ - multipart parts and MIME detection;
98
+ - aliases;
99
+ - help visibility and top-level routing for a new resource.
100
+
101
+ Keep these tests at the CLI-to-client boundary. Do not make network requests. Add `Client` tests only when changing transport behavior.
102
+
103
+ ## Verify and Review
104
+
105
+ Run the narrow test first:
106
+
107
+ ```bash
108
+ bundle exec ruby -Itest test/holivia/commands/test_<resource>.rb
109
+ ```
110
+
111
+ Then run the repository checks:
112
+
113
+ ```bash
114
+ bundle exec rake
115
+ ```
116
+
117
+ Before finishing, inspect the diff and confirm:
118
+
119
+ - Every endpoint path and verb matches the contract exactly.
120
+ - Routing, requires, help text, and tests expose the same command spelling.
121
+ - Query keys, body keys, and OptionParser types match the API.
122
+ - Writes support stdin JSON consistently, unless the command is intentionally file-only or action-only.
123
+ - Successful output is JSON and failures retain the shared executable behavior.
124
+ - No unrelated refactor, version bump, credential, or generated package entered the change.
@@ -27,7 +27,8 @@ module Holivia
27
27
  holivia selfcare create [options] Create a selfcare content
28
28
  (--state draft|ongoing_translation|translation_to_be_reviewed|
29
29
  translation_reviewed|published)
30
- holivia selfcare update <id> [options] Update a selfcare content (same --state values)
30
+ holivia selfcare update <id> [options] Update a selfcare content (same --state values;
31
+ repeat --topic-id ID to replace assigned topics)
31
32
  holivia selfcare compose Create a full content tree atomically (no audio)
32
33
  holivia selfcare schema Show allowed values for content_types, format_types,
33
34
  item_types, states, objective_tiers
@@ -77,6 +77,7 @@ module Holivia
77
77
  opts.on("--description DESC") { |v| options[:description] = v }
78
78
  opts.on("--image FILE") { |v| options[:image] = v }
79
79
  opts.on("--state STATE") { |v| options[:state] = v }
80
+ opts.on("--topic-id ID") { |v| (options[:topic_ids] ||= []) << v }
80
81
  end.parse!(args)
81
82
  options = options.merge(piped_json)
82
83
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Holivia
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holivia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holivia
@@ -45,6 +45,8 @@ executables:
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".agents/skills/add-holivia-cli-endpoint/SKILL.md"
49
+ - ".agents/skills/add-holivia-cli-endpoint/agents/openai.yaml"
48
50
  - ".rubocop.yml"
49
51
  - CHANGELOG.md
50
52
  - CLAUDE.md
@@ -53,6 +55,7 @@ files:
53
55
  - README.md
54
56
  - Rakefile
55
57
  - SKILL.md
58
+ - ai-skills/add-holivia-cli-endpoint.md
56
59
  - example_content.xml
57
60
  - examples/compose.json
58
61
  - exe/holivia