@theholocron/cli 5.0.0-alpha.465 → 5.0.0-alpha.466
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.mjs +71 -29
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-BcdB9khh.mjs → config-system-BzncySAC.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +18 -18
package/dist/cli.mjs
CHANGED
|
@@ -2050,7 +2050,7 @@ function isUnsyncedLayer(layer) {
|
|
|
2050
2050
|
* @param layer - The unsynced layer.
|
|
2051
2051
|
*/
|
|
2052
2052
|
function unsyncedLayerMessage(what, layer) {
|
|
2053
|
-
return `${what} names the \`${layer}\` layer: \`local\` and \`dev\` are read by this machine and are never synced. Only ${ENVIRONMENT_LAYERS.filter((l) => !isUnsyncedLayer(l)).map((l) => `\`${l}\``).join(" and ")} can be synced`;
|
|
2053
|
+
return `${what} names the \`${layer}\` layer: \`local\` and \`dev\` are read by this machine and are never synced. Only ${ENVIRONMENT_LAYERS.filter((l) => !isUnsyncedLayer(l)).map((l) => `\`${String(l)}\``).join(" and ")} can be synced`;
|
|
2054
2054
|
}
|
|
2055
2055
|
/**
|
|
2056
2056
|
* Refuse a sync of an unsynced layer, before anything is read. The argument is a layer word, or the literal name of a
|
|
@@ -4247,7 +4247,7 @@ async function verifyVercelDeploymentProject(url, expectedProjectId, token, opts
|
|
|
4247
4247
|
if (opts.teamId) params.set("teamId", opts.teamId);
|
|
4248
4248
|
let response;
|
|
4249
4249
|
try {
|
|
4250
|
-
response = await doFetch(`${baseUrl}/v13/deployments/get?${params}`, { headers: { Authorization: `Bearer ${token}` } });
|
|
4250
|
+
response = await doFetch(`${baseUrl}/v13/deployments/get?${params.toString()}`, { headers: { Authorization: `Bearer ${token}` } });
|
|
4251
4251
|
} catch {
|
|
4252
4252
|
return false;
|
|
4253
4253
|
}
|
|
@@ -8416,7 +8416,7 @@ async function withElevation(run, deps) {
|
|
|
8416
8416
|
}
|
|
8417
8417
|
if (failure !== void 0) {
|
|
8418
8418
|
if (leftover) print(` ${style.fail(leftover)}`);
|
|
8419
|
-
throw failure;
|
|
8419
|
+
throw failure instanceof Error ? failure : new Error(String(failure));
|
|
8420
8420
|
}
|
|
8421
8421
|
return {
|
|
8422
8422
|
...result,
|
|
@@ -14829,7 +14829,7 @@ function withTimeout(promise, ms) {
|
|
|
14829
14829
|
resolve(value);
|
|
14830
14830
|
}, (err) => {
|
|
14831
14831
|
clearTimeout(timer);
|
|
14832
|
-
reject(err);
|
|
14832
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
14833
14833
|
});
|
|
14834
14834
|
});
|
|
14835
14835
|
}
|
|
@@ -14886,7 +14886,7 @@ async function runSmokeCheck(key, provider, impl) {
|
|
|
14886
14886
|
}
|
|
14887
14887
|
case "auth": {
|
|
14888
14888
|
const who = await impl.whoami();
|
|
14889
|
-
const details = who.details ? ` (${Object.entries(who.details).map(([k, v]) => `${k}=${v}`).join(", ")})` : "";
|
|
14889
|
+
const details = who.details ? ` (${Object.entries(who.details).map(([k, v]) => `${k}=${String(v)}`).join(", ")})` : "";
|
|
14890
14890
|
return mk(key, provider, "ok", `whoami: ${who.provider}${details}`);
|
|
14891
14891
|
}
|
|
14892
14892
|
case "errors": {
|
|
@@ -15755,8 +15755,9 @@ function withDcgHook(settings) {
|
|
|
15755
15755
|
if (!isObject$1(settings)) throw new Error("the settings file is not a JSON object");
|
|
15756
15756
|
const hooks = settings.hooks ?? {};
|
|
15757
15757
|
if (!isObject$1(hooks)) throw new Error("`hooks` in the settings file is not an object");
|
|
15758
|
-
const
|
|
15759
|
-
if (!Array.isArray(
|
|
15758
|
+
const listed = hooks.PreToolUse ?? [];
|
|
15759
|
+
if (!Array.isArray(listed)) throw new Error("`hooks.PreToolUse` in the settings file is not a list");
|
|
15760
|
+
const preToolUse = listed;
|
|
15760
15761
|
if (preToolUse.some((entry) => isObject$1(entry) && entry.matcher === "Bash" && Array.isArray(entry.hooks) && entry.hooks.some(runsDcg))) return settings;
|
|
15761
15762
|
return {
|
|
15762
15763
|
...settings,
|
|
@@ -16718,6 +16719,35 @@ function deriveRepoStack(rootPackageJson, workspacePackageJsons) {
|
|
|
16718
16719
|
const found = new Set([rootPackageJson, ...workspacePackageJsons].flatMap((pkg) => deriveStack(pkg)));
|
|
16719
16720
|
return KNOWN_STACK_DEPS.filter((name) => found.has(name));
|
|
16720
16721
|
}
|
|
16722
|
+
// src/commands/setup/describe-provider-error/describe-provider-error.ts
|
|
16723
|
+
/** The text of a JSON body's `message` or `error` field, or of an `error` object's own `message`. */
|
|
16724
|
+
function jsonMessage(body) {
|
|
16725
|
+
if (typeof body !== "object" || body === null) return void 0;
|
|
16726
|
+
const { message, error } = body;
|
|
16727
|
+
if (typeof message === "string" && message) return message;
|
|
16728
|
+
if (typeof error === "string" && error) return error;
|
|
16729
|
+
return jsonMessage(error);
|
|
16730
|
+
}
|
|
16731
|
+
/** What the provider said in a response body: the JSON `message` or `error` field, else the text as it came. */
|
|
16732
|
+
function providerMessage(details) {
|
|
16733
|
+
if (details === void 0 || details === null || details === "") return void 0;
|
|
16734
|
+
const text = typeof details === "string" ? details : JSON.stringify(details);
|
|
16735
|
+
try {
|
|
16736
|
+
return jsonMessage(JSON.parse(text)) ?? text;
|
|
16737
|
+
} catch {
|
|
16738
|
+
return text;
|
|
16739
|
+
}
|
|
16740
|
+
}
|
|
16741
|
+
/**
|
|
16742
|
+
* {@link describeError} for a setup row, with the provider's own message in place of its whole response body: a JSON
|
|
16743
|
+
* `message` or `error` field when the body has one, else the first part of the text. One line, control characters
|
|
16744
|
+
* gone and cut to a fixed length, as `describeError` does.
|
|
16745
|
+
*/
|
|
16746
|
+
function describeProviderError(err) {
|
|
16747
|
+
const said = providerMessage(err instanceof Error ? err.details : void 0);
|
|
16748
|
+
if (said === void 0 || !(err instanceof Error)) return describeError(err);
|
|
16749
|
+
return describeError(Object.assign(new Error(err.message), { details: said }));
|
|
16750
|
+
}
|
|
16721
16751
|
// src/commands/setup/engineering.ts
|
|
16722
16752
|
async function writeIfAbsent(filePath, content) {
|
|
16723
16753
|
try {
|
|
@@ -16758,23 +16788,23 @@ function errorsEnvKeys(described, stack) {
|
|
|
16758
16788
|
}
|
|
16759
16789
|
// src/commands/setup/run-step/run-step.ts
|
|
16760
16790
|
async function runStep(capability, step, dryRun, body, opts = {}) {
|
|
16761
|
-
const result = await execStep(capability, step, dryRun, body, opts);
|
|
16762
|
-
const { status,
|
|
16791
|
+
const { result, logged } = await execStep(capability, step, dryRun, body, opts);
|
|
16792
|
+
const { status, reason } = result;
|
|
16763
16793
|
getLogger()[status === "fail" ? "warn" : "info"]({
|
|
16764
16794
|
capability,
|
|
16765
16795
|
step,
|
|
16766
16796
|
status,
|
|
16767
|
-
...
|
|
16797
|
+
...logged ? { detail: logged } : {},
|
|
16768
16798
|
...reason ? { reason } : {}
|
|
16769
16799
|
}, `${capability}.${step}`);
|
|
16770
16800
|
return result;
|
|
16771
16801
|
}
|
|
16772
16802
|
async function execStep(capability, step, dryRun, body, opts = {}) {
|
|
16773
|
-
if (dryRun) return {
|
|
16803
|
+
if (dryRun) return { result: {
|
|
16774
16804
|
capability,
|
|
16775
16805
|
step,
|
|
16776
16806
|
status: "dry-run"
|
|
16777
|
-
};
|
|
16807
|
+
} };
|
|
16778
16808
|
try {
|
|
16779
16809
|
const note = await withProgress(`${capability}: ${step}…`, body);
|
|
16780
16810
|
const result = {
|
|
@@ -16783,31 +16813,43 @@ async function execStep(capability, step, dryRun, body, opts = {}) {
|
|
|
16783
16813
|
status: "ok"
|
|
16784
16814
|
};
|
|
16785
16815
|
if (typeof note === "string") result.message = note;
|
|
16786
|
-
return
|
|
16816
|
+
return {
|
|
16817
|
+
result,
|
|
16818
|
+
logged: result.message
|
|
16819
|
+
};
|
|
16787
16820
|
} catch (err) {
|
|
16788
16821
|
if (err instanceof ProviderApiError) {
|
|
16789
16822
|
if (err.status !== void 0 && opts.skipCodes?.includes(err.status)) return {
|
|
16790
|
-
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16823
|
+
result: {
|
|
16824
|
+
capability,
|
|
16825
|
+
step,
|
|
16826
|
+
status: "skip",
|
|
16827
|
+
message: describeProviderError(err)
|
|
16828
|
+
},
|
|
16829
|
+
logged: err.message
|
|
16794
16830
|
};
|
|
16795
16831
|
if (err.status === 403) {
|
|
16796
16832
|
const reason = classify403(err);
|
|
16797
16833
|
return {
|
|
16798
|
-
|
|
16799
|
-
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16834
|
+
result: {
|
|
16835
|
+
capability,
|
|
16836
|
+
step,
|
|
16837
|
+
status: reason === "plan" ? "skip" : "fail",
|
|
16838
|
+
message: describeProviderError(err),
|
|
16839
|
+
reason
|
|
16840
|
+
},
|
|
16841
|
+
logged: err.message
|
|
16803
16842
|
};
|
|
16804
16843
|
}
|
|
16805
16844
|
}
|
|
16806
16845
|
return {
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16846
|
+
result: {
|
|
16847
|
+
capability,
|
|
16848
|
+
step,
|
|
16849
|
+
status: "fail",
|
|
16850
|
+
message: describeProviderError(err)
|
|
16851
|
+
},
|
|
16852
|
+
logged: errorMessage(err)
|
|
16811
16853
|
};
|
|
16812
16854
|
}
|
|
16813
16855
|
}
|
|
@@ -16830,7 +16872,7 @@ function formatStep(step) {
|
|
|
16830
16872
|
async function fetchExternalSkill(entry) {
|
|
16831
16873
|
if (entry.sourceType !== "github")
|
|
16832
16874
|
/* c8 ignore next */
|
|
16833
|
-
throw new Error(`unsupported sourceType: ${entry.sourceType}`);
|
|
16875
|
+
throw new Error(`unsupported sourceType: ${String(entry.sourceType)}`);
|
|
16834
16876
|
const url = `https://raw.githubusercontent.com/${entry.source}/HEAD/${entry.skillPath}`;
|
|
16835
16877
|
const res = await fetch(url);
|
|
16836
16878
|
if (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);
|
|
@@ -17089,7 +17131,7 @@ async function statusPagesStep(monitoring, loader, dryRun) {
|
|
|
17089
17131
|
capability: "monitoring",
|
|
17090
17132
|
step: `dns ${r.name}`,
|
|
17091
17133
|
status: "fail",
|
|
17092
|
-
message:
|
|
17134
|
+
message: describeProviderError(err)
|
|
17093
17135
|
});
|
|
17094
17136
|
}
|
|
17095
17137
|
}
|
|
@@ -17540,7 +17582,7 @@ async function runSetup(input) {
|
|
|
17540
17582
|
capability: "vault",
|
|
17541
17583
|
step: "list",
|
|
17542
17584
|
status: "fail",
|
|
17543
|
-
message:
|
|
17585
|
+
message: describeProviderError(err)
|
|
17544
17586
|
});
|
|
17545
17587
|
}
|
|
17546
17588
|
print(formatStep(steps[steps.length - 1]));
|