@h-rig/cli 0.0.6-alpha.2 → 0.0.6-alpha.20

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // packages/cli/src/launcher.ts
3
3
  import { existsSync } from "fs";
4
- import { resolve } from "path";
4
+ import { basename, resolve } from "path";
5
5
  import { loadDotEnvSecrets } from "@rig/runtime/baked-secrets";
6
6
  import { RIG_DEFINITION_DIRNAME, RIG_STATE_DIRNAME, resolveNearestRigProjectRoot } from "@rig/runtime/layout";
7
7
  function parsePolicyMode(value) {
@@ -14,7 +14,7 @@ function parsePolicyMode(value) {
14
14
  throw new Error(`Invalid --policy-mode value: ${value}. Use off|observe|enforce.`);
15
15
  }
16
16
  function hasRigProjectMarker(candidate) {
17
- return existsSync(resolve(candidate, RIG_DEFINITION_DIRNAME)) || existsSync(resolve(candidate, RIG_STATE_DIRNAME)) || existsSync(resolve(candidate, "rig.config.ts")) || existsSync(resolve(candidate, "rig.config.json"));
17
+ return existsSync(resolve(candidate, RIG_DEFINITION_DIRNAME)) || existsSync(resolve(candidate, RIG_STATE_DIRNAME)) || existsSync(resolve(candidate, "rig.config.ts")) || existsSync(resolve(candidate, "rig.config.json")) || existsSync(resolve(candidate, ".git"));
18
18
  }
19
19
  function resolveProjectRoot({
20
20
  envProjectRoot,
@@ -26,7 +26,9 @@ function resolveProjectRoot({
26
26
  return resolve(cwd, envProjectRoot);
27
27
  }
28
28
  const fallbackImportDir = importDir ?? cwd;
29
- const candidates = [cwd, resolve(execPath, "..", ".."), resolve(fallbackImportDir, "..")];
29
+ const execName = basename(execPath).toLowerCase();
30
+ const execCandidates = execName === "rig" || execName === "rig.exe" ? [resolve(execPath, "..", "..")] : [];
31
+ const candidates = [cwd, ...execCandidates, resolve(fallbackImportDir, "..")];
30
32
  for (const candidate of candidates) {
31
33
  const nearest = resolveNearestRigProjectRoot(candidate);
32
34
  if (hasRigProjectMarker(nearest)) {
@@ -99,12 +99,13 @@ async function runCommand(context, parts) {
99
99
  const envMode = process.env.RIG_BASH_MODE;
100
100
  const effectiveMode = context.policyMode || (envMode === "off" || envMode === "observe" || envMode === "enforce" ? envMode : loadPolicy(context.projectRoot).mode);
101
101
  const controlledPath = `${resolve(context.projectRoot, ".rig", "bin")}:${context.projectRoot}/rig/tools:${process.env.PATH ?? ""}`;
102
- const controlledBash = await ensureAgentShellBinary(context.projectRoot);
102
+ const usesInfrastructureBinary = parts[0] === "rig-server";
103
+ const controlledBash = usesInfrastructureBinary ? null : await ensureAgentShellBinary(context.projectRoot);
103
104
  const commandEnv = [
104
105
  "env",
105
106
  `PATH=${controlledPath}`,
106
107
  `PROJECT_RIG_ROOT=${context.projectRoot}`,
107
- `BASH=${controlledBash}`,
108
+ ...controlledBash ? [`BASH=${controlledBash}`] : [],
108
109
  `RIG_BASH_MODE=${effectiveMode}`,
109
110
  `RIG_POLICY_FILE=${resolve(context.projectRoot, "rig/policy/policy.json")}`,
110
111
  ...context.eventBus.getEventsFile() ? [`RIG_EVENTS_FILE=${context.eventBus.getEventsFile()}`] : []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.2",
3
+ "version": "0.0.6-alpha.20",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -23,9 +23,10 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.2",
27
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.2",
28
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.2",
26
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.20",
27
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.20",
28
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.20",
29
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.20",
29
30
  "picocolors": "^1.1.1"
30
31
  }
31
32
  }