@chllming/wave-orchestration 0.9.0 → 0.9.2

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 (68) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +133 -20
  4. package/docs/README.md +12 -4
  5. package/docs/agents/wave-security-role.md +1 -0
  6. package/docs/architecture/README.md +1498 -0
  7. package/docs/concepts/operating-modes.md +2 -2
  8. package/docs/guides/author-and-run-waves.md +14 -4
  9. package/docs/guides/planner.md +2 -2
  10. package/docs/guides/{recommendations-0.9.0.md → recommendations-0.9.2.md} +8 -7
  11. package/docs/guides/sandboxed-environments.md +158 -0
  12. package/docs/guides/terminal-surfaces.md +14 -12
  13. package/docs/plans/current-state.md +11 -3
  14. package/docs/plans/end-state-architecture.md +3 -1
  15. package/docs/plans/examples/wave-example-design-handoff.md +1 -1
  16. package/docs/plans/examples/wave-example-live-proof.md +1 -1
  17. package/docs/plans/migration.md +70 -19
  18. package/docs/plans/sandbox-end-state-architecture.md +153 -0
  19. package/docs/reference/cli-reference.md +71 -7
  20. package/docs/reference/coordination-and-closure.md +18 -1
  21. package/docs/reference/corridor.md +225 -0
  22. package/docs/reference/github-packages-setup.md +1 -1
  23. package/docs/reference/migration-0.2-to-0.5.md +9 -7
  24. package/docs/reference/npmjs-token-publishing.md +53 -0
  25. package/docs/reference/npmjs-trusted-publishing.md +4 -50
  26. package/docs/reference/package-publishing-flow.md +272 -0
  27. package/docs/reference/runtime-config/README.md +61 -3
  28. package/docs/reference/sample-waves.md +5 -5
  29. package/docs/reference/skills.md +1 -1
  30. package/docs/reference/wave-control.md +358 -27
  31. package/docs/roadmap.md +39 -204
  32. package/package.json +1 -1
  33. package/releases/manifest.json +38 -0
  34. package/scripts/wave-cli-bootstrap.mjs +52 -1
  35. package/scripts/wave-orchestrator/agent-process-runner.mjs +344 -0
  36. package/scripts/wave-orchestrator/agent-state.mjs +0 -1
  37. package/scripts/wave-orchestrator/artifact-schemas.mjs +7 -0
  38. package/scripts/wave-orchestrator/autonomous.mjs +47 -14
  39. package/scripts/wave-orchestrator/closure-engine.mjs +138 -17
  40. package/scripts/wave-orchestrator/config.mjs +199 -3
  41. package/scripts/wave-orchestrator/context7.mjs +231 -29
  42. package/scripts/wave-orchestrator/control-cli.mjs +42 -5
  43. package/scripts/wave-orchestrator/coordination.mjs +14 -0
  44. package/scripts/wave-orchestrator/corridor.mjs +363 -0
  45. package/scripts/wave-orchestrator/dashboard-renderer.mjs +115 -43
  46. package/scripts/wave-orchestrator/derived-state-engine.mjs +44 -4
  47. package/scripts/wave-orchestrator/gate-engine.mjs +126 -38
  48. package/scripts/wave-orchestrator/install.mjs +46 -0
  49. package/scripts/wave-orchestrator/launcher-progress.mjs +91 -0
  50. package/scripts/wave-orchestrator/launcher-runtime.mjs +290 -75
  51. package/scripts/wave-orchestrator/launcher.mjs +201 -53
  52. package/scripts/wave-orchestrator/ledger.mjs +7 -2
  53. package/scripts/wave-orchestrator/planner.mjs +1 -0
  54. package/scripts/wave-orchestrator/projection-writer.mjs +36 -1
  55. package/scripts/wave-orchestrator/provider-runtime.mjs +104 -0
  56. package/scripts/wave-orchestrator/reducer-snapshot.mjs +6 -0
  57. package/scripts/wave-orchestrator/retry-control.mjs +3 -3
  58. package/scripts/wave-orchestrator/retry-engine.mjs +93 -6
  59. package/scripts/wave-orchestrator/role-helpers.mjs +30 -0
  60. package/scripts/wave-orchestrator/session-supervisor.mjs +94 -85
  61. package/scripts/wave-orchestrator/shared.mjs +1 -0
  62. package/scripts/wave-orchestrator/supervisor-cli.mjs +1306 -0
  63. package/scripts/wave-orchestrator/terminals.mjs +12 -32
  64. package/scripts/wave-orchestrator/tmux-adapter.mjs +300 -0
  65. package/scripts/wave-orchestrator/traces.mjs +25 -0
  66. package/scripts/wave-orchestrator/wave-control-client.mjs +14 -1
  67. package/scripts/wave-orchestrator/wave-files.mjs +38 -5
  68. package/scripts/wave.mjs +13 -0
