@mifune/agro 0.15.0 → 0.15.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/dist/agro.js +86 -62
- package/package.json +1 -1
package/dist/agro.js
CHANGED
|
@@ -7,8 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { dirname as dirname10, join as
|
|
11
|
-
import { existsSync as
|
|
10
|
+
import { dirname as dirname10, join as join18, resolve as resolve11 } from "node:path";
|
|
11
|
+
import { existsSync as existsSync22, mkdtempSync as mkdtempSync5, readFileSync as readFileSync12, rmSync as rmSync6 } from "node:fs";
|
|
12
12
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
13
13
|
|
|
14
14
|
// src/commands/update.ts
|
|
@@ -2222,7 +2222,7 @@ function resolveExecutionTarget(opts) {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
|
|
2224
2224
|
// src/lib/version.ts
|
|
2225
|
-
var AGRO_VERSION = true ? "0.15.
|
|
2225
|
+
var AGRO_VERSION = true ? "0.15.1" : "0.0.0-dev";
|
|
2226
2226
|
var OFFICIAL_IMAGE = "ghcr.io/mifunedev/agro";
|
|
2227
2227
|
var RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-z][a-z0-9]*\.[0-9]+)?$/;
|
|
2228
2228
|
function parseReleaseVersion(value) {
|
|
@@ -3732,9 +3732,9 @@ async function runLangfuseSetup(opts, io) {
|
|
|
3732
3732
|
}
|
|
3733
3733
|
|
|
3734
3734
|
// src/commands/sandbox.ts
|
|
3735
|
-
import { existsSync as
|
|
3735
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync3, rmSync as rmSync3, statSync as statSync4 } from "node:fs";
|
|
3736
3736
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
3737
|
-
import { join as
|
|
3737
|
+
import { join as join12, resolve as resolve7 } from "node:path";
|
|
3738
3738
|
|
|
3739
3739
|
// src/lib/runtimes/catalog.ts
|
|
3740
3740
|
var RUNTIME_CATALOG = Object.freeze([
|
|
@@ -3763,6 +3763,27 @@ function runtimeIds() {
|
|
|
3763
3763
|
return RUNTIME_CATALOG.map((r) => r.id);
|
|
3764
3764
|
}
|
|
3765
3765
|
|
|
3766
|
+
// src/lib/star-prompt.ts
|
|
3767
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync7, writeFileSync as writeFileSync8 } from "node:fs";
|
|
3768
|
+
import { join as join11 } from "node:path";
|
|
3769
|
+
var STAR_PROMPT_LINE = "\u2B50 If AGRO helps, star https://github.com/mifunedev/agro";
|
|
3770
|
+
var MARKER = "star-prompt-shown";
|
|
3771
|
+
function maybePrintStarPrompt(io, env = process.env, isTTY = process.stdout.isTTY === true, stateHome = resolveUserStateHome(env)) {
|
|
3772
|
+
if (env.AGRO_NO_STAR_PROMPT === "1") return;
|
|
3773
|
+
if (env.CI !== void 0 && env.CI !== "") return;
|
|
3774
|
+
if (!isTTY) return;
|
|
3775
|
+
const marker = join11(stateHome, MARKER);
|
|
3776
|
+
if (existsSync15(marker)) return;
|
|
3777
|
+
io.stdout(`${STAR_PROMPT_LINE}
|
|
3778
|
+
`);
|
|
3779
|
+
try {
|
|
3780
|
+
mkdirSync7(stateHome, { recursive: true });
|
|
3781
|
+
writeFileSync8(marker, "");
|
|
3782
|
+
} catch {
|
|
3783
|
+
return;
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3766
3787
|
// src/commands/sandbox.ts
|
|
3767
3788
|
function hostTimezone() {
|
|
3768
3789
|
const tz = process.env.TZ;
|
|
@@ -3779,27 +3800,27 @@ function gitIdentity(run, key) {
|
|
|
3779
3800
|
return (result.stdout ?? "").trim();
|
|
3780
3801
|
}
|
|
3781
3802
|
function isBuildCapable(repo) {
|
|
3782
|
-
return repo !== void 0 &&
|
|
3803
|
+
return repo !== void 0 && existsSync16(join12(repo, ".devcontainer", "Dockerfile"));
|
|
3783
3804
|
}
|
|
3784
3805
|
function prepareHomeMount(value) {
|
|
3785
3806
|
const path4 = resolve7(value);
|
|
3786
|
-
if (
|
|
3807
|
+
if (existsSync16(path4)) {
|
|
3787
3808
|
if (!statSync4(path4).isDirectory()) {
|
|
3788
3809
|
throw new Error(`--home-mount path exists and is not a directory: ${path4}`);
|
|
3789
3810
|
}
|
|
3790
3811
|
return path4;
|
|
3791
3812
|
}
|
|
3792
|
-
|
|
3813
|
+
mkdirSync8(path4, { recursive: true });
|
|
3793
3814
|
return path4;
|
|
3794
3815
|
}
|
|
3795
3816
|
function readSeedConfig(repo) {
|
|
3796
3817
|
if (repo === void 0) return void 0;
|
|
3797
3818
|
const file = agroConfigPath(repo);
|
|
3798
|
-
return
|
|
3819
|
+
return existsSync16(file) ? readAgroConfig(file) : void 0;
|
|
3799
3820
|
}
|
|
3800
3821
|
function readEntryConfig(name) {
|
|
3801
3822
|
const file = agroConfigPath(entryRoot(name));
|
|
3802
|
-
return
|
|
3823
|
+
return existsSync16(file) ? readAgroConfig(file) : void 0;
|
|
3803
3824
|
}
|
|
3804
3825
|
function assignSetting(target, path4, value) {
|
|
3805
3826
|
const segments = path4.split(".");
|
|
@@ -3896,7 +3917,7 @@ async function runSandboxInstall(opts, io) {
|
|
|
3896
3917
|
return 1;
|
|
3897
3918
|
}
|
|
3898
3919
|
const checkout = opts.checkout === void 0 ? void 0 : resolve7(opts.checkout);
|
|
3899
|
-
if (checkout !== void 0 && !
|
|
3920
|
+
if (checkout !== void 0 && !existsSync16(checkout)) {
|
|
3900
3921
|
io.stderr(`${opts.bin} sandbox install: --checkout directory does not exist: ${checkout}
|
|
3901
3922
|
`);
|
|
3902
3923
|
return 1;
|
|
@@ -3915,7 +3936,7 @@ async function runSandboxInstall(opts, io) {
|
|
|
3915
3936
|
if (buildRequested && !isBuildCapable(configCheckout(config))) {
|
|
3916
3937
|
const target = configCheckout(config) ?? resolve7(opts.checkout ?? ".");
|
|
3917
3938
|
io.stderr(
|
|
3918
|
-
`${opts.bin} sandbox install: image.mode is "build" but ${
|
|
3939
|
+
`${opts.bin} sandbox install: image.mode is "build" but ${join12(target, ".devcontainer", "Dockerfile")} does not exist \u2014 point --checkout <dir> at a harness checkout that has .devcontainer/Dockerfile, or set image.mode to "image" to run the prebuilt image
|
|
3919
3940
|
`
|
|
3920
3941
|
);
|
|
3921
3942
|
return 1;
|
|
@@ -3959,7 +3980,7 @@ async function runSandboxInstall(opts, io) {
|
|
|
3959
3980
|
...useNoBuild ? { noBuild: true } : {}
|
|
3960
3981
|
};
|
|
3961
3982
|
if (opts.printArgv === true) {
|
|
3962
|
-
const preview = mkdtempSync3(
|
|
3983
|
+
const preview = mkdtempSync3(join12(tmpdir3(), "oh-sandbox-preview-"));
|
|
3963
3984
|
try {
|
|
3964
3985
|
writeAgroConfig(preview, config);
|
|
3965
3986
|
materialize(preview, { ...configCheckout(config) !== void 0 ? { checkout: configCheckout(config) } : {} });
|
|
@@ -3969,12 +3990,15 @@ async function runSandboxInstall(opts, io) {
|
|
|
3969
3990
|
}
|
|
3970
3991
|
}
|
|
3971
3992
|
const root = entryRoot(config.name);
|
|
3972
|
-
|
|
3993
|
+
mkdirSync8(root, { recursive: true });
|
|
3973
3994
|
writeAgroConfig(root, config);
|
|
3974
3995
|
materialize(root, { ...configCheckout(config) !== void 0 ? { checkout: configCheckout(config) } : {} });
|
|
3975
3996
|
const code = await runSandbox({ ...sandboxOpts, cwd: root }, io);
|
|
3976
|
-
if (code === 0)
|
|
3997
|
+
if (code === 0) {
|
|
3998
|
+
io.stdout(`next: ${opts.bin} shell ${config.name}
|
|
3977
3999
|
`);
|
|
4000
|
+
maybePrintStarPrompt(io);
|
|
4001
|
+
}
|
|
3978
4002
|
return code;
|
|
3979
4003
|
}
|
|
3980
4004
|
async function entryStatus(root, name, run) {
|
|
@@ -4026,9 +4050,9 @@ async function runSandboxList(opts, io) {
|
|
|
4026
4050
|
}
|
|
4027
4051
|
|
|
4028
4052
|
// src/commands/harness.ts
|
|
4029
|
-
import { existsSync as
|
|
4053
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
4030
4054
|
import { homedir as homedir3 } from "node:os";
|
|
4031
|
-
import { delimiter as delimiter2, join as
|
|
4055
|
+
import { delimiter as delimiter2, join as join15 } from "node:path";
|
|
4032
4056
|
|
|
4033
4057
|
// src/lib/docs.ts
|
|
4034
4058
|
var SOURCE_DOCS_BASE = "https://github.com/mifunedev/agro/blob/main/";
|
|
@@ -4041,17 +4065,17 @@ function sourceDocsUrl(docsPath) {
|
|
|
4041
4065
|
}
|
|
4042
4066
|
|
|
4043
4067
|
// src/lib/host-config.ts
|
|
4044
|
-
import { existsSync as
|
|
4045
|
-
import { basename as basename5, dirname as dirname8, isAbsolute, join as
|
|
4068
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync9, readFileSync as readFileSync11, renameSync as renameSync4, unlinkSync as unlinkSync5, writeFileSync as writeFileSync9 } from "node:fs";
|
|
4069
|
+
import { basename as basename5, dirname as dirname8, isAbsolute, join as join13, resolve as resolve8 } from "node:path";
|
|
4046
4070
|
var HOST_CONFIG_MODE = 420;
|
|
4047
4071
|
var HOST_CONFIG_FILE = "config.json";
|
|
4048
4072
|
var WORKSPACES_SUBDIR = "workspaces";
|
|
4049
|
-
var DEFAULT_WORKSPACE_NAME = "
|
|
4073
|
+
var DEFAULT_WORKSPACE_NAME = "harness";
|
|
4050
4074
|
function hostStateHome(env, home) {
|
|
4051
4075
|
return resolveUserStateHome(env, home);
|
|
4052
4076
|
}
|
|
4053
4077
|
function hostConfigPath(env, home) {
|
|
4054
|
-
return
|
|
4078
|
+
return join13(hostStateHome(env, home), HOST_CONFIG_FILE);
|
|
4055
4079
|
}
|
|
4056
4080
|
function assertWorkspaceName(name) {
|
|
4057
4081
|
if (!SANDBOX_NAME_PATTERN.test(name)) {
|
|
@@ -4061,14 +4085,14 @@ function assertWorkspaceName(name) {
|
|
|
4061
4085
|
}
|
|
4062
4086
|
}
|
|
4063
4087
|
function workspacesRoot(env, home) {
|
|
4064
|
-
return
|
|
4088
|
+
return join13(hostStateHome(env, home), WORKSPACES_SUBDIR);
|
|
4065
4089
|
}
|
|
4066
4090
|
function workspaceRoot(name, env, home) {
|
|
4067
4091
|
assertWorkspaceName(name);
|
|
4068
|
-
return
|
|
4092
|
+
return join13(workspacesRoot(env, home), name);
|
|
4069
4093
|
}
|
|
4070
4094
|
function defaultHarnessRoot(env, home) {
|
|
4071
|
-
return
|
|
4095
|
+
return join13(workspacesRoot(env, home), DEFAULT_WORKSPACE_NAME);
|
|
4072
4096
|
}
|
|
4073
4097
|
function validateHostConfig(value) {
|
|
4074
4098
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -4126,7 +4150,7 @@ function validateReceipts(value, field, noun) {
|
|
|
4126
4150
|
}
|
|
4127
4151
|
function readHostConfig(env, home) {
|
|
4128
4152
|
const path4 = hostConfigPath(env, home);
|
|
4129
|
-
if (!
|
|
4153
|
+
if (!existsSync17(path4)) return { version: 1 };
|
|
4130
4154
|
let raw;
|
|
4131
4155
|
try {
|
|
4132
4156
|
raw = readFileSync11(path4, "utf8");
|
|
@@ -4148,9 +4172,9 @@ function writeHostConfig(config, env, home) {
|
|
|
4148
4172
|
const body = `${JSON.stringify(validated, null, 2)}
|
|
4149
4173
|
`;
|
|
4150
4174
|
const tmp = `${path4}.tmp.${process.pid}`;
|
|
4151
|
-
|
|
4175
|
+
mkdirSync9(dirname8(path4), { recursive: true });
|
|
4152
4176
|
try {
|
|
4153
|
-
|
|
4177
|
+
writeFileSync9(tmp, body, { mode: HOST_CONFIG_MODE, encoding: "utf8" });
|
|
4154
4178
|
renameSync4(tmp, path4);
|
|
4155
4179
|
} catch (error) {
|
|
4156
4180
|
try {
|
|
@@ -4177,8 +4201,8 @@ function fieldError2(path4, requirement) {
|
|
|
4177
4201
|
}
|
|
4178
4202
|
|
|
4179
4203
|
// src/lib/host-workspace.ts
|
|
4180
|
-
import { existsSync as
|
|
4181
|
-
import { dirname as dirname9, join as
|
|
4204
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, readdirSync as readdirSync3, renameSync as renameSync5, rmSync as rmSync4, statSync as statSync5 } from "node:fs";
|
|
4205
|
+
import { dirname as dirname9, join as join14, resolve as resolve9 } from "node:path";
|
|
4182
4206
|
var AGRO_REPO_URL = "https://github.com/mifunedev/agro.git";
|
|
4183
4207
|
var IGNORABLE_ENTRIES = [
|
|
4184
4208
|
REGISTRY_SUBDIR,
|
|
@@ -4190,7 +4214,7 @@ function isDirectory3(path4) {
|
|
|
4190
4214
|
return statSync5(path4, { throwIfNoEntry: false })?.isDirectory() === true;
|
|
4191
4215
|
}
|
|
4192
4216
|
function stateHomes(home) {
|
|
4193
|
-
return STATE_HOME_DIRS.map((name) =>
|
|
4217
|
+
return STATE_HOME_DIRS.map((name) => join14(home, name));
|
|
4194
4218
|
}
|
|
4195
4219
|
function stateHomeRootRefusal(bin, root, home, verb = "harness") {
|
|
4196
4220
|
const target = resolve9(root);
|
|
@@ -4198,7 +4222,7 @@ function stateHomeRootRefusal(bin, root, home, verb = "harness") {
|
|
|
4198
4222
|
if (enclosing === void 0) return void 0;
|
|
4199
4223
|
return `${bin} ${verb}: the ${verb} root ${target} is the state home ${enclosing} itself.
|
|
4200
4224
|
A workspace there collides with AGRO state and blocks every command run from ${home}.
|
|
4201
|
-
Move it out \u2014 for example \`mv ${enclosing} ${
|
|
4225
|
+
Move it out \u2014 for example \`mv ${enclosing} ${join14(home, "agro")}\` \u2014 then re-run this command.
|
|
4202
4226
|
`;
|
|
4203
4227
|
}
|
|
4204
4228
|
function isIgnorableEntry(name) {
|
|
@@ -4215,16 +4239,16 @@ function cloneInto(target, run, root, ref) {
|
|
|
4215
4239
|
assertCloned(run("git", ["clone", ...branch, AGRO_REPO_URL, target], { stdio: "inherit" }), root);
|
|
4216
4240
|
}
|
|
4217
4241
|
function cloneThroughStaging(root, run, ref) {
|
|
4218
|
-
const staging = mkdtempSync4(
|
|
4242
|
+
const staging = mkdtempSync4(join14(dirname9(root), "agro-clone-"));
|
|
4219
4243
|
try {
|
|
4220
|
-
const checkout =
|
|
4244
|
+
const checkout = join14(staging, "agro");
|
|
4221
4245
|
cloneInto(checkout, run, root, ref);
|
|
4222
4246
|
for (const name of readdirSync3(checkout)) {
|
|
4223
|
-
const destination =
|
|
4224
|
-
if (
|
|
4247
|
+
const destination = join14(root, name);
|
|
4248
|
+
if (existsSync18(destination)) {
|
|
4225
4249
|
throw new Error(`could not move ${name} into ${root} \u2014 the path already exists`);
|
|
4226
4250
|
}
|
|
4227
|
-
renameSync5(
|
|
4251
|
+
renameSync5(join14(checkout, name), destination);
|
|
4228
4252
|
}
|
|
4229
4253
|
} finally {
|
|
4230
4254
|
rmSync4(staging, { recursive: true, force: true });
|
|
@@ -4232,10 +4256,10 @@ function cloneThroughStaging(root, run, ref) {
|
|
|
4232
4256
|
}
|
|
4233
4257
|
function ensureHostWorkspace(path4, run = spawnRunner, ref) {
|
|
4234
4258
|
const root = resolve9(path4);
|
|
4235
|
-
if (
|
|
4259
|
+
if (existsSync18(join14(root, ".git"))) return { root, action: "reused" };
|
|
4236
4260
|
const stats = statSync5(root, { throwIfNoEntry: false });
|
|
4237
4261
|
if (stats === void 0) {
|
|
4238
|
-
|
|
4262
|
+
mkdirSync10(dirname9(root), { recursive: true });
|
|
4239
4263
|
cloneInto(root, run, root, ref);
|
|
4240
4264
|
return { root, action: "cloned" };
|
|
4241
4265
|
}
|
|
@@ -4254,11 +4278,11 @@ function ensureHostWorkspace(path4, run = spawnRunner, ref) {
|
|
|
4254
4278
|
function listHostWorkspaces(env, home) {
|
|
4255
4279
|
const root = workspacesRoot(env, home);
|
|
4256
4280
|
if (!isDirectory3(root)) return [];
|
|
4257
|
-
return readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => SANDBOX_NAME_PATTERN.test(name)).filter((name) =>
|
|
4281
|
+
return readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => SANDBOX_NAME_PATTERN.test(name)).filter((name) => existsSync18(join14(root, name, ".git"))).sort();
|
|
4258
4282
|
}
|
|
4259
4283
|
function resolveExistingWorkspace(bin, verb, path4, env, home) {
|
|
4260
4284
|
const root = resolve9(path4);
|
|
4261
|
-
if (
|
|
4285
|
+
if (existsSync18(join14(root, ".git"))) return { ok: true, root };
|
|
4262
4286
|
const existing = listHostWorkspaces(env, home);
|
|
4263
4287
|
const inventory = existing.length === 0 ? "No host workspace exists yet.\n" : `Workspaces that exist: ${existing.join(", ")}
|
|
4264
4288
|
`;
|
|
@@ -4288,7 +4312,7 @@ function targetFor(root, run, env) {
|
|
|
4288
4312
|
});
|
|
4289
4313
|
}
|
|
4290
4314
|
function hostPrefix(home) {
|
|
4291
|
-
return
|
|
4315
|
+
return join15(home, ".local");
|
|
4292
4316
|
}
|
|
4293
4317
|
function pathEntries(env) {
|
|
4294
4318
|
return (env.PATH ?? "").split(delimiter2).filter((part) => part !== "");
|
|
@@ -4341,7 +4365,7 @@ function probeableHost(env, home) {
|
|
|
4341
4365
|
return void 0;
|
|
4342
4366
|
}
|
|
4343
4367
|
const prefix = hostPrefix(home);
|
|
4344
|
-
if (!
|
|
4368
|
+
if (!existsSync19(join15(root, ".git")) && !existsSync19(prefix)) return void 0;
|
|
4345
4369
|
return { root, prefix };
|
|
4346
4370
|
}
|
|
4347
4371
|
async function collectStates(root, run, home, env, only) {
|
|
@@ -4774,9 +4798,9 @@ async function runHarnessInstall(name, opts, io) {
|
|
|
4774
4798
|
}
|
|
4775
4799
|
|
|
4776
4800
|
// src/commands/workspace.ts
|
|
4777
|
-
import { existsSync as
|
|
4801
|
+
import { existsSync as existsSync20, rmSync as rmSync5 } from "node:fs";
|
|
4778
4802
|
import { homedir as homedir4 } from "node:os";
|
|
4779
|
-
import { join as
|
|
4803
|
+
import { join as join16, resolve as resolve10 } from "node:path";
|
|
4780
4804
|
function homeOf2(opts) {
|
|
4781
4805
|
return (opts.homedir ?? homedir4)();
|
|
4782
4806
|
}
|
|
@@ -4822,9 +4846,9 @@ async function runWorkspaceCreate(name, opts, io) {
|
|
|
4822
4846
|
return 1;
|
|
4823
4847
|
}
|
|
4824
4848
|
let action;
|
|
4825
|
-
const preexisting =
|
|
4849
|
+
const preexisting = existsSync20(root);
|
|
4826
4850
|
try {
|
|
4827
|
-
if (!opts.json && !
|
|
4851
|
+
if (!opts.json && !existsSync20(join16(root, ".git"))) {
|
|
4828
4852
|
const at = opts.ref !== void 0 ? ` at ${opts.ref}` : "";
|
|
4829
4853
|
io.stdout(`cloning ${AGRO_REPO_URL}${at} into ${root}\u2026
|
|
4830
4854
|
`);
|
|
@@ -4869,7 +4893,7 @@ async function runWorkspaceList(opts, io) {
|
|
|
4869
4893
|
const recorded = recordedRoot(env, home);
|
|
4870
4894
|
const registry = workspacesRoot(env, home);
|
|
4871
4895
|
rows = listHostWorkspaces(env, home).map((name) => {
|
|
4872
|
-
const root =
|
|
4896
|
+
const root = join16(registry, name);
|
|
4873
4897
|
return { name, root, default: recorded === root };
|
|
4874
4898
|
});
|
|
4875
4899
|
} catch (err) {
|
|
@@ -4894,9 +4918,9 @@ async function runWorkspaceList(opts, io) {
|
|
|
4894
4918
|
}
|
|
4895
4919
|
|
|
4896
4920
|
// src/commands/tool.ts
|
|
4897
|
-
import { existsSync as
|
|
4921
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
4898
4922
|
import { homedir as homedir5, userInfo as userInfo2 } from "node:os";
|
|
4899
|
-
import { delimiter as delimiter3, join as
|
|
4923
|
+
import { delimiter as delimiter3, join as join17 } from "node:path";
|
|
4900
4924
|
|
|
4901
4925
|
// src/lib/tools/catalog.ts
|
|
4902
4926
|
var TOOLS_DOC = "docs/installation.md";
|
|
@@ -5326,7 +5350,7 @@ function targetFor2(root, run, env) {
|
|
|
5326
5350
|
});
|
|
5327
5351
|
}
|
|
5328
5352
|
function hostPrefix2(home) {
|
|
5329
|
-
return
|
|
5353
|
+
return join17(home, ".local");
|
|
5330
5354
|
}
|
|
5331
5355
|
function pathEntries2(env) {
|
|
5332
5356
|
return (env.PATH ?? "").split(delimiter3).filter((part) => part !== "");
|
|
@@ -5406,7 +5430,7 @@ function probeableHost2(env, home) {
|
|
|
5406
5430
|
return void 0;
|
|
5407
5431
|
}
|
|
5408
5432
|
const prefix = hostPrefix2(home);
|
|
5409
|
-
if (!
|
|
5433
|
+
if (!existsSync21(join17(root, ".git")) && !existsSync21(prefix)) return void 0;
|
|
5410
5434
|
return { root, prefix };
|
|
5411
5435
|
}
|
|
5412
5436
|
async function collectRows(root, run, home, env, only) {
|
|
@@ -6171,8 +6195,8 @@ Usage:
|
|
|
6171
6195
|
|
|
6172
6196
|
\`install\` and \`uninstall\` act on the running sandbox. When no sandbox is
|
|
6173
6197
|
reachable they act on the host. A host install needs an existing AGRO workspace
|
|
6174
|
-
and creates none \u2014 run \`${bin} workspace create
|
|
6175
|
-
the workspace registry entry \`~/.agro/workspaces/
|
|
6198
|
+
and creates none \u2014 run \`${bin} workspace create\` first. The fallback root is
|
|
6199
|
+
the workspace registry entry \`~/.agro/workspaces/harness\`. \`--workspace <name>\`
|
|
6176
6200
|
chooses another entry and \`--path <dir>\` a directory outside the registry. A
|
|
6177
6201
|
successful install records the root as \`harnessRoot\` in \`~/.agro/config.json\`. The
|
|
6178
6202
|
install prefix is always \`~/.local\`.
|
|
@@ -6202,8 +6226,8 @@ Usage:
|
|
|
6202
6226
|
|
|
6203
6227
|
A host workspace is an AGRO checkout under \`~/.agro/workspaces/<name>\`. \`create\`
|
|
6204
6228
|
clones ${AGRO_REPO_URL} into that entry, and reuses an existing checkout. The
|
|
6205
|
-
|
|
6206
|
-
registry instead.
|
|
6229
|
+
implicit name is \`harness\`. Pass \`default\` to create that named workspace.
|
|
6230
|
+
\`--path <dir>\` creates the workspace outside the registry instead.
|
|
6207
6231
|
|
|
6208
6232
|
\`create\` records no default. A host install selects its root with
|
|
6209
6233
|
\`${bin} harness install <harness> --workspace <name>\`, and that install records the
|
|
@@ -6266,8 +6290,8 @@ only on these tools:
|
|
|
6266
6290
|
${hostCapableToolIds().map((t) => ` ${t}`).join("\n")}
|
|
6267
6291
|
|
|
6268
6292
|
A host install needs an existing AGRO workspace \u2014 \`--path <dir>\`, then
|
|
6269
|
-
\`harnessRoot\` in \`~/.agro/config.json\`, then \`~/.agro/workspaces/
|
|
6270
|
-
no workspace: run \`${bin} workspace create
|
|
6293
|
+
\`harnessRoot\` in \`~/.agro/config.json\`, then \`~/.agro/workspaces/harness\`. It creates
|
|
6294
|
+
no workspace: run \`${bin} workspace create\` first. It installs into
|
|
6271
6295
|
\`~/.local\` and records the install as \`hostTools\` in that same file. On the host,
|
|
6272
6296
|
\`uninstall\` removes only what \`install\` recorded, from the prefix in that record.
|
|
6273
6297
|
Without a record it refuses, and \`--force\` overrides.
|
|
@@ -6924,11 +6948,11 @@ function parseGatewayArgs(rest) {
|
|
|
6924
6948
|
}
|
|
6925
6949
|
return { ok: true, args: { help: false, passthrough: [...rest] } };
|
|
6926
6950
|
}
|
|
6927
|
-
function bundledPayloadExists(bundled, exists =
|
|
6928
|
-
return exists(
|
|
6951
|
+
function bundledPayloadExists(bundled, exists = existsSync22) {
|
|
6952
|
+
return exists(join18(bundled.sourceControlDir, "manifest.json"));
|
|
6929
6953
|
}
|
|
6930
6954
|
function resolveVendorSource(args, bundled, bin = AGRO_PRODUCT.bin) {
|
|
6931
|
-
const exists = bundled.exists ??
|
|
6955
|
+
const exists = bundled.exists ?? existsSync22;
|
|
6932
6956
|
if (args.fromDir !== void 0) {
|
|
6933
6957
|
return { kind: "local", fromDir: resolve11(args.fromDir) };
|
|
6934
6958
|
}
|
|
@@ -6948,7 +6972,7 @@ function resolveVendorSource(args, bundled, bin = AGRO_PRODUCT.bin) {
|
|
|
6948
6972
|
function readPayloadVersion(checkoutDir) {
|
|
6949
6973
|
try {
|
|
6950
6974
|
const parsed = JSON.parse(
|
|
6951
|
-
readFileSync12(
|
|
6975
|
+
readFileSync12(join18(resolveControlDir(checkoutDir), "cli", "package.json"), "utf8")
|
|
6952
6976
|
);
|
|
6953
6977
|
if (parsed && typeof parsed.version === "string") return parsed.version;
|
|
6954
6978
|
} catch {
|
|
@@ -6957,7 +6981,7 @@ function readPayloadVersion(checkoutDir) {
|
|
|
6957
6981
|
}
|
|
6958
6982
|
async function runWithRemoteSource(hooks, fn) {
|
|
6959
6983
|
const fetch2 = hooks.fetch ?? fetchRemoteSource;
|
|
6960
|
-
const mkdtemp = hooks.mkdtemp ?? (() => mkdtempSync5(
|
|
6984
|
+
const mkdtemp = hooks.mkdtemp ?? (() => mkdtempSync5(join18(tmpdir4(), "oh-remote-")));
|
|
6961
6985
|
const rm = hooks.rm ?? ((dir) => rmSync6(dir, { recursive: true, force: true }));
|
|
6962
6986
|
const out = hooks.stdout ?? ((s) => process.stdout.write(s));
|
|
6963
6987
|
const checkoutDir = mkdtemp();
|