@renault-digital/bash-base 2.5.0 → 2.5.1

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.
package/CONTRIBUTING.md CHANGED
@@ -30,6 +30,11 @@ implementation details are not a reason to withhold a useful use case.
30
30
 
31
31
  ## Proposing a feature
32
32
 
33
+ Consult the [roadmap](docs/roadmap.md) for current priorities, dependencies and
34
+ acceptance criteria. A roadmap entry is an investigation direction, not an
35
+ approved API or a guaranteed release. Record actionable tasks and results in
36
+ issues and pull requests.
37
+
33
38
  Start with the [design principles](docs/design-principles.md). Bash-base accepts
34
39
  features to reduce recurring command-composition and scripting costs, not to
35
40
  maximize the number of helpers or reproduce another language's standard library.
package/README.md CHANGED
@@ -306,6 +306,14 @@ See [spec](spec) folder. Run `npm test` to execute the Bash/zsh compatibility ga
306
306
  ## Latest Update
307
307
  See [change log](CHANGELOG.md)
308
308
 
309
+ ## Roadmap
310
+
311
+ See the [project roadmap](docs/roadmap.md) for prioritized investigation and
312
+ future evolution of command composition, API contracts, shell portability,
313
+ security, testing and distribution. The roadmap is not a commitment to ship
314
+ particular features or versions. New proposals follow the
315
+ [design principles](docs/design-principles.md).
316
+
309
317
  ## Contributing
310
318
  See [How to contribute](CONTRIBUTING.md)
311
319
 
@@ -171,4 +171,6 @@ APIs when only one well-defined operation is needed.
171
171
 
172
172
  Keep this document focused on design decisions. The API reference belongs to
173
173
  the existing source-comment generation workflow; specific enhancement proposals