package/docs/roadmap.md CHANGED
@@ -1,226 +1,61 @@
1
1
  # Wave Orchestrator Roadmap
2
2
 
3
- Wave Orchestrator should keep wave markdown as the authored plan surface, but it needs a higher planning-fidelity bar and a better authoring loop.
3
+ This roadmap is intentionally short and current. The older planner-foundation and ad-hoc-run phase list has been removed because that work no longer describes the actual shipping direction for this package.
4
4
 
5
- The same planning and execution substrate should also support ad-hoc operator requests without forcing every one-off task into the long-lived numbered roadmap sequence.
5
+ ## Current Release: 0.9.2
6
6
 
7
- The target is the level of specificity shown in [Wave 7](/home/coder/slowfast.ai/docs/plans/waves/wave-7.md): explicit sequencing, hard requirements, exact validation commands, earlier-wave inputs, concrete ownership, and clear closure rules. This roadmap focuses on how to get this repo there without replacing the current architecture.
7
+ `0.9.2` is the current packaged surface.
8
8
 
9
- ## Current Position
9
+ It includes:
10
10
 
11
- The repository already has the right runtime substrate:
11
+ - detached process-backed agent execution instead of tmux-heavy live execution
12
+ - lower steady-state memory pressure and less terminal churn during long runs
13
+ - better behavior in constrained sandboxes such as LEAPclaw, OpenClaw, Nemoshell, and Docker-based operator environments
14
+ - a safer `submit -> supervise -> status/wait -> attach` control path for long-running agentic orchestration
15
+ - tighter supervisor recovery, progress journaling, and closure/retry correctness
16
+ - the current protected Wave Control model: Stack-authenticated browser access, Wave-managed approval states and provider grants, PATs, service tokens, encrypted per-user credentials, and runtime env leasing
17
+ - owned Context7 and Corridor broker routes plus the Corridor-backed security context that can gate closure before integration
12
18
 
13
- - lane-scoped state under `.tmp/`
14
- - wave parsing and validation
15
- - role-based execution with cont-qa, integration, and documentation stewards
16
- - executor profiles and lane runtime policy
17
- - compiled inboxes, ledgers, docs queues, dependency snapshots, and trace bundles
18
- - orchestrator-first clarification handling and human feedback workflows
19
+ ## Near-Term Direction On This Node Line
19
20
 
20
- The biggest remaining gap is not runtime execution. It is authored planning quality, the tooling around planning, and a lower-friction entry point for ad-hoc work that still preserves the same coordination and trace surfaces.
21
+ This standalone Node line should now be treated as maintenance-oriented:
21
22
 
22
- ## Planning Fidelity Target
23
+ - bug fixes
24
+ - compatibility updates
25
+ - operational hardening
26
+ - documentation updates
27
+ - release-surface alignment work
23
28
 
24
- Every serious wave should be able to answer these questions before launch:
29
+ ## Strategic Direction: LEAPclaw Execution Model
25
30
 
26
- - What earlier waves or artifacts are prerequisites?
27
- - What exact components are being promoted and why now?
28
- - What is the required runtime mix and fallback policy?
29
- - Which deploy environment or infra substrate is in scope?
30
- - Is the run `oversight` or `dark-factory`?
31
- - What exact validation commands must pass?
32
- - What exact artifact closes the role?
31
+ With the authenticated Wave Control surface now present, the main execution roadmap moves away from expanding this Node runtime and toward the LEAPclaw execution model.
33
32
 
34
- Generated waves and transient ad-hoc runs should default to these sections when relevant:
33
+ The target shape is:
35
34
 
36
- - sequencing note
37
- - reference rule or source-of-truth note
38
- - project bootstrap context
39
- - deploy environments
40
- - component promotions
41
- - Context7 defaults
42
- - per-agent required context
43
- - earlier-wave outputs to read
44
- - requirements
45
- - validation
46
- - output or closure contract
35
+ - LEAPclaw-native execution semantics for agent orchestration and management
36
+ - Go-based runtime ownership for the long-running execution layer
37
+ - Temporal-backed workflow and recovery coordination
38
+ - LEAPclaw nodes as the durable execution substrate for orchestrated agent work
39
+ - Wave Control acting as an authenticated control and observability surface rather than the long-term primary execution engine
47
40
 
