holivia 0.11.0 → 0.12.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/CHANGELOG.md +8 -0
- data/README.md +65 -5
- data/SKILL.md +58 -0
- data/ai-skills/add-holivia-cli-endpoint.md +9 -4
- data/lib/holivia/cli/help.rb +23 -0
- data/lib/holivia/cli.rb +4 -0
- data/lib/holivia/commands/tag.rb +101 -0
- data/lib/holivia/commands/topic.rb +41 -0
- data/lib/holivia/version.rb +1 -1
- metadata +8 -12
- data/.agents/skills/add-holivia-cli-endpoint/SKILL.md +0 -10
- data/.agents/skills/add-holivia-cli-endpoint/agents/openai.yaml +0 -4
- data/.rubocop.yml +0 -31
- data/CLAUDE.md +0 -17
- data/Rakefile +0 -15
- data/mise.toml +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14dc959e163c982b0cb9ff68d098eb453c99c9802055de1c6086c8b61541894b
|
|
4
|
+
data.tar.gz: cb404446122ffd0f4dab4535b358ec50c6bcdda67781c569f9c6db699ca8ed3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd225340d2dd039e3a40f1104b0a606db28e3b5d30b3f7bd5a19a3ddc6d4e222a1519db2db64a3429fa8040ddc2131b38b5dafca3ce61701241c939e562475ae
|
|
7
|
+
data.tar.gz: c55acec78801a2a38ffa864d95997ae1e0245baa82fa57f53a508592d53a25b77e6c4809cc9d07ff44e9d2eb444a85d22a57d283ade5d32e3ae6d37ae8ec23c8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.12.0] - 2026-09-16
|
|
4
|
+
|
|
5
|
+
- Add `holivia tag` commands for catalogue CRUD and incremental topic-link management through repeatable `--topic-tag-json` flags or stdin JSON
|
|
6
|
+
- Add read-only `holivia topic index` and `holivia topic show` commands with topic filters and pagination
|
|
7
|
+
- Document tag permissions, association IDs, stdin precedence, asynchronous translation, and deletion behavior
|
|
8
|
+
- Move gem development into the SANTEZ monorepo while preserving standalone installation and the `holivia` executable
|
|
9
|
+
- Tag commands require the corresponding backoffice tag API deployment
|
|
10
|
+
|
|
3
11
|
## [0.11.0] - 2026-07-26
|
|
4
12
|
|
|
5
13
|
- Add `holivia support-phone-numbers` commands for backoffice support phone number CRUD and filtering
|
data/README.md
CHANGED
|
@@ -330,6 +330,63 @@ Publish it:
|
|
|
330
330
|
holivia highlight publish 123
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
+
## Tags And Topic Links
|
|
334
|
+
|
|
335
|
+
Tag reads require a content, therapist, or patient viewer/manager role, or `dev`. Creating, updating, and deleting tags and their topic links require `patient_manager` or `dev`. Topic discovery requires `content_viewer`, `content_manager`, or `dev`: patient-manager access alone is insufficient, but permits linking a known topic ID. A `403` means the account lacks the required role for that operation.
|
|
336
|
+
|
|
337
|
+
Discover topics and inspect existing tags:
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
holivia topic index --page 1 --per-page 25
|
|
341
|
+
holivia topic index --theme-id 3 --slug work-pressure
|
|
342
|
+
holivia topic show 12
|
|
343
|
+
holivia tag index --page 1 --per-page 25
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
All IDs below are examples: replace `3` with a theme ID, `12`, `13`, and `14` with IDs from topic responses, and `42` with `tag.id` returned by creation or listing. Use `81` only after reading the actual association ID from `tag.topic_tags[].id` in `tag show`; it is not `topic_id`. Both hidden and visible links are returned with topic summaries.
|
|
347
|
+
|
|
348
|
+
Create and inspect a tag:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
holivia tag create \
|
|
352
|
+
--code work_pressure \
|
|
353
|
+
--name-fr "Pression au travail" \
|
|
354
|
+
--name-en "Work pressure" \
|
|
355
|
+
--description "Support for work pressure" \
|
|
356
|
+
--topic-tag-json '{"topic_id":12,"hidden":false}'
|
|
357
|
+
holivia tag show 42
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Update only supplied fields; omitted scalar fields remain unchanged. Clear a description with `--description ""` without deleting the tag. Changes to French/English names schedule asynchronous translation after commit: the worker fills missing translations, prefers English as its source, and falls back to French. It does not overwrite existing translations; inspect the tag again later for newly translated names.
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
holivia tag update 42 --description ""
|
|
364
|
+
holivia tag update 42 --topic-tag-json '{"topic_id":13}' --topic-tag-json '{"topic_id":14}'
|
|
365
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"topic_id":13}'
|
|
366
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"hidden":true}'
|
|
367
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"_destroy":true}'
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
These are separate operation examples: choose the needed change, and reassign only to a topic not already linked to that tag. Repeated flags add multiple changes to `topic_tags_attributes`. Removing an association keeps the tag and topic. `hidden` and `_destroy` must be JSON booleans. Scalar and link changes in one request save atomically; an invalid link prevents the entire write.
|
|
371
|
+
|
|
372
|
+
Both create and update accept root-level stdin JSON. Stdin wins over flags on duplicate top-level keys, including replacing the flag-built association array for that request:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
printf '%s\n' '{"code":"rest","name_fr":"Repos","name_en":"Rest"}' | holivia tag create
|
|
376
|
+
printf '%s\n' '{"description":"From stdin","topic_tags_attributes":[{"id":81,"hidden":false}]}' | holivia tag update 42 --description "From flags"
|
|
377
|
+
printf '%s\n' '{"topic_tags_attributes":[]}' | holivia tag update 42 --topic-tag-json '{"topic_id":13}'
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Topic-link updates are incremental. Omitting `topic_tags_attributes` or sending `[]` preserves existing links; it never clears the persisted list. Use each association's `id` with `_destroy: true` to remove it.
|
|
381
|
+
|
|
382
|
+
Delete the tag when it is no longer needed:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
holivia tag delete 42
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Deletion removes the tag's patient, therapist, and selfcare assignments plus topic/theme links. Patients, therapists, selfcare contents, topics, and themes remain. A successful API `204` produces `{"deleted":true,"id":42}`; failures do not print success.
|
|
389
|
+
|
|
333
390
|
## Files And Uploads
|
|
334
391
|
|
|
335
392
|
Selfcare create and update commands can upload images with `--image <path>`.
|
|
@@ -356,16 +413,19 @@ Crisis and collective intervention create and update commands accept nested cont
|
|
|
356
413
|
|
|
357
414
|
## Development
|
|
358
415
|
|
|
359
|
-
|
|
416
|
+
Use `bin/holivia` from the SANTEZ root to run the checked-out gem source.
|
|
417
|
+
|
|
418
|
+
After checking out SANTEZ, enter the gem directory and run:
|
|
360
419
|
|
|
361
420
|
```bash
|
|
421
|
+
cd gems/holivia
|
|
362
422
|
bin/setup
|
|
363
423
|
```
|
|
364
424
|
|
|
365
425
|
Run the test suite with:
|
|
366
426
|
|
|
367
427
|
```bash
|
|
368
|
-
rake
|
|
428
|
+
bundle exec rake test
|
|
369
429
|
```
|
|
370
430
|
|
|
371
431
|
Open an interactive console with:
|
|
@@ -386,11 +446,11 @@ To release a new version, update the version number in `lib/holivia/version.rb`,
|
|
|
386
446
|
bundle exec rake release
|
|
387
447
|
```
|
|
388
448
|
|
|
389
|
-
This creates a git tag, pushes commits and
|
|
449
|
+
This creates a `holivia-v<version>` git tag, pushes commits and the tag, and publishes the `.gem` file to [RubyGems.org](https://rubygems.org). Run releases from a clean, merged SANTEZ checkout.
|
|
390
450
|
|
|
391
451
|
## Contributing
|
|
392
452
|
|
|
393
|
-
Bug reports and pull requests are welcome
|
|
453
|
+
Bug reports and pull requests are welcome in the [SANTEZ repository](https://github.com/Holivia-Team/SANTEZ/tree/dockerized-staging/gems/holivia).
|
|
394
454
|
|
|
395
455
|
## License
|
|
396
456
|
|
|
@@ -398,4 +458,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
398
458
|
|
|
399
459
|
## Code Of Conduct
|
|
400
460
|
|
|
401
|
-
Everyone interacting in the Holivia project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/Holivia-Team/
|
|
461
|
+
Everyone interacting in the Holivia project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/Holivia-Team/SANTEZ/blob/dockerized-staging/gems/holivia/CODE_OF_CONDUCT.md).
|
data/SKILL.md
CHANGED
|
@@ -295,6 +295,64 @@ holivia objective show 123
|
|
|
295
295
|
|
|
296
296
|
Objective translated fields are returned in the default locale, currently `fr`.
|
|
297
297
|
|
|
298
|
+
## Tags And Topic Links
|
|
299
|
+
|
|
300
|
+
Permissions: tag reads allow content, therapist, or patient viewer/manager roles and `dev`. Tag writes and deletion require `patient_manager` or `dev`. Topic discovery requires `content_viewer`, `content_manager`, or `dev`. A patient manager may link a known topic ID without topic-read access. Treat a `403` as a missing role for that operation; do not assume tag-write access grants topic discovery.
|
|
301
|
+
|
|
302
|
+
Discover topics and tags, then obtain IDs from their JSON responses:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
holivia topic index --page 1 --per-page 25
|
|
306
|
+
holivia topic index --theme-id 3 --slug work-pressure
|
|
307
|
+
holivia topic show 12
|
|
308
|
+
holivia tag index --page 1 --per-page 25
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
The following IDs are examples, not real targets: `3` is a theme ID; `12`, `13`, and `14` are topic IDs from discovery; `42` is `tag.id` from creation/listing. `81` is a TopicTag association ID from `tag.topic_tags[].id` returned by `tag show`, distinct from `topic_id`. Hidden links are included in that response.
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
holivia tag create \
|
|
315
|
+
--code work_pressure \
|
|
316
|
+
--name-fr "Pression au travail" \
|
|
317
|
+
--name-en "Work pressure" \
|
|
318
|
+
--topic-tag-json '{"topic_id":12,"hidden":false}'
|
|
319
|
+
holivia tag show 42
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Use the appropriate operation below rather than blindly executing every example. Reassignment must target a topic not already linked to the tag:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Add links; repeated flags form topic_tags_attributes
|
|
326
|
+
holivia tag update 42 --topic-tag-json '{"topic_id":13}' --topic-tag-json '{"topic_id":14}'
|
|
327
|
+
# Reassign one existing link
|
|
328
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"topic_id":13}'
|
|
329
|
+
# Change visibility, then remove just that association
|
|
330
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"hidden":true}'
|
|
331
|
+
holivia tag update 42 --topic-tag-json '{"id":81,"_destroy":true}'
|
|
332
|
+
# Clear description while keeping the tag
|
|
333
|
+
holivia tag update 42 --description ""
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Create/update scalar flags are `--code`, `--name-fr`, `--name-en`, and `--description`. Updates preserve omitted fields. French/English name changes enqueue translation after commit; missing translations are filled asynchronously using English first, French as fallback. Existing translations are not overwritten. Read again later when waiting for translated names.
|
|
337
|
+
|
|
338
|
+
Both write commands accept root-level stdin JSON. Stdin overrides duplicate top-level flag keys, including the complete flag-built `topic_tags_attributes` array for that request:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
printf '%s\n' '{"code":"rest","name_fr":"Repos","name_en":"Rest"}' | holivia tag create
|
|
342
|
+
printf '%s\n' '{"description":"From stdin","topic_tags_attributes":[{"id":81,"hidden":false}]}' | holivia tag update 42 --description "From flags"
|
|
343
|
+
printf '%s\n' '{"topic_tags_attributes":[]}' | holivia tag update 42 --topic-tag-json '{"topic_id":13}'
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Omitted association input and `[]` are no-ops: existing links remain. Use association IDs and `_destroy: true` for removal. Use JSON booleans for `hidden` and `_destroy`. Scalar and association changes are atomic; correct a failed request rather than assuming some links were saved. Malformed flag JSON is rejected locally; unknown/foreign association IDs return `404`, and invalid fields or duplicate links return `422`.
|
|
347
|
+
|
|
348
|
+
Delete a tag with:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
holivia tag delete 42
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
This removes patient, therapist, and selfcare taggings and topic/theme links while retaining all linked patients, therapists, contents, topics, and themes. Report deletion only after the CLI returns `{"deleted":true,"id":42}` following API success.
|
|
355
|
+
|
|
298
356
|
## Enterprises
|
|
299
357
|
|
|
300
358
|
Find an enterprise id:
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
The gem lives in the SANTEZ monorepo under `gems/holivia`. Paths in this guide are relative to that directory unless stated otherwise.
|
|
6
|
+
|
|
5
7
|
## Inspect Before Editing
|
|
6
8
|
|
|
7
|
-
1. Read `
|
|
9
|
+
1. Read the repository root `AGENTS.md` and check the worktree for user changes.
|
|
10
|
+
Read `ai-rules/cli-development.md` at the repository root for bundle selection, executable isolation, and verification commands.
|
|
8
11
|
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
12
|
3. Read these architecture files:
|
|
10
13
|
- `lib/holivia/cli.rb` for top-level registration.
|
|
@@ -102,16 +105,18 @@ Keep these tests at the CLI-to-client boundary. Do not make network requests. Ad
|
|
|
102
105
|
|
|
103
106
|
## Verify and Review
|
|
104
107
|
|
|
108
|
+
Run these commands with `gems/holivia` as the working directory and its Gemfile explicitly selected. Follow `ai-rules/cli-development.md` at the repository root for execution-environment guidance, including changes spanning Rails and the CLI.
|
|
109
|
+
|
|
105
110
|
Run the narrow test first:
|
|
106
111
|
|
|
107
112
|
```bash
|
|
108
|
-
bundle exec ruby -Itest test/holivia/commands/test_<resource>.rb
|
|
113
|
+
BUNDLE_GEMFILE="$PWD/Gemfile" bundle exec ruby -Itest test/holivia/commands/test_<resource>.rb
|
|
109
114
|
```
|
|
110
115
|
|
|
111
|
-
Then run the
|
|
116
|
+
Then run the full CLI tests and lint, bypassing the Rails `bin/rake` wrapper:
|
|
112
117
|
|
|
113
118
|
```bash
|
|
114
|
-
bundle exec rake
|
|
119
|
+
BUNDLE_GEMFILE="$PWD/Gemfile" bundle exec ruby -e 'load Gem.bin_path("rake", "rake")'
|
|
115
120
|
```
|
|
116
121
|
|
|
117
122
|
Before finishing, inspect the diff and confirm:
|
data/lib/holivia/cli/help.rb
CHANGED
|
@@ -50,6 +50,29 @@ module Holivia
|
|
|
50
50
|
holivia objective show <id> Show one objective
|
|
51
51
|
Translated fields are returned in the default locale (fr).
|
|
52
52
|
|
|
53
|
+
Topics:
|
|
54
|
+
holivia topic index [--theme-id ID --slug SLUG --page N --per-page N] List topics
|
|
55
|
+
holivia topic show <id> Show one topic by numeric ID
|
|
56
|
+
Requires content_viewer, content_manager, or dev. Patient-manager access alone is insufficient.
|
|
57
|
+
|
|
58
|
+
Tags:
|
|
59
|
+
holivia tag index [--page N --per-page N] List tags
|
|
60
|
+
holivia tag show <id> Show one tag with its topic links
|
|
61
|
+
holivia tag create [options] Create a tag
|
|
62
|
+
holivia tag update <id> [options] Update a tag
|
|
63
|
+
holivia tag delete <id> Delete a tag and its assignments and links; keep linked records
|
|
64
|
+
Write options: --code CODE --name-fr NAME --name-en NAME --description TEXT.
|
|
65
|
+
Piped JSON is merged after flags; stdin wins on duplicate keys.
|
|
66
|
+
Includes hidden links. Each topic_tags entry has an association ID distinct from its topic_id.
|
|
67
|
+
Create/update accept repeatable --topic-tag-json JSON flags, forming topic_tags_attributes:
|
|
68
|
+
Add: --topic-tag-json '{"topic_id":12,"hidden":false}'
|
|
69
|
+
Reassign: --topic-tag-json '{"id":81,"topic_id":13}'
|
|
70
|
+
Visibility: --topic-tag-json '{"id":81,"hidden":true}'
|
|
71
|
+
Remove link: --topic-tag-json '{"id":81,"_destroy":true}'
|
|
72
|
+
Example IDs: 12/13 are topic IDs; 81 is an association ID returned by tag show.
|
|
73
|
+
Changes are incremental: omitted links and [] preserve existing links; [] does not clear them.
|
|
74
|
+
Stdin topic_tags_attributes replaces the flag-built array for this request, not persisted links.
|
|
75
|
+
|
|
53
76
|
Enterprises:
|
|
54
77
|
holivia enterprise index [--query TEXT --headquarter-id ID --user-id ID --page N --per-page N]
|
|
55
78
|
Find enterprises and their enterprise_id values
|
data/lib/holivia/cli.rb
CHANGED
|
@@ -9,6 +9,8 @@ require_relative "commands/slide"
|
|
|
9
9
|
require_relative "commands/env"
|
|
10
10
|
require_relative "commands/item"
|
|
11
11
|
require_relative "commands/objective"
|
|
12
|
+
require_relative "commands/topic"
|
|
13
|
+
require_relative "commands/tag"
|
|
12
14
|
require_relative "commands/appointment"
|
|
13
15
|
require_relative "commands/communication_item"
|
|
14
16
|
require_relative "commands/intervention_item"
|
|
@@ -28,6 +30,8 @@ module Holivia
|
|
|
28
30
|
when "env" then Commands::Env.route(args)
|
|
29
31
|
when "selfcare" then Commands::Selfcare.route(args)
|
|
30
32
|
when "objective" then Commands::Objective.route(args)
|
|
33
|
+
when "topic" then Commands::Topic.route(args)
|
|
34
|
+
when "tag" then Commands::Tag.route(args)
|
|
31
35
|
when "appointment" then Commands::Appointment.route(args)
|
|
32
36
|
when "communication" then Commands::CommunicationItem.route(args)
|
|
33
37
|
when "intervention" then Commands::InterventionItem.route(args)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class Tag < Base
|
|
8
|
+
BASE_PATH = "/api/v1/backoffice/tags"
|
|
9
|
+
|
|
10
|
+
def self.route(args)
|
|
11
|
+
subcommand = args.shift
|
|
12
|
+
case subcommand
|
|
13
|
+
when "index" then new.index(args)
|
|
14
|
+
when "show" then new.show(args)
|
|
15
|
+
when "create" then new.create(args)
|
|
16
|
+
when "update" then new.update(args)
|
|
17
|
+
when "delete" then new.delete(args)
|
|
18
|
+
else warn "Unknown tag command: #{subcommand}"
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def index(args = [])
|
|
24
|
+
params = {}
|
|
25
|
+
OptionParser.new do |opts|
|
|
26
|
+
opts.banner = "Usage: holivia tag index [options]"
|
|
27
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
28
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
29
|
+
end.parse!(args)
|
|
30
|
+
|
|
31
|
+
output(client.get(BASE_PATH, params: params))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def show(args = [])
|
|
35
|
+
id = args.shift
|
|
36
|
+
abort "Usage: holivia tag show <id>" unless id
|
|
37
|
+
|
|
38
|
+
output(client.get("#{BASE_PATH}/#{id}"))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def create(args = [])
|
|
42
|
+
options = parse_write_options(args, "Usage: holivia tag create [options]")
|
|
43
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
44
|
+
|
|
45
|
+
output(client.post(BASE_PATH, body: options))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def update(args = [])
|
|
49
|
+
id = args.shift
|
|
50
|
+
abort "Usage: holivia tag update <id> [options]" unless id
|
|
51
|
+
|
|
52
|
+
options = parse_write_options(args, "Usage: holivia tag update <id> [options]")
|
|
53
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
54
|
+
|
|
55
|
+
output(client.patch("#{BASE_PATH}/#{id}", body: options))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def delete(args = [])
|
|
59
|
+
id = args.shift
|
|
60
|
+
abort "Usage: holivia tag delete <id>" unless id
|
|
61
|
+
|
|
62
|
+
client.delete("#{BASE_PATH}/#{id}")
|
|
63
|
+
output(deleted: true, id: id.to_i)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def parse_write_options(args, banner)
|
|
69
|
+
options = {}
|
|
70
|
+
OptionParser.new do |opts|
|
|
71
|
+
opts.banner = banner
|
|
72
|
+
opts.on("--code CODE") { |v| options[:code] = v }
|
|
73
|
+
opts.on("--name-fr NAME") { |v| options[:name_fr] = v }
|
|
74
|
+
opts.on("--name-en NAME") { |v| options[:name_en] = v }
|
|
75
|
+
opts.on("--description TEXT") { |v| options[:description] = v }
|
|
76
|
+
opts.on("--topic-tag-json JSON", "Repeat for multiple changes") { |v| append_topic_tag(options, v) }
|
|
77
|
+
add_topic_link_help(opts)
|
|
78
|
+
end.parse!(args)
|
|
79
|
+
options.merge(piped_json)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def add_topic_link_help(opts)
|
|
83
|
+
opts.separator "Piped JSON is merged after flags; stdin wins on duplicate keys."
|
|
84
|
+
opts.separator "Topic links are incremental; omitted links and [] preserve existing links."
|
|
85
|
+
opts.separator "Use topic_id to add; id is the association ID from tag show, not the topic ID."
|
|
86
|
+
opts.separator 'Add: {"topic_id":12,"hidden":false}; reassign: {"id":81,"topic_id":13}.'
|
|
87
|
+
opts.separator 'Visibility: {"id":81,"hidden":true}; remove: {"id":81,"_destroy":true}.'
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def append_topic_tag(options, json)
|
|
91
|
+
link = JSON.parse(json, symbolize_names: true)
|
|
92
|
+
abort "--topic-tag-json must be a JSON object (for example: '{\"topic_id\":12}')." unless link.is_a?(Hash)
|
|
93
|
+
|
|
94
|
+
options[:topic_tags_attributes] ||= []
|
|
95
|
+
options[:topic_tags_attributes] << link
|
|
96
|
+
rescue JSON::ParserError
|
|
97
|
+
abort "Invalid JSON for --topic-tag-json. Pass one JSON object (for example: '{\"topic_id\":12}')."
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class Topic < Base
|
|
8
|
+
BASE_PATH = "/api/v1/backoffice/topics"
|
|
9
|
+
|
|
10
|
+
def self.route(args)
|
|
11
|
+
subcommand = args.shift
|
|
12
|
+
case subcommand
|
|
13
|
+
when "index" then new.index(args)
|
|
14
|
+
when "show" then new.show(args)
|
|
15
|
+
else warn "Unknown topic command: #{subcommand}"
|
|
16
|
+
exit 1
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def index(args = [])
|
|
21
|
+
params = {}
|
|
22
|
+
OptionParser.new do |opts|
|
|
23
|
+
opts.banner = "Usage: holivia topic index [options]"
|
|
24
|
+
opts.on("--theme-id ID", Integer) { |v| params[:theme_id] = v }
|
|
25
|
+
opts.on("--slug SLUG") { |v| params[:slug] = v }
|
|
26
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
27
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
28
|
+
end.parse!(args)
|
|
29
|
+
|
|
30
|
+
output(client.get(BASE_PATH, params: params))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def show(args = [])
|
|
34
|
+
id = args.shift
|
|
35
|
+
abort "Usage: holivia topic show <id>" unless id
|
|
36
|
+
|
|
37
|
+
output(client.get("#{BASE_PATH}/#{id}"))
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/holivia/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Holivia
|
|
@@ -45,15 +45,10 @@ 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"
|
|
50
|
-
- ".rubocop.yml"
|
|
51
48
|
- CHANGELOG.md
|
|
52
|
-
- CLAUDE.md
|
|
53
49
|
- CODE_OF_CONDUCT.md
|
|
54
50
|
- LICENSE.txt
|
|
55
51
|
- README.md
|
|
56
|
-
- Rakefile
|
|
57
52
|
- SKILL.md
|
|
58
53
|
- ai-skills/add-holivia-cli-endpoint.md
|
|
59
54
|
- example_content.xml
|
|
@@ -82,19 +77,20 @@ files:
|
|
|
82
77
|
- lib/holivia/commands/selfcare_objective.rb
|
|
83
78
|
- lib/holivia/commands/slide.rb
|
|
84
79
|
- lib/holivia/commands/support_phone_number.rb
|
|
80
|
+
- lib/holivia/commands/tag.rb
|
|
81
|
+
- lib/holivia/commands/topic.rb
|
|
85
82
|
- lib/holivia/config_error.rb
|
|
86
83
|
- lib/holivia/configuration.rb
|
|
87
84
|
- lib/holivia/env_manager.rb
|
|
88
85
|
- lib/holivia/version.rb
|
|
89
|
-
- mise.toml
|
|
90
86
|
- sig/holivia.rbs
|
|
91
|
-
homepage: https://github.com/Holivia-Team/holivia
|
|
87
|
+
homepage: https://github.com/Holivia-Team/SANTEZ/tree/dockerized-staging/gems/holivia
|
|
92
88
|
licenses:
|
|
93
89
|
- MIT
|
|
94
90
|
metadata:
|
|
95
|
-
homepage_uri: https://github.com/Holivia-Team/holivia
|
|
96
|
-
source_code_uri: https://github.com/Holivia-Team/holivia
|
|
97
|
-
changelog_uri: https://github.com/Holivia-Team/
|
|
91
|
+
homepage_uri: https://github.com/Holivia-Team/SANTEZ/tree/dockerized-staging/gems/holivia
|
|
92
|
+
source_code_uri: https://github.com/Holivia-Team/SANTEZ/tree/dockerized-staging/gems/holivia
|
|
93
|
+
changelog_uri: https://github.com/Holivia-Team/SANTEZ/blob/dockerized-staging/gems/holivia/CHANGELOG.md
|
|
98
94
|
rubygems_mfa_required: 'true'
|
|
99
95
|
rdoc_options: []
|
|
100
96
|
require_paths:
|
|
@@ -110,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
110
106
|
- !ruby/object:Gem::Version
|
|
111
107
|
version: '0'
|
|
112
108
|
requirements: []
|
|
113
|
-
rubygems_version:
|
|
109
|
+
rubygems_version: 4.0.10
|
|
114
110
|
specification_version: 4
|
|
115
111
|
summary: Ruby client and CLI for the Holivia API
|
|
116
112
|
test_files: []
|
|
@@ -1,10 +0,0 @@
|
|
|
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.
|
data/.rubocop.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
TargetRubyVersion: 3.1
|
|
3
|
-
NewCops: enable
|
|
4
|
-
SuggestExtensions: false
|
|
5
|
-
|
|
6
|
-
Style/Documentation:
|
|
7
|
-
Enabled: false
|
|
8
|
-
|
|
9
|
-
Metrics/ClassLength:
|
|
10
|
-
Exclude:
|
|
11
|
-
- "test/**/*"
|
|
12
|
-
|
|
13
|
-
Metrics/AbcSize:
|
|
14
|
-
Max: 20
|
|
15
|
-
|
|
16
|
-
Metrics/MethodLength:
|
|
17
|
-
Max: 12
|
|
18
|
-
Exclude:
|
|
19
|
-
- "test/**/*"
|
|
20
|
-
|
|
21
|
-
Metrics/ParameterLists:
|
|
22
|
-
Max: 6
|
|
23
|
-
|
|
24
|
-
Naming/VariableNumber:
|
|
25
|
-
CheckMethodNames: false
|
|
26
|
-
|
|
27
|
-
Style/StringLiterals:
|
|
28
|
-
EnforcedStyle: double_quotes
|
|
29
|
-
|
|
30
|
-
Style/StringLiteralsInInterpolation:
|
|
31
|
-
EnforcedStyle: double_quotes
|
data/CLAUDE.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
## Project
|
|
2
|
-
|
|
3
|
-
This is the `holivia` Ruby gem — an API client library and CLI for the Holivia platform.
|
|
4
|
-
|
|
5
|
-
- **Gem name**: `holivia` (published on RubyGems.org)
|
|
6
|
-
- **Executable**: `holivia`
|
|
7
|
-
- **Repo**: `Holivia-Team/holivia-ruby`
|
|
8
|
-
|
|
9
|
-
## General Behavior
|
|
10
|
-
|
|
11
|
-
When asked for design options, architecture discussion, or planning — respond directly with ideas/options FIRST. Do not explore the codebase or use Task agents before answering the question. Only look at code if the user asks you to implement something.
|
|
12
|
-
|
|
13
|
-
When making changes, stay strictly within the scope of what was requested. Do not add, remove, or refactor code that wasn't asked for. If you think adjacent changes would be beneficial, mention them but wait for approval before making them.
|
|
14
|
-
|
|
15
|
-
When asked to commit changes, choose the appropriate workflow:
|
|
16
|
-
- **Full commit** (`/commit` skill): When Ruby files are changed — runs rubocop, rspec, and creates atomic conventional commits.
|
|
17
|
-
- **Quick commit**: When only non-Ruby files are changed (markdown, config, etc.) — just stage, write a conventional commit message, and commit directly.
|
data/Rakefile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler/gem_tasks"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
|
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
|
7
|
-
t.libs << "test"
|
|
8
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
require "rubocop/rake_task"
|
|
12
|
-
|
|
13
|
-
RuboCop::RakeTask.new
|
|
14
|
-
|
|
15
|
-
task default: %i[test rubocop]
|
data/mise.toml
DELETED