174
- and scheduling decisions belong in issues and pull requests.
174
+ and scheduling decisions belong in issues and pull requests. The
175
+ [roadmap](roadmap.md) tracks possible future directions and their acceptance
176
+ criteria; it does not override existing API contracts or these principles.
@@ -0,0 +1,289 @@
1
+ # Bash-base roadmap
2
+
3
+ > **Status:** Planning document; last reviewed 2026-10-16. Priorities and status
4
+ > notes describe the known project state at that review, not a guarantee of
5
+ > present CI or release status. Check current GitHub issues, pull requests,
6
+ > workflow runs and published artifacts before acting.
7
+
8
+ ## Purpose and scope
9
+
10
+ Bash-base aims to make **command-oriented Bash and zsh programming more reliable,
11
+ understandable and composable**. Reusable higher-level helpers should reduce
12
+ repeated searching, comparison, experimentation, verification and maintenance.
13
+ String and array operations support argument management, output transformation
14
+ and automation logic; implementing a general-purpose data-processing language
15
+ is not the project's goal.
16
+
17
+ This roadmap identifies problems to investigate, their relative priorities and
18
+ what evidence would justify calling the work complete. It is **not** a promise
19
+ that every proposed API will be implemented, a release schedule, or a statement
20
+ that unimplemented helpers are already available.
21
+
22
+ Read [design principles](design-principles.md) for lasting rules,
23
+ [Bash/zsh compatibility](bash-zsh-compatibility.md) for the currently documented
24
+ portability contract, [coverage and the CI test matrix](coverage.md) for actual
25
+ test scope, and [CONTRIBUTING](../CONTRIBUTING.md) for proposal and review
26
+ requirements. The [generated API reference](references.md) and source comments,
27
+ not this roadmap, describe shipped APIs.
28
+
29
+ ## How priorities and status work
30
+
31
+ | Priority | Meaning |
32
+ | --- | --- |
33
+ | **P0 — Reliability and foundations** | Protect current consumers, close release/security risks and establish contracts needed before safely expanding APIs. |
34
+ | **P1 — Coherent evolution** | Improve composability, data semantics, deployment experience and testing after their dependencies are understood. |
35
+ | **P2 — Candidate capabilities** | Investigate useful new helpers only when real recurring use cases justify them. |
36
+
37
+ Possible status values are **Proposed**, **Under investigation**, **Planned**,
38
+ **In progress**, **Blocked** and **Completed**. An item's presence or P-level
39
+ **does not authorize implementation**. Keep statuses and evidence in focused
40
+ GitHub issues and pull requests; update this document when the direction,
41
+ priority or acceptance criteria meaningfully change. Do not invent dates or
42
+ promise a particular release number before scope and risks are reviewed.
43
+
44
+ ## P0 — Reliability, release integrity and API foundations
45
+
46
+ ### P0.1 Complete and verify the release chain
47
+
48
+ **Status (2026-10-16): In progress.** The GitHub Actions to npm OIDC token
49
+ exchange was observed to succeed. The first end-to-end publication was not
50
+ completed in the observed run: release Git push was blocked by a local Husky
51
+ `pre-push` hook in a job without zsh. Treat this as a release-workflow issue;
52
+ do not reintroduce a long-lived npm publishing token or bypass existing quality
53
+ gates. Current results and fixes must be checked in the relevant CI runs.
54
+
55
+ Work to investigate and verify:
56
+
57
+ - Keep npm Trusted Publishing matched to the authorized GitHub repository and
58
+ release workflow, with narrowly scoped `id-token: write` on trusted release
59
+ jobs. Validate actual publication, not only credential exchange or dry-run.
60
+ - Keep GitHub Release and Docker authentication separate from npm OIDC. Avoid
61
+ re-running developer-local Git hooks in release jobs after required CI gates,
62
+ without disabling those hooks for contributors.
63
+ - Verify npm package version, Git tags, generated bundle, GitHub Release and
64
+ Docker tags/images represent the intended source and release. Investigate the
65
+ previously observed mismatch between the npm published version and the latest
66
+ Git tag instead of assuming they were always synchronized.
67
+ - Review release-trigger rules and side effects: documentation and CI commits
68
+ may currently cause a patch release. Preserve intended behavior until a
69
+ separate, reviewed change establishes a new policy.
70
+ - After a successful trusted publish, review restrictive package publishing
71
+ access and retire obsolete npm tokens without removing credentials needed by
72
+ other release destinations.
73
+
74
+ **Acceptance:** A real authorized `master` release completes with the required
75
+ lint, compatibility, regression and strict coverage jobs passing; npm, GitHub
76
+ and Docker artifacts are checked against the intended tag/source; the npm
77
+ Trusted Publisher is validated; no legacy `NPM_TOKEN` is needed by npm publish.
78
+
79
+ ### P0.2 Security and compatibility audit of existing code
80
+
81
+ **Status: Planned; findings require fresh source review.**
82
+
83
+ - Audit `eval`, dynamic variable names/references, command-string construction,
84
+ argument quoting, glob expansion, external input and re-interpretation of data
85
+ as Shell code. Distinguish APIs intentionally accepting *trusted code* from
86
+ APIs accepting ordinary data.
87
+ - Audit process selection/termination (especially `prc_filter_by_cmd` and
88
+ `prc_kill_by_cmd`) for ambiguous matches, accidental termination, exit-state
89
+ handling and potential safer PID-based alternatives.
90
+ - Audit `source`-time and repeated-source effects on caller variables, `IFS`,
91
+ options, traps, current directory, terminal interaction and stdout/stderr.
92
+ - Check historical executable-mode changes on `src/*.sh` against actual intended
93
+ use. Sourcing a file does not require the executable bit; whether direct
94
+ execution is a supported contract must be verified before changing modes.
95
+ - Audit npm vulnerabilities using a current dependency tree and threat model;
96
+ distinguish development/build-only dependencies from runtime exposure.
97
+ Previous `npm ci` warnings are a historical finding, not a current count.
98
+
99
+ **Acceptance:** Findings have reproducible evidence and risk classification;
100
+ changes preserve existing Bash and documented zsh behavior unless deliberate
101
+ migration is approved; regression and adversarial-input tests cover fixes. Do
102
+ not remove `eval` indiscriminately or use `npm audit fix --force` as a shortcut.
103
+
104
+ ### P0.3 Define a consistent public API contract
105
+
106
+ **Status: Planned. Design guidance exists; per-helper review remains.**
107
+
108
+ Define and document, for new public APIs and each reviewed legacy API:
109
+
110
+ | Contract area | Required decisions |
111
+ | --- | --- |
112
+ | Input | Positional parameters, stdin, named variables; accepted identifiers and record boundaries. |
113
+ | Output | stdout, named destination, in-place change or other side effect; output suitable for composition. |
114
+ | Outcomes | How success, false predicates, empty results, invalid inputs and command failures differ. |
115
+ | Data | Ordering, duplicates, empty elements, whitespace, newlines, encoding limitations and serialization domain. |
116
+ | Execution | External processes, prompts, timeouts, cleanup, cwd, traps, variables and other caller-state changes. |
117
+ | Portability | Tested Shell versions and GNU/BSD command requirements; explicitly documented exceptions. |
118
+
119
+ **Acceptance:** A reviewed, example-backed contract template is available and
120
+ applied to the first representative String, Array, Argument and Process helpers;
121
+ contract tests prove relevant boundary behavior. Existing undocumented quirks
122
+ are catalogued before redesign. New guidelines **do not retroactively change**
123
+ legacy API semantics.
124
+
125
+ ### P0.4 Preserve trustworthy test and coverage gates
126
+
127
+ **Status: Established gates; continued assurance required.**
128
+
129
+ - Preserve the Bash regression suite, Bash/zsh compatibility checks and the
130
+ macOS Bash 3.2 / Bash 5+ / zsh / interactive TTY coverage collection.
131
+ - Keep the **100% union of measurable source lines** as a mandatory CI gate.
132
+ This does **not** mean each Shell individually has 100% coverage, or that all
133
+ branches, inputs, OS combinations or security properties have been tested.
134
+ - Ensure that Codecov displays the validated report for the correct source
135
+ revision, and that report-export or upload failures cannot silently create a
136
+ misleading green result. Preserve diagnostics for failures.
137
+ - Add boundary, negative-case, quoting, failure-propagation and caller-state
138
+ tests where risk warrants them. Keep test selectors and the
139
+ [CI test matrix](coverage.md#ci-test-matrix) synchronized.
140
+
141
+ **Acceptance:** Mandatory CI gates fail on a regression or a real coverage
142
+ shortfall; reports and source identity are verifiable; neither exclusions,
143
+ synthetic hits nor weakened assertions are used to satisfy a coverage number.
144
+
145
+ ## P1 — Coherent abstractions and adoption
146
+
147
+ ### P1.1 Clarify String / Array / List / Set semantics
148
+
149
+ **Status: Planned (design before expansion).**
150
+
151
+ - Distinguish a String from a Shell-native Array, a List (ordered, duplicates
152
+ allowed) and a Set (unique elements; traversal order must be specified).
153
+ - Audit the real behavior of existing `array_*` functions, especially union,
154
+ intersection, duplicates and ordering. Do not rename or change them just
155
+ because a new conceptual model is clearer.
156
+ - Decide whether distinct `list_*` or `set_*` APIs solve real command-input or
157
+ command-output workflows; avoid adding an entire family for symmetry alone.
158
+ - Verify empty elements, spaces, literal wildcards, newline-containing values,
159
+ shell indexing and serialization/restore boundaries in supported Shells.
160
+
161
+ **Acceptance:** A documented semantic model, representative composition
162
+ examples, compatibility analysis and cross-Shell boundary tests precede any
163
+ new public type family.
164
+
165
+ ### P1.2 Investigate a Map API
166
+
167
+ **Status: Under investigation; not an implemented feature.**
168
+
169
+ Potential uses include options, configuration and key/value associations
170
+ between system commands. Start with a contract rather than function names:
171
+
172
+ - Key and value domain; empty values versus missing keys; duplicate assignment.
173
+ - Lookup, insertion/removal and iteration semantics; deterministic ordering
174
+ only if explicitly promised; memory and performance constraints.
175
+ - Serialization, newlines and unsafe code/data boundaries.
176
+ - A Bash 3.2-compatible representation (it lacks native associative arrays),
177
+ and any Bash 5+/zsh optimization that preserves the same public contract.
178
+
179
+ **Acceptance:** Demonstrate a recurring use case that existing built-ins,
180
+ helpers or tools do not solve adequately; compare representations and costs;
181
+ approve an API contract and test model before implementation. A proposal can
182
+ be rejected if complexity outweighs command-composition value.
183
+
184
+ ### P1.3 Improve module loading and namespacing
185
+
186
+ **Status: Proposed.**
187
+
188
+ - Investigate optional `bb_*` namespaced entry points to reduce function-name
189
+ collisions. Keep current public names working unless a separately planned,
190
+ properly versioned migration is approved.
191
+ - Investigate selective module loading with explicit module dependencies,
192
+ idempotence and well-defined `source` effects. Simply splitting files is not
193
+ proof of independent modules.
194
+ - Prefer a migration/adoption story with tangible benefit over a broad,
195
+ mechanical rename or a large framework layer.
196
+
197
+ **Acceptance:** Dependency and state model documented; current full-library
198
+ loading remains compatible; realistic scripts validate both old and new usage.
199
+
200
+ ### P1.4 Strengthen fixed-version and offline-first distribution
201
+
202
+ **Status: Proposed enhancements to existing distribution.**
203
+
204
+ The build **already generates a single-file** `bin/bash-base`; do not propose
205
+ adding that existing feature a second time. Instead:
206
+
207
+ - Make pinned/local/offline usage clear and straightforward, with examples
208
+ for GitHub, npm, Docker and bundled artifacts that state when network access
209
+ occurs. Never imply that `source <(curl ...)` works offline.
210
+ - Evaluate module vendoring or focused bundling only when it lowers setup and
211
+ maintenance costs without changing behavior.
212
+ - Verify runtime requirements separately from npm/Docker tools used for build,
213
+ CI or distribution. Check version provenance and reproducibility where useful.
214
+
215
+ **Acceptance:** A documented, reproducible installation and loading path can
216
+ be followed with a pinned artifact after initial acquisition, without requiring
217
+ Node.js or Docker merely to execute the already-provided Shell library.
218
+
219
+ ### P1.5 Improve examples and user-facing documentation
220
+
221
+ **Status: Planned, incremental.**
222
+
223
+ - Update the README Quick Start and API navigation to match current supported
224
+ Bash/zsh behavior and distinguish online shortcuts from pinned local usage.
225
+ - Add complete realistic examples that orchestrate Git, SSH, Docker or system
226
+ commands with safe argument boundaries, outputs, failures and cleanup.
227
+ - Keep generated references derived from source comments; do not hand-edit
228
+ `docs/references.md`, `bin/` or man pages outside their generation workflow.
229
+ - Track reproducible feedback and real usage rather than treating Stars,
230
+ downloads or function count as proxies for correctness or adoption.
231
+
232
+ **Acceptance:** Examples execute in declared environments; links and generated
233
+ artifacts correspond to the implementation; user feedback informs prioritization.
234
+
235
+ ## P2 — Problem-driven helper candidates (not commitments)
236
+
237
+ Investigate a candidate **only when** there is a concrete and recurring
238
+ command-composition cost and a contract can be made clear. Priority within this
239
+ table is intentionally not assigned in advance.
240
+
241
+ | Candidate | Problem worth investigating | Main risk / contract question |
242
+ | --- | --- | --- |
243
+ | Bounded `retry` | Transient failures of appropriate external commands | Retry safety/idempotence, wait policy, exit status, stdout/stderr and cancellation. |
244
+ | Portable `timeout` | Commands or children that hang | Process groups, signal propagation, cleanup and GNU/BSD differences. |
245
+ | Cleanup registration | Consistent temporary-file/process cleanup | Trap ownership, nested/early exits and caller-state changes. |
246
+ | Dependency checks | Missing external programs or incompatible tool variants | Clear diagnostics and optional/versioned requirements. |
247
+ | Portable path resolution | GNU/BSD differences in paths and symlinks | Physical/logical paths, missing targets and special characters. |
248
+ | Secure temporary-file helpers | Cross-platform safe file/directory creation | Races, permissions, lifetime and cleanup contract. |
249
+ | Argument/output adapters | Prevent splitting, globbing and unsafe record decoding | Preserve boundaries, empty values and newlines; no fake lossless text format. |
250
+ | Structured logging | Consistent diagnostic output for automation | stdout/stderr ownership, optional external dependencies and formatting. |
251
+ | Safer process APIs | Replace ambiguous process-name matching where appropriate | PID identity, permissions, dry-run and accidental termination. |
252
+
253
+ No candidate name above should be treated as an existing Bash-base API. A
254
+ small example, clearer documentation or an established external utility may be
255
+ preferable to implementing a wrapper.
256
+
257
+ ## Backward compatibility and release strategy
258
+
259
+ The default is to **preserve the v2.x public Bash behavior and documented zsh
260
+ support**. Prefer new explicit contracts and additive, narrowly scoped APIs
261
+ over silent changes to old names or outputs. For any breaking change, document
262
+ consumer impact, alternatives, migration steps and why a major release is
263
+ necessary. A hypothetical v3 is not a scheduled deliverable.
264
+
265
+ Do not expand the project into a full object system, general JSON/YAML engine,
266
+ all-POSIX-Shell portability layer or a Python-equivalent standard library
267
+ without separately demonstrated command-oriented need. High-level abstraction
268
+ should hide incidental complexity, **not meaningful errors or side effects**.
269
+
270
+ ## How an item becomes work — and how work is accepted
271
+
272
+ 1. **Describe the pain.** Provide a real script or task, the repetitive research
273
+ and verification burden, and the commands/data boundaries involved.
274
+ 2. **Compare alternatives.** Check built-ins, existing helpers, external tools,
275
+ example-only solutions and their deployment costs.
276
+ 3. **Define the contract.** Decide inputs, outputs, return states, side effects,
277
+ portability limits, versioning and a realistic composition example.
278
+ 4. **Validate the change.** Add behavior and failure tests in relevant Shells,
279
+ check caller state and preserve the existing required CI and 100% line-union
280
+ gate. Coverage is evidence, not proof of total correctness.
281
+ 5. **Review net maintenance value.** Accept only when expected time/risk savings
282
+ justify implementation, learning and long-term support cost.
283
+
284
+ Create a focused [GitHub issue](https://github.com/renault-digital/bash-base/issues)
285
+ for an approved investigation or proposed task, linking the appropriate
286
+ acceptance evidence. Use [pull requests](https://github.com/renault-digital/bash-base/pulls)
287
+ to track actual implementation and verification; don't mark an item completed
288
+ because a document or proposal has been written. Re-review this roadmap after
289
+ material changes rather than treating priorities or estimates as permanent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@renault-digital/bash-base",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Reusable Bash/zsh utilities for reliable command composition and automation.",
5
5
  "private": false,
6
6
  "publishConfig": {