48
- ## Phase 1: Planner Foundation
41
+ This direction matches the broader local platform work in the sibling `slowfast.ai` repository, where the support-service and runtime direction already points toward LEAPclaw support services, Go runtime ownership, and Temporal-backed orchestration.
49
42
 
50
- Status: shipped in `0.5.4`.
43
+ ## Future Standalone Runtime Direction
51
44
 
52
- - Add saved project bootstrap memory in `.wave/project-profile.json` for the implicit default project, with project-scoped profiles under `.wave/projects/<projectId>/project-profile.json` for explicit monorepo projects.
53
- - Ask once whether the repo is a new project and keep that answer for future drafts.
54
- - Add `wave project setup` and `wave project show`.
55
- - Add interactive `wave draft` that writes:
56
- - `docs/plans/waves/specs/wave-<n>.json`
57
- - `docs/plans/waves/wave-<n>.md`
58
- - Treat the JSON draft spec as the canonical authoring artifact and render markdown from it.
59
- - Keep generated waves fully compatible with the current parser and launcher.
60
- - Add `wave launch --terminal-surface vscode|tmux|none`.
61
- - Support a tmux-only operator mode that never touches `.vscode/terminals.json`.
45
+ For future standalone Wave Orchestrator versions, the preferred implementation direction is the Rust runtime at:
62
46
 
63
- Why first:
47
+ - `https://github.com/chllming/agent-wave-orchestrator`
64
48
 
65
- - Better planning is the highest-leverage missing piece.
66
- - The repo already has strong runtime and closure machinery.
67
- - Project memory removes repeated setup questions and gives future planner steps a durable baseline.
49
+ That line is expected to carry:
68
50
 
69
- ## Phase 2: Ad-Hoc Task Runs
51
+ - its own runtime implementation
52
+ - its own terminal-native/TUI operator surface
53
+ - the longer-term standalone execution model once the Node package settles into maintenance mode
70
54
 
71
- The orchestrator should support operator-driven one-off requests without requiring the user to author or commit a numbered roadmap wave first.
55
+ ## Practical Guidance
72
56
 
73
- CLI target:
57
+ For this repository, the practical sequence is:
74
58
 
