holivia 0.18.0 → 0.20.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: 271aaa000a9c26152473b0b6cb693a8897ceca2da7ca2fd53a1e8a3beb6335a2
4
- data.tar.gz: 69220c288809bceb7a8ed8c8873b1fbb57831d11049a371a18cd8c5d84626ae9
3
+ metadata.gz: 268213a58b9c58ce6568a167df1055d76f293b335dbbcb77fc2051faad018eff
4
+ data.tar.gz: 36f77ef89a5f69cbdd0cf90f0320e20c6f8604a394b42cda5e1e070832d1b4e4
5
5
  SHA512:
6
- metadata.gz: 3c682d5f11d12ca60ea9c07337a3587f3426859497c9af2c11eabe3b663124c5437a5e0f2d000b804c4d6d556d9c4d4bb7c0ed40f942382a66e1a8e9b0e7265a
7
- data.tar.gz: 79ce0864fe511c0e75fb47f07e511376e0d35e99b412b248a103753eb21bb22b1bfb5a124a328fde5f92550a177b14bc1dab64788ad1a0a82543d108e3d25156
6
+ metadata.gz: ff0e46b0ea6ab9f940062e3f8e68b55076656610d1a237cbb8bcc09d0d6cc593a6e100405cbd760a8ed75e5aea270b33b0672b719d05833581e6bab0fae77161
7
+ data.tar.gz: 288b374e2b2bce9fd1b999d23f7319146aaee86df3bea8ccbad6ba586f9428d4a93d8cc24f033a369654c9f5d5c083fa365458c7fc21e9eb6f40a42616033472
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.20.0] - 2026-11-12
4
+
5
+ - Add `holivia employee create` and `holivia employee update <id>` with the backoffice employee form fields (`--first-name`, `--last-name`, `--enterprise-email`, `--gender`, `--birthdate`, `--language`, `--location`, `--department`, `--segment-3` to `--segment-5`, `--hr-manager`, `--active-until`, `--kickable`, `--demo-deactivable`, `--dashboard-ids`), plus piped JSON; create also takes `--enterprise-id`. Update is partial. Requires an employee manager role
6
+ - Add `holivia segment index`, `show <id>`, and `update <id>` (all with `--enterprise-id`) to list an enterprise's segments, rename one (`--name-fr`, `--name-en`), or protect it from syncs (`--protected-from-sync true|false`). Requires an enterprise manager role
7
+ - `holivia employee index` and `show` now return `segment_3` to `segment_5`
8
+ - Requires the matching Holivia backoffice API deployment
9
+
10
+ ## [0.19.0] - 2026-11-11
11
+
12
+ - Add `holivia selfcare text <id>` to print the plain text of a selfcare content's text format: slide titles and rich text, in reading order; returns 404 when the content has no text format
13
+ - Add `--format-type TYPE` (`text`, `audio`, or `video`) to `holivia selfcare index`, also with `--all`, to list only contents that have a format of that type
14
+ - Requires a content viewer, content manager, or dev role
15
+ - Requires the matching Holivia backoffice API deployment
16
+
3
17
  ## [0.18.0] - 2026-11-03
4
18
 
5
19
  - Add `holivia credit-consumption-alert index` with `--enterprise-id`, `--page`, and `--per-page`, listing alerts with their `employees_count` and `consumption`
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Ruby client and command-line interface for the Holivia API.
4
4
 
5
- The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, enterprises, employees, HR access grants, contracts, credit consumption alerts, communication library items, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment diagnostics and history.
5
+ The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, enterprises, employees, segments, HR access grants, contracts, credit consumption alerts, communication library items, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment diagnostics and history.
6
6
 
7
7
  Coding agents can use [`SKILL.md`](SKILL.md) as a downloadable usage guide for operating this CLI safely.
8
8
 
@@ -122,6 +122,12 @@ holivia selfcare index --query "communication non violente" --locale fr --state
122
122
  holivia selfcare index --content-type exercise --page 2 --per-page 100
123
123
  ```
124
124
 
125
+ Keep only contents that have a format of a given type (`text`, `audio`, or `video`):
126
+
127
+ ```bash
128
+ holivia selfcare index --format-type text --all
129
+ ```
130
+
125
131
  Fetch every matching content as one JSON array (`--all` ignores `--page` and `--per-page`):
126
132
 
127
133
  ```bash
@@ -136,6 +142,12 @@ Show one selfcare content:
136
142
  holivia selfcare show 123
