opencode-swarm 7.25.1 → 7.25.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.
- package/README.md +34 -6
- package/dist/cli/index.js +266 -54
- package/dist/evidence/manager.d.ts +8 -0
- package/dist/index.js +534 -247
- package/dist/services/config-doctor.d.ts +33 -0
- package/dist/test-impact/analyzer.d.ts +2 -0
- package/dist/test-impact/history-store.d.ts +7 -0
- package/dist/tools/pre-check-batch.d.ts +1 -1
- package/dist/tools/resolve-working-directory.d.ts +8 -1
- package/dist/tools/update-task-status.d.ts +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -684,14 +684,28 @@ File rotates automatically at 10MB to `.swarm/telemetry.jsonl.1`.
|
|
|
684
684
|
</details>
|
|
685
685
|
|
|
686
686
|
<details>
|
|
687
|
-
<summary><strong>
|
|
687
|
+
<summary><strong>Working Directory Requirement: No process.cwd() Fallback</strong></summary>
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
All Swarm tools that accept a `working_directory` parameter **require an explicit path**. They do **not** fall back to `process.cwd()`. This prevents `.swarm` state from being created in project subdirectories when the host process's working directory differs from the actual project root (issue [#922](https://github.com/zaxbysauce/opencode-swarm/issues/922)).
|
|
690
690
|
|
|
691
|
-
###
|
|
691
|
+
### Defense-in-Depth
|
|
692
692
|
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
This safety guarantee is implemented in two layers:
|
|
694
|
+
|
|
695
|
+
1. **Fast-path filter** (`resolveWorkingDirectory` in `src/tools/resolve-working-directory.ts`) — validates all incoming `working_directory` values for null-byte injection, path traversal, Windows device paths, and subdirectory containment before any file system access
|
|
696
|
+
2. **Canonical write-time guard** (`validateProjectRoot` in `src/evidence/manager.ts`) — uses `realpathSync` to canonicalize paths at evidence-write time, catching any symlink-based subdirectory bypasses that slip past the fast-path filter
|
|
697
|
+
|
|
698
|
+
### Tools That Require Explicit working_directory
|
|
699
|
+
|
|
700
|
+
The following tools require an explicit `working_directory` and reject subdirectory paths:
|
|
701
|
+
|
|
702
|
+
- `save_plan`
|
|
703
|
+
- `update_task_status`
|
|
704
|
+
- `declare_scope`
|
|
705
|
+
- `pre_check_batch`
|
|
706
|
+
- `test_impact`
|
|
707
|
+
- `mutation_test`
|
|
708
|
+
- `diff_summary`
|
|
695
709
|
|
|
696
710
|
### Failure Conditions
|
|
697
711
|
|
|
@@ -700,20 +714,34 @@ The `save_plan` tool requires an explicit target workspace path. It does **not**
|
|
|
700
714
|
| Missing (`undefined` / `null`) | Fails with: "Target workspace is required" |
|
|
701
715
|
| Empty or whitespace-only | Fails with: "Target workspace cannot be empty or whitespace" |
|
|
702
716
|
| Path traversal (`..`) | Fails with: "Target workspace cannot contain path traversal" |
|
|
717
|
+
| Subdirectory of project root | Fails with: "...is a subdirectory of fallback..." |
|
|
718
|
+
| Windows device path | Fails with: "Windows device paths are not allowed" |
|
|
703
719
|
|
|
704
720
|
### Usage Contract
|
|
705
721
|
|
|
706
|
-
When using
|
|
722
|
+
When using any affected tool, always pass a valid `working_directory`:
|
|
707
723
|
|
|
708
724
|
```typescript
|
|
725
|
+
// save_plan example
|
|
709
726
|
save_plan({
|
|
710
727
|
title: "My Project",
|
|
711
728
|
swarm_id: "mega",
|
|
712
729
|
phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Initialize project" }] }],
|
|
730
|
+
working_directory: "/path/to/project" // Required - no process.cwd() fallback
|
|
731
|
+
})
|
|
732
|
+
|
|
733
|
+
// update_task_status example
|
|
734
|
+
update_task_status({
|
|
735
|
+
task_id: "1.1",
|
|
736
|
+
status: "completed",
|
|
713
737
|
working_directory: "/path/to/project" // Required - no fallback
|
|
714
738
|
})
|
|
715
739
|
```
|
|
716
740
|
|
|
741
|
+
### Stray .swarm Detection
|
|
742
|
+
|
|
743
|
+
`/swarm doctor` now detects and reports stray `.swarm` directories found in project subdirectories (created by older versions or misconfigured tools). It offers cleanup guidance to prevent state pollution.
|
|
744
|
+
|
|
717
745
|
</details>
|
|
718
746
|
|
|
719
747
|
<details>
|