75
- - `wave adhoc plan --task "..."`
76
- - `wave adhoc run --task "..." [--task "..."]`
77
- - `wave adhoc list`
78
- - `wave adhoc show --run <id>`
79
- - `wave adhoc promote --run <id> --wave <n>`
80
-
81
- Behavior:
82
-
83
- - accept one or more free-form task requests
84
- - normalize them into a single transient plan or spec
85
- - synthesize the worker roles needed for the request while still preserving cont-qa, integration, and documentation closure when relevant
86
- - run that transient plan through the existing launcher, coordination, inbox, ledger, docs queue, integration, and trace machinery
87
- - keep ad-hoc runs logged, inspectable, and replayable with the same basic operator surfaces as roadmap waves
88
- - route shared-plan documentation deltas into the canonical shared docs queue, plus an ad-hoc closure report for the run
89
- - treat only repo-local paths as ownership hints and ignore external references such as URLs
90
-
91
- Storage model:
92
-
93
- - do not write ad-hoc runs into the canonical numbered wave sequence under `docs/plans/waves/`
94
- - store the original request, generated spec, rendered markdown, and final result under `.wave/adhoc/<projectId>/runs/<run-id>/` for explicit projects, while the implicit default project keeps the legacy layout
95
- - keep runtime state isolated under `.tmp/<lane>-wave-launcher/adhoc/<run-id>/`
96
- - extend trace metadata with `runKind: adhoc` and `runId`
97
-
98
- Design constraints:
99
-
100
- - reuse the planner and launcher instead of building a second runtime
101
- - treat ad-hoc as a transient single-run execution unit, not a fake roadmap wave
102
- - do not let ad-hoc completion mutate normal `completedWaves` lane state
103
- - give `wave coord`, `wave feedback`, and future replay or reporting flows a way to target `--run <id>`
104
- - promote numbered roadmap artifacts from the stored ad-hoc spec instead of recomputing them from the current project profile
105
-
106
- Why this matters:
107
-
108
- - many real operator requests are one-off bugfix, investigation, doc, infra, or release tasks
109
- - the framework's coordination, closure, and traceability should apply to ad-hoc work too
110
- - isolated ad-hoc runs preserve auditability without polluting the long-lived roadmap
111
-
112
- ## Phase 3: Forward Replanning
113
-
114
- Add `wave update --from-wave <n>`.
115
-
116
- Rules:
117
-
118
- - closed waves are immutable
119
- - the current open wave and later waves may be regenerated
120
- - replanning must record what changed and why
121
- - new repo state, new user intent, and refreshed research may all trigger a replan
122
-
123
- Outputs:
124
-
125
- - updated draft JSON specs
126
- - regenerated markdown waves
127
- - a short replan summary for operator review
128
-
129
- Why this matters:
130
-
131
- - multi-wave plans drift as code lands
132
- - research and infra assumptions change
133
- - forward-only replanning preserves auditability without pretending older waves never existed
134
-
135
- ## Phase 4: Infra and Deploy-Aware Planning
136
-
137
- Infra and deploy roles need typed environment context, not free-form prompt notes only.
138
-
139
- Project profile should support typed deploy providers with a `custom` escape hatch:
140
-
141
- - `railway-mcp`
142
- - `railway-cli`
143
- - `docker-compose`
144
- - `kubernetes`
145
- - `ssh-manual`
146
- - `custom`
147
-
148
- Planner-generated infra or deploy roles should know:
149
-
150
- - which environment they own
151
- - which substrate is authoritative
152
- - what credentials or executors are expected
153
- - what validation commands prove readiness
154
- - what rollback or recovery guidance applies
155
-
156
- This is especially important for `dark-factory` mode. Fully autonomous infra work should require stronger environment modeling than human-overseen work.
157
-
158
- ## Phase 5: Oversight and Dark-Factory Modes
159
-
160
- Execution posture must be explicit plan data.
161
-
162
- Default:
163
-
164
- - `oversight`
165
-
166
- Opt-in:
167
-
168
- - `dark-factory`
169
-
170
- `oversight` means:
171
-
172
- - human checkpoints remain normal for live mutation, deploy, release, or risky infra work
173
- - the planner should generate explicit review gates
174
-
175
- `dark-factory` means:
176
-
177
- - the wave is intended to run end-to-end without routine human approvals
178
- - deploy environment, validation, rollback, and closure signals must be stricter
179
- - missing environment context is a planning error, not a runtime surprise
180
-
181
- ## Phase 6: Coordination and Integration Upgrades
182
-
183
- The runtime already has strong coordination primitives, but the roadmap should still push these areas:
184
-
185
- - keep the canonical authority set explicit and the markdown board as a rendered view
186
- - keep compiled per-agent inboxes and shared summaries central to prompt construction
187
- - strengthen the integration steward output as the single closure-ready synthesis artifact
188
- - add `wave lint` for ownership, component promotion, runtime mix, deploy environment, and closure completeness
189
- - expand replay scenarios for replanning, autonomy modes, and infra-heavy waves
190
-
191
- ## Additional Features Worth Scheduling
192
-
193
- - template packs for common wave shapes: implementation, QA, infra, release, migration
194
- - doc-delta extraction plus changelog or release-note queues when waves change public behavior
195
- - executor and credential preflight checks before launch
196
- - project-profile-aware defaults for lane, template, terminal surface, and oversight mode
197
- - richer branch and PR guidance in draft specs when the wave is release or deploy oriented
198
- - benchmark scenarios that compare oversight vs dark-factory outcomes
199
-
200
- ## Research Notes
201
-
202
- The direction above is consistent with the local source set and the current external references:
203
-
204
- - OpenAI, “Harness engineering: leveraging Codex in an agent-first world”
205
- - repository-local plans and environment design matter more than prompt-only control
206
- - Anthropic, “Effective harnesses for long-running agents”
207
- - first-run initialization and durable progress artifacts are critical
208
- - DOVA
209
- - deliberation-first orchestration and transparent intermediate state support better refinement loops
210
- - Silo-Bench
211
- - communication alone is not enough; integration quality is the real bottleneck
212
- - Evaluating AGENTS.md
213
- - repository-level context files help, but they should complement executable and versioned planning artifacts rather than replace them
214
-
215
- ## Immediate Recommendation
216
-
217
- The next shipping sequence should be:
218
-
219
- 1. planner foundation
220
- 2. ad-hoc task runs on the same substrate
221
- 3. forward replanning
222
- 4. typed infra and deploy planning
223
- 5. explicit oversight vs dark-factory workflows
224
- 6. stronger linting, replay, and benchmark coverage
225
-
226
- That sequence keeps the current harness intact while making planning, execution posture, and infra ownership much more explicit and durable.
59
+ 1. Ship `0.9.2` with the sandbox/runtime hardening and aligned docs.
60
+ 2. Maintain this Node package for bug fixes, compatibility, operational hardening, and release-surface sync rather than a broad new feature wave.
61
+ 3. Move long-term execution investment to the LEAPclaw + Go + Temporal architecture and the Rust standalone runtime.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chllming/wave-orchestration",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "license": "MIT",
5
5
  "description": "Generic wave-based multi-agent orchestration for repository work.",
