release-skill 0.2.7 → 0.2.8
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codebuddy-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +2 -2
- package/.kimi-plugin/plugin.json +1 -1
- package/CHANGELOG.md +21 -0
- package/INSTALL.md +4 -4
- package/INSTALL.zh-CN.md +4 -4
- package/README.md +10 -10
- package/README.zh-CN.md +10 -10
- package/adapters/claude/.claude-plugin/marketplace.json +1 -1
- package/adapters/claude/.claude-plugin/plugin.json +1 -1
- package/adapters/claude/bin/release-skill.bundle.mjs +1116 -618
- package/adapters/claude/schemas/.render-manifest.json +2 -2
- package/adapters/claude/schemas/release-project.schema.json +60 -0
- package/adapters/codex/.codex-plugin/plugin.json +2 -2
- package/adapters/codex/bin/release-skill.bundle.mjs +1116 -618
- package/adapters/codex/schemas/.render-manifest.json +2 -2
- package/adapters/codex/schemas/release-project.schema.json +60 -0
- package/adapters/kimi/.kimi-plugin/plugin.json +1 -1
- package/adapters/kimi/bin/release-skill.bundle.mjs +1116 -618
- package/adapters/kimi/schemas/.render-manifest.json +2 -2
- package/adapters/kimi/schemas/release-project.schema.json +60 -0
- package/adapters/workbuddy/.codebuddy-plugin/plugin.json +1 -1
- package/adapters/workbuddy/bin/release-skill.bundle.mjs +1116 -618
- package/adapters/workbuddy/schemas/.render-manifest.json +2 -2
- package/adapters/workbuddy/schemas/release-project.schema.json +60 -0
- package/bin/release-skill.bundle.mjs +1116 -618
- package/package.json +1 -1
- package/schemas/.render-manifest.json +2 -2
- package/schemas/release-project.schema.json +60 -0
- package/src/commands/prepare.mjs +46 -0
- package/src/core/config.mjs +48 -0
- package/src/core/public-surface.mjs +509 -0
|
@@ -9,7 +9,7 @@ const __bundlePkgRoot = __bundleResolve(__bundleDirname(__bundleFileURLToPath(im
|
|
|
9
9
|
// Provide a real require() for CJS packages bundled into ESM (e.g. yaml, ajv).
|
|
10
10
|
const __bundleRealRequire = __bundleCreateRequire(import.meta.url);
|
|
11
11
|
// Package identity injected at build time — closure-independent --version probe.
|
|
12
|
-
const __bundlePkg = Object.freeze({"name":"release-skill","version":"0.2.
|
|
12
|
+
const __bundlePkg = Object.freeze({"name":"release-skill","version":"0.2.8"});
|
|
13
13
|
|
|
14
14
|
var __create = Object.create;
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
@@ -4425,10 +4425,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
4425
4425
|
let offset = bm.offset;
|
|
4426
4426
|
let commentEnd = null;
|
|
4427
4427
|
for (const collItem of bm.items) {
|
|
4428
|
-
const { start, key, sep:
|
|
4428
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4429
4429
|
const keyProps = resolveProps.resolveProps(start, {
|
|
4430
4430
|
indicator: "explicit-key-ind",
|
|
4431
|
-
next: key ??
|
|
4431
|
+
next: key ?? sep7?.[0],
|
|
4432
4432
|
offset,
|
|
4433
4433
|
onError,
|
|
4434
4434
|
parentIndent: bm.indent,
|
|
@@ -4442,7 +4442,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4442
4442
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
4443
4443
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
4444
4444
|
}
|
|
4445
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
4445
|
+
if (!keyProps.anchor && !keyProps.tag && !sep7) {
|
|
4446
4446
|
commentEnd = keyProps.end;
|
|
4447
4447
|
if (keyProps.comment) {
|
|
4448
4448
|
if (map.comment)
|
|
@@ -4466,7 +4466,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4466
4466
|
ctx.atKey = false;
|
|
4467
4467
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
4468
4468
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4469
|
-
const valueProps = resolveProps.resolveProps(
|
|
4469
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
4470
4470
|
indicator: "map-value-ind",
|
|
4471
4471
|
next: value,
|
|
4472
4472
|
offset: keyNode.range[2],
|
|
@@ -4482,7 +4482,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4482
4482
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
4483
4483
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
4484
4484
|
}
|
|
4485
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
4485
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
|
|
4486
4486
|
if (ctx.schema.compat)
|
|
4487
4487
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
4488
4488
|
offset = valueNode.range[2];
|
|
@@ -4575,7 +4575,7 @@ var require_resolve_end = __commonJS({
|
|
|
4575
4575
|
let comment = "";
|
|
4576
4576
|
if (end) {
|
|
4577
4577
|
let hasSpace = false;
|
|
4578
|
-
let
|
|
4578
|
+
let sep7 = "";
|
|
4579
4579
|
for (const token of end) {
|
|
4580
4580
|
const { source, type } = token;
|
|
4581
4581
|
switch (type) {
|
|
@@ -4589,13 +4589,13 @@ var require_resolve_end = __commonJS({
|
|
|
4589
4589
|
if (!comment)
|
|
4590
4590
|
comment = cb;
|
|
4591
4591
|
else
|
|
4592
|
-
comment +=
|
|
4593
|
-
|
|
4592
|
+
comment += sep7 + cb;
|
|
4593
|
+
sep7 = "";
|
|
4594
4594
|
break;
|
|
4595
4595
|
}
|
|
4596
4596
|
case "newline":
|
|
4597
4597
|
if (comment)
|
|
4598
|
-
|
|
4598
|
+
sep7 += source;
|
|
4599
4599
|
hasSpace = true;
|
|
4600
4600
|
break;
|
|
4601
4601
|
default:
|
|
@@ -4639,18 +4639,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4639
4639
|
let offset = fc.offset + fc.start.source.length;
|
|
4640
4640
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
4641
4641
|
const collItem = fc.items[i];
|
|
4642
|
-
const { start, key, sep:
|
|
4642
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4643
4643
|
const props = resolveProps.resolveProps(start, {
|
|
4644
4644
|
flow: fcName,
|
|
4645
4645
|
indicator: "explicit-key-ind",
|
|
4646
|
-
next: key ??
|
|
4646
|
+
next: key ?? sep7?.[0],
|
|
4647
4647
|
offset,
|
|
4648
4648
|
onError,
|
|
4649
4649
|
parentIndent: fc.indent,
|
|
4650
4650
|
startOnNewline: false
|
|
4651
4651
|
});
|
|
4652
4652
|
if (!props.found) {
|
|
4653
|
-
if (!props.anchor && !props.tag && !
|
|
4653
|
+
if (!props.anchor && !props.tag && !sep7 && !value) {
|
|
4654
4654
|
if (i === 0 && props.comma)
|
|
4655
4655
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
4656
4656
|
else if (i < fc.items.length - 1)
|
|
@@ -4704,8 +4704,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4704
4704
|
}
|
|
4705
4705
|
}
|
|
4706
4706
|
}
|
|
4707
|
-
if (!isMap && !
|
|
4708
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4707
|
+
if (!isMap && !sep7 && !props.found) {
|
|
4708
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
|
|
4709
4709
|
coll.items.push(valueNode);
|
|
4710
4710
|
offset = valueNode.range[2];
|
|
4711
4711
|
if (isBlock(value))
|
|
@@ -4717,7 +4717,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4717
4717
|
if (isBlock(key))
|
|
4718
4718
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
4719
4719
|
ctx.atKey = false;
|
|
4720
|
-
const valueProps = resolveProps.resolveProps(
|
|
4720
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
4721
4721
|
flow: fcName,
|
|
4722
4722
|
indicator: "map-value-ind",
|
|
4723
4723
|
next: value,
|
|
@@ -4728,8 +4728,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4728
4728
|
});
|
|
4729
4729
|
if (valueProps.found) {
|
|
4730
4730
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
4731
|
-
if (
|
|
4732
|
-
for (const st of
|
|
4731
|
+
if (sep7)
|
|
4732
|
+
for (const st of sep7) {
|
|
4733
4733
|
if (st === valueProps.found)
|
|
4734
4734
|
break;
|
|
4735
4735
|
if (st.type === "newline") {
|
|
@@ -4746,7 +4746,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4746
4746
|
else
|
|
4747
4747
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
4748
4748
|
}
|
|
4749
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
4749
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
|
|
4750
4750
|
if (valueNode) {
|
|
4751
4751
|
if (isBlock(value))
|
|
4752
4752
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -4929,7 +4929,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4929
4929
|
chompStart = i + 1;
|
|
4930
4930
|
}
|
|
4931
4931
|
let value = "";
|
|
4932
|
-
let
|
|
4932
|
+
let sep7 = "";
|
|
4933
4933
|
let prevMoreIndented = false;
|
|
4934
4934
|
for (let i = 0; i < contentStart; ++i)
|
|
4935
4935
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -4946,24 +4946,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4946
4946
|
indent = "";
|
|
4947
4947
|
}
|
|
4948
4948
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
4949
|
-
value +=
|
|
4950
|
-
|
|
4949
|
+
value += sep7 + indent.slice(trimIndent) + content;
|
|
4950
|
+
sep7 = "\n";
|
|
4951
4951
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
4952
|
-
if (
|
|
4953
|
-
|
|
4954
|
-
else if (!prevMoreIndented &&
|
|
4955
|
-
|
|
4956
|
-
value +=
|
|
4957
|
-
|
|
4952
|
+
if (sep7 === " ")
|
|
4953
|
+
sep7 = "\n";
|
|
4954
|
+
else if (!prevMoreIndented && sep7 === "\n")
|
|
4955
|
+
sep7 = "\n\n";
|
|
4956
|
+
value += sep7 + indent.slice(trimIndent) + content;
|
|
4957
|
+
sep7 = "\n";
|
|
4958
4958
|
prevMoreIndented = true;
|
|
4959
4959
|
} else if (content === "") {
|
|
4960
|
-
if (
|
|
4960
|
+
if (sep7 === "\n")
|
|
4961
4961
|
value += "\n";
|
|
4962
4962
|
else
|
|
4963
|
-
|
|
4963
|
+
sep7 = "\n";
|
|
4964
4964
|
} else {
|
|
4965
|
-
value +=
|
|
4966
|
-
|
|
4965
|
+
value += sep7 + content;
|
|
4966
|
+
sep7 = " ";
|
|
4967
4967
|
prevMoreIndented = false;
|
|
4968
4968
|
}
|
|
4969
4969
|
}
|
|
@@ -5151,25 +5151,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
5151
5151
|
if (!match)
|
|
5152
5152
|
return source;
|
|
5153
5153
|
let res = match[1];
|
|
5154
|
-
let
|
|
5154
|
+
let sep7 = " ";
|
|
5155
5155
|
let pos = first.lastIndex;
|
|
5156
5156
|
line.lastIndex = pos;
|
|
5157
5157
|
while (match = line.exec(source)) {
|
|
5158
5158
|
if (match[1] === "") {
|
|
5159
|
-
if (
|
|
5160
|
-
res +=
|
|
5159
|
+
if (sep7 === "\n")
|
|
5160
|
+
res += sep7;
|
|
5161
5161
|
else
|
|
5162
|
-
|
|
5162
|
+
sep7 = "\n";
|
|
5163
5163
|
} else {
|
|
5164
|
-
res +=
|
|
5165
|
-
|
|
5164
|
+
res += sep7 + match[1];
|
|
5165
|
+
sep7 = " ";
|
|
5166
5166
|
}
|
|
5167
5167
|
pos = line.lastIndex;
|
|
5168
5168
|
}
|
|
5169
5169
|
const last = /[ \t]*(.*)/sy;
|
|
5170
5170
|
last.lastIndex = pos;
|
|
5171
5171
|
match = last.exec(source);
|
|
5172
|
-
return res +
|
|
5172
|
+
return res + sep7 + (match?.[1] ?? "");
|
|
5173
5173
|
}
|
|
5174
5174
|
__name(foldLines, "foldLines");
|
|
5175
5175
|
function doubleQuotedValue(source, onError) {
|
|
@@ -6003,14 +6003,14 @@ var require_cst_stringify = __commonJS({
|
|
|
6003
6003
|
}
|
|
6004
6004
|
}
|
|
6005
6005
|
__name(stringifyToken, "stringifyToken");
|
|
6006
|
-
function stringifyItem({ start, key, sep:
|
|
6006
|
+
function stringifyItem({ start, key, sep: sep7, value }) {
|
|
6007
6007
|
let res = "";
|
|
6008
6008
|
for (const st of start)
|
|
6009
6009
|
res += st.source;
|
|
6010
6010
|
if (key)
|
|
6011
6011
|
res += stringifyToken(key);
|
|
6012
|
-
if (
|
|
6013
|
-
for (const st of
|
|
6012
|
+
if (sep7)
|
|
6013
|
+
for (const st of sep7)
|
|
6014
6014
|
res += st.source;
|
|
6015
6015
|
if (value)
|
|
6016
6016
|
res += stringifyToken(value);
|
|
@@ -7199,18 +7199,18 @@ var require_parser = __commonJS({
|
|
|
7199
7199
|
if (this.type === "map-value-ind") {
|
|
7200
7200
|
const prev = getPrevProps(this.peek(2));
|
|
7201
7201
|
const start = getFirstKeyStartProps(prev);
|
|
7202
|
-
let
|
|
7202
|
+
let sep7;
|
|
7203
7203
|
if (scalar.end) {
|
|
7204
|
-
|
|
7205
|
-
|
|
7204
|
+
sep7 = scalar.end;
|
|
7205
|
+
sep7.push(this.sourceToken);
|
|
7206
7206
|
delete scalar.end;
|
|
7207
7207
|
} else
|
|
7208
|
-
|
|
7208
|
+
sep7 = [this.sourceToken];
|
|
7209
7209
|
const map = {
|
|
7210
7210
|
type: "block-map",
|
|
7211
7211
|
offset: scalar.offset,
|
|
7212
7212
|
indent: scalar.indent,
|
|
7213
|
-
items: [{ start, key: scalar, sep:
|
|
7213
|
+
items: [{ start, key: scalar, sep: sep7 }]
|
|
7214
7214
|
};
|
|
7215
7215
|
this.onKeyLine = true;
|
|
7216
7216
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -7363,15 +7363,15 @@ var require_parser = __commonJS({
|
|
|
7363
7363
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
7364
7364
|
const start2 = getFirstKeyStartProps(it.start);
|
|
7365
7365
|
const key = it.key;
|
|
7366
|
-
const
|
|
7367
|
-
|
|
7366
|
+
const sep7 = it.sep;
|
|
7367
|
+
sep7.push(this.sourceToken);
|
|
7368
7368
|
delete it.key;
|
|
7369
7369
|
delete it.sep;
|
|
7370
7370
|
this.stack.push({
|
|
7371
7371
|
type: "block-map",
|
|
7372
7372
|
offset: this.offset,
|
|
7373
7373
|
indent: this.indent,
|
|
7374
|
-
items: [{ start: start2, key, sep:
|
|
7374
|
+
items: [{ start: start2, key, sep: sep7 }]
|
|
7375
7375
|
});
|
|
7376
7376
|
} else if (start.length > 0) {
|
|
7377
7377
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -7565,13 +7565,13 @@ var require_parser = __commonJS({
|
|
|
7565
7565
|
const prev = getPrevProps(parent);
|
|
7566
7566
|
const start = getFirstKeyStartProps(prev);
|
|
7567
7567
|
fixFlowSeqItems(fc);
|
|
7568
|
-
const
|
|
7569
|
-
|
|
7568
|
+
const sep7 = fc.end.splice(1, fc.end.length);
|
|
7569
|
+
sep7.push(this.sourceToken);
|
|
7570
7570
|
const map = {
|
|
7571
7571
|
type: "block-map",
|
|
7572
7572
|
offset: fc.offset,
|
|
7573
7573
|
indent: fc.indent,
|
|
7574
|
-
items: [{ start, key: fc, sep:
|
|
7574
|
+
items: [{ start, key: fc, sep: sep7 }]
|
|
7575
7575
|
};
|
|
7576
7576
|
this.onKeyLine = true;
|
|
7577
7577
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -11062,7 +11062,7 @@ var require_compile = __commonJS({
|
|
|
11062
11062
|
const schOrFunc = root.refs[ref];
|
|
11063
11063
|
if (schOrFunc)
|
|
11064
11064
|
return schOrFunc;
|
|
11065
|
-
let _sch =
|
|
11065
|
+
let _sch = resolve29.call(this, root, ref);
|
|
11066
11066
|
if (_sch === void 0) {
|
|
11067
11067
|
const schema2 = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
11068
11068
|
const { schemaId } = this.opts;
|
|
@@ -11093,13 +11093,13 @@ var require_compile = __commonJS({
|
|
|
11093
11093
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
11094
11094
|
}
|
|
11095
11095
|
__name(sameSchemaEnv, "sameSchemaEnv");
|
|
11096
|
-
function
|
|
11096
|
+
function resolve29(root, ref) {
|
|
11097
11097
|
let sch;
|
|
11098
11098
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
11099
11099
|
ref = sch;
|
|
11100
11100
|
return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
|
|
11101
11101
|
}
|
|
11102
|
-
__name(
|
|
11102
|
+
__name(resolve29, "resolve");
|
|
11103
11103
|
function resolveSchema(root, ref) {
|
|
11104
11104
|
const p = this.opts.uriResolver.parse(ref);
|
|
11105
11105
|
const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
|
|
@@ -11751,56 +11751,56 @@ var require_fast_uri = __commonJS({
|
|
|
11751
11751
|
return uri;
|
|
11752
11752
|
}
|
|
11753
11753
|
__name(normalize4, "normalize");
|
|
11754
|
-
function
|
|
11754
|
+
function resolve29(baseURI, relativeURI, options) {
|
|
11755
11755
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
11756
11756
|
const resolved = resolveComponent(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
11757
11757
|
schemelessOptions.skipEscape = true;
|
|
11758
11758
|
return serialize(resolved, schemelessOptions);
|
|
11759
11759
|
}
|
|
11760
|
-
__name(
|
|
11761
|
-
function resolveComponent(base,
|
|
11760
|
+
__name(resolve29, "resolve");
|
|
11761
|
+
function resolveComponent(base, relative26, options, skipNormalization) {
|
|
11762
11762
|
const target = {};
|
|
11763
11763
|
if (!skipNormalization) {
|
|
11764
11764
|
base = parse2(serialize(base, options), options);
|
|
11765
|
-
|
|
11765
|
+
relative26 = parse2(serialize(relative26, options), options);
|
|
11766
11766
|
}
|
|
11767
11767
|
options = options || {};
|
|
11768
|
-
if (!options.tolerant &&
|
|
11769
|
-
target.scheme =
|
|
11770
|
-
target.userinfo =
|
|
11771
|
-
target.host =
|
|
11772
|
-
target.port =
|
|
11773
|
-
target.path = removeDotSegments(
|
|
11774
|
-
target.query =
|
|
11768
|
+
if (!options.tolerant && relative26.scheme) {
|
|
11769
|
+
target.scheme = relative26.scheme;
|
|
11770
|
+
target.userinfo = relative26.userinfo;
|
|
11771
|
+
target.host = relative26.host;
|
|
11772
|
+
target.port = relative26.port;
|
|
11773
|
+
target.path = removeDotSegments(relative26.path || "");
|
|
11774
|
+
target.query = relative26.query;
|
|
11775
11775
|
} else {
|
|
11776
|
-
if (
|
|
11777
|
-
target.userinfo =
|
|
11778
|
-
target.host =
|
|
11779
|
-
target.port =
|
|
11780
|
-
target.path = removeDotSegments(
|
|
11781
|
-
target.query =
|
|
11776
|
+
if (relative26.userinfo !== void 0 || relative26.host !== void 0 || relative26.port !== void 0) {
|
|
11777
|
+
target.userinfo = relative26.userinfo;
|
|
11778
|
+
target.host = relative26.host;
|
|
11779
|
+
target.port = relative26.port;
|
|
11780
|
+
target.path = removeDotSegments(relative26.path || "");
|
|
11781
|
+
target.query = relative26.query;
|
|
11782
11782
|
} else {
|
|
11783
|
-
if (!
|
|
11783
|
+
if (!relative26.path) {
|
|
11784
11784
|
target.path = base.path;
|
|
11785
|
-
if (
|
|
11786
|
-
target.query =
|
|
11785
|
+
if (relative26.query !== void 0) {
|
|
11786
|
+
target.query = relative26.query;
|
|
11787
11787
|
} else {
|
|
11788
11788
|
target.query = base.query;
|
|
11789
11789
|
}
|
|
11790
11790
|
} else {
|
|
11791
|
-
if (
|
|
11792
|
-
target.path = removeDotSegments(
|
|
11791
|
+
if (relative26.path[0] === "/") {
|
|
11792
|
+
target.path = removeDotSegments(relative26.path);
|
|
11793
11793
|
} else {
|
|
11794
11794
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
11795
|
-
target.path = "/" +
|
|
11795
|
+
target.path = "/" + relative26.path;
|
|
11796
11796
|
} else if (!base.path) {
|
|
11797
|
-
target.path =
|
|
11797
|
+
target.path = relative26.path;
|
|
11798
11798
|
} else {
|
|
11799
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
11799
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative26.path;
|
|
11800
11800
|
}
|
|
11801
11801
|
target.path = removeDotSegments(target.path);
|
|
11802
11802
|
}
|
|
11803
|
-
target.query =
|
|
11803
|
+
target.query = relative26.query;
|
|
11804
11804
|
}
|
|
11805
11805
|
target.userinfo = base.userinfo;
|
|
11806
11806
|
target.host = base.host;
|
|
@@ -11808,7 +11808,7 @@ var require_fast_uri = __commonJS({
|
|
|
11808
11808
|
}
|
|
11809
11809
|
target.scheme = base.scheme;
|
|
11810
11810
|
}
|
|
11811
|
-
target.fragment =
|
|
11811
|
+
target.fragment = relative26.fragment;
|
|
11812
11812
|
return target;
|
|
11813
11813
|
}
|
|
11814
11814
|
__name(resolveComponent, "resolveComponent");
|
|
@@ -12019,7 +12019,7 @@ var require_fast_uri = __commonJS({
|
|
|
12019
12019
|
var fastUri = {
|
|
12020
12020
|
SCHEMES,
|
|
12021
12021
|
normalize: normalize4,
|
|
12022
|
-
resolve:
|
|
12022
|
+
resolve: resolve29,
|
|
12023
12023
|
resolveComponent,
|
|
12024
12024
|
equal,
|
|
12025
12025
|
serialize,
|
|
@@ -17089,8 +17089,8 @@ function kimiAuthorityDir(context, planDigest, plugin) {
|
|
|
17089
17089
|
const base = resolve4(context.root, ".release-skill", "kimi-attestations");
|
|
17090
17090
|
const dir = resolve4(base, plugin);
|
|
17091
17091
|
const rel = relative2(base, dir);
|
|
17092
|
-
const
|
|
17093
|
-
if (rel === "" || rel === ".." || isAbsolute2(rel) || rel.startsWith(`..${
|
|
17092
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
17093
|
+
if (rel === "" || rel === ".." || isAbsolute2(rel) || rel.startsWith(`..${sep7}`) || rel.split(sep7).some((segment) => segment === ".." || segment === "")) {
|
|
17094
17094
|
throw new Error("kimi attestation authority path escapes its base");
|
|
17095
17095
|
}
|
|
17096
17096
|
return dir;
|
|
@@ -17429,8 +17429,8 @@ function codebuddyAuthorityDir(context, planDigest, plugin) {
|
|
|
17429
17429
|
const base = resolve5(context.root, ".release-skill", "codebuddy-attestations");
|
|
17430
17430
|
const dir = resolve5(base, plugin);
|
|
17431
17431
|
const rel = relative3(base, dir);
|
|
17432
|
-
const
|
|
17433
|
-
if (rel === "" || rel === ".." || isAbsolute3(rel) || rel.startsWith(`..${
|
|
17432
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
17433
|
+
if (rel === "" || rel === ".." || isAbsolute3(rel) || rel.startsWith(`..${sep7}`) || rel.split(sep7).some((segment) => segment === ".." || segment === "")) {
|
|
17434
17434
|
throw new Error("codebuddy attestation authority path escapes its base");
|
|
17435
17435
|
}
|
|
17436
17436
|
return dir;
|
|
@@ -17786,8 +17786,8 @@ function codexAuthorityDir(context, planDigest, plugin) {
|
|
|
17786
17786
|
const base = resolve6(context.root, ".release-skill", "codex-attestations");
|
|
17787
17787
|
const dir = resolve6(base, plugin);
|
|
17788
17788
|
const rel = relative4(base, dir);
|
|
17789
|
-
const
|
|
17790
|
-
if (rel === "" || rel === ".." || isAbsolute4(rel) || rel.startsWith(`..${
|
|
17789
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
17790
|
+
if (rel === "" || rel === ".." || isAbsolute4(rel) || rel.startsWith(`..${sep7}`) || rel.split(sep7).some((segment) => segment === ".." || segment === "")) {
|
|
17791
17791
|
throw new Error("codex attestation authority path escapes its base");
|
|
17792
17792
|
}
|
|
17793
17793
|
return dir;
|
|
@@ -21523,11 +21523,426 @@ var init_public_path = __esm({
|
|
|
21523
21523
|
}
|
|
21524
21524
|
});
|
|
21525
21525
|
|
|
21526
|
+
// src/core/public-surface.mjs
|
|
21527
|
+
import { lstat as lstat6, readdir as readdir4, realpath as realpath6 } from "node:fs/promises";
|
|
21528
|
+
import {
|
|
21529
|
+
isAbsolute as isAbsolute8,
|
|
21530
|
+
join as join9,
|
|
21531
|
+
relative as relative8,
|
|
21532
|
+
resolve as resolve11,
|
|
21533
|
+
sep as sep3
|
|
21534
|
+
} from "node:path";
|
|
21535
|
+
function compareStrings(left, right) {
|
|
21536
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
21537
|
+
}
|
|
21538
|
+
function toPosixPath(path3) {
|
|
21539
|
+
return path3.split(sep3).join("/");
|
|
21540
|
+
}
|
|
21541
|
+
function isContainedOrEqual(root, candidate) {
|
|
21542
|
+
const rel = relative8(root, candidate);
|
|
21543
|
+
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep3}`) && !isAbsolute8(rel);
|
|
21544
|
+
}
|
|
21545
|
+
function isWorkspaceControlPath(workspaceRoot, candidate) {
|
|
21546
|
+
return ROOT_CONTROL_DIRECTORIES.some((name) => isContainedOrEqual(join9(workspaceRoot, name), candidate));
|
|
21547
|
+
}
|
|
21548
|
+
function failConfig(message, details) {
|
|
21549
|
+
throw new ReleaseError(CONFIG_INVALID, message, details);
|
|
21550
|
+
}
|
|
21551
|
+
function validatePublicSurfaceGlob(glob) {
|
|
21552
|
+
if (typeof glob !== "string" || glob.length === 0) {
|
|
21553
|
+
failConfig("public surface glob must be a non-empty string", {
|
|
21554
|
+
reason: "PUBLIC_SURFACE_GLOB_INVALID",
|
|
21555
|
+
glob
|
|
21556
|
+
});
|
|
21557
|
+
}
|
|
21558
|
+
if (glob.startsWith("/") || glob.startsWith("./") || glob.includes("\\") || glob.includes("\0") || glob.includes(":") || glob.endsWith("/") || UNSUPPORTED_GLOB_CHARACTERS.test(glob)) {
|
|
21559
|
+
failConfig(`unsupported or unsafe public surface glob "${glob}"`, {
|
|
21560
|
+
reason: "PUBLIC_SURFACE_GLOB_INVALID",
|
|
21561
|
+
glob
|
|
21562
|
+
});
|
|
21563
|
+
}
|
|
21564
|
+
const segments = glob.split("/");
|
|
21565
|
+
if (segments.some((segment) => segment === "" || segment === "." || segment === ".." || segment.includes("**") && segment !== "**")) {
|
|
21566
|
+
failConfig(`unsupported or unsafe public surface glob "${glob}"`, {
|
|
21567
|
+
reason: "PUBLIC_SURFACE_GLOB_INVALID",
|
|
21568
|
+
glob
|
|
21569
|
+
});
|
|
21570
|
+
}
|
|
21571
|
+
return glob;
|
|
21572
|
+
}
|
|
21573
|
+
function compileGlob(glob) {
|
|
21574
|
+
validatePublicSurfaceGlob(glob);
|
|
21575
|
+
let source = "";
|
|
21576
|
+
for (let index = 0; index < glob.length; ) {
|
|
21577
|
+
if (glob.startsWith("**/", index)) {
|
|
21578
|
+
source += "(?:.*/)?";
|
|
21579
|
+
index += 3;
|
|
21580
|
+
continue;
|
|
21581
|
+
}
|
|
21582
|
+
if (glob.startsWith("**", index)) {
|
|
21583
|
+
source += ".*";
|
|
21584
|
+
index += 2;
|
|
21585
|
+
continue;
|
|
21586
|
+
}
|
|
21587
|
+
const character = glob[index];
|
|
21588
|
+
if (character === "*") {
|
|
21589
|
+
source += "[^/]*";
|
|
21590
|
+
} else if (character === "?") {
|
|
21591
|
+
source += "[^/]";
|
|
21592
|
+
} else {
|
|
21593
|
+
source += character.replace(/[.+^$|\\]/gu, "\\$&");
|
|
21594
|
+
}
|
|
21595
|
+
index += 1;
|
|
21596
|
+
}
|
|
21597
|
+
return new RegExp(`^${source}$`, "u");
|
|
21598
|
+
}
|
|
21599
|
+
function compilePatterns(patterns) {
|
|
21600
|
+
return (patterns ?? []).map((pattern) => ({
|
|
21601
|
+
pattern,
|
|
21602
|
+
regexp: compileGlob(pattern)
|
|
21603
|
+
}));
|
|
21604
|
+
}
|
|
21605
|
+
function matchingPatterns(matchers, path3) {
|
|
21606
|
+
return matchers.filter(({ regexp }) => regexp.test(path3)).map(({ pattern }) => pattern).sort(compareStrings);
|
|
21607
|
+
}
|
|
21608
|
+
async function assertSafeDirectoryPath({
|
|
21609
|
+
workspaceRoot,
|
|
21610
|
+
containmentRoot,
|
|
21611
|
+
candidate,
|
|
21612
|
+
unitId,
|
|
21613
|
+
configuredRoot
|
|
21614
|
+
}) {
|
|
21615
|
+
if (!isContainedOrEqual(containmentRoot, candidate)) {
|
|
21616
|
+
failConfig(`public surface scan root escapes its ${containmentRoot === workspaceRoot ? "workspace" : "unit"} scope`, {
|
|
21617
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21618
|
+
unitId,
|
|
21619
|
+
root: configuredRoot
|
|
21620
|
+
});
|
|
21621
|
+
}
|
|
21622
|
+
const rel = relative8(workspaceRoot, candidate);
|
|
21623
|
+
if (!isContainedOrEqual(workspaceRoot, candidate)) {
|
|
21624
|
+
failConfig("public surface scan root escapes the workspace", {
|
|
21625
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21626
|
+
unitId,
|
|
21627
|
+
root: configuredRoot
|
|
21628
|
+
});
|
|
21629
|
+
}
|
|
21630
|
+
let cursor = workspaceRoot;
|
|
21631
|
+
for (const segment of rel.split(sep3).filter(Boolean)) {
|
|
21632
|
+
cursor = join9(cursor, segment);
|
|
21633
|
+
let stat9;
|
|
21634
|
+
try {
|
|
21635
|
+
stat9 = await lstat6(cursor);
|
|
21636
|
+
} catch (error) {
|
|
21637
|
+
failConfig(`cannot inspect public surface scan root "${configuredRoot}"`, {
|
|
21638
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21639
|
+
unitId,
|
|
21640
|
+
root: configuredRoot,
|
|
21641
|
+
cause: error.code ?? "UNKNOWN"
|
|
21642
|
+
});
|
|
21643
|
+
}
|
|
21644
|
+
if (stat9.isSymbolicLink() || !stat9.isDirectory()) {
|
|
21645
|
+
failConfig(`public surface scan root or ancestor is not a physical directory: "${configuredRoot}"`, {
|
|
21646
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21647
|
+
unitId,
|
|
21648
|
+
root: configuredRoot
|
|
21649
|
+
});
|
|
21650
|
+
}
|
|
21651
|
+
}
|
|
21652
|
+
let physicalCandidate;
|
|
21653
|
+
let physicalContainmentRoot;
|
|
21654
|
+
try {
|
|
21655
|
+
[physicalCandidate, physicalContainmentRoot] = await Promise.all([
|
|
21656
|
+
realpath6(candidate),
|
|
21657
|
+
realpath6(containmentRoot)
|
|
21658
|
+
]);
|
|
21659
|
+
} catch (error) {
|
|
21660
|
+
failConfig(`cannot resolve public surface scan root "${configuredRoot}"`, {
|
|
21661
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21662
|
+
unitId,
|
|
21663
|
+
root: configuredRoot,
|
|
21664
|
+
cause: error.code ?? "UNKNOWN"
|
|
21665
|
+
});
|
|
21666
|
+
}
|
|
21667
|
+
if (!isContainedOrEqual(workspaceRoot, physicalCandidate) || !isContainedOrEqual(physicalContainmentRoot, physicalCandidate)) {
|
|
21668
|
+
failConfig(`public surface scan root escapes physical containment: "${configuredRoot}"`, {
|
|
21669
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21670
|
+
unitId,
|
|
21671
|
+
root: configuredRoot
|
|
21672
|
+
});
|
|
21673
|
+
}
|
|
21674
|
+
return physicalCandidate;
|
|
21675
|
+
}
|
|
21676
|
+
async function resolveScanRoots({ root, unit }) {
|
|
21677
|
+
let workspaceRoot;
|
|
21678
|
+
try {
|
|
21679
|
+
workspaceRoot = await realpath6(resolve11(root));
|
|
21680
|
+
} catch (error) {
|
|
21681
|
+
failConfig("cannot resolve public surface workspace root", {
|
|
21682
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21683
|
+
unitId: unit.id,
|
|
21684
|
+
cause: error.code ?? "UNKNOWN"
|
|
21685
|
+
});
|
|
21686
|
+
}
|
|
21687
|
+
const unitSource = canonicalPublicPath(unit.source, { allowDot: true }).path;
|
|
21688
|
+
const unitRoot = resolve11(workspaceRoot, unitSource);
|
|
21689
|
+
await assertSafeDirectoryPath({
|
|
21690
|
+
workspaceRoot,
|
|
21691
|
+
containmentRoot: workspaceRoot,
|
|
21692
|
+
candidate: unitRoot,
|
|
21693
|
+
unitId: unit.id,
|
|
21694
|
+
configuredRoot: unit.source
|
|
21695
|
+
});
|
|
21696
|
+
const resolvedRoots = [];
|
|
21697
|
+
for (const [index, rule] of unit.expectedPublicSurface.scanRoots.entries()) {
|
|
21698
|
+
const sourceScope = rule.sourceScope ?? "unit";
|
|
21699
|
+
const configuredRoot = rule.root ?? ".";
|
|
21700
|
+
const rootPath = canonicalPublicPath(configuredRoot, { allowDot: true }).path;
|
|
21701
|
+
const scopeRoot = sourceScope === "workspace" ? workspaceRoot : unitRoot;
|
|
21702
|
+
const candidate = resolve11(scopeRoot, rootPath);
|
|
21703
|
+
if (isWorkspaceControlPath(workspaceRoot, candidate)) {
|
|
21704
|
+
failConfig(`public surface scan root cannot target workspace control paths: "${configuredRoot}"`, {
|
|
21705
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_CONTROL_PATH",
|
|
21706
|
+
unitId: unit.id,
|
|
21707
|
+
root: configuredRoot
|
|
21708
|
+
});
|
|
21709
|
+
}
|
|
21710
|
+
const physicalPath = await assertSafeDirectoryPath({
|
|
21711
|
+
workspaceRoot,
|
|
21712
|
+
containmentRoot: scopeRoot,
|
|
21713
|
+
candidate,
|
|
21714
|
+
unitId: unit.id,
|
|
21715
|
+
configuredRoot
|
|
21716
|
+
});
|
|
21717
|
+
resolvedRoots.push({
|
|
21718
|
+
index,
|
|
21719
|
+
sourceScope,
|
|
21720
|
+
configuredRoot,
|
|
21721
|
+
physicalPath,
|
|
21722
|
+
includeMatchers: compilePatterns(rule.include),
|
|
21723
|
+
excludeMatchers: compilePatterns(rule.exclude)
|
|
21724
|
+
});
|
|
21725
|
+
}
|
|
21726
|
+
for (let leftIndex = 0; leftIndex < resolvedRoots.length; leftIndex += 1) {
|
|
21727
|
+
for (let rightIndex = leftIndex + 1; rightIndex < resolvedRoots.length; rightIndex += 1) {
|
|
21728
|
+
const left = resolvedRoots[leftIndex];
|
|
21729
|
+
const right = resolvedRoots[rightIndex];
|
|
21730
|
+
if (isContainedOrEqual(left.physicalPath, right.physicalPath) || isContainedOrEqual(right.physicalPath, left.physicalPath)) {
|
|
21731
|
+
failConfig(`public surface scan roots overlap for unit "${unit.id}"`, {
|
|
21732
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_OVERLAP",
|
|
21733
|
+
unitId: unit.id,
|
|
21734
|
+
scanRoots: [
|
|
21735
|
+
{ index: left.index, sourceScope: left.sourceScope, root: left.configuredRoot },
|
|
21736
|
+
{ index: right.index, sourceScope: right.sourceScope, root: right.configuredRoot }
|
|
21737
|
+
]
|
|
21738
|
+
});
|
|
21739
|
+
}
|
|
21740
|
+
}
|
|
21741
|
+
}
|
|
21742
|
+
return { workspaceRoot, resolvedRoots };
|
|
21743
|
+
}
|
|
21744
|
+
function unsupportedEntryError({ unit, rule, workspaceRelative, relativePath, entry, includePatterns, excludePatterns }) {
|
|
21745
|
+
return new ReleaseError(
|
|
21746
|
+
GATE_FAILED,
|
|
21747
|
+
`public surface contains an unsupported non-regular entry "${workspaceRelative}"`,
|
|
21748
|
+
{
|
|
21749
|
+
reason: "PUBLIC_SURFACE_UNSUPPORTED_ENTRY",
|
|
21750
|
+
unitId: unit.id,
|
|
21751
|
+
sourceScope: rule.sourceScope,
|
|
21752
|
+
from: workspaceRelative,
|
|
21753
|
+
scanRoot: rule.configuredRoot,
|
|
21754
|
+
relativePath,
|
|
21755
|
+
entryType: entry.isSymbolicLink() ? "symlink" : "special",
|
|
21756
|
+
includePatterns,
|
|
21757
|
+
excludePatterns
|
|
21758
|
+
}
|
|
21759
|
+
);
|
|
21760
|
+
}
|
|
21761
|
+
async function scanRoot({ workspaceRoot, unit, rule }) {
|
|
21762
|
+
const files = [];
|
|
21763
|
+
let skippedNonRegularCount = 0;
|
|
21764
|
+
const skippedControlPaths = new Set(
|
|
21765
|
+
ROOT_CONTROL_DIRECTORIES.map((name) => join9(workspaceRoot, name))
|
|
21766
|
+
);
|
|
21767
|
+
async function walk(directory, relativeDirectory) {
|
|
21768
|
+
let entries;
|
|
21769
|
+
try {
|
|
21770
|
+
entries = await readdir4(directory, { withFileTypes: true });
|
|
21771
|
+
} catch (error) {
|
|
21772
|
+
failConfig(`cannot read public surface scan root for unit "${unit.id}"`, {
|
|
21773
|
+
reason: "PUBLIC_SURFACE_SCAN_ROOT_UNSAFE",
|
|
21774
|
+
unitId: unit.id,
|
|
21775
|
+
root: rule.configuredRoot,
|
|
21776
|
+
cause: error.code ?? "UNKNOWN"
|
|
21777
|
+
});
|
|
21778
|
+
}
|
|
21779
|
+
entries.sort((left, right) => compareStrings(left.name, right.name));
|
|
21780
|
+
for (const entry of entries) {
|
|
21781
|
+
const absolutePath = join9(directory, entry.name);
|
|
21782
|
+
if (skippedControlPaths.has(absolutePath)) continue;
|
|
21783
|
+
if (entry.isDirectory()) {
|
|
21784
|
+
const childRelative = relativeDirectory ? `${relativeDirectory}/${entry.name}` : entry.name;
|
|
21785
|
+
await walk(absolutePath, childRelative);
|
|
21786
|
+
continue;
|
|
21787
|
+
}
|
|
21788
|
+
const relativePath = relativeDirectory ? `${relativeDirectory}/${entry.name}` : entry.name;
|
|
21789
|
+
const includePatterns = matchingPatterns(rule.includeMatchers, relativePath);
|
|
21790
|
+
const excludePatterns = matchingPatterns(rule.excludeMatchers, relativePath);
|
|
21791
|
+
const workspaceRelative = canonicalPublicPath(
|
|
21792
|
+
toPosixPath(relative8(workspaceRoot, absolutePath))
|
|
21793
|
+
).path;
|
|
21794
|
+
if (!entry.isFile()) {
|
|
21795
|
+
if (includePatterns.length === 0 && excludePatterns.length > 0) {
|
|
21796
|
+
skippedNonRegularCount += 1;
|
|
21797
|
+
continue;
|
|
21798
|
+
}
|
|
21799
|
+
throw unsupportedEntryError({
|
|
21800
|
+
unit,
|
|
21801
|
+
rule,
|
|
21802
|
+
workspaceRelative,
|
|
21803
|
+
relativePath,
|
|
21804
|
+
entry,
|
|
21805
|
+
includePatterns,
|
|
21806
|
+
excludePatterns
|
|
21807
|
+
});
|
|
21808
|
+
}
|
|
21809
|
+
files.push({
|
|
21810
|
+
identity: `${rule.sourceScope}\0${workspaceRelative}`,
|
|
21811
|
+
sourceScope: rule.sourceScope,
|
|
21812
|
+
from: workspaceRelative,
|
|
21813
|
+
scanRoot: rule.configuredRoot,
|
|
21814
|
+
relativePath,
|
|
21815
|
+
includePatterns,
|
|
21816
|
+
excludePatterns
|
|
21817
|
+
});
|
|
21818
|
+
}
|
|
21819
|
+
}
|
|
21820
|
+
__name(walk, "walk");
|
|
21821
|
+
await walk(rule.physicalPath, "");
|
|
21822
|
+
return { files, skippedNonRegularCount };
|
|
21823
|
+
}
|
|
21824
|
+
function publicSourceIdentity(sourceScope, from) {
|
|
21825
|
+
return `${sourceScope}\0${from}`;
|
|
21826
|
+
}
|
|
21827
|
+
function sortBySource(left, right) {
|
|
21828
|
+
return compareStrings(left.sourceScope, right.sourceScope) || compareStrings(left.from, right.from);
|
|
21829
|
+
}
|
|
21830
|
+
async function inspectExpectedPublicSurface({ root, unit } = {}) {
|
|
21831
|
+
if (!unit?.expectedPublicSurface) {
|
|
21832
|
+
return Object.freeze({ enabled: false, passed: true, unitId: unit?.id ?? null });
|
|
21833
|
+
}
|
|
21834
|
+
const { workspaceRoot, resolvedRoots } = await resolveScanRoots({ root, unit });
|
|
21835
|
+
const observedFiles = [];
|
|
21836
|
+
let skippedNonRegularCount = 0;
|
|
21837
|
+
for (const rule of resolvedRoots) {
|
|
21838
|
+
const observed = await scanRoot({ workspaceRoot, unit, rule });
|
|
21839
|
+
observedFiles.push(...observed.files);
|
|
21840
|
+
skippedNonRegularCount += observed.skippedNonRegularCount;
|
|
21841
|
+
}
|
|
21842
|
+
const includedByIdentity = /* @__PURE__ */ new Map();
|
|
21843
|
+
const unclassifiedFiles = [];
|
|
21844
|
+
const ambiguousFiles = [];
|
|
21845
|
+
let excludedFileCount = 0;
|
|
21846
|
+
for (const file of observedFiles) {
|
|
21847
|
+
const included = file.includePatterns.length > 0;
|
|
21848
|
+
const excluded = file.excludePatterns.length > 0;
|
|
21849
|
+
if (included) includedByIdentity.set(file.identity, file);
|
|
21850
|
+
if (!included && !excluded) {
|
|
21851
|
+
unclassifiedFiles.push(file);
|
|
21852
|
+
} else if (included && excluded) {
|
|
21853
|
+
ambiguousFiles.push(file);
|
|
21854
|
+
} else if (excluded) {
|
|
21855
|
+
excludedFileCount += 1;
|
|
21856
|
+
}
|
|
21857
|
+
}
|
|
21858
|
+
const mappingsByIdentity = /* @__PURE__ */ new Map();
|
|
21859
|
+
for (const mapping of unit.publicFiles ?? []) {
|
|
21860
|
+
const sourceScope = mapping.sourceScope ?? "unit";
|
|
21861
|
+
const from = canonicalPublicPath(mapping.from).path;
|
|
21862
|
+
const identity = publicSourceIdentity(sourceScope, from);
|
|
21863
|
+
const current = mappingsByIdentity.get(identity) ?? {
|
|
21864
|
+
sourceScope,
|
|
21865
|
+
from,
|
|
21866
|
+
targets: []
|
|
21867
|
+
};
|
|
21868
|
+
current.targets.push(canonicalPublicPath(mapping.to).path);
|
|
21869
|
+
current.targets.sort(compareStrings);
|
|
21870
|
+
mappingsByIdentity.set(identity, current);
|
|
21871
|
+
}
|
|
21872
|
+
const missingMappings = [...includedByIdentity.entries()].filter(([identity]) => !mappingsByIdentity.has(identity)).map(([, file]) => ({
|
|
21873
|
+
sourceScope: file.sourceScope,
|
|
21874
|
+
from: file.from
|
|
21875
|
+
})).sort(sortBySource);
|
|
21876
|
+
const unexpectedMappings = [...mappingsByIdentity.entries()].filter(([identity]) => !includedByIdentity.has(identity)).map(([, mapping]) => mapping).sort(sortBySource);
|
|
21877
|
+
unclassifiedFiles.sort(sortBySource);
|
|
21878
|
+
ambiguousFiles.sort(sortBySource);
|
|
21879
|
+
const passed = missingMappings.length === 0 && unexpectedMappings.length === 0 && unclassifiedFiles.length === 0 && ambiguousFiles.length === 0;
|
|
21880
|
+
return {
|
|
21881
|
+
enabled: true,
|
|
21882
|
+
passed,
|
|
21883
|
+
unitId: unit.id,
|
|
21884
|
+
summary: {
|
|
21885
|
+
scannedFileCount: observedFiles.length,
|
|
21886
|
+
includedFileCount: includedByIdentity.size,
|
|
21887
|
+
excludedFileCount,
|
|
21888
|
+
mappedSourceCount: mappingsByIdentity.size,
|
|
21889
|
+
skippedNonRegularCount
|
|
21890
|
+
},
|
|
21891
|
+
missingMappings,
|
|
21892
|
+
unexpectedMappings,
|
|
21893
|
+
unclassifiedFiles,
|
|
21894
|
+
ambiguousFiles
|
|
21895
|
+
};
|
|
21896
|
+
}
|
|
21897
|
+
async function assertExpectedPublicSurface(options) {
|
|
21898
|
+
const result = await inspectExpectedPublicSurface(options);
|
|
21899
|
+
if (!result.enabled || result.passed) return result;
|
|
21900
|
+
throw new ReleaseError(
|
|
21901
|
+
GATE_FAILED,
|
|
21902
|
+
`expected public surface mismatch for unit "${result.unitId}"`,
|
|
21903
|
+
{
|
|
21904
|
+
reason: "PUBLIC_SURFACE_MISMATCH",
|
|
21905
|
+
unitId: result.unitId,
|
|
21906
|
+
summary: result.summary,
|
|
21907
|
+
missingMappings: result.missingMappings,
|
|
21908
|
+
unexpectedMappings: result.unexpectedMappings,
|
|
21909
|
+
unclassifiedFiles: result.unclassifiedFiles,
|
|
21910
|
+
ambiguousFiles: result.ambiguousFiles
|
|
21911
|
+
}
|
|
21912
|
+
);
|
|
21913
|
+
}
|
|
21914
|
+
var ROOT_CONTROL_DIRECTORIES, UNSUPPORTED_GLOB_CHARACTERS;
|
|
21915
|
+
var init_public_surface = __esm({
|
|
21916
|
+
"src/core/public-surface.mjs"() {
|
|
21917
|
+
init_errors();
|
|
21918
|
+
init_public_path();
|
|
21919
|
+
ROOT_CONTROL_DIRECTORIES = Object.freeze([".git", ".release-skill"]);
|
|
21920
|
+
UNSUPPORTED_GLOB_CHARACTERS = /[!()[\]{}]/u;
|
|
21921
|
+
__name(compareStrings, "compareStrings");
|
|
21922
|
+
__name(toPosixPath, "toPosixPath");
|
|
21923
|
+
__name(isContainedOrEqual, "isContainedOrEqual");
|
|
21924
|
+
__name(isWorkspaceControlPath, "isWorkspaceControlPath");
|
|
21925
|
+
__name(failConfig, "failConfig");
|
|
21926
|
+
__name(validatePublicSurfaceGlob, "validatePublicSurfaceGlob");
|
|
21927
|
+
__name(compileGlob, "compileGlob");
|
|
21928
|
+
__name(compilePatterns, "compilePatterns");
|
|
21929
|
+
__name(matchingPatterns, "matchingPatterns");
|
|
21930
|
+
__name(assertSafeDirectoryPath, "assertSafeDirectoryPath");
|
|
21931
|
+
__name(resolveScanRoots, "resolveScanRoots");
|
|
21932
|
+
__name(unsupportedEntryError, "unsupportedEntryError");
|
|
21933
|
+
__name(scanRoot, "scanRoot");
|
|
21934
|
+
__name(publicSourceIdentity, "publicSourceIdentity");
|
|
21935
|
+
__name(sortBySource, "sortBySource");
|
|
21936
|
+
__name(inspectExpectedPublicSurface, "inspectExpectedPublicSurface");
|
|
21937
|
+
__name(assertExpectedPublicSurface, "assertExpectedPublicSurface");
|
|
21938
|
+
}
|
|
21939
|
+
});
|
|
21940
|
+
|
|
21526
21941
|
// src/core/baseline.mjs
|
|
21527
21942
|
import { execFile as execFileCb3 } from "node:child_process";
|
|
21528
21943
|
import { promisify as promisify3 } from "node:util";
|
|
21529
21944
|
import { createHash as createHash5 } from "node:crypto";
|
|
21530
|
-
import { lstat as
|
|
21945
|
+
import { lstat as lstat7, open as open4, readlink } from "node:fs/promises";
|
|
21531
21946
|
import { constants as fsConstants2 } from "node:fs";
|
|
21532
21947
|
import path from "node:path";
|
|
21533
21948
|
function isControlPlanePath(p) {
|
|
@@ -21606,7 +22021,7 @@ async function computeWorkspaceDigest(root) {
|
|
|
21606
22021
|
`Refusing to read path outside repository root: ${relPath} resolves to ${absPath}`
|
|
21607
22022
|
);
|
|
21608
22023
|
}
|
|
21609
|
-
const stat9 = await
|
|
22024
|
+
const stat9 = await lstat7(absPath);
|
|
21610
22025
|
let type;
|
|
21611
22026
|
if (stat9.isSymbolicLink()) {
|
|
21612
22027
|
type = "symlink";
|
|
@@ -21730,7 +22145,7 @@ var init_baseline = __esm({
|
|
|
21730
22145
|
|
|
21731
22146
|
// src/core/config.mjs
|
|
21732
22147
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
21733
|
-
import { resolve as
|
|
22148
|
+
import { resolve as resolve12, isAbsolute as isAbsolute9, relative as relative9, normalize as normalize2 } from "node:path";
|
|
21734
22149
|
function containsAlias(node) {
|
|
21735
22150
|
if (!node || typeof node !== "object") {
|
|
21736
22151
|
return false;
|
|
@@ -21755,9 +22170,9 @@ function containsAlias(node) {
|
|
|
21755
22170
|
}
|
|
21756
22171
|
function resolveConfigPath(root, configPath) {
|
|
21757
22172
|
const rootNorm = normalize2(root);
|
|
21758
|
-
const resolved =
|
|
21759
|
-
const rel =
|
|
21760
|
-
if (rel.startsWith("..") || rel === ".." ||
|
|
22173
|
+
const resolved = isAbsolute9(configPath) ? normalize2(configPath) : resolve12(rootNorm, configPath);
|
|
22174
|
+
const rel = relative9(rootNorm, resolved);
|
|
22175
|
+
if (rel.startsWith("..") || rel === ".." || isAbsolute9(rel)) {
|
|
21761
22176
|
throw new ReleaseError(
|
|
21762
22177
|
CONFIG_INVALID,
|
|
21763
22178
|
`config path "${configPath}" resolves outside project root "${root}"`,
|
|
@@ -21848,6 +22263,49 @@ async function loadProjectConfig({ root, configPath } = {}) {
|
|
|
21848
22263
|
{ unitId: unit.id, source: unit.source, field: "source" }
|
|
21849
22264
|
);
|
|
21850
22265
|
}
|
|
22266
|
+
const surface = unit.expectedPublicSurface;
|
|
22267
|
+
if (surface && typeof surface === "object" && Array.isArray(surface.scanRoots)) {
|
|
22268
|
+
for (const [rootIndex, scanRoot2] of surface.scanRoots.entries()) {
|
|
22269
|
+
if (!scanRoot2 || typeof scanRoot2 !== "object") continue;
|
|
22270
|
+
if (typeof scanRoot2.root === "string") {
|
|
22271
|
+
try {
|
|
22272
|
+
canonicalPublicPath(scanRoot2.root, { allowDot: true });
|
|
22273
|
+
} catch (err) {
|
|
22274
|
+
throw new ReleaseError(
|
|
22275
|
+
CONFIG_INVALID,
|
|
22276
|
+
`unit "${unit.id}" has invalid expectedPublicSurface scan root: ${err.message}`,
|
|
22277
|
+
{
|
|
22278
|
+
unitId: unit.id,
|
|
22279
|
+
rootIndex,
|
|
22280
|
+
root: scanRoot2.root,
|
|
22281
|
+
field: "expectedPublicSurface.scanRoots[].root"
|
|
22282
|
+
}
|
|
22283
|
+
);
|
|
22284
|
+
}
|
|
22285
|
+
}
|
|
22286
|
+
for (const field of ["include", "exclude"]) {
|
|
22287
|
+
if (!Array.isArray(scanRoot2[field])) continue;
|
|
22288
|
+
for (const pattern of scanRoot2[field]) {
|
|
22289
|
+
if (typeof pattern !== "string") continue;
|
|
22290
|
+
try {
|
|
22291
|
+
validatePublicSurfaceGlob(pattern);
|
|
22292
|
+
} catch (err) {
|
|
22293
|
+
throw new ReleaseError(
|
|
22294
|
+
CONFIG_INVALID,
|
|
22295
|
+
`unit "${unit.id}" has invalid expectedPublicSurface ${field} glob: ${err.message}`,
|
|
22296
|
+
{
|
|
22297
|
+
unitId: unit.id,
|
|
22298
|
+
rootIndex,
|
|
22299
|
+
pattern,
|
|
22300
|
+
field: `expectedPublicSurface.scanRoots[].${field}`,
|
|
22301
|
+
reason: err.details?.reason ?? "PUBLIC_SURFACE_GLOB_INVALID"
|
|
22302
|
+
}
|
|
22303
|
+
);
|
|
22304
|
+
}
|
|
22305
|
+
}
|
|
22306
|
+
}
|
|
22307
|
+
}
|
|
22308
|
+
}
|
|
21851
22309
|
if (Array.isArray(unit.publicFiles)) {
|
|
21852
22310
|
for (const mapping of unit.publicFiles) {
|
|
21853
22311
|
if (typeof mapping === "object" && mapping !== null) {
|
|
@@ -22020,6 +22478,7 @@ var init_config = __esm({
|
|
|
22020
22478
|
import_ajv_formats3 = __toESM(require_dist2(), 1);
|
|
22021
22479
|
init_digest();
|
|
22022
22480
|
init_errors();
|
|
22481
|
+
init_public_surface();
|
|
22023
22482
|
init_public_path();
|
|
22024
22483
|
init_baseline();
|
|
22025
22484
|
init_trusted_resource();
|
|
@@ -22055,7 +22514,7 @@ __export(assess_exports, {
|
|
|
22055
22514
|
assessProject: () => assessProject
|
|
22056
22515
|
});
|
|
22057
22516
|
import { readFile as readFile9, stat as stat2, writeFile as writeFile4, mkdir as mkdir4 } from "node:fs/promises";
|
|
22058
|
-
import { resolve as
|
|
22517
|
+
import { resolve as resolve13, dirname as dirname5, relative as relative10 } from "node:path";
|
|
22059
22518
|
import { execFile as execFileCb4 } from "node:child_process";
|
|
22060
22519
|
import { promisify as promisify4 } from "node:util";
|
|
22061
22520
|
async function fileExists(filePath) {
|
|
@@ -22156,9 +22615,9 @@ async function checkCommonDocs(root, config) {
|
|
|
22156
22615
|
{ file: "LICENSE", code: "LICENSE_MISSING", message: "\u7F3A\u5C11 LICENSE \u6587\u4EF6" }
|
|
22157
22616
|
];
|
|
22158
22617
|
for (const unit of units) {
|
|
22159
|
-
const unitRoot =
|
|
22618
|
+
const unitRoot = resolve13(root, unit.source);
|
|
22160
22619
|
for (const doc of requiredDocs) {
|
|
22161
|
-
const exists = await fileExists(
|
|
22620
|
+
const exists = await fileExists(resolve13(unitRoot, doc.file));
|
|
22162
22621
|
if (!exists) {
|
|
22163
22622
|
gaps.push(
|
|
22164
22623
|
createGap({
|
|
@@ -22179,9 +22638,9 @@ async function checkCommonDocs(root, config) {
|
|
|
22179
22638
|
{ file: "CONTRIBUTING.md", code: "CONTRIBUTING_MISSING", message: "\u5EFA\u8BAE\u6DFB\u52A0 CONTRIBUTING.md" }
|
|
22180
22639
|
];
|
|
22181
22640
|
for (const unit of units) {
|
|
22182
|
-
const unitRoot =
|
|
22641
|
+
const unitRoot = resolve13(root, unit.source);
|
|
22183
22642
|
for (const doc of recommendedDocs) {
|
|
22184
|
-
const exists = await fileExists(
|
|
22643
|
+
const exists = await fileExists(resolve13(unitRoot, doc.file));
|
|
22185
22644
|
if (!exists) {
|
|
22186
22645
|
gaps.push(
|
|
22187
22646
|
createGap({
|
|
@@ -22203,9 +22662,9 @@ async function checkPluginManifests(root, config) {
|
|
|
22203
22662
|
const units = config.releaseUnits ?? [];
|
|
22204
22663
|
for (const unit of units) {
|
|
22205
22664
|
const distributionTypes = new Set((unit.distributions ?? []).map((dist) => dist.type));
|
|
22206
|
-
const unitRoot =
|
|
22665
|
+
const unitRoot = resolve13(root, unit.source);
|
|
22207
22666
|
if (distributionTypes.has("claude-plugin")) {
|
|
22208
|
-
const manifestPath =
|
|
22667
|
+
const manifestPath = resolve13(unitRoot, ".claude-plugin", "plugin.json");
|
|
22209
22668
|
const displayPath = unitFile(unit, ".claude-plugin/plugin.json");
|
|
22210
22669
|
const exists = await fileExists(manifestPath);
|
|
22211
22670
|
if (!exists) {
|
|
@@ -22252,7 +22711,7 @@ async function checkPluginManifests(root, config) {
|
|
|
22252
22711
|
}
|
|
22253
22712
|
}
|
|
22254
22713
|
if (distributionTypes.has("codex-plugin")) {
|
|
22255
|
-
const manifestPath =
|
|
22714
|
+
const manifestPath = resolve13(unitRoot, ".codex-plugin", "plugin.json");
|
|
22256
22715
|
const displayPath = unitFile(unit, ".codex-plugin/plugin.json");
|
|
22257
22716
|
const exists = await fileExists(manifestPath);
|
|
22258
22717
|
if (!exists) {
|
|
@@ -22299,7 +22758,7 @@ async function checkPluginManifests(root, config) {
|
|
|
22299
22758
|
}
|
|
22300
22759
|
}
|
|
22301
22760
|
if (distributionTypes.has("kimi-plugin")) {
|
|
22302
|
-
const manifestPath =
|
|
22761
|
+
const manifestPath = resolve13(unitRoot, ".kimi-plugin", "plugin.json");
|
|
22303
22762
|
const displayPath = unitFile(unit, ".kimi-plugin/plugin.json");
|
|
22304
22763
|
const exists = await fileExists(manifestPath);
|
|
22305
22764
|
if (!exists) {
|
|
@@ -22346,7 +22805,7 @@ async function checkPluginManifests(root, config) {
|
|
|
22346
22805
|
}
|
|
22347
22806
|
}
|
|
22348
22807
|
if (distributionTypes.has("codebuddy-plugin")) {
|
|
22349
|
-
const manifestPath =
|
|
22808
|
+
const manifestPath = resolve13(unitRoot, ".codebuddy-plugin", "plugin.json");
|
|
22350
22809
|
const displayPath = unitFile(unit, ".codebuddy-plugin/plugin.json");
|
|
22351
22810
|
const exists = await fileExists(manifestPath);
|
|
22352
22811
|
if (!exists) {
|
|
@@ -22412,8 +22871,8 @@ async function checkPackageMetadata(root, config) {
|
|
|
22412
22871
|
for (const unit of units) {
|
|
22413
22872
|
const hasNpmDist = (unit.distributions ?? []).some((d) => d.type === "npm");
|
|
22414
22873
|
if (!hasNpmDist) continue;
|
|
22415
|
-
const unitRoot =
|
|
22416
|
-
const pkgPath =
|
|
22874
|
+
const unitRoot = resolve13(root, unit.source);
|
|
22875
|
+
const pkgPath = resolve13(unitRoot, "package.json");
|
|
22417
22876
|
const exists = await fileExists(pkgPath);
|
|
22418
22877
|
if (!exists) {
|
|
22419
22878
|
gaps.push(
|
|
@@ -22496,7 +22955,7 @@ async function checkRemotePrerequisites(root, config, offline) {
|
|
|
22496
22955
|
for (const unit of units) {
|
|
22497
22956
|
const npmDist = (unit.distributions ?? []).find((d) => d.type === "npm");
|
|
22498
22957
|
if (!npmDist?.package) continue;
|
|
22499
|
-
const pkgPath =
|
|
22958
|
+
const pkgPath = resolve13(root, unit.source, "package.json");
|
|
22500
22959
|
let version;
|
|
22501
22960
|
try {
|
|
22502
22961
|
const content = await readFile9(pkgPath, "utf8");
|
|
@@ -22530,7 +22989,7 @@ async function checkReadmeStructure(root, config) {
|
|
|
22530
22989
|
const gaps = [];
|
|
22531
22990
|
const units = config.releaseUnits ?? [];
|
|
22532
22991
|
for (const unit of units) {
|
|
22533
|
-
const readmePath =
|
|
22992
|
+
const readmePath = resolve13(root, unit.source, "README.md");
|
|
22534
22993
|
const displayPath = unitFile(unit, "README.md");
|
|
22535
22994
|
const exists = await fileExists(readmePath);
|
|
22536
22995
|
if (!exists) continue;
|
|
@@ -22753,8 +23212,8 @@ var init_assess = __esm({
|
|
|
22753
23212
|
// src/core/hooks.mjs
|
|
22754
23213
|
import { execFile as execFileCb5 } from "node:child_process";
|
|
22755
23214
|
import { promisify as promisify5 } from "node:util";
|
|
22756
|
-
import { resolve as
|
|
22757
|
-
import { realpath as
|
|
23215
|
+
import { resolve as resolve14, relative as relative11, isAbsolute as isAbsolute10 } from "node:path";
|
|
23216
|
+
import { realpath as realpath7 } from "node:fs/promises";
|
|
22758
23217
|
function validateHook(hook) {
|
|
22759
23218
|
if (!hook || typeof hook !== "object" || Array.isArray(hook)) {
|
|
22760
23219
|
throw new ReleaseError("INVALID_HOOK", "hook must be a non-null object");
|
|
@@ -22837,13 +23296,13 @@ async function runHook(hook, context) {
|
|
|
22837
23296
|
if (!context || typeof context !== "object" || Array.isArray(context)) {
|
|
22838
23297
|
throw new ReleaseError("INVALID_HOOK", "context must be a non-null object");
|
|
22839
23298
|
}
|
|
22840
|
-
if (typeof context.root !== "string" || !
|
|
23299
|
+
if (typeof context.root !== "string" || !isAbsolute10(context.root)) {
|
|
22841
23300
|
throw new ReleaseError("INVALID_HOOK", "context.root must be an absolute path");
|
|
22842
23301
|
}
|
|
22843
23302
|
const { command: command2, cwd, timeoutMs, envAllowlist = [] } = hook;
|
|
22844
|
-
const rootReal = await
|
|
22845
|
-
const resolvedCwd = cwd ? await
|
|
22846
|
-
const rel =
|
|
23303
|
+
const rootReal = await realpath7(context.root);
|
|
23304
|
+
const resolvedCwd = cwd ? await realpath7(resolve14(rootReal, cwd)) : rootReal;
|
|
23305
|
+
const rel = relative11(rootReal, resolvedCwd);
|
|
22847
23306
|
if (rel.startsWith("..") || rel === "..") {
|
|
22848
23307
|
throw new ReleaseError(
|
|
22849
23308
|
"INVALID_HOOK",
|
|
@@ -22909,8 +23368,8 @@ var init_hooks = __esm({
|
|
|
22909
23368
|
});
|
|
22910
23369
|
|
|
22911
23370
|
// src/core/hook-cache.mjs
|
|
22912
|
-
import { readdir as
|
|
22913
|
-
import { join as
|
|
23371
|
+
import { readdir as readdir5, readFile as readFile10, mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
23372
|
+
import { join as join10 } from "node:path";
|
|
22914
23373
|
function globToRegExp(glob) {
|
|
22915
23374
|
let source = "";
|
|
22916
23375
|
let i = 0;
|
|
@@ -22939,7 +23398,7 @@ async function listInputFiles(root) {
|
|
|
22939
23398
|
async function walk(dirAbs, dirRel) {
|
|
22940
23399
|
let entries;
|
|
22941
23400
|
try {
|
|
22942
|
-
entries = await
|
|
23401
|
+
entries = await readdir5(dirAbs, { withFileTypes: true });
|
|
22943
23402
|
} catch {
|
|
22944
23403
|
return;
|
|
22945
23404
|
}
|
|
@@ -22947,7 +23406,7 @@ async function listInputFiles(root) {
|
|
|
22947
23406
|
if (entry.isDirectory()) {
|
|
22948
23407
|
if (SKIPPED_DIRS.has(entry.name)) continue;
|
|
22949
23408
|
const rel = dirRel ? `${dirRel}/${entry.name}` : entry.name;
|
|
22950
|
-
await walk(
|
|
23409
|
+
await walk(join10(dirAbs, entry.name), rel);
|
|
22951
23410
|
} else if (entry.isFile()) {
|
|
22952
23411
|
out.push(dirRel ? `${dirRel}/${entry.name}` : entry.name);
|
|
22953
23412
|
}
|
|
@@ -22986,17 +23445,17 @@ async function computeHookCacheKey(hook, root) {
|
|
|
22986
23445
|
matched.sort();
|
|
22987
23446
|
const fileEntries = [];
|
|
22988
23447
|
for (const relPath of matched) {
|
|
22989
|
-
const content = await readFile10(
|
|
23448
|
+
const content = await readFile10(join10(root, relPath));
|
|
22990
23449
|
fileEntries.push({ path: relPath, sha256: sha256Hex(content) });
|
|
22991
23450
|
}
|
|
22992
23451
|
const cacheKey = sha256Hex(canonicalJson(hook) + canonicalJson(fileEntries));
|
|
22993
23452
|
return { cacheKey, matchedFiles: matched };
|
|
22994
23453
|
}
|
|
22995
23454
|
function hookCacheDir(root, hookName) {
|
|
22996
|
-
return
|
|
23455
|
+
return join10(root, ...CACHE_BASE, hookName);
|
|
22997
23456
|
}
|
|
22998
23457
|
function hookCachePath(root, hookName, cacheKey) {
|
|
22999
|
-
return
|
|
23458
|
+
return join10(hookCacheDir(root, hookName), `${cacheKey}.json`);
|
|
23000
23459
|
}
|
|
23001
23460
|
async function readHookCache(root, hookName, cacheKey) {
|
|
23002
23461
|
try {
|
|
@@ -23051,8 +23510,8 @@ var init_hook_cache = __esm({
|
|
|
23051
23510
|
// src/core/verification-gates.mjs
|
|
23052
23511
|
import { createHash as createHash6 } from "node:crypto";
|
|
23053
23512
|
import { spawn as spawn2 } from "node:child_process";
|
|
23054
|
-
import { chmod as chmod2, cp, lstat as
|
|
23055
|
-
import { isAbsolute as
|
|
23513
|
+
import { chmod as chmod2, cp, lstat as lstat8, mkdir as mkdir6, readdir as readdir6, realpath as realpath8, rm as rm4 } from "node:fs/promises";
|
|
23514
|
+
import { isAbsolute as isAbsolute11, join as join11, relative as relative12, resolve as resolve15 } from "node:path";
|
|
23056
23515
|
function gateError(gate, message, details = {}) {
|
|
23057
23516
|
return new ReleaseError(GATE_FAILED, `verification gate "${gate?.id ?? "unknown"}" ${message}`, {
|
|
23058
23517
|
gateId: gate?.id,
|
|
@@ -23060,9 +23519,9 @@ function gateError(gate, message, details = {}) {
|
|
|
23060
23519
|
});
|
|
23061
23520
|
}
|
|
23062
23521
|
function isInside2(parent, candidate) {
|
|
23063
|
-
const rel =
|
|
23522
|
+
const rel = relative12(parent, candidate);
|
|
23064
23523
|
const separator = process.platform === "win32" ? "\\" : "/";
|
|
23065
|
-
return rel === "" || !
|
|
23524
|
+
return rel === "" || !isAbsolute11(rel) && rel !== ".." && !rel.startsWith(`..${separator}`);
|
|
23066
23525
|
}
|
|
23067
23526
|
function matchesSubset(actual, expected) {
|
|
23068
23527
|
if (expected === null || typeof expected !== "object" || Array.isArray(expected)) {
|
|
@@ -23117,25 +23576,25 @@ function filteredEnv(allowlist, suppliedEnv, fixedEnv = {}) {
|
|
|
23117
23576
|
return result;
|
|
23118
23577
|
}
|
|
23119
23578
|
async function resolveSafeCwd(executionRoot, cwd, gate) {
|
|
23120
|
-
const rootStat = await
|
|
23579
|
+
const rootStat = await lstat8(executionRoot).catch((error) => {
|
|
23121
23580
|
throw gateError(gate, "execution root is missing", { cause: error.code });
|
|
23122
23581
|
});
|
|
23123
23582
|
if (!rootStat.isDirectory() || rootStat.isSymbolicLink()) {
|
|
23124
23583
|
throw gateError(gate, "execution root must be a real directory");
|
|
23125
23584
|
}
|
|
23126
|
-
const rootReal = await
|
|
23127
|
-
const lexical =
|
|
23585
|
+
const rootReal = await realpath8(executionRoot);
|
|
23586
|
+
const lexical = resolve15(rootReal, cwd ?? ".");
|
|
23128
23587
|
if (!isInside2(rootReal, lexical)) throw gateError(gate, "cwd escapes the execution root");
|
|
23129
|
-
const rel =
|
|
23588
|
+
const rel = relative12(rootReal, lexical);
|
|
23130
23589
|
let current = rootReal;
|
|
23131
23590
|
for (const segment of rel.split(/[\\/]/).filter(Boolean)) {
|
|
23132
|
-
current =
|
|
23133
|
-
const stat9 = await
|
|
23591
|
+
current = join11(current, segment);
|
|
23592
|
+
const stat9 = await lstat8(current).catch((error) => {
|
|
23134
23593
|
throw gateError(gate, "cwd does not exist", { cause: error.code });
|
|
23135
23594
|
});
|
|
23136
23595
|
if (stat9.isSymbolicLink()) throw gateError(gate, "cwd contains a symlink");
|
|
23137
23596
|
}
|
|
23138
|
-
const physical = await
|
|
23597
|
+
const physical = await realpath8(lexical);
|
|
23139
23598
|
if (!isInside2(rootReal, physical)) throw gateError(gate, "cwd resolves outside the execution root");
|
|
23140
23599
|
return physical;
|
|
23141
23600
|
}
|
|
@@ -23374,12 +23833,12 @@ async function runVerificationGate({
|
|
|
23374
23833
|
return result;
|
|
23375
23834
|
}
|
|
23376
23835
|
async function makeTreeWritable(root) {
|
|
23377
|
-
const stat9 = await
|
|
23836
|
+
const stat9 = await lstat8(root);
|
|
23378
23837
|
if (!stat9.isDirectory() || stat9.isSymbolicLink()) throw new Error("gate copy root must be a real directory");
|
|
23379
23838
|
await chmod2(root, stat9.mode | 448);
|
|
23380
|
-
for (const child of await
|
|
23381
|
-
const absolute =
|
|
23382
|
-
const childStat = await
|
|
23839
|
+
for (const child of await readdir6(root, { withFileTypes: true })) {
|
|
23840
|
+
const absolute = join11(root, child.name);
|
|
23841
|
+
const childStat = await lstat8(absolute);
|
|
23383
23842
|
if (childStat.isSymbolicLink()) throw new Error("gate copy must not contain symlinks");
|
|
23384
23843
|
if (childStat.isDirectory()) await makeTreeWritable(absolute);
|
|
23385
23844
|
else if (childStat.isFile() && childStat.nlink === 1) await chmod2(absolute, childStat.mode | 384);
|
|
@@ -23397,7 +23856,7 @@ async function runSnapshotVerificationGates({
|
|
|
23397
23856
|
const snapshotGates = gates.filter((item) => item.phase === "snapshot-verify");
|
|
23398
23857
|
if (snapshotGates.length === 0) return [];
|
|
23399
23858
|
const byUnit = new Map(unitResults.map((item) => [item.unit.id, item]));
|
|
23400
|
-
const gateRoot =
|
|
23859
|
+
const gateRoot = join11(runDir, "snapshot-gates");
|
|
23401
23860
|
await mkdir6(gateRoot, { recursive: true });
|
|
23402
23861
|
const results = [];
|
|
23403
23862
|
for (const gate of snapshotGates) {
|
|
@@ -23595,32 +24054,32 @@ var init_evidence = __esm({
|
|
|
23595
24054
|
});
|
|
23596
24055
|
|
|
23597
24056
|
// src/core/skill-resource-closure.mjs
|
|
23598
|
-
import { lstat as
|
|
23599
|
-
import { dirname as dirname6, isAbsolute as
|
|
24057
|
+
import { lstat as lstat9, readFile as readFile11, readdir as readdir7 } from "node:fs/promises";
|
|
24058
|
+
import { dirname as dirname6, isAbsolute as isAbsolute12, join as join12, relative as relative13, resolve as resolve16, sep as sep4 } from "node:path";
|
|
23600
24059
|
function toPosix(value) {
|
|
23601
24060
|
return value.replaceAll("\\", "/");
|
|
23602
24061
|
}
|
|
23603
24062
|
function relativeStable(root, target) {
|
|
23604
|
-
const value = toPosix(
|
|
24063
|
+
const value = toPosix(relative13(root, target));
|
|
23605
24064
|
return value === "" ? "." : value;
|
|
23606
24065
|
}
|
|
23607
24066
|
function isInside3(parent, candidate) {
|
|
23608
|
-
const rel =
|
|
23609
|
-
return rel === "" || !
|
|
24067
|
+
const rel = relative13(parent, candidate);
|
|
24068
|
+
return rel === "" || !isAbsolute12(rel) && rel !== ".." && !rel.startsWith(`..${sep4}`);
|
|
23610
24069
|
}
|
|
23611
24070
|
async function discoverSkills(root, base = root) {
|
|
23612
24071
|
const results = [];
|
|
23613
24072
|
let entries;
|
|
23614
24073
|
try {
|
|
23615
|
-
entries = await
|
|
24074
|
+
entries = await readdir7(root, { withFileTypes: true });
|
|
23616
24075
|
} catch (error) {
|
|
23617
24076
|
if (error.code === "ENOENT") return results;
|
|
23618
24077
|
throw error;
|
|
23619
24078
|
}
|
|
23620
24079
|
for (const entry of entries) {
|
|
23621
24080
|
if (entry.name === ".git" || entry.name === "node_modules") continue;
|
|
23622
|
-
const absolute =
|
|
23623
|
-
const stableRelative = toPosix(
|
|
24081
|
+
const absolute = join12(root, entry.name);
|
|
24082
|
+
const stableRelative = toPosix(relative13(base, absolute));
|
|
23624
24083
|
if (stableRelative === ".codex-plugin/migrated-command-skills") continue;
|
|
23625
24084
|
if (entry.isDirectory()) {
|
|
23626
24085
|
results.push(...await discoverSkills(absolute, base));
|
|
@@ -23630,14 +24089,14 @@ async function discoverSkills(root, base = root) {
|
|
|
23630
24089
|
}
|
|
23631
24090
|
return results.sort();
|
|
23632
24091
|
}
|
|
23633
|
-
function resolvePluginRoot(skillRelativePath,
|
|
24092
|
+
function resolvePluginRoot(skillRelativePath, scanRoot2) {
|
|
23634
24093
|
const parts = toPosix(skillRelativePath).split("/");
|
|
23635
24094
|
const skillsIndex = parts.lastIndexOf("skills");
|
|
23636
|
-
if (skillsIndex < 0) return
|
|
23637
|
-
return
|
|
24095
|
+
if (skillsIndex < 0) return resolve16(scanRoot2);
|
|
24096
|
+
return resolve16(scanRoot2, ...parts.slice(0, skillsIndex));
|
|
23638
24097
|
}
|
|
23639
|
-
function resolveSkillRoot(skillRelativePath,
|
|
23640
|
-
return
|
|
24098
|
+
function resolveSkillRoot(skillRelativePath, scanRoot2) {
|
|
24099
|
+
return resolve16(scanRoot2, dirname6(skillRelativePath));
|
|
23641
24100
|
}
|
|
23642
24101
|
function trimCandidate(value) {
|
|
23643
24102
|
return value.trim().replace(/^["']/u, "").replace(/["']$/u, "").replace(/[.,;:]+$/u, "");
|
|
@@ -23690,7 +24149,7 @@ function stripExplicitPrefix(token) {
|
|
|
23690
24149
|
}
|
|
23691
24150
|
return token;
|
|
23692
24151
|
}
|
|
23693
|
-
function classifyReference(token, skillRoot, pluginRoot,
|
|
24152
|
+
function classifyReference(token, skillRoot, pluginRoot, scanRoot2) {
|
|
23694
24153
|
if (MACHINE_ABSOLUTE_PATTERN.test(token)) {
|
|
23695
24154
|
return {
|
|
23696
24155
|
classification: CLASSIFICATION.MACHINE_ABSOLUTE,
|
|
@@ -23704,41 +24163,41 @@ function classifyReference(token, skillRoot, pluginRoot, scanRoot) {
|
|
|
23704
24163
|
classification: CLASSIFICATION.SOURCE_BACKJUMP,
|
|
23705
24164
|
resolutionRoot: "(source-tree)",
|
|
23706
24165
|
resolvedTarget: token,
|
|
23707
|
-
absoluteTarget:
|
|
24166
|
+
absoluteTarget: resolve16(scanRoot2, token)
|
|
23708
24167
|
};
|
|
23709
24168
|
}
|
|
23710
24169
|
const explicit = EXPLICIT_PREFIXES.some((prefix) => token.startsWith(prefix));
|
|
23711
24170
|
const resolutionRootAbsolute = explicit ? pluginRoot : skillRoot;
|
|
23712
24171
|
const relativeTarget = explicit ? stripExplicitPrefix(token) : token;
|
|
23713
|
-
const absoluteTarget =
|
|
24172
|
+
const absoluteTarget = resolve16(resolutionRootAbsolute, relativeTarget);
|
|
23714
24173
|
const inBounds = isInside3(resolutionRootAbsolute, absoluteTarget);
|
|
23715
24174
|
return {
|
|
23716
24175
|
classification: inBounds ? explicit ? CLASSIFICATION.PLUGIN_ROOT : CLASSIFICATION.SKILL_LOCAL : CLASSIFICATION.OUT_OF_BOUNDS,
|
|
23717
|
-
resolutionRoot: relativeStable(
|
|
23718
|
-
resolvedTarget: relativeStable(
|
|
24176
|
+
resolutionRoot: relativeStable(scanRoot2, resolutionRootAbsolute),
|
|
24177
|
+
resolvedTarget: relativeStable(scanRoot2, absoluteTarget),
|
|
23719
24178
|
absoluteTarget
|
|
23720
24179
|
};
|
|
23721
24180
|
}
|
|
23722
24181
|
async function inspectRegularFile(root, target) {
|
|
23723
24182
|
if (!isInside3(root, target)) return { code: FINDING_CODE.OUT_OF_BOUNDS };
|
|
23724
|
-
const parts =
|
|
24183
|
+
const parts = relative13(root, target).split(sep4).filter(Boolean);
|
|
23725
24184
|
let current = root;
|
|
23726
|
-
const rootStat = await
|
|
24185
|
+
const rootStat = await lstat9(root);
|
|
23727
24186
|
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
23728
24187
|
return { code: FINDING_CODE.SYMLINK_NOT_ALLOWED };
|
|
23729
24188
|
}
|
|
23730
24189
|
for (const part of parts) {
|
|
23731
|
-
current =
|
|
24190
|
+
current = join12(current, part);
|
|
23732
24191
|
let stat9;
|
|
23733
24192
|
try {
|
|
23734
|
-
stat9 = await
|
|
24193
|
+
stat9 = await lstat9(current);
|
|
23735
24194
|
} catch (error) {
|
|
23736
24195
|
if (error.code === "ENOENT") return { code: FINDING_CODE.RESOURCE_MISSING };
|
|
23737
24196
|
throw error;
|
|
23738
24197
|
}
|
|
23739
24198
|
if (stat9.isSymbolicLink()) return { code: FINDING_CODE.SYMLINK_NOT_ALLOWED };
|
|
23740
24199
|
}
|
|
23741
|
-
const targetStat = await
|
|
24200
|
+
const targetStat = await lstat9(target);
|
|
23742
24201
|
if (!targetStat.isFile() || targetStat.nlink !== 1) {
|
|
23743
24202
|
return { code: FINDING_CODE.RESOURCE_NOT_REGULAR_FILE };
|
|
23744
24203
|
}
|
|
@@ -23811,15 +24270,15 @@ async function checkSkillResourceClosure({
|
|
|
23811
24270
|
if (typeof snapshotDir !== "string" || snapshotDir.length === 0) {
|
|
23812
24271
|
throw new TypeError("snapshotDir must be a non-empty string");
|
|
23813
24272
|
}
|
|
23814
|
-
const
|
|
23815
|
-
const scanStat = await
|
|
24273
|
+
const scanRoot2 = resolve16(snapshotDir);
|
|
24274
|
+
const scanStat = await lstat9(scanRoot2);
|
|
23816
24275
|
if (!scanStat.isDirectory() || scanStat.isSymbolicLink()) {
|
|
23817
24276
|
throw new Error("snapshotDir must be a real directory");
|
|
23818
24277
|
}
|
|
23819
24278
|
let inputDigest;
|
|
23820
24279
|
let snapshotError = null;
|
|
23821
24280
|
try {
|
|
23822
|
-
inputDigest = (await computeFrozenSnapshot(
|
|
24281
|
+
inputDigest = (await computeFrozenSnapshot(scanRoot2, {
|
|
23823
24282
|
excludeRootEntries: TRANSPORT_EXCLUSIONS
|
|
23824
24283
|
})).digest;
|
|
23825
24284
|
} catch (error) {
|
|
@@ -23828,15 +24287,15 @@ async function checkSkillResourceClosure({
|
|
|
23828
24287
|
invalidTree: error.message
|
|
23829
24288
|
}));
|
|
23830
24289
|
}
|
|
23831
|
-
const skillPaths = await discoverSkills(
|
|
24290
|
+
const skillPaths = await discoverSkills(scanRoot2);
|
|
23832
24291
|
const findings = [];
|
|
23833
24292
|
const surfaceMap = /* @__PURE__ */ new Map();
|
|
23834
24293
|
let referenceCount = 0;
|
|
23835
24294
|
let sourceOnlyCount = 0;
|
|
23836
24295
|
for (const skill of skillPaths) {
|
|
23837
|
-
const skillRoot = resolveSkillRoot(skill,
|
|
23838
|
-
const pluginRoot = resolvePluginRoot(skill,
|
|
23839
|
-
const surfaceId = relativeStable(
|
|
24296
|
+
const skillRoot = resolveSkillRoot(skill, scanRoot2);
|
|
24297
|
+
const pluginRoot = resolvePluginRoot(skill, scanRoot2);
|
|
24298
|
+
const surfaceId = relativeStable(scanRoot2, pluginRoot);
|
|
23840
24299
|
const surfaceHost = inferSurfaceHost(surfaceId, host);
|
|
23841
24300
|
const surface = surfaceMap.get(surfaceId) ?? {
|
|
23842
24301
|
id: surfaceId,
|
|
@@ -23847,7 +24306,7 @@ async function checkSkillResourceClosure({
|
|
|
23847
24306
|
};
|
|
23848
24307
|
surface.skillCount += 1;
|
|
23849
24308
|
surfaceMap.set(surfaceId, surface);
|
|
23850
|
-
const content = await readFile11(
|
|
24309
|
+
const content = await readFile11(resolve16(scanRoot2, skill), "utf8");
|
|
23851
24310
|
for (const pathToken of extractPathTokens(content)) {
|
|
23852
24311
|
referenceCount += 1;
|
|
23853
24312
|
surface.referenceCount += 1;
|
|
@@ -23855,7 +24314,7 @@ async function checkSkillResourceClosure({
|
|
|
23855
24314
|
pathToken.token,
|
|
23856
24315
|
skillRoot,
|
|
23857
24316
|
pluginRoot,
|
|
23858
|
-
|
|
24317
|
+
scanRoot2
|
|
23859
24318
|
);
|
|
23860
24319
|
const findingBase = {
|
|
23861
24320
|
host: surfaceHost,
|
|
@@ -23991,9 +24450,9 @@ var init_skill_resource_closure = __esm({
|
|
|
23991
24450
|
});
|
|
23992
24451
|
|
|
23993
24452
|
// src/snapshot/public-map.mjs
|
|
23994
|
-
import { lstat as
|
|
24453
|
+
import { lstat as lstat10, readFile as readFile12, mkdir as mkdir8, readdir as readdir8, realpath as realpath9, chmod as fsChmod } from "node:fs/promises";
|
|
23995
24454
|
import { open as fsOpen } from "node:fs/promises";
|
|
23996
|
-
import { relative as
|
|
24455
|
+
import { relative as relative14, resolve as resolve17, dirname as dirname7, sep as pathSep, isAbsolute as isAbsolute13 } from "node:path";
|
|
23997
24456
|
import { posix } from "node:path";
|
|
23998
24457
|
import { constants as fsConstants3 } from "node:fs";
|
|
23999
24458
|
import { createHash as createHash7 } from "node:crypto";
|
|
@@ -24002,14 +24461,14 @@ function _isContainedWith(relativeFn, isAbsoluteFn, root, candidate, relPathSep
|
|
|
24002
24461
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${relPathSep}`) && !isAbsoluteFn(rel);
|
|
24003
24462
|
}
|
|
24004
24463
|
function isContained(root, candidate) {
|
|
24005
|
-
return _isContainedWith(
|
|
24464
|
+
return _isContainedWith(relative14, isAbsolute13, root, candidate);
|
|
24006
24465
|
}
|
|
24007
|
-
async function assertNoAncestorSymlinks(root, filePath, fs = { lstat:
|
|
24008
|
-
const rel =
|
|
24466
|
+
async function assertNoAncestorSymlinks(root, filePath, fs = { lstat: lstat10 }) {
|
|
24467
|
+
const rel = relative14(root, filePath);
|
|
24009
24468
|
const segments = rel.split(/[/\\]/);
|
|
24010
24469
|
let current = root;
|
|
24011
24470
|
for (const segment of segments) {
|
|
24012
|
-
current =
|
|
24471
|
+
current = resolve17(current, segment);
|
|
24013
24472
|
try {
|
|
24014
24473
|
const st = await fs.lstat(current, { stage: "source-ancestor" });
|
|
24015
24474
|
if (st.isSymbolicLink()) {
|
|
@@ -24031,7 +24490,7 @@ async function assertNoAncestorSymlinks(root, filePath, fs = { lstat: lstat9 })
|
|
|
24031
24490
|
}
|
|
24032
24491
|
}
|
|
24033
24492
|
}
|
|
24034
|
-
async function assertOutputAncestorsNoFollow(effectiveOutputDir, fs = { lstat:
|
|
24493
|
+
async function assertOutputAncestorsNoFollow(effectiveOutputDir, fs = { lstat: lstat10 }) {
|
|
24035
24494
|
const parts = effectiveOutputDir.split(pathSep).filter(Boolean);
|
|
24036
24495
|
let accumulated = "";
|
|
24037
24496
|
for (const part of parts) {
|
|
@@ -24065,12 +24524,12 @@ async function assertOutputAncestorsNoFollow(effectiveOutputDir, fs = { lstat: l
|
|
|
24065
24524
|
}
|
|
24066
24525
|
}
|
|
24067
24526
|
}
|
|
24068
|
-
async function assertDestAncestorsNoFollow(realOutputRoot, destPath, fs = { lstat:
|
|
24069
|
-
const relDest =
|
|
24527
|
+
async function assertDestAncestorsNoFollow(realOutputRoot, destPath, fs = { lstat: lstat10 }) {
|
|
24528
|
+
const relDest = relative14(realOutputRoot, destPath);
|
|
24070
24529
|
const segments = relDest.split(pathSep).filter(Boolean);
|
|
24071
24530
|
let current = realOutputRoot;
|
|
24072
24531
|
for (const segment of segments) {
|
|
24073
|
-
current =
|
|
24532
|
+
current = resolve17(current, segment);
|
|
24074
24533
|
try {
|
|
24075
24534
|
const st = await fs.lstat(current, { stage: "dest-ancestor" });
|
|
24076
24535
|
if (st.isSymbolicLink()) {
|
|
@@ -24224,12 +24683,12 @@ async function buildPublicStaging({
|
|
|
24224
24683
|
throw new ReleaseError(CONFIG_INVALID, "unit.publicFiles must be an array");
|
|
24225
24684
|
}
|
|
24226
24685
|
const fs = {
|
|
24227
|
-
lstat: _fsOps.lstat ? (p, ctx) => _fsOps.lstat({ operation: "lstat", path: p, ...ctx }) :
|
|
24228
|
-
realpath: _fsOps.realpath ? (p, ctx) => _fsOps.realpath({ operation: "realpath", path: p, ...ctx }) :
|
|
24686
|
+
lstat: _fsOps.lstat ? (p, ctx) => _fsOps.lstat({ operation: "lstat", path: p, ...ctx }) : lstat10,
|
|
24687
|
+
realpath: _fsOps.realpath ? (p, ctx) => _fsOps.realpath({ operation: "realpath", path: p, ...ctx }) : realpath9,
|
|
24229
24688
|
readFile: _fsOps.readFile ? (p, ctx) => _fsOps.readFile({ operation: "readFile", path: p, ...ctx }) : readFile12,
|
|
24230
24689
|
open: _fsOps.open ? (p, flags, mode, ctx) => _fsOps.open({ operation: "open", path: p, flags, mode, ...ctx }) : fsOpen,
|
|
24231
24690
|
mkdir: _fsOps.mkdir ? (p, opts, ctx) => _fsOps.mkdir({ operation: "mkdir", path: p, opts, ...ctx }) : mkdir8,
|
|
24232
|
-
readdir: _fsOps.readdir ? (p, ctx) => _fsOps.readdir({ operation: "readdir", path: p, ...ctx }) :
|
|
24691
|
+
readdir: _fsOps.readdir ? (p, ctx) => _fsOps.readdir({ operation: "readdir", path: p, ...ctx }) : readdir8,
|
|
24233
24692
|
chmod: _fsOps.chmod ? (p, mode, ctx) => _fsOps.chmod({ operation: "chmod", path: p, mode, ...ctx }) : fsChmod
|
|
24234
24693
|
};
|
|
24235
24694
|
let realSourceRoot;
|
|
@@ -24261,7 +24720,7 @@ async function buildPublicStaging({
|
|
|
24261
24720
|
{ count: mappings.length, limit: MAX_MAPPINGS }
|
|
24262
24721
|
);
|
|
24263
24722
|
}
|
|
24264
|
-
const unitRootLexical =
|
|
24723
|
+
const unitRootLexical = resolve17(sourceRoot, unit.source);
|
|
24265
24724
|
let realUnitRoot;
|
|
24266
24725
|
try {
|
|
24267
24726
|
realUnitRoot = await fs.realpath(unitRootLexical, { stage: "unit-root-realpath" });
|
|
@@ -24274,14 +24733,14 @@ async function buildPublicStaging({
|
|
|
24274
24733
|
{ sourceRoot, unitSource: unit.source, cause: code }
|
|
24275
24734
|
);
|
|
24276
24735
|
}
|
|
24277
|
-
const effectiveOutputDir =
|
|
24278
|
-
outputDir ??
|
|
24736
|
+
const effectiveOutputDir = resolve17(
|
|
24737
|
+
outputDir ?? resolve17(sourceRoot, ".release-skill", "staging")
|
|
24279
24738
|
);
|
|
24280
24739
|
const preflightRecords = [];
|
|
24281
24740
|
const requiredTargetSet = new Set(unit.requiredPublicFiles ?? []);
|
|
24282
24741
|
for (const mapping of mappings) {
|
|
24283
|
-
const srcPath =
|
|
24284
|
-
const destPath =
|
|
24742
|
+
const srcPath = resolve17(sourceRoot, mapping.from);
|
|
24743
|
+
const destPath = resolve17(effectiveOutputDir, mapping.to);
|
|
24285
24744
|
if (srcPath.length > MAX_PATH_LENGTH || destPath.length > MAX_PATH_LENGTH) {
|
|
24286
24745
|
preflightRecords.push({
|
|
24287
24746
|
ok: false,
|
|
@@ -24768,11 +25227,11 @@ async function buildPublicStaging({
|
|
|
24768
25227
|
);
|
|
24769
25228
|
}
|
|
24770
25229
|
const destDir = dirname7(destPath);
|
|
24771
|
-
const relDest =
|
|
25230
|
+
const relDest = relative14(realOutputRoot, destDir);
|
|
24772
25231
|
const destSegments = relDest.split(pathSep).filter(Boolean);
|
|
24773
25232
|
let accumulatedPath = realOutputRoot;
|
|
24774
25233
|
for (const seg of destSegments) {
|
|
24775
|
-
accumulatedPath =
|
|
25234
|
+
accumulatedPath = resolve17(accumulatedPath, seg);
|
|
24776
25235
|
try {
|
|
24777
25236
|
const segStat = await fs.lstat(accumulatedPath, { stage: "dest-ancestor-pre-mkdir" });
|
|
24778
25237
|
if (segStat.isSymbolicLink()) {
|
|
@@ -25071,25 +25530,25 @@ var init_public_map = __esm({
|
|
|
25071
25530
|
});
|
|
25072
25531
|
|
|
25073
25532
|
// src/snapshot/scan.mjs
|
|
25074
|
-
import { readFile as readFile13, readdir as
|
|
25075
|
-
import { join as
|
|
25533
|
+
import { readFile as readFile13, readdir as readdir9, stat as stat3 } from "node:fs/promises";
|
|
25534
|
+
import { join as join13, relative as relative15, extname, posix as posix2, win32 } from "node:path";
|
|
25076
25535
|
import { createHash as createHash8 } from "node:crypto";
|
|
25077
25536
|
async function collectFiles(dir, base = dir) {
|
|
25078
25537
|
const results = [];
|
|
25079
25538
|
let entries;
|
|
25080
25539
|
try {
|
|
25081
|
-
entries = await
|
|
25540
|
+
entries = await readdir9(dir, { withFileTypes: true });
|
|
25082
25541
|
} catch {
|
|
25083
25542
|
return results;
|
|
25084
25543
|
}
|
|
25085
25544
|
for (const entry of entries) {
|
|
25086
25545
|
if (entry.name === ".git") continue;
|
|
25087
|
-
const abs =
|
|
25546
|
+
const abs = join13(dir, entry.name);
|
|
25088
25547
|
if (entry.isDirectory()) {
|
|
25089
25548
|
const sub = await collectFiles(abs, base);
|
|
25090
25549
|
results.push(...sub);
|
|
25091
25550
|
} else if (entry.isFile()) {
|
|
25092
|
-
results.push(
|
|
25551
|
+
results.push(relative15(base, abs));
|
|
25093
25552
|
}
|
|
25094
25553
|
}
|
|
25095
25554
|
return results;
|
|
@@ -25121,9 +25580,9 @@ async function scanFile(relPath, absPath, forbiddenPaths, forbiddenContentPatter
|
|
|
25121
25580
|
for (const fp of forbiddenPaths) {
|
|
25122
25581
|
const normFp = fp.replaceAll(win32.sep, posix2.sep).replace(/\/+$/, "").toLowerCase();
|
|
25123
25582
|
if (!normFp) continue;
|
|
25124
|
-
for (const
|
|
25125
|
-
const prefix = normFp.endsWith(
|
|
25126
|
-
const checkPath = lowerRel +
|
|
25583
|
+
for (const sep7 of separators) {
|
|
25584
|
+
const prefix = normFp.endsWith(sep7.toLowerCase()) ? normFp : normFp + sep7.toLowerCase();
|
|
25585
|
+
const checkPath = lowerRel + sep7.toLowerCase();
|
|
25127
25586
|
if (lowerRel === normFp || checkPath.startsWith(prefix)) {
|
|
25128
25587
|
const dedupKey = `FORBIDDEN_PATH:${normFp}:${normRel}`;
|
|
25129
25588
|
if (!seenKinds.has(dedupKey)) {
|
|
@@ -25209,7 +25668,7 @@ async function scanFile(relPath, absPath, forbiddenPaths, forbiddenContentPatter
|
|
|
25209
25668
|
}
|
|
25210
25669
|
async function scanForStaleDist(snapshotDir) {
|
|
25211
25670
|
const findings = [];
|
|
25212
|
-
const manifestPath =
|
|
25671
|
+
const manifestPath = join13(snapshotDir, "dist", "manifest.json");
|
|
25213
25672
|
let manifest;
|
|
25214
25673
|
try {
|
|
25215
25674
|
const raw = await readFile13(manifestPath, "utf8");
|
|
@@ -25220,10 +25679,10 @@ async function scanForStaleDist(snapshotDir) {
|
|
|
25220
25679
|
if (!manifest.files || typeof manifest.files !== "object") {
|
|
25221
25680
|
return findings;
|
|
25222
25681
|
}
|
|
25223
|
-
const distDir =
|
|
25682
|
+
const distDir = join13(snapshotDir, "dist");
|
|
25224
25683
|
for (const [fileRel, expectedHash] of Object.entries(manifest.files)) {
|
|
25225
25684
|
if (typeof expectedHash !== "string") continue;
|
|
25226
|
-
const fileAbs =
|
|
25685
|
+
const fileAbs = join13(distDir, fileRel);
|
|
25227
25686
|
let actualContent;
|
|
25228
25687
|
try {
|
|
25229
25688
|
actualContent = await readFile13(fileAbs);
|
|
@@ -25267,7 +25726,7 @@ async function scanSnapshot({ snapshotDir, policy = {} } = {}) {
|
|
|
25267
25726
|
const relFiles = await collectFiles(snapshotDir);
|
|
25268
25727
|
const seenKinds = /* @__PURE__ */ new Set();
|
|
25269
25728
|
for (const relPath of relFiles) {
|
|
25270
|
-
const absPath =
|
|
25729
|
+
const absPath = join13(snapshotDir, relPath);
|
|
25271
25730
|
const normRel = relPath.replaceAll(win32.sep, posix2.sep);
|
|
25272
25731
|
if (await isBinaryFile(relPath, absPath)) continue;
|
|
25273
25732
|
const fileFindings = await scanFile(normRel, absPath, forbiddenPaths, forbiddenContentPatterns, seenKinds);
|
|
@@ -25521,11 +25980,11 @@ var init_contract2 = __esm({
|
|
|
25521
25980
|
// src/core/source-authority.mjs
|
|
25522
25981
|
import { execFile as execFileCb6 } from "node:child_process";
|
|
25523
25982
|
import { promisify as promisify6 } from "node:util";
|
|
25524
|
-
import { lstat as
|
|
25525
|
-
import { join as
|
|
25983
|
+
import { lstat as lstat11, mkdtemp as mkdtemp2, readFile as readFile15, readdir as readdir10, realpath as realpath10, rm as rm5 } from "node:fs/promises";
|
|
25984
|
+
import { join as join14, relative as relative16, resolve as resolve18, sep as sep5 } from "node:path";
|
|
25526
25985
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
25527
25986
|
async function computeSourceInputClosure({ units, root }) {
|
|
25528
|
-
const realRoot = await
|
|
25987
|
+
const realRoot = await realpath10(resolve18(root));
|
|
25529
25988
|
const entriesByPath = /* @__PURE__ */ new Map();
|
|
25530
25989
|
for (const unit of units ?? []) {
|
|
25531
25990
|
for (const mapping of unit.publicFiles ?? []) {
|
|
@@ -25564,7 +26023,7 @@ function computeEntriesDigest(entries) {
|
|
|
25564
26023
|
async function collectPath({ absolutePath, root, entriesByPath }) {
|
|
25565
26024
|
let stat9;
|
|
25566
26025
|
try {
|
|
25567
|
-
stat9 = await
|
|
26026
|
+
stat9 = await lstat11(absolutePath);
|
|
25568
26027
|
} catch (error) {
|
|
25569
26028
|
throw new ReleaseError(
|
|
25570
26029
|
CONFIG_INVALID,
|
|
@@ -25580,7 +26039,7 @@ async function collectPath({ absolutePath, root, entriesByPath }) {
|
|
|
25580
26039
|
{ path: rel }
|
|
25581
26040
|
);
|
|
25582
26041
|
}
|
|
25583
|
-
const physicalPath = await
|
|
26042
|
+
const physicalPath = await realpath10(absolutePath);
|
|
25584
26043
|
if (physicalPath !== absolutePath) {
|
|
25585
26044
|
throw new ReleaseError(
|
|
25586
26045
|
CONFIG_INVALID,
|
|
@@ -25589,11 +26048,11 @@ async function collectPath({ absolutePath, root, entriesByPath }) {
|
|
|
25589
26048
|
);
|
|
25590
26049
|
}
|
|
25591
26050
|
if (stat9.isDirectory()) {
|
|
25592
|
-
const children = await
|
|
26051
|
+
const children = await readdir10(absolutePath, { withFileTypes: true });
|
|
25593
26052
|
children.sort((left, right) => left.name.localeCompare(right.name));
|
|
25594
26053
|
for (const child of children) {
|
|
25595
26054
|
await collectPath({
|
|
25596
|
-
absolutePath:
|
|
26055
|
+
absolutePath: join14(absolutePath, child.name),
|
|
25597
26056
|
root,
|
|
25598
26057
|
entriesByPath
|
|
25599
26058
|
});
|
|
@@ -25615,9 +26074,9 @@ async function collectPath({ absolutePath, root, entriesByPath }) {
|
|
|
25615
26074
|
});
|
|
25616
26075
|
}
|
|
25617
26076
|
function resolveInside(base, candidate, containmentRoot = base) {
|
|
25618
|
-
const resolved =
|
|
25619
|
-
const root =
|
|
25620
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
26077
|
+
const resolved = resolve18(base, candidate);
|
|
26078
|
+
const root = resolve18(containmentRoot);
|
|
26079
|
+
if (resolved !== root && !resolved.startsWith(`${root}${sep5}`)) {
|
|
25621
26080
|
throw new ReleaseError(
|
|
25622
26081
|
CONFIG_INVALID,
|
|
25623
26082
|
`source-input closure path escapes workspace root: "${candidate}"`,
|
|
@@ -25627,7 +26086,7 @@ function resolveInside(base, candidate, containmentRoot = base) {
|
|
|
25627
26086
|
return resolved;
|
|
25628
26087
|
}
|
|
25629
26088
|
function toRelative(root, absolutePath) {
|
|
25630
|
-
const rel =
|
|
26089
|
+
const rel = relative16(root, absolutePath).split(sep5).join("/");
|
|
25631
26090
|
if (!rel || rel === "." || rel.startsWith("../") || rel === "..") {
|
|
25632
26091
|
throw new ReleaseError(
|
|
25633
26092
|
CONFIG_INVALID,
|
|
@@ -25837,7 +26296,7 @@ async function verifyWithTemporaryGit({
|
|
|
25837
26296
|
if (!branchLine) {
|
|
25838
26297
|
return failure(REF_MISSING, `remote ref "refs/heads/${defaultBranch}" does not exist`);
|
|
25839
26298
|
}
|
|
25840
|
-
const tempRoot = await mkdtemp2(
|
|
26299
|
+
const tempRoot = await mkdtemp2(join14(tmpdir3(), "release-skill-source-authority-"));
|
|
25841
26300
|
try {
|
|
25842
26301
|
await execFn("git", ["init", "--bare", tempRoot], {
|
|
25843
26302
|
encoding: "utf8",
|
|
@@ -26944,10 +27403,10 @@ var require_commonjs = __commonJS({
|
|
|
26944
27403
|
* Return a void Promise that resolves once the stream ends.
|
|
26945
27404
|
*/
|
|
26946
27405
|
async promise() {
|
|
26947
|
-
return new Promise((
|
|
27406
|
+
return new Promise((resolve29, reject) => {
|
|
26948
27407
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
26949
27408
|
this.on("error", (er) => reject(er));
|
|
26950
|
-
this.on("end", () =>
|
|
27409
|
+
this.on("end", () => resolve29());
|
|
26951
27410
|
});
|
|
26952
27411
|
}
|
|
26953
27412
|
/**
|
|
@@ -26971,7 +27430,7 @@ var require_commonjs = __commonJS({
|
|
|
26971
27430
|
return Promise.resolve({ done: false, value: res });
|
|
26972
27431
|
if (this[EOF])
|
|
26973
27432
|
return stop();
|
|
26974
|
-
let
|
|
27433
|
+
let resolve29;
|
|
26975
27434
|
let reject;
|
|
26976
27435
|
const onerr = /* @__PURE__ */ __name((er) => {
|
|
26977
27436
|
this.off("data", ondata);
|
|
@@ -26985,19 +27444,19 @@ var require_commonjs = __commonJS({
|
|
|
26985
27444
|
this.off("end", onend);
|
|
26986
27445
|
this.off(DESTROYED, ondestroy);
|
|
26987
27446
|
this.pause();
|
|
26988
|
-
|
|
27447
|
+
resolve29({ value, done: !!this[EOF] });
|
|
26989
27448
|
}, "ondata");
|
|
26990
27449
|
const onend = /* @__PURE__ */ __name(() => {
|
|
26991
27450
|
this.off("error", onerr);
|
|
26992
27451
|
this.off("data", ondata);
|
|
26993
27452
|
this.off(DESTROYED, ondestroy);
|
|
26994
27453
|
stop();
|
|
26995
|
-
|
|
27454
|
+
resolve29({ done: true, value: void 0 });
|
|
26996
27455
|
}, "onend");
|
|
26997
27456
|
const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
|
|
26998
27457
|
return new Promise((res2, rej) => {
|
|
26999
27458
|
reject = rej;
|
|
27000
|
-
|
|
27459
|
+
resolve29 = res2;
|
|
27001
27460
|
this.once(DESTROYED, ondestroy);
|
|
27002
27461
|
this.once("error", onerr);
|
|
27003
27462
|
this.once("end", onend);
|
|
@@ -28088,10 +28547,10 @@ var require_minipass = __commonJS({
|
|
|
28088
28547
|
}
|
|
28089
28548
|
// stream.promise().then(() => done, er => emitted error)
|
|
28090
28549
|
promise() {
|
|
28091
|
-
return new Promise((
|
|
28550
|
+
return new Promise((resolve29, reject) => {
|
|
28092
28551
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
28093
28552
|
this.on("error", (er) => reject(er));
|
|
28094
|
-
this.on("end", () =>
|
|
28553
|
+
this.on("end", () => resolve29());
|
|
28095
28554
|
});
|
|
28096
28555
|
}
|
|
28097
28556
|
// for await (let chunk of stream)
|
|
@@ -28102,7 +28561,7 @@ var require_minipass = __commonJS({
|
|
|
28102
28561
|
return Promise.resolve({ done: false, value: res });
|
|
28103
28562
|
if (this[EOF])
|
|
28104
28563
|
return Promise.resolve({ done: true });
|
|
28105
|
-
let
|
|
28564
|
+
let resolve29 = null;
|
|
28106
28565
|
let reject = null;
|
|
28107
28566
|
const onerr = /* @__PURE__ */ __name((er) => {
|
|
28108
28567
|
this.removeListener("data", ondata);
|
|
@@ -28113,17 +28572,17 @@ var require_minipass = __commonJS({
|
|
|
28113
28572
|
this.removeListener("error", onerr);
|
|
28114
28573
|
this.removeListener("end", onend);
|
|
28115
28574
|
this.pause();
|
|
28116
|
-
|
|
28575
|
+
resolve29({ value, done: !!this[EOF] });
|
|
28117
28576
|
}, "ondata");
|
|
28118
28577
|
const onend = /* @__PURE__ */ __name(() => {
|
|
28119
28578
|
this.removeListener("error", onerr);
|
|
28120
28579
|
this.removeListener("data", ondata);
|
|
28121
|
-
|
|
28580
|
+
resolve29({ done: true });
|
|
28122
28581
|
}, "onend");
|
|
28123
28582
|
const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
|
|
28124
28583
|
return new Promise((res2, rej) => {
|
|
28125
28584
|
reject = rej;
|
|
28126
|
-
|
|
28585
|
+
resolve29 = res2;
|
|
28127
28586
|
this.once(DESTROYED, ondestroy);
|
|
28128
28587
|
this.once("error", onerr);
|
|
28129
28588
|
this.once("end", onend);
|
|
@@ -32162,12 +32621,12 @@ var require_body = __commonJS({
|
|
|
32162
32621
|
if (resTimeout && resTimeout.unref) {
|
|
32163
32622
|
resTimeout.unref();
|
|
32164
32623
|
}
|
|
32165
|
-
return new Promise((
|
|
32624
|
+
return new Promise((resolve29) => {
|
|
32166
32625
|
if (stream !== upstream) {
|
|
32167
32626
|
upstream.on("error", (er) => stream.emit("error", er));
|
|
32168
32627
|
upstream.pipe(stream);
|
|
32169
32628
|
}
|
|
32170
|
-
|
|
32629
|
+
resolve29();
|
|
32171
32630
|
}).then(() => stream.concat()).then((buf) => {
|
|
32172
32631
|
clearTimeout(resTimeout);
|
|
32173
32632
|
return buf;
|
|
@@ -32932,7 +33391,7 @@ var require_lib2 = __commonJS({
|
|
|
32932
33391
|
var fetch = /* @__PURE__ */ __name(async (url, opts) => {
|
|
32933
33392
|
if (/^data:/.test(url)) {
|
|
32934
33393
|
const request = new Request(url, opts);
|
|
32935
|
-
return Promise.resolve().then(() => new Promise((
|
|
33394
|
+
return Promise.resolve().then(() => new Promise((resolve29, reject) => {
|
|
32936
33395
|
let type, data;
|
|
32937
33396
|
try {
|
|
32938
33397
|
const { pathname, search } = new URL2(url);
|
|
@@ -32956,10 +33415,10 @@ var require_lib2 = __commonJS({
|
|
|
32956
33415
|
if (type) {
|
|
32957
33416
|
headers["Content-Type"] = type;
|
|
32958
33417
|
}
|
|
32959
|
-
return
|
|
33418
|
+
return resolve29(new Response(data, { headers }));
|
|
32960
33419
|
}));
|
|
32961
33420
|
}
|
|
32962
|
-
return new Promise((
|
|
33421
|
+
return new Promise((resolve29, reject) => {
|
|
32963
33422
|
const request = new Request(url, opts);
|
|
32964
33423
|
let options;
|
|
32965
33424
|
try {
|
|
@@ -33078,7 +33537,7 @@ var require_lib2 = __commonJS({
|
|
|
33078
33537
|
requestOpts.body = void 0;
|
|
33079
33538
|
requestOpts.headers.delete("content-length");
|
|
33080
33539
|
}
|
|
33081
|
-
|
|
33540
|
+
resolve29(fetch(new Request(locationURL, requestOpts)));
|
|
33082
33541
|
finalize();
|
|
33083
33542
|
return;
|
|
33084
33543
|
}
|
|
@@ -33106,7 +33565,7 @@ var require_lib2 = __commonJS({
|
|
|
33106
33565
|
const codings = headers.get("Content-Encoding");
|
|
33107
33566
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
33108
33567
|
response = new Response(body, responseOptions);
|
|
33109
|
-
|
|
33568
|
+
resolve29(response);
|
|
33110
33569
|
return;
|
|
33111
33570
|
}
|
|
33112
33571
|
const zlibOptions = {
|
|
@@ -33125,7 +33584,7 @@ var require_lib2 = __commonJS({
|
|
|
33125
33584
|
).pipe(unzip),
|
|
33126
33585
|
responseOptions
|
|
33127
33586
|
);
|
|
33128
|
-
|
|
33587
|
+
resolve29(response);
|
|
33129
33588
|
return;
|
|
33130
33589
|
}
|
|
33131
33590
|
if (codings === "deflate" || codings === "x-deflate") {
|
|
@@ -33137,7 +33596,7 @@ var require_lib2 = __commonJS({
|
|
|
33137
33596
|
(er) => decoder2.emit("error", er)
|
|
33138
33597
|
).pipe(decoder2);
|
|
33139
33598
|
response = new Response(decoder2, responseOptions);
|
|
33140
|
-
|
|
33599
|
+
resolve29(response);
|
|
33141
33600
|
});
|
|
33142
33601
|
return;
|
|
33143
33602
|
}
|
|
@@ -33155,11 +33614,11 @@ var require_lib2 = __commonJS({
|
|
|
33155
33614
|
(er) => decoder.emit("error", er)
|
|
33156
33615
|
).pipe(decoder);
|
|
33157
33616
|
response = new Response(decoder, responseOptions);
|
|
33158
|
-
|
|
33617
|
+
resolve29(response);
|
|
33159
33618
|
return;
|
|
33160
33619
|
}
|
|
33161
33620
|
response = new Response(body, responseOptions);
|
|
33162
|
-
|
|
33621
|
+
resolve29(response);
|
|
33163
33622
|
});
|
|
33164
33623
|
writeToStream(req, request);
|
|
33165
33624
|
});
|
|
@@ -33413,12 +33872,12 @@ var require_lib3 = __commonJS({
|
|
|
33413
33872
|
return process.emit("input", "end");
|
|
33414
33873
|
}, "end"),
|
|
33415
33874
|
read: /* @__PURE__ */ __name(function(...args2) {
|
|
33416
|
-
let
|
|
33875
|
+
let resolve29, reject;
|
|
33417
33876
|
const promise = new Promise((_resolve, _reject) => {
|
|
33418
|
-
|
|
33877
|
+
resolve29 = _resolve;
|
|
33419
33878
|
reject = _reject;
|
|
33420
33879
|
});
|
|
33421
|
-
process.emit("input", "read",
|
|
33880
|
+
process.emit("input", "read", resolve29, reject, ...args2);
|
|
33422
33881
|
return promise;
|
|
33423
33882
|
}, "read")
|
|
33424
33883
|
}
|
|
@@ -37833,7 +38292,7 @@ var require_npa = __commonJS({
|
|
|
37833
38292
|
spec = arg;
|
|
37834
38293
|
}
|
|
37835
38294
|
}
|
|
37836
|
-
return
|
|
38295
|
+
return resolve29(name, spec, where, arg);
|
|
37837
38296
|
}
|
|
37838
38297
|
__name(npa, "npa");
|
|
37839
38298
|
function isFileSpec(spec) {
|
|
@@ -37856,7 +38315,7 @@ var require_npa = __commonJS({
|
|
|
37856
38315
|
return spec.toLowerCase().startsWith("npm:");
|
|
37857
38316
|
}
|
|
37858
38317
|
__name(isAliasSpec, "isAliasSpec");
|
|
37859
|
-
function
|
|
38318
|
+
function resolve29(name, spec, where, arg) {
|
|
37860
38319
|
const res = new Result({
|
|
37861
38320
|
raw: arg,
|
|
37862
38321
|
name,
|
|
@@ -37888,7 +38347,7 @@ var require_npa = __commonJS({
|
|
|
37888
38347
|
return fromRegistry(res);
|
|
37889
38348
|
}
|
|
37890
38349
|
}
|
|
37891
|
-
__name(
|
|
38350
|
+
__name(resolve29, "resolve");
|
|
37892
38351
|
function toPurl(arg, reg = defaultRegistry) {
|
|
37893
38352
|
const res = npa(arg);
|
|
37894
38353
|
if (res.type !== "version") {
|
|
@@ -38189,7 +38648,7 @@ var require_npa = __commonJS({
|
|
|
38189
38648
|
}
|
|
38190
38649
|
__name(fromRegistry, "fromRegistry");
|
|
38191
38650
|
module.exports = npa;
|
|
38192
|
-
module.exports.resolve =
|
|
38651
|
+
module.exports.resolve = resolve29;
|
|
38193
38652
|
module.exports.toPurl = toPurl;
|
|
38194
38653
|
module.exports.Result = Result;
|
|
38195
38654
|
}
|
|
@@ -39780,7 +40239,7 @@ var require_lib7 = __commonJS({
|
|
|
39780
40239
|
return `${this.algorithm}-${this.digest}${getOptString(this.options)}`;
|
|
39781
40240
|
}
|
|
39782
40241
|
};
|
|
39783
|
-
function integrityHashToString(toString,
|
|
40242
|
+
function integrityHashToString(toString, sep7, opts, hashes) {
|
|
39784
40243
|
const toStringIsNotEmpty = toString !== "";
|
|
39785
40244
|
let shouldAddFirstSep = false;
|
|
39786
40245
|
let complement = "";
|
|
@@ -39790,7 +40249,7 @@ var require_lib7 = __commonJS({
|
|
|
39790
40249
|
if (hashString) {
|
|
39791
40250
|
shouldAddFirstSep = true;
|
|
39792
40251
|
complement += hashString;
|
|
39793
|
-
complement +=
|
|
40252
|
+
complement += sep7;
|
|
39794
40253
|
}
|
|
39795
40254
|
}
|
|
39796
40255
|
const finalHashString = Hash.prototype.toString.call(hashes[lastIndex], opts);
|
|
@@ -39799,7 +40258,7 @@ var require_lib7 = __commonJS({
|
|
|
39799
40258
|
complement += finalHashString;
|
|
39800
40259
|
}
|
|
39801
40260
|
if (toStringIsNotEmpty && shouldAddFirstSep) {
|
|
39802
|
-
return toString +
|
|
40261
|
+
return toString + sep7 + complement;
|
|
39803
40262
|
}
|
|
39804
40263
|
return toString + complement;
|
|
39805
40264
|
}
|
|
@@ -39818,18 +40277,18 @@ var require_lib7 = __commonJS({
|
|
|
39818
40277
|
return Object.keys(this).length === 0;
|
|
39819
40278
|
}
|
|
39820
40279
|
toString(opts) {
|
|
39821
|
-
let
|
|
40280
|
+
let sep7 = opts?.sep || " ";
|
|
39822
40281
|
let toString = "";
|
|
39823
40282
|
if (opts?.strict) {
|
|
39824
|
-
|
|
40283
|
+
sep7 = sep7.replace(/\S+/g, " ");
|
|
39825
40284
|
for (const hash of SPEC_ALGORITHMS) {
|
|
39826
40285
|
if (this[hash]) {
|
|
39827
|
-
toString = integrityHashToString(toString,
|
|
40286
|
+
toString = integrityHashToString(toString, sep7, opts, this[hash]);
|
|
39828
40287
|
}
|
|
39829
40288
|
}
|
|
39830
40289
|
} else {
|
|
39831
40290
|
for (const hash of Object.keys(this)) {
|
|
39832
|
-
toString = integrityHashToString(toString,
|
|
40291
|
+
toString = integrityHashToString(toString, sep7, opts, this[hash]);
|
|
39833
40292
|
}
|
|
39834
40293
|
}
|
|
39835
40294
|
return toString;
|
|
@@ -39962,7 +40421,7 @@ var require_lib7 = __commonJS({
|
|
|
39962
40421
|
module.exports.fromStream = fromStream;
|
|
39963
40422
|
function fromStream(stream, opts) {
|
|
39964
40423
|
const istream = integrityStream(opts);
|
|
39965
|
-
return new Promise((
|
|
40424
|
+
return new Promise((resolve29, reject) => {
|
|
39966
40425
|
stream.pipe(istream);
|
|
39967
40426
|
stream.on("error", reject);
|
|
39968
40427
|
istream.on("error", reject);
|
|
@@ -39970,7 +40429,7 @@ var require_lib7 = __commonJS({
|
|
|
39970
40429
|
istream.on("integrity", (s) => {
|
|
39971
40430
|
sri = s;
|
|
39972
40431
|
});
|
|
39973
|
-
istream.on("end", () =>
|
|
40432
|
+
istream.on("end", () => resolve29(sri));
|
|
39974
40433
|
istream.resume();
|
|
39975
40434
|
});
|
|
39976
40435
|
}
|
|
@@ -40031,7 +40490,7 @@ var require_lib7 = __commonJS({
|
|
|
40031
40490
|
));
|
|
40032
40491
|
}
|
|
40033
40492
|
const checker = integrityStream(opts);
|
|
40034
|
-
return new Promise((
|
|
40493
|
+
return new Promise((resolve29, reject) => {
|
|
40035
40494
|
stream.pipe(checker);
|
|
40036
40495
|
stream.on("error", reject);
|
|
40037
40496
|
checker.on("error", reject);
|
|
@@ -40039,7 +40498,7 @@ var require_lib7 = __commonJS({
|
|
|
40039
40498
|
checker.on("verified", (s) => {
|
|
40040
40499
|
verified = s;
|
|
40041
40500
|
});
|
|
40042
|
-
checker.on("end", () =>
|
|
40501
|
+
checker.on("end", () => resolve29(verified));
|
|
40043
40502
|
checker.resume();
|
|
40044
40503
|
});
|
|
40045
40504
|
}
|
|
@@ -40920,9 +41379,9 @@ var require_polyfill = __commonJS({
|
|
|
40920
41379
|
var {
|
|
40921
41380
|
chmod: chmod5,
|
|
40922
41381
|
copyFile,
|
|
40923
|
-
lstat:
|
|
41382
|
+
lstat: lstat18,
|
|
40924
41383
|
mkdir: mkdir18,
|
|
40925
|
-
readdir:
|
|
41384
|
+
readdir: readdir17,
|
|
40926
41385
|
readlink: readlink2,
|
|
40927
41386
|
stat: stat9,
|
|
40928
41387
|
symlink,
|
|
@@ -40931,11 +41390,11 @@ var require_polyfill = __commonJS({
|
|
|
40931
41390
|
} = __require("fs/promises");
|
|
40932
41391
|
var {
|
|
40933
41392
|
dirname: dirname16,
|
|
40934
|
-
isAbsolute:
|
|
40935
|
-
join:
|
|
41393
|
+
isAbsolute: isAbsolute22,
|
|
41394
|
+
join: join30,
|
|
40936
41395
|
parse: parse2,
|
|
40937
|
-
resolve:
|
|
40938
|
-
sep:
|
|
41396
|
+
resolve: resolve29,
|
|
41397
|
+
sep: sep7,
|
|
40939
41398
|
toNamespacedPath
|
|
40940
41399
|
} = __require("path");
|
|
40941
41400
|
var { fileURLToPath: fileURLToPath3 } = __require("url");
|
|
@@ -41021,7 +41480,7 @@ var require_polyfill = __commonJS({
|
|
|
41021
41480
|
}
|
|
41022
41481
|
__name(areIdentical, "areIdentical");
|
|
41023
41482
|
function getStats(src, dest, opts) {
|
|
41024
|
-
const statFunc = opts.dereference ? (file) => stat9(file, { bigint: true }) : (file) =>
|
|
41483
|
+
const statFunc = opts.dereference ? (file) => stat9(file, { bigint: true }) : (file) => lstat18(file, { bigint: true });
|
|
41025
41484
|
return Promise.all([
|
|
41026
41485
|
statFunc(src),
|
|
41027
41486
|
statFunc(dest).catch((err) => {
|
|
@@ -41052,8 +41511,8 @@ var require_polyfill = __commonJS({
|
|
|
41052
41511
|
}
|
|
41053
41512
|
__name(pathExists2, "pathExists");
|
|
41054
41513
|
async function checkParentPaths(src, srcStat, dest) {
|
|
41055
|
-
const srcParent =
|
|
41056
|
-
const destParent =
|
|
41514
|
+
const srcParent = resolve29(dirname16(src));
|
|
41515
|
+
const destParent = resolve29(dirname16(dest));
|
|
41057
41516
|
if (destParent === srcParent || destParent === parse2(destParent).root) {
|
|
41058
41517
|
return;
|
|
41059
41518
|
}
|
|
@@ -41077,7 +41536,7 @@ var require_polyfill = __commonJS({
|
|
|
41077
41536
|
return checkParentPaths(src, srcStat, destParent);
|
|
41078
41537
|
}
|
|
41079
41538
|
__name(checkParentPaths, "checkParentPaths");
|
|
41080
|
-
var normalizePathToArray = /* @__PURE__ */ __name((path3) =>
|
|
41539
|
+
var normalizePathToArray = /* @__PURE__ */ __name((path3) => resolve29(path3).split(sep7).filter(Boolean), "normalizePathToArray");
|
|
41081
41540
|
function isSrcSubdir(src, dest) {
|
|
41082
41541
|
const srcArr = normalizePathToArray(src);
|
|
41083
41542
|
const destArr = normalizePathToArray(dest);
|
|
@@ -41099,7 +41558,7 @@ var require_polyfill = __commonJS({
|
|
|
41099
41558
|
}
|
|
41100
41559
|
__name(startCopy, "startCopy");
|
|
41101
41560
|
async function getStatsForCopy(destStat, src, dest, opts) {
|
|
41102
|
-
const statFn = opts.dereference ? stat9 :
|
|
41561
|
+
const statFn = opts.dereference ? stat9 : lstat18;
|
|
41103
41562
|
const srcStat = await statFn(src);
|
|
41104
41563
|
if (srcStat.isDirectory() && opts.recursive) {
|
|
41105
41564
|
return onDir(srcStat, destStat, src, dest, opts);
|
|
@@ -41210,11 +41669,11 @@ var require_polyfill = __commonJS({
|
|
|
41210
41669
|
}
|
|
41211
41670
|
__name(mkDirAndCopy, "mkDirAndCopy");
|
|
41212
41671
|
async function copyDir(src, dest, opts) {
|
|
41213
|
-
const dir = await
|
|
41672
|
+
const dir = await readdir17(src);
|
|
41214
41673
|
for (let i = 0; i < dir.length; i++) {
|
|
41215
41674
|
const item = dir[i];
|
|
41216
|
-
const srcItem =
|
|
41217
|
-
const destItem =
|
|
41675
|
+
const srcItem = join30(src, item);
|
|
41676
|
+
const destItem = join30(dest, item);
|
|
41218
41677
|
const { destStat } = await checkPaths(srcItem, destItem, opts);
|
|
41219
41678
|
await startCopy(destStat, srcItem, destItem, opts);
|
|
41220
41679
|
}
|
|
@@ -41222,8 +41681,8 @@ var require_polyfill = __commonJS({
|
|
|
41222
41681
|
__name(copyDir, "copyDir");
|
|
41223
41682
|
async function onLink(destStat, src, dest) {
|
|
41224
41683
|
let resolvedSrc = await readlink2(src);
|
|
41225
|
-
if (!
|
|
41226
|
-
resolvedSrc =
|
|
41684
|
+
if (!isAbsolute22(resolvedSrc)) {
|
|
41685
|
+
resolvedSrc = resolve29(dirname16(src), resolvedSrc);
|
|
41227
41686
|
}
|
|
41228
41687
|
if (!destStat) {
|
|
41229
41688
|
return symlink(resolvedSrc, dest);
|
|
@@ -41237,8 +41696,8 @@ var require_polyfill = __commonJS({
|
|
|
41237
41696
|
}
|
|
41238
41697
|
throw err;
|
|
41239
41698
|
}
|
|
41240
|
-
if (!
|
|
41241
|
-
resolvedDest =
|
|
41699
|
+
if (!isAbsolute22(resolvedDest)) {
|
|
41700
|
+
resolvedDest = resolve29(dirname16(dest), resolvedDest);
|
|
41242
41701
|
}
|
|
41243
41702
|
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
41244
41703
|
throw new ERR_FS_CP_EINVAL({
|
|
@@ -41290,7 +41749,7 @@ var require_cp = __commonJS({
|
|
|
41290
41749
|
// ../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js
|
|
41291
41750
|
var require_with_temp_dir = __commonJS({
|
|
41292
41751
|
"../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js"(exports, module) {
|
|
41293
|
-
var { join:
|
|
41752
|
+
var { join: join30, sep: sep7 } = __require("path");
|
|
41294
41753
|
var getOptions = require_get_options();
|
|
41295
41754
|
var { mkdir: mkdir18, mkdtemp: mkdtemp6, rm: rm10 } = __require("fs/promises");
|
|
41296
41755
|
var withTempDir = /* @__PURE__ */ __name(async (root, fn, opts) => {
|
|
@@ -41298,7 +41757,7 @@ var require_with_temp_dir = __commonJS({
|
|
|
41298
41757
|
copy: ["tmpPrefix"]
|
|
41299
41758
|
});
|
|
41300
41759
|
await mkdir18(root, { recursive: true });
|
|
41301
|
-
const target = await mkdtemp6(
|
|
41760
|
+
const target = await mkdtemp6(join30(`${root}${sep7}`, options.tmpPrefix || ""));
|
|
41302
41761
|
let err;
|
|
41303
41762
|
let result;
|
|
41304
41763
|
try {
|
|
@@ -41322,14 +41781,14 @@ var require_with_temp_dir = __commonJS({
|
|
|
41322
41781
|
// ../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/readdir-scoped.js
|
|
41323
41782
|
var require_readdir_scoped = __commonJS({
|
|
41324
41783
|
"../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/readdir-scoped.js"(exports, module) {
|
|
41325
|
-
var { readdir:
|
|
41326
|
-
var { join:
|
|
41784
|
+
var { readdir: readdir17 } = __require("fs/promises");
|
|
41785
|
+
var { join: join30 } = __require("path");
|
|
41327
41786
|
var readdirScoped = /* @__PURE__ */ __name(async (dir) => {
|
|
41328
41787
|
const results = [];
|
|
41329
|
-
for (const item of await
|
|
41788
|
+
for (const item of await readdir17(dir)) {
|
|
41330
41789
|
if (item.startsWith("@")) {
|
|
41331
|
-
for (const scopedItem of await
|
|
41332
|
-
results.push(
|
|
41790
|
+
for (const scopedItem of await readdir17(join30(dir, item))) {
|
|
41791
|
+
results.push(join30(item, scopedItem));
|
|
41333
41792
|
}
|
|
41334
41793
|
} else {
|
|
41335
41794
|
results.push(item);
|
|
@@ -41344,7 +41803,7 @@ var require_readdir_scoped = __commonJS({
|
|
|
41344
41803
|
// ../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/move-file.js
|
|
41345
41804
|
var require_move_file = __commonJS({
|
|
41346
41805
|
"../../node_modules/.pnpm/@npmcli+fs@4.0.0/node_modules/@npmcli/fs/lib/move-file.js"(exports, module) {
|
|
41347
|
-
var { dirname: dirname16, join:
|
|
41806
|
+
var { dirname: dirname16, join: join30, resolve: resolve29, relative: relative26, isAbsolute: isAbsolute22 } = __require("path");
|
|
41348
41807
|
var fs = __require("fs/promises");
|
|
41349
41808
|
var pathExists2 = /* @__PURE__ */ __name(async (path3) => {
|
|
41350
41809
|
try {
|
|
@@ -41374,7 +41833,7 @@ var require_move_file = __commonJS({
|
|
|
41374
41833
|
if (sourceStat.isDirectory()) {
|
|
41375
41834
|
const files = await fs.readdir(source);
|
|
41376
41835
|
await Promise.all(files.map(
|
|
41377
|
-
(file) => moveFile(
|
|
41836
|
+
(file) => moveFile(join30(source, file), join30(destination, file), options, false, symlinks)
|
|
41378
41837
|
));
|
|
41379
41838
|
} else if (sourceStat.isSymbolicLink()) {
|
|
41380
41839
|
symlinks.push({ source, destination });
|
|
@@ -41388,12 +41847,12 @@ var require_move_file = __commonJS({
|
|
|
41388
41847
|
if (root) {
|
|
41389
41848
|
await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
|
|
41390
41849
|
let target = await fs.readlink(symSource);
|
|
41391
|
-
if (
|
|
41392
|
-
target =
|
|
41850
|
+
if (isAbsolute22(target)) {
|
|
41851
|
+
target = resolve29(symDestination, relative26(symSource, target));
|
|
41393
41852
|
}
|
|
41394
41853
|
let targetStat = "file";
|
|
41395
41854
|
try {
|
|
41396
|
-
targetStat = await fs.stat(
|
|
41855
|
+
targetStat = await fs.stat(resolve29(dirname16(symSource), target));
|
|
41397
41856
|
if (targetStat.isDirectory()) {
|
|
41398
41857
|
targetStat = "junction";
|
|
41399
41858
|
}
|
|
@@ -41466,7 +41925,7 @@ async function pMap(iterable, mapper, {
|
|
|
41466
41925
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
41467
41926
|
signal?.removeEventListener("abort", signalListener);
|
|
41468
41927
|
}, "cleanup");
|
|
41469
|
-
const
|
|
41928
|
+
const resolve29 = /* @__PURE__ */ __name((value) => {
|
|
41470
41929
|
resolve_(value);
|
|
41471
41930
|
cleanup();
|
|
41472
41931
|
}, "resolve");
|
|
@@ -41498,7 +41957,7 @@ async function pMap(iterable, mapper, {
|
|
|
41498
41957
|
}
|
|
41499
41958
|
isResolved = true;
|
|
41500
41959
|
if (skippedIndexesMap.size === 0) {
|
|
41501
|
-
|
|
41960
|
+
resolve29(result);
|
|
41502
41961
|
return;
|
|
41503
41962
|
}
|
|
41504
41963
|
const pureResult = [];
|
|
@@ -41508,7 +41967,7 @@ async function pMap(iterable, mapper, {
|
|
|
41508
41967
|
}
|
|
41509
41968
|
pureResult.push(value);
|
|
41510
41969
|
}
|
|
41511
|
-
|
|
41970
|
+
resolve29(pureResult);
|
|
41512
41971
|
}
|
|
41513
41972
|
return;
|
|
41514
41973
|
}
|
|
@@ -41649,7 +42108,7 @@ var require_entry_index = __commonJS({
|
|
|
41649
42108
|
appendFile,
|
|
41650
42109
|
mkdir: mkdir18,
|
|
41651
42110
|
readFile: readFile33,
|
|
41652
|
-
readdir:
|
|
42111
|
+
readdir: readdir17,
|
|
41653
42112
|
rm: rm10,
|
|
41654
42113
|
writeFile: writeFile11
|
|
41655
42114
|
} = __require("fs/promises");
|
|
@@ -41909,7 +42368,7 @@ ${hashEntry(stringified)} ${stringified}`);
|
|
|
41909
42368
|
}
|
|
41910
42369
|
__name(formatEntry, "formatEntry");
|
|
41911
42370
|
function readdirOrEmpty(dir) {
|
|
41912
|
-
return
|
|
42371
|
+
return readdir17(dir).catch((err) => {
|
|
41913
42372
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") {
|
|
41914
42373
|
return [];
|
|
41915
42374
|
}
|
|
@@ -45714,9 +46173,9 @@ var require_commonjs5 = __commonJS({
|
|
|
45714
46173
|
if (this.#asyncReaddirInFlight) {
|
|
45715
46174
|
await this.#asyncReaddirInFlight;
|
|
45716
46175
|
} else {
|
|
45717
|
-
let
|
|
46176
|
+
let resolve29 = /* @__PURE__ */ __name(() => {
|
|
45718
46177
|
}, "resolve");
|
|
45719
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
46178
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve29 = res);
|
|
45720
46179
|
try {
|
|
45721
46180
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
45722
46181
|
withFileTypes: true
|
|
@@ -45729,7 +46188,7 @@ var require_commonjs5 = __commonJS({
|
|
|
45729
46188
|
children.provisional = 0;
|
|
45730
46189
|
}
|
|
45731
46190
|
this.#asyncReaddirInFlight = void 0;
|
|
45732
|
-
|
|
46191
|
+
resolve29();
|
|
45733
46192
|
}
|
|
45734
46193
|
return children.slice(0, children.provisional);
|
|
45735
46194
|
}
|
|
@@ -45971,7 +46430,7 @@ var require_commonjs5 = __commonJS({
|
|
|
45971
46430
|
*
|
|
45972
46431
|
* @internal
|
|
45973
46432
|
*/
|
|
45974
|
-
constructor(cwd = process.cwd(), pathImpl,
|
|
46433
|
+
constructor(cwd = process.cwd(), pathImpl, sep7, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS } = {}) {
|
|
45975
46434
|
this.#fs = fsFromOption(fs);
|
|
45976
46435
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
45977
46436
|
cwd = (0, node_url_1.fileURLToPath)(cwd);
|
|
@@ -45982,7 +46441,7 @@ var require_commonjs5 = __commonJS({
|
|
|
45982
46441
|
this.#resolveCache = new ResolveCache();
|
|
45983
46442
|
this.#resolvePosixCache = new ResolveCache();
|
|
45984
46443
|
this.#children = new ChildrenCache(childrenCacheSize);
|
|
45985
|
-
const split = cwdPath.substring(this.rootPath.length).split(
|
|
46444
|
+
const split = cwdPath.substring(this.rootPath.length).split(sep7);
|
|
45986
46445
|
if (split.length === 1 && !split[0]) {
|
|
45987
46446
|
split.pop();
|
|
45988
46447
|
}
|
|
@@ -46840,10 +47299,10 @@ var require_ignore = __commonJS({
|
|
|
46840
47299
|
ignored(p) {
|
|
46841
47300
|
const fullpath = p.fullpath();
|
|
46842
47301
|
const fullpaths = `${fullpath}/`;
|
|
46843
|
-
const
|
|
46844
|
-
const relatives = `${
|
|
47302
|
+
const relative26 = p.relative() || ".";
|
|
47303
|
+
const relatives = `${relative26}/`;
|
|
46845
47304
|
for (const m of this.relative) {
|
|
46846
|
-
if (m.match(
|
|
47305
|
+
if (m.match(relative26) || m.match(relatives))
|
|
46847
47306
|
return true;
|
|
46848
47307
|
}
|
|
46849
47308
|
for (const m of this.absolute) {
|
|
@@ -46854,9 +47313,9 @@ var require_ignore = __commonJS({
|
|
|
46854
47313
|
}
|
|
46855
47314
|
childrenIgnored(p) {
|
|
46856
47315
|
const fullpath = p.fullpath() + "/";
|
|
46857
|
-
const
|
|
47316
|
+
const relative26 = (p.relative() || ".") + "/";
|
|
46858
47317
|
for (const m of this.relativeChildren) {
|
|
46859
|
-
if (m.match(
|
|
47318
|
+
if (m.match(relative26))
|
|
46860
47319
|
return true;
|
|
46861
47320
|
}
|
|
46862
47321
|
for (const m of this.absoluteChildren) {
|
|
@@ -47947,8 +48406,8 @@ var require_verify = __commonJS({
|
|
|
47947
48406
|
liveContent.add(integrity[algo].toString());
|
|
47948
48407
|
}
|
|
47949
48408
|
});
|
|
47950
|
-
await new Promise((
|
|
47951
|
-
indexStream.on("end",
|
|
48409
|
+
await new Promise((resolve29, reject) => {
|
|
48410
|
+
indexStream.on("end", resolve29).on("error", reject);
|
|
47952
48411
|
});
|
|
47953
48412
|
const contentDir = contentPath.contentDir(cache);
|
|
47954
48413
|
const files = await glob(path3.join(contentDir, "**"), {
|
|
@@ -48504,7 +48963,7 @@ var require_promise_retry = __commonJS({
|
|
|
48504
48963
|
fn = temp;
|
|
48505
48964
|
}
|
|
48506
48965
|
operation = retry.operation(options);
|
|
48507
|
-
return new Promise(function(
|
|
48966
|
+
return new Promise(function(resolve29, reject) {
|
|
48508
48967
|
operation.attempt(function(number) {
|
|
48509
48968
|
Promise.resolve().then(function() {
|
|
48510
48969
|
return fn(function(err) {
|
|
@@ -48513,7 +48972,7 @@ var require_promise_retry = __commonJS({
|
|
|
48513
48972
|
}
|
|
48514
48973
|
throw errcode(new Error("Retrying"), "EPROMISERETRY", { retried: err });
|
|
48515
48974
|
}, number);
|
|
48516
|
-
}).then(
|
|
48975
|
+
}).then(resolve29, function(err) {
|
|
48517
48976
|
if (isRetryError(err)) {
|
|
48518
48977
|
err = err.retried;
|
|
48519
48978
|
if (operation.retry(err || new Error())) {
|
|
@@ -49398,8 +49857,8 @@ var require_helpers = __commonJS({
|
|
|
49398
49857
|
function req(url, opts = {}) {
|
|
49399
49858
|
const href = typeof url === "string" ? url : url.href;
|
|
49400
49859
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
49401
|
-
const promise = new Promise((
|
|
49402
|
-
req2.once("response",
|
|
49860
|
+
const promise = new Promise((resolve29, reject) => {
|
|
49861
|
+
req2.once("response", resolve29).once("error", reject).end();
|
|
49403
49862
|
});
|
|
49404
49863
|
req2.then = promise.then.bind(promise);
|
|
49405
49864
|
return req2;
|
|
@@ -49714,7 +50173,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
49714
50173
|
var debug_1 = __importDefault(require_src());
|
|
49715
50174
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
49716
50175
|
function parseProxyResponse(socket) {
|
|
49717
|
-
return new Promise((
|
|
50176
|
+
return new Promise((resolve29, reject) => {
|
|
49718
50177
|
let buffersLength = 0;
|
|
49719
50178
|
const buffers = [];
|
|
49720
50179
|
function read() {
|
|
@@ -49784,7 +50243,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
49784
50243
|
}
|
|
49785
50244
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
49786
50245
|
cleanup();
|
|
49787
|
-
|
|
50246
|
+
resolve29({
|
|
49788
50247
|
connect: {
|
|
49789
50248
|
statusCode,
|
|
49790
50249
|
statusText,
|
|
@@ -53463,12 +53922,12 @@ var require_socksclient = __commonJS({
|
|
|
53463
53922
|
"use strict";
|
|
53464
53923
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
53465
53924
|
function adopt(value) {
|
|
53466
|
-
return value instanceof P ? value : new P(function(
|
|
53467
|
-
|
|
53925
|
+
return value instanceof P ? value : new P(function(resolve29) {
|
|
53926
|
+
resolve29(value);
|
|
53468
53927
|
});
|
|
53469
53928
|
}
|
|
53470
53929
|
__name(adopt, "adopt");
|
|
53471
|
-
return new (P || (P = Promise))(function(
|
|
53930
|
+
return new (P || (P = Promise))(function(resolve29, reject) {
|
|
53472
53931
|
function fulfilled(value) {
|
|
53473
53932
|
try {
|
|
53474
53933
|
step(generator.next(value));
|
|
@@ -53486,7 +53945,7 @@ var require_socksclient = __commonJS({
|
|
|
53486
53945
|
}
|
|
53487
53946
|
__name(rejected, "rejected");
|
|
53488
53947
|
function step(result) {
|
|
53489
|
-
result.done ?
|
|
53948
|
+
result.done ? resolve29(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
53490
53949
|
}
|
|
53491
53950
|
__name(step, "step");
|
|
53492
53951
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
@@ -53524,13 +53983,13 @@ var require_socksclient = __commonJS({
|
|
|
53524
53983
|
* @returns { Promise }
|
|
53525
53984
|
*/
|
|
53526
53985
|
static createConnection(options, callback) {
|
|
53527
|
-
return new Promise((
|
|
53986
|
+
return new Promise((resolve29, reject) => {
|
|
53528
53987
|
try {
|
|
53529
53988
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
53530
53989
|
} catch (err) {
|
|
53531
53990
|
if (typeof callback === "function") {
|
|
53532
53991
|
callback(err);
|
|
53533
|
-
return
|
|
53992
|
+
return resolve29(err);
|
|
53534
53993
|
} else {
|
|
53535
53994
|
return reject(err);
|
|
53536
53995
|
}
|
|
@@ -53541,16 +54000,16 @@ var require_socksclient = __commonJS({
|
|
|
53541
54000
|
client.removeAllListeners();
|
|
53542
54001
|
if (typeof callback === "function") {
|
|
53543
54002
|
callback(null, info);
|
|
53544
|
-
|
|
54003
|
+
resolve29(info);
|
|
53545
54004
|
} else {
|
|
53546
|
-
|
|
54005
|
+
resolve29(info);
|
|
53547
54006
|
}
|
|
53548
54007
|
});
|
|
53549
54008
|
client.once("error", (err) => {
|
|
53550
54009
|
client.removeAllListeners();
|
|
53551
54010
|
if (typeof callback === "function") {
|
|
53552
54011
|
callback(err);
|
|
53553
|
-
|
|
54012
|
+
resolve29(err);
|
|
53554
54013
|
} else {
|
|
53555
54014
|
reject(err);
|
|
53556
54015
|
}
|
|
@@ -53567,13 +54026,13 @@ var require_socksclient = __commonJS({
|
|
|
53567
54026
|
* @returns { Promise }
|
|
53568
54027
|
*/
|
|
53569
54028
|
static createConnectionChain(options, callback) {
|
|
53570
|
-
return new Promise((
|
|
54029
|
+
return new Promise((resolve29, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
53571
54030
|
try {
|
|
53572
54031
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
53573
54032
|
} catch (err) {
|
|
53574
54033
|
if (typeof callback === "function") {
|
|
53575
54034
|
callback(err);
|
|
53576
|
-
return
|
|
54035
|
+
return resolve29(err);
|
|
53577
54036
|
} else {
|
|
53578
54037
|
return reject(err);
|
|
53579
54038
|
}
|
|
@@ -53599,14 +54058,14 @@ var require_socksclient = __commonJS({
|
|
|
53599
54058
|
}
|
|
53600
54059
|
if (typeof callback === "function") {
|
|
53601
54060
|
callback(null, { socket: sock });
|
|
53602
|
-
|
|
54061
|
+
resolve29({ socket: sock });
|
|
53603
54062
|
} else {
|
|
53604
|
-
|
|
54063
|
+
resolve29({ socket: sock });
|
|
53605
54064
|
}
|
|
53606
54065
|
} catch (err) {
|
|
53607
54066
|
if (typeof callback === "function") {
|
|
53608
54067
|
callback(err);
|
|
53609
|
-
|
|
54068
|
+
resolve29(err);
|
|
53610
54069
|
} else {
|
|
53611
54070
|
reject(err);
|
|
53612
54071
|
}
|
|
@@ -54294,12 +54753,12 @@ var require_dist6 = __commonJS({
|
|
|
54294
54753
|
let { host } = opts;
|
|
54295
54754
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
54296
54755
|
if (shouldLookup) {
|
|
54297
|
-
host = await new Promise((
|
|
54756
|
+
host = await new Promise((resolve29, reject) => {
|
|
54298
54757
|
lookupFn(host, {}, (err, res) => {
|
|
54299
54758
|
if (err) {
|
|
54300
54759
|
reject(err);
|
|
54301
54760
|
} else {
|
|
54302
|
-
|
|
54761
|
+
resolve29(res);
|
|
54303
54762
|
}
|
|
54304
54763
|
});
|
|
54305
54764
|
});
|
|
@@ -55111,8 +55570,8 @@ var require_entry = __commonJS({
|
|
|
55111
55570
|
let body = null;
|
|
55112
55571
|
if (this.response.status === 200) {
|
|
55113
55572
|
let cacheWriteResolve, cacheWriteReject;
|
|
55114
|
-
const cacheWritePromise = new Promise((
|
|
55115
|
-
cacheWriteResolve =
|
|
55573
|
+
const cacheWritePromise = new Promise((resolve29, reject) => {
|
|
55574
|
+
cacheWriteResolve = resolve29;
|
|
55116
55575
|
cacheWriteReject = reject;
|
|
55117
55576
|
}).catch((err) => {
|
|
55118
55577
|
body.emit("error", err);
|
|
@@ -56627,9 +57086,9 @@ var require_index_min = __commonJS({
|
|
|
56627
57086
|
var require_lib17 = __commonJS({
|
|
56628
57087
|
"../../node_modules/.pnpm/which@5.0.0/node_modules/which/lib/index.js"(exports, module) {
|
|
56629
57088
|
var { isexe, sync: isexeSync } = require_index_min();
|
|
56630
|
-
var { join:
|
|
57089
|
+
var { join: join30, delimiter, sep: sep7, posix: posix3 } = __require("path");
|
|
56631
57090
|
var isWindows = process.platform === "win32";
|
|
56632
|
-
var rSlash = new RegExp(`[${posix3.sep}${
|
|
57091
|
+
var rSlash = new RegExp(`[${posix3.sep}${sep7 === posix3.sep ? "" : sep7}]`.replace(/(\\)/g, "\\$1"));
|
|
56633
57092
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
56634
57093
|
var getNotFoundError = /* @__PURE__ */ __name((cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), "getNotFoundError");
|
|
56635
57094
|
var getPathInfo = /* @__PURE__ */ __name((cmd, {
|
|
@@ -56656,7 +57115,7 @@ var require_lib17 = __commonJS({
|
|
|
56656
57115
|
var getPathPart = /* @__PURE__ */ __name((raw, cmd) => {
|
|
56657
57116
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
56658
57117
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
56659
|
-
return prefix +
|
|
57118
|
+
return prefix + join30(pathPart, cmd);
|
|
56660
57119
|
}, "getPathPart");
|
|
56661
57120
|
var which = /* @__PURE__ */ __name(async (cmd, opt = {}) => {
|
|
56662
57121
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -56779,9 +57238,9 @@ var require_lib18 = __commonJS({
|
|
|
56779
57238
|
if (opts.shell) {
|
|
56780
57239
|
return spawnWithShell(cmd, args2, opts, extra);
|
|
56781
57240
|
}
|
|
56782
|
-
let
|
|
57241
|
+
let resolve29, reject;
|
|
56783
57242
|
const promise = new Promise((_resolve, _reject) => {
|
|
56784
|
-
|
|
57243
|
+
resolve29 = _resolve;
|
|
56785
57244
|
reject = _reject;
|
|
56786
57245
|
});
|
|
56787
57246
|
const closeError = new Error("command failed");
|
|
@@ -56814,7 +57273,7 @@ var require_lib18 = __commonJS({
|
|
|
56814
57273
|
if (code || signal) {
|
|
56815
57274
|
rejectWithOpts(closeError, { code, signal });
|
|
56816
57275
|
} else {
|
|
56817
|
-
|
|
57276
|
+
resolve29(getResult({ code, signal }));
|
|
56818
57277
|
}
|
|
56819
57278
|
});
|
|
56820
57279
|
return promise;
|
|
@@ -57795,7 +58254,7 @@ var require_lib19 = __commonJS({
|
|
|
57795
58254
|
// ../../node_modules/.pnpm/npm-normalize-package-bin@4.0.0/node_modules/npm-normalize-package-bin/lib/index.js
|
|
57796
58255
|
var require_lib20 = __commonJS({
|
|
57797
58256
|
"../../node_modules/.pnpm/npm-normalize-package-bin@4.0.0/node_modules/npm-normalize-package-bin/lib/index.js"(exports, module) {
|
|
57798
|
-
var { join:
|
|
58257
|
+
var { join: join30, basename: basename11 } = __require("path");
|
|
57799
58258
|
var normalize4 = /* @__PURE__ */ __name((pkg) => !pkg.bin ? removeBin(pkg) : typeof pkg.bin === "string" ? normalizeString(pkg) : Array.isArray(pkg.bin) ? normalizeArray(pkg) : typeof pkg.bin === "object" ? normalizeObject(pkg) : removeBin(pkg), "normalize");
|
|
57800
58259
|
var normalizeString = /* @__PURE__ */ __name((pkg) => {
|
|
57801
58260
|
if (!pkg.name) {
|
|
@@ -57820,11 +58279,11 @@ var require_lib20 = __commonJS({
|
|
|
57820
58279
|
const clean = {};
|
|
57821
58280
|
let hasBins = false;
|
|
57822
58281
|
Object.keys(orig).forEach((binKey) => {
|
|
57823
|
-
const base =
|
|
58282
|
+
const base = join30("/", basename11(binKey.replace(/\\|:/g, "/"))).slice(1);
|
|
57824
58283
|
if (typeof orig[binKey] !== "string" || !base) {
|
|
57825
58284
|
return;
|
|
57826
58285
|
}
|
|
57827
|
-
const binTarget =
|
|
58286
|
+
const binTarget = join30("/", orig[binKey].replace(/\\/g, "/")).replace(/\\/g, "/").slice(1);
|
|
57828
58287
|
if (!binTarget) {
|
|
57829
58288
|
return;
|
|
57830
58289
|
}
|
|
@@ -60503,7 +60962,7 @@ var require_sort2 = __commonJS({
|
|
|
60503
60962
|
var require_lib23 = __commonJS({
|
|
60504
60963
|
"../../node_modules/.pnpm/@npmcli+package-json@6.2.0/node_modules/@npmcli/package-json/lib/index.js"(exports, module) {
|
|
60505
60964
|
var { readFile: readFile33, writeFile: writeFile11 } = __require("node:fs/promises");
|
|
60506
|
-
var { resolve:
|
|
60965
|
+
var { resolve: resolve29 } = __require("node:path");
|
|
60507
60966
|
var parseJSON = require_lib16();
|
|
60508
60967
|
var updateDeps = require_update_dependencies();
|
|
60509
60968
|
var updateScripts = require_update_scripts();
|
|
@@ -60626,7 +61085,7 @@ var require_lib23 = __commonJS({
|
|
|
60626
61085
|
parseErr = err;
|
|
60627
61086
|
}
|
|
60628
61087
|
if (parseErr) {
|
|
60629
|
-
const indexFile =
|
|
61088
|
+
const indexFile = resolve29(this.path, "index.js");
|
|
60630
61089
|
let indexFileContent;
|
|
60631
61090
|
try {
|
|
60632
61091
|
indexFileContent = await readFile33(indexFile, "utf8");
|
|
@@ -60678,7 +61137,7 @@ var require_lib23 = __commonJS({
|
|
|
60678
61137
|
}
|
|
60679
61138
|
get filename() {
|
|
60680
61139
|
if (this.path) {
|
|
60681
|
-
return
|
|
61140
|
+
return resolve29(this.path, "package.json");
|
|
60682
61141
|
}
|
|
60683
61142
|
return void 0;
|
|
60684
61143
|
}
|
|
@@ -67604,12 +68063,12 @@ var require_fetcher = __commonJS({
|
|
|
67604
68063
|
};
|
|
67605
68064
|
exports.DefaultFetcher = DefaultFetcher;
|
|
67606
68065
|
var writeBufferToStream = /* @__PURE__ */ __name(async (stream, buffer) => {
|
|
67607
|
-
return new Promise((
|
|
68066
|
+
return new Promise((resolve29, reject) => {
|
|
67608
68067
|
stream.write(buffer, (err) => {
|
|
67609
68068
|
if (err) {
|
|
67610
68069
|
reject(err);
|
|
67611
68070
|
}
|
|
67612
|
-
|
|
68071
|
+
resolve29(true);
|
|
67613
68072
|
});
|
|
67614
68073
|
});
|
|
67615
68074
|
}, "writeBufferToStream");
|
|
@@ -67828,12 +68287,12 @@ var require_url = __commonJS({
|
|
|
67828
68287
|
"../../node_modules/.pnpm/tuf-js@3.1.0/node_modules/tuf-js/dist/utils/url.js"(exports) {
|
|
67829
68288
|
"use strict";
|
|
67830
68289
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67831
|
-
exports.join =
|
|
68290
|
+
exports.join = join30;
|
|
67832
68291
|
var url_1 = __require("url");
|
|
67833
|
-
function
|
|
68292
|
+
function join30(base, path3) {
|
|
67834
68293
|
return new url_1.URL(ensureTrailingSlash(base) + removeLeadingSlash(path3)).toString();
|
|
67835
68294
|
}
|
|
67836
|
-
__name(
|
|
68295
|
+
__name(join30, "join");
|
|
67837
68296
|
function ensureTrailingSlash(path3) {
|
|
67838
68297
|
return path3.endsWith("/") ? path3 : path3 + "/";
|
|
67839
68298
|
}
|
|
@@ -68212,7 +68671,7 @@ var require_target = __commonJS({
|
|
|
68212
68671
|
var error_1 = require_error8();
|
|
68213
68672
|
async function readTarget(tuf, targetPath) {
|
|
68214
68673
|
const path3 = await getTargetPath(tuf, targetPath);
|
|
68215
|
-
return new Promise((
|
|
68674
|
+
return new Promise((resolve29, reject) => {
|
|
68216
68675
|
fs_1.default.readFile(path3, "utf-8", (err, data) => {
|
|
68217
68676
|
if (err) {
|
|
68218
68677
|
reject(new error_1.TUFError({
|
|
@@ -68221,7 +68680,7 @@ var require_target = __commonJS({
|
|
|
68221
68680
|
cause: err
|
|
68222
68681
|
}));
|
|
68223
68682
|
} else {
|
|
68224
|
-
|
|
68683
|
+
resolve29(data);
|
|
68225
68684
|
}
|
|
68226
68685
|
});
|
|
68227
68686
|
});
|
|
@@ -70470,9 +70929,9 @@ import { createHash as createHash9, randomUUID } from "node:crypto";
|
|
|
70470
70929
|
import { execFile as execFileCb7, spawn as spawn3 } from "node:child_process";
|
|
70471
70930
|
import { gunzipSync } from "node:zlib";
|
|
70472
70931
|
import { promisify as promisify7 } from "node:util";
|
|
70473
|
-
import { dirname as dirname8, isAbsolute as
|
|
70932
|
+
import { dirname as dirname8, isAbsolute as isAbsolute14, join as join15, relative as relative17, resolve as resolve19 } from "node:path";
|
|
70474
70933
|
import { constants as fsConstants4 } from "node:fs";
|
|
70475
|
-
import { chmod as chmod3, lstat as
|
|
70934
|
+
import { chmod as chmod3, lstat as lstat12, mkdtemp as mkdtemp3, open as open6, readFile as readFile16, realpath as realpath11, rm as rm6 } from "node:fs/promises";
|
|
70476
70935
|
function validatePackageName(value) {
|
|
70477
70936
|
if (typeof value !== "string" || value.length > 214 || !SAFE_PACKAGE_NAME.test(value)) {
|
|
70478
70937
|
throw new Error("npm package must be a safe lowercase package name or @scope/name");
|
|
@@ -70549,7 +71008,7 @@ async function defaultResolveAuthToken({ registry, cwd, exec, env = process.env
|
|
|
70549
71008
|
if (env[name]) candidates.push(env[name]);
|
|
70550
71009
|
}
|
|
70551
71010
|
const key = registryTokenKey(registry);
|
|
70552
|
-
candidates.push(...await tokensFromNpmrc(
|
|
71011
|
+
candidates.push(...await tokensFromNpmrc(join15(cwd, ".npmrc"), key, env));
|
|
70553
71012
|
const npmUserConfigKey = ["npm", "config", "userconfig"].join("_");
|
|
70554
71013
|
const userConfig = env[npmUserConfigKey] ?? (await exec("npm", ["config", "get", "userconfig"], { cwd, shell: false })).stdout.trim();
|
|
70555
71014
|
if (userConfig) candidates.push(...await tokensFromNpmrc(userConfig, key, env));
|
|
@@ -70578,10 +71037,10 @@ async function defaultWhoamiWithToken({ registry, token, cwd, exec }) {
|
|
|
70578
71037
|
}
|
|
70579
71038
|
function resolvePackageCwd(cwd, root) {
|
|
70580
71039
|
if (!cwd || typeof cwd !== "string") throw new Error("NPM_PUBLISH requires a non-empty action.cwd (package directory)");
|
|
70581
|
-
const rootPath =
|
|
70582
|
-
const packagePath =
|
|
70583
|
-
const rel =
|
|
70584
|
-
if (
|
|
71040
|
+
const rootPath = resolve19(root);
|
|
71041
|
+
const packagePath = resolve19(root, cwd);
|
|
71042
|
+
const rel = relative17(rootPath, packagePath);
|
|
71043
|
+
if (isAbsolute14(rel) || rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
|
|
70585
71044
|
throw new Error(`cwd "${cwd}" is outside project root "${root}"`);
|
|
70586
71045
|
}
|
|
70587
71046
|
return packagePath;
|
|
@@ -70594,15 +71053,15 @@ ${error?.message ?? ""}`;
|
|
|
70594
71053
|
return /\bE404\b|\b404\b.*not found|not found.*\b404\b/i.test(text);
|
|
70595
71054
|
}
|
|
70596
71055
|
async function readVerifiedTarballBytes(action, root) {
|
|
70597
|
-
if (!action.tarballPath ||
|
|
71056
|
+
if (!action.tarballPath || isAbsolute14(action.tarballPath)) throw new Error("tarballPath must be project-relative");
|
|
70598
71057
|
if (!/^[a-f0-9]{64}$/.test(action.tarballSha256 ?? "")) throw new Error("tarballSha256 must be a lowercase SHA-256 digest");
|
|
70599
|
-
const rootReal = await
|
|
70600
|
-
const lexical =
|
|
70601
|
-
const rel =
|
|
70602
|
-
if (
|
|
71058
|
+
const rootReal = await realpath11(root);
|
|
71059
|
+
const lexical = resolve19(rootReal, action.tarballPath);
|
|
71060
|
+
const rel = relative17(rootReal, lexical);
|
|
71061
|
+
if (isAbsolute14(rel) || rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
|
|
70603
71062
|
throw new Error("tarballPath escapes project root");
|
|
70604
71063
|
}
|
|
70605
|
-
const before = await
|
|
71064
|
+
const before = await lstat12(lexical);
|
|
70606
71065
|
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1) {
|
|
70607
71066
|
throw new Error("frozen tarball must be a single-link regular file");
|
|
70608
71067
|
}
|
|
@@ -70895,7 +71354,7 @@ function createNpmAdapter(deps = {}) {
|
|
|
70895
71354
|
throw new Error("npm bearer authentication does not match the frozen registry and publisher");
|
|
70896
71355
|
}
|
|
70897
71356
|
if (typeof beforeBufferPublishHook === "function") {
|
|
70898
|
-
await beforeBufferPublishHook(
|
|
71357
|
+
await beforeBufferPublishHook(resolve19(context.root, action.tarballPath));
|
|
70899
71358
|
}
|
|
70900
71359
|
try {
|
|
70901
71360
|
await publishTarballBuffer({
|
|
@@ -71061,11 +71520,11 @@ var init_npm = __esm({
|
|
|
71061
71520
|
});
|
|
71062
71521
|
|
|
71063
71522
|
// src/core/run.mjs
|
|
71064
|
-
import { link as link2, lstat as
|
|
71523
|
+
import { link as link2, lstat as lstat13, mkdir as mkdir9, open as open7, readFile as readFile17, unlink as unlink3 } from "node:fs/promises";
|
|
71065
71524
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
71066
|
-
import { dirname as dirname9, join as
|
|
71525
|
+
import { dirname as dirname9, join as join16, resolve as resolve20, basename as basename4, relative as relative18, isAbsolute as isAbsolute15 } from "node:path";
|
|
71067
71526
|
function resolveDefaultRunDir(planPath, command2, runId = `${command2}-${Date.now()}`) {
|
|
71068
|
-
const absolute =
|
|
71527
|
+
const absolute = resolve20(planPath);
|
|
71069
71528
|
const fileName = basename4(absolute);
|
|
71070
71529
|
const parentDir = dirname9(absolute);
|
|
71071
71530
|
if (fileName === "release-plan.json") {
|
|
@@ -71073,7 +71532,7 @@ function resolveDefaultRunDir(planPath, command2, runId = `${command2}-${Date.no
|
|
|
71073
71532
|
}
|
|
71074
71533
|
if (basename4(parentDir) === "plans") {
|
|
71075
71534
|
const releaseDir = dirname9(parentDir);
|
|
71076
|
-
return
|
|
71535
|
+
return join16(releaseDir, "runs", runId);
|
|
71077
71536
|
}
|
|
71078
71537
|
return `${parentDir}/runs/${runId}`;
|
|
71079
71538
|
}
|
|
@@ -71138,7 +71597,7 @@ async function loadRun(runPath, options = {}) {
|
|
|
71138
71597
|
return run5;
|
|
71139
71598
|
}
|
|
71140
71599
|
function assertImmutableRunAuthority(runPath, planPath, run5) {
|
|
71141
|
-
const absolutePlan = realpathSync3(
|
|
71600
|
+
const absolutePlan = realpathSync3(resolve20(planPath));
|
|
71142
71601
|
const planDir = dirname9(absolutePlan);
|
|
71143
71602
|
if (basename4(planDir) !== "plans") {
|
|
71144
71603
|
throw new ReleaseError(GATE_FAILED, "run authority requires an immutable plans/<digest>.json plan path");
|
|
@@ -71152,10 +71611,10 @@ function assertImmutableRunAuthority(runPath, planPath, run5) {
|
|
|
71152
71611
|
}
|
|
71153
71612
|
cursor = dirname9(cursor);
|
|
71154
71613
|
}
|
|
71155
|
-
const runsDir =
|
|
71156
|
-
const absoluteRun = realpathSync3(
|
|
71157
|
-
const rel =
|
|
71158
|
-
if (
|
|
71614
|
+
const runsDir = join16(authorityRoot, "runs");
|
|
71615
|
+
const absoluteRun = realpathSync3(resolve20(runPath));
|
|
71616
|
+
const rel = relative18(runsDir, absoluteRun);
|
|
71617
|
+
if (isAbsolute15(rel) || rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
|
|
71159
71618
|
throw new ReleaseError(GATE_FAILED, "production run authority must be inside the plan sibling runs/ directory");
|
|
71160
71619
|
}
|
|
71161
71620
|
const fileName = basename4(absoluteRun);
|
|
@@ -71170,7 +71629,7 @@ function assertImmutableRunAuthority(runPath, planPath, run5) {
|
|
|
71170
71629
|
}
|
|
71171
71630
|
}
|
|
71172
71631
|
async function createProductionRunDir(runDir, planPath) {
|
|
71173
|
-
const absolutePlan = realpathSync3(
|
|
71632
|
+
const absolutePlan = realpathSync3(resolve20(planPath));
|
|
71174
71633
|
const planDir = dirname9(absolutePlan);
|
|
71175
71634
|
if (basename4(planDir) !== "plans") {
|
|
71176
71635
|
throw new ReleaseError(GATE_FAILED, "production run directory requires an immutable plans/<digest>.json authority");
|
|
@@ -71179,10 +71638,10 @@ async function createProductionRunDir(runDir, planPath) {
|
|
|
71179
71638
|
return createProductionRunDirWithinAuthority(runDir, authorityRoot);
|
|
71180
71639
|
}
|
|
71181
71640
|
async function createProductionPrepareRunDir(runDir, releaseDir) {
|
|
71182
|
-
const authorityRoot =
|
|
71641
|
+
const authorityRoot = resolve20(releaseDir);
|
|
71183
71642
|
let authorityStat;
|
|
71184
71643
|
try {
|
|
71185
|
-
authorityStat = await
|
|
71644
|
+
authorityStat = await lstat13(authorityRoot);
|
|
71186
71645
|
} catch (error) {
|
|
71187
71646
|
throw new ReleaseError(GATE_FAILED, "cannot inspect production .release-skill authority root", {
|
|
71188
71647
|
releaseDir: authorityRoot,
|
|
@@ -71207,10 +71666,10 @@ async function createProductionPrepareRunDir(runDir, releaseDir) {
|
|
|
71207
71666
|
return createProductionRunDirWithinAuthority(runDir, physicalAuthorityRoot);
|
|
71208
71667
|
}
|
|
71209
71668
|
async function createProductionRunDirWithinAuthority(runDir, authorityRoot) {
|
|
71210
|
-
const runsDir =
|
|
71669
|
+
const runsDir = join16(authorityRoot, "runs");
|
|
71211
71670
|
let runsStat;
|
|
71212
71671
|
try {
|
|
71213
|
-
runsStat = await
|
|
71672
|
+
runsStat = await lstat13(runsDir);
|
|
71214
71673
|
} catch (error) {
|
|
71215
71674
|
if (error.code !== "ENOENT") {
|
|
71216
71675
|
throw new ReleaseError(GATE_FAILED, "cannot inspect production runs authority root", {
|
|
@@ -71228,7 +71687,7 @@ async function createProductionRunDirWithinAuthority(runDir, authorityRoot) {
|
|
|
71228
71687
|
});
|
|
71229
71688
|
}
|
|
71230
71689
|
}
|
|
71231
|
-
runsStat = await
|
|
71690
|
+
runsStat = await lstat13(runsDir);
|
|
71232
71691
|
}
|
|
71233
71692
|
if (runsStat.isSymbolicLink() || !runsStat.isDirectory()) {
|
|
71234
71693
|
throw new ReleaseError(
|
|
@@ -71245,7 +71704,7 @@ async function createProductionRunDirWithinAuthority(runDir, authorityRoot) {
|
|
|
71245
71704
|
{ runsDir, physicalRunsDir }
|
|
71246
71705
|
);
|
|
71247
71706
|
}
|
|
71248
|
-
const requested =
|
|
71707
|
+
const requested = resolve20(runDir);
|
|
71249
71708
|
let physicalParent;
|
|
71250
71709
|
try {
|
|
71251
71710
|
physicalParent = realpathSync3(dirname9(requested));
|
|
@@ -71263,7 +71722,7 @@ async function createProductionRunDirWithinAuthority(runDir, authorityRoot) {
|
|
|
71263
71722
|
);
|
|
71264
71723
|
}
|
|
71265
71724
|
try {
|
|
71266
|
-
await
|
|
71725
|
+
await lstat13(requested);
|
|
71267
71726
|
throw new ReleaseError(GATE_FAILED, "production run directory already exists; authority directories cannot be reused", { runDir });
|
|
71268
71727
|
} catch (error) {
|
|
71269
71728
|
if (error instanceof ReleaseError) throw error;
|
|
@@ -71296,7 +71755,7 @@ async function validateStatePredecessorChain(run5, runPath, options = {}) {
|
|
|
71296
71755
|
return;
|
|
71297
71756
|
}
|
|
71298
71757
|
let current = run5;
|
|
71299
|
-
let currentPath = realpathSync3(
|
|
71758
|
+
let currentPath = realpathSync3(resolve20(runPath));
|
|
71300
71759
|
let traversed = 0;
|
|
71301
71760
|
while (true) {
|
|
71302
71761
|
const sequence = current.stateSequence;
|
|
@@ -71317,7 +71776,7 @@ async function validateStatePredecessorChain(run5, runPath, options = {}) {
|
|
|
71317
71776
|
if (traversed > 1e5) {
|
|
71318
71777
|
throw new ReleaseError(GATE_FAILED, "run state predecessor chain exceeds maximum depth");
|
|
71319
71778
|
}
|
|
71320
|
-
const previousPath =
|
|
71779
|
+
const previousPath = join16(dirname9(currentPath), `${String(sequence - 1).padStart(6, "0")}.json`);
|
|
71321
71780
|
const previous = await loadRun(previousPath, {
|
|
71322
71781
|
requireDigest: true,
|
|
71323
71782
|
...options.production ? { authorityPlanPath: options.planPath } : {}
|
|
@@ -71410,7 +71869,7 @@ function validateRunPlanDigest(run5, plan, options = {}) {
|
|
|
71410
71869
|
{ runDigest: run5.planDigest, planDigest: expectedDigest }
|
|
71411
71870
|
);
|
|
71412
71871
|
}
|
|
71413
|
-
if (plan.production && run5.planPath && options.planPath &&
|
|
71872
|
+
if (plan.production && run5.planPath && options.planPath && resolve20(run5.planPath) !== resolve20(options.planPath)) {
|
|
71414
71873
|
throw new ReleaseError(
|
|
71415
71874
|
GATE_FAILED,
|
|
71416
71875
|
"source run immutable plan path does not match the supplied plan authority",
|
|
@@ -71527,10 +71986,10 @@ async function appendRunState(runDir, sequence, run5) {
|
|
|
71527
71986
|
if (!Number.isSafeInteger(sequence) || sequence < 0) {
|
|
71528
71987
|
throw new ReleaseError(GATE_FAILED, "run state sequence must be a non-negative integer");
|
|
71529
71988
|
}
|
|
71530
|
-
const statesDir =
|
|
71989
|
+
const statesDir = join16(runDir, "states");
|
|
71531
71990
|
let previousStateDigest;
|
|
71532
71991
|
if (sequence > 0) {
|
|
71533
|
-
const previousPath =
|
|
71992
|
+
const previousPath = join16(statesDir, `${String(sequence - 1).padStart(6, "0")}.json`);
|
|
71534
71993
|
const previous = await loadRun(previousPath, { requireDigest: true });
|
|
71535
71994
|
if (previous.stateSequence !== sequence - 1 || previous.runId !== run5.runId || previous.command !== run5.command || previous.planDigest !== run5.planDigest) {
|
|
71536
71995
|
throw new ReleaseError(
|
|
@@ -71547,7 +72006,7 @@ async function appendRunState(runDir, sequence, run5) {
|
|
|
71547
72006
|
stateSequence: sequence,
|
|
71548
72007
|
...previousStateDigest ? { previousStateDigest } : {}
|
|
71549
72008
|
});
|
|
71550
|
-
const statePath =
|
|
72009
|
+
const statePath = join16(statesDir, `${String(sequence).padStart(6, "0")}.json`);
|
|
71551
72010
|
await writeRunAtomic(statePath, state);
|
|
71552
72011
|
return Object.freeze({ state, statePath });
|
|
71553
72012
|
}
|
|
@@ -71599,8 +72058,8 @@ __export(plugin_marketplace_exports, {
|
|
|
71599
72058
|
});
|
|
71600
72059
|
import { execFile as execFileCb8 } from "node:child_process";
|
|
71601
72060
|
import { promisify as promisify8 } from "node:util";
|
|
71602
|
-
import { readFile as readFile18, stat as stat4, mkdir as mkdir10, readdir as
|
|
71603
|
-
import { join as
|
|
72061
|
+
import { readFile as readFile18, stat as stat4, mkdir as mkdir10, readdir as readdir11, realpath as realpath12, lstat as lstat14 } from "node:fs/promises";
|
|
72062
|
+
import { join as join17, resolve as resolve21, relative as relative19, isAbsolute as isAbsolute16, basename as basename5 } from "node:path";
|
|
71604
72063
|
import { createHash as createHash10 } from "node:crypto";
|
|
71605
72064
|
function transportPayload(entries) {
|
|
71606
72065
|
return entries.map(({ path: path3, type, mode, size, contentDigest }) => ({
|
|
@@ -71668,21 +72127,21 @@ async function resolvePluginManifestFromMarketplaceEntrySource(marketIndex, plug
|
|
|
71668
72127
|
}
|
|
71669
72128
|
const entry = matches[0];
|
|
71670
72129
|
const sourcePath = extractDeclaredPluginSource(platform.id, entry);
|
|
71671
|
-
const snapshotDirReal = await
|
|
71672
|
-
const marketplaceRootAbs = marketplaceRootRel === "." ? snapshotDirReal :
|
|
71673
|
-
const pluginRootAbs =
|
|
71674
|
-
const pluginRootReal = await
|
|
72130
|
+
const snapshotDirReal = await realpath12(snapshotDir).catch(() => snapshotDir);
|
|
72131
|
+
const marketplaceRootAbs = marketplaceRootRel === "." ? snapshotDirReal : resolve21(snapshotDirReal, marketplaceRootRel);
|
|
72132
|
+
const pluginRootAbs = resolve21(marketplaceRootAbs, sourcePath);
|
|
72133
|
+
const pluginRootReal = await realpath12(pluginRootAbs).catch(() => null);
|
|
71675
72134
|
if (!pluginRootReal) {
|
|
71676
72135
|
throw new Error(`marketplace plugin entry source "${sourcePath}" does not exist in snapshot`);
|
|
71677
72136
|
}
|
|
71678
|
-
const containment =
|
|
71679
|
-
const
|
|
71680
|
-
if (containment !== "" && (
|
|
72137
|
+
const containment = relative19(snapshotDirReal, pluginRootReal);
|
|
72138
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
72139
|
+
if (containment !== "" && (isAbsolute16(containment) || containment === ".." || containment.startsWith(`..${sep7}`))) {
|
|
71681
72140
|
throw new Error(`marketplace plugin entry source "${sourcePath}" escapes the snapshot after symlink resolution`);
|
|
71682
72141
|
}
|
|
71683
72142
|
const manifestRelative = platform.manifestPaths.plugin;
|
|
71684
|
-
const manifestAbs =
|
|
71685
|
-
const pluginRootRelToSnapshot =
|
|
72143
|
+
const manifestAbs = resolve21(pluginRootReal, manifestRelative);
|
|
72144
|
+
const pluginRootRelToSnapshot = relative19(snapshotDirReal, pluginRootReal);
|
|
71686
72145
|
const fullManifestRelative = pluginRootRelToSnapshot === "" ? manifestRelative : `${pluginRootRelToSnapshot}/${manifestRelative}`;
|
|
71687
72146
|
let raw;
|
|
71688
72147
|
try {
|
|
@@ -71717,7 +72176,7 @@ async function validateInstallationContractDigest(action, snapshotDirReal, platf
|
|
|
71717
72176
|
includeMarketplaceEntry = hasMarketplacePath;
|
|
71718
72177
|
if (includeMarketplaceEntry) {
|
|
71719
72178
|
marketplaceIndexRelative = action.marketplaceIndexPath ?? platform.manifestPaths.marketplace;
|
|
71720
|
-
const marketplacePath =
|
|
72179
|
+
const marketplacePath = resolve21(snapshotDirReal, marketplaceIndexRelative);
|
|
71721
72180
|
const mkResult = await validateManifestFile(marketplacePath, ["name", "plugins"]);
|
|
71722
72181
|
if (!mkResult.valid) {
|
|
71723
72182
|
return { valid: false, error: `installationContractDigest \u9A8C\u8BC1\u5931\u8D25\uFF1A\u5E02\u573A\u7D22\u5F15\u8BFB\u53D6\u5931\u8D25\uFF1A${mkResult.error}` };
|
|
@@ -71763,7 +72222,7 @@ async function validateInstallationContractDigest(action, snapshotDirReal, platf
|
|
|
71763
72222
|
pluginManifestRelative = readResult.manifestRelative ?? platform.manifestPaths.plugin;
|
|
71764
72223
|
} else {
|
|
71765
72224
|
pluginManifestRelative = platform.manifestPaths.plugin;
|
|
71766
|
-
const pluginManifestPath =
|
|
72225
|
+
const pluginManifestPath = resolve21(snapshotDirReal, pluginManifestRelative);
|
|
71767
72226
|
const manifestResult = await validateManifestFile(pluginManifestPath, ["name", "version"]);
|
|
71768
72227
|
if (!manifestResult.valid) {
|
|
71769
72228
|
return { valid: false, error: `installationContractDigest \u9A8C\u8BC1\u5931\u8D25\uFF1A\u63D2\u4EF6 manifest \u8BFB\u53D6\u5931\u8D25\uFF1A${manifestResult.error}` };
|
|
@@ -71800,7 +72259,7 @@ async function resolveInstalledPayloadSubpath(snapshotDir, sourceEntries, action
|
|
|
71800
72259
|
if (!anchored) {
|
|
71801
72260
|
throw new Error(`frozen snapshot is missing the marketplace manifest ${marketplaceRelative}`);
|
|
71802
72261
|
}
|
|
71803
|
-
const result = await validateManifestFile(
|
|
72262
|
+
const result = await validateManifestFile(resolve21(snapshotDir, marketplaceRelative), ["name", "plugins"]);
|
|
71804
72263
|
if (!result.valid) {
|
|
71805
72264
|
throw new Error(`frozen snapshot ${marketplaceRelative} invalid: ${result.error}`);
|
|
71806
72265
|
}
|
|
@@ -71914,26 +72373,26 @@ async function resolveKimiEntrySkillFile(pluginRootReal, manifest, entrySkill) {
|
|
|
71914
72373
|
}
|
|
71915
72374
|
let entryAbs;
|
|
71916
72375
|
if (manifest.skills === void 0 || manifest.skills === null) {
|
|
71917
|
-
entryAbs =
|
|
72376
|
+
entryAbs = resolve21(pluginRootReal, "SKILL.md");
|
|
71918
72377
|
} else {
|
|
71919
72378
|
const skillsRel = normalizeKimiSkillsRel(manifest.skills);
|
|
71920
|
-
const skillsRootAbs = skillsRel === "" ? pluginRootReal :
|
|
71921
|
-
const skillsRootReal = await
|
|
72379
|
+
const skillsRootAbs = skillsRel === "" ? pluginRootReal : resolve21(pluginRootReal, skillsRel);
|
|
72380
|
+
const skillsRootReal = await realpath12(skillsRootAbs).catch(() => null);
|
|
71922
72381
|
if (!skillsRootReal) {
|
|
71923
72382
|
throw new Error(`kimi manifest skills root does not exist: ${manifest.skills}`);
|
|
71924
72383
|
}
|
|
71925
|
-
const skillsContainment =
|
|
72384
|
+
const skillsContainment = relative19(pluginRootReal, skillsRootReal);
|
|
71926
72385
|
const sepK = process.platform === "win32" ? "\\" : "/";
|
|
71927
|
-
if (skillsContainment !== "" && (
|
|
72386
|
+
if (skillsContainment !== "" && (isAbsolute16(skillsContainment) || skillsContainment === ".." || skillsContainment.startsWith(`..${sepK}`))) {
|
|
71928
72387
|
throw new Error(`kimi manifest skills "${manifest.skills}" escapes the plugin root after symlink resolution`);
|
|
71929
72388
|
}
|
|
71930
|
-
entryAbs =
|
|
72389
|
+
entryAbs = resolve21(skillsRootReal, entrySkill, "SKILL.md");
|
|
71931
72390
|
}
|
|
71932
72391
|
let entryLexicalStat;
|
|
71933
72392
|
try {
|
|
71934
|
-
entryLexicalStat = await
|
|
72393
|
+
entryLexicalStat = await lstat14(entryAbs);
|
|
71935
72394
|
} catch {
|
|
71936
|
-
throw new Error(`kimi entry skill not found: ${
|
|
72395
|
+
throw new Error(`kimi entry skill not found: ${relative19(pluginRootReal, entryAbs) || "SKILL.md"}`);
|
|
71937
72396
|
}
|
|
71938
72397
|
if (entryLexicalStat.isSymbolicLink()) {
|
|
71939
72398
|
throw new Error("kimi entry skill must not be a symlink");
|
|
@@ -71941,13 +72400,13 @@ async function resolveKimiEntrySkillFile(pluginRootReal, manifest, entrySkill) {
|
|
|
71941
72400
|
if (!entryLexicalStat.isFile()) {
|
|
71942
72401
|
throw new Error("kimi entry skill is not a regular file");
|
|
71943
72402
|
}
|
|
71944
|
-
const entryReal = await
|
|
72403
|
+
const entryReal = await realpath12(entryAbs).catch(() => null);
|
|
71945
72404
|
if (!entryReal) {
|
|
71946
|
-
throw new Error(`kimi entry skill not found: ${
|
|
72405
|
+
throw new Error(`kimi entry skill not found: ${relative19(pluginRootReal, entryAbs) || "SKILL.md"}`);
|
|
71947
72406
|
}
|
|
71948
|
-
const entryContainment =
|
|
72407
|
+
const entryContainment = relative19(pluginRootReal, entryReal);
|
|
71949
72408
|
const sepE = process.platform === "win32" ? "\\" : "/";
|
|
71950
|
-
if (entryContainment !== "" && (
|
|
72409
|
+
if (entryContainment !== "" && (isAbsolute16(entryContainment) || entryContainment === ".." || entryContainment.startsWith(`..${sepE}`))) {
|
|
71951
72410
|
throw new Error("kimi entry skill escapes the plugin root after symlink resolution");
|
|
71952
72411
|
}
|
|
71953
72412
|
return entryReal;
|
|
@@ -71985,26 +72444,26 @@ async function resolveCodeBuddyEntrySkillFile(pluginRootReal, manifest, entrySki
|
|
|
71985
72444
|
}
|
|
71986
72445
|
let entryAbs;
|
|
71987
72446
|
if (manifest.skills === void 0 || manifest.skills === null) {
|
|
71988
|
-
entryAbs =
|
|
72447
|
+
entryAbs = resolve21(pluginRootReal, "SKILL.md");
|
|
71989
72448
|
} else {
|
|
71990
72449
|
const skillsRel = normalizeCodeBuddySkillsRel(manifest.skills);
|
|
71991
|
-
const skillsRootAbs = skillsRel === "" ? pluginRootReal :
|
|
71992
|
-
const skillsRootReal = await
|
|
72450
|
+
const skillsRootAbs = skillsRel === "" ? pluginRootReal : resolve21(pluginRootReal, skillsRel);
|
|
72451
|
+
const skillsRootReal = await realpath12(skillsRootAbs).catch(() => null);
|
|
71993
72452
|
if (!skillsRootReal) {
|
|
71994
72453
|
throw new Error(`codebuddy manifest skills root does not exist: ${manifest.skills}`);
|
|
71995
72454
|
}
|
|
71996
|
-
const skillsContainment =
|
|
72455
|
+
const skillsContainment = relative19(pluginRootReal, skillsRootReal);
|
|
71997
72456
|
const sepK = process.platform === "win32" ? "\\" : "/";
|
|
71998
|
-
if (skillsContainment !== "" && (
|
|
72457
|
+
if (skillsContainment !== "" && (isAbsolute16(skillsContainment) || skillsContainment === ".." || skillsContainment.startsWith(`..${sepK}`))) {
|
|
71999
72458
|
throw new Error(`codebuddy manifest skills "${manifest.skills}" escapes the plugin root after symlink resolution`);
|
|
72000
72459
|
}
|
|
72001
|
-
entryAbs =
|
|
72460
|
+
entryAbs = resolve21(skillsRootReal, entrySkill, "SKILL.md");
|
|
72002
72461
|
}
|
|
72003
72462
|
let entryLexicalStat;
|
|
72004
72463
|
try {
|
|
72005
|
-
entryLexicalStat = await
|
|
72464
|
+
entryLexicalStat = await lstat14(entryAbs);
|
|
72006
72465
|
} catch {
|
|
72007
|
-
throw new Error(`codebuddy entry skill not found: ${
|
|
72466
|
+
throw new Error(`codebuddy entry skill not found: ${relative19(pluginRootReal, entryAbs) || "SKILL.md"}`);
|
|
72008
72467
|
}
|
|
72009
72468
|
if (entryLexicalStat.isSymbolicLink()) {
|
|
72010
72469
|
throw new Error("codebuddy entry skill must not be a symlink");
|
|
@@ -72012,13 +72471,13 @@ async function resolveCodeBuddyEntrySkillFile(pluginRootReal, manifest, entrySki
|
|
|
72012
72471
|
if (!entryLexicalStat.isFile()) {
|
|
72013
72472
|
throw new Error("codebuddy entry skill is not a regular file");
|
|
72014
72473
|
}
|
|
72015
|
-
const entryReal = await
|
|
72474
|
+
const entryReal = await realpath12(entryAbs).catch(() => null);
|
|
72016
72475
|
if (!entryReal) {
|
|
72017
|
-
throw new Error(`codebuddy entry skill not found: ${
|
|
72476
|
+
throw new Error(`codebuddy entry skill not found: ${relative19(pluginRootReal, entryAbs) || "SKILL.md"}`);
|
|
72018
72477
|
}
|
|
72019
|
-
const entryContainment =
|
|
72478
|
+
const entryContainment = relative19(pluginRootReal, entryReal);
|
|
72020
72479
|
const sepE = process.platform === "win32" ? "\\" : "/";
|
|
72021
|
-
if (entryContainment !== "" && (
|
|
72480
|
+
if (entryContainment !== "" && (isAbsolute16(entryContainment) || entryContainment === ".." || entryContainment.startsWith(`..${sepE}`))) {
|
|
72022
72481
|
throw new Error("codebuddy entry skill escapes the plugin root after symlink resolution");
|
|
72023
72482
|
}
|
|
72024
72483
|
return entryReal;
|
|
@@ -72157,7 +72616,7 @@ async function checkRequiredFiles(dir, requiredFiles) {
|
|
|
72157
72616
|
const missing = [];
|
|
72158
72617
|
for (const file of requiredFiles) {
|
|
72159
72618
|
try {
|
|
72160
|
-
await stat4(
|
|
72619
|
+
await stat4(resolve21(dir, file));
|
|
72161
72620
|
} catch {
|
|
72162
72621
|
missing.push(file);
|
|
72163
72622
|
}
|
|
@@ -72884,7 +73343,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
72884
73343
|
});
|
|
72885
73344
|
}
|
|
72886
73345
|
const externalManifestRelative = platform.manifestPaths.plugin;
|
|
72887
|
-
const externalManifestPath =
|
|
73346
|
+
const externalManifestPath = resolve21(snapshotDirReal, externalManifestRelative);
|
|
72888
73347
|
const externalManifestResult = await validateManifestFile(externalManifestPath, ["name", "version"]);
|
|
72889
73348
|
if (!externalManifestResult.valid) {
|
|
72890
73349
|
return createResult({
|
|
@@ -72919,7 +73378,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
72919
73378
|
error: `marketplace root resolution failed: ${mktRootErr.message}`
|
|
72920
73379
|
});
|
|
72921
73380
|
}
|
|
72922
|
-
const marketplacePath =
|
|
73381
|
+
const marketplacePath = resolve21(snapshotDirReal, marketplaceRelative);
|
|
72923
73382
|
const marketplaceResult = await validateManifestFile(marketplacePath, ["name"]);
|
|
72924
73383
|
if (!marketplaceResult.valid) {
|
|
72925
73384
|
return createResult({
|
|
@@ -72962,9 +73421,9 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
72962
73421
|
error: sourceErr.message
|
|
72963
73422
|
});
|
|
72964
73423
|
}
|
|
72965
|
-
const mktRootAbs = mktRoot === "." ? snapshotDirReal :
|
|
72966
|
-
const sourceDirAbs =
|
|
72967
|
-
sourceDirReal = await
|
|
73424
|
+
const mktRootAbs = mktRoot === "." ? snapshotDirReal : resolve21(snapshotDirReal, mktRoot);
|
|
73425
|
+
const sourceDirAbs = resolve21(mktRootAbs, sourcePath);
|
|
73426
|
+
sourceDirReal = await realpath12(sourceDirAbs).catch(() => null);
|
|
72968
73427
|
if (!sourceDirReal) {
|
|
72969
73428
|
return createResult({
|
|
72970
73429
|
actionType,
|
|
@@ -72972,8 +73431,8 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
72972
73431
|
error: `marketplace plugin entry source directory does not exist: ${sourcePath}`
|
|
72973
73432
|
});
|
|
72974
73433
|
}
|
|
72975
|
-
const sourceRelCheck =
|
|
72976
|
-
if (sourceRelCheck.startsWith("..") ||
|
|
73434
|
+
const sourceRelCheck = relative19(snapshotDirReal, sourceDirReal);
|
|
73435
|
+
if (sourceRelCheck.startsWith("..") || isAbsolute16(sourceRelCheck)) {
|
|
72977
73436
|
return createResult({
|
|
72978
73437
|
actionType,
|
|
72979
73438
|
status: ActionStatus.PREFLIGHT_FAILED,
|
|
@@ -72981,9 +73440,9 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
72981
73440
|
});
|
|
72982
73441
|
}
|
|
72983
73442
|
pluginRootForEntrySkill = sourceDirReal;
|
|
72984
|
-
const pluginRootRelToSnapshot =
|
|
73443
|
+
const pluginRootRelToSnapshot = relative19(snapshotDirReal, sourceDirReal) || ".";
|
|
72985
73444
|
const manifestRelative = pluginRootRelToSnapshot === "." ? platform.manifestPaths.plugin : `${pluginRootRelToSnapshot}/${platform.manifestPaths.plugin}`;
|
|
72986
|
-
const manifestPath =
|
|
73445
|
+
const manifestPath = resolve21(snapshotDirReal, manifestRelative);
|
|
72987
73446
|
const manifestResult = await validateManifestFile(manifestPath, ["name", "version"]);
|
|
72988
73447
|
if (!manifestResult.valid) {
|
|
72989
73448
|
return createResult({
|
|
@@ -73036,11 +73495,11 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73036
73495
|
}
|
|
73037
73496
|
} else {
|
|
73038
73497
|
const pluginRootForSkill = pluginRootForEntrySkill || snapshotDirReal;
|
|
73039
|
-
const entrySkillFile =
|
|
73498
|
+
const entrySkillFile = resolve21(pluginRootForSkill, "skills", action.entrySkill, "SKILL.md");
|
|
73040
73499
|
try {
|
|
73041
73500
|
await stat4(entrySkillFile);
|
|
73042
73501
|
} catch {
|
|
73043
|
-
const skillRel =
|
|
73502
|
+
const skillRel = relative19(snapshotDirReal, entrySkillFile) || `skills/${action.entrySkill}/SKILL.md`;
|
|
73044
73503
|
return createResult({
|
|
73045
73504
|
actionType,
|
|
73046
73505
|
status: ActionStatus.PREFLIGHT_FAILED,
|
|
@@ -73162,7 +73621,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73162
73621
|
}
|
|
73163
73622
|
if (action.entryPoint) {
|
|
73164
73623
|
try {
|
|
73165
|
-
await exec(process.execPath, ["--check",
|
|
73624
|
+
await exec(process.execPath, ["--check", resolve21(pluginDir, action.entryPoint)]);
|
|
73166
73625
|
} catch (checkErr) {
|
|
73167
73626
|
return createResult({
|
|
73168
73627
|
actionType,
|
|
@@ -73220,12 +73679,12 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73220
73679
|
}
|
|
73221
73680
|
const consumer = action.consumer;
|
|
73222
73681
|
const runDir = context.runDir;
|
|
73223
|
-
const isolatedHome =
|
|
73224
|
-
const runDirReal = await
|
|
73225
|
-
const isolatedHomePreReal = await
|
|
73226
|
-
const relToRun =
|
|
73682
|
+
const isolatedHome = resolve21(runDir, "consumers", `${consumer}-${action.plugin}`);
|
|
73683
|
+
const runDirReal = await realpath12(runDir).catch(() => runDir);
|
|
73684
|
+
const isolatedHomePreReal = await realpath12(isolatedHome).catch(() => isolatedHome);
|
|
73685
|
+
const relToRun = relative19(runDirReal, isolatedHomePreReal);
|
|
73227
73686
|
const sepE = process.platform === "win32" ? "\\" : "/";
|
|
73228
|
-
if (relToRun !== "" && (
|
|
73687
|
+
if (relToRun !== "" && (isAbsolute16(relToRun) || relToRun === ".." || relToRun.startsWith(`..${sepE}`))) {
|
|
73229
73688
|
return createResult({
|
|
73230
73689
|
actionType,
|
|
73231
73690
|
status: ActionStatus.EXECUTE_FAILED,
|
|
@@ -73234,7 +73693,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73234
73693
|
}
|
|
73235
73694
|
await mkdir10(isolatedHome, { recursive: true, mode: 448 });
|
|
73236
73695
|
for (const subdir of platform.isolationSubdirs) {
|
|
73237
|
-
await mkdir10(
|
|
73696
|
+
await mkdir10(resolve21(isolatedHome, subdir), { recursive: true, mode: 448 });
|
|
73238
73697
|
}
|
|
73239
73698
|
const cliCmd = platform.cli.binary;
|
|
73240
73699
|
const baseEnv = { ...process.env, ...context.env };
|
|
@@ -73331,9 +73790,9 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73331
73790
|
error: `plugin install JSON missing installedPath`
|
|
73332
73791
|
});
|
|
73333
73792
|
}
|
|
73334
|
-
const installPathAbs =
|
|
73335
|
-
const installPathRel =
|
|
73336
|
-
if (
|
|
73793
|
+
const installPathAbs = resolve21(installFields.installedPath);
|
|
73794
|
+
const installPathRel = relative19(isolatedHome, installPathAbs);
|
|
73795
|
+
if (isAbsolute16(installPathRel) || installPathRel === ".." || installPathRel.startsWith(`..${sepE}`)) {
|
|
73337
73796
|
return createResult({
|
|
73338
73797
|
actionType,
|
|
73339
73798
|
status: ActionStatus.EXECUTE_FAILED,
|
|
@@ -73394,9 +73853,9 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73394
73853
|
executedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
73395
73854
|
...extraInstalledPathsAudit(executeBinding)
|
|
73396
73855
|
};
|
|
73397
|
-
const evidenceDir =
|
|
73856
|
+
const evidenceDir = resolve21(runDir, "evidence", `${consumer}-${action.plugin}`);
|
|
73398
73857
|
await mkdir10(evidenceDir, { recursive: true, mode: 448 });
|
|
73399
|
-
const evidencePath =
|
|
73858
|
+
const evidencePath = resolve21(evidenceDir, "release-skill-install-evidence.json");
|
|
73400
73859
|
await writeEvidenceAtomic(evidencePath, evidence);
|
|
73401
73860
|
const executeObservation = {
|
|
73402
73861
|
...evidence,
|
|
@@ -73492,7 +73951,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73492
73951
|
observation: { installed: false, error: "context.runDir is required" }
|
|
73493
73952
|
});
|
|
73494
73953
|
}
|
|
73495
|
-
const isolatedHome =
|
|
73954
|
+
const isolatedHome = resolve21(runDir, "consumers", `${consumer}-${action.plugin}`);
|
|
73496
73955
|
const platform = PLATFORMS.find((p) => p.id === consumer) ?? null;
|
|
73497
73956
|
if (!platform) {
|
|
73498
73957
|
throw new Error(
|
|
@@ -73544,7 +74003,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73544
74003
|
}
|
|
73545
74004
|
let requirement = null;
|
|
73546
74005
|
try {
|
|
73547
|
-
requirement = JSON.parse(await readFile18(
|
|
74006
|
+
requirement = JSON.parse(await readFile18(resolve21(attestationDir, KIMI_REQUIREMENT_FILE), "utf8"));
|
|
73548
74007
|
} catch {
|
|
73549
74008
|
return createResult({
|
|
73550
74009
|
actionType,
|
|
@@ -73568,7 +74027,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73568
74027
|
}
|
|
73569
74028
|
let attestation = null;
|
|
73570
74029
|
try {
|
|
73571
|
-
attestation = JSON.parse(await readFile18(
|
|
74030
|
+
attestation = JSON.parse(await readFile18(resolve21(attestationDir, KIMI_ATTESTATION_FILE), "utf8"));
|
|
73572
74031
|
} catch {
|
|
73573
74032
|
return createResult({
|
|
73574
74033
|
actionType,
|
|
@@ -73578,7 +74037,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73578
74037
|
manualInstallRequired: true,
|
|
73579
74038
|
installUrl: requirement.installUrl,
|
|
73580
74039
|
attestationDir,
|
|
73581
|
-
error: `kimi attestation is missing; write ${
|
|
74040
|
+
error: `kimi attestation is missing; write ${resolve21(attestationDir, KIMI_ATTESTATION_FILE)} after the interactive install (${requirement.installUrl})`
|
|
73582
74041
|
}
|
|
73583
74042
|
});
|
|
73584
74043
|
}
|
|
@@ -73620,10 +74079,10 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73620
74079
|
}
|
|
73621
74080
|
let verifiedInstallPath = null;
|
|
73622
74081
|
if (normalizedAttestation.installPath) {
|
|
73623
|
-
const installPathAbs =
|
|
74082
|
+
const installPathAbs = resolve21(normalizedAttestation.installPath);
|
|
73624
74083
|
let lexicalStat;
|
|
73625
74084
|
try {
|
|
73626
|
-
lexicalStat = await
|
|
74085
|
+
lexicalStat = await lstat14(installPathAbs);
|
|
73627
74086
|
} catch {
|
|
73628
74087
|
return createResult({
|
|
73629
74088
|
actionType,
|
|
@@ -73644,7 +74103,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73644
74103
|
}
|
|
73645
74104
|
});
|
|
73646
74105
|
}
|
|
73647
|
-
const installPathReal2 = await
|
|
74106
|
+
const installPathReal2 = await realpath12(installPathAbs).catch(() => null);
|
|
73648
74107
|
if (!installPathReal2) {
|
|
73649
74108
|
return createResult({
|
|
73650
74109
|
actionType,
|
|
@@ -73735,7 +74194,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73735
74194
|
}
|
|
73736
74195
|
let requirement = null;
|
|
73737
74196
|
try {
|
|
73738
|
-
requirement = JSON.parse(await readFile18(
|
|
74197
|
+
requirement = JSON.parse(await readFile18(resolve21(attestationDir, CODEBUDDY_REQUIREMENT_FILE), "utf8"));
|
|
73739
74198
|
} catch {
|
|
73740
74199
|
return createResult({
|
|
73741
74200
|
actionType,
|
|
@@ -73759,7 +74218,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73759
74218
|
}
|
|
73760
74219
|
let attestation = null;
|
|
73761
74220
|
try {
|
|
73762
|
-
attestation = JSON.parse(await readFile18(
|
|
74221
|
+
attestation = JSON.parse(await readFile18(resolve21(attestationDir, CODEBUDDY_ATTESTATION_FILE), "utf8"));
|
|
73763
74222
|
} catch {
|
|
73764
74223
|
return createResult({
|
|
73765
74224
|
actionType,
|
|
@@ -73769,7 +74228,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73769
74228
|
manualInstallRequired: true,
|
|
73770
74229
|
marketplaceSource: CODEBUDDY_MARKETPLACE_SOURCE,
|
|
73771
74230
|
attestationDir,
|
|
73772
|
-
error: `codebuddy attestation is missing; write ${
|
|
74231
|
+
error: `codebuddy attestation is missing; write ${resolve21(attestationDir, CODEBUDDY_ATTESTATION_FILE)} after the manual install (marketplace ${CODEBUDDY_MARKETPLACE_SOURCE})`
|
|
73773
74232
|
}
|
|
73774
74233
|
});
|
|
73775
74234
|
}
|
|
@@ -73833,10 +74292,10 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73833
74292
|
}
|
|
73834
74293
|
});
|
|
73835
74294
|
}
|
|
73836
|
-
const installPathAbs =
|
|
74295
|
+
const installPathAbs = resolve21(normalizedAttestation.installPath);
|
|
73837
74296
|
let lexicalStat;
|
|
73838
74297
|
try {
|
|
73839
|
-
lexicalStat = await
|
|
74298
|
+
lexicalStat = await lstat14(installPathAbs);
|
|
73840
74299
|
} catch {
|
|
73841
74300
|
return createResult({
|
|
73842
74301
|
actionType,
|
|
@@ -73857,7 +74316,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73857
74316
|
}
|
|
73858
74317
|
});
|
|
73859
74318
|
}
|
|
73860
|
-
verifiedInstallPath = await
|
|
74319
|
+
verifiedInstallPath = await realpath12(installPathAbs);
|
|
73861
74320
|
}
|
|
73862
74321
|
return createResult({
|
|
73863
74322
|
actionType,
|
|
@@ -73897,13 +74356,13 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73897
74356
|
if (codexAttestationDir) {
|
|
73898
74357
|
let codexRequirement = null;
|
|
73899
74358
|
try {
|
|
73900
|
-
codexRequirement = JSON.parse(await readFile18(
|
|
74359
|
+
codexRequirement = JSON.parse(await readFile18(resolve21(codexAttestationDir, CODEX_REQUIREMENT_FILE), "utf8"));
|
|
73901
74360
|
} catch {
|
|
73902
74361
|
}
|
|
73903
74362
|
if (codexRequirement && codexRequirement.planDigest === codexBoundPlanDigest && codexRequirement.plugin === action.plugin && codexRequirement.version === action.version && codexRequirement.repo === action.repo && codexRequirement.ref === (action.ref ?? `v${action.version}`) && (!action.entrySkill || codexRequirement.entrySkill === action.entrySkill)) {
|
|
73904
74363
|
let codexAttestation = null;
|
|
73905
74364
|
try {
|
|
73906
|
-
codexAttestation = JSON.parse(await readFile18(
|
|
74365
|
+
codexAttestation = JSON.parse(await readFile18(resolve21(codexAttestationDir, CODEX_ATTESTATION_FILE), "utf8"));
|
|
73907
74366
|
} catch {
|
|
73908
74367
|
}
|
|
73909
74368
|
if (codexAttestation) {
|
|
@@ -73958,7 +74417,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
73958
74417
|
}
|
|
73959
74418
|
let evidence = null;
|
|
73960
74419
|
try {
|
|
73961
|
-
const evidenceRaw = await readFile18(
|
|
74420
|
+
const evidenceRaw = await readFile18(resolve21(runDir, "evidence", `${consumer}-${action.plugin}`, "release-skill-install-evidence.json"), "utf8");
|
|
73962
74421
|
evidence = JSON.parse(evidenceRaw);
|
|
73963
74422
|
} catch {
|
|
73964
74423
|
return createResult({
|
|
@@ -74041,11 +74500,11 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
74041
74500
|
}
|
|
74042
74501
|
}
|
|
74043
74502
|
}
|
|
74044
|
-
const isolatedHomeReal = await
|
|
74045
|
-
const installPathReal = await
|
|
74046
|
-
const relToHome =
|
|
74047
|
-
const
|
|
74048
|
-
if (relToHome !== "" && (
|
|
74503
|
+
const isolatedHomeReal = await realpath12(isolatedHome).catch(() => isolatedHome);
|
|
74504
|
+
const installPathReal = await realpath12(installPath).catch(() => installPath);
|
|
74505
|
+
const relToHome = relative19(isolatedHomeReal, installPathReal);
|
|
74506
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
74507
|
+
if (relToHome !== "" && (isAbsolute16(relToHome) || relToHome === ".." || relToHome.startsWith(`..${sep7}`))) {
|
|
74049
74508
|
return createResult({
|
|
74050
74509
|
actionType,
|
|
74051
74510
|
status: ActionStatus.OBSERVED,
|
|
@@ -74055,10 +74514,10 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
74055
74514
|
}
|
|
74056
74515
|
});
|
|
74057
74516
|
}
|
|
74058
|
-
const entrySkillPath =
|
|
74517
|
+
const entrySkillPath = resolve21(installPath, "skills", action.entrySkill, "SKILL.md");
|
|
74059
74518
|
let entrySkillFound = false;
|
|
74060
74519
|
try {
|
|
74061
|
-
const skillStat = await
|
|
74520
|
+
const skillStat = await lstat14(entrySkillPath);
|
|
74062
74521
|
if (skillStat.isFile() && !skillStat.isSymbolicLink()) {
|
|
74063
74522
|
entrySkillFound = true;
|
|
74064
74523
|
}
|
|
@@ -74124,7 +74583,7 @@ function createPluginMarketplaceAdapter(deps = {}) {
|
|
|
74124
74583
|
});
|
|
74125
74584
|
}
|
|
74126
74585
|
try {
|
|
74127
|
-
const installedManifestPath =
|
|
74586
|
+
const installedManifestPath = resolve21(installPath, platform.manifestPaths.plugin);
|
|
74128
74587
|
const installedManifestContent = await readFile18(installedManifestPath, "utf8");
|
|
74129
74588
|
const installedManifest = JSON.parse(installedManifestContent);
|
|
74130
74589
|
const expectedName = observation.plugin;
|
|
@@ -74307,8 +74766,8 @@ var init_plugin_marketplace = __esm({
|
|
|
74307
74766
|
});
|
|
74308
74767
|
|
|
74309
74768
|
// src/artifacts/transaction-journal.mjs
|
|
74310
|
-
import { readdir as
|
|
74311
|
-
import { join as
|
|
74769
|
+
import { readdir as readdir12, readFile as readFile19, rm as rm7, stat as stat5 } from "node:fs/promises";
|
|
74770
|
+
import { join as join18 } from "node:path";
|
|
74312
74771
|
function failSchema(message, details) {
|
|
74313
74772
|
throw new ReleaseError(TRANSACTION_INCOMPLETE, message, details);
|
|
74314
74773
|
}
|
|
@@ -75305,7 +75764,7 @@ async function pruneTerminalTransactionRecords(transactionsRoot, {
|
|
|
75305
75764
|
if (!Number.isInteger(retentionMax) || retentionMax < 0) return summary;
|
|
75306
75765
|
let entries;
|
|
75307
75766
|
try {
|
|
75308
|
-
entries = await
|
|
75767
|
+
entries = await readdir12(transactionsRoot, { withFileTypes: true });
|
|
75309
75768
|
} catch (scanErr) {
|
|
75310
75769
|
summary.errors.push(`scan: ${scanErr?.code || scanErr?.message || "readdir-failed"}`);
|
|
75311
75770
|
return summary;
|
|
@@ -75315,11 +75774,11 @@ async function pruneTerminalTransactionRecords(transactionsRoot, {
|
|
|
75315
75774
|
if (txnDirs.length <= retentionMax) return summary;
|
|
75316
75775
|
const terminal = [];
|
|
75317
75776
|
for (const entry of txnDirs) {
|
|
75318
|
-
const recordDir =
|
|
75777
|
+
const recordDir = join18(transactionsRoot, entry.name);
|
|
75319
75778
|
let state = null;
|
|
75320
75779
|
let createdAt = null;
|
|
75321
75780
|
try {
|
|
75322
|
-
const raw = await readFile19(
|
|
75781
|
+
const raw = await readFile19(join18(recordDir, "journal.json"), "utf8");
|
|
75323
75782
|
const journal = JSON.parse(raw);
|
|
75324
75783
|
if (journal && typeof journal === "object") {
|
|
75325
75784
|
state = typeof journal.state === "string" ? journal.state : null;
|
|
@@ -75383,7 +75842,7 @@ async function createTransactionJournal({
|
|
|
75383
75842
|
);
|
|
75384
75843
|
if (typeof root === "string" && root.length > 0) {
|
|
75385
75844
|
await pruneTerminalTransactionRecords(
|
|
75386
|
-
|
|
75845
|
+
join18(root, ".release-skill", "transactions"),
|
|
75387
75846
|
{ retentionMax }
|
|
75388
75847
|
);
|
|
75389
75848
|
}
|
|
@@ -75747,7 +76206,7 @@ __export(transaction_exports, {
|
|
|
75747
76206
|
applyWriteSetUnderLock: () => applyWriteSetUnderLock
|
|
75748
76207
|
});
|
|
75749
76208
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
75750
|
-
import { relative as
|
|
76209
|
+
import { relative as relative20 } from "node:path";
|
|
75751
76210
|
function computeCanonicalPlanDigest(plan) {
|
|
75752
76211
|
const { planDigest: _ignored, ...content } = plan;
|
|
75753
76212
|
return `sha256:${sha256Hex(canonicalJson(content))}`;
|
|
@@ -76660,7 +77119,7 @@ async function applyArtifactPlanUnderLock({
|
|
|
76660
77119
|
}
|
|
76661
77120
|
const handle = await safeFs.openRoot(root);
|
|
76662
77121
|
try {
|
|
76663
|
-
const relPlanPath = canonicalArtifactPath(
|
|
77122
|
+
const relPlanPath = canonicalArtifactPath(relative20(root, planPath)).path;
|
|
76664
77123
|
const planFileData = await withParentHandle(handle, relPlanPath, async (parent, leaf) => {
|
|
76665
77124
|
const planEntry = await parent.readEntry(leaf);
|
|
76666
77125
|
if (!planEntry || planEntry.kind === "absent") {
|
|
@@ -79075,7 +79534,7 @@ __export(refresh_service_exports, {
|
|
|
79075
79534
|
planReleaseDocsRefreshForUnit: () => planReleaseDocsRefreshForUnit,
|
|
79076
79535
|
runReleaseDocsRefresh: () => runReleaseDocsRefresh
|
|
79077
79536
|
});
|
|
79078
|
-
import { isAbsolute as
|
|
79537
|
+
import { isAbsolute as isAbsolute17, relative as relative21, resolve as resolve22, sep as sep6 } from "node:path";
|
|
79079
79538
|
function deepFreeze7(value) {
|
|
79080
79539
|
if (Array.isArray(value)) {
|
|
79081
79540
|
for (const item of value) deepFreeze7(item);
|
|
@@ -79158,7 +79617,7 @@ async function planReleaseDocsRefreshForUnit({
|
|
|
79158
79617
|
field: "unit.source"
|
|
79159
79618
|
});
|
|
79160
79619
|
}
|
|
79161
|
-
const unitRoot =
|
|
79620
|
+
const unitRoot = resolve22(root, unit.source);
|
|
79162
79621
|
const backend = await (backendFactory ?? loadSafeFs)();
|
|
79163
79622
|
const sharedFactory = /* @__PURE__ */ __name(async () => backend, "sharedFactory");
|
|
79164
79623
|
const notesSource = await loadReleaseNotesSource({
|
|
@@ -79368,16 +79827,16 @@ async function runReleaseDocsRefresh({
|
|
|
79368
79827
|
});
|
|
79369
79828
|
}
|
|
79370
79829
|
const changedFiles = plan.files.filter((file) => file.changed);
|
|
79371
|
-
const unitRoot =
|
|
79372
|
-
const unitLocation =
|
|
79373
|
-
if (unitLocation === ".." || unitLocation.startsWith(`..${
|
|
79830
|
+
const unitRoot = resolve22(root, unit.source);
|
|
79831
|
+
const unitLocation = relative21(root, unitRoot);
|
|
79832
|
+
if (unitLocation === ".." || unitLocation.startsWith(`..${sep6}`) || isAbsolute17(unitLocation)) {
|
|
79374
79833
|
throw new ReleaseError(
|
|
79375
79834
|
PATH_UNSAFE,
|
|
79376
79835
|
"release unit source escapes the project root",
|
|
79377
79836
|
{ reason: "UNIT_SOURCE_ESCAPE", unitId }
|
|
79378
79837
|
);
|
|
79379
79838
|
}
|
|
79380
|
-
const unitPrefix = unitLocation === "" ? "" : `${unitLocation.split(
|
|
79839
|
+
const unitPrefix = unitLocation === "" ? "" : `${unitLocation.split(sep6).join("/")}/`;
|
|
79381
79840
|
const projectPath = /* @__PURE__ */ __name((targetPath) => `${unitPrefix}${targetPath}`, "projectPath");
|
|
79382
79841
|
const writeSet = changedFiles.map((file) => ({
|
|
79383
79842
|
id: `${file.kind}:${projectPath(file.path)}`,
|
|
@@ -79428,7 +79887,7 @@ async function runReleaseDocsRefresh({
|
|
|
79428
79887
|
if (err instanceof ReleaseError && err.code === TRANSACTION_INCOMPLETE && typeof err.details?.recover === "string") {
|
|
79429
79888
|
const restored = await tryRestoreOldBytes(
|
|
79430
79889
|
backend,
|
|
79431
|
-
|
|
79890
|
+
resolve22(root, unit.source),
|
|
79432
79891
|
changedFiles,
|
|
79433
79892
|
modes
|
|
79434
79893
|
);
|
|
@@ -79528,8 +79987,8 @@ __export(prepare_exports, {
|
|
|
79528
79987
|
resolveUnitVersion: () => resolveUnitVersion,
|
|
79529
79988
|
runDeclaredHooks: () => runDeclaredHooks
|
|
79530
79989
|
});
|
|
79531
|
-
import { resolve as
|
|
79532
|
-
import { readFile as readFile20, mkdir as mkdir11, realpath as
|
|
79990
|
+
import { resolve as resolve23, relative as relative22, isAbsolute as isAbsolute18, normalize as normalize3, dirname as dirname10 } from "node:path";
|
|
79991
|
+
import { readFile as readFile20, mkdir as mkdir11, realpath as realpath13 } from "node:fs/promises";
|
|
79533
79992
|
import { execFile as execFileCb9 } from "node:child_process";
|
|
79534
79993
|
import { promisify as promisify9 } from "node:util";
|
|
79535
79994
|
async function resolveUnitVersion(unit, root, explicitVersion) {
|
|
@@ -79541,18 +80000,18 @@ async function resolveUnitVersion(unit, root, explicitVersion) {
|
|
|
79541
80000
|
{ unitId: unit.id }
|
|
79542
80001
|
);
|
|
79543
80002
|
}
|
|
79544
|
-
if (
|
|
80003
|
+
if (isAbsolute18(versionSource)) {
|
|
79545
80004
|
throw new ReleaseError(
|
|
79546
80005
|
CONFIG_INVALID,
|
|
79547
80006
|
`unit "${unit.id}" version.source must be a relative path, got absolute: "${versionSource}"`,
|
|
79548
80007
|
{ unitId: unit.id, versionSource }
|
|
79549
80008
|
);
|
|
79550
80009
|
}
|
|
79551
|
-
const unitRoot =
|
|
79552
|
-
const resolvedPath =
|
|
80010
|
+
const unitRoot = resolve23(root, unit.source);
|
|
80011
|
+
const resolvedPath = resolve23(unitRoot, versionSource);
|
|
79553
80012
|
const normalizedPath = normalize3(resolvedPath);
|
|
79554
|
-
const rel =
|
|
79555
|
-
if (rel.startsWith("..") || rel === ".." ||
|
|
80013
|
+
const rel = relative22(unitRoot, normalizedPath);
|
|
80014
|
+
if (rel.startsWith("..") || rel === ".." || isAbsolute18(rel)) {
|
|
79556
80015
|
throw new ReleaseError(
|
|
79557
80016
|
CONFIG_INVALID,
|
|
79558
80017
|
`unit "${unit.id}" version.source escapes unit root: "${versionSource}"`,
|
|
@@ -79851,7 +80310,7 @@ async function processSnapshots(config, root, evidence, runDir, production = fal
|
|
|
79851
80310
|
const unitResults = [];
|
|
79852
80311
|
const snapshotDigests = [];
|
|
79853
80312
|
for (const unit of units) {
|
|
79854
|
-
const outputDir = resolveUnitScopedPath(
|
|
80313
|
+
const outputDir = resolveUnitScopedPath(resolve23(runDir, "snapshots"), unit.id);
|
|
79855
80314
|
await evidence.append({
|
|
79856
80315
|
phase: "snapshot",
|
|
79857
80316
|
status: "started",
|
|
@@ -80079,7 +80538,7 @@ async function buildProductionAssets(unitResults, resolvedVersions, root, runDir
|
|
|
80079
80538
|
const { unit, manifest } = unitResults[index];
|
|
80080
80539
|
const version = resolvedVersions[index];
|
|
80081
80540
|
const { tag, branch, branchStrategy } = resolveProductionBranch(unit, version);
|
|
80082
|
-
const snapshotPath =
|
|
80541
|
+
const snapshotPath = relative22(root, manifest.outputDir);
|
|
80083
80542
|
const observed = await computeFrozenSnapshot(manifest.outputDir);
|
|
80084
80543
|
if (observed.digest !== manifest.snapshotDigest) {
|
|
80085
80544
|
throw new ReleaseError(
|
|
@@ -80090,7 +80549,7 @@ async function buildProductionAssets(unitResults, resolvedVersions, root, runDir
|
|
|
80090
80549
|
}
|
|
80091
80550
|
await sealFrozenSnapshot(manifest.outputDir);
|
|
80092
80551
|
const sealed = await computeFrozenSnapshot(manifest.outputDir);
|
|
80093
|
-
const repositoryDir = resolveUnitScopedPath(
|
|
80552
|
+
const repositoryDir = resolveUnitScopedPath(resolve23(runDir, "git"), unit.id, { suffix: ".git" });
|
|
80094
80553
|
const unitBaseline = unitBaselineResults.get(unit.id);
|
|
80095
80554
|
const parent = branchStrategy === "create-release-branch" ? void 0 : {
|
|
80096
80555
|
githubHost: unitBaseline.githubHost,
|
|
@@ -80111,21 +80570,21 @@ async function buildProductionAssets(unitResults, resolvedVersions, root, runDir
|
|
|
80111
80570
|
if (npmDistribution) {
|
|
80112
80571
|
npm = await buildFrozenNpmTarball({
|
|
80113
80572
|
snapshotDir: manifest.outputDir,
|
|
80114
|
-
tarballDir: resolveUnitScopedPath(
|
|
80573
|
+
tarballDir: resolveUnitScopedPath(resolve23(runDir, "tarballs"), unit.id),
|
|
80115
80574
|
expectedSnapshotDigest: sealed.digest
|
|
80116
80575
|
});
|
|
80117
80576
|
await verifyFrozenNpmTarballContract({
|
|
80118
80577
|
package: npmDistribution.package,
|
|
80119
80578
|
version,
|
|
80120
|
-
tarballPath:
|
|
80579
|
+
tarballPath: relative22(root, npm.tarballPath),
|
|
80121
80580
|
tarballSha256: npm.sha256,
|
|
80122
80581
|
integrity: npm.integrity
|
|
80123
|
-
}, root, resolveUnitScopedPath(
|
|
80582
|
+
}, root, resolveUnitScopedPath(resolve23(runDir, "tarballs"), unit.id));
|
|
80124
80583
|
}
|
|
80125
80584
|
assets.push({
|
|
80126
80585
|
snapshotPath,
|
|
80127
80586
|
manifestDigest: sealed.digest,
|
|
80128
|
-
gitObjectDir:
|
|
80587
|
+
gitObjectDir: relative22(root, repositoryDir),
|
|
80129
80588
|
commit: git2.commit,
|
|
80130
80589
|
tree: git2.tree,
|
|
80131
80590
|
commitTimestamp: canonicalFreezeTimestamp,
|
|
@@ -80134,7 +80593,7 @@ async function buildProductionAssets(unitResults, resolvedVersions, root, runDir
|
|
|
80134
80593
|
branch,
|
|
80135
80594
|
tag,
|
|
80136
80595
|
npm: npm ? {
|
|
80137
|
-
tarballPath:
|
|
80596
|
+
tarballPath: relative22(root, npm.tarballPath),
|
|
80138
80597
|
tarballSha256: npm.sha256,
|
|
80139
80598
|
integrity: npm.integrity,
|
|
80140
80599
|
size: npm.size
|
|
@@ -80685,7 +81144,7 @@ async function prepareRelease(options) {
|
|
|
80685
81144
|
}
|
|
80686
81145
|
let realRoot;
|
|
80687
81146
|
try {
|
|
80688
|
-
realRoot = await
|
|
81147
|
+
realRoot = await realpath13(root);
|
|
80689
81148
|
} catch (err) {
|
|
80690
81149
|
throw new ReleaseError(
|
|
80691
81150
|
CONFIG_INVALID,
|
|
@@ -80694,26 +81153,26 @@ async function prepareRelease(options) {
|
|
|
80694
81153
|
);
|
|
80695
81154
|
}
|
|
80696
81155
|
if (production) {
|
|
80697
|
-
const canonicalOutput =
|
|
80698
|
-
if (output &&
|
|
81156
|
+
const canonicalOutput = resolve23(realRoot, ".release-skill", "release-plan.json");
|
|
81157
|
+
if (output && resolve23(output) !== canonicalOutput) {
|
|
80699
81158
|
throw new ReleaseError(
|
|
80700
81159
|
GATE_FAILED,
|
|
80701
81160
|
"production prepare requires the canonical .release-skill/release-plan.json output; custom --output is supported only outside production",
|
|
80702
|
-
{ output:
|
|
81161
|
+
{ output: resolve23(output), expected: canonicalOutput }
|
|
80703
81162
|
);
|
|
80704
81163
|
}
|
|
80705
81164
|
}
|
|
80706
81165
|
const lock = await acquireProjectLock({ root: realRoot, command: "prepare", mode: "exclusive" });
|
|
80707
|
-
const releaseDir =
|
|
81166
|
+
const releaseDir = resolve23(realRoot, ".release-skill");
|
|
80708
81167
|
const runId = `prepare-${Date.now()}`;
|
|
80709
|
-
const rawRunDir = runDirOpt ??
|
|
81168
|
+
const rawRunDir = runDirOpt ?? resolve23(releaseDir, "runs", runId);
|
|
80710
81169
|
let runDir;
|
|
80711
81170
|
try {
|
|
80712
81171
|
if (production) {
|
|
80713
81172
|
runDir = await createProductionPrepareRunDir(rawRunDir, releaseDir);
|
|
80714
81173
|
} else {
|
|
80715
81174
|
await mkdir11(rawRunDir, { recursive: true });
|
|
80716
|
-
runDir = await
|
|
81175
|
+
runDir = await realpath13(rawRunDir);
|
|
80717
81176
|
}
|
|
80718
81177
|
} catch (error) {
|
|
80719
81178
|
await lock.release();
|
|
@@ -80727,7 +81186,7 @@ async function prepareRelease(options) {
|
|
|
80727
81186
|
await evidence.append({
|
|
80728
81187
|
phase: "config",
|
|
80729
81188
|
status: "completed",
|
|
80730
|
-
configPath:
|
|
81189
|
+
configPath: relative22(realRoot, configPath),
|
|
80731
81190
|
configDigest
|
|
80732
81191
|
});
|
|
80733
81192
|
const configUnits = config.releaseUnits ?? [];
|
|
@@ -80859,6 +81318,44 @@ To proceed, pass --acknowledge-hook-side-effects (CLI) or hooksAuthorized=true (
|
|
|
80859
81318
|
expectedBindings: preHookDocsBindings
|
|
80860
81319
|
});
|
|
80861
81320
|
}
|
|
81321
|
+
for (const unit of configUnits) {
|
|
81322
|
+
if (!unit?.expectedPublicSurface) continue;
|
|
81323
|
+
await evidence.append({
|
|
81324
|
+
phase: "public-surface",
|
|
81325
|
+
status: "started",
|
|
81326
|
+
unitId: unit.id
|
|
81327
|
+
});
|
|
81328
|
+
try {
|
|
81329
|
+
const surface = await assertExpectedPublicSurface({
|
|
81330
|
+
root: realRoot,
|
|
81331
|
+
unit
|
|
81332
|
+
});
|
|
81333
|
+
await evidence.append({
|
|
81334
|
+
phase: "public-surface",
|
|
81335
|
+
status: "completed",
|
|
81336
|
+
unitId: unit.id,
|
|
81337
|
+
...surface.summary
|
|
81338
|
+
});
|
|
81339
|
+
} catch (error) {
|
|
81340
|
+
await evidence.append({
|
|
81341
|
+
phase: "public-surface",
|
|
81342
|
+
status: "failed",
|
|
81343
|
+
unitId: unit.id,
|
|
81344
|
+
reason: error.details?.reason ?? "PUBLIC_SURFACE_CHECK_FAILED",
|
|
81345
|
+
error: {
|
|
81346
|
+
code: error.code,
|
|
81347
|
+
message: error.message
|
|
81348
|
+
},
|
|
81349
|
+
diagnostics: {
|
|
81350
|
+
missingMappings: error.details?.missingMappings ?? [],
|
|
81351
|
+
unexpectedMappings: error.details?.unexpectedMappings ?? [],
|
|
81352
|
+
unclassifiedFiles: error.details?.unclassifiedFiles ?? [],
|
|
81353
|
+
ambiguousFiles: error.details?.ambiguousFiles ?? []
|
|
81354
|
+
}
|
|
81355
|
+
});
|
|
81356
|
+
throw error;
|
|
81357
|
+
}
|
|
81358
|
+
}
|
|
80862
81359
|
const sourceRepository = config.project?.sourceRepository ?? null;
|
|
80863
81360
|
const configDefaultBranch = config.project?.defaultBranch ?? null;
|
|
80864
81361
|
let sourceAuthority = null;
|
|
@@ -81371,7 +81868,7 @@ To proceed, pass --acknowledge-hook-side-effects (CLI) or hooksAuthorized=true (
|
|
|
81371
81868
|
{ unitId: unit.id, distributionType: dist.type }
|
|
81372
81869
|
);
|
|
81373
81870
|
}
|
|
81374
|
-
const marketplaceIndexPath =
|
|
81871
|
+
const marketplaceIndexPath = resolve23(snapshotDir, marketplaceIndexRelative);
|
|
81375
81872
|
let marketplaceIndexRaw;
|
|
81376
81873
|
try {
|
|
81377
81874
|
marketplaceIndexRaw = await readFile20(marketplaceIndexPath, "utf8");
|
|
@@ -81440,7 +81937,7 @@ To proceed, pass --acknowledge-hook-side-effects (CLI) or hooksAuthorized=true (
|
|
|
81440
81937
|
pluginManifestRelative = readResult.manifestRelative ?? platform.manifestPaths.plugin;
|
|
81441
81938
|
} else {
|
|
81442
81939
|
pluginManifestRelative = platform.manifestPaths.plugin;
|
|
81443
|
-
const pluginManifestPath =
|
|
81940
|
+
const pluginManifestPath = resolve23(snapshotDir, pluginManifestRelative);
|
|
81444
81941
|
let raw;
|
|
81445
81942
|
try {
|
|
81446
81943
|
raw = await readFile20(pluginManifestPath, "utf8");
|
|
@@ -81573,7 +82070,7 @@ To proceed, pass --acknowledge-hook-side-effects (CLI) or hooksAuthorized=true (
|
|
|
81573
82070
|
...production ? {
|
|
81574
82071
|
production: {
|
|
81575
82072
|
mode: "github-npm-v1",
|
|
81576
|
-
assetRoot:
|
|
82073
|
+
assetRoot: relative22(realRoot, runDir)
|
|
81577
82074
|
}
|
|
81578
82075
|
} : {},
|
|
81579
82076
|
units,
|
|
@@ -81588,9 +82085,9 @@ To proceed, pass --acknowledge-hook-side-effects (CLI) or hooksAuthorized=true (
|
|
|
81588
82085
|
actionCount: externalActions.length
|
|
81589
82086
|
});
|
|
81590
82087
|
await evidence.append({ phase: "plan-write", status: "started" });
|
|
81591
|
-
const latestPlanPath = output ??
|
|
82088
|
+
const latestPlanPath = output ?? resolve23(releaseDir, "release-plan.json");
|
|
81592
82089
|
const plannedDigest = computePlanDigest(plan);
|
|
81593
|
-
const immutablePlanPath =
|
|
82090
|
+
const immutablePlanPath = resolve23(dirname10(latestPlanPath), "plans", `${plannedDigest}.json`);
|
|
81594
82091
|
const { planPath: writtenPath, planDigest } = await writePlanImmutable(immutablePlanPath, plan);
|
|
81595
82092
|
await writePlanAtomic(latestPlanPath, plan);
|
|
81596
82093
|
await evidence.append({
|
|
@@ -81638,6 +82135,7 @@ var init_prepare = __esm({
|
|
|
81638
82135
|
init_baseline();
|
|
81639
82136
|
init_hooks();
|
|
81640
82137
|
init_hook_cache();
|
|
82138
|
+
init_public_surface();
|
|
81641
82139
|
init_verification_gates();
|
|
81642
82140
|
init_evidence();
|
|
81643
82141
|
await init_plan();
|
|
@@ -81682,7 +82180,7 @@ var init_prepare = __esm({
|
|
|
81682
82180
|
|
|
81683
82181
|
// src/core/approval.mjs
|
|
81684
82182
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
81685
|
-
import { basename as basename6, dirname as dirname11, join as
|
|
82183
|
+
import { basename as basename6, dirname as dirname11, join as join19, resolve as resolve24 } from "node:path";
|
|
81686
82184
|
function validateApprovalRecordSchema(approval) {
|
|
81687
82185
|
if (validateApprovalSchema(approval)) return;
|
|
81688
82186
|
const errors = validateApprovalSchema.errors ?? [];
|
|
@@ -81699,7 +82197,7 @@ function assertImmutableApprovalAuthority(approvalPath, plan, rawApproval) {
|
|
|
81699
82197
|
if (!plan?.production) return;
|
|
81700
82198
|
const planDigest = computePlanDigest(plan);
|
|
81701
82199
|
const approvalDigest = computeApprovalDigest(rawApproval);
|
|
81702
|
-
const absolute =
|
|
82200
|
+
const absolute = resolve24(approvalPath);
|
|
81703
82201
|
const planDirectory = dirname11(absolute);
|
|
81704
82202
|
if (basename6(absolute) !== `${approvalDigest}.json` || basename6(planDirectory) !== planDigest || basename6(dirname11(planDirectory)) !== "approvals") {
|
|
81705
82203
|
throw new ReleaseError(
|
|
@@ -81969,7 +82467,7 @@ __export(approve_exports, {
|
|
|
81969
82467
|
approvePlan: () => approvePlan
|
|
81970
82468
|
});
|
|
81971
82469
|
import { readFile as readFile22, writeFile as writeFile7 } from "node:fs/promises";
|
|
81972
|
-
import { resolve as
|
|
82470
|
+
import { resolve as resolve25, dirname as dirname12, basename as basename7 } from "node:path";
|
|
81973
82471
|
function defaultClock() {
|
|
81974
82472
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
81975
82473
|
}
|
|
@@ -82099,18 +82597,18 @@ async function approvePlan(options) {
|
|
|
82099
82597
|
expiresAt
|
|
82100
82598
|
};
|
|
82101
82599
|
validateApprovalRecordSchema(approvalRecord);
|
|
82102
|
-
const planDir = dirname12(
|
|
82600
|
+
const planDir = dirname12(resolve25(planPath));
|
|
82103
82601
|
const releaseDir = basename7(planDir) === "plans" && basename7(planPath) === `${actualDigest}.json` ? dirname12(planDir) : planDir;
|
|
82104
|
-
if (plan.production?.mode === "github-npm-v1" && outputPath &&
|
|
82602
|
+
if (plan.production?.mode === "github-npm-v1" && outputPath && resolve25(outputPath) !== resolve25(releaseDir, "approval-record.json")) {
|
|
82105
82603
|
throw new ReleaseError(
|
|
82106
82604
|
GATE_FAILED,
|
|
82107
82605
|
"production approve requires the canonical approval-record.json alias next to the immutable plan authority; custom --output is supported only outside production",
|
|
82108
|
-
{ outputPath:
|
|
82606
|
+
{ outputPath: resolve25(outputPath), expected: resolve25(releaseDir, "approval-record.json") }
|
|
82109
82607
|
);
|
|
82110
82608
|
}
|
|
82111
82609
|
const json = JSON.stringify(approvalRecord, null, 2);
|
|
82112
82610
|
const approvalDigest = computeApprovalDigest(json);
|
|
82113
|
-
const immutableApprovalPath =
|
|
82611
|
+
const immutableApprovalPath = resolve25(
|
|
82114
82612
|
releaseDir,
|
|
82115
82613
|
"approvals",
|
|
82116
82614
|
actualDigest,
|
|
@@ -82131,7 +82629,7 @@ async function approvePlan(options) {
|
|
|
82131
82629
|
);
|
|
82132
82630
|
}
|
|
82133
82631
|
}
|
|
82134
|
-
const writePath = outputPath ??
|
|
82632
|
+
const writePath = outputPath ?? resolve25(releaseDir, "approval-record.json");
|
|
82135
82633
|
await prepareAuthorityDirectory(dirname12(writePath));
|
|
82136
82634
|
await assertAuthorityFileTarget(writePath);
|
|
82137
82635
|
await writeFile7(writePath, json, "utf8");
|
|
@@ -82333,7 +82831,7 @@ function defaultSleep(ms) {
|
|
|
82333
82831
|
if (process.env.RELEASE_SKILL_OBSERVE_RETRY_NO_WAIT === "1") {
|
|
82334
82832
|
return Promise.resolve();
|
|
82335
82833
|
}
|
|
82336
|
-
return new Promise((
|
|
82834
|
+
return new Promise((resolve29) => setTimeout(resolve29, ms));
|
|
82337
82835
|
}
|
|
82338
82836
|
function isPropagatingMissing(result) {
|
|
82339
82837
|
if (result == null) return true;
|
|
@@ -82423,7 +82921,7 @@ __export(reconcile_exports, {
|
|
|
82423
82921
|
reconcileRelease: () => reconcileRelease
|
|
82424
82922
|
});
|
|
82425
82923
|
import { readFile as readFile23, mkdir as mkdir12 } from "node:fs/promises";
|
|
82426
|
-
import { join as
|
|
82924
|
+
import { join as join20 } from "node:path";
|
|
82427
82925
|
function defaultClock3() {
|
|
82428
82926
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
82429
82927
|
}
|
|
@@ -83371,7 +83869,7 @@ async function reconcileRelease(options) {
|
|
|
83371
83869
|
...normalized === "deferred" ? { reason: CONSUMER_VERIFICATION_DEFERRED, phase: "post-publish-verification" } : {}
|
|
83372
83870
|
};
|
|
83373
83871
|
});
|
|
83374
|
-
const runPath =
|
|
83872
|
+
const runPath = join20(runDir, "release-run.json");
|
|
83375
83873
|
const sourceRunDigest = sourceAuthorityDigest;
|
|
83376
83874
|
const runState = {
|
|
83377
83875
|
runId,
|
|
@@ -84038,9 +84536,9 @@ __export(verify_exports, {
|
|
|
84038
84536
|
runSmokeTest: () => runSmokeTest,
|
|
84039
84537
|
verifyRelease: () => verifyRelease
|
|
84040
84538
|
});
|
|
84041
|
-
import { readFile as readFile24, writeFile as writeFile8, mkdtemp as mkdtemp4, rm as rm8, mkdir as mkdir13, lstat as
|
|
84539
|
+
import { readFile as readFile24, writeFile as writeFile8, mkdtemp as mkdtemp4, rm as rm8, mkdir as mkdir13, lstat as lstat15, realpath as realpath14, readdir as readdir13 } from "node:fs/promises";
|
|
84042
84540
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
84043
|
-
import { dirname as dirname13, join as
|
|
84541
|
+
import { dirname as dirname13, join as join21, relative as relative23, isAbsolute as isAbsolute19, resolve as resolve26, basename as basename8 } from "node:path";
|
|
84044
84542
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
84045
84543
|
import { execFile as execFileCb12 } from "node:child_process";
|
|
84046
84544
|
import { promisify as promisify12 } from "node:util";
|
|
@@ -84070,7 +84568,7 @@ function matchesSubset2(actual, expected) {
|
|
|
84070
84568
|
async function runSmokeTest(plan, root, options = {}) {
|
|
84071
84569
|
const baseDir = options.baseDir ?? tmpdir4();
|
|
84072
84570
|
await mkdir13(baseDir, { recursive: true });
|
|
84073
|
-
const tmpDir = await mkdtemp4(
|
|
84571
|
+
const tmpDir = await mkdtemp4(join21(baseDir, "verify-smoke-"));
|
|
84074
84572
|
const npmExec = options.npmExecutor ?? defaultNpmExecutor;
|
|
84075
84573
|
const installFlags = [
|
|
84076
84574
|
"--ignore-scripts",
|
|
@@ -84118,7 +84616,7 @@ async function runSmokeTest(plan, root, options = {}) {
|
|
|
84118
84616
|
for (const { package: pkgName, registry, targetVersion, unitId, smokeBin, smokeArgs, smokeExpectedJson } of npmDistributions) {
|
|
84119
84617
|
const packageAtVersion = `${pkgName}@${targetVersion}`;
|
|
84120
84618
|
const installDir = resolveUnitScopedPath(tmpDir, unitId);
|
|
84121
|
-
await mkdir13(
|
|
84619
|
+
await mkdir13(join21(installDir, "node_modules"), { recursive: true });
|
|
84122
84620
|
const registryFlags = [...installFlags, "--registry", registry];
|
|
84123
84621
|
const installResult = await npmExec.install(
|
|
84124
84622
|
packageAtVersion,
|
|
@@ -84136,7 +84634,7 @@ async function runSmokeTest(plan, root, options = {}) {
|
|
|
84136
84634
|
}
|
|
84137
84635
|
};
|
|
84138
84636
|
}
|
|
84139
|
-
const installedPkgPath =
|
|
84637
|
+
const installedPkgPath = join21(installDir, "node_modules", pkgName, "package.json");
|
|
84140
84638
|
let installedPkg;
|
|
84141
84639
|
try {
|
|
84142
84640
|
installedPkg = JSON.parse(await readFile24(installedPkgPath, "utf8"));
|
|
@@ -84170,7 +84668,7 @@ async function runSmokeTest(plan, root, options = {}) {
|
|
|
84170
84668
|
}
|
|
84171
84669
|
};
|
|
84172
84670
|
}
|
|
84173
|
-
const pkgRoot =
|
|
84671
|
+
const pkgRoot = join21(installDir, "node_modules", pkgName);
|
|
84174
84672
|
{
|
|
84175
84673
|
const dirIndex = await buildDirectoryFileIndex(pkgRoot);
|
|
84176
84674
|
const closureResult = checkNpmEntryClosure(installedPkg, dirIndex);
|
|
@@ -84270,10 +84768,10 @@ async function runSmokeTest(plan, root, options = {}) {
|
|
|
84270
84768
|
}
|
|
84271
84769
|
};
|
|
84272
84770
|
}
|
|
84273
|
-
const binPath =
|
|
84274
|
-
const relBin =
|
|
84275
|
-
const
|
|
84276
|
-
if (
|
|
84771
|
+
const binPath = resolve26(pkgRoot, binRelative);
|
|
84772
|
+
const relBin = relative23(pkgRoot, binPath);
|
|
84773
|
+
const sep7 = process.platform === "win32" ? "\\" : "/";
|
|
84774
|
+
if (isAbsolute19(relBin) || relBin === ".." || relBin.startsWith(`..${sep7}`)) {
|
|
84277
84775
|
return {
|
|
84278
84776
|
passed: false,
|
|
84279
84777
|
details: {
|
|
@@ -84285,10 +84783,10 @@ async function runSmokeTest(plan, root, options = {}) {
|
|
|
84285
84783
|
}
|
|
84286
84784
|
let binStat;
|
|
84287
84785
|
try {
|
|
84288
|
-
binStat = await
|
|
84289
|
-
const [pkgRootReal, binPathReal] = await Promise.all([
|
|
84290
|
-
const relReal =
|
|
84291
|
-
if (!binStat.isFile() || binStat.isSymbolicLink() ||
|
|
84786
|
+
binStat = await lstat15(binPath);
|
|
84787
|
+
const [pkgRootReal, binPathReal] = await Promise.all([realpath14(pkgRoot), realpath14(binPath)]);
|
|
84788
|
+
const relReal = relative23(pkgRootReal, binPathReal);
|
|
84789
|
+
if (!binStat.isFile() || binStat.isSymbolicLink() || isAbsolute19(relReal) || relReal === ".." || relReal.startsWith(`..${sep7}`)) {
|
|
84292
84790
|
throw new Error("bin is not a regular file inside the installed package");
|
|
84293
84791
|
}
|
|
84294
84792
|
} catch (err) {
|
|
@@ -84574,7 +85072,7 @@ async function verifyRelease(options) {
|
|
|
84574
85072
|
const trustedVerifyRuns = [];
|
|
84575
85073
|
const planDir = dirname13(planPath);
|
|
84576
85074
|
const releaseDir = basename8(planDir) === "plans" ? dirname13(planDir) : planDir;
|
|
84577
|
-
const runsDir =
|
|
85075
|
+
const runsDir = resolve26(releaseDir, "runs");
|
|
84578
85076
|
let runsDirReal = null;
|
|
84579
85077
|
let authorityDirReal = null;
|
|
84580
85078
|
if (previousVerifyRun) {
|
|
@@ -84587,7 +85085,7 @@ async function verifyRelease(options) {
|
|
|
84587
85085
|
}
|
|
84588
85086
|
{
|
|
84589
85087
|
try {
|
|
84590
|
-
const runsDirStat = await
|
|
85088
|
+
const runsDirStat = await lstat15(runsDir);
|
|
84591
85089
|
if (runsDirStat.isSymbolicLink()) {
|
|
84592
85090
|
throw new ReleaseError(
|
|
84593
85091
|
GATE_FAILED,
|
|
@@ -84616,7 +85114,7 @@ async function verifyRelease(options) {
|
|
|
84616
85114
|
runsDirReal = null;
|
|
84617
85115
|
}
|
|
84618
85116
|
if (runsDirReal) {
|
|
84619
|
-
const entries = await
|
|
85117
|
+
const entries = await readdir13(runsDirReal, { withFileTypes: true });
|
|
84620
85118
|
for (const entry of entries) {
|
|
84621
85119
|
if (!entry.name.startsWith("verify-")) continue;
|
|
84622
85120
|
if (!entry.isDirectory() || entry.isSymbolicLink()) {
|
|
@@ -84626,8 +85124,8 @@ async function verifyRelease(options) {
|
|
|
84626
85124
|
{ entry: entry.name, runsDir: runsDirReal }
|
|
84627
85125
|
);
|
|
84628
85126
|
}
|
|
84629
|
-
const candidateDir =
|
|
84630
|
-
const candidateStat = await
|
|
85127
|
+
const candidateDir = resolve26(runsDirReal, entry.name);
|
|
85128
|
+
const candidateStat = await lstat15(candidateDir).catch(() => null);
|
|
84631
85129
|
if (!candidateStat || candidateStat.isSymbolicLink()) {
|
|
84632
85130
|
throw new ReleaseError(
|
|
84633
85131
|
GATE_FAILED,
|
|
@@ -84643,7 +85141,7 @@ async function verifyRelease(options) {
|
|
|
84643
85141
|
{ candidateDir, candidateReal, runsDir: runsDirReal }
|
|
84644
85142
|
);
|
|
84645
85143
|
}
|
|
84646
|
-
const candidatePath =
|
|
85144
|
+
const candidatePath = resolve26(candidateDir, "release-run.json");
|
|
84647
85145
|
try {
|
|
84648
85146
|
const candidate = await loadRun(candidatePath, { requireDigest: true });
|
|
84649
85147
|
if (candidate.status !== "VERIFIED") continue;
|
|
@@ -84835,15 +85333,15 @@ async function verifyRelease(options) {
|
|
|
84835
85333
|
evidence,
|
|
84836
85334
|
env: gateEnv ?? process.env,
|
|
84837
85335
|
fixedEnv: action.type === "claude-marketplace-install" ? {
|
|
84838
|
-
HOME:
|
|
84839
|
-
CLAUDE_CONFIG_DIR:
|
|
85336
|
+
HOME: resolve26(runDir, "consumers", `claude-${action.parameters.plugin}`),
|
|
85337
|
+
CLAUDE_CONFIG_DIR: resolve26(runDir, "consumers", `claude-${action.parameters.plugin}`, ".claude")
|
|
84840
85338
|
} : action.type === "codex-marketplace-install" ? {
|
|
84841
|
-
HOME:
|
|
84842
|
-
CODEX_HOME:
|
|
85339
|
+
HOME: resolve26(runDir, "consumers", `codex-${action.parameters.plugin}`),
|
|
85340
|
+
CODEX_HOME: resolve26(runDir, "consumers", `codex-${action.parameters.plugin}`)
|
|
84843
85341
|
} : action.type === "codebuddy-marketplace-install" ? {
|
|
84844
|
-
HOME:
|
|
85342
|
+
HOME: resolve26(runDir, "consumers", `codebuddy-${action.parameters.plugin}`)
|
|
84845
85343
|
} : {
|
|
84846
|
-
HOME:
|
|
85344
|
+
HOME: resolve26(runDir, "consumers", `kimi-${action.parameters.plugin}`)
|
|
84847
85345
|
}
|
|
84848
85346
|
}));
|
|
84849
85347
|
} else {
|
|
@@ -85013,7 +85511,7 @@ async function verifyRelease(options) {
|
|
|
85013
85511
|
assertTransition(PUBLISHED, VERIFIED);
|
|
85014
85512
|
await evidence.append({ phase: "verify", status: "completed", overallStatus: VERIFIED });
|
|
85015
85513
|
const sourceRunDigest = sourceRun.runDigest ?? computeRunDigest(sourceRun);
|
|
85016
|
-
const verifyRunPath =
|
|
85514
|
+
const verifyRunPath = join21(runDir, "release-run.json");
|
|
85017
85515
|
const verifyRunState = {
|
|
85018
85516
|
runId,
|
|
85019
85517
|
command: "verify",
|
|
@@ -85134,7 +85632,7 @@ var init_verify = __esm({
|
|
|
85134
85632
|
exec: execFile11,
|
|
85135
85633
|
env: process.env
|
|
85136
85634
|
});
|
|
85137
|
-
const userConfig =
|
|
85635
|
+
const userConfig = join21(cwd, ".release-skill-npmrc");
|
|
85138
85636
|
await writeFile8(
|
|
85139
85637
|
userConfig,
|
|
85140
85638
|
`registry=${normalizedRegistry}/
|
|
@@ -85195,10 +85693,10 @@ __export(publish_exports, {
|
|
|
85195
85693
|
publishRelease: () => publishRelease
|
|
85196
85694
|
});
|
|
85197
85695
|
import { readFile as readFile25, mkdir as mkdir14 } from "node:fs/promises";
|
|
85198
|
-
import { isAbsolute as
|
|
85696
|
+
import { isAbsolute as isAbsolute20, join as join22, relative as relative24 } from "node:path";
|
|
85199
85697
|
function assertInsideAssetRoot(assetRoot, candidate, label) {
|
|
85200
|
-
const rel =
|
|
85201
|
-
if (rel === "" ||
|
|
85698
|
+
const rel = relative24(assetRoot, candidate);
|
|
85699
|
+
if (rel === "" || isAbsolute20(rel) || rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
|
|
85202
85700
|
throw new ReleaseError(GATE_FAILED, `${label} must be a child of the production asset root`);
|
|
85203
85701
|
}
|
|
85204
85702
|
}
|
|
@@ -85907,7 +86405,7 @@ async function publishRelease(options) {
|
|
|
85907
86405
|
}
|
|
85908
86406
|
}
|
|
85909
86407
|
await evidence.append({ phase: "safety-gate", gate: "global-preflight", status: "passed" });
|
|
85910
|
-
const runPath =
|
|
86408
|
+
const runPath = join22(runDir, "release-run.json");
|
|
85911
86409
|
const checkpoints = orderedActions.map((action) => {
|
|
85912
86410
|
if (isMarketplaceAction(action.type)) {
|
|
85913
86411
|
return {
|
|
@@ -86177,7 +86675,7 @@ var init_publish = __esm({
|
|
|
86177
86675
|
|
|
86178
86676
|
// src/artifacts/policy.mjs
|
|
86179
86677
|
import { readFile as readFile26 } from "node:fs/promises";
|
|
86180
|
-
import { join as
|
|
86678
|
+
import { join as join23 } from "node:path";
|
|
86181
86679
|
import { createHash as createHash11 } from "node:crypto";
|
|
86182
86680
|
function validateArtifactPolicy(policy) {
|
|
86183
86681
|
const ok = _validate(policy);
|
|
@@ -86273,7 +86771,7 @@ async function parseSafeYamlWithinRoot(root, policyPath) {
|
|
|
86273
86771
|
}
|
|
86274
86772
|
throw err;
|
|
86275
86773
|
}
|
|
86276
|
-
const fullPath =
|
|
86774
|
+
const fullPath = join23(root, policyPath);
|
|
86277
86775
|
let content;
|
|
86278
86776
|
try {
|
|
86279
86777
|
content = await readFile26(fullPath, "utf8");
|
|
@@ -86387,8 +86885,8 @@ var init_policy = __esm({
|
|
|
86387
86885
|
});
|
|
86388
86886
|
|
|
86389
86887
|
// src/artifacts/entry.mjs
|
|
86390
|
-
import { lstat as
|
|
86391
|
-
import { join as
|
|
86888
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile27 } from "node:fs/promises";
|
|
86889
|
+
import { join as join24 } from "node:path";
|
|
86392
86890
|
import { promisify as promisify13 } from "node:util";
|
|
86393
86891
|
import { execFile as execFile12 } from "node:child_process";
|
|
86394
86892
|
function statToGitMode(stat9) {
|
|
@@ -86408,12 +86906,12 @@ async function gitHashObject(root, absPath) {
|
|
|
86408
86906
|
}
|
|
86409
86907
|
async function enumerateTreeEntries(root, dirPath, relBase) {
|
|
86410
86908
|
const entries = [];
|
|
86411
|
-
const items = await
|
|
86909
|
+
const items = await readdir14(dirPath, { withFileTypes: true });
|
|
86412
86910
|
for (const item of items) {
|
|
86413
86911
|
if (SKIP_DIRS2.has(item.name)) continue;
|
|
86414
|
-
const absPath =
|
|
86912
|
+
const absPath = join24(dirPath, item.name);
|
|
86415
86913
|
const relPath = relBase ? `${relBase}/${item.name}` : item.name;
|
|
86416
|
-
const st = await
|
|
86914
|
+
const st = await lstat16(absPath);
|
|
86417
86915
|
if (st.isSymbolicLink()) {
|
|
86418
86916
|
throw new ReleaseError(
|
|
86419
86917
|
PATH_UNSAFE,
|
|
@@ -86462,10 +86960,10 @@ async function readEntry({ root, path: path3, source = "worktree" } = {}) {
|
|
|
86462
86960
|
if (source !== "worktree") {
|
|
86463
86961
|
throw new ReleaseError(PATH_UNSAFE, `unsupported readEntry source: ${source}`, { source });
|
|
86464
86962
|
}
|
|
86465
|
-
const absPath =
|
|
86963
|
+
const absPath = join24(root, path3);
|
|
86466
86964
|
let st;
|
|
86467
86965
|
try {
|
|
86468
|
-
st = await
|
|
86966
|
+
st = await lstat16(absPath);
|
|
86469
86967
|
} catch (err) {
|
|
86470
86968
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") {
|
|
86471
86969
|
return Object.freeze({ kind: "absent" });
|
|
@@ -86758,8 +87256,8 @@ var init_graph = __esm({
|
|
|
86758
87256
|
});
|
|
86759
87257
|
|
|
86760
87258
|
// src/artifacts/producer-registry.mjs
|
|
86761
|
-
import { readFile as readFile28, readdir as
|
|
86762
|
-
import { join as
|
|
87259
|
+
import { readFile as readFile28, readdir as readdir15, stat as stat6, mkdir as mkdir15, writeFile as writeFile9, rm as rm9 } from "node:fs/promises";
|
|
87260
|
+
import { join as join25 } from "node:path";
|
|
86763
87261
|
import { mkdtemp as mkdtemp5 } from "node:fs/promises";
|
|
86764
87262
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
86765
87263
|
import { createHash as createHash12 } from "node:crypto";
|
|
@@ -86780,7 +87278,7 @@ function collectStaticImports(filePath, visited = /* @__PURE__ */ new Set()) {
|
|
|
86780
87278
|
const dir = abs.replace(/\/[^/]*$/, "");
|
|
86781
87279
|
while ((match = importRe.exec(source)) !== null) {
|
|
86782
87280
|
const spec = match[1];
|
|
86783
|
-
let resolved =
|
|
87281
|
+
let resolved = join25(dir, spec);
|
|
86784
87282
|
if (!resolved.endsWith(".mjs")) resolved += ".mjs";
|
|
86785
87283
|
results.push(...collectStaticImports(resolved, visited));
|
|
86786
87284
|
}
|
|
@@ -86788,7 +87286,7 @@ function collectStaticImports(filePath, visited = /* @__PURE__ */ new Set()) {
|
|
|
86788
87286
|
}
|
|
86789
87287
|
async function createBuiltInProducerRegistry() {
|
|
86790
87288
|
const producers = /* @__PURE__ */ new Map();
|
|
86791
|
-
const lockfilePath =
|
|
87289
|
+
const lockfilePath = join25(new URL("../../..", import.meta.url).pathname, "pnpm-lock.yaml");
|
|
86792
87290
|
let lockfileBytes;
|
|
86793
87291
|
try {
|
|
86794
87292
|
lockfileBytes = await readFile28(lockfilePath);
|
|
@@ -86825,10 +87323,10 @@ async function createBuiltInProducerRegistry() {
|
|
|
86825
87323
|
}
|
|
86826
87324
|
async function readDirEntries(dirPath, relBase = "") {
|
|
86827
87325
|
const entries = [];
|
|
86828
|
-
const items = await
|
|
87326
|
+
const items = await readdir15(dirPath, { withFileTypes: true });
|
|
86829
87327
|
for (const item of items) {
|
|
86830
87328
|
if (item.name === ".git") continue;
|
|
86831
|
-
const absPath =
|
|
87329
|
+
const absPath = join25(dirPath, item.name);
|
|
86832
87330
|
const relPath = relBase ? `${relBase}/${item.name}` : item.name;
|
|
86833
87331
|
const st = await stat6(absPath);
|
|
86834
87332
|
if (st.isDirectory()) {
|
|
@@ -86851,11 +87349,11 @@ async function readDirEntries(dirPath, relBase = "") {
|
|
|
86851
87349
|
async function materializeEntries(entries, dirPath) {
|
|
86852
87350
|
for (const entry of entries) {
|
|
86853
87351
|
if (!entry.path) continue;
|
|
86854
|
-
const targetPath =
|
|
87352
|
+
const targetPath = join25(dirPath, entry.path);
|
|
86855
87353
|
if (entry.type === "tree" || entry.kind === "tree") {
|
|
86856
87354
|
await mkdir15(targetPath, { recursive: true });
|
|
86857
87355
|
} else {
|
|
86858
|
-
await mkdir15(
|
|
87356
|
+
await mkdir15(join25(targetPath, ".."), { recursive: true });
|
|
86859
87357
|
if (entry.content) {
|
|
86860
87358
|
await writeFile9(targetPath, entry.content);
|
|
86861
87359
|
}
|
|
@@ -86899,7 +87397,7 @@ async function runProducerClosure({
|
|
|
86899
87397
|
graph,
|
|
86900
87398
|
inputSnapshot,
|
|
86901
87399
|
artifactIds,
|
|
86902
|
-
tempRootFactory = /* @__PURE__ */ __name(async () => mkdtemp5(
|
|
87400
|
+
tempRootFactory = /* @__PURE__ */ __name(async () => mkdtemp5(join25(tmpdir5(), "producer-")), "tempRootFactory")
|
|
86903
87401
|
} = {}) {
|
|
86904
87402
|
const generatedSet = new Set(graph.topologicalOrder);
|
|
86905
87403
|
for (const id of artifactIds) {
|
|
@@ -86936,7 +87434,7 @@ async function runProducerClosure({
|
|
|
86936
87434
|
if (inputEntries) {
|
|
86937
87435
|
const first = inputEntries[0];
|
|
86938
87436
|
if (first && first.path) {
|
|
86939
|
-
const absPath = first.path.startsWith("/") ? first.path :
|
|
87437
|
+
const absPath = first.path.startsWith("/") ? first.path : join25(process.cwd(), first.path);
|
|
86940
87438
|
try {
|
|
86941
87439
|
const st = await stat6(absPath);
|
|
86942
87440
|
if (st.isDirectory()) {
|
|
@@ -88049,8 +88547,8 @@ var init_adoption = __esm({
|
|
|
88049
88547
|
// src/artifacts/inspect.mjs
|
|
88050
88548
|
import { promisify as promisify16 } from "node:util";
|
|
88051
88549
|
import { execFile as execFile15 } from "node:child_process";
|
|
88052
|
-
import { readdir as
|
|
88053
|
-
import { join as
|
|
88550
|
+
import { readdir as readdir16, stat as stat7, readFile as readFile30 } from "node:fs/promises";
|
|
88551
|
+
import { join as join26 } from "node:path";
|
|
88054
88552
|
async function hasNestedGitRoots(root) {
|
|
88055
88553
|
try {
|
|
88056
88554
|
const { stdout } = await execFileAsync5(
|
|
@@ -88060,9 +88558,9 @@ async function hasNestedGitRoots(root) {
|
|
|
88060
88558
|
);
|
|
88061
88559
|
const dirs = stdout.split("\n").filter((s) => s.length > 0);
|
|
88062
88560
|
for (const dir of dirs) {
|
|
88063
|
-
const absDir =
|
|
88561
|
+
const absDir = join26(root, dir);
|
|
88064
88562
|
try {
|
|
88065
|
-
const nestedGit =
|
|
88563
|
+
const nestedGit = join26(absDir, ".git");
|
|
88066
88564
|
await stat7(nestedGit);
|
|
88067
88565
|
return true;
|
|
88068
88566
|
} catch {
|
|
@@ -88321,8 +88819,8 @@ var init_inspect = __esm({
|
|
|
88321
88819
|
});
|
|
88322
88820
|
|
|
88323
88821
|
// src/artifacts/resolution.mjs
|
|
88324
|
-
import { mkdir as mkdir17, open as open9, readFile as readFile31, stat as stat8, lstat as
|
|
88325
|
-
import { join as
|
|
88822
|
+
import { mkdir as mkdir17, open as open9, readFile as readFile31, stat as stat8, lstat as lstat17, chmod as chmod4 } from "node:fs/promises";
|
|
88823
|
+
import { join as join27, resolve as resolve27, relative as relative25, isAbsolute as isAbsolute21, basename as basename9 } from "node:path";
|
|
88326
88824
|
function decodeBuffer(value, label) {
|
|
88327
88825
|
if (value == null) return null;
|
|
88328
88826
|
if (Buffer.isBuffer(value)) return value;
|
|
@@ -88424,13 +88922,13 @@ function assertSafeArtifactId(id) {
|
|
|
88424
88922
|
}
|
|
88425
88923
|
async function assertNoSymlinksInPath(root, artifactId) {
|
|
88426
88924
|
const levels = [
|
|
88427
|
-
|
|
88428
|
-
|
|
88429
|
-
|
|
88925
|
+
join27(root, ".release-skill"),
|
|
88926
|
+
join27(root, ".release-skill", "resolution"),
|
|
88927
|
+
join27(root, ".release-skill", "resolution", artifactId)
|
|
88430
88928
|
];
|
|
88431
88929
|
for (const dir of levels) {
|
|
88432
88930
|
try {
|
|
88433
|
-
const st = await
|
|
88931
|
+
const st = await lstat17(dir);
|
|
88434
88932
|
if (st.isSymbolicLink()) {
|
|
88435
88933
|
throw new ReleaseError(PATH_UNSAFE, `directory is a symlink: ${dir}`, { path: dir });
|
|
88436
88934
|
}
|
|
@@ -88442,11 +88940,11 @@ async function assertNoSymlinksInPath(root, artifactId) {
|
|
|
88442
88940
|
}
|
|
88443
88941
|
}
|
|
88444
88942
|
async function assertSafeResolvedPath(root, artifactId, resolvedPath) {
|
|
88445
|
-
const resolutionDir =
|
|
88446
|
-
const resolved =
|
|
88943
|
+
const resolutionDir = resolve27(root, ".release-skill", "resolution", artifactId);
|
|
88944
|
+
const resolved = resolve27(resolvedPath);
|
|
88447
88945
|
await assertNoSymlinksInPath(root, artifactId);
|
|
88448
|
-
const rel =
|
|
88449
|
-
if (rel.startsWith("..") ||
|
|
88946
|
+
const rel = relative25(resolutionDir, resolved);
|
|
88947
|
+
if (rel.startsWith("..") || isAbsolute21(rel)) {
|
|
88450
88948
|
throw new ReleaseError(
|
|
88451
88949
|
PATH_UNSAFE,
|
|
88452
88950
|
`resolvedPath must be inside resolution directory ${resolutionDir}`,
|
|
@@ -88461,7 +88959,7 @@ async function assertSafeResolvedPath(root, artifactId, resolvedPath) {
|
|
|
88461
88959
|
{ resolvedPath, expected: `${artifactId}.resolved`, actual: filename }
|
|
88462
88960
|
);
|
|
88463
88961
|
}
|
|
88464
|
-
if (resolved !==
|
|
88962
|
+
if (resolved !== resolve27(resolutionDir, `${artifactId}.resolved`)) {
|
|
88465
88963
|
throw new ReleaseError(
|
|
88466
88964
|
PATH_UNSAFE,
|
|
88467
88965
|
"resolvedPath must be the exact materialized resolution file",
|
|
@@ -88470,7 +88968,7 @@ async function assertSafeResolvedPath(root, artifactId, resolvedPath) {
|
|
|
88470
88968
|
}
|
|
88471
88969
|
let st;
|
|
88472
88970
|
try {
|
|
88473
|
-
st = await
|
|
88971
|
+
st = await lstat17(resolvedPath);
|
|
88474
88972
|
} catch (err) {
|
|
88475
88973
|
throw new ReleaseError(
|
|
88476
88974
|
MISSING_PARAMETERS,
|
|
@@ -88605,13 +89103,13 @@ async function materializeResolution({
|
|
|
88605
89103
|
const template = buildConflictTemplate(artifact.conflict ?? {}, decodedBuffers);
|
|
88606
89104
|
const templateDigest = sha256Hex(template);
|
|
88607
89105
|
await assertNoSymlinksInPath(root, artifactId);
|
|
88608
|
-
const resolutionDir =
|
|
89106
|
+
const resolutionDir = join27(root, ".release-skill", "resolution", artifactId);
|
|
88609
89107
|
await mkdir17(resolutionDir, { recursive: true, mode: 448 });
|
|
88610
89108
|
const dirStat = await stat8(resolutionDir);
|
|
88611
89109
|
if ((dirStat.mode & 511) !== 448) {
|
|
88612
89110
|
await chmod4(resolutionDir, 448);
|
|
88613
89111
|
}
|
|
88614
|
-
const resolvedPath =
|
|
89112
|
+
const resolvedPath = join27(resolutionDir, `${artifactId}.resolved`);
|
|
88615
89113
|
const fh = await open9(resolvedPath, "wx", 384);
|
|
88616
89114
|
try {
|
|
88617
89115
|
await fh.write(template, 0, template.length);
|
|
@@ -88822,7 +89320,7 @@ __export(artifacts_exports, {
|
|
|
88822
89320
|
runArtifactsCommand: () => runArtifactsCommand
|
|
88823
89321
|
});
|
|
88824
89322
|
import { readFile as readFile32 } from "node:fs/promises";
|
|
88825
|
-
import { join as
|
|
89323
|
+
import { join as join28 } from "node:path";
|
|
88826
89324
|
async function runArtifactsCommand({ subcommand, args: args2, root } = {}) {
|
|
88827
89325
|
if (!VALID_SUBCOMMANDS.has(subcommand)) {
|
|
88828
89326
|
throw new ReleaseError(
|
|
@@ -88965,7 +89463,7 @@ async function handleAdopt({ args: args2, root }) {
|
|
|
88965
89463
|
if (artifact.path) {
|
|
88966
89464
|
const entry = await readEntry({ root, path: artifact.path, source: "worktree" });
|
|
88967
89465
|
if (entry.kind === "regular") {
|
|
88968
|
-
const bytes = await readFile32(
|
|
89466
|
+
const bytes = await readFile32(join28(root, artifact.path));
|
|
88969
89467
|
currentEntries.set(artifact.id, Object.freeze({ ...entry, bytes, content: bytes }));
|
|
88970
89468
|
} else {
|
|
88971
89469
|
currentEntries.set(artifact.id, entry);
|
|
@@ -89042,7 +89540,7 @@ async function handleBootstrap({ args: args2, root }) {
|
|
|
89042
89540
|
if (entry.kind !== "regular") {
|
|
89043
89541
|
throw new ReleaseError("PLAN_STALE", `artifact is no longer a regular file: ${id}`, { id });
|
|
89044
89542
|
}
|
|
89045
|
-
const bytes = await readFile32(
|
|
89543
|
+
const bytes = await readFile32(join28(root, artifactPath));
|
|
89046
89544
|
currentEntries.set(id, Object.freeze({ ...entry, bytes, content: bytes }));
|
|
89047
89545
|
}
|
|
89048
89546
|
let replacementBytes;
|
|
@@ -89453,7 +89951,7 @@ var init_docs = __esm({
|
|
|
89453
89951
|
});
|
|
89454
89952
|
|
|
89455
89953
|
// bin/release-skill-cli.mjs
|
|
89456
|
-
import { basename as basename10, dirname as dirname15, join as
|
|
89954
|
+
import { basename as basename10, dirname as dirname15, join as join29, resolve as resolve28 } from "node:path";
|
|
89457
89955
|
import { execFile as execFileCb13 } from "node:child_process";
|
|
89458
89956
|
import { promisify as promisify17 } from "node:util";
|
|
89459
89957
|
|
|
@@ -89707,7 +90205,7 @@ if (!command && (args.includes("--version") || args.includes("-v"))) {
|
|
|
89707
90205
|
} else {
|
|
89708
90206
|
const { readFileSync: readFileSync5 } = await import("node:fs");
|
|
89709
90207
|
const { fileURLToPath: fileURLToPath3 } = await import("node:url");
|
|
89710
|
-
const pkgPath =
|
|
90208
|
+
const pkgPath = join29(dirname15(fileURLToPath3(import.meta.url)), "..", "package.json");
|
|
89711
90209
|
pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
|
|
89712
90210
|
}
|
|
89713
90211
|
if (hasJson) {
|
|
@@ -89828,7 +90326,7 @@ if (!COMMANDS.has(command)) {
|
|
|
89828
90326
|
if (command === "setup") {
|
|
89829
90327
|
const rootIdx = args.indexOf("--root");
|
|
89830
90328
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
89831
|
-
const root =
|
|
90329
|
+
const root = resolve28(rawRoot);
|
|
89832
90330
|
const answersIdx = args.indexOf("--answers");
|
|
89833
90331
|
const answersPath = answersIdx !== -1 && args[answersIdx + 1] ? args[answersIdx + 1] : void 0;
|
|
89834
90332
|
const confirmationIdx = args.indexOf("--confirm-setup");
|
|
@@ -89863,7 +90361,7 @@ if (command === "setup") {
|
|
|
89863
90361
|
if (command === "assess") {
|
|
89864
90362
|
const rootIdx = args.indexOf("--root");
|
|
89865
90363
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
89866
|
-
const root =
|
|
90364
|
+
const root = resolve28(rawRoot);
|
|
89867
90365
|
const offline = args.includes("--offline") || !args.includes("--online");
|
|
89868
90366
|
const outputIdx = args.indexOf("--output");
|
|
89869
90367
|
const output = outputIdx !== -1 && args[outputIdx + 1] ? args[outputIdx + 1] : void 0;
|
|
@@ -89894,7 +90392,7 @@ if (command === "assess") {
|
|
|
89894
90392
|
if (command === "prepare") {
|
|
89895
90393
|
const rootIdx = args.indexOf("--root");
|
|
89896
90394
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
89897
|
-
const root =
|
|
90395
|
+
const root = resolve28(rawRoot);
|
|
89898
90396
|
const offline = args.includes("--offline") || !args.includes("--online");
|
|
89899
90397
|
let targetVersion;
|
|
89900
90398
|
for (const flag of ["--target-version", "--version"]) {
|
|
@@ -89909,9 +90407,9 @@ if (command === "prepare") {
|
|
|
89909
90407
|
const hookCache = !args.includes("--no-hook-cache");
|
|
89910
90408
|
const production = args.includes("--production");
|
|
89911
90409
|
const outputIdx = args.indexOf("--output");
|
|
89912
|
-
const output = outputIdx !== -1 && args[outputIdx + 1] ?
|
|
90410
|
+
const output = outputIdx !== -1 && args[outputIdx + 1] ? resolve28(args[outputIdx + 1]) : void 0;
|
|
89913
90411
|
const runDirIdx = args.indexOf("--run-dir");
|
|
89914
|
-
const runDir = runDirIdx !== -1 && args[runDirIdx + 1] ?
|
|
90412
|
+
const runDir = runDirIdx !== -1 && args[runDirIdx + 1] ? resolve28(args[runDirIdx + 1]) : void 0;
|
|
89915
90413
|
try {
|
|
89916
90414
|
const { prepareRelease: prepareRelease2 } = await init_prepare().then(() => prepare_exports);
|
|
89917
90415
|
const { readFile: readFileFs } = await import("node:fs/promises");
|
|
@@ -89964,7 +90462,7 @@ if (command === "approve") {
|
|
|
89964
90462
|
const actorIdx = args.indexOf("--actor");
|
|
89965
90463
|
const actor = actorIdx !== -1 && args[actorIdx + 1] ? args[actorIdx + 1] : void 0;
|
|
89966
90464
|
const outputIdx = args.indexOf("--output");
|
|
89967
|
-
const outputPath = outputIdx !== -1 && args[outputIdx + 1] ?
|
|
90465
|
+
const outputPath = outputIdx !== -1 && args[outputIdx + 1] ? resolve28(args[outputIdx + 1]) : void 0;
|
|
89968
90466
|
if (!planPath || !expectedDigest || !actor) {
|
|
89969
90467
|
const msg = "approve requires --plan <path>, --digest <sha256>, and --actor <name>";
|
|
89970
90468
|
if (hasJson) {
|
|
@@ -89976,10 +90474,10 @@ if (command === "approve") {
|
|
|
89976
90474
|
}
|
|
89977
90475
|
try {
|
|
89978
90476
|
const { approvePlan: approvePlan2 } = await init_approve().then(() => approve_exports);
|
|
89979
|
-
const resolvedPlanPath =
|
|
90477
|
+
const resolvedPlanPath = resolve28(planPath);
|
|
89980
90478
|
const planDir = dirname15(resolvedPlanPath);
|
|
89981
90479
|
const releaseDir = basename10(planDir) === "plans" && basename10(resolvedPlanPath) === `${expectedDigest}.json` ? dirname15(planDir) : planDir;
|
|
89982
|
-
const approvalPath = outputPath ??
|
|
90480
|
+
const approvalPath = outputPath ?? join29(releaseDir, "approval-record.json");
|
|
89983
90481
|
const record = await approvePlan2({ planPath, expectedDigest, actor, outputPath: approvalPath });
|
|
89984
90482
|
if (hasJson) {
|
|
89985
90483
|
console.log(JSON.stringify(record, null, 2));
|
|
@@ -90006,13 +90504,13 @@ if (command === "approve") {
|
|
|
90006
90504
|
if (command === "reconcile") {
|
|
90007
90505
|
const rootIdx = args.indexOf("--root");
|
|
90008
90506
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
90009
|
-
const root =
|
|
90507
|
+
const root = resolve28(rawRoot);
|
|
90010
90508
|
const planIdx = args.indexOf("--plan");
|
|
90011
|
-
const planPath = planIdx !== -1 && args[planIdx + 1] ?
|
|
90509
|
+
const planPath = planIdx !== -1 && args[planIdx + 1] ? resolve28(args[planIdx + 1]) : void 0;
|
|
90012
90510
|
const runIdx = args.indexOf("--run");
|
|
90013
|
-
const runPath = runIdx !== -1 && args[runIdx + 1] ?
|
|
90511
|
+
const runPath = runIdx !== -1 && args[runIdx + 1] ? resolve28(args[runIdx + 1]) : void 0;
|
|
90014
90512
|
const approvalIdx = args.indexOf("--approval");
|
|
90015
|
-
const approvalPath = approvalIdx !== -1 && args[approvalIdx + 1] ?
|
|
90513
|
+
const approvalPath = approvalIdx !== -1 && args[approvalIdx + 1] ? resolve28(args[approvalIdx + 1]) : void 0;
|
|
90016
90514
|
const confirmationIdx = args.indexOf("--confirm-production");
|
|
90017
90515
|
const productionConfirmation = confirmationIdx !== -1 && args[confirmationIdx + 1] ? args[confirmationIdx + 1] : void 0;
|
|
90018
90516
|
if (!planPath || !runPath) {
|
|
@@ -90071,11 +90569,11 @@ if (command === "reconcile") {
|
|
|
90071
90569
|
if (command === "verify") {
|
|
90072
90570
|
const rootIdx = args.indexOf("--root");
|
|
90073
90571
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
90074
|
-
const root =
|
|
90572
|
+
const root = resolve28(rawRoot);
|
|
90075
90573
|
const planIdx = args.indexOf("--plan");
|
|
90076
|
-
const planPath = planIdx !== -1 && args[planIdx + 1] ?
|
|
90574
|
+
const planPath = planIdx !== -1 && args[planIdx + 1] ? resolve28(args[planIdx + 1]) : void 0;
|
|
90077
90575
|
const runIdx = args.indexOf("--run");
|
|
90078
|
-
const runPath = runIdx !== -1 && args[runIdx + 1] ?
|
|
90576
|
+
const runPath = runIdx !== -1 && args[runIdx + 1] ? resolve28(args[runIdx + 1]) : void 0;
|
|
90079
90577
|
const verificationGatesAuthorized = args.includes("--acknowledge-gate-side-effects");
|
|
90080
90578
|
if (!planPath || !runPath) {
|
|
90081
90579
|
const msg = "verify requires --plan <path> and --run <path>";
|
|
@@ -90131,11 +90629,11 @@ if (command === "verify") {
|
|
|
90131
90629
|
if (command === "publish") {
|
|
90132
90630
|
const rootIdx = args.indexOf("--root");
|
|
90133
90631
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
90134
|
-
const root =
|
|
90632
|
+
const root = resolve28(rawRoot);
|
|
90135
90633
|
const planIdx = args.indexOf("--plan");
|
|
90136
|
-
const planPath = planIdx !== -1 && args[planIdx + 1] ?
|
|
90634
|
+
const planPath = planIdx !== -1 && args[planIdx + 1] ? resolve28(args[planIdx + 1]) : void 0;
|
|
90137
90635
|
const approvalIdx = args.indexOf("--approval");
|
|
90138
|
-
const approvalPath = approvalIdx !== -1 && args[approvalIdx + 1] ?
|
|
90636
|
+
const approvalPath = approvalIdx !== -1 && args[approvalIdx + 1] ? resolve28(args[approvalIdx + 1]) : void 0;
|
|
90139
90637
|
const confirmationIdx = args.indexOf("--confirm-production");
|
|
90140
90638
|
const productionConfirmation = confirmationIdx !== -1 && args[confirmationIdx + 1] ? args[confirmationIdx + 1] : void 0;
|
|
90141
90639
|
if (!planPath || !approvalPath || !productionConfirmation) {
|
|
@@ -90194,9 +90692,9 @@ if (command === "publish") {
|
|
|
90194
90692
|
if (command === "artifacts") {
|
|
90195
90693
|
const rootIdx = args.indexOf("--root");
|
|
90196
90694
|
const rawRoot = rootIdx !== -1 && args[rootIdx + 1] ? args[rootIdx + 1] : process.cwd();
|
|
90197
|
-
const root =
|
|
90695
|
+
const root = resolve28(rawRoot);
|
|
90198
90696
|
const outputIdx = args.indexOf("--output");
|
|
90199
|
-
const output = outputIdx !== -1 && args[outputIdx + 1] ?
|
|
90697
|
+
const output = outputIdx !== -1 && args[outputIdx + 1] ? resolve28(args[outputIdx + 1]) : void 0;
|
|
90200
90698
|
const subcommand = positional[1] ?? "status";
|
|
90201
90699
|
try {
|
|
90202
90700
|
const { runArtifactsCommand: runArtifactsCommand2 } = await Promise.resolve().then(() => (init_artifacts(), artifacts_exports));
|
|
@@ -90263,7 +90761,7 @@ if (command === "docs") {
|
|
|
90263
90761
|
);
|
|
90264
90762
|
}
|
|
90265
90763
|
}
|
|
90266
|
-
const root =
|
|
90764
|
+
const root = resolve28(rawRoot);
|
|
90267
90765
|
const valuedDocsFlags = /* @__PURE__ */ new Set(["--root", "--unit", "--confirm-refresh"]);
|
|
90268
90766
|
const booleanDocsFlags = /* @__PURE__ */ new Set(["--json", "--write", "--ack-local-document-write"]);
|
|
90269
90767
|
let docsSubcommand;
|