opencode-swarm 7.29.3 → 7.29.4

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/dist/cli/index.js CHANGED
@@ -34,7 +34,7 @@ var package_default;
34
34
  var init_package = __esm(() => {
35
35
  package_default = {
36
36
  name: "opencode-swarm",
37
- version: "7.29.3",
37
+ version: "7.29.4",
38
38
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
39
39
  main: "dist/index.js",
40
40
  types: "dist/index.d.ts",
@@ -19857,15 +19857,36 @@ function validateProjectRoot(directory) {
19857
19857
  throw new Error(`Cannot verify project root for "${directory}" \u2014 directory may not exist or is inaccessible`);
19858
19858
  }
19859
19859
  let current = resolved;
19860
+ let depth = 0;
19860
19861
  while (true) {
19862
+ if (depth >= MAX_DEPTH)
19863
+ break;
19864
+ depth++;
19861
19865
  const parent = path7.dirname(current);
19862
19866
  if (parent === current)
19863
19867
  break;
19864
19868
  const parentSwarm = path7.join(parent, ".swarm");
19865
19869
  try {
19866
19870
  if (statSync4(parentSwarm).isDirectory()) {
19867
- warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
19868
- throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
19871
+ let hasProjectIndicator = false;
19872
+ for (const indicator of PROJECT_INDICATORS) {
19873
+ try {
19874
+ const indicatorStat = statSync4(path7.join(parent, indicator));
19875
+ if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
19876
+ hasProjectIndicator = true;
19877
+ break;
19878
+ }
19879
+ } catch (error49) {
19880
+ if (error49 instanceof Error && "code" in error49 && error49.code === "ENOENT") {} else {
19881
+ hasProjectIndicator = true;
19882
+ break;
19883
+ }
19884
+ }
19885
+ }
19886
+ if (hasProjectIndicator) {
19887
+ warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
19888
+ throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
19889
+ }
19869
19890
  }
19870
19891
  } catch (error49) {
19871
19892
  if (error49 instanceof Error && error49.message.startsWith("Cannot write evidence")) {
@@ -20108,7 +20129,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles) {
20108
20129
  }
20109
20130
  return archived;
20110
20131
  }
20111
- var VALID_EVIDENCE_TYPES, sanitizeTaskId2, LEGACY_TASK_COMPLEXITY_MAP, _internals5;
20132
+ var VALID_EVIDENCE_TYPES, sanitizeTaskId2, MAX_DEPTH = 20, PROJECT_INDICATORS, LEGACY_TASK_COMPLEXITY_MAP, _internals5;
20112
20133
  var init_manager2 = __esm(() => {
20113
20134
  init_zod();
20114
20135
  init_evidence_schema();
@@ -20133,6 +20154,19 @@ var init_manager2 = __esm(() => {
20133
20154
  "secretscan"
20134
20155
  ];
20135
20156
  sanitizeTaskId2 = sanitizeTaskId;
20157
+ PROJECT_INDICATORS = [
20158
+ "package.json",
20159
+ ".git",
20160
+ ".opencode",
20161
+ "Cargo.toml",
20162
+ "go.mod",
20163
+ "pyproject.toml",
20164
+ "Gemfile",
20165
+ "composer.json",
20166
+ "pom.xml",
20167
+ "build.gradle",
20168
+ "CMakeLists.txt"
20169
+ ];
20136
20170
  LEGACY_TASK_COMPLEXITY_MAP = {
20137
20171
  low: "simple",
20138
20172
  medium: "moderate",
@@ -40693,10 +40727,10 @@ function detectStraySwarmDirs(projectRoot) {
40693
40727
  "__pycache__",
40694
40728
  ".tox"
40695
40729
  ]);
40696
- const MAX_DEPTH = 10;
40730
+ const MAX_DEPTH2 = 10;
40697
40731
  const MAX_CONTENTS_ENTRIES = 20;
40698
40732
  function walk(dir, depth) {
40699
- if (depth > MAX_DEPTH)
40733
+ if (depth > MAX_DEPTH2)
40700
40734
  return;
40701
40735
  let entries;
40702
40736
  try {
@@ -38,11 +38,17 @@ export declare function isQualityBudgetEvidence(evidence: Evidence): evidence is
38
38
  export declare function isSecretscanEvidence(evidence: Evidence): evidence is SecretscanEvidence;
39
39
  import { sanitizeTaskId as _sanitizeTaskId } from '../validation/task-id';
40
40
  export declare const sanitizeTaskId: typeof _sanitizeTaskId;
41
+ /** Maximum depth to walk up the directory tree before stopping (fail-open). */
42
+ export declare const MAX_DEPTH = 20;
43
+ /** File/directory names that indicate a real project root. */
44
+ export declare const PROJECT_INDICATORS: readonly ["package.json", ".git", ".opencode", "Cargo.toml", "go.mod", "pyproject.toml", "Gemfile", "composer.json", "pom.xml", "build.gradle", "CMakeLists.txt"];
41
45
  /**
42
46
  * Defense-in-depth: verify that `directory` is the project root and not a subdirectory
43
47
  * of a project that already has a .swarm/ at its root.
44
- * Walks up the directory tree to filesystem root looking for a parent .swarm/ directory.
45
- * @throws Error if a parent directory contains .swarm/
48
+ * Walks up the directory tree (bounded by MAX_DEPTH) looking for a parent .swarm/ directory.
49
+ * When .swarm/ is found, checks for at least one PROJECT_INDICATORS entry to distinguish
50
+ * real projects from stray artifacts (e.g. `C:\.swarm`).
51
+ * @throws Error if a parent directory contains both .swarm/ and a project indicator
46
52
  */
47
53
  export declare function validateProjectRoot(directory: string): void;
48
54
  /**
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ var package_default;
48
48
  var init_package = __esm(() => {
49
49
  package_default = {
50
50
  name: "opencode-swarm",
51
- version: "7.29.3",
51
+ version: "7.29.4",
52
52
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
53
53
  main: "dist/index.js",
54
54
  types: "dist/index.d.ts",
@@ -20692,15 +20692,36 @@ function validateProjectRoot(directory) {
20692
20692
  throw new Error(`Cannot verify project root for "${directory}" — directory may not exist or is inaccessible`);
20693
20693
  }
20694
20694
  let current = resolved;
20695
+ let depth = 0;
20695
20696
  while (true) {
20697
+ if (depth >= MAX_DEPTH)
20698
+ break;
20699
+ depth++;
20696
20700
  const parent = path8.dirname(current);
20697
20701
  if (parent === current)
20698
20702
  break;
20699
20703
  const parentSwarm = path8.join(parent, ".swarm");
20700
20704
  try {
20701
20705
  if (statSync5(parentSwarm).isDirectory()) {
20702
- warn(`[evidence] Rejecting write to subdirectory "${resolved}" — parent "${parent}" already contains .swarm/`);
20703
- throw new Error(`Cannot write evidence in "${resolved}" — parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
20706
+ let hasProjectIndicator = false;
20707
+ for (const indicator of PROJECT_INDICATORS) {
20708
+ try {
20709
+ const indicatorStat = statSync5(path8.join(parent, indicator));
20710
+ if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
20711
+ hasProjectIndicator = true;
20712
+ break;
20713
+ }
20714
+ } catch (error49) {
20715
+ if (error49 instanceof Error && "code" in error49 && error49.code === "ENOENT") {} else {
20716
+ hasProjectIndicator = true;
20717
+ break;
20718
+ }
20719
+ }
20720
+ }
20721
+ if (hasProjectIndicator) {
20722
+ warn(`[evidence] Rejecting write to subdirectory "${resolved}" — parent "${parent}" already contains .swarm/`);
20723
+ throw new Error(`Cannot write evidence in "${resolved}" — parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
20724
+ }
20704
20725
  }
20705
20726
  } catch (error49) {
20706
20727
  if (error49 instanceof Error && error49.message.startsWith("Cannot write evidence")) {
@@ -20943,7 +20964,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles) {
20943
20964
  }
20944
20965
  return archived;
20945
20966
  }
20946
- var VALID_EVIDENCE_TYPES, sanitizeTaskId2, LEGACY_TASK_COMPLEXITY_MAP, _internals8;
20967
+ var VALID_EVIDENCE_TYPES, sanitizeTaskId2, MAX_DEPTH = 20, PROJECT_INDICATORS, LEGACY_TASK_COMPLEXITY_MAP, _internals8;
20947
20968
  var init_manager2 = __esm(() => {
20948
20969
  init_zod();
20949
20970
  init_evidence_schema();
@@ -20968,6 +20989,19 @@ var init_manager2 = __esm(() => {
20968
20989
  "secretscan"
20969
20990
  ];
20970
20991
  sanitizeTaskId2 = sanitizeTaskId;
20992
+ PROJECT_INDICATORS = [
20993
+ "package.json",
20994
+ ".git",
20995
+ ".opencode",
20996
+ "Cargo.toml",
20997
+ "go.mod",
20998
+ "pyproject.toml",
20999
+ "Gemfile",
21000
+ "composer.json",
21001
+ "pom.xml",
21002
+ "build.gradle",
21003
+ "CMakeLists.txt"
21004
+ ];
20971
21005
  LEGACY_TASK_COMPLEXITY_MAP = {
20972
21006
  low: "simple",
20973
21007
  medium: "moderate",
@@ -61619,10 +61653,10 @@ function detectStraySwarmDirs(projectRoot) {
61619
61653
  "__pycache__",
61620
61654
  ".tox"
61621
61655
  ]);
61622
- const MAX_DEPTH = 10;
61656
+ const MAX_DEPTH2 = 10;
61623
61657
  const MAX_CONTENTS_ENTRIES = 20;
61624
61658
  function walk(dir, depth) {
61625
- if (depth > MAX_DEPTH)
61659
+ if (depth > MAX_DEPTH2)
61626
61660
  return;
61627
61661
  let entries;
61628
61662
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.29.3",
3
+ "version": "7.29.4",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",