@mp-lb/forum-cli 0.1.61 → 0.1.63
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/index.js +317 -347
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1879,12 +1879,12 @@ var KNOWN_JUNK_RULES = [
|
|
|
1879
1879
|
];
|
|
1880
1880
|
var detectJunk = (paths, rules = KNOWN_JUNK_RULES) => {
|
|
1881
1881
|
const grouped = /* @__PURE__ */ new Map();
|
|
1882
|
-
for (const
|
|
1883
|
-
const rule = rules.find((candidate) => candidate.matches(
|
|
1882
|
+
for (const path37 of paths) {
|
|
1883
|
+
const rule = rules.find((candidate) => candidate.matches(path37));
|
|
1884
1884
|
if (!rule) continue;
|
|
1885
1885
|
const existing = grouped.get(rule);
|
|
1886
|
-
if (existing) existing.push(
|
|
1887
|
-
else grouped.set(rule, [
|
|
1886
|
+
if (existing) existing.push(path37);
|
|
1887
|
+
else grouped.set(rule, [path37]);
|
|
1888
1888
|
}
|
|
1889
1889
|
return rules.filter((rule) => grouped.has(rule)).map((rule) => ({
|
|
1890
1890
|
rule,
|
|
@@ -2102,8 +2102,8 @@ var prepareCheckoutIgnore = async ({
|
|
|
2102
2102
|
|
|
2103
2103
|
// src/index.ts
|
|
2104
2104
|
import { realpathSync, watch as watch2 } from "fs";
|
|
2105
|
-
import
|
|
2106
|
-
import { lstat as
|
|
2105
|
+
import path36 from "path";
|
|
2106
|
+
import { lstat as lstat5, mkdir as mkdir8, readFile as readFile11, rm as rm9, writeFile as writeFile8 } from "fs/promises";
|
|
2107
2107
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
2108
2108
|
import { pathToFileURL } from "url";
|
|
2109
2109
|
|
|
@@ -2873,10 +2873,10 @@ function mergeDefs(...defs) {
|
|
|
2873
2873
|
function cloneDef(schema) {
|
|
2874
2874
|
return mergeDefs(schema._zod.def);
|
|
2875
2875
|
}
|
|
2876
|
-
function getElementAtPath(obj,
|
|
2877
|
-
if (!
|
|
2876
|
+
function getElementAtPath(obj, path37) {
|
|
2877
|
+
if (!path37)
|
|
2878
2878
|
return obj;
|
|
2879
|
-
return
|
|
2879
|
+
return path37.reduce((acc, key) => acc?.[key], obj);
|
|
2880
2880
|
}
|
|
2881
2881
|
function promiseAllObject(promisesObj) {
|
|
2882
2882
|
const keys = Object.keys(promisesObj);
|
|
@@ -3285,11 +3285,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
return false;
|
|
3287
3287
|
}
|
|
3288
|
-
function prefixIssues(
|
|
3288
|
+
function prefixIssues(path37, issues) {
|
|
3289
3289
|
return issues.map((iss) => {
|
|
3290
3290
|
var _a4;
|
|
3291
3291
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
3292
|
-
iss.path.unshift(
|
|
3292
|
+
iss.path.unshift(path37);
|
|
3293
3293
|
return iss;
|
|
3294
3294
|
});
|
|
3295
3295
|
}
|
|
@@ -3436,16 +3436,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3436
3436
|
}
|
|
3437
3437
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
3438
3438
|
const fieldErrors = { _errors: [] };
|
|
3439
|
-
const processError = (error52,
|
|
3439
|
+
const processError = (error52, path37 = []) => {
|
|
3440
3440
|
for (const issue2 of error52.issues) {
|
|
3441
3441
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3442
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3442
|
+
issue2.errors.map((issues) => processError({ issues }, [...path37, ...issue2.path]));
|
|
3443
3443
|
} else if (issue2.code === "invalid_key") {
|
|
3444
|
-
processError({ issues: issue2.issues }, [...
|
|
3444
|
+
processError({ issues: issue2.issues }, [...path37, ...issue2.path]);
|
|
3445
3445
|
} else if (issue2.code === "invalid_element") {
|
|
3446
|
-
processError({ issues: issue2.issues }, [...
|
|
3446
|
+
processError({ issues: issue2.issues }, [...path37, ...issue2.path]);
|
|
3447
3447
|
} else {
|
|
3448
|
-
const fullpath = [...
|
|
3448
|
+
const fullpath = [...path37, ...issue2.path];
|
|
3449
3449
|
if (fullpath.length === 0) {
|
|
3450
3450
|
fieldErrors._errors.push(mapper(issue2));
|
|
3451
3451
|
} else {
|
|
@@ -3472,17 +3472,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3472
3472
|
}
|
|
3473
3473
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
3474
3474
|
const result = { errors: [] };
|
|
3475
|
-
const processError = (error52,
|
|
3475
|
+
const processError = (error52, path37 = []) => {
|
|
3476
3476
|
var _a4, _b;
|
|
3477
3477
|
for (const issue2 of error52.issues) {
|
|
3478
3478
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3479
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3479
|
+
issue2.errors.map((issues) => processError({ issues }, [...path37, ...issue2.path]));
|
|
3480
3480
|
} else if (issue2.code === "invalid_key") {
|
|
3481
|
-
processError({ issues: issue2.issues }, [...
|
|
3481
|
+
processError({ issues: issue2.issues }, [...path37, ...issue2.path]);
|
|
3482
3482
|
} else if (issue2.code === "invalid_element") {
|
|
3483
|
-
processError({ issues: issue2.issues }, [...
|
|
3483
|
+
processError({ issues: issue2.issues }, [...path37, ...issue2.path]);
|
|
3484
3484
|
} else {
|
|
3485
|
-
const fullpath = [...
|
|
3485
|
+
const fullpath = [...path37, ...issue2.path];
|
|
3486
3486
|
if (fullpath.length === 0) {
|
|
3487
3487
|
result.errors.push(mapper(issue2));
|
|
3488
3488
|
continue;
|
|
@@ -3514,8 +3514,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
function toDotPath(_path) {
|
|
3516
3516
|
const segs = [];
|
|
3517
|
-
const
|
|
3518
|
-
for (const seg of
|
|
3517
|
+
const path37 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
3518
|
+
for (const seg of path37) {
|
|
3519
3519
|
if (typeof seg === "number")
|
|
3520
3520
|
segs.push(`[${seg}]`);
|
|
3521
3521
|
else if (typeof seg === "symbol")
|
|
@@ -16207,13 +16207,13 @@ function resolveRef(ref, ctx) {
|
|
|
16207
16207
|
if (!ref.startsWith("#")) {
|
|
16208
16208
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
16209
16209
|
}
|
|
16210
|
-
const
|
|
16211
|
-
if (
|
|
16210
|
+
const path37 = ref.slice(1).split("/").filter(Boolean);
|
|
16211
|
+
if (path37.length === 0) {
|
|
16212
16212
|
return ctx.rootSchema;
|
|
16213
16213
|
}
|
|
16214
16214
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
16215
|
-
if (
|
|
16216
|
-
const key =
|
|
16215
|
+
if (path37[0] === defsKey) {
|
|
16216
|
+
const key = path37[1];
|
|
16217
16217
|
if (!key || !ctx.defs[key]) {
|
|
16218
16218
|
throw new Error(`Reference not found: ${ref}`);
|
|
16219
16219
|
}
|
|
@@ -16825,8 +16825,8 @@ var unboundEncryptedEnvelopeSchema = external_exports.object({
|
|
|
16825
16825
|
var parseBoundEncryptedEnvelopeHeader = (header2) => {
|
|
16826
16826
|
const result = boundEncryptedEnvelopeHeaderSchema.safeParse(header2);
|
|
16827
16827
|
if (!result.success) {
|
|
16828
|
-
const
|
|
16829
|
-
throw new EncryptedEnvelopeFormatError(`invalid ${
|
|
16828
|
+
const path37 = result.error.issues[0]?.path.join(".") || "envelope";
|
|
16829
|
+
throw new EncryptedEnvelopeFormatError(`invalid ${path37}.`);
|
|
16830
16830
|
}
|
|
16831
16831
|
return result.data;
|
|
16832
16832
|
};
|
|
@@ -16858,8 +16858,8 @@ var parseEncryptedEnvelope = (encryptedText) => {
|
|
|
16858
16858
|
const result = schema.safeParse(parsed);
|
|
16859
16859
|
if (!result.success) {
|
|
16860
16860
|
const issue2 = result.error.issues[0];
|
|
16861
|
-
const
|
|
16862
|
-
throw new EncryptedEnvelopeFormatError(`invalid ${
|
|
16861
|
+
const path37 = issue2?.path?.join(".") || "envelope";
|
|
16862
|
+
throw new EncryptedEnvelopeFormatError(`invalid ${path37}.`);
|
|
16863
16863
|
}
|
|
16864
16864
|
return result.data;
|
|
16865
16865
|
};
|
|
@@ -18728,33 +18728,33 @@ var EncryptionBackupError = class extends Error {
|
|
|
18728
18728
|
};
|
|
18729
18729
|
|
|
18730
18730
|
// ../../packages/encryption/src/backup/isSafeEncryptionBackupPath.ts
|
|
18731
|
-
var isSafeEncryptionBackupPath = (
|
|
18732
|
-
if (
|
|
18731
|
+
var isSafeEncryptionBackupPath = (path37) => {
|
|
18732
|
+
if (path37.length === 0 || path37.length > 1024) {
|
|
18733
18733
|
return false;
|
|
18734
18734
|
}
|
|
18735
|
-
if (/[\u0000-\u001f\u007f\\:]/.test(
|
|
18735
|
+
if (/[\u0000-\u001f\u007f\\:]/.test(path37) || path37.startsWith("/")) {
|
|
18736
18736
|
return false;
|
|
18737
18737
|
}
|
|
18738
|
-
return
|
|
18738
|
+
return path37.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
18739
18739
|
};
|
|
18740
18740
|
|
|
18741
18741
|
// ../../packages/encryption/src/backup/assertEncryptionBackupPaths.ts
|
|
18742
18742
|
var assertEncryptionBackupPaths = (paths) => {
|
|
18743
18743
|
const seen = /* @__PURE__ */ new Set();
|
|
18744
|
-
for (const
|
|
18745
|
-
if (!isSafeEncryptionBackupPath(
|
|
18744
|
+
for (const path37 of paths) {
|
|
18745
|
+
if (!isSafeEncryptionBackupPath(path37)) {
|
|
18746
18746
|
throw new EncryptionBackupError(
|
|
18747
18747
|
"invalid_path",
|
|
18748
|
-
`Refusing unsafe backup path ${JSON.stringify(
|
|
18748
|
+
`Refusing unsafe backup path ${JSON.stringify(path37)}.`
|
|
18749
18749
|
);
|
|
18750
18750
|
}
|
|
18751
|
-
if (seen.has(
|
|
18751
|
+
if (seen.has(path37)) {
|
|
18752
18752
|
throw new EncryptionBackupError(
|
|
18753
18753
|
"duplicate_path",
|
|
18754
|
-
`The backup lists ${
|
|
18754
|
+
`The backup lists ${path37} more than once.`
|
|
18755
18755
|
);
|
|
18756
18756
|
}
|
|
18757
|
-
seen.add(
|
|
18757
|
+
seen.add(path37);
|
|
18758
18758
|
}
|
|
18759
18759
|
};
|
|
18760
18760
|
|
|
@@ -18802,7 +18802,7 @@ var encryptionBackupFormat = {
|
|
|
18802
18802
|
var decryptEncryptionBackupFile = async ({
|
|
18803
18803
|
encryptedText,
|
|
18804
18804
|
keyId,
|
|
18805
|
-
path:
|
|
18805
|
+
path: path37,
|
|
18806
18806
|
userKey
|
|
18807
18807
|
}) => {
|
|
18808
18808
|
let recipients;
|
|
@@ -18811,13 +18811,13 @@ var decryptEncryptionBackupFile = async ({
|
|
|
18811
18811
|
} catch {
|
|
18812
18812
|
throw new EncryptionBackupError(
|
|
18813
18813
|
"corrupt",
|
|
18814
|
-
`${
|
|
18814
|
+
`${path37} is not a readable Forum encrypted file.`
|
|
18815
18815
|
);
|
|
18816
18816
|
}
|
|
18817
18817
|
if (!findEncryptionRecipient({ recipients, recipientId: keyId })) {
|
|
18818
18818
|
throw new EncryptionBackupError(
|
|
18819
18819
|
"identity_mismatch",
|
|
18820
|
-
`${
|
|
18820
|
+
`${path37} is not encrypted for this identity.`
|
|
18821
18821
|
);
|
|
18822
18822
|
}
|
|
18823
18823
|
try {
|
|
@@ -18830,7 +18830,7 @@ var decryptEncryptionBackupFile = async ({
|
|
|
18830
18830
|
} catch {
|
|
18831
18831
|
throw new EncryptionBackupError(
|
|
18832
18832
|
"corrupt",
|
|
18833
|
-
`${
|
|
18833
|
+
`${path37} failed integrity checks and could not be decrypted.`
|
|
18834
18834
|
);
|
|
18835
18835
|
}
|
|
18836
18836
|
};
|
|
@@ -18839,7 +18839,7 @@ var decryptEncryptionBackupFile = async ({
|
|
|
18839
18839
|
var findEncryptionBackupExclusion = async ({
|
|
18840
18840
|
encryptedText,
|
|
18841
18841
|
keyId,
|
|
18842
|
-
path:
|
|
18842
|
+
path: path37,
|
|
18843
18843
|
userKey
|
|
18844
18844
|
}) => {
|
|
18845
18845
|
let recipients;
|
|
@@ -18852,7 +18852,7 @@ var findEncryptionBackupExclusion = async ({
|
|
|
18852
18852
|
return "not_a_recipient";
|
|
18853
18853
|
}
|
|
18854
18854
|
try {
|
|
18855
|
-
await decryptEncryptionBackupFile({ encryptedText, keyId, path:
|
|
18855
|
+
await decryptEncryptionBackupFile({ encryptedText, keyId, path: path37, userKey });
|
|
18856
18856
|
return null;
|
|
18857
18857
|
} catch {
|
|
18858
18858
|
return "undecryptable";
|
|
@@ -19543,8 +19543,8 @@ var normalizeStorePath = (value) => {
|
|
|
19543
19543
|
}
|
|
19544
19544
|
return segments2.length === 0 ? "/" : `/${segments2.join("/")}`;
|
|
19545
19545
|
};
|
|
19546
|
-
var storePathToArray = (
|
|
19547
|
-
const normalizedPath = normalizeStorePath(
|
|
19546
|
+
var storePathToArray = (path37) => {
|
|
19547
|
+
const normalizedPath = normalizeStorePath(path37);
|
|
19548
19548
|
return normalizedPath === "/" ? [] : normalizedPath.split("/").filter(Boolean);
|
|
19549
19549
|
};
|
|
19550
19550
|
var storePathSchema = external_exports.string().trim().min(1).transform((value) => normalizeStorePath(value));
|
|
@@ -21641,21 +21641,21 @@ var isKey = (value) => /^\w*$/.test(value);
|
|
|
21641
21641
|
var isUndefined = (val) => val === void 0;
|
|
21642
21642
|
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
21643
21643
|
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
21644
|
-
var get = (object2,
|
|
21645
|
-
if (!
|
|
21644
|
+
var get = (object2, path37, defaultValue) => {
|
|
21645
|
+
if (!path37 || !isObject2(object2)) {
|
|
21646
21646
|
return defaultValue;
|
|
21647
21647
|
}
|
|
21648
|
-
const paths = isKey(
|
|
21648
|
+
const paths = isKey(path37) ? [path37] : stringToPath(path37);
|
|
21649
21649
|
const result = paths.reduce((result2, key) => {
|
|
21650
21650
|
return isNullOrUndefined(result2) ? void 0 : result2[key];
|
|
21651
21651
|
}, object2);
|
|
21652
|
-
return isUndefined(result) || result === object2 ? isUndefined(object2[
|
|
21652
|
+
return isUndefined(result) || result === object2 ? isUndefined(object2[path37]) ? defaultValue : object2[path37] : result;
|
|
21653
21653
|
};
|
|
21654
21654
|
var isBoolean = (value) => typeof value === "boolean";
|
|
21655
21655
|
var isFunction = (value) => typeof value === "function";
|
|
21656
|
-
var set2 = (object2,
|
|
21656
|
+
var set2 = (object2, path37, value) => {
|
|
21657
21657
|
let index = -1;
|
|
21658
|
-
const tempPath = isKey(
|
|
21658
|
+
const tempPath = isKey(path37) ? [path37] : stringToPath(path37);
|
|
21659
21659
|
const length = tempPath.length;
|
|
21660
21660
|
const lastIndex = length - 1;
|
|
21661
21661
|
while (++index < length) {
|
|
@@ -21853,12 +21853,12 @@ function isEmptyArray(obj) {
|
|
|
21853
21853
|
}
|
|
21854
21854
|
return true;
|
|
21855
21855
|
}
|
|
21856
|
-
function unset(object2,
|
|
21857
|
-
if (isString(
|
|
21858
|
-
delete object2[
|
|
21856
|
+
function unset(object2, path37) {
|
|
21857
|
+
if (isString(path37) && Object.prototype.hasOwnProperty.call(object2, path37)) {
|
|
21858
|
+
delete object2[path37];
|
|
21859
21859
|
return object2;
|
|
21860
21860
|
}
|
|
21861
|
-
const paths = Array.isArray(
|
|
21861
|
+
const paths = Array.isArray(path37) ? path37 : isKey(path37) ? [path37] : stringToPath(path37);
|
|
21862
21862
|
const childObject = paths.length === 1 ? object2 : baseGet(object2, paths);
|
|
21863
21863
|
const index = paths.length - 1;
|
|
21864
21864
|
const key = paths[index];
|
|
@@ -25616,7 +25616,7 @@ var publicActionSubmitResultSchema = external_exports.unknown();
|
|
|
25616
25616
|
|
|
25617
25617
|
// ../../packages/core/src/widgetRuntime.ts
|
|
25618
25618
|
var widgetRuntimeOutputPathSchema = storePathSchema.refine(
|
|
25619
|
-
(
|
|
25619
|
+
(path37) => path37 !== "/",
|
|
25620
25620
|
{
|
|
25621
25621
|
message: "Path must not be the root directory."
|
|
25622
25622
|
}
|
|
@@ -25666,7 +25666,7 @@ var widgetRuntimeCompleteAttachmentUploadInputSchema = storeRefSchema.safeExtend
|
|
|
25666
25666
|
treeVisibility: external_exports.enum(["visible", "hidden"]).optional(),
|
|
25667
25667
|
uploadIntentId: external_exports.string().trim().min(1)
|
|
25668
25668
|
});
|
|
25669
|
-
var widgetRuntimeLinkPathSchema = external_exports.string().trim().min(1).max(2048).refine((
|
|
25669
|
+
var widgetRuntimeLinkPathSchema = external_exports.string().trim().min(1).max(2048).refine((path37) => path37.startsWith("/") && !path37.startsWith("//"), {
|
|
25670
25670
|
message: "Link path must be a relative application path."
|
|
25671
25671
|
});
|
|
25672
25672
|
var widgetRuntimeCreateSigningLinkInputSchema = storeRefSchema.safeExtend({
|
|
@@ -26029,8 +26029,8 @@ var listMachineCredentialSecurityActivityInputSchema = securityActivityPageInput
|
|
|
26029
26029
|
|
|
26030
26030
|
// ../../packages/store-tree/src/patterns.ts
|
|
26031
26031
|
var escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26032
|
-
var basename2 = (
|
|
26033
|
-
const segments2 =
|
|
26032
|
+
var basename2 = (path37) => {
|
|
26033
|
+
const segments2 = path37.split("/").filter(Boolean);
|
|
26034
26034
|
return segments2[segments2.length - 1] ?? "";
|
|
26035
26035
|
};
|
|
26036
26036
|
var normalizeStorePathPattern = (pattern) => pattern.trim();
|
|
@@ -26048,7 +26048,7 @@ var storePathPatternToRegex = (pattern) => {
|
|
|
26048
26048
|
return new RegExp(source, "i");
|
|
26049
26049
|
};
|
|
26050
26050
|
var doesStorePathPatternMatch = ({
|
|
26051
|
-
path:
|
|
26051
|
+
path: path37,
|
|
26052
26052
|
pattern,
|
|
26053
26053
|
mode = "path"
|
|
26054
26054
|
}) => {
|
|
@@ -26056,7 +26056,7 @@ var doesStorePathPatternMatch = ({
|
|
|
26056
26056
|
if (!normalizedPattern) {
|
|
26057
26057
|
return true;
|
|
26058
26058
|
}
|
|
26059
|
-
const normalizedPath = normalizeStorePath(
|
|
26059
|
+
const normalizedPath = normalizeStorePath(path37);
|
|
26060
26060
|
const target = mode === "basename" ? basename2(normalizedPath) : normalizedPath;
|
|
26061
26061
|
if (patternHasWildcard(normalizedPattern)) {
|
|
26062
26062
|
return storePathPatternToRegex(normalizedPattern).test(target);
|
|
@@ -26147,8 +26147,8 @@ var isIssueRecord = (value) => {
|
|
|
26147
26147
|
return isRecord2(value) && typeof value.message === "string";
|
|
26148
26148
|
};
|
|
26149
26149
|
var formatIssue = (issue2) => {
|
|
26150
|
-
const
|
|
26151
|
-
return
|
|
26150
|
+
const path37 = Array.isArray(issue2.path) && issue2.path.length > 0 ? issue2.path.map(String).join(".") : "";
|
|
26151
|
+
return path37 ? `${path37}: ${issue2.message}` : issue2.message;
|
|
26152
26152
|
};
|
|
26153
26153
|
var formatIssueArray = (issues) => {
|
|
26154
26154
|
if (!issues.every(isIssueRecord)) {
|
|
@@ -26622,7 +26622,7 @@ var buildContentChangedConflictExplainer = (issues) => {
|
|
|
26622
26622
|
body: [
|
|
26623
26623
|
pathSubject(
|
|
26624
26624
|
paths,
|
|
26625
|
-
(
|
|
26625
|
+
(path37) => `${path37} changed both locally and remotely.`,
|
|
26626
26626
|
(count) => `${count} files changed both locally and remotely.`
|
|
26627
26627
|
),
|
|
26628
26628
|
"Forum left these files alone because either overwrite direction could lose work."
|
|
@@ -26654,7 +26654,7 @@ var buildLocalDeleteRemoteChangeExplainer = (issues) => {
|
|
|
26654
26654
|
body: [
|
|
26655
26655
|
pathSubject(
|
|
26656
26656
|
paths,
|
|
26657
|
-
(
|
|
26657
|
+
(path37) => `${path37} was deleted locally, but the remote file changed.`,
|
|
26658
26658
|
(count) => `${count} files were deleted locally, but changed remotely.`
|
|
26659
26659
|
),
|
|
26660
26660
|
"Forum did not delete newer remote work automatically."
|
|
@@ -26686,7 +26686,7 @@ var buildMoveDestinationConflictExplainer = (issues) => {
|
|
|
26686
26686
|
body: [
|
|
26687
26687
|
pathSubject(
|
|
26688
26688
|
paths,
|
|
26689
|
-
(
|
|
26689
|
+
(path37) => `${path37} is the destination of a remote move, but already exists locally.`,
|
|
26690
26690
|
(count) => `${count} paths are remote move destinations that already exist locally.`
|
|
26691
26691
|
),
|
|
26692
26692
|
"Forum synced unrelated files but left these paths alone."
|
|
@@ -26721,7 +26721,7 @@ var buildMoveRemoteChangeConflictExplainer = (issues) => {
|
|
|
26721
26721
|
body: [
|
|
26722
26722
|
pathSubject(
|
|
26723
26723
|
paths,
|
|
26724
|
-
(
|
|
26724
|
+
(path37) => `${path37} was involved in a move while the other side changed it.`,
|
|
26725
26725
|
(count) => `${count} files were involved in moves while the other side changed them.`
|
|
26726
26726
|
),
|
|
26727
26727
|
"Forum did not combine the move and content change automatically."
|
|
@@ -26753,7 +26753,7 @@ var buildMoveMoveConflictExplainer = (issues) => {
|
|
|
26753
26753
|
body: [
|
|
26754
26754
|
pathSubject(
|
|
26755
26755
|
paths,
|
|
26756
|
-
(
|
|
26756
|
+
(path37) => `${path37} moved locally and remotely to different paths.`,
|
|
26757
26757
|
(count) => `${count} files moved locally and remotely to different paths.`
|
|
26758
26758
|
),
|
|
26759
26759
|
"Forum left these moves unresolved because choosing a path automatically could hide work."
|
|
@@ -26785,7 +26785,7 @@ var buildDeleteMoveConflictExplainer = (issues) => {
|
|
|
26785
26785
|
body: [
|
|
26786
26786
|
pathSubject(
|
|
26787
26787
|
paths,
|
|
26788
|
-
(
|
|
26788
|
+
(path37) => `${path37} was deleted on one side and moved on the other.`,
|
|
26789
26789
|
(count) => `${count} files were deleted on one side and moved on the other.`
|
|
26790
26790
|
),
|
|
26791
26791
|
"Forum did not choose between delete and move automatically."
|
|
@@ -26817,7 +26817,7 @@ var buildReferenceLocalFileConflictExplainer = (issues) => {
|
|
|
26817
26817
|
body: [
|
|
26818
26818
|
pathSubject(
|
|
26819
26819
|
paths,
|
|
26820
|
-
(
|
|
26820
|
+
(path37) => `${path37} is now a remote reference, but the local file has changes.`,
|
|
26821
26821
|
(count) => `${count} paths are now remote references, but local files have changes.`
|
|
26822
26822
|
),
|
|
26823
26823
|
"Forum left the local files alone because replacing them would discard local work."
|
|
@@ -26849,7 +26849,7 @@ var buildUnsupportedLocalEntryExplainer = (issues) => {
|
|
|
26849
26849
|
body: [
|
|
26850
26850
|
pathSubject(
|
|
26851
26851
|
paths,
|
|
26852
|
-
(
|
|
26852
|
+
(path37) => `${path37} is an unsupported local filesystem entry.`,
|
|
26853
26853
|
(count) => `${count} local filesystem entries are unsupported.`
|
|
26854
26854
|
),
|
|
26855
26855
|
"Forum skipped these paths and continued with unrelated files where it could."
|
|
@@ -26881,7 +26881,7 @@ var buildReadOnlyLocalChangeExplainer = (issues) => {
|
|
|
26881
26881
|
body: [
|
|
26882
26882
|
pathSubject(
|
|
26883
26883
|
paths,
|
|
26884
|
-
(
|
|
26884
|
+
(path37) => `${path37} has local changes, but its sync rule is read-only.`,
|
|
26885
26885
|
(count) => `${count} files have local changes, but their sync rules are read-only.`
|
|
26886
26886
|
),
|
|
26887
26887
|
"Forum left these files alone so remote updates cannot overwrite local work."
|
|
@@ -26978,7 +26978,7 @@ var checkoutConflictIssuesFromResult = (result) => checkoutIssuesFromResult(resu
|
|
|
26978
26978
|
(issue2) => issue2.type === "conflict"
|
|
26979
26979
|
);
|
|
26980
26980
|
var formatCheckoutExplainer = (explainer) => {
|
|
26981
|
-
const pathLines = explainer.paths.length <= 1 ? [] : ["", ...formatPathList(explainer.paths).map((
|
|
26981
|
+
const pathLines = explainer.paths.length <= 1 ? [] : ["", ...formatPathList(explainer.paths).map((path37) => ` ${path37}`)];
|
|
26982
26982
|
const actionLines = explainer.actions.map(
|
|
26983
26983
|
(action) => `${styleText.bold(`${action.label}:`)} ${action.text}`
|
|
26984
26984
|
);
|
|
@@ -27168,19 +27168,19 @@ import { TextDecoder as TextDecoder2 } from "util";
|
|
|
27168
27168
|
import ignore2 from "ignore";
|
|
27169
27169
|
|
|
27170
27170
|
// src/buildCheckoutFileManifestEntry.ts
|
|
27171
|
-
var toManifestRemotePath = (
|
|
27171
|
+
var toManifestRemotePath = (path37) => path37.startsWith("/") ? path37 : `/${path37}`;
|
|
27172
27172
|
var buildCheckoutFileManifestEntry = ({
|
|
27173
27173
|
storageClass,
|
|
27174
27174
|
hash: hash2,
|
|
27175
27175
|
manifestEntry,
|
|
27176
|
-
path:
|
|
27176
|
+
path: path37,
|
|
27177
27177
|
remoteFile,
|
|
27178
27178
|
source,
|
|
27179
27179
|
syncedAt
|
|
27180
27180
|
}) => {
|
|
27181
27181
|
const remoteFileId = remoteFile.id ?? remoteFile._id ?? manifestEntry?.remoteFileId;
|
|
27182
27182
|
if (!remoteFileId) {
|
|
27183
|
-
throw new Error(`Remote file ${
|
|
27183
|
+
throw new Error(`Remote file ${path37} did not include a file id`);
|
|
27184
27184
|
}
|
|
27185
27185
|
return {
|
|
27186
27186
|
storageClass,
|
|
@@ -27188,7 +27188,7 @@ var buildCheckoutFileManifestEntry = ({
|
|
|
27188
27188
|
isExecutable: storageClass === "text" ? remoteFile.isExecutable === true || void 0 : void 0,
|
|
27189
27189
|
lastSyncedAt: syncedAt,
|
|
27190
27190
|
remoteFileId,
|
|
27191
|
-
remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(
|
|
27191
|
+
remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(path37),
|
|
27192
27192
|
remoteUpdatedAt: remoteFile.updatedAt ?? null,
|
|
27193
27193
|
remoteRevisionNumber: remoteFile.revisionNumber ?? null,
|
|
27194
27194
|
...source ? { source } : {}
|
|
@@ -29953,16 +29953,16 @@ var updateFileManifestEntry = ({
|
|
|
29953
29953
|
hash: hash2,
|
|
29954
29954
|
manifest,
|
|
29955
29955
|
manifestEntry,
|
|
29956
|
-
path:
|
|
29956
|
+
path: path37,
|
|
29957
29957
|
remoteFile,
|
|
29958
29958
|
source,
|
|
29959
29959
|
syncedAt
|
|
29960
29960
|
}) => {
|
|
29961
|
-
manifest.files[
|
|
29961
|
+
manifest.files[path37] = buildCheckoutFileManifestEntry({
|
|
29962
29962
|
storageClass,
|
|
29963
29963
|
hash: hash2,
|
|
29964
29964
|
manifestEntry,
|
|
29965
|
-
path:
|
|
29965
|
+
path: path37,
|
|
29966
29966
|
remoteFile,
|
|
29967
29967
|
source,
|
|
29968
29968
|
syncedAt
|
|
@@ -31443,7 +31443,7 @@ var remoteFileHash = async ({
|
|
|
31443
31443
|
client,
|
|
31444
31444
|
remoteFile,
|
|
31445
31445
|
storeRef,
|
|
31446
|
-
path:
|
|
31446
|
+
path: path37
|
|
31447
31447
|
}) => {
|
|
31448
31448
|
const textHash = remoteTextHash(remoteFile);
|
|
31449
31449
|
if (textHash) {
|
|
@@ -31454,7 +31454,7 @@ var remoteFileHash = async ({
|
|
|
31454
31454
|
}
|
|
31455
31455
|
const { downloadUrl } = await client.createFileDownloadUrlByRef({
|
|
31456
31456
|
...storeRef,
|
|
31457
|
-
path:
|
|
31457
|
+
path: path37
|
|
31458
31458
|
});
|
|
31459
31459
|
const response = await fetch(downloadUrl);
|
|
31460
31460
|
if (!response.ok) {
|
|
@@ -32881,9 +32881,9 @@ var createHumanWatchSubscriber = ({
|
|
|
32881
32881
|
return;
|
|
32882
32882
|
}
|
|
32883
32883
|
case "sync.watch.conflict.raised": {
|
|
32884
|
-
const
|
|
32884
|
+
const path37 = String(details.path ?? "");
|
|
32885
32885
|
const suggestions = details.suggestions ?? [];
|
|
32886
|
-
error51(`Conflict: ${
|
|
32886
|
+
error51(`Conflict: ${path37} \u2014 ${event.message ?? "needs attention"}`);
|
|
32887
32887
|
if (suggestions.length > 0) {
|
|
32888
32888
|
error51(` ${formatSuggestions(suggestions)}`);
|
|
32889
32889
|
}
|
|
@@ -32912,10 +32912,10 @@ import notifier from "node-notifier";
|
|
|
32912
32912
|
var createNotifyWatchSubscriber = () => {
|
|
32913
32913
|
return (event) => {
|
|
32914
32914
|
if (event.eventType === "sync.watch.conflict.raised") {
|
|
32915
|
-
const
|
|
32915
|
+
const path37 = event.details?.path;
|
|
32916
32916
|
notifier.notify({
|
|
32917
32917
|
title: "Forum sync conflict",
|
|
32918
|
-
message: typeof
|
|
32918
|
+
message: typeof path37 === "string" ? `${path37} needs attention` : event.message ?? "A file needs attention"
|
|
32919
32919
|
});
|
|
32920
32920
|
return;
|
|
32921
32921
|
}
|
|
@@ -33031,10 +33031,10 @@ var createConflictTracker = () => {
|
|
|
33031
33031
|
);
|
|
33032
33032
|
const raised = current.filter((conflict) => !active.has(conflict.path));
|
|
33033
33033
|
const cleared = [...active.keys()].filter(
|
|
33034
|
-
(
|
|
33034
|
+
(path37) => !currentByPath.has(path37)
|
|
33035
33035
|
);
|
|
33036
|
-
for (const
|
|
33037
|
-
active.delete(
|
|
33036
|
+
for (const path37 of cleared) {
|
|
33037
|
+
active.delete(path37);
|
|
33038
33038
|
}
|
|
33039
33039
|
for (const conflict of current) {
|
|
33040
33040
|
active.set(conflict.path, conflict);
|
|
@@ -33045,13 +33045,13 @@ var createConflictTracker = () => {
|
|
|
33045
33045
|
};
|
|
33046
33046
|
|
|
33047
33047
|
// src/watch/conflictResolutionHints.ts
|
|
33048
|
-
var keepLocal = (
|
|
33048
|
+
var keepLocal = (path37) => ({
|
|
33049
33049
|
label: "Keep local",
|
|
33050
|
-
command: `fm push --force ${
|
|
33050
|
+
command: `fm push --force ${path37}`
|
|
33051
33051
|
});
|
|
33052
|
-
var acceptRemote = (
|
|
33052
|
+
var acceptRemote = (path37) => ({
|
|
33053
33053
|
label: "Accept remote",
|
|
33054
|
-
command: `fm pull --force ${
|
|
33054
|
+
command: `fm pull --force ${path37}`
|
|
33055
33055
|
});
|
|
33056
33056
|
var review = (label, command) => ({
|
|
33057
33057
|
label,
|
|
@@ -33067,23 +33067,23 @@ var forceResolvableTypes = /* @__PURE__ */ new Set([
|
|
|
33067
33067
|
"reference-local-file",
|
|
33068
33068
|
"read-only-local-change"
|
|
33069
33069
|
]);
|
|
33070
|
-
var conflictResolutionSuggestions = (conflictType,
|
|
33070
|
+
var conflictResolutionSuggestions = (conflictType, path37) => {
|
|
33071
33071
|
if (forceResolvableTypes.has(conflictType)) {
|
|
33072
|
-
return [keepLocal(
|
|
33072
|
+
return [keepLocal(path37), acceptRemote(path37)];
|
|
33073
33073
|
}
|
|
33074
|
-
return [review("Review", `fm status ${
|
|
33074
|
+
return [review("Review", `fm status ${path37}`)];
|
|
33075
33075
|
};
|
|
33076
33076
|
|
|
33077
33077
|
// src/watch/extractWatchConflicts.ts
|
|
33078
33078
|
var toWatchConflict = (issue2) => {
|
|
33079
|
-
const { path:
|
|
33079
|
+
const { path: path37, message, relatedPaths } = issue2.details.details;
|
|
33080
33080
|
const conflictType = issue2.details.type;
|
|
33081
33081
|
return {
|
|
33082
|
-
path:
|
|
33082
|
+
path: path37,
|
|
33083
33083
|
conflictType,
|
|
33084
33084
|
message,
|
|
33085
33085
|
relatedPaths: relatedPaths ?? [],
|
|
33086
|
-
suggestions: conflictResolutionSuggestions(conflictType,
|
|
33086
|
+
suggestions: conflictResolutionSuggestions(conflictType, path37)
|
|
33087
33087
|
};
|
|
33088
33088
|
};
|
|
33089
33089
|
var extractWatchConflicts = (result) => {
|
|
@@ -33174,9 +33174,9 @@ var createCheckoutWatcher = ({
|
|
|
33174
33174
|
})
|
|
33175
33175
|
);
|
|
33176
33176
|
}
|
|
33177
|
-
for (const
|
|
33177
|
+
for (const path37 of cleared) {
|
|
33178
33178
|
bus.emit(
|
|
33179
|
-
watchEvent("sync.watch.conflict.cleared", void 0, { path:
|
|
33179
|
+
watchEvent("sync.watch.conflict.cleared", void 0, { path: path37 })
|
|
33180
33180
|
);
|
|
33181
33181
|
}
|
|
33182
33182
|
bus.emit(
|
|
@@ -34597,11 +34597,11 @@ var promptSkillConnection = async (client, input) => {
|
|
|
34597
34597
|
};
|
|
34598
34598
|
|
|
34599
34599
|
// src/skills/loadSkillStubs.ts
|
|
34600
|
-
import { lstat as
|
|
34601
|
-
import
|
|
34600
|
+
import { lstat as lstat4, mkdir as mkdir7, open as open3, unlink } from "fs/promises";
|
|
34601
|
+
import path26 from "path";
|
|
34602
34602
|
|
|
34603
34603
|
// src/skills/planSkillStubs.ts
|
|
34604
|
-
import {
|
|
34604
|
+
import { readdir as readdir4 } from "fs/promises";
|
|
34605
34605
|
import path23 from "path";
|
|
34606
34606
|
import { isDeepStrictEqual } from "util";
|
|
34607
34607
|
|
|
@@ -34611,175 +34611,140 @@ var createSkillStub = (item, source) => [
|
|
|
34611
34611
|
"---",
|
|
34612
34612
|
`name: ${item.slug}`,
|
|
34613
34613
|
`description: ${JSON.stringify(item.description)}`,
|
|
34614
|
-
"compatibility: Requires the Forum CLI (fm), network access, and read access to the source store.",
|
|
34615
34614
|
"---",
|
|
34616
34615
|
"",
|
|
34617
|
-
"
|
|
34616
|
+
"Fetch and follow the current instructions before each use:",
|
|
34618
34617
|
"",
|
|
34619
34618
|
"```sh",
|
|
34620
34619
|
`DOCTRINE_API_URL=${quote(source.apiBaseUrl)} fm skills read ${quote(item.slug)} --store ${quote(source.storeId)} --folder ${quote(source.folder)}`,
|
|
34621
34620
|
"```",
|
|
34622
34621
|
"",
|
|
34623
|
-
"
|
|
34624
|
-
"The response identifies the source store, document path, and revision. Resolve supporting document paths in that Forum store, relative to the source document, and fetch them with fm read. They are not files next to this local stub.",
|
|
34625
|
-
"Fetch current instructions when starting a new use of this skill. Instructions already loaded into a task do not update automatically.",
|
|
34622
|
+
"Stop if the fetch fails. Read supporting files with `fm read`, relative to the returned source document in the same Forum store.",
|
|
34626
34623
|
"",
|
|
34627
|
-
"Generated by fm skills
|
|
34624
|
+
"Generated by `fm skills`. Edit the source in Forum.",
|
|
34628
34625
|
""
|
|
34629
34626
|
].join("\n");
|
|
34630
34627
|
|
|
34631
|
-
// src/skills/
|
|
34632
|
-
import { lstat as lstat3, readFile as readFile7
|
|
34628
|
+
// src/skills/readSkillManifest.ts
|
|
34629
|
+
import { lstat as lstat3, readFile as readFile7 } from "fs/promises";
|
|
34633
34630
|
import path22 from "path";
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34631
|
+
var manifestSchema = external_exports.object({
|
|
34632
|
+
version: external_exports.literal(1),
|
|
34633
|
+
skills: external_exports.record(
|
|
34634
|
+
skillSlugSchema,
|
|
34635
|
+
external_exports.object({
|
|
34636
|
+
apiBaseUrl: external_exports.string().min(1),
|
|
34637
|
+
storeId: external_exports.string().min(1),
|
|
34638
|
+
folder: skillFolderSchema
|
|
34639
|
+
})
|
|
34640
|
+
)
|
|
34641
|
+
});
|
|
34642
|
+
var readSkillManifest = async (root) => {
|
|
34643
|
+
const file2 = path22.join(root, ".forum-skills.json");
|
|
34644
|
+
const stat5 = await lstat3(file2).catch((error51) => {
|
|
34637
34645
|
if (error51.code === "ENOENT") return null;
|
|
34638
34646
|
throw error51;
|
|
34639
34647
|
});
|
|
34640
|
-
if (!stat5) return
|
|
34641
|
-
if (!stat5.
|
|
34642
|
-
throw new Error(
|
|
34643
|
-
|
|
34644
|
-
);
|
|
34645
|
-
const markerPath = path22.join(directory, ".forum-skill.json");
|
|
34646
|
-
const names = await readdir4(directory);
|
|
34647
|
-
if (!names.includes(".forum-skill.json")) return null;
|
|
34648
|
-
const markerStat = await lstat3(markerPath);
|
|
34649
|
-
if (!markerStat.isFile() || markerStat.isSymbolicLink())
|
|
34650
|
-
throw new Error(`Invalid Forum skill marker: ${markerPath}`);
|
|
34651
|
-
const marker = JSON.parse(
|
|
34652
|
-
await readFile7(markerPath, "utf8")
|
|
34653
|
-
);
|
|
34654
|
-
if (marker.version !== 1 || typeof marker.source?.storeId !== "string" || typeof marker.source?.folder !== "string" || typeof marker.source?.apiBaseUrl !== "string" || typeof marker.hash !== "string") {
|
|
34655
|
-
throw new Error(`Invalid Forum skill marker: ${markerPath}`);
|
|
34656
|
-
}
|
|
34657
|
-
if (names.some((name) => name !== "SKILL.md" && name !== ".forum-skill.json"))
|
|
34658
|
-
throw new Error(
|
|
34659
|
-
`Skill contains local files; refusing to replace it: ${directory}`
|
|
34660
|
-
);
|
|
34661
|
-
const stubPath = path22.join(directory, "SKILL.md");
|
|
34662
|
-
const stubStat = await lstat3(stubPath);
|
|
34663
|
-
if (!stubStat.isFile() || stubStat.isSymbolicLink())
|
|
34664
|
-
throw new Error(`Invalid generated skill: ${stubPath}`);
|
|
34665
|
-
const content = await readFile7(stubPath, "utf8");
|
|
34666
|
-
if (createHash3("sha256").update(content).digest("hex") !== marker.hash)
|
|
34667
|
-
throw new Error(
|
|
34668
|
-
`Generated skill was edited locally; refusing to replace it: ${stubPath}`
|
|
34669
|
-
);
|
|
34670
|
-
return marker;
|
|
34648
|
+
if (!stat5) return { version: 1, skills: {} };
|
|
34649
|
+
if (!stat5.isFile() || stat5.isSymbolicLink())
|
|
34650
|
+
throw new Error(`Invalid Forum skills manifest: ${file2}`);
|
|
34651
|
+
return manifestSchema.parse(JSON.parse(await readFile7(file2, "utf8")));
|
|
34671
34652
|
};
|
|
34672
34653
|
|
|
34673
34654
|
// src/skills/planSkillStubs.ts
|
|
34674
34655
|
var planSkillStubs = async (input, roots) => {
|
|
34675
|
-
const
|
|
34656
|
+
const plans = [];
|
|
34676
34657
|
for (const { agent, root } of roots) {
|
|
34677
|
-
const
|
|
34658
|
+
const manifest = await readSkillManifest(root);
|
|
34659
|
+
const entries = await readdir4(root, { withFileTypes: true }).catch(
|
|
34678
34660
|
(error51) => {
|
|
34679
34661
|
if (error51.code === "ENOENT") return [];
|
|
34680
34662
|
throw error51;
|
|
34681
34663
|
}
|
|
34682
34664
|
);
|
|
34683
|
-
|
|
34684
|
-
|
|
34685
|
-
|
|
34686
|
-
|
|
34687
|
-
|
|
34665
|
+
const plan = { root, manifest, changes: [] };
|
|
34666
|
+
const desired = new Map(input.skills.map((item) => [item.slug, item]));
|
|
34667
|
+
const owned = Object.keys(manifest.skills).filter(
|
|
34668
|
+
(slug) => isDeepStrictEqual(manifest.skills[slug], input.source)
|
|
34669
|
+
);
|
|
34670
|
+
for (const slug of /* @__PURE__ */ new Set([...desired.keys(), ...owned])) {
|
|
34671
|
+
const destination = path23.join(root, slug);
|
|
34672
|
+
const entry = entries.find((item2) => item2.name === slug);
|
|
34673
|
+
const registered = Object.hasOwn(manifest.skills, slug);
|
|
34674
|
+
if ((entry || registered) && !owned.includes(slug))
|
|
34688
34675
|
throw new Error(
|
|
34689
|
-
`Skill name collision: ${destination}. Choose a different slug;
|
|
34676
|
+
`Skill name collision: ${destination}. Choose a different slug; skills not owned by this collection are never overwritten.`
|
|
34690
34677
|
);
|
|
34691
|
-
|
|
34692
|
-
|
|
34693
|
-
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34697
|
-
action: unchanged ? "unchanged" : exists2 ? "update" : "create",
|
|
34698
|
-
content
|
|
34699
|
-
});
|
|
34700
|
-
}
|
|
34701
|
-
const slugs = new Set(input.skills.map((item) => item.slug));
|
|
34702
|
-
for (const entry of directories) {
|
|
34703
|
-
if (!entry.isDirectory() || entry.isSymbolicLink() || slugs.has(entry.name) || entry.name.startsWith("."))
|
|
34704
|
-
continue;
|
|
34705
|
-
const destination = path23.join(root, entry.name);
|
|
34706
|
-
const markerPath = path23.join(destination, ".forum-skill.json");
|
|
34707
|
-
const markerStat = await lstat4(markerPath).catch(
|
|
34708
|
-
(error51) => {
|
|
34709
|
-
if (error51.code === "ENOENT") return null;
|
|
34710
|
-
throw error51;
|
|
34711
|
-
}
|
|
34712
|
-
);
|
|
34713
|
-
if (!markerStat?.isFile() || markerStat.isSymbolicLink()) continue;
|
|
34714
|
-
const candidate = JSON.parse(await readFile8(markerPath, "utf8"));
|
|
34715
|
-
if (!isDeepStrictEqual(candidate.source, input.source)) continue;
|
|
34716
|
-
await readSkillStubMarker(destination);
|
|
34717
|
-
changes.push({
|
|
34678
|
+
if (entry && (!entry.isDirectory() || entry.isSymbolicLink()))
|
|
34679
|
+
throw new Error(
|
|
34680
|
+
`Skill destination is not a regular directory: ${destination}`
|
|
34681
|
+
);
|
|
34682
|
+
const item = desired.get(slug);
|
|
34683
|
+
plan.changes.push({
|
|
34718
34684
|
agent,
|
|
34719
|
-
slug
|
|
34685
|
+
slug,
|
|
34720
34686
|
path: destination,
|
|
34721
|
-
action: "remove"
|
|
34687
|
+
action: item ? entry ? "update" : "create" : "remove",
|
|
34688
|
+
...item ? { content: createSkillStub(item, input.source) } : {}
|
|
34722
34689
|
});
|
|
34723
34690
|
}
|
|
34691
|
+
plans.push(plan);
|
|
34724
34692
|
}
|
|
34725
|
-
return
|
|
34693
|
+
return plans;
|
|
34726
34694
|
};
|
|
34727
34695
|
|
|
34728
34696
|
// src/skills/applySkillStubChanges.ts
|
|
34729
|
-
import {
|
|
34730
|
-
import
|
|
34697
|
+
import { mkdir as mkdir6, rm as rm7, writeFile as writeFile5 } from "fs/promises";
|
|
34698
|
+
import path25 from "path";
|
|
34699
|
+
|
|
34700
|
+
// src/skills/writeSkillManifest.ts
|
|
34701
|
+
import { randomUUID } from "crypto";
|
|
34702
|
+
import { rename as rename4, rm as rm6, writeFile as writeFile4 } from "fs/promises";
|
|
34731
34703
|
import path24 from "path";
|
|
34732
|
-
var
|
|
34733
|
-
const
|
|
34704
|
+
var writeSkillManifest = async (root, manifest) => {
|
|
34705
|
+
const temporary = path24.join(root, `.forum-skills-${randomUUID()}.tmp`);
|
|
34734
34706
|
try {
|
|
34707
|
+
await writeFile4(temporary, `${JSON.stringify(manifest, null, 2)}
|
|
34708
|
+
`, {
|
|
34709
|
+
encoding: "utf8",
|
|
34710
|
+
flag: "wx"
|
|
34711
|
+
});
|
|
34712
|
+
await rename4(temporary, path24.join(root, ".forum-skills.json"));
|
|
34713
|
+
} finally {
|
|
34714
|
+
await rm6(temporary, { force: true });
|
|
34715
|
+
}
|
|
34716
|
+
};
|
|
34717
|
+
|
|
34718
|
+
// src/skills/applySkillStubChanges.ts
|
|
34719
|
+
var applySkillStubChanges = async (plans, source) => {
|
|
34720
|
+
for (const { root, manifest, changes } of plans) {
|
|
34721
|
+
if (!changes.length) continue;
|
|
34722
|
+
for (const change of changes)
|
|
34723
|
+
if (change.action !== "remove") manifest.skills[change.slug] = source;
|
|
34724
|
+
await writeSkillManifest(root, manifest);
|
|
34735
34725
|
for (const change of changes) {
|
|
34736
|
-
|
|
34737
|
-
|
|
34738
|
-
|
|
34726
|
+
await rm7(change.path, { recursive: true, force: true });
|
|
34727
|
+
if (change.action === "remove") continue;
|
|
34728
|
+
await mkdir6(change.path);
|
|
34729
|
+
await writeFile5(
|
|
34730
|
+
path25.join(change.path, "SKILL.md"),
|
|
34731
|
+
change.content,
|
|
34732
|
+
"utf8"
|
|
34739
34733
|
);
|
|
34740
|
-
|
|
34741
|
-
change,
|
|
34742
|
-
|
|
34743
|
-
|
|
34744
|
-
|
|
34745
|
-
|
|
34746
|
-
applied.push(entry);
|
|
34747
|
-
if (change.action !== "remove") {
|
|
34748
|
-
const content = change.content;
|
|
34749
|
-
const marker = {
|
|
34750
|
-
version: 1,
|
|
34751
|
-
source,
|
|
34752
|
-
hash: createHash4("sha256").update(content).digest("hex")
|
|
34753
|
-
};
|
|
34754
|
-
await writeFile4(path24.join(temporary, "SKILL.md"), content, "utf8");
|
|
34755
|
-
await writeFile4(
|
|
34756
|
-
path24.join(temporary, ".forum-skill.json"),
|
|
34757
|
-
`${JSON.stringify(marker, null, 2)}
|
|
34734
|
+
if (change.agent === "codex") {
|
|
34735
|
+
await mkdir6(path25.join(change.path, "agents"));
|
|
34736
|
+
await writeFile5(
|
|
34737
|
+
path25.join(change.path, "agents/openai.yaml"),
|
|
34738
|
+
`interface:
|
|
34739
|
+
display_name: ${JSON.stringify(change.slug)}
|
|
34758
34740
|
`,
|
|
34759
34741
|
"utf8"
|
|
34760
34742
|
);
|
|
34761
34743
|
}
|
|
34762
|
-
if (change.action !== "create") {
|
|
34763
|
-
const backup = `${temporary}-backup`;
|
|
34764
|
-
await rename4(change.path, backup);
|
|
34765
|
-
entry.backup = backup;
|
|
34766
|
-
}
|
|
34767
|
-
if (change.action !== "remove") {
|
|
34768
|
-
await rename4(temporary, change.path);
|
|
34769
|
-
entry.installed = true;
|
|
34770
|
-
}
|
|
34771
|
-
}
|
|
34772
|
-
} catch (error51) {
|
|
34773
|
-
for (const entry of applied.toReversed()) {
|
|
34774
|
-
if (entry.installed) await rm6(entry.change.path, { recursive: true });
|
|
34775
|
-
if (entry.backup) await rename4(entry.backup, entry.change.path);
|
|
34776
|
-
await rm6(entry.temporary, { recursive: true, force: true });
|
|
34777
34744
|
}
|
|
34778
|
-
|
|
34779
|
-
|
|
34780
|
-
|
|
34781
|
-
if (entry.backup) await rm6(entry.backup, { recursive: true });
|
|
34782
|
-
await rm6(entry.temporary, { recursive: true, force: true });
|
|
34745
|
+
for (const change of changes)
|
|
34746
|
+
if (change.action === "remove") delete manifest.skills[change.slug];
|
|
34747
|
+
await writeSkillManifest(root, manifest);
|
|
34783
34748
|
}
|
|
34784
34749
|
};
|
|
34785
34750
|
|
|
@@ -34790,16 +34755,16 @@ var loadSkillStubs = async (input) => {
|
|
|
34790
34755
|
throw new Error("Use a canonical store folder path.");
|
|
34791
34756
|
if (new Set(input.skills.map((skill) => skill.slug)).size !== input.skills.length)
|
|
34792
34757
|
throw new Error("Duplicate skill names in collection.");
|
|
34793
|
-
const base =
|
|
34758
|
+
const base = path26.resolve(input.global ? input.home : input.directory);
|
|
34794
34759
|
const roots = [...new Set(input.agents)].map((agent) => ({
|
|
34795
34760
|
agent,
|
|
34796
|
-
root:
|
|
34761
|
+
root: path26.join(base, agent === "codex" ? ".agents" : ".claude", "skills")
|
|
34797
34762
|
}));
|
|
34798
34763
|
const locks = [];
|
|
34799
34764
|
try {
|
|
34800
34765
|
for (const { root } of roots) {
|
|
34801
|
-
for (const directory of [
|
|
34802
|
-
const stat5 = await
|
|
34766
|
+
for (const directory of [path26.dirname(root), root]) {
|
|
34767
|
+
const stat5 = await lstat4(directory).catch(
|
|
34803
34768
|
(error51) => {
|
|
34804
34769
|
if (error51.code === "ENOENT") return null;
|
|
34805
34770
|
throw error51;
|
|
@@ -34811,8 +34776,8 @@ var loadSkillStubs = async (input) => {
|
|
|
34811
34776
|
);
|
|
34812
34777
|
}
|
|
34813
34778
|
if (!input.dryRun) {
|
|
34814
|
-
await
|
|
34815
|
-
const lockPath =
|
|
34779
|
+
await mkdir7(root, { recursive: true });
|
|
34780
|
+
const lockPath = path26.join(root, ".forum-skills.lock");
|
|
34816
34781
|
const file2 = await open3(lockPath, "wx").catch(
|
|
34817
34782
|
(error51) => {
|
|
34818
34783
|
if (error51.code === "EEXIST")
|
|
@@ -34825,14 +34790,14 @@ var loadSkillStubs = async (input) => {
|
|
|
34825
34790
|
locks.push({ path: lockPath, file: file2 });
|
|
34826
34791
|
}
|
|
34827
34792
|
}
|
|
34828
|
-
const
|
|
34829
|
-
if (!input.dryRun) await applySkillStubChanges(
|
|
34793
|
+
const plans = await planSkillStubs(input, roots);
|
|
34794
|
+
if (!input.dryRun) await applySkillStubChanges(plans, input.source);
|
|
34830
34795
|
return {
|
|
34831
34796
|
dryRun: input.dryRun,
|
|
34832
34797
|
source: input.source,
|
|
34833
|
-
changes: changes.map(({ agent, path:
|
|
34798
|
+
changes: plans.flatMap((plan) => plan.changes).map(({ agent, path: path37, slug, action }) => ({
|
|
34834
34799
|
agent,
|
|
34835
|
-
path:
|
|
34800
|
+
path: path37,
|
|
34836
34801
|
slug,
|
|
34837
34802
|
action
|
|
34838
34803
|
}))
|
|
@@ -34899,10 +34864,15 @@ var renderSkillConnection = (result, json2) => {
|
|
|
34899
34864
|
"name: 1\u201364 lowercase letters, numbers, and single hyphens; unique in this folder. description: a non-empty string, up to 1,024 characters. Edit the Metadata section in Forum, or add this header in Raw view."
|
|
34900
34865
|
);
|
|
34901
34866
|
}
|
|
34902
|
-
for (const change of result.changes)
|
|
34867
|
+
for (const change of result.changes) {
|
|
34903
34868
|
renderOutput(
|
|
34904
34869
|
`${result.status === "preview" ? "Would " : ""}${change.action} ${change.agent}: ${change.path}`
|
|
34905
34870
|
);
|
|
34871
|
+
if (change.action !== "remove")
|
|
34872
|
+
renderOutput(
|
|
34873
|
+
change.agent === "codex" ? ` SKILL.md, agents/openai.yaml (display_name: ${change.slug})` : " SKILL.md"
|
|
34874
|
+
);
|
|
34875
|
+
}
|
|
34906
34876
|
if (result.status === "invalid")
|
|
34907
34877
|
renderOutput(
|
|
34908
34878
|
"No local skills changed. Correct the invalid metadata and try again."
|
|
@@ -35041,11 +35011,11 @@ import { CommanderError as CommanderError2 } from "commander";
|
|
|
35041
35011
|
import { Command as Command2, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
35042
35012
|
|
|
35043
35013
|
// src/machine/createMachineCommandClient.ts
|
|
35044
|
-
import
|
|
35014
|
+
import path27 from "path";
|
|
35045
35015
|
var machineTokenEnvVar = "FORUM_MACHINE_TOKEN";
|
|
35046
35016
|
var apiBaseUrl = () => (process.env.DOCTRINE_API_URL || DEFAULT_API_BASE_URL).replace(/\/+$/, "");
|
|
35047
35017
|
var createMachineAdminClient = async (options2) => {
|
|
35048
|
-
const stateDir = options2.stateDir ?
|
|
35018
|
+
const stateDir = options2.stateDir ? path27.resolve(options2.stateDir) : defaultStateDir();
|
|
35049
35019
|
const token = options2.token || process.env.DOCTRINE_TOKEN || (await readConfig(stateDir)).token;
|
|
35050
35020
|
registerRedactedSecret(token);
|
|
35051
35021
|
if (token && isMachineToken(token)) {
|
|
@@ -35083,15 +35053,15 @@ var describeMachineCredential = (credential) => [
|
|
|
35083
35053
|
].join("\n");
|
|
35084
35054
|
|
|
35085
35055
|
// src/machine/emitIssuedSecrets.ts
|
|
35086
|
-
import
|
|
35056
|
+
import path28 from "path";
|
|
35087
35057
|
|
|
35088
35058
|
// src/machine/machineKeyEnvVar.ts
|
|
35089
35059
|
var machineKeyEnvVar = "FORUM_MACHINE_KEY";
|
|
35090
35060
|
|
|
35091
35061
|
// src/machine/writeSecretFile.ts
|
|
35092
|
-
import { writeFile as
|
|
35062
|
+
import { writeFile as writeFile6 } from "fs/promises";
|
|
35093
35063
|
var writeSecretFile = async (filePath, secret) => {
|
|
35094
|
-
await
|
|
35064
|
+
await writeFile6(filePath, `${secret}
|
|
35095
35065
|
`, { flag: "wx", mode: 384 });
|
|
35096
35066
|
};
|
|
35097
35067
|
|
|
@@ -35111,7 +35081,7 @@ var emitIssuedSecrets = async ({
|
|
|
35111
35081
|
for (const secret of secrets) {
|
|
35112
35082
|
if (!secret.value) continue;
|
|
35113
35083
|
if (secret.file) {
|
|
35114
|
-
const filePath =
|
|
35084
|
+
const filePath = path28.resolve(secret.file);
|
|
35115
35085
|
await writeSecretFile(filePath, secret.value);
|
|
35116
35086
|
written[secret.env] = filePath;
|
|
35117
35087
|
} else {
|
|
@@ -35125,19 +35095,19 @@ var emitIssuedSecrets = async ({
|
|
|
35125
35095
|
var parseMachineGrantSpec = (value) => {
|
|
35126
35096
|
const separator = value.indexOf(":");
|
|
35127
35097
|
const store = (separator === -1 ? value : value.slice(0, separator)).trim();
|
|
35128
|
-
const
|
|
35098
|
+
const path37 = separator === -1 ? "" : value.slice(separator + 1).trim();
|
|
35129
35099
|
if (!store) {
|
|
35130
35100
|
throw new Error(
|
|
35131
35101
|
`Invalid --grant "${value}". Use <store> or <store>:<path>.`
|
|
35132
35102
|
);
|
|
35133
35103
|
}
|
|
35134
35104
|
if (separator === -1) return { store };
|
|
35135
|
-
if (!
|
|
35105
|
+
if (!path37.startsWith("/")) {
|
|
35136
35106
|
throw new Error(
|
|
35137
35107
|
`Invalid --grant "${value}". File paths start with /, for example ${store}:/prod.env.enc.`
|
|
35138
35108
|
);
|
|
35139
35109
|
}
|
|
35140
|
-
return { paths: [
|
|
35110
|
+
return { paths: [path37], store };
|
|
35141
35111
|
};
|
|
35142
35112
|
|
|
35143
35113
|
// src/machine/provisionMachineCredential.ts
|
|
@@ -35249,7 +35219,7 @@ var runMachineCredentialAction = (act) => async (ref, _options, command) => {
|
|
|
35249
35219
|
};
|
|
35250
35220
|
|
|
35251
35221
|
// src/machine/runMachineFetch.ts
|
|
35252
|
-
import
|
|
35222
|
+
import path29 from "path";
|
|
35253
35223
|
|
|
35254
35224
|
// src/machine/fetchMachineFile.ts
|
|
35255
35225
|
var fetchMachineFile = async ({
|
|
@@ -35265,11 +35235,11 @@ var fetchMachineFile = async ({
|
|
|
35265
35235
|
// src/machine/parseMachineFileRef.ts
|
|
35266
35236
|
var parseMachineFileRef = ({
|
|
35267
35237
|
fileId,
|
|
35268
|
-
path:
|
|
35238
|
+
path: path37,
|
|
35269
35239
|
store
|
|
35270
35240
|
}) => {
|
|
35271
|
-
if (fileId && !store && !
|
|
35272
|
-
if (!fileId && store &&
|
|
35241
|
+
if (fileId && !store && !path37) return { fileId };
|
|
35242
|
+
if (!fileId && store && path37) return { path: path37, store };
|
|
35273
35243
|
throw new Error(
|
|
35274
35244
|
"Pass either --file-id <id>, or --store <store> --path <path>."
|
|
35275
35245
|
);
|
|
@@ -35279,7 +35249,7 @@ var parseMachineFileRef = ({
|
|
|
35279
35249
|
var runMachineFetch = async (_options, command) => {
|
|
35280
35250
|
const options2 = command.optsWithGlobals();
|
|
35281
35251
|
configureRenderer({ json: Boolean(options2.json) });
|
|
35282
|
-
const outputPath = options2.output ?
|
|
35252
|
+
const outputPath = options2.output ? path29.resolve(options2.output) : null;
|
|
35283
35253
|
const file2 = await fetchMachineFile({
|
|
35284
35254
|
client: createMachineTokenClient(options2),
|
|
35285
35255
|
outputPath,
|
|
@@ -35992,8 +35962,8 @@ var decryptTextForRecipientSecret = async (encryptedText, secretArg, expectation
|
|
|
35992
35962
|
};
|
|
35993
35963
|
|
|
35994
35964
|
// src/decryptRun/runDecryptRunCommand.ts
|
|
35995
|
-
import { readFile as
|
|
35996
|
-
import
|
|
35965
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
35966
|
+
import path30 from "path";
|
|
35997
35967
|
|
|
35998
35968
|
// ../../packages/doctrine-secrets/src/credentials/credentialEnvironmentNames.ts
|
|
35999
35969
|
var credentialEnvironmentNames = [
|
|
@@ -36697,7 +36667,7 @@ var runDecryptRunCommand = async ({
|
|
|
36697
36667
|
stdout.write(decryptRunUsage);
|
|
36698
36668
|
return 0;
|
|
36699
36669
|
}
|
|
36700
|
-
const encryptedText = await
|
|
36670
|
+
const encryptedText = await readFile8(path30.resolve(args.filePath), "utf8");
|
|
36701
36671
|
const credential = await resolveDecryptRunCredential({
|
|
36702
36672
|
args,
|
|
36703
36673
|
environment,
|
|
@@ -37243,13 +37213,13 @@ var runEncryptionIdentityCommand = async ({
|
|
|
37243
37213
|
};
|
|
37244
37214
|
|
|
37245
37215
|
// src/writeTextFileIfUnchanged.ts
|
|
37246
|
-
import { readFile as
|
|
37216
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
37247
37217
|
var writeTextFileIfUnchanged = async ({
|
|
37248
37218
|
expectedText,
|
|
37249
37219
|
filePath,
|
|
37250
37220
|
text
|
|
37251
37221
|
}) => {
|
|
37252
|
-
const current = await
|
|
37222
|
+
const current = await readFile9(filePath, "utf8");
|
|
37253
37223
|
if (current !== expectedText) {
|
|
37254
37224
|
throw new Error(
|
|
37255
37225
|
`${filePath} changed while this command was running; nothing was written. Re-run against the latest version.`
|
|
@@ -37261,8 +37231,8 @@ var writeTextFileIfUnchanged = async ({
|
|
|
37261
37231
|
// src/openInEditor.ts
|
|
37262
37232
|
import { spawn as spawn2 } from "child_process";
|
|
37263
37233
|
import { rmSync } from "fs";
|
|
37264
|
-
import { chmod as chmod3, mkdtemp
|
|
37265
|
-
import
|
|
37234
|
+
import { chmod as chmod3, mkdtemp, readFile as readFile10, rm as rm8, writeFile as writeFile7 } from "fs/promises";
|
|
37235
|
+
import path31 from "path";
|
|
37266
37236
|
|
|
37267
37237
|
// src/resolvePrivateTempBase.ts
|
|
37268
37238
|
import { statSync } from "fs";
|
|
@@ -37303,13 +37273,13 @@ var openInEditor = async (currentText, {
|
|
|
37303
37273
|
extension = "",
|
|
37304
37274
|
signalSource
|
|
37305
37275
|
} = {}) => {
|
|
37306
|
-
const dir = await
|
|
37276
|
+
const dir = await mkdtemp(path31.join(resolvePrivateTempBase(), "fm-edit-"));
|
|
37307
37277
|
const removeOnExit = () => rmSync(dir, { force: true, recursive: true });
|
|
37308
37278
|
process.once("exit", removeOnExit);
|
|
37309
37279
|
try {
|
|
37310
37280
|
await chmod3(dir, privateModes.directory);
|
|
37311
|
-
const tempPath =
|
|
37312
|
-
await
|
|
37281
|
+
const tempPath = path31.join(dir, `edit${extension}`);
|
|
37282
|
+
await writeFile7(tempPath, currentText, {
|
|
37313
37283
|
encoding: "utf8",
|
|
37314
37284
|
flag: "wx",
|
|
37315
37285
|
mode: privateModes.file
|
|
@@ -37317,10 +37287,10 @@ var openInEditor = async (currentText, {
|
|
|
37317
37287
|
if (await runEditor(tempPath, signalSource) !== 0) {
|
|
37318
37288
|
return null;
|
|
37319
37289
|
}
|
|
37320
|
-
return await
|
|
37290
|
+
return await readFile10(tempPath, "utf8");
|
|
37321
37291
|
} finally {
|
|
37322
37292
|
try {
|
|
37323
|
-
await
|
|
37293
|
+
await rm8(dir, { force: true, recursive: true });
|
|
37324
37294
|
process.off("exit", removeOnExit);
|
|
37325
37295
|
} catch {
|
|
37326
37296
|
}
|
|
@@ -37359,7 +37329,7 @@ var standaloneIncludeId = (paragraph) => {
|
|
|
37359
37329
|
var textContent = (file2) => file2?.content && "text" in file2.content ? file2.content.text : null;
|
|
37360
37330
|
var compileMarkdown = async ({
|
|
37361
37331
|
entry,
|
|
37362
|
-
readFile:
|
|
37332
|
+
readFile: readFile12,
|
|
37363
37333
|
optional: optional2,
|
|
37364
37334
|
limits = {}
|
|
37365
37335
|
}) => {
|
|
@@ -37403,7 +37373,7 @@ var compileMarkdown = async ({
|
|
|
37403
37373
|
throw new Error(`Include cycle: ${[...chain, id].join(" -> ")}`);
|
|
37404
37374
|
let target;
|
|
37405
37375
|
try {
|
|
37406
|
-
target = await
|
|
37376
|
+
target = await readFile12(id);
|
|
37407
37377
|
} catch (error51) {
|
|
37408
37378
|
if (optional2) {
|
|
37409
37379
|
warnings.push(`Omitted unreadable include ${id} from ${label}.`);
|
|
@@ -37481,11 +37451,11 @@ var isEncryptionBackupSubcommand = (value) => encryptionBackupSubcommands.includ
|
|
|
37481
37451
|
|
|
37482
37452
|
// src/encryptionBackup/createEncryptionBackupFile.ts
|
|
37483
37453
|
import fs4 from "fs/promises";
|
|
37484
|
-
import
|
|
37454
|
+
import path34 from "path";
|
|
37485
37455
|
|
|
37486
37456
|
// src/encryptionBackup/collectEncryptedFileCandidates.ts
|
|
37487
37457
|
import fs from "fs/promises";
|
|
37488
|
-
import
|
|
37458
|
+
import path32 from "path";
|
|
37489
37459
|
|
|
37490
37460
|
// src/encryptionBackup/isEncryptedEnvelopeText.ts
|
|
37491
37461
|
var isEncryptedEnvelopeText = (text) => {
|
|
@@ -37507,12 +37477,12 @@ var collectEncryptedFileCandidates = async ({
|
|
|
37507
37477
|
excludePaths = [],
|
|
37508
37478
|
rootDir
|
|
37509
37479
|
}) => {
|
|
37510
|
-
const excluded = new Set(excludePaths.map((entry) =>
|
|
37480
|
+
const excluded = new Set(excludePaths.map((entry) => path32.resolve(entry)));
|
|
37511
37481
|
const candidates = [];
|
|
37512
37482
|
const walk = async (directory) => {
|
|
37513
37483
|
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
37514
37484
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
37515
|
-
const absolute =
|
|
37485
|
+
const absolute = path32.join(directory, entry.name);
|
|
37516
37486
|
if (entry.isDirectory() && !skippedDirectories.has(entry.name)) {
|
|
37517
37487
|
await walk(absolute);
|
|
37518
37488
|
continue;
|
|
@@ -37527,12 +37497,12 @@ var collectEncryptedFileCandidates = async ({
|
|
|
37527
37497
|
if (isEncryptedEnvelopeText(text)) {
|
|
37528
37498
|
candidates.push({
|
|
37529
37499
|
encryptedText: text,
|
|
37530
|
-
path:
|
|
37500
|
+
path: path32.relative(rootDir, absolute).split(path32.sep).join("/")
|
|
37531
37501
|
});
|
|
37532
37502
|
}
|
|
37533
37503
|
}
|
|
37534
37504
|
};
|
|
37535
|
-
await walk(
|
|
37505
|
+
await walk(path32.resolve(rootDir));
|
|
37536
37506
|
return candidates;
|
|
37537
37507
|
};
|
|
37538
37508
|
|
|
@@ -37551,13 +37521,13 @@ var pathExists4 = async (target) => {
|
|
|
37551
37521
|
};
|
|
37552
37522
|
|
|
37553
37523
|
// src/encryptionBackup/writeFileExclusive.ts
|
|
37554
|
-
import { randomUUID } from "crypto";
|
|
37524
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
37555
37525
|
import fs3 from "fs/promises";
|
|
37556
|
-
import
|
|
37526
|
+
import path33 from "path";
|
|
37557
37527
|
var writeFileExclusive = async (target, content, mode = 384) => {
|
|
37558
|
-
const temporary =
|
|
37559
|
-
|
|
37560
|
-
`.${
|
|
37528
|
+
const temporary = path33.join(
|
|
37529
|
+
path33.dirname(target),
|
|
37530
|
+
`.${path33.basename(target)}.${randomUUID2()}.partial`
|
|
37561
37531
|
);
|
|
37562
37532
|
try {
|
|
37563
37533
|
await fs3.writeFile(temporary, content, { flag: "wx", mode });
|
|
@@ -37578,7 +37548,7 @@ var createEncryptionBackupFile = async ({
|
|
|
37578
37548
|
password,
|
|
37579
37549
|
sourceDir
|
|
37580
37550
|
}) => {
|
|
37581
|
-
const resolvedOutput =
|
|
37551
|
+
const resolvedOutput = path34.resolve(outputPath);
|
|
37582
37552
|
if (await pathExists4(resolvedOutput)) {
|
|
37583
37553
|
throw existingOutputError(outputPath);
|
|
37584
37554
|
}
|
|
@@ -37597,7 +37567,7 @@ var createEncryptionBackupFile = async ({
|
|
|
37597
37567
|
identity: encryption,
|
|
37598
37568
|
password
|
|
37599
37569
|
});
|
|
37600
|
-
await fs4.mkdir(
|
|
37570
|
+
await fs4.mkdir(path34.dirname(resolvedOutput), { recursive: true });
|
|
37601
37571
|
try {
|
|
37602
37572
|
await writeFileExclusive(resolvedOutput, serializeEncryptionBackup(backup));
|
|
37603
37573
|
} catch (error51) {
|
|
@@ -37629,19 +37599,19 @@ import fs7 from "fs/promises";
|
|
|
37629
37599
|
|
|
37630
37600
|
// src/encryptionBackup/resolveRestoreTarget.ts
|
|
37631
37601
|
import fs6 from "fs/promises";
|
|
37632
|
-
import
|
|
37602
|
+
import path35 from "path";
|
|
37633
37603
|
var resolveRestoreTarget = async (targetDir, relativePath) => {
|
|
37634
37604
|
const root = await fs6.realpath(targetDir);
|
|
37635
|
-
const target =
|
|
37636
|
-
const parent =
|
|
37605
|
+
const target = path35.join(root, ...relativePath.split("/"));
|
|
37606
|
+
const parent = path35.dirname(target);
|
|
37637
37607
|
await fs6.mkdir(parent, { mode: 448, recursive: true });
|
|
37638
37608
|
const realParent = await fs6.realpath(parent);
|
|
37639
|
-
if (realParent !== root && !realParent.startsWith(`${root}${
|
|
37609
|
+
if (realParent !== root && !realParent.startsWith(`${root}${path35.sep}`)) {
|
|
37640
37610
|
throw new Error(
|
|
37641
37611
|
`Refusing to restore ${relativePath} outside ${targetDir}.`
|
|
37642
37612
|
);
|
|
37643
37613
|
}
|
|
37644
|
-
return
|
|
37614
|
+
return path35.join(realParent, path35.basename(target));
|
|
37645
37615
|
};
|
|
37646
37616
|
|
|
37647
37617
|
// src/encryptionBackup/restoreDecryptedFile.ts
|
|
@@ -37750,8 +37720,8 @@ var runEncryptionBackupCommand = async ({
|
|
|
37750
37720
|
render(
|
|
37751
37721
|
`Backed up ${plural(result.fileCount, "encrypted file")} for identity ${formatEncryptionFingerprint(result.fingerprint)} to ${first}.`
|
|
37752
37722
|
);
|
|
37753
|
-
for (const { path:
|
|
37754
|
-
render(`Not included (${reason.replaceAll("_", " ")}): ${
|
|
37723
|
+
for (const { path: path37, reason } of result.excluded) {
|
|
37724
|
+
render(`Not included (${reason.replaceAll("_", " ")}): ${path37}`);
|
|
37755
37725
|
}
|
|
37756
37726
|
encryptionBackupGuidance.forEach((line) => render(line));
|
|
37757
37727
|
return;
|
|
@@ -37771,7 +37741,7 @@ var runEncryptionBackupCommand = async ({
|
|
|
37771
37741
|
password: await readPassword(),
|
|
37772
37742
|
targetDir: second
|
|
37773
37743
|
});
|
|
37774
|
-
outcomes.forEach(({ path:
|
|
37744
|
+
outcomes.forEach(({ path: path37, status }) => render(`${status}: ${path37}`));
|
|
37775
37745
|
const conflicts = outcomes.filter((outcome) => outcome.status === "conflict");
|
|
37776
37746
|
render(
|
|
37777
37747
|
`Restored backup for identity ${formatEncryptionFingerprint(fingerprint)} into ${second}: ${plural(outcomes.length - conflicts.length, "file")} in place.`
|
|
@@ -37917,7 +37887,7 @@ Output:
|
|
|
37917
37887
|
`;
|
|
37918
37888
|
var readCliVersion = async () => {
|
|
37919
37889
|
const packageJson = JSON.parse(
|
|
37920
|
-
await
|
|
37890
|
+
await readFile11(new URL("../package.json", import.meta.url), "utf8")
|
|
37921
37891
|
);
|
|
37922
37892
|
return typeof packageJson.version === "string" ? packageJson.version : "unknown";
|
|
37923
37893
|
};
|
|
@@ -38044,13 +38014,13 @@ var parseArgs = (argv) => {
|
|
|
38044
38014
|
continue;
|
|
38045
38015
|
}
|
|
38046
38016
|
if (current === "--file" || current === "-f") {
|
|
38047
|
-
inputFilePath = next ?
|
|
38017
|
+
inputFilePath = next ? path36.resolve(next) : inputFilePath;
|
|
38048
38018
|
index += 1;
|
|
38049
38019
|
continue;
|
|
38050
38020
|
}
|
|
38051
38021
|
if (current === "--output" || current === "-o") {
|
|
38052
38022
|
if (!next) throw new Error(`${current} requires a local output path.`);
|
|
38053
|
-
outputFilePath =
|
|
38023
|
+
outputFilePath = path36.resolve(next);
|
|
38054
38024
|
index += 1;
|
|
38055
38025
|
continue;
|
|
38056
38026
|
}
|
|
@@ -38160,7 +38130,7 @@ var parseArgs = (argv) => {
|
|
|
38160
38130
|
continue;
|
|
38161
38131
|
}
|
|
38162
38132
|
if (current === "--state-dir") {
|
|
38163
|
-
stateDir =
|
|
38133
|
+
stateDir = path36.resolve(next ?? stateDir);
|
|
38164
38134
|
index += 1;
|
|
38165
38135
|
continue;
|
|
38166
38136
|
}
|
|
@@ -38168,12 +38138,12 @@ var parseArgs = (argv) => {
|
|
|
38168
38138
|
if (!next) {
|
|
38169
38139
|
throw new Error("--paths-file requires a file path.");
|
|
38170
38140
|
}
|
|
38171
|
-
pathsFile =
|
|
38141
|
+
pathsFile = path36.resolve(expandHomePath(next));
|
|
38172
38142
|
index += 1;
|
|
38173
38143
|
continue;
|
|
38174
38144
|
}
|
|
38175
38145
|
if (current.startsWith("--paths-file=")) {
|
|
38176
|
-
pathsFile =
|
|
38146
|
+
pathsFile = path36.resolve(
|
|
38177
38147
|
expandHomePath(current.slice("--paths-file=".length))
|
|
38178
38148
|
);
|
|
38179
38149
|
continue;
|
|
@@ -38373,10 +38343,10 @@ var listDirectoryEntries = async (listDirectory, directoryPath) => {
|
|
|
38373
38343
|
if (left.type !== "directory" && right.type === "directory") {
|
|
38374
38344
|
return 1;
|
|
38375
38345
|
}
|
|
38376
|
-
return
|
|
38346
|
+
return path36.basename(left.path).localeCompare(path36.basename(right.path));
|
|
38377
38347
|
}).forEach((entry) => {
|
|
38378
38348
|
const suffix = entry.type === "directory" ? "/" : "";
|
|
38379
|
-
renderOutput(`${
|
|
38349
|
+
renderOutput(`${path36.basename(entry.path)}${suffix}`);
|
|
38380
38350
|
});
|
|
38381
38351
|
};
|
|
38382
38352
|
var listStores = async (listStoresMetadata) => {
|
|
@@ -38780,7 +38750,7 @@ var readWriteTextInput = async (inlineText, inputFilePath) => {
|
|
|
38780
38750
|
throw new Error("Provide either inline text or --file, not both.");
|
|
38781
38751
|
}
|
|
38782
38752
|
if (inputFilePath) {
|
|
38783
|
-
return
|
|
38753
|
+
return readFile11(inputFilePath, "utf8");
|
|
38784
38754
|
}
|
|
38785
38755
|
return inlineText ?? null;
|
|
38786
38756
|
};
|
|
@@ -38796,7 +38766,7 @@ var readRemoteTextFile = async (filePath, storeRef, client) => {
|
|
|
38796
38766
|
return text;
|
|
38797
38767
|
};
|
|
38798
38768
|
var normalizeRemotePath = (input) => {
|
|
38799
|
-
const normalized =
|
|
38769
|
+
const normalized = path36.posix.normalize(`/${input.trim()}`);
|
|
38800
38770
|
if (normalized.includes("\0")) {
|
|
38801
38771
|
throw new Error("Path contains an invalid null byte.");
|
|
38802
38772
|
}
|
|
@@ -39090,7 +39060,7 @@ var diffRemoteFiles = async ({
|
|
|
39090
39060
|
storeRef
|
|
39091
39061
|
}) => {
|
|
39092
39062
|
const leftText = await readRemoteTextFile(leftPath, storeRef, client);
|
|
39093
|
-
const rightText = localRight ? await
|
|
39063
|
+
const rightText = localRight ? await readFile11(path36.resolve(rightPath), "utf8") : await readRemoteTextFile(rightPath, storeRef, client);
|
|
39094
39064
|
return buildUnifiedDiff({
|
|
39095
39065
|
leftLabel: leftPath,
|
|
39096
39066
|
leftText,
|
|
@@ -39157,8 +39127,8 @@ var copyRemotePath = async (args, storeRef, client) => {
|
|
|
39157
39127
|
(entry) => entry.path.startsWith(`${normalizedSource}/`)
|
|
39158
39128
|
);
|
|
39159
39129
|
for (const entry of descendants) {
|
|
39160
|
-
const relativePath =
|
|
39161
|
-
const targetPath =
|
|
39130
|
+
const relativePath = path36.posix.relative(normalizedSource, entry.path);
|
|
39131
|
+
const targetPath = path36.posix.join(normalizedDestination, relativePath);
|
|
39162
39132
|
if (entry.type === "directory") {
|
|
39163
39133
|
await createRemoteDirectory(targetPath, storeRef, client);
|
|
39164
39134
|
continue;
|
|
@@ -39371,19 +39341,19 @@ var runDecryptCommand = async (rest, parsed, client) => {
|
|
|
39371
39341
|
);
|
|
39372
39342
|
};
|
|
39373
39343
|
var runEditCommand = async (rest, parsed, client) => {
|
|
39374
|
-
const filePath = parsed.inputFilePath ?? (rest[0] ?
|
|
39344
|
+
const filePath = parsed.inputFilePath ?? (rest[0] ? path36.resolve(rest[0]) : null);
|
|
39375
39345
|
if (!filePath) {
|
|
39376
39346
|
throw new Error(
|
|
39377
39347
|
`Usage: ${commandNames} edit (<localPath>|--file|-f <localPath>) [--password <password>] [--token <jwt>]`
|
|
39378
39348
|
);
|
|
39379
39349
|
}
|
|
39380
|
-
const encryptedText = await
|
|
39350
|
+
const encryptedText = await readFile11(filePath, "utf8");
|
|
39381
39351
|
const [password, userEncryption] = await Promise.all([
|
|
39382
39352
|
readEncryptionPassword(parsed),
|
|
39383
39353
|
readUserEncryption(client)
|
|
39384
39354
|
]);
|
|
39385
39355
|
const result = await editEncryptedText({
|
|
39386
|
-
edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension:
|
|
39356
|
+
edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension: path36.extname(filePath) }),
|
|
39387
39357
|
encryptedText,
|
|
39388
39358
|
password,
|
|
39389
39359
|
userEncryption: userEncryption.userEncryption
|
|
@@ -39636,11 +39606,11 @@ var runEncryptRekeyCommand = async (rest, parsed, client) => {
|
|
|
39636
39606
|
parsed.inputFilePath ? `Updated ${parsed.inputFilePath}. Run \`${commandNames} push\` (and commit) for store-synced projects.` : result.encryptedText
|
|
39637
39607
|
);
|
|
39638
39608
|
};
|
|
39639
|
-
var defaultEncryptionMigrationBackupPath = () =>
|
|
39640
|
-
var readEncryptionMigrationBackup = async (backupPath) => JSON.parse(await
|
|
39609
|
+
var defaultEncryptionMigrationBackupPath = () => path36.resolve(process.cwd(), "doctrine-encryption-migration.json");
|
|
39610
|
+
var readEncryptionMigrationBackup = async (backupPath) => JSON.parse(await readFile11(backupPath, "utf8"));
|
|
39641
39611
|
var writeEncryptionMigrationBackup = async (backupPath, backup) => {
|
|
39642
|
-
await
|
|
39643
|
-
await
|
|
39612
|
+
await mkdir8(path36.dirname(backupPath), { recursive: true });
|
|
39613
|
+
await writeFile8(backupPath, `${JSON.stringify(backup, null, 2)}
|
|
39644
39614
|
`, "utf8");
|
|
39645
39615
|
};
|
|
39646
39616
|
var confirmEncryptionMigration = async ({
|
|
@@ -39931,7 +39901,7 @@ var runEncryptionMigrateCommand = async (rest, parsed, client) => {
|
|
|
39931
39901
|
`Usage: ${commandNames} encryption migrate [backup-file] [--store <storeId>] [--password <password>] [--dry-run] [--yes]`
|
|
39932
39902
|
);
|
|
39933
39903
|
}
|
|
39934
|
-
const backupPath =
|
|
39904
|
+
const backupPath = path36.resolve(
|
|
39935
39905
|
rest[1] ?? defaultEncryptionMigrationBackupPath()
|
|
39936
39906
|
);
|
|
39937
39907
|
const password = await readEncryptionPassword(parsed);
|
|
@@ -40012,7 +39982,7 @@ var doesRemoteQueryMatchPath = (query, filePath) => {
|
|
|
40012
39982
|
if (query.startsWith("/")) {
|
|
40013
39983
|
return normalizedPath === query;
|
|
40014
39984
|
}
|
|
40015
|
-
const filename =
|
|
39985
|
+
const filename = path36.basename(filePath).toLowerCase();
|
|
40016
39986
|
return filename === query || normalizedPath === query || filename.includes(query) || normalizedPath.includes(query);
|
|
40017
39987
|
};
|
|
40018
39988
|
var queryRemoteFiles = async (query, storeFilters, client) => {
|
|
@@ -40084,7 +40054,7 @@ var printRemoteQueryMatches = (matches) => {
|
|
|
40084
40054
|
});
|
|
40085
40055
|
};
|
|
40086
40056
|
var normalizeRemoteDirectoryPath = (input) => {
|
|
40087
|
-
const normalized =
|
|
40057
|
+
const normalized = path36.posix.normalize(`/${input.trim()}`);
|
|
40088
40058
|
if (normalized.includes("\0")) {
|
|
40089
40059
|
throw new Error("Path contains an invalid null byte.");
|
|
40090
40060
|
}
|
|
@@ -40204,12 +40174,12 @@ var labelFromTreeDirectoryPath = (directoryPath) => {
|
|
|
40204
40174
|
if (directoryPath === "/") {
|
|
40205
40175
|
return "./";
|
|
40206
40176
|
}
|
|
40207
|
-
return `${
|
|
40177
|
+
return `${path36.posix.basename(directoryPath)}/`;
|
|
40208
40178
|
};
|
|
40209
40179
|
var doesTreeFilterMatchDirectory = (filter, directoryPath) => {
|
|
40210
40180
|
const normalizedFilter = filter.trim().toLowerCase();
|
|
40211
40181
|
const normalizedPath = directoryPath.toLowerCase();
|
|
40212
|
-
const basename3 =
|
|
40182
|
+
const basename3 = path36.posix.basename(directoryPath).toLowerCase();
|
|
40213
40183
|
return basename3.includes(normalizedFilter) || normalizedPath.includes(normalizedFilter);
|
|
40214
40184
|
};
|
|
40215
40185
|
var resolveTreeDirectoryPath = async ({
|
|
@@ -40264,7 +40234,7 @@ var printRemoteTreeChildren = async ({
|
|
|
40264
40234
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
40265
40235
|
const suffix = entry.type === "directory" ? "/" : "";
|
|
40266
40236
|
lines.push(
|
|
40267
|
-
`${prefix}${connector}${
|
|
40237
|
+
`${prefix}${connector}${path36.posix.basename(entry.path)}${suffix}`
|
|
40268
40238
|
);
|
|
40269
40239
|
if (entry.type === "directory") {
|
|
40270
40240
|
await printRemoteTreeChildren({
|
|
@@ -40874,9 +40844,9 @@ var shouldPrintCheckoutDetail = (detail, verbose) => {
|
|
|
40874
40844
|
var formatCheckoutDetail = (detail, options2) => {
|
|
40875
40845
|
const status = checkoutStatusLabel(detail, options2);
|
|
40876
40846
|
const direction = checkoutDirectionLabel(detail);
|
|
40877
|
-
const
|
|
40847
|
+
const path37 = formatCheckoutDetailPath(detail, options2.syncRules);
|
|
40878
40848
|
const reason = styleText.dim(checkoutDetailMessage(detail));
|
|
40879
|
-
return direction ? `${direction} ${status} ${
|
|
40849
|
+
return direction ? `${direction} ${status} ${path37} ${reason}` : `${status} ${path37} ${reason}`;
|
|
40880
40850
|
};
|
|
40881
40851
|
var formatCheckoutDetailPath = (detail, syncRules) => {
|
|
40882
40852
|
const localPath = formatLocalCheckoutPath(detail.relativePath);
|
|
@@ -41088,9 +41058,9 @@ var checkoutReportGroups = (details, options2) => {
|
|
|
41088
41058
|
);
|
|
41089
41059
|
};
|
|
41090
41060
|
var checkoutReportDetailLine = (detail, options2) => {
|
|
41091
|
-
const
|
|
41061
|
+
const path37 = formatCheckoutDetailPath(detail, options2.syncRules);
|
|
41092
41062
|
const message = detail.status === "failed" || detail.status === "skipped" || detail.status === "ignored" ? detail.message ?? checkoutDetailMessage(detail) : "";
|
|
41093
|
-
return message ? ` ${
|
|
41063
|
+
return message ? ` ${path37} ${styleText.dim(message)}` : ` ${path37}`;
|
|
41094
41064
|
};
|
|
41095
41065
|
var checkoutReportGroupBlock = ({
|
|
41096
41066
|
dryRun,
|
|
@@ -41217,13 +41187,13 @@ var statusChangeKind = (detail) => {
|
|
|
41217
41187
|
var formatStatusChange = (detail, syncRules) => {
|
|
41218
41188
|
const kind = statusChangeKind(detail);
|
|
41219
41189
|
const tone = kind === "deleted" ? "error" : kind === "added" ? "ok" : "warn";
|
|
41220
|
-
const
|
|
41221
|
-
return ` ${styleText.color(tone, kind.padEnd(8))} ${
|
|
41190
|
+
const path37 = formatCheckoutDetailPath(detail, syncRules);
|
|
41191
|
+
return ` ${styleText.color(tone, kind.padEnd(8))} ${path37}`;
|
|
41222
41192
|
};
|
|
41223
41193
|
var formatStatusBlock = (detail, syncRules) => {
|
|
41224
41194
|
const message = detail.message ? ` ${styleText.dim(detail.message)}` : "";
|
|
41225
|
-
const
|
|
41226
|
-
return ` ${styleText.color("error", "blocked ".padEnd(8))} ${
|
|
41195
|
+
const path37 = formatCheckoutDetailPath(detail, syncRules);
|
|
41196
|
+
return ` ${styleText.color("error", "blocked ".padEnd(8))} ${path37}${message}`;
|
|
41227
41197
|
};
|
|
41228
41198
|
var actionableStatusDetails = (result) => result.details.filter(
|
|
41229
41199
|
(detail) => detail.status === "succeeded" || detail.status === "deleted"
|
|
@@ -41882,15 +41852,15 @@ var runCheckoutStatus = async ({
|
|
|
41882
41852
|
var isCheckoutStateGitPath = isCheckoutStateDirectoryPath;
|
|
41883
41853
|
var checkoutFilesManifestPath2 = () => `${resolveCheckoutStateDirectoryName()}/files.json`;
|
|
41884
41854
|
var isInsideOrEqual = (parentPath, childPath2) => {
|
|
41885
|
-
const relativePath =
|
|
41886
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
41855
|
+
const relativePath = path36.relative(parentPath, childPath2);
|
|
41856
|
+
return relativePath === "" || !relativePath.startsWith("..") && !path36.isAbsolute(relativePath);
|
|
41887
41857
|
};
|
|
41888
41858
|
var resolveSyncTargetPaths = (checkout) => checkout.syncRules.map(
|
|
41889
|
-
(rule) =>
|
|
41859
|
+
(rule) => path36.resolve(checkout.rootDir, rule.target || ".")
|
|
41890
41860
|
);
|
|
41891
|
-
var resolveCheckoutManifestGitPath = (checkout, gitRoot) =>
|
|
41861
|
+
var resolveCheckoutManifestGitPath = (checkout, gitRoot) => path36.relative(
|
|
41892
41862
|
gitRoot,
|
|
41893
|
-
|
|
41863
|
+
path36.join(checkout.rootDir, checkoutFilesManifestPath2())
|
|
41894
41864
|
) || checkoutFilesManifestPath2();
|
|
41895
41865
|
var stageCheckoutManifest = async ({
|
|
41896
41866
|
checkout,
|
|
@@ -41916,7 +41886,7 @@ var assertGitChangesStayInSyncTargets = async ({
|
|
|
41916
41886
|
if (isCheckoutStateGitPath(entry.path)) {
|
|
41917
41887
|
return false;
|
|
41918
41888
|
}
|
|
41919
|
-
const absolutePath =
|
|
41889
|
+
const absolutePath = path36.resolve(gitRoot, entry.path);
|
|
41920
41890
|
return !allowedPaths.some(
|
|
41921
41891
|
(allowedPath) => isInsideOrEqual(allowedPath, absolutePath)
|
|
41922
41892
|
);
|
|
@@ -41938,7 +41908,7 @@ var stageGitSyncTargets = async ({
|
|
|
41938
41908
|
}) => {
|
|
41939
41909
|
const targetPaths = [];
|
|
41940
41910
|
for (const targetPath of resolveSyncTargetPaths(checkout)) {
|
|
41941
|
-
const relativePath =
|
|
41911
|
+
const relativePath = path36.relative(gitRoot, targetPath) || ".";
|
|
41942
41912
|
const tracked = await runGit(gitRoot, ["ls-files", "--", relativePath]);
|
|
41943
41913
|
if (await pathExists3(targetPath) || tracked.stdout.trim()) {
|
|
41944
41914
|
targetPaths.push(relativePath);
|
|
@@ -42238,7 +42208,7 @@ var writeCheckoutConfig = async (directoryPath, metadata, workspaceSlug, options
|
|
|
42238
42208
|
);
|
|
42239
42209
|
}
|
|
42240
42210
|
await writeForumProjectConfig(
|
|
42241
|
-
|
|
42211
|
+
path36.join(directoryPath, defaultProjectConfigFilename),
|
|
42242
42212
|
{
|
|
42243
42213
|
syncRules: [
|
|
42244
42214
|
{
|
|
@@ -42275,7 +42245,7 @@ var normalizeProjectConfigPath = (value, fieldName, allowCurrentDirectory = fals
|
|
|
42275
42245
|
}
|
|
42276
42246
|
throw new Error(`${fieldName} must be a non-empty relative path.`);
|
|
42277
42247
|
}
|
|
42278
|
-
if (
|
|
42248
|
+
if (path36.isAbsolute(value)) {
|
|
42279
42249
|
throw new Error(`${fieldName} must be a relative path.`);
|
|
42280
42250
|
}
|
|
42281
42251
|
const segments2 = trimmed.split("/");
|
|
@@ -42457,7 +42427,7 @@ var defaultCloneDirectoryName = (storeId) => {
|
|
|
42457
42427
|
var fsErrorCode = (error51) => error51 instanceof Error && "code" in error51 ? String(error51.code ?? "") : "";
|
|
42458
42428
|
var ensureGitMetadataExists = async (directoryPath) => {
|
|
42459
42429
|
try {
|
|
42460
|
-
await
|
|
42430
|
+
await lstat5(path36.join(directoryPath, ".git"));
|
|
42461
42431
|
} catch (error51) {
|
|
42462
42432
|
if (fsErrorCode(error51) === "ENOENT") {
|
|
42463
42433
|
throw new Error(
|
|
@@ -42495,8 +42465,8 @@ var confirmGitMetadataDeletion = async (localPath, assumeYes) => {
|
|
|
42495
42465
|
"Refusing to delete .git without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell."
|
|
42496
42466
|
);
|
|
42497
42467
|
}
|
|
42498
|
-
const gitPath =
|
|
42499
|
-
const gitignorePath =
|
|
42468
|
+
const gitPath = path36.join(localPath, ".git");
|
|
42469
|
+
const gitignorePath = path36.join(localPath, ".gitignore");
|
|
42500
42470
|
const confirmationPhrase = "DELETE GIT";
|
|
42501
42471
|
renderWarning("");
|
|
42502
42472
|
renderWarning("DANGER: Forum is about to remove Git from this checkout.");
|
|
@@ -42542,7 +42512,7 @@ var runGitConvertCommand = async ({
|
|
|
42542
42512
|
);
|
|
42543
42513
|
}
|
|
42544
42514
|
await writeForumProjectConfig(
|
|
42545
|
-
|
|
42515
|
+
path36.join(localPath, defaultProjectConfigFilename),
|
|
42546
42516
|
{
|
|
42547
42517
|
syncRules: [
|
|
42548
42518
|
{
|
|
@@ -42604,8 +42574,8 @@ var runGitConvertCommand = async ({
|
|
|
42604
42574
|
"Aborted before deleting Git metadata. The Forum push completed, but .git and .gitignore were left in place."
|
|
42605
42575
|
);
|
|
42606
42576
|
}
|
|
42607
|
-
await
|
|
42608
|
-
await
|
|
42577
|
+
await rm9(path36.join(localPath, ".gitignore"), { force: true });
|
|
42578
|
+
await rm9(path36.join(localPath, ".git"), { recursive: true, force: true });
|
|
42609
42579
|
renderOutput(
|
|
42610
42580
|
`${created ? "Created" : "Using existing"} store ${metadata.slug}`
|
|
42611
42581
|
);
|
|
@@ -42787,7 +42757,7 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
42787
42757
|
}
|
|
42788
42758
|
if (command === "hash" && parsed.local) {
|
|
42789
42759
|
const filePath = rest[0];
|
|
42790
|
-
renderOutput(await hashLocalFile(
|
|
42760
|
+
renderOutput(await hashLocalFile(path36.resolve(filePath)));
|
|
42791
42761
|
return;
|
|
42792
42762
|
}
|
|
42793
42763
|
const config2 = await resolveConfig(parsed);
|
|
@@ -43317,8 +43287,8 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
43317
43287
|
`Usage: ${commandNames} clone <storeId> [localPath] [--readonly]`
|
|
43318
43288
|
);
|
|
43319
43289
|
}
|
|
43320
|
-
const localPath =
|
|
43321
|
-
rest[1] ??
|
|
43290
|
+
const localPath = path36.resolve(
|
|
43291
|
+
rest[1] ?? path36.join(process.cwd(), defaultCloneDirectoryName(remoteInput))
|
|
43322
43292
|
);
|
|
43323
43293
|
const { metadata, workspaceSlug, storeRef } = await resolveReadableStore(
|
|
43324
43294
|
remoteInput,
|
|
@@ -43346,7 +43316,7 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
43346
43316
|
storeRef,
|
|
43347
43317
|
syncRules: checkout.syncRules
|
|
43348
43318
|
});
|
|
43349
|
-
renderOutput(`Cloned store ${metadata.slug} to ${
|
|
43319
|
+
renderOutput(`Cloned store ${metadata.slug} to ${path36.resolve(localPath)}`);
|
|
43350
43320
|
formatCheckoutResult("Pulled", result, {
|
|
43351
43321
|
detailsRendered: Boolean(progress),
|
|
43352
43322
|
verbose: parsed.verbose
|
|
@@ -43396,7 +43366,7 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
43396
43366
|
});
|
|
43397
43367
|
result.warnings.forEach((warning) => renderWarning(warning));
|
|
43398
43368
|
if (parsed.outputFilePath) {
|
|
43399
|
-
await
|
|
43369
|
+
await writeFile8(parsed.outputFilePath, result.text, "utf8");
|
|
43400
43370
|
} else {
|
|
43401
43371
|
renderOutput(result.text);
|
|
43402
43372
|
}
|