137
143
  ```
138
144
 
145
+ Read the plain text of a content's text format (slide titles and rich text, in reading order; returns 404 when the content has no text format):
146
+
147
+ ```bash
148
+ holivia selfcare text 123
149
+ ```
150
+
139
151
  Create a selfcare content from flags:
140
152
 
141
153
  ```bash
@@ -227,6 +239,20 @@ holivia employee index --enterprise-id 123 --query durand --left false
227
239
  holivia employee show 42
228
240
  ```
229
241
 
242
+ Create or update an employee (update keeps the fields you leave out):
243
+
244
+ ```bash
245
+ holivia employee create --enterprise-id 123 --enterprise-email ada@acme.fr --first-name Ada --last-name Lovelace
246
+ holivia employee update 42 --segment-5 Lyon
247
+ ```
248
+
249
+ List an enterprise's segments, rename one, or protect it from imports and directory syncs:
250
+
251
+ ```bash
252
+ holivia segment index --enterprise-id 123
253
+ holivia segment update 5 --enterprise-id 123 --name-fr Site --protected-from-sync true
254
+ ```
255
+
230
256
  Show and update an employee's HR access grants (omitted features are kept; `KEY=` clears one):
231
257
 
232
258
  ```bash
data/SKILL.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Use this skill when you need to operate the Holivia API through the `holivia` command-line tool.
4
4
 
5
- The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, enterprises, employees, HR access grants, contracts, credit consumption alerts, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment video diagnostics and history.
5
+ The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, enterprises, employees, segments, HR access grants, contracts, credit consumption alerts, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment video diagnostics and history.
6
6
 
7
7
  ## Preconditions
8
8
 
@@ -164,6 +164,12 @@ holivia selfcare index --query "communication non violente" --locale fr --state
164
164
  holivia selfcare index --content-type exercise --page 2 --per-page 100
165
165
  ```
166
166
 
167
+ Keep only contents that have a format of a given type (`text`, `audio`, or `video`):
168
+
169
+ ```bash
170
+ holivia selfcare index --format-type text --all
171
+ ```
172
+
167
173
  Fetch every matching content as one JSON array (`--all` ignores `--page` and `--per-page`):
168
174
 
169
175
  ```bash
@@ -178,6 +184,12 @@ Show one content:
178
184
  holivia selfcare show 123
179
185
  ```
180
186
 
187
+ Read the plain text of a content's text format (slide titles and rich text, in reading order; returns 404 when the content has no text format):
188
+
189
+ ```bash
190
+ holivia selfcare text 123
191
+ ```
192
+
181
193
  Create a content with flags:
182
194
 
183
195
  ```bash
@@ -419,6 +431,31 @@ Show one employee:
419
431
  holivia employee show 42