6
6
  "repository": {
@@ -2,6 +2,44 @@
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@chllming/wave-orchestration",
4
4
  "releases": [
5
+ {
6
+ "version": "0.9.2",
7
+ "date": "2026-03-29",
8
+ "summary": "0.9.2 release cut for the documented Corridor and Wave Control surface, plus aligned publish artifacts.",
9
+ "features": [
10
+ "The packaged version now advances to `0.9.2` so the documented Corridor, Wave Control auth, and security surfaces can be tagged and published without colliding with the existing `0.9.1` npm release and git tag.",
11
+ "Release docs, migration guidance, runtime-config docs, coordination docs, Wave Control docs, package publishing docs, tracked install-state fixtures, and the release manifest now all point at the same `0.9.2` surface.",
12
+ "The shipped versioned operating guide is now `docs/guides/recommendations-0.9.2.md`, and starter install seeding plus install regression coverage now use that exact path.",
13
+ "Planner migration guidance and the `planner-agentic` bundle placeholder remain part of the shipped current-surface docs so adopted repos still have one aligned upgrade target."
14
+ ],
15
+ "manualSteps": [
16
+ "Run `pnpm exec wave doctor` and `pnpm exec wave launch --lane main --dry-run --no-dashboard` after upgrading so the repo validates against the `0.9.2` release surface.",
17
+ "Push the `v0.9.2` tag after the release commit so the GitHub publish workflow can publish the matching npm package version.",
18
+ "If your repo copied starter docs or runbooks, sync `README.md`, `docs/README.md`, `docs/plans/current-state.md`, `docs/plans/migration.md`, `docs/reference/coordination-and-closure.md`, `docs/reference/runtime-config/README.md`, `docs/reference/corridor.md`, `docs/reference/wave-control.md`, and `docs/guides/recommendations-0.9.2.md` so local guidance matches the packaged release."
19
+ ],
20
+ "breaking": false
21
+ },
22
+ {
23
+ "version": "0.9.1",
24
+ "date": "2026-03-29",
25
+ "summary": "Detached process-backed agent execution, authenticated Wave Control, Corridor-backed security context, and 0.9.1 release-surface alignment.",
26
+ "features": [
27
+ "Live agent execution now uses detached process runners by default instead of per-agent tmux execution sessions, which reduces tmux churn and lowers memory use during wide orchestration bursts while keeping tmux as an optional dashboard projection layer.",
28
+ "The sandbox-facing path is now `wave submit`, `wave supervise`, `wave status`, `wave wait`, and `wave attach`, with exact-context lookup, read-side launcher-status reconciliation, progress journaling, degraded-run handling, and log-follow attach behavior suited to LEAPclaw, OpenClaw, Nemoshell, and similar short-lived exec environments.",
29
+ "Supervisor recovery now relies on run-owned terminal artifacts and finalized progress instead of lane-global completion history, preserving the correct remaining wave range and final active wave during multi-wave reruns and launcher-loss recovery.",
30
+ "Ordinary runs, closure runs, and resident orchestrator runs now all preserve process-runtime metadata for timeout and cleanup, while process-backed resident orchestrators terminate cleanly and rate-limit retry detection stays scoped to the current attempt output.",
31
+ "Owned `wave-control` deployments now expose the shipped auth surface: Stack-backed browser access, Wave-managed approval states and provider grants, PATs, dedicated service tokens, encrypted per-user credential storage, runtime env leasing, and the separate `services/wave-control-web` frontend.",
32
+ "Corridor is now documented as a first-class security input with `direct`, `broker`, and `hybrid` runtime modes, normalized per-wave security artifacts, owned-path matching rules, and closure gating that can fail before integration on fetch failures or matched blocking findings.",
33
+ "Planner migration guidance and the `planner-agentic` bundle placeholder remain part of the shipped current-surface docs so adopted repos still have one aligned upgrade target.",
34
+ "A dedicated setup guide now ships for sandboxed and containerized operation, and README, migration docs, terminal-surface docs, runtime-config docs, coordination docs, Wave Control docs, the new Corridor reference, and the renamed recommendations guide `docs/guides/recommendations-0.9.1.md` now describe the same current release surface."
35
+ ],
36
+ "manualSteps": [
37
+ "Run `pnpm exec wave doctor` and `pnpm exec wave launch --lane main --dry-run --no-dashboard` after upgrading so the repo validates against the `0.9.1` release surface.",
38
+ "If your repo runs Wave inside LEAPclaw, OpenClaw, Nemoshell, Docker, or another short-lived exec sandbox, move long-running orchestration to `wave supervise`, use `wave submit/status/wait/attach` from disposable clients, and set Codex sandbox defaults in `wave.config.json` instead of relying on per-command overrides.",
39
+ "If your repo copied starter docs or runbooks, sync `README.md`, `docs/README.md`, `docs/plans/current-state.md`, `docs/plans/migration.md`, `docs/reference/coordination-and-closure.md`, `docs/reference/runtime-config/README.md`, `docs/reference/corridor.md`, `docs/reference/wave-control.md`, `docs/guides/sandboxed-environments.md`, `docs/guides/terminal-surfaces.md`, and `docs/guides/recommendations-0.9.1.md` so local guidance matches the packaged release."
40
+ ],
41
+ "breaking": false
42
+ },
5
43
  {
6
44
  "version": "0.9.0",
7
45
  "date": "2026-03-28",
@@ -1,4 +1,13 @@
1
1
  import path from "node:path";
2
+ import fs from "node:fs";
3
+
4
+ const ALLOWLISTED_ENV_FILE_KEYS = new Set([
5
+ "CONTEXT7_API_KEY",
6
+ "CORRIDOR_API_TOKEN",
7
+ "CORRIDOR_API_KEY",
8
+ "WAVE_API_TOKEN",
9
+ "WAVE_CONTROL_AUTH_TOKEN",
10
+ ]);
2
11
 
3
12
  function stripRepoRootArg(argv) {
4
13
  const normalizedArgs = [];
@@ -22,6 +31,48 @@ function stripRepoRootArg(argv) {
22
31
  return normalizedArgs;
23
32
  }
24
33
 
34
+ function parseEnvLine(line) {
35
+ const trimmed = String(line || "").trim();
36
+ if (!trimmed || trimmed.startsWith("#")) {
37
+ return null;
38
+ }
39
+ const exportPrefix = trimmed.startsWith("export ") ? trimmed.slice("export ".length).trim() : trimmed;
40
+ const equalsIndex = exportPrefix.indexOf("=");
41
+ if (equalsIndex <= 0) {
42
+ return null;
43
+ }
44
+ const key = exportPrefix.slice(0, equalsIndex).trim();
45
+ let value = exportPrefix.slice(equalsIndex + 1).trim();
46
+ if (!ALLOWLISTED_ENV_FILE_KEYS.has(key)) {
47
+ return null;
48
+ }
49
+ if (
50
+ (value.startsWith("\"") && value.endsWith("\"")) ||
51
+ (value.startsWith("'") && value.endsWith("'"))
52
+ ) {
53
+ value = value.slice(1, -1);
54
+ }
55
+ return { key, value };
56
+ }
57
+
58
+ function loadRepoLocalEnv() {
59
+ const repoRoot = path.resolve(process.env.WAVE_REPO_ROOT || process.cwd());
60
+ const envPath = path.join(repoRoot, ".env.local");
61
+ if (!fs.existsSync(envPath)) {
62
+ return;
63
+ }
64
+ const lines = fs.readFileSync(envPath, "utf8").split(/\r?\n/);
65
+ for (const line of lines) {
66
+ const entry = parseEnvLine(line);
67
+ if (!entry || process.env[entry.key]) {
68
+ continue;
69
+ }
70
+ process.env[entry.key] = entry.value;
71
+ }
72
+ }
73
+
25
74
  export function bootstrapWaveArgs(argv) {
26
- return stripRepoRootArg(Array.isArray(argv) ? argv : []);
75
+ const normalizedArgs = stripRepoRootArg(Array.isArray(argv) ? argv : []);
76
+ loadRepoLocalEnv();
77
+ return normalizedArgs;
27
78
  }