420
432
  ```
421
433
 
434
+ Create or update an employee (requires an employee manager role). Update is partial: fields you leave out keep their value. Gender and birthdate are accepted but never returned. The enterprise cannot be changed here, and `hr_space_only` only in the backoffice:
435
+
436
+ ```bash
437
+ holivia employee create --enterprise-id 123 --enterprise-email ada@acme.fr --first-name Ada --last-name Lovelace \
438
+ --birthdate 1990-12-10 --language fr --segment-5 Lyon
439
+ holivia employee update 42 --segment-5 Lyon
440
+ echo '{"segment_5": null}' | holivia employee update 42
441
+ ```
442
+
443
+ Segments protected from syncs are written by these commands: a manual edit always wins over imports and directory syncs.
444
+
445
+ ## Segments
446
+
447
+ Requires an enterprise manager role. Each enterprise has one segment per type: `location`, `department`, `segment_3`, `segment_4`, `segment_5`, and `gender`.
448
+
449
+ List them with their names and protection, then rename one or protect it from syncs:
450
+
451
+ ```bash
452
+ holivia segment index --enterprise-id 123
453
+ holivia segment show 5 --enterprise-id 123
454
+ holivia segment update 5 --enterprise-id 123 --name-fr Site --name-en Site --protected-from-sync true
455
+ ```
456
+
457
+ When a segment is protected, file imports, directory syncs, and the Saint-Gobain sync keep the current value of employees already in the enterprise; new employees and employees moved in from another enterprise still get the synced value. `gender` cannot be protected.
458
+
422
459
  ## HR Access Grants
423
460
 
424
461
  Requires an enterprise manager role or `dev`. Grants decide which HR space features an employee can use, and for which resource: a data scope for `usage`, a segment for `segment_summary`, an enterprise for every other feature.
@@ -53,6 +53,8 @@ module Holivia
53
53
 
54
54
  def launch_browser(url)
55
55
  command = RUBY_PLATFORM.include?("darwin") ? "open" : "xdg-open"
56
+ # Fixed command with an argument list (no shell); the URL is built by this class.
57
+ # nosemgrep: ruby.lang.security.dangerous-exec.dangerous-exec
56
58
  system(command, url, out: File::NULL, err: File::NULL)
57
59
  end
58
60
 
@@ -24,8 +24,10 @@ module Holivia
24
24
  Selfcare Contents:
25
25
  holivia selfcare index [options] List selfcare contents
26
26
  (--query TEXT --locale LOCALE --state STATE
27
- --content-type TYPE --page N --per-page N --all)
27
+ --content-type TYPE --format-type TYPE
28
+ --page N --per-page N --all)
28
29
  holivia selfcare show <id> Show a selfcare content by id
30
+ holivia selfcare text <id> Show the plain text of a selfcare content's text format
29
31
  holivia selfcare create [options] Create a selfcare content
30
32
  (--state draft|ongoing_translation|translation_to_be_reviewed|
31
33
  translation_reviewed|published)
@@ -92,6 +94,30 @@ module Holivia
92
94
  List employees; never includes Holivia account data.
93
95
  Demo employees are excluded unless --demo is given
94
96
  holivia employee show <id> Show one employee with its enterprise
97
+ holivia employee create --enterprise-id ID --enterprise-email EMAIL [options]
98
+ Create an employee
99
+ holivia employee update <id> [options] Update an employee; omitted fields keep their value
100
+ Write options: --first-name NAME --last-name NAME --enterprise-email EMAIL --gender male|female
101
+ --birthdate YYYY-MM-DD --language fr|en --location VALUE --department VALUE --segment-3 VALUE
102
+ --segment-4 VALUE --segment-5 VALUE --hr-manager true|false --active-until YYYY-MM-DD
103
+ --kickable true|false --demo-deactivable true|false --dashboard-ids ID,ID (replaces the list).
104
+ Segments protected from syncs are written too. Gender and birthdate are never returned.
105
+ The enterprise cannot be changed on update, and hr_space_only only in the backoffice.
106
+ Piped JSON is merged after flags; stdin wins ({"segment_5": null} clears a field).
107
+ Create and update require employee_manager.
108
+
109
+ Segments:
110
+ holivia segment index --enterprise-id ID
111
+ List the enterprise's segment types (location, department,
112
+ segment_3 to segment_5, gender) with their names and protection
113
+ holivia segment show <id> --enterprise-id ID
114
+ Show one segment
115
+ holivia segment update <id> --enterprise-id ID [--name-fr NAME --name-en NAME
116
+ --protected-from-sync true|false]
117
+ Rename a segment or protect it from syncs: file imports,
118
+ directory syncs and the Saint-Gobain sync then keep the
119
+ value of existing employees. Gender cannot be protected
120
+ Piped JSON is merged after flags; stdin wins. Requires enterprise_manager.
95
121
 
96
122
  HR Access Grants:
97
123
  holivia hr-access-grant show <employee_id>
data/lib/holivia/cli.rb CHANGED
@@ -17,6 +17,7 @@ require_relative "commands/intervention_item"
17
17
  require_relative "commands/hr_home_highlight"
18
18
  require_relative "commands/enterprise"
19
19
  require_relative "commands/employee"
20
+ require_relative "commands/segment"
20
21
  require_relative "commands/hr_access_grant"
21
22
  require_relative "commands/contract"
22
23
  require_relative "commands/credit_consumption_alert"
@@ -42,6 +43,7 @@ module Holivia
42
43
  when "highlight" then Commands::HrHomeHighlight.route(args)
43
44
  when "enterprise" then Commands::Enterprise.route(args)
44
45
  when "employee" then Commands::Employee.route(args)
46
+ when "segment" then Commands::Segment.route(args)
45
47
  when "hr-access-grant" then Commands::HrAccessGrant.route(args)
46
48
  when "contract" then Commands::Contract.route(args)
47
49
  when "credit-consumption-alert" then Commands::CreditConsumptionAlert.route(args)
@@ -9,12 +9,17 @@ module Holivia
9
9
  BOOLEAN_VALUES = %w[true false].freeze
10
10
  DEPENDENT_STATUSES = %w[creator dependent not_dependent].freeze
11
11
  DEMO_VALUES = %w[true false all].freeze
12
+ BOOLEANS = { "true" => true, "false" => false }.freeze
13
+ CREATE_BANNER = "Usage: holivia employee create --enterprise-id ID --enterprise-email EMAIL [options]"
14
+ UPDATE_BANNER = "Usage: holivia employee update <id> [options]"
12
15
 
13
16
  def self.route(args)
14
17
  subcommand = args.shift
15
18
  case subcommand
16
19
  when "index" then new.index(args)
17
20
  when "show" then new.show(args)
21
+ when "create" then new.create(args)
22
+ when "update" then new.update(args)
18
23
  else warn "Unknown employee command: #{subcommand}"
19
24
  exit 1
20
25
  end
@@ -43,6 +48,58 @@ module Holivia
43
48
 
44
49
  output(client.get("#{BASE_PATH}/#{id}"))
45
50
  end
51
+
52
+ def create(args = [])
53
+ options = parse_write_options(args, CREATE_BANNER, create: true)
54
+ abort "No options provided. Use --help for usage." if options.empty?
55
+
56
+ output(client.post(BASE_PATH, body: options))
57
+ end
58
+
59
+ def update(args = [])
60
+ id = args.shift
61
+ abort UPDATE_BANNER unless id
62
+
63
+ options = parse_write_options(args, UPDATE_BANNER)
64
+ abort "No options provided. Use --help for usage." if options.empty?
65
+
66
+ output(client.patch("#{BASE_PATH}/#{id}", body: options))
67
+ end
68
+
69
+ private
70
+
71
+ def parse_write_options(args, banner, create: false) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
72
+ options = {}
73
+ OptionParser.new do |opts|
74
+ opts.banner = banner
75
+ opts.on("--enterprise-id ID", Integer) { |v| options[:enterprise_id] = v } if create
76
+ opts.on("--first-name NAME") { |v| options[:first_name] = v }
77
+ opts.on("--last-name NAME") { |v| options[:last_name] = v }
78
+ opts.on("--enterprise-email EMAIL") { |v| options[:enterprise_email] = v }
79
+ opts.on("--gender GENDER", "male or female") { |v| options[:gender] = v }
80
+ opts.on("--birthdate DATE", "YYYY-MM-DD") { |v| options[:birthdate] = v }
81
+ opts.on("--language LANG", "fr or en") { |v| options[:language] = v }
82
+ opts.on("--location VALUE") { |v| options[:location] = v }
83
+ opts.on("--department VALUE") { |v| options[:department] = v }
84
+ opts.on("--segment-3 VALUE") { |v| options[:segment_3] = v }
85
+ opts.on("--segment-4 VALUE") { |v| options[:segment_4] = v }
86
+ opts.on("--segment-5 VALUE") { |v| options[:segment_5] = v }
87
+ opts.on("--hr-manager BOOL", BOOLEANS) { |v| options[:hr_manager] = v }
88
+ opts.on("--active-until DATE", "YYYY-MM-DD") { |v| options[:active_until] = v }
89
+ opts.on("--kickable BOOL", BOOLEANS) { |v| options[:kickable] = v }
90
+ opts.on("--demo-deactivable BOOL", BOOLEANS) { |v| options[:demo_deactivable] = v }
91
+ opts.on("--dashboard-ids IDS", Array, "Enterprise IDs, comma separated; replaces the list") do |v|
92
+ options[:dashboard_ids] = parse_ids(v)
93
+ end
94
+ end.parse!(args)
95
+ options.merge(piped_json)
96
+ end
97
+
98
+ def parse_ids(values)
99
+ values.map { |id| Integer(id) }
100
+ rescue ArgumentError
101
+ raise OptionParser::InvalidArgument, values.join(",")
102
+ end
46
103
  end
47
104
  end
48
105
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Holivia
6
+ module Commands
7
+ class Segment < Base
8
+ ENTERPRISES_PATH = "/api/v1/backoffice/enterprises"
9
+ BOOLEANS = { "true" => true, "false" => false }.freeze
10
+ UPDATE_BANNER = "Usage: holivia segment update <id> --enterprise-id ID " \
11
+ "[--name-fr NAME --name-en NAME --protected-from-sync true|false]"
12
+
13
+ def self.route(args)
14
+ subcommand = args.shift
15
+ case subcommand
16
+ when "index" then new.index(args)
17
+ when "show" then new.show(args)
18
+ when "update" then new.update(args)
19
+ else warn "Unknown segment command: #{subcommand}"
20
+ exit 1
21
+ end
22
+ end
23
+
24
+ def index(args = [])
25
+ enterprise_id = parse_enterprise_id(args, "Usage: holivia segment index --enterprise-id ID")
26
+
27
+ output(client.get(segments_path(enterprise_id)))
28
+ end
29
+
30
+ def show(args = [])
31
+ banner = "Usage: holivia segment show <id> --enterprise-id ID"
32
+ id = args.shift
33
+ abort banner unless id
34
+
35
+ output(client.get("#{segments_path(parse_enterprise_id(args, banner))}/#{id}"))
36
+ end
37
+
38
+ def update(args = [])
39
+ id = args.shift
40
+ abort UPDATE_BANNER unless id
41
+
42
+ enterprise_id, options = parse_update_options(args)
43
+ abort UPDATE_BANNER unless enterprise_id
44
+ options = options.merge(piped_json)
45
+ abort "No options provided. Use --help for usage." if options.empty?
46
+
47
+ output(client.patch("#{segments_path(enterprise_id)}/#{id}", body: options))
48
+ end
49
+
50
+ private
51
+
52
+ def parse_enterprise_id(args, banner)
53
+ enterprise_id = nil
54
+ OptionParser.new do |opts|
55
+ opts.banner = banner
56
+ opts.on("--enterprise-id ID", Integer) { |v| enterprise_id = v }
57
+ end.parse!(args)
58
+ abort banner unless enterprise_id
59
+
60
+ enterprise_id
61
+ end
62
+
63
+ def parse_update_options(args)
64
+ enterprise_id = nil
65
+ options = {}
66
+ OptionParser.new do |opts|
67
+ opts.banner = UPDATE_BANNER
68
+ opts.on("--enterprise-id ID", Integer) { |v| enterprise_id = v }
69
+ opts.on("--name-fr NAME") { |v| options[:name_fr] = v }
70
+ opts.on("--name-en NAME") { |v| options[:name_en] = v }
71
+ opts.on("--protected-from-sync BOOL", BOOLEANS) { |v| options[:protected_from_sync] = v }
72
+ end.parse!(args)
73
+ [enterprise_id, options]
74
+ end
75
+
76
+ def segments_path(enterprise_id)
77
+ "#{ENTERPRISES_PATH}/#{enterprise_id}/segments"
78
+ end
79
+ end
80
+ end
81
+ end
@@ -22,6 +22,7 @@ module Holivia
22
22
  case subcommand
23
23
  when "index" then new.index(args)
24
24
  when "show" then new.show(args)
25
+ when "text" then new.text(args)
25
26
  when "create" then new.create(args)
26
27
  when "update" then new.update(args)
27
28
  when "compose" then new.compose(args)
@@ -44,6 +45,9 @@ module Holivia
44
45
  opts.on("--locale LOCALE") { |v| params[:locale] = v }
45
46
  opts.on("--state STATE") { |v| params[:state] = v }
46
47
  opts.on("--content-type TYPE") { |v| params[:content_type] = v }
48
+ opts.on("--format-type TYPE", "Only contents with a format of this type (text, audio, video)") do |v|
49
+ params[:format_type] = v
50
+ end
47
51
  opts.on("--page N", Integer) { |v| params[:page] = v }
48
52
  opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
49
53
  opts.on("--all", "Fetch every page and print one JSON array (ignores --page and --per-page)") { all = true }
@@ -59,6 +63,13 @@ module Holivia
59
63
  output(client.get("#{BASE_PATH}/#{id}"))
60
64
  end
61
65
 
66
+ def text(args = [])
67
+ id = args.shift
68
+ abort "Usage: holivia selfcare text <id>" unless id
69
+
70
+ output(client.get("#{BASE_PATH}/#{id}/text"))
71
+ end
72
+
62
73
  def create(args = []) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
63
74
  options = {}
64
75
  OptionParser.new do |opts|
@@ -58,6 +58,8 @@ module Holivia
58
58
  return default_config unless raw["environments"].is_a?(Hash)
59
59
  return default_config unless raw["current_env"].is_a?(String)
60
60
 
61
+ # Not a Rails view; raw is a local variable holding the parsed config.
62
+ # nosemgrep: ruby.rails.security.audit.xss.avoid-raw.avoid-raw
61
63
  raw
62
64
  end
63
65
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Holivia
4
- VERSION = "0.18.0"
4
+ VERSION = "0.20.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.18.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holivia
@@ -78,6 +78,7 @@ files:
78
78
  - lib/holivia/commands/intervention_item.rb
79
79
  - lib/holivia/commands/item.rb
80
80
  - lib/holivia/commands/objective.rb
81
+ - lib/holivia/commands/segment.rb
81
82
  - lib/holivia/commands/selfcare.rb
82
83
  - lib/holivia/commands/selfcare_objective.rb
83
84
  - lib/holivia/commands/slide.rb