@alessandroraffa/tangyr 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -17
- package/dist/index.js +666 -597
- package/mappings/loss-severity.yaml +5 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1372,7 +1372,7 @@ var require_command = __commonJS({
|
|
|
1372
1372
|
"use strict";
|
|
1373
1373
|
var EventEmitter = __require("events").EventEmitter;
|
|
1374
1374
|
var childProcess = __require("child_process");
|
|
1375
|
-
var
|
|
1375
|
+
var path55 = __require("path");
|
|
1376
1376
|
var fs53 = __require("fs");
|
|
1377
1377
|
var process5 = __require("process");
|
|
1378
1378
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -2385,9 +2385,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2385
2385
|
let launchWithNode = false;
|
|
2386
2386
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2387
2387
|
function findFile(baseDir, baseName) {
|
|
2388
|
-
const localBin =
|
|
2388
|
+
const localBin = path55.resolve(baseDir, baseName);
|
|
2389
2389
|
if (fs53.existsSync(localBin)) return localBin;
|
|
2390
|
-
if (sourceExt.includes(
|
|
2390
|
+
if (sourceExt.includes(path55.extname(baseName))) return void 0;
|
|
2391
2391
|
const foundExt = sourceExt.find(
|
|
2392
2392
|
(ext) => fs53.existsSync(`${localBin}${ext}`)
|
|
2393
2393
|
);
|
|
@@ -2405,17 +2405,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2405
2405
|
} catch {
|
|
2406
2406
|
resolvedScriptPath = this._scriptPath;
|
|
2407
2407
|
}
|
|
2408
|
-
executableDir =
|
|
2409
|
-
|
|
2408
|
+
executableDir = path55.resolve(
|
|
2409
|
+
path55.dirname(resolvedScriptPath),
|
|
2410
2410
|
executableDir
|
|
2411
2411
|
);
|
|
2412
2412
|
}
|
|
2413
2413
|
if (executableDir) {
|
|
2414
2414
|
let localFile = findFile(executableDir, executableFile);
|
|
2415
2415
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2416
|
-
const legacyName =
|
|
2416
|
+
const legacyName = path55.basename(
|
|
2417
2417
|
this._scriptPath,
|
|
2418
|
-
|
|
2418
|
+
path55.extname(this._scriptPath)
|
|
2419
2419
|
);
|
|
2420
2420
|
if (legacyName !== this._name) {
|
|
2421
2421
|
localFile = findFile(
|
|
@@ -2426,7 +2426,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2426
2426
|
}
|
|
2427
2427
|
executableFile = localFile || executableFile;
|
|
2428
2428
|
}
|
|
2429
|
-
launchWithNode = sourceExt.includes(
|
|
2429
|
+
launchWithNode = sourceExt.includes(path55.extname(executableFile));
|
|
2430
2430
|
let proc;
|
|
2431
2431
|
if (process5.platform !== "win32") {
|
|
2432
2432
|
if (launchWithNode) {
|
|
@@ -3341,7 +3341,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3341
3341
|
* @return {Command}
|
|
3342
3342
|
*/
|
|
3343
3343
|
nameFromFilename(filename) {
|
|
3344
|
-
this._name =
|
|
3344
|
+
this._name = path55.basename(filename, path55.extname(filename));
|
|
3345
3345
|
return this;
|
|
3346
3346
|
}
|
|
3347
3347
|
/**
|
|
@@ -3355,9 +3355,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3355
3355
|
* @param {string} [path]
|
|
3356
3356
|
* @return {(string|null|Command)}
|
|
3357
3357
|
*/
|
|
3358
|
-
executableDir(
|
|
3359
|
-
if (
|
|
3360
|
-
this._executableDir =
|
|
3358
|
+
executableDir(path56) {
|
|
3359
|
+
if (path56 === void 0) return this._executableDir;
|
|
3360
|
+
this._executableDir = path56;
|
|
3361
3361
|
return this;
|
|
3362
3362
|
}
|
|
3363
3363
|
/**
|
|
@@ -3713,17 +3713,17 @@ var require_visit = __commonJS({
|
|
|
3713
3713
|
visit.BREAK = BREAK;
|
|
3714
3714
|
visit.SKIP = SKIP;
|
|
3715
3715
|
visit.REMOVE = REMOVE;
|
|
3716
|
-
function visit_(key, node, visitor,
|
|
3717
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
3716
|
+
function visit_(key, node, visitor, path55) {
|
|
3717
|
+
const ctrl = callVisitor(key, node, visitor, path55);
|
|
3718
3718
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3719
|
-
replaceNode(key,
|
|
3720
|
-
return visit_(key, ctrl, visitor,
|
|
3719
|
+
replaceNode(key, path55, ctrl);
|
|
3720
|
+
return visit_(key, ctrl, visitor, path55);
|
|
3721
3721
|
}
|
|
3722
3722
|
if (typeof ctrl !== "symbol") {
|
|
3723
3723
|
if (identity.isCollection(node)) {
|
|
3724
|
-
|
|
3724
|
+
path55 = Object.freeze(path55.concat(node));
|
|
3725
3725
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3726
|
-
const ci2 = visit_(i, node.items[i], visitor,
|
|
3726
|
+
const ci2 = visit_(i, node.items[i], visitor, path55);
|
|
3727
3727
|
if (typeof ci2 === "number")
|
|
3728
3728
|
i = ci2 - 1;
|
|
3729
3729
|
else if (ci2 === BREAK)
|
|
@@ -3734,13 +3734,13 @@ var require_visit = __commonJS({
|
|
|
3734
3734
|
}
|
|
3735
3735
|
}
|
|
3736
3736
|
} else if (identity.isPair(node)) {
|
|
3737
|
-
|
|
3738
|
-
const ck = visit_("key", node.key, visitor,
|
|
3737
|
+
path55 = Object.freeze(path55.concat(node));
|
|
3738
|
+
const ck = visit_("key", node.key, visitor, path55);
|
|
3739
3739
|
if (ck === BREAK)
|
|
3740
3740
|
return BREAK;
|
|
3741
3741
|
else if (ck === REMOVE)
|
|
3742
3742
|
node.key = null;
|
|
3743
|
-
const cv = visit_("value", node.value, visitor,
|
|
3743
|
+
const cv = visit_("value", node.value, visitor, path55);
|
|
3744
3744
|
if (cv === BREAK)
|
|
3745
3745
|
return BREAK;
|
|
3746
3746
|
else if (cv === REMOVE)
|
|
@@ -3761,17 +3761,17 @@ var require_visit = __commonJS({
|
|
|
3761
3761
|
visitAsync.BREAK = BREAK;
|
|
3762
3762
|
visitAsync.SKIP = SKIP;
|
|
3763
3763
|
visitAsync.REMOVE = REMOVE;
|
|
3764
|
-
async function visitAsync_(key, node, visitor,
|
|
3765
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3764
|
+
async function visitAsync_(key, node, visitor, path55) {
|
|
3765
|
+
const ctrl = await callVisitor(key, node, visitor, path55);
|
|
3766
3766
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3767
|
-
replaceNode(key,
|
|
3768
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3767
|
+
replaceNode(key, path55, ctrl);
|
|
3768
|
+
return visitAsync_(key, ctrl, visitor, path55);
|
|
3769
3769
|
}
|
|
3770
3770
|
if (typeof ctrl !== "symbol") {
|
|
3771
3771
|
if (identity.isCollection(node)) {
|
|
3772
|
-
|
|
3772
|
+
path55 = Object.freeze(path55.concat(node));
|
|
3773
3773
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3774
|
-
const ci2 = await visitAsync_(i, node.items[i], visitor,
|
|
3774
|
+
const ci2 = await visitAsync_(i, node.items[i], visitor, path55);
|
|
3775
3775
|
if (typeof ci2 === "number")
|
|
3776
3776
|
i = ci2 - 1;
|
|
3777
3777
|
else if (ci2 === BREAK)
|
|
@@ -3782,13 +3782,13 @@ var require_visit = __commonJS({
|
|
|
3782
3782
|
}
|
|
3783
3783
|
}
|
|
3784
3784
|
} else if (identity.isPair(node)) {
|
|
3785
|
-
|
|
3786
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3785
|
+
path55 = Object.freeze(path55.concat(node));
|
|
3786
|
+
const ck = await visitAsync_("key", node.key, visitor, path55);
|
|
3787
3787
|
if (ck === BREAK)
|
|
3788
3788
|
return BREAK;
|
|
3789
3789
|
else if (ck === REMOVE)
|
|
3790
3790
|
node.key = null;
|
|
3791
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3791
|
+
const cv = await visitAsync_("value", node.value, visitor, path55);
|
|
3792
3792
|
if (cv === BREAK)
|
|
3793
3793
|
return BREAK;
|
|
3794
3794
|
else if (cv === REMOVE)
|
|
@@ -3815,23 +3815,23 @@ var require_visit = __commonJS({
|
|
|
3815
3815
|
}
|
|
3816
3816
|
return visitor;
|
|
3817
3817
|
}
|
|
3818
|
-
function callVisitor(key, node, visitor,
|
|
3818
|
+
function callVisitor(key, node, visitor, path55) {
|
|
3819
3819
|
if (typeof visitor === "function")
|
|
3820
|
-
return visitor(key, node,
|
|
3820
|
+
return visitor(key, node, path55);
|
|
3821
3821
|
if (identity.isMap(node))
|
|
3822
|
-
return visitor.Map?.(key, node,
|
|
3822
|
+
return visitor.Map?.(key, node, path55);
|
|
3823
3823
|
if (identity.isSeq(node))
|
|
3824
|
-
return visitor.Seq?.(key, node,
|
|
3824
|
+
return visitor.Seq?.(key, node, path55);
|
|
3825
3825
|
if (identity.isPair(node))
|
|
3826
|
-
return visitor.Pair?.(key, node,
|
|
3826
|
+
return visitor.Pair?.(key, node, path55);
|
|
3827
3827
|
if (identity.isScalar(node))
|
|
3828
|
-
return visitor.Scalar?.(key, node,
|
|
3828
|
+
return visitor.Scalar?.(key, node, path55);
|
|
3829
3829
|
if (identity.isAlias(node))
|
|
3830
|
-
return visitor.Alias?.(key, node,
|
|
3830
|
+
return visitor.Alias?.(key, node, path55);
|
|
3831
3831
|
return void 0;
|
|
3832
3832
|
}
|
|
3833
|
-
function replaceNode(key,
|
|
3834
|
-
const parent =
|
|
3833
|
+
function replaceNode(key, path55, node) {
|
|
3834
|
+
const parent = path55[path55.length - 1];
|
|
3835
3835
|
if (identity.isCollection(parent)) {
|
|
3836
3836
|
parent.items[key] = node;
|
|
3837
3837
|
} else if (identity.isPair(parent)) {
|
|
@@ -4439,10 +4439,10 @@ var require_Collection = __commonJS({
|
|
|
4439
4439
|
var createNode = require_createNode();
|
|
4440
4440
|
var identity = require_identity();
|
|
4441
4441
|
var Node = require_Node();
|
|
4442
|
-
function collectionFromPath(schema,
|
|
4442
|
+
function collectionFromPath(schema, path55, value) {
|
|
4443
4443
|
let v2 = value;
|
|
4444
|
-
for (let i =
|
|
4445
|
-
const k2 =
|
|
4444
|
+
for (let i = path55.length - 1; i >= 0; --i) {
|
|
4445
|
+
const k2 = path55[i];
|
|
4446
4446
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
4447
4447
|
const a = [];
|
|
4448
4448
|
a[k2] = v2;
|
|
@@ -4461,7 +4461,7 @@ var require_Collection = __commonJS({
|
|
|
4461
4461
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
4462
4462
|
});
|
|
4463
4463
|
}
|
|
4464
|
-
var isEmptyPath = (
|
|
4464
|
+
var isEmptyPath = (path55) => path55 == null || typeof path55 === "object" && !!path55[Symbol.iterator]().next().done;
|
|
4465
4465
|
var Collection = class extends Node.NodeBase {
|
|
4466
4466
|
constructor(type, schema) {
|
|
4467
4467
|
super(type);
|
|
@@ -4491,11 +4491,11 @@ var require_Collection = __commonJS({
|
|
|
4491
4491
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
4492
4492
|
* that already exists in the map.
|
|
4493
4493
|
*/
|
|
4494
|
-
addIn(
|
|
4495
|
-
if (isEmptyPath(
|
|
4494
|
+
addIn(path55, value) {
|
|
4495
|
+
if (isEmptyPath(path55))
|
|
4496
4496
|
this.add(value);
|
|
4497
4497
|
else {
|
|
4498
|
-
const [key, ...rest] =
|
|
4498
|
+
const [key, ...rest] = path55;
|
|
4499
4499
|
const node = this.get(key, true);
|
|
4500
4500
|
if (identity.isCollection(node))
|
|
4501
4501
|
node.addIn(rest, value);
|
|
@@ -4509,8 +4509,8 @@ var require_Collection = __commonJS({
|
|
|
4509
4509
|
* Removes a value from the collection.
|
|
4510
4510
|
* @returns `true` if the item was found and removed.
|
|
4511
4511
|
*/
|
|
4512
|
-
deleteIn(
|
|
4513
|
-
const [key, ...rest] =
|
|
4512
|
+
deleteIn(path55) {
|
|
4513
|
+
const [key, ...rest] = path55;
|
|
4514
4514
|
if (rest.length === 0)
|
|
4515
4515
|
return this.delete(key);
|
|
4516
4516
|
const node = this.get(key, true);
|
|
@@ -4524,8 +4524,8 @@ var require_Collection = __commonJS({
|
|
|
4524
4524
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
4525
4525
|
* `true` (collections are always returned intact).
|
|
4526
4526
|
*/
|
|
4527
|
-
getIn(
|
|
4528
|
-
const [key, ...rest] =
|
|
4527
|
+
getIn(path55, keepScalar) {
|
|
4528
|
+
const [key, ...rest] = path55;
|
|
4529
4529
|
const node = this.get(key, true);
|
|
4530
4530
|
if (rest.length === 0)
|
|
4531
4531
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -4543,8 +4543,8 @@ var require_Collection = __commonJS({
|
|
|
4543
4543
|
/**
|
|
4544
4544
|
* Checks if the collection includes a value with the key `key`.
|
|
4545
4545
|
*/
|
|
4546
|
-
hasIn(
|
|
4547
|
-
const [key, ...rest] =
|
|
4546
|
+
hasIn(path55) {
|
|
4547
|
+
const [key, ...rest] = path55;
|
|
4548
4548
|
if (rest.length === 0)
|
|
4549
4549
|
return this.has(key);
|
|
4550
4550
|
const node = this.get(key, true);
|
|
@@ -4554,8 +4554,8 @@ var require_Collection = __commonJS({
|
|
|
4554
4554
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
4555
4555
|
* boolean to add/remove the item from the set.
|
|
4556
4556
|
*/
|
|
4557
|
-
setIn(
|
|
4558
|
-
const [key, ...rest] =
|
|
4557
|
+
setIn(path55, value) {
|
|
4558
|
+
const [key, ...rest] = path55;
|
|
4559
4559
|
if (rest.length === 0) {
|
|
4560
4560
|
this.set(key, value);
|
|
4561
4561
|
} else {
|
|
@@ -7067,9 +7067,9 @@ var require_Document = __commonJS({
|
|
|
7067
7067
|
this.contents.add(value);
|
|
7068
7068
|
}
|
|
7069
7069
|
/** Adds a value to the document. */
|
|
7070
|
-
addIn(
|
|
7070
|
+
addIn(path55, value) {
|
|
7071
7071
|
if (assertCollection(this.contents))
|
|
7072
|
-
this.contents.addIn(
|
|
7072
|
+
this.contents.addIn(path55, value);
|
|
7073
7073
|
}
|
|
7074
7074
|
/**
|
|
7075
7075
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -7144,14 +7144,14 @@ var require_Document = __commonJS({
|
|
|
7144
7144
|
* Removes a value from the document.
|
|
7145
7145
|
* @returns `true` if the item was found and removed.
|
|
7146
7146
|
*/
|
|
7147
|
-
deleteIn(
|
|
7148
|
-
if (Collection.isEmptyPath(
|
|
7147
|
+
deleteIn(path55) {
|
|
7148
|
+
if (Collection.isEmptyPath(path55)) {
|
|
7149
7149
|
if (this.contents == null)
|
|
7150
7150
|
return false;
|
|
7151
7151
|
this.contents = null;
|
|
7152
7152
|
return true;
|
|
7153
7153
|
}
|
|
7154
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
7154
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path55) : false;
|
|
7155
7155
|
}
|
|
7156
7156
|
/**
|
|
7157
7157
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -7166,10 +7166,10 @@ var require_Document = __commonJS({
|
|
|
7166
7166
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7167
7167
|
* `true` (collections are always returned intact).
|
|
7168
7168
|
*/
|
|
7169
|
-
getIn(
|
|
7170
|
-
if (Collection.isEmptyPath(
|
|
7169
|
+
getIn(path55, keepScalar) {
|
|
7170
|
+
if (Collection.isEmptyPath(path55))
|
|
7171
7171
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
7172
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
7172
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path55, keepScalar) : void 0;
|
|
7173
7173
|
}
|
|
7174
7174
|
/**
|
|
7175
7175
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -7180,10 +7180,10 @@ var require_Document = __commonJS({
|
|
|
7180
7180
|
/**
|
|
7181
7181
|
* Checks if the document includes a value at `path`.
|
|
7182
7182
|
*/
|
|
7183
|
-
hasIn(
|
|
7184
|
-
if (Collection.isEmptyPath(
|
|
7183
|
+
hasIn(path55) {
|
|
7184
|
+
if (Collection.isEmptyPath(path55))
|
|
7185
7185
|
return this.contents !== void 0;
|
|
7186
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
7186
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path55) : false;
|
|
7187
7187
|
}
|
|
7188
7188
|
/**
|
|
7189
7189
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -7200,13 +7200,13 @@ var require_Document = __commonJS({
|
|
|
7200
7200
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
7201
7201
|
* boolean to add/remove the item from the set.
|
|
7202
7202
|
*/
|
|
7203
|
-
setIn(
|
|
7204
|
-
if (Collection.isEmptyPath(
|
|
7203
|
+
setIn(path55, value) {
|
|
7204
|
+
if (Collection.isEmptyPath(path55)) {
|
|
7205
7205
|
this.contents = value;
|
|
7206
7206
|
} else if (this.contents == null) {
|
|
7207
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
7207
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path55), value);
|
|
7208
7208
|
} else if (assertCollection(this.contents)) {
|
|
7209
|
-
this.contents.setIn(
|
|
7209
|
+
this.contents.setIn(path55, value);
|
|
7210
7210
|
}
|
|
7211
7211
|
}
|
|
7212
7212
|
/**
|
|
@@ -9163,9 +9163,9 @@ var require_cst_visit = __commonJS({
|
|
|
9163
9163
|
visit.BREAK = BREAK;
|
|
9164
9164
|
visit.SKIP = SKIP;
|
|
9165
9165
|
visit.REMOVE = REMOVE;
|
|
9166
|
-
visit.itemAtPath = (cst,
|
|
9166
|
+
visit.itemAtPath = (cst, path55) => {
|
|
9167
9167
|
let item = cst;
|
|
9168
|
-
for (const [field, index] of
|
|
9168
|
+
for (const [field, index] of path55) {
|
|
9169
9169
|
const tok = item?.[field];
|
|
9170
9170
|
if (tok && "items" in tok) {
|
|
9171
9171
|
item = tok.items[index];
|
|
@@ -9174,23 +9174,23 @@ var require_cst_visit = __commonJS({
|
|
|
9174
9174
|
}
|
|
9175
9175
|
return item;
|
|
9176
9176
|
};
|
|
9177
|
-
visit.parentCollection = (cst,
|
|
9178
|
-
const parent = visit.itemAtPath(cst,
|
|
9179
|
-
const field =
|
|
9177
|
+
visit.parentCollection = (cst, path55) => {
|
|
9178
|
+
const parent = visit.itemAtPath(cst, path55.slice(0, -1));
|
|
9179
|
+
const field = path55[path55.length - 1][0];
|
|
9180
9180
|
const coll = parent?.[field];
|
|
9181
9181
|
if (coll && "items" in coll)
|
|
9182
9182
|
return coll;
|
|
9183
9183
|
throw new Error("Parent collection not found");
|
|
9184
9184
|
};
|
|
9185
|
-
function _visit(
|
|
9186
|
-
let ctrl = visitor(item,
|
|
9185
|
+
function _visit(path55, item, visitor) {
|
|
9186
|
+
let ctrl = visitor(item, path55);
|
|
9187
9187
|
if (typeof ctrl === "symbol")
|
|
9188
9188
|
return ctrl;
|
|
9189
9189
|
for (const field of ["key", "value"]) {
|
|
9190
9190
|
const token = item[field];
|
|
9191
9191
|
if (token && "items" in token) {
|
|
9192
9192
|
for (let i = 0; i < token.items.length; ++i) {
|
|
9193
|
-
const ci2 = _visit(Object.freeze(
|
|
9193
|
+
const ci2 = _visit(Object.freeze(path55.concat([[field, i]])), token.items[i], visitor);
|
|
9194
9194
|
if (typeof ci2 === "number")
|
|
9195
9195
|
i = ci2 - 1;
|
|
9196
9196
|
else if (ci2 === BREAK)
|
|
@@ -9201,10 +9201,10 @@ var require_cst_visit = __commonJS({
|
|
|
9201
9201
|
}
|
|
9202
9202
|
}
|
|
9203
9203
|
if (typeof ctrl === "function" && field === "key")
|
|
9204
|
-
ctrl = ctrl(item,
|
|
9204
|
+
ctrl = ctrl(item, path55);
|
|
9205
9205
|
}
|
|
9206
9206
|
}
|
|
9207
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9207
|
+
return typeof ctrl === "function" ? ctrl(item, path55) : ctrl;
|
|
9208
9208
|
}
|
|
9209
9209
|
exports2.visit = visit;
|
|
9210
9210
|
}
|
|
@@ -18382,7 +18382,7 @@ async function runCacheClearCommand(options, logger) {
|
|
|
18382
18382
|
|
|
18383
18383
|
// src/commands/cleanup.ts
|
|
18384
18384
|
import fs29 from "fs";
|
|
18385
|
-
import
|
|
18385
|
+
import path27 from "path";
|
|
18386
18386
|
|
|
18387
18387
|
// node_modules/glob/dist/esm/index.min.js
|
|
18388
18388
|
import { fileURLToPath as Wi } from "url";
|
|
@@ -21542,7 +21542,7 @@ function removeManagedEntries(filePath, parser, serializer, removeManaged, logge
|
|
|
21542
21542
|
|
|
21543
21543
|
// src/commands/uninstall.ts
|
|
21544
21544
|
import fs28 from "fs";
|
|
21545
|
-
import
|
|
21545
|
+
import path26 from "path";
|
|
21546
21546
|
|
|
21547
21547
|
// src/core/managed-sources.ts
|
|
21548
21548
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
@@ -21628,10 +21628,11 @@ function normalizeManagedSourcePath(rawPath) {
|
|
|
21628
21628
|
|
|
21629
21629
|
// src/compiler/hook-components.ts
|
|
21630
21630
|
import fs22 from "fs";
|
|
21631
|
-
import
|
|
21631
|
+
import path21 from "path";
|
|
21632
21632
|
|
|
21633
21633
|
// src/compiler/loss-report.ts
|
|
21634
21634
|
import fs21 from "fs";
|
|
21635
|
+
import path20 from "path";
|
|
21635
21636
|
function createLossReport() {
|
|
21636
21637
|
return {
|
|
21637
21638
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -21710,12 +21711,24 @@ function resolveLossSeverity(kind, name, action, explicitSeverity) {
|
|
|
21710
21711
|
}
|
|
21711
21712
|
return lossSeverityByEntryType[action];
|
|
21712
21713
|
}
|
|
21713
|
-
|
|
21714
|
-
|
|
21715
|
-
|
|
21714
|
+
var DEFAULT_LOSS_REPORT_FILE = "loss.json";
|
|
21715
|
+
function writeLossReport(filePath, report, scopePath) {
|
|
21716
|
+
const destinations = /* @__PURE__ */ new Set();
|
|
21717
|
+
if (filePath) {
|
|
21718
|
+
destinations.add(filePath);
|
|
21719
|
+
}
|
|
21720
|
+
if (scopePath) {
|
|
21721
|
+
destinations.add(path20.join(scopePath, DEFAULT_LOSS_REPORT_FILE));
|
|
21722
|
+
}
|
|
21723
|
+
const serialized = `${JSON.stringify(report, null, 2)}
|
|
21724
|
+
`;
|
|
21725
|
+
for (const destination of destinations) {
|
|
21726
|
+
try {
|
|
21727
|
+
fs21.mkdirSync(path20.dirname(destination), { recursive: true });
|
|
21728
|
+
fs21.writeFileSync(destination, serialized);
|
|
21729
|
+
} catch {
|
|
21730
|
+
}
|
|
21716
21731
|
}
|
|
21717
|
-
fs21.writeFileSync(filePath, `${JSON.stringify(report, null, 2)}
|
|
21718
|
-
`);
|
|
21719
21732
|
}
|
|
21720
21733
|
|
|
21721
21734
|
// src/compiler/hook-components.ts
|
|
@@ -21850,7 +21863,7 @@ function synthesizeHooksJson(declarations, scriptsDir) {
|
|
|
21850
21863
|
return { hooks };
|
|
21851
21864
|
}
|
|
21852
21865
|
function loadSourceHooks(hooksDir, hookNames, scriptsDir) {
|
|
21853
|
-
const hooksJsonPath =
|
|
21866
|
+
const hooksJsonPath = path21.join(hooksDir, "hooks.json");
|
|
21854
21867
|
if (fs22.existsSync(hooksJsonPath)) {
|
|
21855
21868
|
const raw = fs22.readFileSync(hooksJsonPath, "utf8");
|
|
21856
21869
|
return JSON.parse(raw);
|
|
@@ -21870,7 +21883,7 @@ function loadHookDeclarations(hooksDir, hookNames) {
|
|
|
21870
21883
|
}
|
|
21871
21884
|
const declarations = [];
|
|
21872
21885
|
for (const name of names) {
|
|
21873
|
-
const filePath =
|
|
21886
|
+
const filePath = path21.join(hooksDir, `${name}.md`);
|
|
21874
21887
|
const result = parseHookDeclaration(filePath);
|
|
21875
21888
|
if (result.ok) {
|
|
21876
21889
|
declarations.push(result.declaration);
|
|
@@ -21879,7 +21892,7 @@ function loadHookDeclarations(hooksDir, hookNames) {
|
|
|
21879
21892
|
return declarations;
|
|
21880
21893
|
}
|
|
21881
21894
|
function collectHookRejections(hooksDir, hookNames) {
|
|
21882
|
-
if (fs22.existsSync(
|
|
21895
|
+
if (fs22.existsSync(path21.join(hooksDir, "hooks.json"))) {
|
|
21883
21896
|
return [];
|
|
21884
21897
|
}
|
|
21885
21898
|
if (!fs22.existsSync(hooksDir) || !fs22.statSync(hooksDir).isDirectory()) {
|
|
@@ -21888,7 +21901,7 @@ function collectHookRejections(hooksDir, hookNames) {
|
|
|
21888
21901
|
const names = hookNames && hookNames.length > 0 ? hookNames : fs22.readdirSync(hooksDir).filter((f) => f.endsWith(".md") && !f.startsWith(".")).map((f) => f.slice(0, -3)).sort();
|
|
21889
21902
|
const rejections = [];
|
|
21890
21903
|
for (const name of names) {
|
|
21891
|
-
const filePath =
|
|
21904
|
+
const filePath = path21.join(hooksDir, `${name}.md`);
|
|
21892
21905
|
if (!fs22.existsSync(filePath)) {
|
|
21893
21906
|
continue;
|
|
21894
21907
|
}
|
|
@@ -21922,10 +21935,10 @@ function extractFrontmatter(content) {
|
|
|
21922
21935
|
function reportHookRejections(report, targets, hooksDir, hookNames) {
|
|
21923
21936
|
const rejections = collectHookRejections(hooksDir, hookNames);
|
|
21924
21937
|
for (const rejection of rejections) {
|
|
21925
|
-
const name =
|
|
21938
|
+
const name = path21.basename(rejection.file, ".md");
|
|
21926
21939
|
for (const target of targets) {
|
|
21927
21940
|
addLoss(report, target, "hooks", {
|
|
21928
|
-
source: `hooks/${
|
|
21941
|
+
source: `hooks/${path21.basename(rejection.file)}`,
|
|
21929
21942
|
fields: [
|
|
21930
21943
|
{
|
|
21931
21944
|
field: rejection.field,
|
|
@@ -21946,7 +21959,7 @@ function declarationFileNames(hooksDir) {
|
|
|
21946
21959
|
return fs22.readdirSync(hooksDir).filter((f) => f.endsWith(".md") && !f.startsWith(".")).sort();
|
|
21947
21960
|
}
|
|
21948
21961
|
function detectHooksSourceForm(hooksDir) {
|
|
21949
|
-
const hasJson = fs22.existsSync(
|
|
21962
|
+
const hasJson = fs22.existsSync(path21.join(hooksDir, "hooks.json"));
|
|
21950
21963
|
const hasDeclarations = declarationFileNames(hooksDir).length > 0;
|
|
21951
21964
|
if (hasJson && hasDeclarations) return { kind: "both" };
|
|
21952
21965
|
if (hasJson) return { kind: "hooks-json" };
|
|
@@ -21980,7 +21993,7 @@ function describeHooksSourceConflict(hooksDir, hookNames) {
|
|
|
21980
21993
|
if (detectHooksSourceForm(hooksDir).kind !== "both") {
|
|
21981
21994
|
return null;
|
|
21982
21995
|
}
|
|
21983
|
-
const jsonPath =
|
|
21996
|
+
const jsonPath = path21.join(hooksDir, "hooks.json");
|
|
21984
21997
|
const declared = declarationFileNames(hooksDir);
|
|
21985
21998
|
let divergence = "";
|
|
21986
21999
|
try {
|
|
@@ -22022,7 +22035,7 @@ function loadKitHooksSource(sourceRoot, config, scriptsDir) {
|
|
|
22022
22035
|
const form = detectHooksSourceForm(hooksDir);
|
|
22023
22036
|
return {
|
|
22024
22037
|
hooks,
|
|
22025
|
-
path: form.kind === "declarations" ? hooksDir :
|
|
22038
|
+
path: form.kind === "declarations" ? hooksDir : path21.join(hooksDir, "hooks.json"),
|
|
22026
22039
|
label: hooksSourceLabel(sourceRoot, config),
|
|
22027
22040
|
// Hashed over the compiled input rather than over one file's bytes: the
|
|
22028
22041
|
// declaration form has no single file to hash, and what provenance needs
|
|
@@ -22037,7 +22050,7 @@ function reportHooksSourceConflict(report, targets, hooksDir, hookNames) {
|
|
|
22037
22050
|
}
|
|
22038
22051
|
for (const target of targets) {
|
|
22039
22052
|
addLoss(report, target, "hooks", {
|
|
22040
|
-
source: `${
|
|
22053
|
+
source: `${path21.basename(hooksDir)}/`,
|
|
22041
22054
|
fields: [
|
|
22042
22055
|
{
|
|
22043
22056
|
field: "hooks.json",
|
|
@@ -22053,18 +22066,18 @@ function reportHooksSourceConflict(report, targets, hooksDir, hookNames) {
|
|
|
22053
22066
|
|
|
22054
22067
|
// src/adapters/hook-scripts-bridge.ts
|
|
22055
22068
|
import fs25 from "fs";
|
|
22056
|
-
import
|
|
22069
|
+
import path24 from "path";
|
|
22057
22070
|
|
|
22058
22071
|
// src/utils/fs.ts
|
|
22059
22072
|
import fs23 from "fs";
|
|
22060
|
-
import
|
|
22073
|
+
import path22 from "path";
|
|
22061
22074
|
function ensureDir(dirPath) {
|
|
22062
22075
|
fs23.mkdirSync(dirPath, { recursive: true });
|
|
22063
22076
|
}
|
|
22064
22077
|
function createRelativeSymlink(source, destination, type, options) {
|
|
22065
|
-
const absoluteSource =
|
|
22066
|
-
const relative =
|
|
22067
|
-
realPathOrInput(
|
|
22078
|
+
const absoluteSource = path22.resolve(source);
|
|
22079
|
+
const relative = path22.relative(
|
|
22080
|
+
realPathOrInput(path22.dirname(destination)),
|
|
22068
22081
|
absoluteSource
|
|
22069
22082
|
);
|
|
22070
22083
|
if (process.platform === "win32" && type === "dir") {
|
|
@@ -22098,7 +22111,7 @@ function createRelativeSymlink(source, destination, type, options) {
|
|
|
22098
22111
|
fs23.symlinkSync(relative, destination, type);
|
|
22099
22112
|
}
|
|
22100
22113
|
function createManagedCopy(source, destination, provenanceMarker, _logger) {
|
|
22101
|
-
ensureDir(
|
|
22114
|
+
ensureDir(path22.dirname(destination));
|
|
22102
22115
|
const content = fs23.readFileSync(source, "utf8");
|
|
22103
22116
|
fs23.writeFileSync(destination, `${provenanceMarker}
|
|
22104
22117
|
${content}`);
|
|
@@ -22184,7 +22197,7 @@ function compareArtifactState(recorded, artifactPath) {
|
|
|
22184
22197
|
}
|
|
22185
22198
|
|
|
22186
22199
|
// src/core/shared-artifacts.ts
|
|
22187
|
-
import
|
|
22200
|
+
import path23 from "path";
|
|
22188
22201
|
var SHARED_NAMESPACE = "shared";
|
|
22189
22202
|
var SHARED_INSTRUCTIONS_KEY = `${SHARED_NAMESPACE}/AGENTS.md`;
|
|
22190
22203
|
var SHARED_INSTRUCTIONS_FILE = "AGENTS.md";
|
|
@@ -22194,14 +22207,14 @@ function sharedArtifactKey(destination, scope, projectRoot) {
|
|
|
22194
22207
|
return null;
|
|
22195
22208
|
}
|
|
22196
22209
|
const root = projectRoot ?? process.cwd();
|
|
22197
|
-
const shared =
|
|
22198
|
-
return
|
|
22210
|
+
const shared = path23.resolve(root, SHARED_INSTRUCTIONS_FILE);
|
|
22211
|
+
return path23.resolve(destination) === shared ? SHARED_INSTRUCTIONS_KEY : null;
|
|
22199
22212
|
}
|
|
22200
22213
|
function resolveSharedArtifactKey(key, scope, projectRoot) {
|
|
22201
22214
|
if (key !== SHARED_INSTRUCTIONS_KEY || scope !== "project") {
|
|
22202
22215
|
return null;
|
|
22203
22216
|
}
|
|
22204
|
-
return
|
|
22217
|
+
return path23.join(projectRoot ?? process.cwd(), SHARED_INSTRUCTIONS_FILE);
|
|
22205
22218
|
}
|
|
22206
22219
|
var SHARED_SKILLS_PREFIX = `${SHARED_NAMESPACE}/skills`;
|
|
22207
22220
|
function sharedKeyForDestination(destination, scope, projectRoot, platformPaths) {
|
|
@@ -22209,7 +22222,7 @@ function sharedKeyForDestination(destination, scope, projectRoot, platformPaths)
|
|
|
22209
22222
|
if (instructions) {
|
|
22210
22223
|
return instructions;
|
|
22211
22224
|
}
|
|
22212
|
-
const resolved =
|
|
22225
|
+
const resolved = path23.resolve(destination);
|
|
22213
22226
|
let profiles;
|
|
22214
22227
|
try {
|
|
22215
22228
|
profiles = resolveTargetPaths({
|
|
@@ -22220,12 +22233,12 @@ function sharedKeyForDestination(destination, scope, projectRoot, platformPaths)
|
|
|
22220
22233
|
} catch {
|
|
22221
22234
|
return null;
|
|
22222
22235
|
}
|
|
22223
|
-
if (resolved ===
|
|
22236
|
+
if (resolved === path23.resolve(profiles.codex.hook_scripts)) {
|
|
22224
22237
|
return SHARED_HOOK_SCRIPTS_KEY;
|
|
22225
22238
|
}
|
|
22226
|
-
const skillsRoot =
|
|
22227
|
-
if (resolved.startsWith(`${skillsRoot}${
|
|
22228
|
-
const inside =
|
|
22239
|
+
const skillsRoot = path23.resolve(profiles.opencode.skills_shared);
|
|
22240
|
+
if (resolved.startsWith(`${skillsRoot}${path23.sep}`)) {
|
|
22241
|
+
const inside = path23.relative(skillsRoot, resolved).split(path23.sep).join("/");
|
|
22229
22242
|
return `${SHARED_SKILLS_PREFIX}/${inside}`;
|
|
22230
22243
|
}
|
|
22231
22244
|
return null;
|
|
@@ -22235,7 +22248,7 @@ function resolveSharedSkillsKey(key, sharedSkillsRoot) {
|
|
|
22235
22248
|
return null;
|
|
22236
22249
|
}
|
|
22237
22250
|
const inside = key.slice(SHARED_SKILLS_PREFIX.length + 1);
|
|
22238
|
-
return
|
|
22251
|
+
return path23.join(sharedSkillsRoot, ...inside.split("/"));
|
|
22239
22252
|
}
|
|
22240
22253
|
|
|
22241
22254
|
// src/adapters/hook-scripts-bridge.ts
|
|
@@ -22263,7 +22276,7 @@ function syncHookScriptsBridge(args) {
|
|
|
22263
22276
|
} else if (artifactClass === "managed-symlink") {
|
|
22264
22277
|
fs25.unlinkSync(destination);
|
|
22265
22278
|
}
|
|
22266
|
-
ensureDir(
|
|
22279
|
+
ensureDir(path24.dirname(destination));
|
|
22267
22280
|
createRelativeSymlink(source, destination, "dir");
|
|
22268
22281
|
if (args.manifest) {
|
|
22269
22282
|
const state = describeArtifactState(destination);
|
|
@@ -22294,7 +22307,7 @@ function isSymlinkTo(linkPath, source) {
|
|
|
22294
22307
|
|
|
22295
22308
|
// src/core/shared-surface.ts
|
|
22296
22309
|
import fs26 from "fs";
|
|
22297
|
-
import
|
|
22310
|
+
import path25 from "path";
|
|
22298
22311
|
function isPlainObject2(value) {
|
|
22299
22312
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) !== null;
|
|
22300
22313
|
}
|
|
@@ -22607,7 +22620,7 @@ async function runUninstallCommand(options, logger) {
|
|
|
22607
22620
|
if (recorded) {
|
|
22608
22621
|
const outcome = revertSharedSurface(recorded, logger);
|
|
22609
22622
|
if (outcome === "reverted" || outcome === "removed") {
|
|
22610
|
-
removedParentDirs.add(
|
|
22623
|
+
removedParentDirs.add(path26.dirname(recorded.path));
|
|
22611
22624
|
removedCount++;
|
|
22612
22625
|
}
|
|
22613
22626
|
if (outcome === "reverted") {
|
|
@@ -22623,7 +22636,7 @@ async function runUninstallCommand(options, logger) {
|
|
|
22623
22636
|
uninstallProjectRoot
|
|
22624
22637
|
);
|
|
22625
22638
|
if (surfacePath && stripTangyrFromMergeSurface(surfacePath, logger)) {
|
|
22626
|
-
removedParentDirs.add(
|
|
22639
|
+
removedParentDirs.add(path26.dirname(surfacePath));
|
|
22627
22640
|
removedCount++;
|
|
22628
22641
|
if (fs28.existsSync(surfacePath)) {
|
|
22629
22642
|
keptSurfaces.push(surfacePath);
|
|
@@ -22645,7 +22658,7 @@ async function runUninstallCommand(options, logger) {
|
|
|
22645
22658
|
for (const actualPath of paths) {
|
|
22646
22659
|
if (actualPath && (fs28.existsSync(actualPath) || isSymlink(actualPath))) {
|
|
22647
22660
|
removeManagedPath(actualPath);
|
|
22648
|
-
removedParentDirs.add(
|
|
22661
|
+
removedParentDirs.add(path26.dirname(actualPath));
|
|
22649
22662
|
logger.verbose(` removed: ${actualPath}`);
|
|
22650
22663
|
removedCount++;
|
|
22651
22664
|
} else {
|
|
@@ -22667,7 +22680,7 @@ async function runUninstallCommand(options, logger) {
|
|
|
22667
22680
|
continue;
|
|
22668
22681
|
}
|
|
22669
22682
|
removeManagedPath(actualPath);
|
|
22670
|
-
removedParentDirs.add(
|
|
22683
|
+
removedParentDirs.add(path26.dirname(actualPath));
|
|
22671
22684
|
logger.verbose(` removed: ${actualPath}`);
|
|
22672
22685
|
removedCount++;
|
|
22673
22686
|
} else {
|
|
@@ -22724,12 +22737,17 @@ ${String(kept.length)} later backup(s) were NOT restored: the earliest copy of e
|
|
|
22724
22737
|
" The manifest is removed below, so nothing will reference these copies afterwards. Move what you need out of the backups directory now."
|
|
22725
22738
|
);
|
|
22726
22739
|
}
|
|
22727
|
-
const manifestPath =
|
|
22740
|
+
const manifestPath = path26.join(scopePath, "manifest.json");
|
|
22728
22741
|
if (fs28.existsSync(manifestPath)) {
|
|
22729
22742
|
fs28.unlinkSync(manifestPath);
|
|
22730
22743
|
logger.verbose(` removed manifest: ${manifestPath}`);
|
|
22731
22744
|
}
|
|
22732
|
-
|
|
22745
|
+
const lossReportPath = path26.join(scopePath, DEFAULT_LOSS_REPORT_FILE);
|
|
22746
|
+
if (fs28.existsSync(lossReportPath)) {
|
|
22747
|
+
fs28.unlinkSync(lossReportPath);
|
|
22748
|
+
logger.verbose(` removed loss report: ${lossReportPath}`);
|
|
22749
|
+
}
|
|
22750
|
+
pruneEmptyDirs(path26.join(scopePath, "backups"), logger);
|
|
22733
22751
|
try {
|
|
22734
22752
|
const remaining = fs28.readdirSync(scopePath);
|
|
22735
22753
|
if (remaining.length === 0) {
|
|
@@ -22752,7 +22770,7 @@ ${String(kept.length)} later backup(s) were NOT restored: the earliest copy of e
|
|
|
22752
22770
|
} else {
|
|
22753
22771
|
logger.verbose(" no manifest to update after partial residue cleanup");
|
|
22754
22772
|
}
|
|
22755
|
-
const pruneBoundary =
|
|
22773
|
+
const pruneBoundary = path26.dirname(scopePath);
|
|
22756
22774
|
for (const dir of removedParentDirs) {
|
|
22757
22775
|
pruneEmptyAncestors2(dir, pruneBoundary, logger);
|
|
22758
22776
|
}
|
|
@@ -22803,32 +22821,32 @@ function resolveManifestKeyToPath(key, scope, runtime, projectRootOverride) {
|
|
|
22803
22821
|
if (!slotPath) {
|
|
22804
22822
|
return null;
|
|
22805
22823
|
}
|
|
22806
|
-
return subPath ?
|
|
22824
|
+
return subPath ? path26.join(slotPath, subPath) : slotPath;
|
|
22807
22825
|
}
|
|
22808
22826
|
if (tool === "copilot") {
|
|
22809
22827
|
const copilotPaths = resolveCopilotPaths(runtime, scope, projectRoot);
|
|
22810
22828
|
if (component.startsWith("skills/")) {
|
|
22811
|
-
return
|
|
22829
|
+
return path26.join(copilotPaths.skills, component.slice("skills/".length));
|
|
22812
22830
|
}
|
|
22813
22831
|
if (component === "skills") {
|
|
22814
22832
|
return copilotPaths.skills;
|
|
22815
22833
|
}
|
|
22816
22834
|
if (component.startsWith("agents/")) {
|
|
22817
|
-
return
|
|
22835
|
+
return path26.join(copilotPaths.agents, component.slice("agents/".length));
|
|
22818
22836
|
}
|
|
22819
22837
|
if (component.startsWith("prompts/")) {
|
|
22820
|
-
return
|
|
22838
|
+
return path26.join(
|
|
22821
22839
|
copilotPaths.prompts,
|
|
22822
22840
|
component.slice("prompts/".length)
|
|
22823
22841
|
);
|
|
22824
22842
|
}
|
|
22825
22843
|
if (component.startsWith("hooks/")) {
|
|
22826
|
-
return
|
|
22844
|
+
return path26.join(copilotPaths.hooks, component.slice("hooks/".length));
|
|
22827
22845
|
}
|
|
22828
|
-
if (component ===
|
|
22846
|
+
if (component === path26.basename(copilotPaths.mcpSharedFile)) {
|
|
22829
22847
|
return copilotPaths.mcpSharedFile;
|
|
22830
22848
|
}
|
|
22831
|
-
if (copilotPaths.instructions !== null && component ===
|
|
22849
|
+
if (copilotPaths.instructions !== null && component === path26.basename(copilotPaths.instructions)) {
|
|
22832
22850
|
return copilotPaths.instructions;
|
|
22833
22851
|
}
|
|
22834
22852
|
return null;
|
|
@@ -22842,15 +22860,15 @@ function resolveManifestKeyToPath(key, scope, runtime, projectRootOverride) {
|
|
|
22842
22860
|
return codexPaths.skills;
|
|
22843
22861
|
}
|
|
22844
22862
|
if (component.startsWith("agents/")) {
|
|
22845
|
-
return
|
|
22863
|
+
return path26.join(codexPaths.agents, component.slice("agents/".length));
|
|
22846
22864
|
}
|
|
22847
22865
|
if (component.startsWith("rules/")) {
|
|
22848
|
-
return
|
|
22866
|
+
return path26.join(codexPaths.rules, component.slice("rules/".length));
|
|
22849
22867
|
}
|
|
22850
|
-
if (component ===
|
|
22868
|
+
if (component === path26.basename(codexPaths.hooksSharedFile)) {
|
|
22851
22869
|
return codexPaths.hooksSharedFile;
|
|
22852
22870
|
}
|
|
22853
|
-
if (component ===
|
|
22871
|
+
if (component === path26.basename(codexPaths.mcpSharedFile)) {
|
|
22854
22872
|
return codexPaths.mcpSharedFile;
|
|
22855
22873
|
}
|
|
22856
22874
|
return null;
|
|
@@ -22867,15 +22885,15 @@ function resolveManifestKeyToPath(key, scope, runtime, projectRootOverride) {
|
|
|
22867
22885
|
return opencodePaths.skillsShared;
|
|
22868
22886
|
}
|
|
22869
22887
|
if (component.startsWith("agents/")) {
|
|
22870
|
-
return
|
|
22888
|
+
return path26.join(opencodePaths.agents, component.slice("agents/".length));
|
|
22871
22889
|
}
|
|
22872
22890
|
if (component.startsWith("commands/")) {
|
|
22873
|
-
return
|
|
22891
|
+
return path26.join(
|
|
22874
22892
|
opencodePaths.commands,
|
|
22875
22893
|
component.slice("commands/".length)
|
|
22876
22894
|
);
|
|
22877
22895
|
}
|
|
22878
|
-
if (component ===
|
|
22896
|
+
if (component === path26.basename(opencodePaths.configDoc)) {
|
|
22879
22897
|
return opencodePaths.configDoc;
|
|
22880
22898
|
}
|
|
22881
22899
|
return null;
|
|
@@ -22901,13 +22919,13 @@ function resolveManifestKeyToPath(key, scope, runtime, projectRootOverride) {
|
|
|
22901
22919
|
return cursorPaths.permissionsFile;
|
|
22902
22920
|
}
|
|
22903
22921
|
if (component.startsWith("agents/")) {
|
|
22904
|
-
return
|
|
22922
|
+
return path26.join(cursorPaths.agents, component.slice("agents/".length));
|
|
22905
22923
|
}
|
|
22906
22924
|
if (component.startsWith("rules/")) {
|
|
22907
|
-
return
|
|
22925
|
+
return path26.join(cursorPaths.rules, component.slice("rules/".length));
|
|
22908
22926
|
}
|
|
22909
22927
|
if (component.startsWith("skills/")) {
|
|
22910
|
-
return
|
|
22928
|
+
return path26.join(cursorPaths.skills, component.slice("skills/".length));
|
|
22911
22929
|
}
|
|
22912
22930
|
return null;
|
|
22913
22931
|
}
|
|
@@ -22923,10 +22941,10 @@ function resolveManifestKeyToPath(key, scope, runtime, projectRootOverride) {
|
|
|
22923
22941
|
return clinePaths.mcpFile;
|
|
22924
22942
|
}
|
|
22925
22943
|
if (component.startsWith("rules/")) {
|
|
22926
|
-
return
|
|
22944
|
+
return path26.join(clinePaths.rules, component.slice("rules/".length));
|
|
22927
22945
|
}
|
|
22928
22946
|
if (component.startsWith("workflows/")) {
|
|
22929
|
-
return
|
|
22947
|
+
return path26.join(
|
|
22930
22948
|
clinePaths.workflows,
|
|
22931
22949
|
component.slice("workflows/".length)
|
|
22932
22950
|
);
|
|
@@ -22960,22 +22978,22 @@ function resolveClaudeCodePaths(runtime, scope, projectRoot) {
|
|
|
22960
22978
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
22961
22979
|
if (scope === "global") {
|
|
22962
22980
|
return {
|
|
22963
|
-
instructions:
|
|
22964
|
-
agents:
|
|
22965
|
-
skills:
|
|
22966
|
-
commands:
|
|
22967
|
-
rules:
|
|
22968
|
-
output_styles:
|
|
22981
|
+
instructions: path26.join(home, ".claude", "CLAUDE.md"),
|
|
22982
|
+
agents: path26.join(home, ".claude", "agents"),
|
|
22983
|
+
skills: path26.join(home, ".claude", "skills"),
|
|
22984
|
+
commands: path26.join(home, ".claude", "commands"),
|
|
22985
|
+
rules: path26.join(home, ".claude", "rules"),
|
|
22986
|
+
output_styles: path26.join(home, ".claude", "output-styles")
|
|
22969
22987
|
};
|
|
22970
22988
|
}
|
|
22971
22989
|
const root = projectRoot ?? process.cwd();
|
|
22972
22990
|
return {
|
|
22973
|
-
instructions:
|
|
22974
|
-
agents:
|
|
22975
|
-
skills:
|
|
22976
|
-
commands:
|
|
22977
|
-
rules:
|
|
22978
|
-
output_styles:
|
|
22991
|
+
instructions: path26.join(root, "CLAUDE.md"),
|
|
22992
|
+
agents: path26.join(root, ".claude", "agents"),
|
|
22993
|
+
skills: path26.join(root, ".claude", "skills"),
|
|
22994
|
+
commands: path26.join(root, ".claude", "commands"),
|
|
22995
|
+
rules: path26.join(root, ".claude", "rules"),
|
|
22996
|
+
output_styles: path26.join(root, ".claude", "output-styles")
|
|
22979
22997
|
};
|
|
22980
22998
|
}
|
|
22981
22999
|
function resolveClaudeRootsForUninstall(manifest, runtime) {
|
|
@@ -22994,12 +23012,12 @@ function resolveClaudeRootsForUninstall(manifest, runtime) {
|
|
|
22994
23012
|
projectRoot: void 0,
|
|
22995
23013
|
mappings: mappings.platformPaths
|
|
22996
23014
|
})["claude-code"];
|
|
22997
|
-
return [
|
|
23015
|
+
return [path26.dirname(profile.agents)];
|
|
22998
23016
|
} catch {
|
|
22999
23017
|
}
|
|
23000
23018
|
}
|
|
23001
23019
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
23002
|
-
return [
|
|
23020
|
+
return [path26.resolve(expandHome(`${home}/.claude`))];
|
|
23003
23021
|
}
|
|
23004
23022
|
function resolveAllClaudeRoots(manifest, runtime, claudeConfigDirs) {
|
|
23005
23023
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
@@ -23011,13 +23029,13 @@ function resolveAllClaudeRoots(manifest, runtime, claudeConfigDirs) {
|
|
|
23011
23029
|
env: process.env.TANGYR_CLAUDE_CONFIG_DIRS,
|
|
23012
23030
|
config: runtime.config.claudeCodeGlobalPaths
|
|
23013
23031
|
})
|
|
23014
|
-
].map((root) =>
|
|
23032
|
+
].map((root) => path26.resolve(root))
|
|
23015
23033
|
);
|
|
23016
23034
|
if (home && fs28.existsSync(home)) {
|
|
23017
23035
|
try {
|
|
23018
23036
|
for (const entry of fs28.readdirSync(home, { withFileTypes: true })) {
|
|
23019
23037
|
if (entry.isDirectory() && entry.name.startsWith(".claude-")) {
|
|
23020
|
-
roots.add(
|
|
23038
|
+
roots.add(path26.resolve(home, entry.name));
|
|
23021
23039
|
}
|
|
23022
23040
|
}
|
|
23023
23041
|
} catch {
|
|
@@ -23036,13 +23054,13 @@ function resolveManifestKeyToMultiPaths(key, claudeRoots, runtime) {
|
|
|
23036
23054
|
const rootsToResolve = isShared ? [claudeRoots[0]] : claudeRoots;
|
|
23037
23055
|
if (!runtime) {
|
|
23038
23056
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
23039
|
-
const defaultRoot =
|
|
23057
|
+
const defaultRoot = path26.resolve(expandHome(`${home}/.claude`));
|
|
23040
23058
|
return rootsToResolve.flatMap((root) => {
|
|
23041
23059
|
const hardcoded = resolveHardcodedClaudeSlot(root, defaultRoot, slotName);
|
|
23042
23060
|
if (!hardcoded) {
|
|
23043
23061
|
return [];
|
|
23044
23062
|
}
|
|
23045
|
-
return [subPath ?
|
|
23063
|
+
return [subPath ? path26.join(hardcoded, subPath) : hardcoded];
|
|
23046
23064
|
});
|
|
23047
23065
|
}
|
|
23048
23066
|
try {
|
|
@@ -23060,17 +23078,17 @@ function resolveManifestKeyToMultiPaths(key, claudeRoots, runtime) {
|
|
|
23060
23078
|
if (!slotPath) {
|
|
23061
23079
|
return [];
|
|
23062
23080
|
}
|
|
23063
|
-
return [subPath ?
|
|
23081
|
+
return [subPath ? path26.join(slotPath, subPath) : slotPath];
|
|
23064
23082
|
});
|
|
23065
23083
|
} catch {
|
|
23066
23084
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
23067
|
-
const defaultRoot =
|
|
23085
|
+
const defaultRoot = path26.resolve(expandHome(`${home}/.claude`));
|
|
23068
23086
|
return rootsToResolve.flatMap((root) => {
|
|
23069
23087
|
const hardcoded = resolveHardcodedClaudeSlot(root, defaultRoot, slotName);
|
|
23070
23088
|
if (!hardcoded) {
|
|
23071
23089
|
return [];
|
|
23072
23090
|
}
|
|
23073
|
-
return [subPath ?
|
|
23091
|
+
return [subPath ? path26.join(hardcoded, subPath) : hardcoded];
|
|
23074
23092
|
});
|
|
23075
23093
|
}
|
|
23076
23094
|
}
|
|
@@ -23095,9 +23113,9 @@ function resolveHardcodedClaudeSlot(root, defaultRoot, slotName) {
|
|
|
23095
23113
|
return null;
|
|
23096
23114
|
}
|
|
23097
23115
|
if (root === defaultRoot) {
|
|
23098
|
-
return
|
|
23116
|
+
return path26.join(root, relative);
|
|
23099
23117
|
}
|
|
23100
|
-
return
|
|
23118
|
+
return path26.join(root, relative);
|
|
23101
23119
|
}
|
|
23102
23120
|
function resolveRuntimeIfAvailable(options, logger) {
|
|
23103
23121
|
try {
|
|
@@ -23169,9 +23187,9 @@ function stripTangyrFromMergeSurface(filePath, logger) {
|
|
|
23169
23187
|
return true;
|
|
23170
23188
|
}
|
|
23171
23189
|
function pruneEmptyAncestors2(startDir, stopAt, logger) {
|
|
23172
|
-
const boundary =
|
|
23173
|
-
let current =
|
|
23174
|
-
while (current !== boundary && current.startsWith(`${boundary}${
|
|
23190
|
+
const boundary = path26.resolve(stopAt);
|
|
23191
|
+
let current = path26.resolve(startDir);
|
|
23192
|
+
while (current !== boundary && current.startsWith(`${boundary}${path26.sep}`)) {
|
|
23175
23193
|
try {
|
|
23176
23194
|
if (fs28.readdirSync(current).length > 0) {
|
|
23177
23195
|
return;
|
|
@@ -23181,7 +23199,7 @@ function pruneEmptyAncestors2(startDir, stopAt, logger) {
|
|
|
23181
23199
|
} catch {
|
|
23182
23200
|
return;
|
|
23183
23201
|
}
|
|
23184
|
-
current =
|
|
23202
|
+
current = path26.dirname(current);
|
|
23185
23203
|
}
|
|
23186
23204
|
}
|
|
23187
23205
|
function pruneEmptyDirs(dir, logger) {
|
|
@@ -23196,7 +23214,7 @@ function pruneEmptyDirs(dir, logger) {
|
|
|
23196
23214
|
}
|
|
23197
23215
|
for (const entry of fs28.readdirSync(dir, { withFileTypes: true })) {
|
|
23198
23216
|
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
23199
|
-
pruneEmptyDirs(
|
|
23217
|
+
pruneEmptyDirs(path26.join(dir, entry.name), logger);
|
|
23200
23218
|
}
|
|
23201
23219
|
}
|
|
23202
23220
|
try {
|
|
@@ -23221,9 +23239,9 @@ function sharedSurfaceFor(manifest, file, selectedTools, scope, runtime, project
|
|
|
23221
23239
|
if (!artifactPath) {
|
|
23222
23240
|
return null;
|
|
23223
23241
|
}
|
|
23224
|
-
const resolved =
|
|
23242
|
+
const resolved = path26.resolve(artifactPath);
|
|
23225
23243
|
return records.find(
|
|
23226
|
-
(record) =>
|
|
23244
|
+
(record) => path26.resolve(record.path) === resolved && selectedTools.has(record.tool)
|
|
23227
23245
|
) ?? null;
|
|
23228
23246
|
}
|
|
23229
23247
|
function revertSharedSurface(record, logger) {
|
|
@@ -23304,7 +23322,7 @@ function addManagedSymlinkChildren(artifacts, directory, runtime, component) {
|
|
|
23304
23322
|
return;
|
|
23305
23323
|
}
|
|
23306
23324
|
for (const entry of entries) {
|
|
23307
|
-
const artifactPath =
|
|
23325
|
+
const artifactPath = path26.join(directory, entry.name);
|
|
23308
23326
|
const artifactClass = classifyArtifact(
|
|
23309
23327
|
artifactPath,
|
|
23310
23328
|
runtime.config,
|
|
@@ -23343,8 +23361,8 @@ function collectStringValuesByKey(value, keyName, values) {
|
|
|
23343
23361
|
}
|
|
23344
23362
|
function addLegacyOperatingGuideCopies(artifacts, claudeRoot) {
|
|
23345
23363
|
for (const artifactPath of [
|
|
23346
|
-
...ts(
|
|
23347
|
-
...ts(
|
|
23364
|
+
...ts(path26.join(claudeRoot, "CLAUDE.md.bak.*")),
|
|
23365
|
+
...ts(path26.join(claudeRoot, "AGENTS.md.bak.*"))
|
|
23348
23366
|
].sort()) {
|
|
23349
23367
|
artifacts.push({
|
|
23350
23368
|
component: "claude-code legacy operating guide backup",
|
|
@@ -23398,7 +23416,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23398
23416
|
for (const skill of runtime.kitInfo.components.skills.declared) {
|
|
23399
23417
|
artifacts.push({
|
|
23400
23418
|
component: "claude-code skill",
|
|
23401
|
-
path:
|
|
23419
|
+
path: path26.join(profile.skills, skill),
|
|
23402
23420
|
kind: "direct"
|
|
23403
23421
|
});
|
|
23404
23422
|
}
|
|
@@ -23417,7 +23435,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23417
23435
|
if (isFullToolUninstall(manifest, selectedTools)) {
|
|
23418
23436
|
addLegacyOperatingGuideCopies(
|
|
23419
23437
|
artifacts,
|
|
23420
|
-
|
|
23438
|
+
path26.dirname(profile.instructions)
|
|
23421
23439
|
);
|
|
23422
23440
|
}
|
|
23423
23441
|
}
|
|
@@ -23440,20 +23458,20 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23440
23458
|
if (selectedTools.has("copilot")) {
|
|
23441
23459
|
addCompiledGlobPlans(
|
|
23442
23460
|
artifacts,
|
|
23443
|
-
|
|
23461
|
+
path26.join(copilotPaths.agents, "*.agent.md"),
|
|
23444
23462
|
"copilot",
|
|
23445
23463
|
"copilot agent residue"
|
|
23446
23464
|
);
|
|
23447
23465
|
addCompiledGlobPlans(
|
|
23448
23466
|
artifacts,
|
|
23449
|
-
|
|
23467
|
+
path26.join(copilotPaths.prompts, "*.prompt.md"),
|
|
23450
23468
|
"copilot",
|
|
23451
23469
|
"copilot prompt residue"
|
|
23452
23470
|
);
|
|
23453
23471
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
23454
23472
|
artifacts.push({
|
|
23455
23473
|
component: "copilot agent",
|
|
23456
|
-
path:
|
|
23474
|
+
path: path26.join(copilotPaths.agents, `${agentEntry}.agent.md`),
|
|
23457
23475
|
kind: "compiled",
|
|
23458
23476
|
expectedTarget: "copilot",
|
|
23459
23477
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -23462,7 +23480,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23462
23480
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
23463
23481
|
artifacts.push({
|
|
23464
23482
|
component: "copilot prompt",
|
|
23465
|
-
path:
|
|
23483
|
+
path: path26.join(copilotPaths.prompts, `${commandEntry}.prompt.md`),
|
|
23466
23484
|
kind: "compiled",
|
|
23467
23485
|
expectedTarget: "copilot",
|
|
23468
23486
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -23477,7 +23495,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23477
23495
|
for (const skill of runtime.kitInfo.components.skills.declared) {
|
|
23478
23496
|
artifacts.push({
|
|
23479
23497
|
component: "copilot skill",
|
|
23480
|
-
path:
|
|
23498
|
+
path: path26.join(copilotPaths.skills, skill),
|
|
23481
23499
|
kind: "direct"
|
|
23482
23500
|
});
|
|
23483
23501
|
}
|
|
@@ -23491,13 +23509,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23491
23509
|
artifacts.push(
|
|
23492
23510
|
{
|
|
23493
23511
|
component: "copilot hooks",
|
|
23494
|
-
path:
|
|
23512
|
+
path: path26.join(copilotPaths.hooks, "tangyr-managed.json"),
|
|
23495
23513
|
kind: "managed-json",
|
|
23496
23514
|
expectedTarget: "copilot"
|
|
23497
23515
|
},
|
|
23498
23516
|
{
|
|
23499
23517
|
component: "copilot legacy hooks",
|
|
23500
|
-
path:
|
|
23518
|
+
path: path26.join(copilotPaths.hooks, "proteus-managed.json"),
|
|
23501
23519
|
kind: "managed-json",
|
|
23502
23520
|
expectedTarget: "copilot"
|
|
23503
23521
|
}
|
|
@@ -23506,7 +23524,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23506
23524
|
if (hooksSourceExists(runtime.sourceRoot, runtime.config)) {
|
|
23507
23525
|
artifacts.push({
|
|
23508
23526
|
component: "copilot hooks",
|
|
23509
|
-
path:
|
|
23527
|
+
path: path26.join(copilotPaths.hooks, "tangyr-managed.json"),
|
|
23510
23528
|
kind: "compiled",
|
|
23511
23529
|
expectedTarget: "copilot",
|
|
23512
23530
|
expectedSource: hooksSource
|
|
@@ -23536,13 +23554,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23536
23554
|
);
|
|
23537
23555
|
addCompiledGlobPlans(
|
|
23538
23556
|
artifacts,
|
|
23539
|
-
|
|
23557
|
+
path26.join(codexPaths.agents, "*.toml"),
|
|
23540
23558
|
"codex",
|
|
23541
23559
|
"codex agent residue"
|
|
23542
23560
|
);
|
|
23543
23561
|
addCompiledGlobPlans(
|
|
23544
23562
|
artifacts,
|
|
23545
|
-
|
|
23563
|
+
path26.join(codexPaths.rules, "*.rules"),
|
|
23546
23564
|
"codex",
|
|
23547
23565
|
"codex rule residue"
|
|
23548
23566
|
);
|
|
@@ -23556,7 +23574,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23556
23574
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
23557
23575
|
artifacts.push({
|
|
23558
23576
|
component: "codex agent",
|
|
23559
|
-
path:
|
|
23577
|
+
path: path26.join(codexPaths.agents, `${agentEntry}.toml`),
|
|
23560
23578
|
kind: "compiled",
|
|
23561
23579
|
expectedTarget: "codex",
|
|
23562
23580
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -23565,7 +23583,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23565
23583
|
for (const ruleEntry of runtime.kitInfo.components.rules.declared) {
|
|
23566
23584
|
artifacts.push({
|
|
23567
23585
|
component: "codex rule",
|
|
23568
|
-
path:
|
|
23586
|
+
path: path26.join(codexPaths.rules, `${ruleEntry}.rules`),
|
|
23569
23587
|
kind: "compiled",
|
|
23570
23588
|
expectedTarget: "codex",
|
|
23571
23589
|
expectedSource: `rules/${ruleEntry}.md`
|
|
@@ -23617,13 +23635,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23617
23635
|
);
|
|
23618
23636
|
addCompiledGlobPlans(
|
|
23619
23637
|
artifacts,
|
|
23620
|
-
|
|
23638
|
+
path26.join(opencodePaths.agents, "*.md"),
|
|
23621
23639
|
"opencode",
|
|
23622
23640
|
"opencode agent residue"
|
|
23623
23641
|
);
|
|
23624
23642
|
addCompiledGlobPlans(
|
|
23625
23643
|
artifacts,
|
|
23626
|
-
|
|
23644
|
+
path26.join(opencodePaths.commands, "*.md"),
|
|
23627
23645
|
"opencode",
|
|
23628
23646
|
"opencode command residue"
|
|
23629
23647
|
);
|
|
@@ -23642,7 +23660,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23642
23660
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
23643
23661
|
artifacts.push({
|
|
23644
23662
|
component: "opencode agent",
|
|
23645
|
-
path:
|
|
23663
|
+
path: path26.join(opencodePaths.agents, `${agentEntry}.md`),
|
|
23646
23664
|
kind: "compiled",
|
|
23647
23665
|
expectedTarget: "opencode",
|
|
23648
23666
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -23651,7 +23669,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23651
23669
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
23652
23670
|
artifacts.push({
|
|
23653
23671
|
component: "opencode command",
|
|
23654
|
-
path:
|
|
23672
|
+
path: path26.join(opencodePaths.commands, `${commandEntry}.md`),
|
|
23655
23673
|
kind: "compiled",
|
|
23656
23674
|
expectedTarget: "opencode",
|
|
23657
23675
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -23706,19 +23724,19 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23706
23724
|
);
|
|
23707
23725
|
addCompiledGlobPlans(
|
|
23708
23726
|
artifacts,
|
|
23709
|
-
|
|
23727
|
+
path26.join(cursorPaths.agents, "*.md"),
|
|
23710
23728
|
"cursor",
|
|
23711
23729
|
"cursor agent residue"
|
|
23712
23730
|
);
|
|
23713
23731
|
addCompiledGlobPlans(
|
|
23714
23732
|
artifacts,
|
|
23715
|
-
|
|
23733
|
+
path26.join(cursorPaths.rules, "*.mdc"),
|
|
23716
23734
|
"cursor",
|
|
23717
23735
|
"cursor rule residue"
|
|
23718
23736
|
);
|
|
23719
23737
|
addCompiledGlobPlans(
|
|
23720
23738
|
artifacts,
|
|
23721
|
-
|
|
23739
|
+
path26.join(cursorPaths.skills, "*", "SKILL.md"),
|
|
23722
23740
|
"cursor",
|
|
23723
23741
|
"cursor command residue"
|
|
23724
23742
|
);
|
|
@@ -23732,7 +23750,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23732
23750
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
23733
23751
|
artifacts.push({
|
|
23734
23752
|
component: "cursor agent",
|
|
23735
|
-
path:
|
|
23753
|
+
path: path26.join(cursorPaths.agents, `${agentEntry}.md`),
|
|
23736
23754
|
kind: "compiled",
|
|
23737
23755
|
expectedTarget: "cursor",
|
|
23738
23756
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -23769,13 +23787,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23769
23787
|
);
|
|
23770
23788
|
addCompiledGlobPlans(
|
|
23771
23789
|
artifacts,
|
|
23772
|
-
|
|
23790
|
+
path26.join(clinePaths.rules, "*.md"),
|
|
23773
23791
|
"cline",
|
|
23774
23792
|
"cline rule residue"
|
|
23775
23793
|
);
|
|
23776
23794
|
addCompiledGlobPlans(
|
|
23777
23795
|
artifacts,
|
|
23778
|
-
|
|
23796
|
+
path26.join(clinePaths.workflows, "*.md"),
|
|
23779
23797
|
"cline",
|
|
23780
23798
|
"cline workflow residue"
|
|
23781
23799
|
);
|
|
@@ -23803,7 +23821,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23803
23821
|
for (const ruleEntry of runtime.kitInfo.components.rules.declared) {
|
|
23804
23822
|
artifacts.push({
|
|
23805
23823
|
component: "cline rule",
|
|
23806
|
-
path:
|
|
23824
|
+
path: path26.join(clinePaths.rules, `${ruleEntry}.md`),
|
|
23807
23825
|
kind: "compiled",
|
|
23808
23826
|
expectedTarget: "cline",
|
|
23809
23827
|
expectedSource: `rules/${ruleEntry}.md`
|
|
@@ -23812,7 +23830,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
23812
23830
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
23813
23831
|
artifacts.push({
|
|
23814
23832
|
component: "cline workflow",
|
|
23815
|
-
path:
|
|
23833
|
+
path: path26.join(clinePaths.workflows, `${commandEntry}.md`),
|
|
23816
23834
|
kind: "compiled",
|
|
23817
23835
|
expectedTarget: "cline",
|
|
23818
23836
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -24147,12 +24165,12 @@ function resolveCopilotPaths(runtime, scope = "global", projectRoot) {
|
|
|
24147
24165
|
if (scope === "project") {
|
|
24148
24166
|
const root = projectRoot ?? process.cwd();
|
|
24149
24167
|
return {
|
|
24150
|
-
instructions:
|
|
24151
|
-
agents:
|
|
24152
|
-
prompts:
|
|
24153
|
-
skills:
|
|
24154
|
-
hooks:
|
|
24155
|
-
mcpSharedFile:
|
|
24168
|
+
instructions: path26.join(root, ".github", "copilot-instructions.md"),
|
|
24169
|
+
agents: path26.join(root, ".github", "agents"),
|
|
24170
|
+
prompts: path26.join(root, ".github", "prompts"),
|
|
24171
|
+
skills: path26.join(root, ".github", "skills"),
|
|
24172
|
+
hooks: path26.join(root, ".github", "hooks"),
|
|
24173
|
+
mcpSharedFile: path26.join(root, ".vscode", "mcp.json")
|
|
24156
24174
|
};
|
|
24157
24175
|
}
|
|
24158
24176
|
return {
|
|
@@ -24192,12 +24210,12 @@ function resolveCodexPaths(runtime, scope = "global", projectRoot) {
|
|
|
24192
24210
|
if (scope === "project") {
|
|
24193
24211
|
const root = projectRoot ?? process.cwd();
|
|
24194
24212
|
return {
|
|
24195
|
-
instructions:
|
|
24196
|
-
agents:
|
|
24197
|
-
rules:
|
|
24198
|
-
skills:
|
|
24199
|
-
hooksSharedFile:
|
|
24200
|
-
mcpSharedFile:
|
|
24213
|
+
instructions: path26.join(root, "AGENTS.md"),
|
|
24214
|
+
agents: path26.join(root, ".codex", "agents"),
|
|
24215
|
+
rules: path26.join(root, ".codex", "rules"),
|
|
24216
|
+
skills: path26.join(root, ".codex", "skills"),
|
|
24217
|
+
hooksSharedFile: path26.join(root, ".codex", "hooks.json"),
|
|
24218
|
+
mcpSharedFile: path26.join(root, ".codex", "config.toml")
|
|
24201
24219
|
};
|
|
24202
24220
|
}
|
|
24203
24221
|
return {
|
|
@@ -24226,7 +24244,7 @@ function resolveSharedHookScriptsPath(runtime, scope, projectRoot) {
|
|
|
24226
24244
|
}
|
|
24227
24245
|
}
|
|
24228
24246
|
if (scope === "project") {
|
|
24229
|
-
return
|
|
24247
|
+
return path26.join(projectRoot ?? process.cwd(), ".agents", "hooks");
|
|
24230
24248
|
}
|
|
24231
24249
|
return resolveTargetPath("~/.agents/hooks");
|
|
24232
24250
|
}
|
|
@@ -24247,7 +24265,7 @@ function resolveSharedSkillsPath(runtime, scope, projectRoot) {
|
|
|
24247
24265
|
}
|
|
24248
24266
|
}
|
|
24249
24267
|
if (scope === "project") {
|
|
24250
|
-
return
|
|
24268
|
+
return path26.join(projectRoot ?? process.cwd(), ".agents", "skills");
|
|
24251
24269
|
}
|
|
24252
24270
|
return resolveTargetPath("~/.agents/skills");
|
|
24253
24271
|
}
|
|
@@ -24432,7 +24450,7 @@ function isKitPointer(artifact) {
|
|
|
24432
24450
|
}
|
|
24433
24451
|
try {
|
|
24434
24452
|
const recordedPath = fs28.readFileSync(artifact.path, "utf8").trim();
|
|
24435
|
-
return recordedPath.length > 0 &&
|
|
24453
|
+
return recordedPath.length > 0 && path26.resolve(recordedPath) === path26.resolve(artifact.expectedPath);
|
|
24436
24454
|
} catch {
|
|
24437
24455
|
return false;
|
|
24438
24456
|
}
|
|
@@ -24597,7 +24615,7 @@ function restoreBackup(backup, logger) {
|
|
|
24597
24615
|
logger.warn(` backup not found: ${backup.backupLocation}`);
|
|
24598
24616
|
return;
|
|
24599
24617
|
}
|
|
24600
|
-
const destDir =
|
|
24618
|
+
const destDir = path26.dirname(backup.originalPath);
|
|
24601
24619
|
fs28.mkdirSync(destDir, { recursive: true });
|
|
24602
24620
|
if (fs28.lstatSync(backup.backupLocation).isDirectory()) {
|
|
24603
24621
|
fs28.cpSync(backup.backupLocation, backup.originalPath, {
|
|
@@ -24759,7 +24777,7 @@ function cleanupCopilot(config, sourceRoot, configDir, logger) {
|
|
|
24759
24777
|
logger
|
|
24760
24778
|
);
|
|
24761
24779
|
removeManagedJsonFile(
|
|
24762
|
-
|
|
24780
|
+
path27.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
24763
24781
|
"_tangyr",
|
|
24764
24782
|
logger
|
|
24765
24783
|
);
|
|
@@ -24921,7 +24939,7 @@ function removeManagedDirectPath(artifactPath, config, sourceRoot, component, lo
|
|
|
24921
24939
|
}
|
|
24922
24940
|
}
|
|
24923
24941
|
function removeManagedCompiledFiles(dir, pattern, expectedTarget, logger) {
|
|
24924
|
-
for (const filePath of ts(
|
|
24942
|
+
for (const filePath of ts(path27.join(dir, pattern)).sort()) {
|
|
24925
24943
|
removeManagedCompiledFile(filePath, expectedTarget, logger);
|
|
24926
24944
|
}
|
|
24927
24945
|
}
|
|
@@ -25032,7 +25050,7 @@ function toVerbosity(value) {
|
|
|
25032
25050
|
// src/commands/detect.ts
|
|
25033
25051
|
import fs30 from "fs";
|
|
25034
25052
|
import os5 from "os";
|
|
25035
|
-
import
|
|
25053
|
+
import path28 from "path";
|
|
25036
25054
|
import { spawnSync } from "child_process";
|
|
25037
25055
|
var copilotEditorCommands = [
|
|
25038
25056
|
"code",
|
|
@@ -25164,7 +25182,7 @@ function detectEditorExtension(label, matchesExtension, logger, dependencies = {
|
|
|
25164
25182
|
}
|
|
25165
25183
|
}
|
|
25166
25184
|
for (const relativeDirectory of copilotExtensionDirectories) {
|
|
25167
|
-
const extensionDirectory =
|
|
25185
|
+
const extensionDirectory = path28.join(homeDirectory, relativeDirectory);
|
|
25168
25186
|
if (!pathExists(extensionDirectory)) {
|
|
25169
25187
|
continue;
|
|
25170
25188
|
}
|
|
@@ -25187,7 +25205,7 @@ function cursorExecutablePaths(platform, homeDirectory) {
|
|
|
25187
25205
|
}
|
|
25188
25206
|
return [
|
|
25189
25207
|
...systemPaths,
|
|
25190
|
-
|
|
25208
|
+
path28.join(
|
|
25191
25209
|
homeDirectory,
|
|
25192
25210
|
"Applications/Cursor.app/Contents/Resources/app/bin/cursor"
|
|
25193
25211
|
)
|
|
@@ -25248,7 +25266,7 @@ function logDetectionError(attemptedCommand, error, logger) {
|
|
|
25248
25266
|
|
|
25249
25267
|
// src/commands/doctor.ts
|
|
25250
25268
|
import fs31 from "fs";
|
|
25251
|
-
import
|
|
25269
|
+
import path29 from "path";
|
|
25252
25270
|
function runDoctorCommand(options, logger) {
|
|
25253
25271
|
const { config, configDir, configPath, sourceRoot } = resolveRuntime(
|
|
25254
25272
|
options,
|
|
@@ -25258,7 +25276,7 @@ function runDoctorCommand(options, logger) {
|
|
|
25258
25276
|
if (!fs31.existsSync(configPath)) {
|
|
25259
25277
|
findings.push(`${configPath}: missing`);
|
|
25260
25278
|
}
|
|
25261
|
-
const hooksJsonPath =
|
|
25279
|
+
const hooksJsonPath = path29.join(
|
|
25262
25280
|
sourceRoot,
|
|
25263
25281
|
config.source.hooks,
|
|
25264
25282
|
"hooks.json"
|
|
@@ -25334,18 +25352,18 @@ function checkClaudeCode(options, findings, config, sourceRoot, configDir, logge
|
|
|
25334
25352
|
projectRoot
|
|
25335
25353
|
)) {
|
|
25336
25354
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
25337
|
-
const sourcePath = artifact.sourceKey ?
|
|
25355
|
+
const sourcePath = artifact.sourceKey ? path29.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
25338
25356
|
if (artifactClass === "managed-stale") {
|
|
25339
25357
|
findings.push(
|
|
25340
25358
|
`${artifact.component}: managed stale artifact at ${artifact.path}`
|
|
25341
25359
|
);
|
|
25342
25360
|
if (options.fix && sourcePath && isOurStaleSymlink(
|
|
25343
25361
|
artifact.path,
|
|
25344
|
-
/* @__PURE__ */ new Set([
|
|
25362
|
+
/* @__PURE__ */ new Set([path29.resolve(artifact.path)]),
|
|
25345
25363
|
config
|
|
25346
25364
|
)) {
|
|
25347
25365
|
fs31.unlinkSync(artifact.path);
|
|
25348
|
-
ensureDir(
|
|
25366
|
+
ensureDir(path29.dirname(artifact.path));
|
|
25349
25367
|
const symlinkType = fs31.statSync(sourcePath).isDirectory() ? "dir" : "file";
|
|
25350
25368
|
createRelativeSymlink(sourcePath, artifact.path, symlinkType, {
|
|
25351
25369
|
logger,
|
|
@@ -25359,8 +25377,8 @@ function checkClaudeCode(options, findings, config, sourceRoot, configDir, logge
|
|
|
25359
25377
|
logger.info(`${artifact.component}: recreated managed symlink`);
|
|
25360
25378
|
}
|
|
25361
25379
|
}
|
|
25362
|
-
if (options.fix && !fs31.existsSync(
|
|
25363
|
-
ensureDir(
|
|
25380
|
+
if (options.fix && !fs31.existsSync(path29.dirname(artifact.path))) {
|
|
25381
|
+
ensureDir(path29.dirname(artifact.path));
|
|
25364
25382
|
}
|
|
25365
25383
|
checkParentWritablePath(artifact.path, artifact.component, findings);
|
|
25366
25384
|
}
|
|
@@ -25382,7 +25400,7 @@ function slotsForScope(config, sourceRoot, configDir, target, options) {
|
|
|
25382
25400
|
});
|
|
25383
25401
|
const resolved = {};
|
|
25384
25402
|
for (const [slot, value] of Object.entries(projectSlots)) {
|
|
25385
|
-
resolved[slot] = typeof value === "string" ?
|
|
25403
|
+
resolved[slot] = typeof value === "string" ? path29.resolve(root, value) : value;
|
|
25386
25404
|
}
|
|
25387
25405
|
return resolved;
|
|
25388
25406
|
}
|
|
@@ -25402,7 +25420,7 @@ function checkCopilot(config, sourceRoot, configDir, findings, options) {
|
|
|
25402
25420
|
continue;
|
|
25403
25421
|
}
|
|
25404
25422
|
const label = `copilot: ${rawPath}`;
|
|
25405
|
-
if (key.endsWith("_shared_file") ||
|
|
25423
|
+
if (key.endsWith("_shared_file") || path29.extname(rawPath).length > 0) {
|
|
25406
25424
|
checkParentWritablePath(resolveTargetPath(rawPath), label, findings);
|
|
25407
25425
|
continue;
|
|
25408
25426
|
}
|
|
@@ -25428,7 +25446,7 @@ function checkCodex(config, sourceRoot, configDir, findings, logger, options) {
|
|
|
25428
25446
|
continue;
|
|
25429
25447
|
}
|
|
25430
25448
|
const label = `codex: ${rawPath}`;
|
|
25431
|
-
if (key.endsWith("_shared_file") ||
|
|
25449
|
+
if (key.endsWith("_shared_file") || path29.extname(rawPath).length > 0) {
|
|
25432
25450
|
checkParentWritablePath(resolveTargetPath(rawPath), label, findings);
|
|
25433
25451
|
continue;
|
|
25434
25452
|
}
|
|
@@ -25445,13 +25463,13 @@ function resolveHooksScriptPath(config, sourceRoot, configDir) {
|
|
|
25445
25463
|
scope: "global",
|
|
25446
25464
|
mappings: mappings.platformPaths
|
|
25447
25465
|
});
|
|
25448
|
-
return
|
|
25466
|
+
return path29.join(profile["claude-code"].hooks, "scripts");
|
|
25449
25467
|
} catch {
|
|
25450
25468
|
return resolveTargetPath("~/.agents/hooks/scripts");
|
|
25451
25469
|
}
|
|
25452
25470
|
}
|
|
25453
25471
|
function checkParentWritablePath(targetPath, label, findings) {
|
|
25454
|
-
checkWritablePath(
|
|
25472
|
+
checkWritablePath(path29.dirname(targetPath), `${label} parent`, findings);
|
|
25455
25473
|
}
|
|
25456
25474
|
function checkWritablePath(checkPath, label, findings) {
|
|
25457
25475
|
if (!fs31.existsSync(checkPath)) {
|
|
@@ -25468,7 +25486,7 @@ function walkHookScripts(dir) {
|
|
|
25468
25486
|
if (!fs31.existsSync(dir)) {
|
|
25469
25487
|
return [];
|
|
25470
25488
|
}
|
|
25471
|
-
return fs31.readdirSync(dir).map((entry) =>
|
|
25489
|
+
return fs31.readdirSync(dir).map((entry) => path29.join(dir, entry)).filter((entryPath) => fs31.statSync(entryPath).isFile());
|
|
25472
25490
|
}
|
|
25473
25491
|
function fixManagedHookScriptModes(scriptRoot, sourceRoot, logger) {
|
|
25474
25492
|
if (!fs31.existsSync(scriptRoot)) {
|
|
@@ -25485,16 +25503,16 @@ function fixManagedHookScriptModes(scriptRoot, sourceRoot, logger) {
|
|
|
25485
25503
|
}
|
|
25486
25504
|
}
|
|
25487
25505
|
function hasSymlinkAncestor(targetPath, stopAt) {
|
|
25488
|
-
const relative =
|
|
25489
|
-
|
|
25490
|
-
|
|
25506
|
+
const relative = path29.relative(
|
|
25507
|
+
path29.resolve(stopAt),
|
|
25508
|
+
path29.resolve(targetPath)
|
|
25491
25509
|
);
|
|
25492
|
-
if (relative.startsWith("..") ||
|
|
25510
|
+
if (relative.startsWith("..") || path29.isAbsolute(relative)) {
|
|
25493
25511
|
return false;
|
|
25494
25512
|
}
|
|
25495
|
-
return relative.split(
|
|
25496
|
-
const candidate =
|
|
25497
|
-
|
|
25513
|
+
return relative.split(path29.sep).some((_segment, index, segments) => {
|
|
25514
|
+
const candidate = path29.join(
|
|
25515
|
+
path29.resolve(stopAt),
|
|
25498
25516
|
...segments.slice(0, index + 1)
|
|
25499
25517
|
);
|
|
25500
25518
|
try {
|
|
@@ -25505,8 +25523,8 @@ function hasSymlinkAncestor(targetPath, stopAt) {
|
|
|
25505
25523
|
});
|
|
25506
25524
|
}
|
|
25507
25525
|
function isInside(childPath, parentPath) {
|
|
25508
|
-
const relative =
|
|
25509
|
-
return relative.length === 0 || !relative.startsWith("..") && !
|
|
25526
|
+
const relative = path29.relative(parentPath, childPath);
|
|
25527
|
+
return relative.length === 0 || !relative.startsWith("..") && !path29.isAbsolute(relative);
|
|
25510
25528
|
}
|
|
25511
25529
|
function realPathOrInput2(filePath) {
|
|
25512
25530
|
try {
|
|
@@ -25518,12 +25536,12 @@ function realPathOrInput2(filePath) {
|
|
|
25518
25536
|
|
|
25519
25537
|
// src/commands/init.ts
|
|
25520
25538
|
import fs32 from "fs";
|
|
25521
|
-
import
|
|
25539
|
+
import path30 from "path";
|
|
25522
25540
|
var import_yaml7 = __toESM(require_dist(), 1);
|
|
25523
25541
|
async function runInitCommand(_options, logger) {
|
|
25524
25542
|
const sourceRoot = await dist_default6({
|
|
25525
25543
|
message: "Canonical Tangyr kit root",
|
|
25526
|
-
default:
|
|
25544
|
+
default: path30.resolve("projects/tangyr/agent-coding")
|
|
25527
25545
|
});
|
|
25528
25546
|
const componentCount = [
|
|
25529
25547
|
"CLAUDE.md",
|
|
@@ -25533,7 +25551,7 @@ async function runInitCommand(_options, logger) {
|
|
|
25533
25551
|
"rules",
|
|
25534
25552
|
"hooks"
|
|
25535
25553
|
].filter(
|
|
25536
|
-
(relativePath) => fs32.existsSync(
|
|
25554
|
+
(relativePath) => fs32.existsSync(path30.join(sourceRoot, relativePath))
|
|
25537
25555
|
).length;
|
|
25538
25556
|
const detectedTargets = detectTargets(logger);
|
|
25539
25557
|
const enabledTargets = await dist_default4({
|
|
@@ -25553,7 +25571,7 @@ async function runInitCommand(_options, logger) {
|
|
|
25553
25571
|
value
|
|
25554
25572
|
}))
|
|
25555
25573
|
});
|
|
25556
|
-
const configPath =
|
|
25574
|
+
const configPath = path30.join(sourceRoot, "tangyr.config.yaml");
|
|
25557
25575
|
if (fs32.existsSync(configPath)) {
|
|
25558
25576
|
const overwrite = await dist_default5({
|
|
25559
25577
|
message: `${configPath} exists. Overwrite?`,
|
|
@@ -25608,14 +25626,14 @@ function toConflictPolicy2(value) {
|
|
|
25608
25626
|
|
|
25609
25627
|
// src/commands/install.ts
|
|
25610
25628
|
import fs47 from "fs";
|
|
25611
|
-
import
|
|
25629
|
+
import path48 from "path";
|
|
25612
25630
|
|
|
25613
25631
|
// src/core/channel-state.ts
|
|
25614
25632
|
import fs33 from "fs";
|
|
25615
|
-
import
|
|
25633
|
+
import path31 from "path";
|
|
25616
25634
|
var CHANNEL_STATE_FILENAME = ".tangyr-channels.json";
|
|
25617
25635
|
function stateFilePath(cacheRoot) {
|
|
25618
|
-
return
|
|
25636
|
+
return path31.join(cacheRoot, CHANNEL_STATE_FILENAME);
|
|
25619
25637
|
}
|
|
25620
25638
|
function channelKey(kit, channel) {
|
|
25621
25639
|
return `${kit}/${channel}`;
|
|
@@ -25671,7 +25689,7 @@ function writeChannelSequence(params) {
|
|
|
25671
25689
|
[key]: { sequence, version, seenAt: now.toISOString() }
|
|
25672
25690
|
};
|
|
25673
25691
|
const filePath = stateFilePath(cacheRoot);
|
|
25674
|
-
fs33.mkdirSync(
|
|
25692
|
+
fs33.mkdirSync(path31.dirname(filePath), { recursive: true, mode: 448 });
|
|
25675
25693
|
const tempPath = `${filePath}.${process.pid}.tmp`;
|
|
25676
25694
|
fs33.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
25677
25695
|
`, {
|
|
@@ -25694,7 +25712,7 @@ var DEFAULT_CHANNEL = "stable";
|
|
|
25694
25712
|
|
|
25695
25713
|
// src/core/materialize.ts
|
|
25696
25714
|
import fs34 from "fs";
|
|
25697
|
-
import
|
|
25715
|
+
import path32 from "path";
|
|
25698
25716
|
|
|
25699
25717
|
// src/core/integrity.ts
|
|
25700
25718
|
import crypto3 from "crypto";
|
|
@@ -26030,7 +26048,7 @@ function assertFileWithinCeiling(entryPath, byteLength) {
|
|
|
26030
26048
|
}
|
|
26031
26049
|
var WINDOWS_DRIVE_ABSOLUTE = /^[a-zA-Z]:[\\/]/u;
|
|
26032
26050
|
function sanitizeBundleFilePath(entryPath, stagingDir) {
|
|
26033
|
-
if (
|
|
26051
|
+
if (path32.isAbsolute(entryPath) || WINDOWS_DRIVE_ABSOLUTE.test(entryPath)) {
|
|
26034
26052
|
throw new IntegrityError(
|
|
26035
26053
|
`Bundle file path "${entryPath}" is absolute \u2014 every file inside a bundle must use a relative path (REQ-INT-004).`
|
|
26036
26054
|
);
|
|
@@ -26046,13 +26064,13 @@ function sanitizeBundleFilePath(entryPath, stagingDir) {
|
|
|
26046
26064
|
`Bundle file path "${entryPath}" contains a ".." segment \u2014 directory traversal is rejected (REQ-INT-004).`
|
|
26047
26065
|
);
|
|
26048
26066
|
}
|
|
26049
|
-
const resolved =
|
|
26067
|
+
const resolved = path32.resolve(stagingDir, entryPath);
|
|
26050
26068
|
if (resolved === stagingDir) {
|
|
26051
26069
|
throw new IntegrityError(
|
|
26052
26070
|
`Bundle file path "${entryPath}" resolves to the staging directory itself \u2014 every entry must be a file inside it (REQ-INT-004).`
|
|
26053
26071
|
);
|
|
26054
26072
|
}
|
|
26055
|
-
if (!resolved.startsWith(stagingDir +
|
|
26073
|
+
if (!resolved.startsWith(stagingDir + path32.sep)) {
|
|
26056
26074
|
throw new IntegrityError(
|
|
26057
26075
|
`Bundle file path "${entryPath}" escapes the staging directory \u2014 refusing to write (REQ-INT-004).`
|
|
26058
26076
|
);
|
|
@@ -26104,7 +26122,7 @@ function verifyBundleFileHashes(bundle) {
|
|
|
26104
26122
|
function writeStagedFiles(stagingDir, decoded) {
|
|
26105
26123
|
for (const [rawPath, bytes] of decoded) {
|
|
26106
26124
|
const target = sanitizeBundleFilePath(rawPath, stagingDir);
|
|
26107
|
-
fs34.mkdirSync(
|
|
26125
|
+
fs34.mkdirSync(path32.dirname(target), { recursive: true, mode: 448 });
|
|
26108
26126
|
let existingStat;
|
|
26109
26127
|
try {
|
|
26110
26128
|
existingStat = fs34.lstatSync(target);
|
|
@@ -26516,7 +26534,7 @@ function sleep(ms2) {
|
|
|
26516
26534
|
|
|
26517
26535
|
// src/core/contested-instructions.ts
|
|
26518
26536
|
import fs35 from "fs";
|
|
26519
|
-
import
|
|
26537
|
+
import path33 from "path";
|
|
26520
26538
|
var FOLDS_RULES_INTO_INSTRUCTIONS = {
|
|
26521
26539
|
codex: "its own rules slot takes only exec-policy rules, so guidance rules are folded in",
|
|
26522
26540
|
opencode: "it has no rules slot of its own, so every rule is folded in"
|
|
@@ -26535,7 +26553,7 @@ function markerTarget(destination) {
|
|
|
26535
26553
|
function findContestedInstructions(instructionsByTarget) {
|
|
26536
26554
|
const byPath = /* @__PURE__ */ new Map();
|
|
26537
26555
|
for (const [target, destination] of instructionsByTarget) {
|
|
26538
|
-
const resolved =
|
|
26556
|
+
const resolved = path33.resolve(destination);
|
|
26539
26557
|
byPath.set(resolved, [...byPath.get(resolved) ?? [], target]);
|
|
26540
26558
|
}
|
|
26541
26559
|
const contested = [];
|
|
@@ -26597,14 +26615,14 @@ function instructionsByActiveTarget(tools, scope, projectRoot, mappings) {
|
|
|
26597
26615
|
}
|
|
26598
26616
|
}
|
|
26599
26617
|
if (scope === "project" && projectRoot && tools.includes("copilot")) {
|
|
26600
|
-
byTarget.set("copilot",
|
|
26618
|
+
byTarget.set("copilot", path33.join(projectRoot, "AGENTS.md"));
|
|
26601
26619
|
}
|
|
26602
26620
|
return byTarget;
|
|
26603
26621
|
}
|
|
26604
26622
|
|
|
26605
26623
|
// src/core/kit-coverage.ts
|
|
26606
26624
|
import fs36 from "fs";
|
|
26607
|
-
import
|
|
26625
|
+
import path34 from "path";
|
|
26608
26626
|
var COVERED_CATEGORIES = [
|
|
26609
26627
|
"agents",
|
|
26610
26628
|
"commands",
|
|
@@ -26682,7 +26700,7 @@ function inSlot(slotPath, name) {
|
|
|
26682
26700
|
return true;
|
|
26683
26701
|
}
|
|
26684
26702
|
return entries.some((entry) => {
|
|
26685
|
-
const full =
|
|
26703
|
+
const full = path34.join(slotPath, entry);
|
|
26686
26704
|
try {
|
|
26687
26705
|
if (!fs36.statSync(full).isFile()) {
|
|
26688
26706
|
return false;
|
|
@@ -26763,7 +26781,7 @@ function explain(target, category, surfaces, hasSurface, contestedByPath, lossRe
|
|
|
26763
26781
|
return `${target} has no ${category} surface in this scope`;
|
|
26764
26782
|
}
|
|
26765
26783
|
if (FOLDS_INTO_INSTRUCTIONS.has(category) && surfaces.instructions) {
|
|
26766
|
-
const contested = contestedByPath.get(
|
|
26784
|
+
const contested = contestedByPath.get(path34.resolve(surfaces.instructions));
|
|
26767
26785
|
if (contested && contested.survivor !== null && contested.survivor !== target) {
|
|
26768
26786
|
return `folded into ${display(surfaces.instructions, projectRoot)}, which ${contested.survivor} wrote last`;
|
|
26769
26787
|
}
|
|
@@ -26779,7 +26797,7 @@ function display(target, projectRoot) {
|
|
|
26779
26797
|
if (!projectRoot) {
|
|
26780
26798
|
return target;
|
|
26781
26799
|
}
|
|
26782
|
-
const relative =
|
|
26800
|
+
const relative = path34.relative(projectRoot, target);
|
|
26783
26801
|
return relative.startsWith("..") ? target : relative;
|
|
26784
26802
|
}
|
|
26785
26803
|
function reportKitCoverage(coverage, logger) {
|
|
@@ -26857,7 +26875,7 @@ function declaredComponents(kit) {
|
|
|
26857
26875
|
|
|
26858
26876
|
// src/adapters/claude-code.ts
|
|
26859
26877
|
import fs39 from "fs";
|
|
26860
|
-
import
|
|
26878
|
+
import path38 from "path";
|
|
26861
26879
|
|
|
26862
26880
|
// src/core/shim.ts
|
|
26863
26881
|
import crypto4 from "crypto";
|
|
@@ -26880,7 +26898,7 @@ ${SHIM_BODY}`;
|
|
|
26880
26898
|
|
|
26881
26899
|
// src/core/skills-slot.ts
|
|
26882
26900
|
import fs37 from "fs";
|
|
26883
|
-
import
|
|
26901
|
+
import path35 from "path";
|
|
26884
26902
|
function isForeignSkillsSlotSymlink(destination, config, sourceRoot, source) {
|
|
26885
26903
|
if (!isSymlinkPath(destination)) {
|
|
26886
26904
|
return false;
|
|
@@ -26921,7 +26939,7 @@ function syncSkillsSlot(sync) {
|
|
|
26921
26939
|
if (isLegacyWholesaleSymlink) {
|
|
26922
26940
|
for (const name of foreignSkillNames(source, declaredNames)) {
|
|
26923
26941
|
logger.info(
|
|
26924
|
-
`[dry-run] skills: migrate foreign skill ${
|
|
26942
|
+
`[dry-run] skills: migrate foreign skill ${path35.join(source, name)} -> ${path35.join(destination, name)}`
|
|
26925
26943
|
);
|
|
26926
26944
|
}
|
|
26927
26945
|
logger.info(
|
|
@@ -26929,9 +26947,9 @@ function syncSkillsSlot(sync) {
|
|
|
26929
26947
|
);
|
|
26930
26948
|
}
|
|
26931
26949
|
for (const name of declaredNames ?? listSkillDirNames(source)) {
|
|
26932
|
-
const skillDestination =
|
|
26950
|
+
const skillDestination = path35.join(destination, name);
|
|
26933
26951
|
logger.info(
|
|
26934
|
-
`[dry-run] skills: symlink ${
|
|
26952
|
+
`[dry-run] skills: symlink ${path35.join(source, name)} -> ${skillDestination}`
|
|
26935
26953
|
);
|
|
26936
26954
|
outcomes2.push({
|
|
26937
26955
|
component: "skills",
|
|
@@ -26958,8 +26976,8 @@ function syncSkillsSlot(sync) {
|
|
|
26958
26976
|
}
|
|
26959
26977
|
function syncSingleSkill(sync, name) {
|
|
26960
26978
|
const { config, sourceRoot, source, destination } = sync;
|
|
26961
|
-
const skillSource =
|
|
26962
|
-
const skillDestination =
|
|
26979
|
+
const skillSource = path35.join(source, name);
|
|
26980
|
+
const skillDestination = path35.join(destination, name);
|
|
26963
26981
|
if (!fs37.existsSync(skillSource)) {
|
|
26964
26982
|
return {
|
|
26965
26983
|
component: "skills",
|
|
@@ -26990,8 +27008,8 @@ function migrateWholesaleSkillsSymlink(source, destination, declaredNames, logge
|
|
|
26990
27008
|
fs37.unlinkSync(destination);
|
|
26991
27009
|
ensureDir(destination);
|
|
26992
27010
|
for (const name of foreignNames) {
|
|
26993
|
-
const from =
|
|
26994
|
-
const to =
|
|
27011
|
+
const from = path35.join(source, name);
|
|
27012
|
+
const to = path35.join(destination, name);
|
|
26995
27013
|
if (fs37.existsSync(to)) {
|
|
26996
27014
|
logger.warn(
|
|
26997
27015
|
`skills migration: ${to} already exists \u2014 skipping ${from} to avoid overwrite. Nothing in the kit was changed.`
|
|
@@ -27033,23 +27051,23 @@ function isSymlinkTo2(linkPath, source) {
|
|
|
27033
27051
|
}
|
|
27034
27052
|
|
|
27035
27053
|
// src/core/hook-scripts.ts
|
|
27036
|
-
import
|
|
27054
|
+
import path36 from "path";
|
|
27037
27055
|
function hookScriptsDir(bridge, target, projectRoot) {
|
|
27038
27056
|
const globalBridge = resolveTargetPath("~/.agents/hooks");
|
|
27039
|
-
if (
|
|
27057
|
+
if (path36.resolve(bridge) === path36.resolve(globalBridge)) {
|
|
27040
27058
|
return { prefix: GLOBAL_HOOK_SCRIPTS_DIR, machineLocal: false };
|
|
27041
27059
|
}
|
|
27042
|
-
const relative =
|
|
27043
|
-
const insideProject = !relative.startsWith("..") && !
|
|
27060
|
+
const relative = path36.relative(projectRoot ?? process.cwd(), bridge);
|
|
27061
|
+
const insideProject = !relative.startsWith("..") && !path36.isAbsolute(relative) && relative !== "";
|
|
27044
27062
|
const variable = PROJECT_DIR_VARIABLE[target];
|
|
27045
27063
|
if (insideProject && variable) {
|
|
27046
|
-
const posix =
|
|
27047
|
-
relative.split(
|
|
27064
|
+
const posix = path36.posix.join(
|
|
27065
|
+
relative.split(path36.sep).join("/"),
|
|
27048
27066
|
"scripts"
|
|
27049
27067
|
);
|
|
27050
27068
|
return { prefix: `$${variable.slice(1)}/${posix}`, machineLocal: false };
|
|
27051
27069
|
}
|
|
27052
|
-
return { prefix:
|
|
27070
|
+
return { prefix: path36.join(bridge, "scripts"), machineLocal: true };
|
|
27053
27071
|
}
|
|
27054
27072
|
var PROJECT_DIR_VARIABLE = {
|
|
27055
27073
|
"claude-code": "$CLAUDE_PROJECT_DIR"
|
|
@@ -27060,18 +27078,18 @@ function machineLocalScriptPathNotice(target, prefix) {
|
|
|
27060
27078
|
|
|
27061
27079
|
// src/core/instructions-source.ts
|
|
27062
27080
|
import fs38 from "fs";
|
|
27063
|
-
import
|
|
27081
|
+
import path37 from "path";
|
|
27064
27082
|
var PORTABLE_INSTRUCTIONS_NAME = "AGENTS.md";
|
|
27065
27083
|
var InstructionsSourceMissingError = class extends Error {
|
|
27066
27084
|
constructor(kitRoot, expected, declaredBy) {
|
|
27067
27085
|
super(
|
|
27068
|
-
`${
|
|
27086
|
+
`${path37.join(kitRoot, expected)}: instructions source not found (declared by ${declaredBy}). To fix: create that file, or point '${declaredBy}' at the file this kit actually carries. With neither declaration, the kit's ${DEFAULT_ENTRYPOINT} or ${PORTABLE_INSTRUCTIONS_NAME} is used.`
|
|
27069
27087
|
);
|
|
27070
27088
|
this.name = "InstructionsSourceMissingError";
|
|
27071
27089
|
}
|
|
27072
27090
|
};
|
|
27073
27091
|
function normalizeLabel(kitRoot, file) {
|
|
27074
|
-
return
|
|
27092
|
+
return path37.relative(kitRoot, file).split(path37.sep).join("/");
|
|
27075
27093
|
}
|
|
27076
27094
|
function isExplicitOverride(configured) {
|
|
27077
27095
|
const normalize = (value) => value.replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
@@ -27080,7 +27098,7 @@ function isExplicitOverride(configured) {
|
|
|
27080
27098
|
function resolveInstructionsSource(kitRoot, config) {
|
|
27081
27099
|
const configured = config.source.instructions;
|
|
27082
27100
|
if (isExplicitOverride(configured)) {
|
|
27083
|
-
const file =
|
|
27101
|
+
const file = path37.resolve(kitRoot, configured);
|
|
27084
27102
|
if (!fs38.existsSync(file)) {
|
|
27085
27103
|
throw new InstructionsSourceMissingError(
|
|
27086
27104
|
kitRoot,
|
|
@@ -27096,7 +27114,7 @@ function resolveInstructionsSource(kitRoot, config) {
|
|
|
27096
27114
|
}
|
|
27097
27115
|
const declared = resolveKitEntrypointName(kitRoot);
|
|
27098
27116
|
if (declared !== void 0) {
|
|
27099
|
-
const file =
|
|
27117
|
+
const file = path37.resolve(kitRoot, declared);
|
|
27100
27118
|
if (!fs38.existsSync(file)) {
|
|
27101
27119
|
throw new InstructionsSourceMissingError(
|
|
27102
27120
|
kitRoot,
|
|
@@ -27111,12 +27129,12 @@ function resolveInstructionsSource(kitRoot, config) {
|
|
|
27111
27129
|
};
|
|
27112
27130
|
}
|
|
27113
27131
|
for (const name of [DEFAULT_ENTRYPOINT, PORTABLE_INSTRUCTIONS_NAME]) {
|
|
27114
|
-
const file =
|
|
27132
|
+
const file = path37.resolve(kitRoot, name);
|
|
27115
27133
|
if (fs38.existsSync(file)) {
|
|
27116
27134
|
return { file, label: name, origin: "convention" };
|
|
27117
27135
|
}
|
|
27118
27136
|
}
|
|
27119
|
-
const legacy =
|
|
27137
|
+
const legacy = path37.resolve(kitRoot, LEGACY_ENTRYPOINT);
|
|
27120
27138
|
if (fs38.existsSync(legacy)) {
|
|
27121
27139
|
return {
|
|
27122
27140
|
file: legacy,
|
|
@@ -27129,7 +27147,7 @@ function resolveInstructionsSource(kitRoot, config) {
|
|
|
27129
27147
|
}
|
|
27130
27148
|
function instructionsSourcePath(kitRoot, config) {
|
|
27131
27149
|
const resolved = resolveInstructionsSource(kitRoot, config);
|
|
27132
|
-
return resolved ? resolved.file :
|
|
27150
|
+
return resolved ? resolved.file : path37.resolve(kitRoot, config.source.instructions);
|
|
27133
27151
|
}
|
|
27134
27152
|
function instructionsSourceLabel(kitRoot, config) {
|
|
27135
27153
|
const resolved = resolveInstructionsSource(kitRoot, config);
|
|
@@ -27250,7 +27268,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
27250
27268
|
if (!shouldSkipComponent(options, "hooks")) {
|
|
27251
27269
|
outcomes.push(
|
|
27252
27270
|
syncHookScriptsBridge({
|
|
27253
|
-
source:
|
|
27271
|
+
source: path38.resolve(sourceRoot, config.source.hooks),
|
|
27254
27272
|
destination: profile.hook_scripts,
|
|
27255
27273
|
config,
|
|
27256
27274
|
sourceRoot,
|
|
@@ -27311,13 +27329,13 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
27311
27329
|
}
|
|
27312
27330
|
function syncProviderLoss(config, sourceRoot, mappings, lossReport) {
|
|
27313
27331
|
if (!mappings.modelTiers.custom_provider) return;
|
|
27314
|
-
const agentsDir =
|
|
27332
|
+
const agentsDir = path38.join(sourceRoot, config.source.agents);
|
|
27315
27333
|
if (!fs39.existsSync(agentsDir)) return;
|
|
27316
|
-
for (const agentFile of ts(
|
|
27334
|
+
for (const agentFile of ts(path38.join(agentsDir, "*.md")).sort()) {
|
|
27317
27335
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
27318
27336
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
27319
27337
|
if (hasProvider) {
|
|
27320
|
-
const basename =
|
|
27338
|
+
const basename = path38.basename(agentFile);
|
|
27321
27339
|
addLoss(lossReport, "claude-code", "agents", {
|
|
27322
27340
|
source: `agents/${basename}`,
|
|
27323
27341
|
fields: [
|
|
@@ -27367,7 +27385,7 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
27367
27385
|
origin: "tangyr-managed"
|
|
27368
27386
|
});
|
|
27369
27387
|
writeManifest(scopePath, manifest);
|
|
27370
|
-
fs39.mkdirSync(
|
|
27388
|
+
fs39.mkdirSync(path38.dirname(shimPath), { recursive: true });
|
|
27371
27389
|
fs39.writeFileSync(shimPath, shimContent);
|
|
27372
27390
|
logger?.verbose(`instructions-shim: wrote @AGENTS.md shim -> ${shimPath}`);
|
|
27373
27391
|
return;
|
|
@@ -27399,7 +27417,7 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
27399
27417
|
logger?.verbose(`instructions-shim: backed up and replaced -> ${shimPath}`);
|
|
27400
27418
|
}
|
|
27401
27419
|
function syncDirectComponent(config, sourceRoot, options, logger, directComponent, manifest, scopePath) {
|
|
27402
|
-
const source = directComponent.sourceKey === "instructions" ? instructionsSourcePath(sourceRoot, config) :
|
|
27420
|
+
const source = directComponent.sourceKey === "instructions" ? instructionsSourcePath(sourceRoot, config) : path38.resolve(sourceRoot, config.source[directComponent.sourceKey]);
|
|
27403
27421
|
const sourceLabel = directComponent.sourceKey === "instructions" ? instructionsSourceLabel(sourceRoot, config) : config.source[directComponent.sourceKey];
|
|
27404
27422
|
const destination = directComponent.destination;
|
|
27405
27423
|
if (!fs39.existsSync(source)) {
|
|
@@ -27436,7 +27454,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
27436
27454
|
} else if (artifactClass === "managed-compiled") {
|
|
27437
27455
|
fs39.unlinkSync(destination);
|
|
27438
27456
|
}
|
|
27439
|
-
ensureDir(
|
|
27457
|
+
ensureDir(path38.dirname(destination));
|
|
27440
27458
|
createRelativeSymlink(source, destination, directComponent.type, {
|
|
27441
27459
|
logger,
|
|
27442
27460
|
provenanceMarker: directComponent.type === "file" ? formatProvenanceMarker(
|
|
@@ -27456,7 +27474,7 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
27456
27474
|
return syncSkillsSlot({
|
|
27457
27475
|
config,
|
|
27458
27476
|
sourceRoot,
|
|
27459
|
-
source:
|
|
27477
|
+
source: path38.resolve(sourceRoot, config.source.skills),
|
|
27460
27478
|
destination,
|
|
27461
27479
|
dryRun: options.dryRun,
|
|
27462
27480
|
logger,
|
|
@@ -27504,7 +27522,7 @@ function syncHooks(config, sourceRoot, options, logger, destination, scriptsBrid
|
|
|
27504
27522
|
};
|
|
27505
27523
|
}
|
|
27506
27524
|
function syncMcp(config, sourceRoot, options, logger, destination, manifest) {
|
|
27507
|
-
const source =
|
|
27525
|
+
const source = path38.resolve(sourceRoot, config.source.mcp);
|
|
27508
27526
|
if (!fs39.existsSync(source)) {
|
|
27509
27527
|
return skippedMissingSource("mcp", source);
|
|
27510
27528
|
}
|
|
@@ -27540,7 +27558,7 @@ function syncMcp(config, sourceRoot, options, logger, destination, manifest) {
|
|
|
27540
27558
|
};
|
|
27541
27559
|
}
|
|
27542
27560
|
function syncSettings(config, sourceRoot, options, logger, destination, manifest) {
|
|
27543
|
-
const source =
|
|
27561
|
+
const source = path38.resolve(sourceRoot, config.source.settings);
|
|
27544
27562
|
if (!fs39.existsSync(source)) {
|
|
27545
27563
|
return skippedMissingSource("settings", source);
|
|
27546
27564
|
}
|
|
@@ -27646,12 +27664,12 @@ function isRecord3(value) {
|
|
|
27646
27664
|
var TOML3 = __toESM(require_toml(), 1);
|
|
27647
27665
|
import crypto6 from "crypto";
|
|
27648
27666
|
import fs42 from "fs";
|
|
27649
|
-
import
|
|
27667
|
+
import path42 from "path";
|
|
27650
27668
|
|
|
27651
27669
|
// src/compiler/agents.ts
|
|
27652
27670
|
var TOML = __toESM(require_toml(), 1);
|
|
27653
27671
|
var import_yaml8 = __toESM(require_dist(), 1);
|
|
27654
|
-
import
|
|
27672
|
+
import path39 from "path";
|
|
27655
27673
|
var writeCapabilityClasses = /* @__PURE__ */ new Set(["filesystem-write", "shell-execution"]);
|
|
27656
27674
|
var copilotToolAliasesByClass = {
|
|
27657
27675
|
delegation: "agent",
|
|
@@ -27663,7 +27681,7 @@ var copilotToolAliasesByClass = {
|
|
|
27663
27681
|
};
|
|
27664
27682
|
function compileAgent(sourceFile, target, mappings, extensions, lossReport) {
|
|
27665
27683
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
27666
|
-
const relativeSource = `agents/${
|
|
27684
|
+
const relativeSource = `agents/${path39.basename(sourceFile)}`;
|
|
27667
27685
|
if (target === "opencode") {
|
|
27668
27686
|
return compileOpenCodeAgent(
|
|
27669
27687
|
sourceFile,
|
|
@@ -27704,7 +27722,7 @@ function compileAgent(sourceFile, target, mappings, extensions, lossReport) {
|
|
|
27704
27722
|
mappings,
|
|
27705
27723
|
lossReport
|
|
27706
27724
|
);
|
|
27707
|
-
const overlayKey = `agents/${
|
|
27725
|
+
const overlayKey = `agents/${path39.basename(sourceFile, ".md")}.${target}.yaml`;
|
|
27708
27726
|
const targetFields = {
|
|
27709
27727
|
...translated.fields,
|
|
27710
27728
|
...extensions[overlayKey] ?? {}
|
|
@@ -27738,7 +27756,7 @@ ${TOML.stringify({
|
|
|
27738
27756
|
function compileOpenCodeAgent(sourceFile, data, body, relativeSource, lossReport) {
|
|
27739
27757
|
if (typeof data.description !== "string" || data.description.trim() === "") {
|
|
27740
27758
|
throw new Error(
|
|
27741
|
-
`${
|
|
27759
|
+
`${path39.basename(sourceFile)}: OpenCode agent requires a non-empty description field`
|
|
27742
27760
|
);
|
|
27743
27761
|
}
|
|
27744
27762
|
const frontmatter = {
|
|
@@ -27792,7 +27810,7 @@ function compileOpenCodeAgent(sourceFile, data, body, relativeSource, lossReport
|
|
|
27792
27810
|
"permission",
|
|
27793
27811
|
"permission-coarsening"
|
|
27794
27812
|
),
|
|
27795
|
-
detail: `${
|
|
27813
|
+
detail: `${path39.basename(sourceFile)}: per-tool permission '${tool}' mapped to coarse allow|deny action`
|
|
27796
27814
|
}
|
|
27797
27815
|
]
|
|
27798
27816
|
});
|
|
@@ -27817,7 +27835,7 @@ ${(0, import_yaml8.stringify)(frontmatter).trim()}
|
|
|
27817
27835
|
function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport) {
|
|
27818
27836
|
if (typeof data.description !== "string" || data.description.trim() === "") {
|
|
27819
27837
|
throw new Error(
|
|
27820
|
-
`${
|
|
27838
|
+
`${path39.basename(sourceFile)}: Cursor agent requires a non-empty description field`
|
|
27821
27839
|
);
|
|
27822
27840
|
}
|
|
27823
27841
|
const frontmatter = {
|
|
@@ -27854,7 +27872,7 @@ function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport)
|
|
|
27854
27872
|
"permission",
|
|
27855
27873
|
"permission-coarsening"
|
|
27856
27874
|
),
|
|
27857
|
-
detail: `${
|
|
27875
|
+
detail: `${path39.basename(sourceFile)}: per-agent tool allow set coarsened to readonly=${readonly} boolean (Cursor only exposes readonly control)`
|
|
27858
27876
|
}
|
|
27859
27877
|
]
|
|
27860
27878
|
});
|
|
@@ -27873,7 +27891,7 @@ function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport)
|
|
|
27873
27891
|
"provider",
|
|
27874
27892
|
"provider-not-representable"
|
|
27875
27893
|
),
|
|
27876
|
-
detail: `${
|
|
27894
|
+
detail: `${path39.basename(sourceFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
27877
27895
|
}
|
|
27878
27896
|
]
|
|
27879
27897
|
});
|
|
@@ -27905,7 +27923,7 @@ function compileClineAgent(sourceFile, _data, _body, relativeSource, lossReport)
|
|
|
27905
27923
|
"persona",
|
|
27906
27924
|
"persona-not-representable"
|
|
27907
27925
|
),
|
|
27908
|
-
detail: `${
|
|
27926
|
+
detail: `${path39.basename(sourceFile)}: Cline has no committable per-agent persona file for the VSCode extension target; configure the agent through Cline Settings \u2192 Agent.`
|
|
27909
27927
|
}
|
|
27910
27928
|
]
|
|
27911
27929
|
});
|
|
@@ -27932,7 +27950,14 @@ function translateAgentFields(sourceFile, sourceFields, target, mappings, lossRe
|
|
|
27932
27950
|
);
|
|
27933
27951
|
}
|
|
27934
27952
|
if (target === "codex") {
|
|
27935
|
-
|
|
27953
|
+
const sandbox = deriveCodexSandbox(sourceFields.tools, mappings);
|
|
27954
|
+
Object.assign(translated, sandbox);
|
|
27955
|
+
recordCodexToolCoarsening(
|
|
27956
|
+
sourceFile,
|
|
27957
|
+
sourceFields.tools,
|
|
27958
|
+
sandbox.sandbox_mode,
|
|
27959
|
+
losses
|
|
27960
|
+
);
|
|
27936
27961
|
const model = typeof sourceFields.model === "string" ? sourceFields.model : void 0;
|
|
27937
27962
|
const tier = model ? mappings.modelTiers.tiers[model] : void 0;
|
|
27938
27963
|
if (tier) {
|
|
@@ -27953,7 +27978,7 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
27953
27978
|
field,
|
|
27954
27979
|
"model-not-representable"
|
|
27955
27980
|
),
|
|
27956
|
-
detail: `${
|
|
27981
|
+
detail: `${path39.basename(sourceFile)}: model tier '${String(value)}' has no stable Copilot model literal; omitted so VS Code uses the selected model.`
|
|
27957
27982
|
});
|
|
27958
27983
|
return;
|
|
27959
27984
|
}
|
|
@@ -27971,9 +27996,9 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
27971
27996
|
lossReport,
|
|
27972
27997
|
target,
|
|
27973
27998
|
"agents",
|
|
27974
|
-
`agents/${
|
|
27999
|
+
`agents/${path39.basename(sourceFile)}`,
|
|
27975
28000
|
"info",
|
|
27976
|
-
`${
|
|
28001
|
+
`${path39.basename(sourceFile)}: ${field} is delivered through another managed surface.`
|
|
27977
28002
|
);
|
|
27978
28003
|
return;
|
|
27979
28004
|
}
|
|
@@ -27982,7 +28007,7 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
27982
28007
|
field,
|
|
27983
28008
|
action: entryType,
|
|
27984
28009
|
severity: resolveLossSeverity("agent-field", field, entryType),
|
|
27985
|
-
detail: `${
|
|
28010
|
+
detail: `${path39.basename(sourceFile)}: ${field} has no emitted field for this target.`
|
|
27986
28011
|
});
|
|
27987
28012
|
}
|
|
27988
28013
|
function mapToolsToCapabilities(value, mappings) {
|
|
@@ -27995,6 +28020,27 @@ function mapToolsToCapabilities(value, mappings) {
|
|
|
27995
28020
|
)
|
|
27996
28021
|
).sort();
|
|
27997
28022
|
}
|
|
28023
|
+
function recordCodexToolCoarsening(sourceFile, tools, sandboxMode, losses) {
|
|
28024
|
+
const declared = normalizeToolList(tools);
|
|
28025
|
+
if (declared.length === 0) {
|
|
28026
|
+
return;
|
|
28027
|
+
}
|
|
28028
|
+
losses.push({
|
|
28029
|
+
field: "tools",
|
|
28030
|
+
action: "permission-coarsening",
|
|
28031
|
+
// `warning`, against the type's `error` default, and deliberately. The
|
|
28032
|
+
// default is set by the sites where a permission rule cannot be enforced at
|
|
28033
|
+
// all — a safety boundary that does not survive. Here the boundary does
|
|
28034
|
+
// survive, in a coarser form: the agent still runs under a posture, and no
|
|
28035
|
+
// manual step or kit change can make Codex hold a per-agent tool list.
|
|
28036
|
+
//
|
|
28037
|
+
// An error every kit with agents would hit on every run is an error nobody
|
|
28038
|
+
// reads, and the exit code it forces teaches `--ignore-errors`, which is
|
|
28039
|
+
// how the losses that ARE actionable get missed.
|
|
28040
|
+
severity: "warning",
|
|
28041
|
+
detail: `${path39.basename(sourceFile)}: Codex has no per-agent tool allow set \u2014 ${declared.join(", ")} becomes sandbox_mode = "${String(sandboxMode)}", so agents with different tool sets that share a posture become indistinguishable.`
|
|
28042
|
+
});
|
|
28043
|
+
}
|
|
27998
28044
|
function deriveCodexSandbox(value, mappings) {
|
|
27999
28045
|
const classes = new Set(
|
|
28000
28046
|
normalizeToolList(value).map(
|
|
@@ -28413,12 +28459,12 @@ function addHookLoss(lossReport, target, eventName, sourceLabel, severity, reaso
|
|
|
28413
28459
|
// src/compiler/command-as-skill.ts
|
|
28414
28460
|
var import_yaml9 = __toESM(require_dist(), 1);
|
|
28415
28461
|
import fs40 from "fs";
|
|
28416
|
-
import
|
|
28462
|
+
import path40 from "path";
|
|
28417
28463
|
var CARRIED_OVER = ["argument-hint", "agent", "launch"];
|
|
28418
28464
|
function compileCommandAsSkill(commandFile, target) {
|
|
28419
|
-
const name =
|
|
28465
|
+
const name = path40.basename(commandFile, ".md");
|
|
28420
28466
|
const { data, body } = parseMarkdownFrontmatter(commandFile);
|
|
28421
|
-
const relativeSource = `commands/${
|
|
28467
|
+
const relativeSource = `commands/${path40.basename(commandFile)}`;
|
|
28422
28468
|
const description = typeof data.description === "string" && data.description.trim().length > 0 ? data.description.trim() : `The ${name} command.`;
|
|
28423
28469
|
const frontmatter = { name, description };
|
|
28424
28470
|
for (const key of CARRIED_OVER) {
|
|
@@ -28445,7 +28491,7 @@ function compileCommandsAsSkills(commandsRoot, target) {
|
|
|
28445
28491
|
return [];
|
|
28446
28492
|
}
|
|
28447
28493
|
return fs40.readdirSync(commandsRoot).filter((entry) => entry.endsWith(".md")).sort().map(
|
|
28448
|
-
(entry) => compileCommandAsSkill(
|
|
28494
|
+
(entry) => compileCommandAsSkill(path40.join(commandsRoot, entry), target)
|
|
28449
28495
|
);
|
|
28450
28496
|
}
|
|
28451
28497
|
|
|
@@ -28728,7 +28774,7 @@ function compileOpenCodeMcp(sourceMcpJson, lossReport, sourceLabel) {
|
|
|
28728
28774
|
}
|
|
28729
28775
|
|
|
28730
28776
|
// src/compiler/rules.ts
|
|
28731
|
-
import
|
|
28777
|
+
import path41 from "path";
|
|
28732
28778
|
var import_yaml10 = __toESM(require_dist(), 1);
|
|
28733
28779
|
import fs41 from "fs";
|
|
28734
28780
|
function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
@@ -28749,13 +28795,13 @@ function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
|
28749
28795
|
}
|
|
28750
28796
|
const appendixParts = [];
|
|
28751
28797
|
const dotRulesFiles = [];
|
|
28752
|
-
for (const ruleFile of ts(
|
|
28798
|
+
for (const ruleFile of ts(path41.join(sourceRulesDir, "*.md")).sort()) {
|
|
28753
28799
|
const parsed = parseRule(ruleFile);
|
|
28754
|
-
const name =
|
|
28800
|
+
const name = path41.basename(ruleFile, ".md");
|
|
28755
28801
|
if (parsed.mode === "exec-policy") {
|
|
28756
28802
|
dotRulesFiles.push({
|
|
28757
28803
|
name: `${name}.rules`,
|
|
28758
|
-
content: `${formatProvenanceMarker("toml", `rules/${
|
|
28804
|
+
content: `${formatProvenanceMarker("toml", `rules/${path41.basename(ruleFile)}`, computeSourceHash(ruleFile), "codex")}
|
|
28759
28805
|
${parsed.body}`
|
|
28760
28806
|
});
|
|
28761
28807
|
continue;
|
|
@@ -28764,7 +28810,7 @@ ${parsed.body}`
|
|
|
28764
28810
|
|
|
28765
28811
|
${parsed.body.trim()}`);
|
|
28766
28812
|
addLoss(lossReport, "codex", "rules", {
|
|
28767
|
-
source: `rules/${
|
|
28813
|
+
source: `rules/${path41.basename(ruleFile)}`,
|
|
28768
28814
|
fields: [
|
|
28769
28815
|
{
|
|
28770
28816
|
field: "mode",
|
|
@@ -28774,7 +28820,7 @@ ${parsed.body.trim()}`);
|
|
|
28774
28820
|
"mode",
|
|
28775
28821
|
"rule-as-instruction"
|
|
28776
28822
|
),
|
|
28777
|
-
detail: `${
|
|
28823
|
+
detail: `${path41.basename(ruleFile)} is appended to the managed Codex instructions file as guidance.`
|
|
28778
28824
|
}
|
|
28779
28825
|
]
|
|
28780
28826
|
});
|
|
@@ -28806,14 +28852,14 @@ function isRuleMode(value) {
|
|
|
28806
28852
|
}
|
|
28807
28853
|
function compileOpenCodeRules(sourceRulesDir, lossReport) {
|
|
28808
28854
|
const appendixParts = [];
|
|
28809
|
-
for (const ruleFile of ts(
|
|
28855
|
+
for (const ruleFile of ts(path41.join(sourceRulesDir, "*.md")).sort()) {
|
|
28810
28856
|
const parsed = parseRule(ruleFile);
|
|
28811
|
-
const name =
|
|
28857
|
+
const name = path41.basename(ruleFile, ".md");
|
|
28812
28858
|
appendixParts.push(`## ${name}
|
|
28813
28859
|
|
|
28814
28860
|
${parsed.body.trim()}`);
|
|
28815
28861
|
addLoss(lossReport, "opencode", "rules", {
|
|
28816
|
-
source: `rules/${
|
|
28862
|
+
source: `rules/${path41.basename(ruleFile)}`,
|
|
28817
28863
|
fields: [
|
|
28818
28864
|
{
|
|
28819
28865
|
field: "rule",
|
|
@@ -28823,7 +28869,7 @@ ${parsed.body.trim()}`);
|
|
|
28823
28869
|
"rule",
|
|
28824
28870
|
"rule-path-scoping"
|
|
28825
28871
|
),
|
|
28826
|
-
detail: `${
|
|
28872
|
+
detail: `${path41.basename(ruleFile)}: OpenCode has no per-agent rule scoping \u2014 rule appended to its instructions file`
|
|
28827
28873
|
}
|
|
28828
28874
|
]
|
|
28829
28875
|
});
|
|
@@ -28832,9 +28878,9 @@ ${parsed.body.trim()}`);
|
|
|
28832
28878
|
}
|
|
28833
28879
|
function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
28834
28880
|
const dotRulesFiles = [];
|
|
28835
|
-
for (const ruleFile of ts(
|
|
28881
|
+
for (const ruleFile of ts(path41.join(sourceRulesDir, "*.md")).sort()) {
|
|
28836
28882
|
const content = fs41.readFileSync(ruleFile, "utf8");
|
|
28837
|
-
const name =
|
|
28883
|
+
const name = path41.basename(ruleFile, ".md");
|
|
28838
28884
|
let frontmatterData = {};
|
|
28839
28885
|
let body = content;
|
|
28840
28886
|
if (content.startsWith("---\n")) {
|
|
@@ -28863,7 +28909,7 @@ function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
|
28863
28909
|
}
|
|
28864
28910
|
const marker = formatProvenanceMarker(
|
|
28865
28911
|
"markdown",
|
|
28866
|
-
`rules/${
|
|
28912
|
+
`rules/${path41.basename(ruleFile)}`,
|
|
28867
28913
|
computeSourceHash(ruleFile),
|
|
28868
28914
|
"cursor"
|
|
28869
28915
|
);
|
|
@@ -28879,9 +28925,9 @@ ${body}`;
|
|
|
28879
28925
|
}
|
|
28880
28926
|
function compileClineRules(sourceRulesDir, lossReport) {
|
|
28881
28927
|
const dotRulesFiles = [];
|
|
28882
|
-
for (const ruleFile of ts(
|
|
28928
|
+
for (const ruleFile of ts(path41.join(sourceRulesDir, "*.md")).sort()) {
|
|
28883
28929
|
const content = fs41.readFileSync(ruleFile, "utf8");
|
|
28884
|
-
const name =
|
|
28930
|
+
const name = path41.basename(ruleFile, ".md");
|
|
28885
28931
|
let frontmatterData = {};
|
|
28886
28932
|
let body = content;
|
|
28887
28933
|
if (content.startsWith("---\n")) {
|
|
@@ -28898,13 +28944,13 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
28898
28944
|
}
|
|
28899
28945
|
const marker = formatProvenanceMarker(
|
|
28900
28946
|
"markdown",
|
|
28901
|
-
`rules/${
|
|
28947
|
+
`rules/${path41.basename(ruleFile)}`,
|
|
28902
28948
|
computeSourceHash(ruleFile),
|
|
28903
28949
|
"cline"
|
|
28904
28950
|
);
|
|
28905
28951
|
if (frontmatterData.mode === "exec-policy") {
|
|
28906
28952
|
addLoss(lossReport, "cline", "rules", {
|
|
28907
|
-
source: `rules/${
|
|
28953
|
+
source: `rules/${path41.basename(ruleFile)}`,
|
|
28908
28954
|
fields: [
|
|
28909
28955
|
{
|
|
28910
28956
|
field: "mode",
|
|
@@ -28914,7 +28960,7 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
28914
28960
|
"mode",
|
|
28915
28961
|
"rule-mode-downgrade"
|
|
28916
28962
|
),
|
|
28917
|
-
detail: `${
|
|
28963
|
+
detail: `${path41.basename(ruleFile)}: Cline rules have no exec-policy mode; rule emitted as guidance.`
|
|
28918
28964
|
}
|
|
28919
28965
|
]
|
|
28920
28966
|
});
|
|
@@ -28938,8 +28984,8 @@ function compileCopilotRules(sourceRulesDir) {
|
|
|
28938
28984
|
return [];
|
|
28939
28985
|
}
|
|
28940
28986
|
const files = [];
|
|
28941
|
-
for (const ruleFile of ts(
|
|
28942
|
-
const name =
|
|
28987
|
+
for (const ruleFile of ts(path41.join(sourceRulesDir, "*.md")).sort()) {
|
|
28988
|
+
const name = path41.basename(ruleFile, ".md");
|
|
28943
28989
|
const { data } = parseMarkdownFrontmatter(ruleFile);
|
|
28944
28990
|
const { body } = parseRule(ruleFile);
|
|
28945
28991
|
const declared = data.paths;
|
|
@@ -28948,7 +28994,7 @@ function compileCopilotRules(sourceRulesDir) {
|
|
|
28948
28994
|
"---",
|
|
28949
28995
|
`applyTo: ${JSON.stringify(applyTo)}`,
|
|
28950
28996
|
"x-tangyr:",
|
|
28951
|
-
` source: rules/${
|
|
28997
|
+
` source: rules/${path41.basename(ruleFile)}`,
|
|
28952
28998
|
` hash: ${computeSourceHash(ruleFile)}`,
|
|
28953
28999
|
" target: copilot",
|
|
28954
29000
|
"---"
|
|
@@ -28985,7 +29031,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
28985
29031
|
rules: profile.rules
|
|
28986
29032
|
};
|
|
28987
29033
|
const rules = compileRules(
|
|
28988
|
-
|
|
29034
|
+
path42.join(sourceRoot, config.source.rules),
|
|
28989
29035
|
"codex",
|
|
28990
29036
|
mappings,
|
|
28991
29037
|
lossReport
|
|
@@ -29065,7 +29111,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
29065
29111
|
if (!shouldSkipComponent2(options, "hooks")) {
|
|
29066
29112
|
outcomes.push(
|
|
29067
29113
|
syncHookScriptsBridge({
|
|
29068
|
-
source:
|
|
29114
|
+
source: path42.resolve(sourceRoot, config.source.hooks),
|
|
29069
29115
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
29070
29116
|
config,
|
|
29071
29117
|
sourceRoot,
|
|
@@ -29166,9 +29212,9 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
29166
29212
|
function buildProviderTomlSection(config, sourceRoot, mappings, scope, lossReport) {
|
|
29167
29213
|
const cp = mappings.modelTiers.custom_provider;
|
|
29168
29214
|
if (!cp) return "";
|
|
29169
|
-
const agentsDir =
|
|
29215
|
+
const agentsDir = path42.join(sourceRoot, config.source.agents);
|
|
29170
29216
|
if (!fs42.existsSync(agentsDir)) return "";
|
|
29171
|
-
const agentFiles = ts(
|
|
29217
|
+
const agentFiles = ts(path42.join(agentsDir, "*.md")).sort();
|
|
29172
29218
|
const hasProviderAgent = agentFiles.some((agentFile) => {
|
|
29173
29219
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
29174
29220
|
return typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
@@ -29233,7 +29279,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
29233
29279
|
}
|
|
29234
29280
|
];
|
|
29235
29281
|
for (const ruleFile of rules.dotRulesFiles) {
|
|
29236
|
-
const destination =
|
|
29282
|
+
const destination = path42.join(rulesRoot, ruleFile.name);
|
|
29237
29283
|
if (options.dryRun) {
|
|
29238
29284
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
29239
29285
|
outcomes.push({
|
|
@@ -29272,7 +29318,7 @@ function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, lo
|
|
|
29272
29318
|
${agentsAppendix}`.trim();
|
|
29273
29319
|
const marker = formatProvenanceMarker(
|
|
29274
29320
|
"markdown",
|
|
29275
|
-
|
|
29321
|
+
path42.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
29276
29322
|
hashString(composed),
|
|
29277
29323
|
"codex"
|
|
29278
29324
|
);
|
|
@@ -29302,7 +29348,7 @@ function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopeP
|
|
|
29302
29348
|
return syncSkillsSlot({
|
|
29303
29349
|
config,
|
|
29304
29350
|
sourceRoot,
|
|
29305
|
-
source:
|
|
29351
|
+
source: path42.resolve(sourceRoot, config.source.skills),
|
|
29306
29352
|
destination: resolveTargetPath(paths.skills),
|
|
29307
29353
|
dryRun: options.dryRun,
|
|
29308
29354
|
logger,
|
|
@@ -29317,13 +29363,13 @@ function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopeP
|
|
|
29317
29363
|
});
|
|
29318
29364
|
}
|
|
29319
29365
|
function syncCommandsAsSkills(config, sourceRoot, paths, options, _lossReport, logger, manifest, scopePath) {
|
|
29320
|
-
const commandsRoot =
|
|
29366
|
+
const commandsRoot = path42.resolve(sourceRoot, config.source.commands);
|
|
29321
29367
|
if (!fs42.existsSync(commandsRoot)) {
|
|
29322
29368
|
return [skippedMissingSource2("commands", commandsRoot)];
|
|
29323
29369
|
}
|
|
29324
29370
|
const skillsRoot = resolveTargetPath(paths.skills);
|
|
29325
29371
|
return compileCommandsAsSkills(commandsRoot, "codex").map((skill) => {
|
|
29326
|
-
const destination =
|
|
29372
|
+
const destination = path42.join(skillsRoot, skill.name, "SKILL.md");
|
|
29327
29373
|
if (options.dryRun) {
|
|
29328
29374
|
logger.info(
|
|
29329
29375
|
`[dry-run] commands: compile ${skill.relativeSource} -> ${destination}`
|
|
@@ -29349,16 +29395,16 @@ function syncCommandsAsSkills(config, sourceRoot, paths, options, _lossReport, l
|
|
|
29349
29395
|
});
|
|
29350
29396
|
}
|
|
29351
29397
|
function syncAgents(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
29352
|
-
const sourceAgentsRoot =
|
|
29398
|
+
const sourceAgentsRoot = path42.join(sourceRoot, config.source.agents);
|
|
29353
29399
|
if (!fs42.existsSync(sourceAgentsRoot)) {
|
|
29354
29400
|
return [skippedMissingSource2("agents", sourceAgentsRoot)];
|
|
29355
29401
|
}
|
|
29356
|
-
const sourceAgents = ts(
|
|
29402
|
+
const sourceAgents = ts(path42.join(sourceAgentsRoot, "*.md")).sort();
|
|
29357
29403
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
29358
29404
|
return sourceAgents.map((agentFile) => {
|
|
29359
|
-
const destination =
|
|
29405
|
+
const destination = path42.join(
|
|
29360
29406
|
agentsRoot,
|
|
29361
|
-
`${
|
|
29407
|
+
`${path42.basename(agentFile, ".md")}.toml`
|
|
29362
29408
|
);
|
|
29363
29409
|
const compiled = compileAgent(
|
|
29364
29410
|
agentFile,
|
|
@@ -29494,7 +29540,7 @@ function writeCompiledArtifact(component, destination, content, expectedHash, co
|
|
|
29494
29540
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
29495
29541
|
return { component, status: "conflict", path: destination };
|
|
29496
29542
|
}
|
|
29497
|
-
ensureDir(
|
|
29543
|
+
ensureDir(path42.dirname(destination));
|
|
29498
29544
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
29499
29545
|
if (clearedLink !== null) {
|
|
29500
29546
|
logger.verbose(
|
|
@@ -29523,7 +29569,7 @@ ${managedMcpEnd}
|
|
|
29523
29569
|
if (current === next.trimStart()) {
|
|
29524
29570
|
return false;
|
|
29525
29571
|
}
|
|
29526
|
-
ensureDir(
|
|
29572
|
+
ensureDir(path42.dirname(destination));
|
|
29527
29573
|
fs42.writeFileSync(destination, next.trimStart());
|
|
29528
29574
|
return true;
|
|
29529
29575
|
}
|
|
@@ -29598,15 +29644,15 @@ function hashString(value) {
|
|
|
29598
29644
|
// src/adapters/copilot.ts
|
|
29599
29645
|
import crypto7 from "crypto";
|
|
29600
29646
|
import fs43 from "fs";
|
|
29601
|
-
import
|
|
29647
|
+
import path44 from "path";
|
|
29602
29648
|
|
|
29603
29649
|
// src/compiler/commands.ts
|
|
29604
29650
|
var import_yaml11 = __toESM(require_dist(), 1);
|
|
29605
|
-
import
|
|
29651
|
+
import path43 from "path";
|
|
29606
29652
|
function compileCommandPrompt(sourceFile) {
|
|
29607
29653
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
29608
|
-
const relativeSource = `commands/${
|
|
29609
|
-
const fields = promptFrontmatter(data,
|
|
29654
|
+
const relativeSource = `commands/${path43.basename(sourceFile)}`;
|
|
29655
|
+
const fields = promptFrontmatter(data, path43.basename(sourceFile, ".md"));
|
|
29610
29656
|
const marker = formatProvenanceMarker(
|
|
29611
29657
|
"markdown",
|
|
29612
29658
|
relativeSource,
|
|
@@ -29747,7 +29793,7 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
29747
29793
|
if (!shouldSkipComponent3(options, "hooks")) {
|
|
29748
29794
|
outcomes.push(
|
|
29749
29795
|
syncHookScriptsBridge({
|
|
29750
|
-
source:
|
|
29796
|
+
source: path44.resolve(sourceRoot, config.source.hooks),
|
|
29751
29797
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
29752
29798
|
config,
|
|
29753
29799
|
sourceRoot,
|
|
@@ -29828,13 +29874,13 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
29828
29874
|
}
|
|
29829
29875
|
function syncProviderLoss2(config, sourceRoot, mappings, lossReport) {
|
|
29830
29876
|
if (!mappings.modelTiers.custom_provider) return;
|
|
29831
|
-
const agentsDir =
|
|
29877
|
+
const agentsDir = path44.join(sourceRoot, config.source.agents);
|
|
29832
29878
|
if (!fs43.existsSync(agentsDir)) return;
|
|
29833
|
-
for (const agentFile of ts(
|
|
29879
|
+
for (const agentFile of ts(path44.join(agentsDir, "*.md")).sort()) {
|
|
29834
29880
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
29835
29881
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
29836
29882
|
if (hasProvider) {
|
|
29837
|
-
const basename =
|
|
29883
|
+
const basename = path44.basename(agentFile);
|
|
29838
29884
|
addLoss(lossReport, "copilot", "agents", {
|
|
29839
29885
|
source: `agents/${basename}`,
|
|
29840
29886
|
fields: [
|
|
@@ -29867,15 +29913,15 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
29867
29913
|
const contentHash = hashString2(rawContent);
|
|
29868
29914
|
const marker = formatProvenanceMarker(
|
|
29869
29915
|
"markdown",
|
|
29870
|
-
|
|
29916
|
+
path44.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
29871
29917
|
contentHash,
|
|
29872
29918
|
"copilot"
|
|
29873
29919
|
);
|
|
29874
29920
|
const composedContent = `${marker}
|
|
29875
29921
|
${rawContent}`;
|
|
29876
29922
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
29877
|
-
const agentsMdDest =
|
|
29878
|
-
const mirrorDest =
|
|
29923
|
+
const agentsMdDest = path44.resolve(projectRoot, "AGENTS.md");
|
|
29924
|
+
const mirrorDest = path44.resolve(
|
|
29879
29925
|
projectRoot,
|
|
29880
29926
|
".github",
|
|
29881
29927
|
"copilot-instructions.md"
|
|
@@ -29929,7 +29975,7 @@ function writeInstructionsFile(component, destination, content, contentHash, con
|
|
|
29929
29975
|
if (artifactClass === "unmanaged-conflict" && !handleConflict3(destination, config, options, logger, manifest, scopePath)) {
|
|
29930
29976
|
return { component, status: "conflict", path: destination };
|
|
29931
29977
|
}
|
|
29932
|
-
ensureDir(
|
|
29978
|
+
ensureDir(path44.dirname(destination));
|
|
29933
29979
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
29934
29980
|
if (clearedLink !== null) {
|
|
29935
29981
|
logger.verbose(
|
|
@@ -29946,7 +29992,7 @@ function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
29946
29992
|
return syncSkillsSlot({
|
|
29947
29993
|
config,
|
|
29948
29994
|
sourceRoot,
|
|
29949
|
-
source:
|
|
29995
|
+
source: path44.resolve(sourceRoot, config.source.skills),
|
|
29950
29996
|
destination: resolveTargetPath(paths.skills),
|
|
29951
29997
|
dryRun: options.dryRun,
|
|
29952
29998
|
logger,
|
|
@@ -29961,16 +30007,16 @@ function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
29961
30007
|
});
|
|
29962
30008
|
}
|
|
29963
30009
|
function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
29964
|
-
const sourceAgentsRoot =
|
|
30010
|
+
const sourceAgentsRoot = path44.join(sourceRoot, config.source.agents);
|
|
29965
30011
|
if (!fs43.existsSync(sourceAgentsRoot)) {
|
|
29966
30012
|
return [skippedMissingSource3("agents", sourceAgentsRoot)];
|
|
29967
30013
|
}
|
|
29968
|
-
const sourceAgents = ts(
|
|
30014
|
+
const sourceAgents = ts(path44.join(sourceAgentsRoot, "*.md")).sort();
|
|
29969
30015
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
29970
30016
|
return sourceAgents.map((agentFile) => {
|
|
29971
|
-
const destination =
|
|
30017
|
+
const destination = path44.join(
|
|
29972
30018
|
agentsRoot,
|
|
29973
|
-
`${
|
|
30019
|
+
`${path44.basename(agentFile, ".md")}.agent.md`
|
|
29974
30020
|
);
|
|
29975
30021
|
const compiled = compileAgent(
|
|
29976
30022
|
agentFile,
|
|
@@ -29998,16 +30044,16 @@ function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
29998
30044
|
});
|
|
29999
30045
|
}
|
|
30000
30046
|
function syncCommands(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
30001
|
-
const sourceCommandsRoot =
|
|
30047
|
+
const sourceCommandsRoot = path44.join(sourceRoot, config.source.commands);
|
|
30002
30048
|
if (!fs43.existsSync(sourceCommandsRoot)) {
|
|
30003
30049
|
return [skippedMissingSource3("commands", sourceCommandsRoot)];
|
|
30004
30050
|
}
|
|
30005
|
-
const sourceCommands = ts(
|
|
30051
|
+
const sourceCommands = ts(path44.join(sourceCommandsRoot, "*.md")).sort();
|
|
30006
30052
|
const promptsRoot = resolveTargetPath(paths.prompts);
|
|
30007
30053
|
return sourceCommands.map((commandFile) => {
|
|
30008
|
-
const destination =
|
|
30054
|
+
const destination = path44.join(
|
|
30009
30055
|
promptsRoot,
|
|
30010
|
-
`${
|
|
30056
|
+
`${path44.basename(commandFile, ".md")}.prompt.md`
|
|
30011
30057
|
);
|
|
30012
30058
|
const compiled = compileCommandPrompt(commandFile);
|
|
30013
30059
|
if (options.dryRun) {
|
|
@@ -30031,7 +30077,7 @@ function syncCommands(config, sourceRoot, paths, options, logger, manifest, scop
|
|
|
30031
30077
|
});
|
|
30032
30078
|
}
|
|
30033
30079
|
function syncHooks3(config, sourceRoot, paths, mappings, options, lossReport, logger) {
|
|
30034
|
-
const destination =
|
|
30080
|
+
const destination = path44.join(
|
|
30035
30081
|
resolveTargetPath(paths.hooks),
|
|
30036
30082
|
"tangyr-managed.json"
|
|
30037
30083
|
);
|
|
@@ -30120,13 +30166,13 @@ function syncMcp3(config, sourceRoot, paths, options, lossReport, logger) {
|
|
|
30120
30166
|
);
|
|
30121
30167
|
}
|
|
30122
30168
|
function syncRules2(config, sourceRoot, rulesSlot, options, logger, manifest, scopePath) {
|
|
30123
|
-
const sourceRulesDir =
|
|
30169
|
+
const sourceRulesDir = path44.resolve(sourceRoot, config.source.rules);
|
|
30124
30170
|
if (!fs43.existsSync(sourceRulesDir)) {
|
|
30125
30171
|
return [skippedMissingSource3("rules", sourceRulesDir)];
|
|
30126
30172
|
}
|
|
30127
30173
|
const destinationRoot = resolveTargetPath(rulesSlot);
|
|
30128
30174
|
return compileCopilotRules(sourceRulesDir).map((file) => {
|
|
30129
|
-
const destination =
|
|
30175
|
+
const destination = path44.join(destinationRoot, file.name);
|
|
30130
30176
|
if (options.dryRun) {
|
|
30131
30177
|
logger.info(`[dry-run] rules: compile -> ${destination}`);
|
|
30132
30178
|
return {
|
|
@@ -30160,7 +30206,7 @@ function writeCompiledArtifact2(component, destination, content, expectedHash, c
|
|
|
30160
30206
|
if (artifactClass === "unmanaged-conflict" && !handleConflict3(destination, config, options, logger, manifest, scopePath)) {
|
|
30161
30207
|
return { component, status: "conflict", path: destination };
|
|
30162
30208
|
}
|
|
30163
|
-
ensureDir(
|
|
30209
|
+
ensureDir(path44.dirname(destination));
|
|
30164
30210
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
30165
30211
|
if (clearedLink !== null) {
|
|
30166
30212
|
logger.verbose(
|
|
@@ -30216,12 +30262,12 @@ function shouldSkipComponent3(options, component) {
|
|
|
30216
30262
|
function cleanupLegacyAgents(paths, options, logger) {
|
|
30217
30263
|
const currentAgentsRoot = resolveTargetPath(paths.agents);
|
|
30218
30264
|
const legacyAgentsRoot = resolveTargetPath(legacyCopilotAgentsPath);
|
|
30219
|
-
if (
|
|
30265
|
+
if (path44.resolve(currentAgentsRoot) === path44.resolve(legacyAgentsRoot)) {
|
|
30220
30266
|
return [];
|
|
30221
30267
|
}
|
|
30222
30268
|
const outcomes = [];
|
|
30223
30269
|
for (const filePath of ts(
|
|
30224
|
-
|
|
30270
|
+
path44.join(legacyAgentsRoot, "*.agent.md")
|
|
30225
30271
|
).sort()) {
|
|
30226
30272
|
if (!isCopilotManagedCompiledFile(filePath)) {
|
|
30227
30273
|
continue;
|
|
@@ -30254,7 +30300,7 @@ function skippedMissingSource3(component, source) {
|
|
|
30254
30300
|
// src/adapters/cursor.ts
|
|
30255
30301
|
import crypto8 from "crypto";
|
|
30256
30302
|
import fs44 from "fs";
|
|
30257
|
-
import
|
|
30303
|
+
import path45 from "path";
|
|
30258
30304
|
function syncCursor(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
30259
30305
|
const scope = options.scope ?? "global";
|
|
30260
30306
|
const profile = resolveTargetPaths({
|
|
@@ -30366,7 +30412,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
30366
30412
|
if (!shouldSkipComponent4(options, "hooks")) {
|
|
30367
30413
|
outcomes.push(
|
|
30368
30414
|
syncHookScriptsBridge({
|
|
30369
|
-
source:
|
|
30415
|
+
source: path45.resolve(sourceRoot, config.source.hooks),
|
|
30370
30416
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
30371
30417
|
config,
|
|
30372
30418
|
sourceRoot,
|
|
@@ -30431,7 +30477,7 @@ function syncInstructions2(config, sourceRoot, paths, options, lossReport, logge
|
|
|
30431
30477
|
const composed = composeCursorInstructions(config, sourceRoot, lossReport);
|
|
30432
30478
|
const marker = formatProvenanceMarker(
|
|
30433
30479
|
"markdown",
|
|
30434
|
-
|
|
30480
|
+
path45.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
30435
30481
|
hashString3(composed),
|
|
30436
30482
|
"cursor"
|
|
30437
30483
|
);
|
|
@@ -30470,11 +30516,11 @@ function composeCursorInstructions(config, sourceRoot, lossReport) {
|
|
|
30470
30516
|
${personaContent}`.trim() : baseContent;
|
|
30471
30517
|
}
|
|
30472
30518
|
function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
30473
|
-
const agentsDir =
|
|
30519
|
+
const agentsDir = path45.join(sourceRoot, config.source.agents);
|
|
30474
30520
|
if (!fs44.existsSync(agentsDir)) {
|
|
30475
30521
|
return null;
|
|
30476
30522
|
}
|
|
30477
|
-
const agentFiles = ts(
|
|
30523
|
+
const agentFiles = ts(path45.join(agentsDir, "*.md")).sort();
|
|
30478
30524
|
if (agentFiles.length === 0) {
|
|
30479
30525
|
return null;
|
|
30480
30526
|
}
|
|
@@ -30497,7 +30543,7 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
30497
30543
|
return null;
|
|
30498
30544
|
}
|
|
30499
30545
|
addLoss(lossReport, "cursor", "instructions", {
|
|
30500
|
-
source: `agents/${
|
|
30546
|
+
source: `agents/${path45.basename(primaryFile)}`,
|
|
30501
30547
|
fields: [
|
|
30502
30548
|
{
|
|
30503
30549
|
field: "persona",
|
|
@@ -30507,23 +30553,23 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
30507
30553
|
"persona",
|
|
30508
30554
|
"instructions-shim"
|
|
30509
30555
|
),
|
|
30510
|
-
detail: `Primary persona from ${
|
|
30556
|
+
detail: `Primary persona from ${path45.basename(primaryFile)} folded into its instructions file (Cursor has no custom modes surface)`
|
|
30511
30557
|
}
|
|
30512
30558
|
]
|
|
30513
30559
|
});
|
|
30514
30560
|
return body.trim();
|
|
30515
30561
|
}
|
|
30516
30562
|
function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
30517
|
-
const sourceAgentsRoot =
|
|
30563
|
+
const sourceAgentsRoot = path45.join(sourceRoot, config.source.agents);
|
|
30518
30564
|
if (!fs44.existsSync(sourceAgentsRoot)) {
|
|
30519
30565
|
return [skippedMissingSource4("agents", sourceAgentsRoot)];
|
|
30520
30566
|
}
|
|
30521
|
-
const sourceAgents = ts(
|
|
30567
|
+
const sourceAgents = ts(path45.join(sourceAgentsRoot, "*.md")).sort();
|
|
30522
30568
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
30523
30569
|
return sourceAgents.map((agentFile) => {
|
|
30524
|
-
const destination =
|
|
30570
|
+
const destination = path45.join(
|
|
30525
30571
|
agentsRoot,
|
|
30526
|
-
`${
|
|
30572
|
+
`${path45.basename(agentFile, ".md")}.md`
|
|
30527
30573
|
);
|
|
30528
30574
|
let compiled;
|
|
30529
30575
|
try {
|
|
@@ -30564,14 +30610,14 @@ function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
30564
30610
|
});
|
|
30565
30611
|
}
|
|
30566
30612
|
function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
30567
|
-
const sourceRulesDir =
|
|
30613
|
+
const sourceRulesDir = path45.join(sourceRoot, config.source.rules);
|
|
30568
30614
|
if (!fs44.existsSync(sourceRulesDir)) {
|
|
30569
30615
|
return [skippedMissingSource4("rules", sourceRulesDir)];
|
|
30570
30616
|
}
|
|
30571
30617
|
const compiled = compileRules(sourceRulesDir, "cursor", mappings, lossReport);
|
|
30572
30618
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
30573
30619
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
30574
|
-
const destination =
|
|
30620
|
+
const destination = path45.join(rulesDir, name);
|
|
30575
30621
|
if (options.dryRun) {
|
|
30576
30622
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
30577
30623
|
return {
|
|
@@ -30595,15 +30641,15 @@ function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
30595
30641
|
});
|
|
30596
30642
|
}
|
|
30597
30643
|
function syncCommands2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
30598
|
-
const sourceCommandsRoot =
|
|
30644
|
+
const sourceCommandsRoot = path45.join(sourceRoot, config.source.commands);
|
|
30599
30645
|
if (!fs44.existsSync(sourceCommandsRoot)) {
|
|
30600
30646
|
return [skippedMissingSource4("commands", sourceCommandsRoot)];
|
|
30601
30647
|
}
|
|
30602
|
-
const sourceCommands = ts(
|
|
30648
|
+
const sourceCommands = ts(path45.join(sourceCommandsRoot, "*.md")).sort();
|
|
30603
30649
|
const skillsRoot = resolveTargetPath(paths.skills);
|
|
30604
30650
|
return sourceCommands.map((commandFile) => {
|
|
30605
|
-
const baseName =
|
|
30606
|
-
const destination =
|
|
30651
|
+
const baseName = path45.basename(commandFile, ".md");
|
|
30652
|
+
const destination = path45.join(skillsRoot, baseName, "SKILL.md");
|
|
30607
30653
|
const { content } = compileCommandAsSkill(commandFile, "cursor");
|
|
30608
30654
|
if (options.dryRun) {
|
|
30609
30655
|
logger.info(
|
|
@@ -30633,7 +30679,7 @@ function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, _
|
|
|
30633
30679
|
return syncSkillsSlot({
|
|
30634
30680
|
config,
|
|
30635
30681
|
sourceRoot,
|
|
30636
|
-
source:
|
|
30682
|
+
source: path45.resolve(sourceRoot, config.source.skills),
|
|
30637
30683
|
destination,
|
|
30638
30684
|
dryRun: options.dryRun,
|
|
30639
30685
|
logger,
|
|
@@ -30681,7 +30727,7 @@ function syncHooks4(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
30681
30727
|
}
|
|
30682
30728
|
const hooksFileContent = `${JSON.stringify({ version: 1, hooks: compiled.payload }, null, 2)}
|
|
30683
30729
|
`;
|
|
30684
|
-
ensureDir(
|
|
30730
|
+
ensureDir(path45.dirname(destination));
|
|
30685
30731
|
fs44.writeFileSync(destination, hooksFileContent);
|
|
30686
30732
|
return { component: "hooks", status: "success", path: destination };
|
|
30687
30733
|
}
|
|
@@ -30745,13 +30791,13 @@ function syncPermissions(config, paths, options, _lossReport, logger, manifest,
|
|
|
30745
30791
|
);
|
|
30746
30792
|
}
|
|
30747
30793
|
function syncProviderPin(config, sourceRoot, lossReport) {
|
|
30748
|
-
const agentsDir =
|
|
30794
|
+
const agentsDir = path45.join(sourceRoot, config.source.agents);
|
|
30749
30795
|
if (!fs44.existsSync(agentsDir)) return;
|
|
30750
|
-
for (const agentFile of ts(
|
|
30796
|
+
for (const agentFile of ts(path45.join(agentsDir, "*.md")).sort()) {
|
|
30751
30797
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
30752
30798
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
30753
30799
|
if (hasCustomProvider) {
|
|
30754
|
-
const relativeSource = `agents/${
|
|
30800
|
+
const relativeSource = `agents/${path45.basename(agentFile)}`;
|
|
30755
30801
|
addLoss(lossReport, "cursor", "agents", {
|
|
30756
30802
|
source: relativeSource,
|
|
30757
30803
|
fields: [
|
|
@@ -30763,7 +30809,7 @@ function syncProviderPin(config, sourceRoot, lossReport) {
|
|
|
30763
30809
|
"provider",
|
|
30764
30810
|
"provider-not-representable"
|
|
30765
30811
|
),
|
|
30766
|
-
detail: `${
|
|
30812
|
+
detail: `${path45.basename(agentFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
30767
30813
|
}
|
|
30768
30814
|
]
|
|
30769
30815
|
});
|
|
@@ -30781,7 +30827,7 @@ function writeCompiledArtifact3(component, destination, content, expectedHash, c
|
|
|
30781
30827
|
if (artifactClass === "unmanaged-conflict" && !handleConflict4(destination, config, options, logger, manifest, scopePath)) {
|
|
30782
30828
|
return { component, status: "conflict", path: destination };
|
|
30783
30829
|
}
|
|
30784
|
-
ensureDir(
|
|
30830
|
+
ensureDir(path45.dirname(destination));
|
|
30785
30831
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
30786
30832
|
if (clearedLink !== null) {
|
|
30787
30833
|
logger.verbose(
|
|
@@ -30848,7 +30894,7 @@ function hashString3(value) {
|
|
|
30848
30894
|
// src/adapters/cline.ts
|
|
30849
30895
|
import crypto9 from "crypto";
|
|
30850
30896
|
import fs45 from "fs";
|
|
30851
|
-
import
|
|
30897
|
+
import path46 from "path";
|
|
30852
30898
|
function syncCline(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
30853
30899
|
const scope = options.scope ?? "global";
|
|
30854
30900
|
const profile = resolveTargetPaths({
|
|
@@ -30961,7 +31007,7 @@ function syncCline(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
30961
31007
|
function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport, logger, manifest, scopePath) {
|
|
30962
31008
|
if (scope === "global" || paths.instructions === null) {
|
|
30963
31009
|
addLoss(lossReport, "cline", "instructions", {
|
|
30964
|
-
source:
|
|
31010
|
+
source: path46.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
30965
31011
|
fields: [
|
|
30966
31012
|
{
|
|
30967
31013
|
field: "instructions",
|
|
@@ -30986,7 +31032,7 @@ function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport
|
|
|
30986
31032
|
const baseContent = fs45.existsSync(source) ? fs45.readFileSync(source, "utf8").trim() : "";
|
|
30987
31033
|
const marker = formatProvenanceMarker(
|
|
30988
31034
|
"markdown",
|
|
30989
|
-
|
|
31035
|
+
path46.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
30990
31036
|
hashString4(baseContent),
|
|
30991
31037
|
"cline"
|
|
30992
31038
|
);
|
|
@@ -31011,11 +31057,11 @@ ${baseContent}
|
|
|
31011
31057
|
);
|
|
31012
31058
|
}
|
|
31013
31059
|
function syncAgents4(config, sourceRoot, mappings, extensions, options, lossReport, logger) {
|
|
31014
|
-
const sourceAgentsRoot =
|
|
31060
|
+
const sourceAgentsRoot = path46.join(sourceRoot, config.source.agents);
|
|
31015
31061
|
if (!fs45.existsSync(sourceAgentsRoot)) {
|
|
31016
31062
|
return [skippedMissingSource5("agents", sourceAgentsRoot)];
|
|
31017
31063
|
}
|
|
31018
|
-
const sourceAgents = ts(
|
|
31064
|
+
const sourceAgents = ts(path46.join(sourceAgentsRoot, "*.md")).sort();
|
|
31019
31065
|
return sourceAgents.map((agentFile) => {
|
|
31020
31066
|
compileAgent(agentFile, "cline", mappings, extensions, lossReport);
|
|
31021
31067
|
if (options.dryRun) {
|
|
@@ -31031,14 +31077,14 @@ function syncAgents4(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
31031
31077
|
});
|
|
31032
31078
|
}
|
|
31033
31079
|
function syncRules4(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
31034
|
-
const sourceRulesDir =
|
|
31080
|
+
const sourceRulesDir = path46.join(sourceRoot, config.source.rules);
|
|
31035
31081
|
if (!fs45.existsSync(sourceRulesDir)) {
|
|
31036
31082
|
return [skippedMissingSource5("rules", sourceRulesDir)];
|
|
31037
31083
|
}
|
|
31038
31084
|
const compiled = compileRules(sourceRulesDir, "cline", mappings, lossReport);
|
|
31039
31085
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
31040
31086
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
31041
|
-
const destination =
|
|
31087
|
+
const destination = path46.join(rulesDir, name);
|
|
31042
31088
|
if (options.dryRun) {
|
|
31043
31089
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
31044
31090
|
return {
|
|
@@ -31062,17 +31108,17 @@ function syncRules4(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
31062
31108
|
});
|
|
31063
31109
|
}
|
|
31064
31110
|
function syncCommands3(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
31065
|
-
const sourceCommandsRoot =
|
|
31111
|
+
const sourceCommandsRoot = path46.join(sourceRoot, config.source.commands);
|
|
31066
31112
|
if (!fs45.existsSync(sourceCommandsRoot)) {
|
|
31067
31113
|
return [skippedMissingSource5("commands", sourceCommandsRoot)];
|
|
31068
31114
|
}
|
|
31069
|
-
const sourceCommands = ts(
|
|
31115
|
+
const sourceCommands = ts(path46.join(sourceCommandsRoot, "*.md")).sort();
|
|
31070
31116
|
const workflowsRoot = resolveTargetPath(paths.workflows);
|
|
31071
31117
|
return sourceCommands.map((commandFile) => {
|
|
31072
|
-
const baseName =
|
|
31073
|
-
const destination =
|
|
31118
|
+
const baseName = path46.basename(commandFile);
|
|
31119
|
+
const destination = path46.join(workflowsRoot, baseName);
|
|
31074
31120
|
const commandContent = fs45.readFileSync(commandFile, "utf8");
|
|
31075
|
-
const relativeSource = `commands/${
|
|
31121
|
+
const relativeSource = `commands/${path46.basename(commandFile)}`;
|
|
31076
31122
|
const marker = formatProvenanceMarker(
|
|
31077
31123
|
"markdown",
|
|
31078
31124
|
relativeSource,
|
|
@@ -31110,7 +31156,7 @@ function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
31110
31156
|
return syncSkillsSlot({
|
|
31111
31157
|
config,
|
|
31112
31158
|
sourceRoot,
|
|
31113
|
-
source:
|
|
31159
|
+
source: path46.resolve(sourceRoot, config.source.skills),
|
|
31114
31160
|
destination: resolveTargetPath(paths.skills),
|
|
31115
31161
|
dryRun: options.dryRun,
|
|
31116
31162
|
logger,
|
|
@@ -31189,11 +31235,11 @@ function syncSettings2(lossReport) {
|
|
|
31189
31235
|
};
|
|
31190
31236
|
}
|
|
31191
31237
|
function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
31192
|
-
const agentsDir =
|
|
31238
|
+
const agentsDir = path46.join(sourceRoot, config.source.agents);
|
|
31193
31239
|
if (!fs45.existsSync(agentsDir)) return;
|
|
31194
|
-
for (const agentFile of ts(
|
|
31240
|
+
for (const agentFile of ts(path46.join(agentsDir, "*.md")).sort()) {
|
|
31195
31241
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
31196
|
-
const relativeSource = `agents/${
|
|
31242
|
+
const relativeSource = `agents/${path46.basename(agentFile)}`;
|
|
31197
31243
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
31198
31244
|
if (hasCustomProvider) {
|
|
31199
31245
|
addLoss(lossReport, "cline", "agents", {
|
|
@@ -31207,7 +31253,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
31207
31253
|
"provider",
|
|
31208
31254
|
"provider-not-representable"
|
|
31209
31255
|
),
|
|
31210
|
-
detail: `${
|
|
31256
|
+
detail: `${path46.basename(agentFile)}: Cline provider is interface-only (Settings \u2192 API Provider); configure manually.`
|
|
31211
31257
|
}
|
|
31212
31258
|
]
|
|
31213
31259
|
});
|
|
@@ -31225,7 +31271,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
31225
31271
|
"model",
|
|
31226
31272
|
"model-not-representable"
|
|
31227
31273
|
),
|
|
31228
|
-
detail: `${
|
|
31274
|
+
detail: `${path46.basename(agentFile)}: Cline model pin is interface-only (Settings \u2192 Model); configure manually.`
|
|
31229
31275
|
}
|
|
31230
31276
|
]
|
|
31231
31277
|
});
|
|
@@ -31243,7 +31289,7 @@ function writeCompiledArtifact4(component, destination, content, expectedHash, c
|
|
|
31243
31289
|
if (artifactClass === "unmanaged-conflict" && !handleConflict5(destination, config, options, logger, manifest, scopePath)) {
|
|
31244
31290
|
return { component, status: "conflict", path: destination };
|
|
31245
31291
|
}
|
|
31246
|
-
ensureDir(
|
|
31292
|
+
ensureDir(path46.dirname(destination));
|
|
31247
31293
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
31248
31294
|
if (clearedLink !== null) {
|
|
31249
31295
|
logger.verbose(
|
|
@@ -31311,7 +31357,7 @@ function hashString4(value) {
|
|
|
31311
31357
|
import crypto10 from "crypto";
|
|
31312
31358
|
import fs46 from "fs";
|
|
31313
31359
|
import os6 from "os";
|
|
31314
|
-
import
|
|
31360
|
+
import path47 from "path";
|
|
31315
31361
|
var import_yaml12 = __toESM(require_dist(), 1);
|
|
31316
31362
|
function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
31317
31363
|
const scope = options.scope ?? "global";
|
|
@@ -31329,7 +31375,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
31329
31375
|
config_doc: profile.config_doc
|
|
31330
31376
|
};
|
|
31331
31377
|
const rules = compileRules(
|
|
31332
|
-
|
|
31378
|
+
path47.join(sourceRoot, config.source.rules),
|
|
31333
31379
|
"opencode",
|
|
31334
31380
|
mappings,
|
|
31335
31381
|
lossReport
|
|
@@ -31449,7 +31495,7 @@ function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, l
|
|
|
31449
31495
|
${agentsAppendix}`.trim() : baseContent;
|
|
31450
31496
|
const marker = formatProvenanceMarker(
|
|
31451
31497
|
"markdown",
|
|
31452
|
-
|
|
31498
|
+
path47.basename(instructionsSourceLabel(sourceRoot, config)),
|
|
31453
31499
|
hashString5(composed),
|
|
31454
31500
|
"opencode"
|
|
31455
31501
|
);
|
|
@@ -31483,13 +31529,13 @@ ${composed}
|
|
|
31483
31529
|
];
|
|
31484
31530
|
}
|
|
31485
31531
|
function declaredInstructionsPath(paths) {
|
|
31486
|
-
const configDir =
|
|
31532
|
+
const configDir = path47.dirname(resolveTargetPath(paths.config_doc));
|
|
31487
31533
|
const instructions = resolveTargetPath(paths.instructions);
|
|
31488
|
-
const relative =
|
|
31534
|
+
const relative = path47.relative(configDir, instructions);
|
|
31489
31535
|
if (relative === "AGENTS.md" || relative.startsWith("..")) {
|
|
31490
31536
|
return null;
|
|
31491
31537
|
}
|
|
31492
|
-
return relative.split(
|
|
31538
|
+
return relative.split(path47.sep).join("/");
|
|
31493
31539
|
}
|
|
31494
31540
|
function withDeclaredInstructions(existing, reference) {
|
|
31495
31541
|
const listed = Array.isArray(existing) ? existing.filter((entry) => typeof entry === "string") : [];
|
|
@@ -31518,22 +31564,22 @@ function declareInstructions(paths, manifest) {
|
|
|
31518
31564
|
const host = { ...existing };
|
|
31519
31565
|
const written = mergeIntoHost(host, config);
|
|
31520
31566
|
recordSharedWrite(manifest, destination, "opencode", existed, written);
|
|
31521
|
-
ensureDir(
|
|
31567
|
+
ensureDir(path47.dirname(destination));
|
|
31522
31568
|
fs46.writeFileSync(destination, `${JSON.stringify(config, null, 2)}
|
|
31523
31569
|
`);
|
|
31524
31570
|
return destination;
|
|
31525
31571
|
}
|
|
31526
31572
|
function syncAgents5(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
31527
|
-
const sourceAgentsRoot =
|
|
31573
|
+
const sourceAgentsRoot = path47.join(sourceRoot, config.source.agents);
|
|
31528
31574
|
if (!fs46.existsSync(sourceAgentsRoot)) {
|
|
31529
31575
|
return [skippedMissingSource6("agents", sourceAgentsRoot)];
|
|
31530
31576
|
}
|
|
31531
|
-
const sourceAgents = ts(
|
|
31577
|
+
const sourceAgents = ts(path47.join(sourceAgentsRoot, "*.md")).sort();
|
|
31532
31578
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
31533
31579
|
return sourceAgents.map((agentFile) => {
|
|
31534
|
-
const destination =
|
|
31580
|
+
const destination = path47.join(
|
|
31535
31581
|
agentsRoot,
|
|
31536
|
-
`${
|
|
31582
|
+
`${path47.basename(agentFile, ".md")}.md`
|
|
31537
31583
|
);
|
|
31538
31584
|
let compiled;
|
|
31539
31585
|
try {
|
|
@@ -31597,11 +31643,11 @@ function applyProviderModelBinding(compiled, mappings) {
|
|
|
31597
31643
|
return `${before}${(0, import_yaml12.stringify)(fields).trim()}${after}`;
|
|
31598
31644
|
}
|
|
31599
31645
|
function syncCommands4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
31600
|
-
const sourceCommandsRoot =
|
|
31646
|
+
const sourceCommandsRoot = path47.join(sourceRoot, config.source.commands);
|
|
31601
31647
|
if (!fs46.existsSync(sourceCommandsRoot)) {
|
|
31602
31648
|
return [skippedMissingSource6("commands", sourceCommandsRoot)];
|
|
31603
31649
|
}
|
|
31604
|
-
const sourceCommands = ts(
|
|
31650
|
+
const sourceCommands = ts(path47.join(sourceCommandsRoot, "*.md")).sort();
|
|
31605
31651
|
const commandsRoot = resolveTargetPath(paths.commands);
|
|
31606
31652
|
return sourceCommands.map((commandFile) => {
|
|
31607
31653
|
const { data, body } = parseCommandFile(commandFile);
|
|
@@ -31615,7 +31661,7 @@ function syncCommands4(config, sourceRoot, paths, options, logger, manifest, sco
|
|
|
31615
31661
|
if (typeof data.model === "string") {
|
|
31616
31662
|
frontmatter.model = data.model;
|
|
31617
31663
|
}
|
|
31618
|
-
const relativeSource = `commands/${
|
|
31664
|
+
const relativeSource = `commands/${path47.basename(commandFile)}`;
|
|
31619
31665
|
const marker = formatProvenanceMarker(
|
|
31620
31666
|
"markdown",
|
|
31621
31667
|
relativeSource,
|
|
@@ -31631,9 +31677,9 @@ ${body.trimEnd()}
|
|
|
31631
31677
|
` : `${marker}
|
|
31632
31678
|
${body.trimEnd()}
|
|
31633
31679
|
`;
|
|
31634
|
-
const destination =
|
|
31680
|
+
const destination = path47.join(
|
|
31635
31681
|
commandsRoot,
|
|
31636
|
-
`${
|
|
31682
|
+
`${path47.basename(commandFile, ".md")}.md`
|
|
31637
31683
|
);
|
|
31638
31684
|
if (options.dryRun) {
|
|
31639
31685
|
logger.info(
|
|
@@ -31663,7 +31709,7 @@ function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scop
|
|
|
31663
31709
|
return syncSkillsSlot({
|
|
31664
31710
|
config,
|
|
31665
31711
|
sourceRoot,
|
|
31666
|
-
source:
|
|
31712
|
+
source: path47.resolve(sourceRoot, config.source.skills),
|
|
31667
31713
|
destination,
|
|
31668
31714
|
dryRun: options.dryRun,
|
|
31669
31715
|
logger,
|
|
@@ -31797,7 +31843,7 @@ function syncConfigDoc(paths, mcpEntries, _lossReport, permissionMap, mappings,
|
|
|
31797
31843
|
)
|
|
31798
31844
|
});
|
|
31799
31845
|
recordSharedWrite(manifest, destination, "opencode", existed, written);
|
|
31800
|
-
ensureDir(
|
|
31846
|
+
ensureDir(path47.dirname(destination));
|
|
31801
31847
|
fs46.writeFileSync(destination, `${JSON.stringify(config, null, 2)}
|
|
31802
31848
|
`);
|
|
31803
31849
|
}
|
|
@@ -31812,7 +31858,7 @@ function writeCompiledArtifact5(component, destination, content, expectedHash, c
|
|
|
31812
31858
|
if (artifactClass === "unmanaged-conflict" && !handleConflict6(destination, config, options, logger, manifest, scopePath)) {
|
|
31813
31859
|
return { component, status: "conflict", path: destination };
|
|
31814
31860
|
}
|
|
31815
|
-
ensureDir(
|
|
31861
|
+
ensureDir(path47.dirname(destination));
|
|
31816
31862
|
const clearedLink = clearSymlinkAtDestination(destination);
|
|
31817
31863
|
if (clearedLink !== null) {
|
|
31818
31864
|
logger.verbose(
|
|
@@ -31933,7 +31979,7 @@ async function runInstallCommand(options, logger) {
|
|
|
31933
31979
|
);
|
|
31934
31980
|
}
|
|
31935
31981
|
const kitName = resolvedKitName ?? config.kit;
|
|
31936
|
-
const kitPath = kitPathOverride ?? (options.kitPath ?
|
|
31982
|
+
const kitPath = kitPathOverride ?? (options.kitPath ? path48.resolve(options.kitPath) : config.kitPath);
|
|
31937
31983
|
if (!kitName && !kitPath) {
|
|
31938
31984
|
logger.error(
|
|
31939
31985
|
"No kit specified. Use --kit <name>, --kit-path <path>, or set 'kit'/'kitPath' in tangyr.config.yaml."
|
|
@@ -32038,8 +32084,8 @@ async function runInstallCommand(options, logger) {
|
|
|
32038
32084
|
config: options.config,
|
|
32039
32085
|
scope
|
|
32040
32086
|
});
|
|
32041
|
-
const skillsSource =
|
|
32042
|
-
const isPerSkillSkillsSlot = (f) => (f.tool === "claude-code" || f.tool === "copilot") &&
|
|
32087
|
+
const skillsSource = path48.resolve(kitInfo.path, config.source.skills);
|
|
32088
|
+
const isPerSkillSkillsSlot = (f) => (f.tool === "claude-code" || f.tool === "copilot") && path48.basename(f.path) === "skills";
|
|
32043
32089
|
const foreignSkillsSlots = new Set(
|
|
32044
32090
|
assessResult.findings.filter(
|
|
32045
32091
|
(f) => isPerSkillSkillsSlot(f) && isForeignSkillsSlotSymlink(
|
|
@@ -32077,7 +32123,7 @@ async function runInstallCommand(options, logger) {
|
|
|
32077
32123
|
let instructionsLabel;
|
|
32078
32124
|
try {
|
|
32079
32125
|
const resolved = resolveInstructionsSource(kitInfo.path, config);
|
|
32080
|
-
instructionsLabel = resolved ?
|
|
32126
|
+
instructionsLabel = resolved ? path48.relative(kitInfo.path, resolved.file) : "(none \u2014 no instructions file resolves in this kit)";
|
|
32081
32127
|
} catch (err) {
|
|
32082
32128
|
logger.error(
|
|
32083
32129
|
`[dry-run] ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -32105,7 +32151,7 @@ async function runInstallCommand(options, logger) {
|
|
|
32105
32151
|
}
|
|
32106
32152
|
}
|
|
32107
32153
|
logger.info(
|
|
32108
|
-
`[dry-run] Total: ${plannedTotal} destination(s); manifest at ${
|
|
32154
|
+
`[dry-run] Total: ${plannedTotal} destination(s); manifest at ${path48.join(scopePath, "manifest.json")}`
|
|
32109
32155
|
);
|
|
32110
32156
|
return;
|
|
32111
32157
|
}
|
|
@@ -32306,26 +32352,26 @@ SKIPPED CONFLICTS (${skippedTargetPaths.size} target(s) left unchanged):`
|
|
|
32306
32352
|
writeManifest(scopePath, manifest);
|
|
32307
32353
|
logger.info(`
|
|
32308
32354
|
Installation complete: ${installedCount} files installed.`);
|
|
32309
|
-
logger.info(`Manifest written to ${
|
|
32355
|
+
logger.info(`Manifest written to ${path48.join(scopePath, "manifest.json")}`);
|
|
32310
32356
|
logger.info(`Kit: ${kitInfo.name} (archetype: ${kitInfo.archetype})`);
|
|
32311
32357
|
logger.info(`Scope: ${scope}`);
|
|
32312
32358
|
logger.info(`Tools: ${tools.join(", ")}`);
|
|
32313
32359
|
reportHookRejections(
|
|
32314
32360
|
installLossReport,
|
|
32315
32361
|
tools,
|
|
32316
|
-
|
|
32362
|
+
path48.resolve(kitInfo.path, "hooks"),
|
|
32317
32363
|
kitInfo.components.hooks.declared
|
|
32318
32364
|
);
|
|
32319
32365
|
const hooksConflict = reportHooksSourceConflict(
|
|
32320
32366
|
installLossReport,
|
|
32321
32367
|
tools,
|
|
32322
|
-
|
|
32368
|
+
path48.resolve(kitInfo.path, "hooks"),
|
|
32323
32369
|
kitInfo.components.hooks.declared
|
|
32324
32370
|
);
|
|
32325
32371
|
if (hooksConflict) {
|
|
32326
32372
|
logger.warn(hooksConflict);
|
|
32327
32373
|
}
|
|
32328
|
-
writeLossReport(options.lossReport, installLossReport);
|
|
32374
|
+
writeLossReport(options.lossReport, installLossReport, scopePath);
|
|
32329
32375
|
exitOnErrorSeverityLoss(installLossReport, logger, {
|
|
32330
32376
|
acceptedLoss: config.acceptedLoss,
|
|
32331
32377
|
ignoreErrors: options.ignoreErrors ?? false
|
|
@@ -32712,17 +32758,17 @@ function installClaudeCodeSkills(config, kitInfo, manifest, options, logger, sco
|
|
|
32712
32758
|
manifest,
|
|
32713
32759
|
scopePath
|
|
32714
32760
|
);
|
|
32715
|
-
const skillsSource =
|
|
32761
|
+
const skillsSource = path48.resolve(kitInfo.path, config.source.skills);
|
|
32716
32762
|
let count = 0;
|
|
32717
32763
|
for (const outcome of outcomes) {
|
|
32718
32764
|
if (outcome.status !== "success" && outcome.status !== "skipped-current") {
|
|
32719
32765
|
continue;
|
|
32720
32766
|
}
|
|
32721
|
-
const skillName =
|
|
32767
|
+
const skillName = path48.basename(outcome.path);
|
|
32722
32768
|
addArtifactToManifest(manifest, {
|
|
32723
32769
|
relativePath: `claude-code/skills/${skillName}`,
|
|
32724
32770
|
path: outcome.path,
|
|
32725
|
-
hash: describeArtifactState(outcome.path) ?? `dir:${
|
|
32771
|
+
hash: describeArtifactState(outcome.path) ?? `dir:${path48.join(skillsSource, skillName)}`,
|
|
32726
32772
|
origin: "tangyr-managed"
|
|
32727
32773
|
});
|
|
32728
32774
|
count++;
|
|
@@ -32736,7 +32782,7 @@ function applyClaudeCodePlacements(placements, manifest, skippedTargetPaths, log
|
|
|
32736
32782
|
logger.verbose(` skipped (operator choice): ${placement.destination}`);
|
|
32737
32783
|
continue;
|
|
32738
32784
|
}
|
|
32739
|
-
const destDir =
|
|
32785
|
+
const destDir = path48.dirname(placement.destination);
|
|
32740
32786
|
fs47.mkdirSync(destDir, { recursive: true });
|
|
32741
32787
|
if (placement.type === "symlink") {
|
|
32742
32788
|
if (fs47.existsSync(placement.destination) || isSymlink2(placement.destination)) {
|
|
@@ -33053,11 +33099,11 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
33053
33099
|
if (outcome.path === mcpFile2) {
|
|
33054
33100
|
return "cline/mcp.json";
|
|
33055
33101
|
}
|
|
33056
|
-
if (outcome.path.startsWith(`${workflowsRoot}${
|
|
33057
|
-
return `cline/workflows/${
|
|
33102
|
+
if (outcome.path.startsWith(`${workflowsRoot}${path48.sep}`)) {
|
|
33103
|
+
return `cline/workflows/${path48.basename(outcome.path)}`;
|
|
33058
33104
|
}
|
|
33059
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
33060
|
-
return `cline/rules/${
|
|
33105
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path48.sep}`)) {
|
|
33106
|
+
return `cline/rules/${path48.basename(outcome.path)}`;
|
|
33061
33107
|
}
|
|
33062
33108
|
return null;
|
|
33063
33109
|
}
|
|
@@ -33093,14 +33139,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
33093
33139
|
if (outcome.path === permissionsFile) {
|
|
33094
33140
|
return "cursor/permissions.json";
|
|
33095
33141
|
}
|
|
33096
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
33097
|
-
return `cursor/agents/${
|
|
33142
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path48.sep}`)) {
|
|
33143
|
+
return `cursor/agents/${path48.basename(outcome.path)}`;
|
|
33098
33144
|
}
|
|
33099
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
33100
|
-
return `cursor/rules/${
|
|
33145
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path48.sep}`)) {
|
|
33146
|
+
return `cursor/rules/${path48.basename(outcome.path)}`;
|
|
33101
33147
|
}
|
|
33102
|
-
if (outcome.path.startsWith(`${skillsRoot2}${
|
|
33103
|
-
const rel =
|
|
33148
|
+
if (outcome.path.startsWith(`${skillsRoot2}${path48.sep}`)) {
|
|
33149
|
+
const rel = path48.relative(skillsRoot2, outcome.path);
|
|
33104
33150
|
return `cursor/skills/${rel}`;
|
|
33105
33151
|
}
|
|
33106
33152
|
return null;
|
|
@@ -33126,14 +33172,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
33126
33172
|
if (outcome.path === skillsSharedRoot) {
|
|
33127
33173
|
return "opencode/skills_shared";
|
|
33128
33174
|
}
|
|
33129
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
33130
|
-
return `opencode/agents/${
|
|
33175
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path48.sep}`)) {
|
|
33176
|
+
return `opencode/agents/${path48.basename(outcome.path)}`;
|
|
33131
33177
|
}
|
|
33132
|
-
if (outcome.path.startsWith(`${commandsRoot}${
|
|
33133
|
-
return `opencode/commands/${
|
|
33178
|
+
if (outcome.path.startsWith(`${commandsRoot}${path48.sep}`)) {
|
|
33179
|
+
return `opencode/commands/${path48.basename(outcome.path)}`;
|
|
33134
33180
|
}
|
|
33135
33181
|
if (outcome.path === configDocFile) {
|
|
33136
|
-
return `opencode/${
|
|
33182
|
+
return `opencode/${path48.basename(outcome.path)}`;
|
|
33137
33183
|
}
|
|
33138
33184
|
return null;
|
|
33139
33185
|
}
|
|
@@ -33150,29 +33196,29 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
33150
33196
|
const hooksRoot = resolveTargetPath(copilot.hooks);
|
|
33151
33197
|
const mcpFile2 = resolveTargetPath(copilot.mcp_shared_file);
|
|
33152
33198
|
const instructionsMirror = copilot.instructions !== null ? resolveTargetPath(copilot.instructions) : null;
|
|
33153
|
-
if (copilot.rules !== null && outcome.path.startsWith(`${resolveTargetPath(copilot.rules)}${
|
|
33154
|
-
return `copilot/rules/${
|
|
33199
|
+
if (copilot.rules !== null && outcome.path.startsWith(`${resolveTargetPath(copilot.rules)}${path48.sep}`)) {
|
|
33200
|
+
return `copilot/rules/${path48.relative(resolveTargetPath(copilot.rules), outcome.path)}`;
|
|
33155
33201
|
}
|
|
33156
|
-
if (outcome.path.startsWith(`${skillsRoot2}${
|
|
33157
|
-
return `copilot/skills/${
|
|
33202
|
+
if (outcome.path.startsWith(`${skillsRoot2}${path48.sep}`)) {
|
|
33203
|
+
return `copilot/skills/${path48.relative(skillsRoot2, outcome.path)}`;
|
|
33158
33204
|
}
|
|
33159
33205
|
if (outcome.path === skillsRoot2) {
|
|
33160
33206
|
return "copilot/skills";
|
|
33161
33207
|
}
|
|
33162
33208
|
if (instructionsMirror !== null && outcome.path === instructionsMirror) {
|
|
33163
|
-
return `copilot/${
|
|
33209
|
+
return `copilot/${path48.basename(outcome.path)}`;
|
|
33164
33210
|
}
|
|
33165
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
33166
|
-
return `copilot/agents/${
|
|
33211
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path48.sep}`)) {
|
|
33212
|
+
return `copilot/agents/${path48.basename(outcome.path)}`;
|
|
33167
33213
|
}
|
|
33168
|
-
if (outcome.path.startsWith(`${promptsRoot}${
|
|
33169
|
-
return `copilot/prompts/${
|
|
33214
|
+
if (outcome.path.startsWith(`${promptsRoot}${path48.sep}`)) {
|
|
33215
|
+
return `copilot/prompts/${path48.basename(outcome.path)}`;
|
|
33170
33216
|
}
|
|
33171
|
-
if (outcome.path.startsWith(`${hooksRoot}${
|
|
33172
|
-
return `copilot/hooks/${
|
|
33217
|
+
if (outcome.path.startsWith(`${hooksRoot}${path48.sep}`)) {
|
|
33218
|
+
return `copilot/hooks/${path48.basename(outcome.path)}`;
|
|
33173
33219
|
}
|
|
33174
33220
|
if (outcome.path === mcpFile2) {
|
|
33175
|
-
return `copilot/${
|
|
33221
|
+
return `copilot/${path48.basename(outcome.path)}`;
|
|
33176
33222
|
}
|
|
33177
33223
|
return null;
|
|
33178
33224
|
}
|
|
@@ -33189,17 +33235,17 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
33189
33235
|
if (outcome.path === skillsRoot) {
|
|
33190
33236
|
return "codex/skills";
|
|
33191
33237
|
}
|
|
33192
|
-
if (outcome.path.startsWith(`${agentsRoot}${
|
|
33193
|
-
return `codex/agents/${
|
|
33238
|
+
if (outcome.path.startsWith(`${agentsRoot}${path48.sep}`)) {
|
|
33239
|
+
return `codex/agents/${path48.basename(outcome.path)}`;
|
|
33194
33240
|
}
|
|
33195
|
-
if (outcome.path.startsWith(`${rulesRoot}${
|
|
33196
|
-
return `codex/rules/${
|
|
33241
|
+
if (outcome.path.startsWith(`${rulesRoot}${path48.sep}`)) {
|
|
33242
|
+
return `codex/rules/${path48.basename(outcome.path)}`;
|
|
33197
33243
|
}
|
|
33198
33244
|
if (outcome.path === hooksFile) {
|
|
33199
|
-
return `codex/${
|
|
33245
|
+
return `codex/${path48.basename(outcome.path)}`;
|
|
33200
33246
|
}
|
|
33201
33247
|
if (outcome.path === mcpFile) {
|
|
33202
|
-
return `codex/${
|
|
33248
|
+
return `codex/${path48.basename(outcome.path)}`;
|
|
33203
33249
|
}
|
|
33204
33250
|
return null;
|
|
33205
33251
|
}
|
|
@@ -33268,7 +33314,7 @@ function getClaudeCodePlacements(kitInfo, config, scope = "global", projectRoot,
|
|
|
33268
33314
|
rules: resolvedPaths.rules
|
|
33269
33315
|
};
|
|
33270
33316
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
33271
|
-
const componentDir =
|
|
33317
|
+
const componentDir = path48.join(kitInfo.path, component);
|
|
33272
33318
|
if (fs47.existsSync(componentDir) && fs47.statSync(componentDir).isDirectory()) {
|
|
33273
33319
|
placements.push({
|
|
33274
33320
|
source: componentDir,
|
|
@@ -33299,7 +33345,7 @@ function getClaudeCodePlacementsFromProfile(kitInfo, profile, config) {
|
|
|
33299
33345
|
rules: profile.rules
|
|
33300
33346
|
};
|
|
33301
33347
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
33302
|
-
const componentDir =
|
|
33348
|
+
const componentDir = path48.join(kitInfo.path, component);
|
|
33303
33349
|
if (fs47.existsSync(componentDir) && fs47.statSync(componentDir).isDirectory()) {
|
|
33304
33350
|
placements.push({
|
|
33305
33351
|
source: componentDir,
|
|
@@ -33316,7 +33362,7 @@ function collectAllFiles(kitInfo, config) {
|
|
|
33316
33362
|
const files = /* @__PURE__ */ new Map();
|
|
33317
33363
|
const entrypoint = resolveInstructionsSource(kitInfo.path, config);
|
|
33318
33364
|
if (entrypoint) {
|
|
33319
|
-
files.set(
|
|
33365
|
+
files.set(path48.basename(entrypoint.file), entrypoint.file);
|
|
33320
33366
|
}
|
|
33321
33367
|
for (const [component, reconciliation] of Object.entries(
|
|
33322
33368
|
kitInfo.components
|
|
@@ -33325,8 +33371,8 @@ function collectAllFiles(kitInfo, config) {
|
|
|
33325
33371
|
const missingSet = new Set(reconciliation.missing);
|
|
33326
33372
|
for (const entry of reconciliation.declared) {
|
|
33327
33373
|
if (missingSet.has(entry)) continue;
|
|
33328
|
-
const relPath = isSkills ?
|
|
33329
|
-
files.set(relPath,
|
|
33374
|
+
const relPath = isSkills ? path48.join(component, entry) : path48.join(component, `${entry}.md`);
|
|
33375
|
+
files.set(relPath, path48.join(kitInfo.path, relPath));
|
|
33330
33376
|
}
|
|
33331
33377
|
}
|
|
33332
33378
|
return files;
|
|
@@ -33359,10 +33405,10 @@ function skillsSubPathKey(tool, outcomePath, mappings, scope, projectRoot) {
|
|
|
33359
33405
|
continue;
|
|
33360
33406
|
}
|
|
33361
33407
|
const root = resolveTargetPath(slot);
|
|
33362
|
-
if (!outcomePath.startsWith(`${root}${
|
|
33408
|
+
if (!outcomePath.startsWith(`${root}${path48.sep}`)) {
|
|
33363
33409
|
continue;
|
|
33364
33410
|
}
|
|
33365
|
-
const inside =
|
|
33411
|
+
const inside = path48.relative(root, outcomePath).split(path48.sep).join("/");
|
|
33366
33412
|
return `${tool}/skills/${inside}`;
|
|
33367
33413
|
}
|
|
33368
33414
|
return null;
|
|
@@ -33407,14 +33453,14 @@ async function runKitUpdateCommand(options, logger) {
|
|
|
33407
33453
|
}
|
|
33408
33454
|
|
|
33409
33455
|
// src/commands/list.ts
|
|
33410
|
-
import
|
|
33456
|
+
import path49 from "path";
|
|
33411
33457
|
function runListCommand(options, logger) {
|
|
33412
33458
|
let searchPaths = [];
|
|
33413
|
-
let directKitPath = options.kitPath ?
|
|
33459
|
+
let directKitPath = options.kitPath ? path49.resolve(options.kitPath) : void 0;
|
|
33414
33460
|
try {
|
|
33415
33461
|
const { config, configDir } = resolveConfig(options.config);
|
|
33416
33462
|
searchPaths = config.kitSearchPaths ?? [
|
|
33417
|
-
|
|
33463
|
+
path49.join(configDir, "operating-kits")
|
|
33418
33464
|
];
|
|
33419
33465
|
directKitPath = directKitPath ?? config.kitPath;
|
|
33420
33466
|
} catch (err) {
|
|
@@ -33489,7 +33535,7 @@ function withDirectKit(kits, directKitPath) {
|
|
|
33489
33535
|
return kits;
|
|
33490
33536
|
}
|
|
33491
33537
|
const directKit = loadKit(directKitPath);
|
|
33492
|
-
if (kits.some((kit) =>
|
|
33538
|
+
if (kits.some((kit) => path49.resolve(kit.path) === directKit.path)) {
|
|
33493
33539
|
return kits;
|
|
33494
33540
|
}
|
|
33495
33541
|
return [...kits, directKit];
|
|
@@ -33498,7 +33544,7 @@ function withDirectKit(kits, directKitPath) {
|
|
|
33498
33544
|
// src/commands/probe.ts
|
|
33499
33545
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
33500
33546
|
import fs48 from "fs";
|
|
33501
|
-
import
|
|
33547
|
+
import path50 from "path";
|
|
33502
33548
|
function runProbeCommand(options, logger) {
|
|
33503
33549
|
const { config, configDir, configSource, sourceRoot } = resolveRuntime(
|
|
33504
33550
|
options,
|
|
@@ -33526,7 +33572,7 @@ function runProbeCommand(options, logger) {
|
|
|
33526
33572
|
toProbeRow(
|
|
33527
33573
|
target,
|
|
33528
33574
|
key,
|
|
33529
|
-
scope === "project" ?
|
|
33575
|
+
scope === "project" ? path50.resolve(projectRoot ?? process.cwd(), rawPath) : rawPath
|
|
33530
33576
|
)
|
|
33531
33577
|
);
|
|
33532
33578
|
}
|
|
@@ -33592,7 +33638,7 @@ function commandProbeRows(target, key, command, args) {
|
|
|
33592
33638
|
// src/commands/status.ts
|
|
33593
33639
|
import crypto11 from "crypto";
|
|
33594
33640
|
import fs49 from "fs";
|
|
33595
|
-
import
|
|
33641
|
+
import path51 from "path";
|
|
33596
33642
|
function runStatusCommand(options, logger) {
|
|
33597
33643
|
const { config, configDir, configSource, sourceRoot } = resolveRuntime(
|
|
33598
33644
|
options,
|
|
@@ -33698,11 +33744,11 @@ function classifyTargetRows(target, config, sourceRoot, configDir, scope, projec
|
|
|
33698
33744
|
}
|
|
33699
33745
|
}
|
|
33700
33746
|
function sourceMarkdownFiles(sourceRoot, componentPath) {
|
|
33701
|
-
const root =
|
|
33747
|
+
const root = path51.join(sourceRoot, componentPath);
|
|
33702
33748
|
if (!fs49.existsSync(root)) {
|
|
33703
33749
|
return [];
|
|
33704
33750
|
}
|
|
33705
|
-
return ts(
|
|
33751
|
+
return ts(path51.join(root, "*.md")).sort();
|
|
33706
33752
|
}
|
|
33707
33753
|
function notRepresentableRow(component, detail) {
|
|
33708
33754
|
return {
|
|
@@ -33849,7 +33895,7 @@ function classifyOpenCodeFiles(config, sourceRoot, configDir, scope, projectRoot
|
|
|
33849
33895
|
const rows = [];
|
|
33850
33896
|
const instructionsSource = instructionsSourcePath(sourceRoot, config);
|
|
33851
33897
|
const rules = compileRules(
|
|
33852
|
-
|
|
33898
|
+
path51.join(sourceRoot, config.source.rules),
|
|
33853
33899
|
"opencode",
|
|
33854
33900
|
mappings,
|
|
33855
33901
|
createLossReport()
|
|
@@ -33876,10 +33922,10 @@ ${rules.agentsAppendix}`.trim() : baseInstructions;
|
|
|
33876
33922
|
)) {
|
|
33877
33923
|
rows.push(
|
|
33878
33924
|
classifyCompiledFile(
|
|
33879
|
-
`agents/${
|
|
33880
|
-
|
|
33925
|
+
`agents/${path51.basename(agentFile, ".md")}`,
|
|
33926
|
+
path51.join(
|
|
33881
33927
|
resolveTargetPath(paths.agents),
|
|
33882
|
-
`${
|
|
33928
|
+
`${path51.basename(agentFile, ".md")}.md`
|
|
33883
33929
|
),
|
|
33884
33930
|
"opencode",
|
|
33885
33931
|
computeSourceHash(agentFile),
|
|
@@ -33894,10 +33940,10 @@ ${rules.agentsAppendix}`.trim() : baseInstructions;
|
|
|
33894
33940
|
)) {
|
|
33895
33941
|
rows.push(
|
|
33896
33942
|
classifyCompiledFile(
|
|
33897
|
-
`commands/${
|
|
33898
|
-
|
|
33943
|
+
`commands/${path51.basename(commandFile, ".md")}`,
|
|
33944
|
+
path51.join(
|
|
33899
33945
|
resolveTargetPath(paths.commands),
|
|
33900
|
-
`${
|
|
33946
|
+
`${path51.basename(commandFile, ".md")}.md`
|
|
33901
33947
|
),
|
|
33902
33948
|
"opencode",
|
|
33903
33949
|
computeSourceHash(commandFile),
|
|
@@ -33979,10 +34025,10 @@ function classifyCursorFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
33979
34025
|
)) {
|
|
33980
34026
|
rows.push(
|
|
33981
34027
|
classifyCompiledFile(
|
|
33982
|
-
`agents/${
|
|
33983
|
-
|
|
34028
|
+
`agents/${path51.basename(agentFile, ".md")}`,
|
|
34029
|
+
path51.join(
|
|
33984
34030
|
resolveTargetPath(paths.agents),
|
|
33985
|
-
`${
|
|
34031
|
+
`${path51.basename(agentFile, ".md")}.md`
|
|
33986
34032
|
),
|
|
33987
34033
|
"cursor",
|
|
33988
34034
|
computeSourceHash(agentFile),
|
|
@@ -33999,7 +34045,7 @@ function classifyCursorFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
33999
34045
|
rows.push(
|
|
34000
34046
|
classifyCompiledFile(
|
|
34001
34047
|
`rules/${ruleFile.name}`,
|
|
34002
|
-
|
|
34048
|
+
path51.join(resolveTargetPath(paths.rules), ruleFile.name),
|
|
34003
34049
|
"cursor",
|
|
34004
34050
|
void 0,
|
|
34005
34051
|
config,
|
|
@@ -34013,11 +34059,11 @@ function classifyCursorFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
34013
34059
|
sourceRoot,
|
|
34014
34060
|
config.source.commands
|
|
34015
34061
|
)) {
|
|
34016
|
-
const baseName =
|
|
34062
|
+
const baseName = path51.basename(commandFile, ".md");
|
|
34017
34063
|
rows.push(
|
|
34018
34064
|
classifyCompiledFile(
|
|
34019
34065
|
`commands/${baseName}`,
|
|
34020
|
-
|
|
34066
|
+
path51.join(resolveTargetPath(paths.skills), baseName, "SKILL.md"),
|
|
34021
34067
|
"cursor",
|
|
34022
34068
|
computeSourceHash(commandFile),
|
|
34023
34069
|
config,
|
|
@@ -34100,7 +34146,7 @@ function classifyClineFiles(config, sourceRoot, configDir, scope, projectRoot) {
|
|
|
34100
34146
|
rows.push(
|
|
34101
34147
|
classifyCompiledFile(
|
|
34102
34148
|
`rules/${ruleFile.name}`,
|
|
34103
|
-
|
|
34149
|
+
path51.join(resolveTargetPath(paths.rules), ruleFile.name),
|
|
34104
34150
|
"cline",
|
|
34105
34151
|
void 0,
|
|
34106
34152
|
config,
|
|
@@ -34116,10 +34162,10 @@ function classifyClineFiles(config, sourceRoot, configDir, scope, projectRoot) {
|
|
|
34116
34162
|
)) {
|
|
34117
34163
|
rows.push(
|
|
34118
34164
|
classifyCompiledFile(
|
|
34119
|
-
`commands/${
|
|
34120
|
-
|
|
34165
|
+
`commands/${path51.basename(commandFile, ".md")}`,
|
|
34166
|
+
path51.join(
|
|
34121
34167
|
resolveTargetPath(paths.workflows),
|
|
34122
|
-
|
|
34168
|
+
path51.basename(commandFile)
|
|
34123
34169
|
),
|
|
34124
34170
|
"cline",
|
|
34125
34171
|
computeSourceHash(commandFile),
|
|
@@ -34160,7 +34206,7 @@ function classifyClineFiles(config, sourceRoot, configDir, scope, projectRoot) {
|
|
|
34160
34206
|
return rows;
|
|
34161
34207
|
}
|
|
34162
34208
|
function compileRulesFiles(config, sourceRoot, target, mappings) {
|
|
34163
|
-
const rulesSource =
|
|
34209
|
+
const rulesSource = path51.join(sourceRoot, config.source.rules);
|
|
34164
34210
|
if (!fs49.existsSync(rulesSource)) {
|
|
34165
34211
|
return [];
|
|
34166
34212
|
}
|
|
@@ -34186,7 +34232,7 @@ function slotsForScope2(scopeMap, scope, projectRoot) {
|
|
|
34186
34232
|
const root = projectRoot ?? process.cwd();
|
|
34187
34233
|
const resolved = {};
|
|
34188
34234
|
for (const [slot, value] of Object.entries(projectSlots)) {
|
|
34189
|
-
resolved[slot] = typeof value === "string" ?
|
|
34235
|
+
resolved[slot] = typeof value === "string" ? path51.resolve(root, value) : value;
|
|
34190
34236
|
}
|
|
34191
34237
|
return resolved;
|
|
34192
34238
|
}
|
|
@@ -34206,7 +34252,7 @@ function classifyCodexFiles(config, sourceRoot, configDir, scope, projectRoot) {
|
|
|
34206
34252
|
rules: paths.rules
|
|
34207
34253
|
};
|
|
34208
34254
|
const rules = compileRules(
|
|
34209
|
-
|
|
34255
|
+
path51.join(sourceRoot, config.source.rules),
|
|
34210
34256
|
"codex",
|
|
34211
34257
|
mappings,
|
|
34212
34258
|
createLossReport()
|
|
@@ -34217,10 +34263,10 @@ function classifyCodexFiles(config, sourceRoot, configDir, scope, projectRoot) {
|
|
|
34217
34263
|
--- tangyr managed rules ---
|
|
34218
34264
|
${rules.agentsAppendix}`.trim();
|
|
34219
34265
|
const agentFiles = ts(
|
|
34220
|
-
|
|
34266
|
+
path51.join(sourceRoot, config.source.agents, "*.md")
|
|
34221
34267
|
).sort();
|
|
34222
34268
|
const hooksPresent = hooksSourceExists(sourceRoot, config);
|
|
34223
|
-
const mcpSource =
|
|
34269
|
+
const mcpSource = path51.join(sourceRoot, config.source.mcp);
|
|
34224
34270
|
const ruleRows = rules.dotRulesFiles.length === 0 ? [
|
|
34225
34271
|
{
|
|
34226
34272
|
component: "rules",
|
|
@@ -34231,7 +34277,7 @@ ${rules.agentsAppendix}`.trim();
|
|
|
34231
34277
|
] : rules.dotRulesFiles.map(
|
|
34232
34278
|
(ruleFile) => classifyCompiledFile(
|
|
34233
34279
|
`rules/${ruleFile.name}`,
|
|
34234
|
-
|
|
34280
|
+
path51.join(resolveTargetPath(codexPaths.rules), ruleFile.name),
|
|
34235
34281
|
"codex",
|
|
34236
34282
|
void 0,
|
|
34237
34283
|
config,
|
|
@@ -34239,20 +34285,27 @@ ${rules.agentsAppendix}`.trim();
|
|
|
34239
34285
|
)
|
|
34240
34286
|
);
|
|
34241
34287
|
return [
|
|
34242
|
-
|
|
34243
|
-
|
|
34288
|
+
// Through `classifyInstructions`, like every other target, because the
|
|
34289
|
+
// destination may be the shared project-root `AGENTS.md`. Asking
|
|
34290
|
+
// `classifyCompiledFile` directly compares the marker's target against
|
|
34291
|
+
// "codex", and on that file the marker names whoever wrote last — so any
|
|
34292
|
+
// run where another target wrote after codex reported drift on a file that
|
|
34293
|
+
// was exactly what the kit said it should be.
|
|
34294
|
+
classifyInstructions(
|
|
34244
34295
|
resolveTargetPath(codexPaths.instructions),
|
|
34245
34296
|
"codex",
|
|
34246
34297
|
hashString6(composedInstructions),
|
|
34247
34298
|
config,
|
|
34248
|
-
sourceRoot
|
|
34299
|
+
sourceRoot,
|
|
34300
|
+
scope,
|
|
34301
|
+
projectRoot
|
|
34249
34302
|
),
|
|
34250
34303
|
...agentFiles.map(
|
|
34251
34304
|
(agentFile) => classifyCompiledFile(
|
|
34252
|
-
`agents/${
|
|
34253
|
-
|
|
34305
|
+
`agents/${path51.basename(agentFile, ".md")}`,
|
|
34306
|
+
path51.join(
|
|
34254
34307
|
resolveTargetPath(codexPaths.agents),
|
|
34255
|
-
`${
|
|
34308
|
+
`${path51.basename(agentFile, ".md")}.toml`
|
|
34256
34309
|
),
|
|
34257
34310
|
"codex",
|
|
34258
34311
|
computeSourceHash(agentFile),
|
|
@@ -34346,20 +34399,20 @@ function classifyCopilotFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
34346
34399
|
mcpSharedFile: paths.mcp_shared_file
|
|
34347
34400
|
};
|
|
34348
34401
|
const agentFiles = ts(
|
|
34349
|
-
|
|
34402
|
+
path51.join(sourceRoot, config.source.agents, "*.md")
|
|
34350
34403
|
).sort();
|
|
34351
34404
|
const commandFiles = ts(
|
|
34352
|
-
|
|
34405
|
+
path51.join(sourceRoot, config.source.commands, "*.md")
|
|
34353
34406
|
).sort();
|
|
34354
34407
|
const hooksPresent = hooksSourceExists(sourceRoot, config);
|
|
34355
|
-
const mcpSource =
|
|
34408
|
+
const mcpSource = path51.join(sourceRoot, config.source.mcp);
|
|
34356
34409
|
return [
|
|
34357
34410
|
...agentFiles.map(
|
|
34358
34411
|
(agentFile) => classifyCompiledFile(
|
|
34359
|
-
`agents/${
|
|
34360
|
-
|
|
34412
|
+
`agents/${path51.basename(agentFile, ".md")}`,
|
|
34413
|
+
path51.join(
|
|
34361
34414
|
resolveTargetPath(copilotPaths.agents),
|
|
34362
|
-
`${
|
|
34415
|
+
`${path51.basename(agentFile, ".md")}.agent.md`
|
|
34363
34416
|
),
|
|
34364
34417
|
"copilot",
|
|
34365
34418
|
computeSourceHash(agentFile),
|
|
@@ -34376,10 +34429,10 @@ function classifyCopilotFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
34376
34429
|
),
|
|
34377
34430
|
...commandFiles.map(
|
|
34378
34431
|
(commandFile) => classifyCompiledFile(
|
|
34379
|
-
`commands/${
|
|
34380
|
-
|
|
34432
|
+
`commands/${path51.basename(commandFile, ".md")}`,
|
|
34433
|
+
path51.join(
|
|
34381
34434
|
resolveTargetPath(copilotPaths.prompts),
|
|
34382
|
-
`${
|
|
34435
|
+
`${path51.basename(commandFile, ".md")}.prompt.md`
|
|
34383
34436
|
),
|
|
34384
34437
|
"copilot",
|
|
34385
34438
|
computeSourceHash(commandFile),
|
|
@@ -34398,14 +34451,14 @@ function classifyCopilotFiles(config, sourceRoot, configDir, scope, projectRoot)
|
|
|
34398
34451
|
sourceRoot
|
|
34399
34452
|
),
|
|
34400
34453
|
hooksPresent ? classifyCompiledHooksByProvenance(
|
|
34401
|
-
|
|
34454
|
+
path51.join(
|
|
34402
34455
|
resolveTargetPath(copilotPaths.hooks),
|
|
34403
34456
|
"tangyr-managed.json"
|
|
34404
34457
|
),
|
|
34405
34458
|
"copilot"
|
|
34406
34459
|
) : notConfiguredRow(
|
|
34407
34460
|
"hooks",
|
|
34408
|
-
|
|
34461
|
+
path51.join(
|
|
34409
34462
|
resolveTargetPath(copilotPaths.hooks),
|
|
34410
34463
|
"tangyr-managed.json"
|
|
34411
34464
|
)
|
|
@@ -34430,7 +34483,7 @@ function notConfiguredRow(component, filePath) {
|
|
|
34430
34483
|
}
|
|
34431
34484
|
function classifyDirectArtifact(artifact, config, sourceRoot) {
|
|
34432
34485
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
34433
|
-
const sourcePath = artifact.sourceKey === "instructions" ? instructionsSourcePath(sourceRoot, config) : artifact.sourceKey ?
|
|
34486
|
+
const sourcePath = artifact.sourceKey === "instructions" ? instructionsSourcePath(sourceRoot, config) : artifact.sourceKey ? path51.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
34434
34487
|
if (artifact.sourceKey === "skills" && artifactClass === "unmanaged-conflict") {
|
|
34435
34488
|
const perSkill = classifyPerSkillSlot(artifact.path, sourceRoot);
|
|
34436
34489
|
if (perSkill) {
|
|
@@ -34450,7 +34503,7 @@ function classifyDirectArtifact(artifact, config, sourceRoot) {
|
|
|
34450
34503
|
conformant: false
|
|
34451
34504
|
};
|
|
34452
34505
|
}
|
|
34453
|
-
if (artifactClass === "managed-compiled" &&
|
|
34506
|
+
if (artifactClass === "managed-compiled" && !isCompiledCurrent6(artifact.path)) {
|
|
34454
34507
|
return {
|
|
34455
34508
|
component: artifact.component,
|
|
34456
34509
|
className: "drift",
|
|
@@ -34542,7 +34595,7 @@ function classifyPerSkillSlot(slotPath, sourceRoot) {
|
|
|
34542
34595
|
return null;
|
|
34543
34596
|
}
|
|
34544
34597
|
const ours = links.filter(
|
|
34545
|
-
(entry) => isOurSymlink(
|
|
34598
|
+
(entry) => isOurSymlink(path51.join(slotPath, entry.name), sourceRoot)
|
|
34546
34599
|
);
|
|
34547
34600
|
if (ours.length === 0) {
|
|
34548
34601
|
return null;
|
|
@@ -34554,9 +34607,9 @@ function classifyClaudeSharedFiles(config, sourceRoot, settingsPath, claudeJsonP
|
|
|
34554
34607
|
classifyHooks(settingsPath),
|
|
34555
34608
|
classifySettings(
|
|
34556
34609
|
settingsPath,
|
|
34557
|
-
|
|
34610
|
+
path51.resolve(sourceRoot, config.source.settings)
|
|
34558
34611
|
),
|
|
34559
|
-
classifyMcp(claudeJsonPath,
|
|
34612
|
+
classifyMcp(claudeJsonPath, path51.resolve(sourceRoot, config.source.mcp))
|
|
34560
34613
|
];
|
|
34561
34614
|
}
|
|
34562
34615
|
function claudeSharedFileRows(config, sourceRoot, configDir, scope, projectRoot) {
|
|
@@ -34658,14 +34711,26 @@ function isSymlinkCurrent(linkPath, sourcePath) {
|
|
|
34658
34711
|
return false;
|
|
34659
34712
|
}
|
|
34660
34713
|
}
|
|
34661
|
-
function isCompiledCurrent6(filePath
|
|
34714
|
+
function isCompiledCurrent6(filePath) {
|
|
34662
34715
|
try {
|
|
34663
|
-
const
|
|
34664
|
-
|
|
34716
|
+
const content = fs49.readFileSync(filePath, "utf8");
|
|
34717
|
+
const marker = extractProvenanceMarker(content);
|
|
34718
|
+
if (!marker) {
|
|
34719
|
+
return false;
|
|
34720
|
+
}
|
|
34721
|
+
return marker.hash === hashString6(compiledBody(content));
|
|
34665
34722
|
} catch {
|
|
34666
34723
|
return false;
|
|
34667
34724
|
}
|
|
34668
34725
|
}
|
|
34726
|
+
function compiledBody(content) {
|
|
34727
|
+
const lines = content.split("\n");
|
|
34728
|
+
const first = lines.findIndex((line) => line.trim().length > 0);
|
|
34729
|
+
if (first >= 0 && extractProvenanceMarker(lines[first])) {
|
|
34730
|
+
return lines.slice(first + 1).join("\n").trim();
|
|
34731
|
+
}
|
|
34732
|
+
return content.trim();
|
|
34733
|
+
}
|
|
34669
34734
|
function classifyCompiledFile(component, filePath, target, expectedHash, config, sourceRoot, expectedContent) {
|
|
34670
34735
|
const artifactClass = classifyArtifact(filePath, config, sourceRoot);
|
|
34671
34736
|
if (artifactClass !== "managed-compiled") {
|
|
@@ -34722,7 +34787,7 @@ function hashString6(value) {
|
|
|
34722
34787
|
|
|
34723
34788
|
// src/commands/sync.ts
|
|
34724
34789
|
import fs50 from "fs";
|
|
34725
|
-
import
|
|
34790
|
+
import path52 from "path";
|
|
34726
34791
|
|
|
34727
34792
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
34728
34793
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -35392,13 +35457,13 @@ async function runSyncCommand(options, logger) {
|
|
|
35392
35457
|
reportHookRejections(
|
|
35393
35458
|
lossReport,
|
|
35394
35459
|
targets,
|
|
35395
|
-
|
|
35460
|
+
path52.resolve(kitInfo.path, "hooks"),
|
|
35396
35461
|
kitInfo.components.hooks.declared
|
|
35397
35462
|
);
|
|
35398
35463
|
const hooksConflict = reportHooksSourceConflict(
|
|
35399
35464
|
lossReport,
|
|
35400
35465
|
targets,
|
|
35401
|
-
|
|
35466
|
+
path52.resolve(kitInfo.path, "hooks"),
|
|
35402
35467
|
kitInfo.components.hooks.declared
|
|
35403
35468
|
);
|
|
35404
35469
|
if (hooksConflict) {
|
|
@@ -35430,7 +35495,11 @@ async function runSyncCommand(options, logger) {
|
|
|
35430
35495
|
recordCoverageLoss(coverage, lossReport);
|
|
35431
35496
|
}
|
|
35432
35497
|
}
|
|
35433
|
-
writeLossReport(
|
|
35498
|
+
writeLossReport(
|
|
35499
|
+
options.lossReport,
|
|
35500
|
+
lossReport,
|
|
35501
|
+
resolveScopePath(syncOptions.scope, syncOptions.projectRoot)
|
|
35502
|
+
);
|
|
35434
35503
|
printOutcomeTable(results);
|
|
35435
35504
|
if (kitInfo && kitSync && !options.dryRun) {
|
|
35436
35505
|
cleanupRemovedManagedArtifacts(
|
|
@@ -35614,7 +35683,7 @@ function reconcileSyncedArtifacts(manifest, results, mappings, scope, projectRoo
|
|
|
35614
35683
|
}
|
|
35615
35684
|
}
|
|
35616
35685
|
function resolveKitFilePath(kitPath, relativePath) {
|
|
35617
|
-
const fullPath =
|
|
35686
|
+
const fullPath = path52.join(kitPath, relativePath);
|
|
35618
35687
|
return fs50.existsSync(fullPath) ? fullPath : null;
|
|
35619
35688
|
}
|
|
35620
35689
|
function cleanupRemovedManagedArtifacts(config, mappings, targets, options, removedSourcePaths, logger) {
|
|
@@ -35678,9 +35747,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
35678
35747
|
}
|
|
35679
35748
|
if (relativePath.startsWith("agents/")) {
|
|
35680
35749
|
removeManagedCompiledArtifact2(
|
|
35681
|
-
|
|
35750
|
+
path52.join(
|
|
35682
35751
|
resolveTargetPath(paths.agents ?? ""),
|
|
35683
|
-
`${
|
|
35752
|
+
`${path52.parse(relativePath).name}.agent.md`
|
|
35684
35753
|
),
|
|
35685
35754
|
"copilot",
|
|
35686
35755
|
relativePath,
|
|
@@ -35690,9 +35759,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
35690
35759
|
}
|
|
35691
35760
|
if (relativePath.startsWith("commands/")) {
|
|
35692
35761
|
removeManagedCompiledArtifact2(
|
|
35693
|
-
|
|
35762
|
+
path52.join(
|
|
35694
35763
|
resolveTargetPath(paths.prompts ?? ""),
|
|
35695
|
-
`${
|
|
35764
|
+
`${path52.parse(relativePath).name}.prompt.md`
|
|
35696
35765
|
),
|
|
35697
35766
|
"copilot",
|
|
35698
35767
|
relativePath,
|
|
@@ -35702,7 +35771,7 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
35702
35771
|
}
|
|
35703
35772
|
if (relativePath.endsWith("hooks.json")) {
|
|
35704
35773
|
removeManagedCompiledArtifact2(
|
|
35705
|
-
|
|
35774
|
+
path52.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
35706
35775
|
"copilot",
|
|
35707
35776
|
relativePath,
|
|
35708
35777
|
logger
|
|
@@ -35732,9 +35801,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
35732
35801
|
}
|
|
35733
35802
|
if (relativePath.startsWith("agents/")) {
|
|
35734
35803
|
removeManagedCompiledArtifact2(
|
|
35735
|
-
|
|
35804
|
+
path52.join(
|
|
35736
35805
|
resolveTargetPath(paths.agents ?? ""),
|
|
35737
|
-
`${
|
|
35806
|
+
`${path52.parse(relativePath).name}.toml`
|
|
35738
35807
|
),
|
|
35739
35808
|
"codex",
|
|
35740
35809
|
relativePath,
|
|
@@ -35744,9 +35813,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
35744
35813
|
}
|
|
35745
35814
|
if (relativePath.startsWith("rules/")) {
|
|
35746
35815
|
removeManagedCompiledArtifact2(
|
|
35747
|
-
|
|
35816
|
+
path52.join(
|
|
35748
35817
|
resolveTargetPath(paths.rules ?? ""),
|
|
35749
|
-
`${
|
|
35818
|
+
`${path52.parse(relativePath).name}.rules`
|
|
35750
35819
|
),
|
|
35751
35820
|
"codex",
|
|
35752
35821
|
relativePath,
|
|
@@ -35785,9 +35854,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
35785
35854
|
}
|
|
35786
35855
|
if (relativePath.startsWith("agents/")) {
|
|
35787
35856
|
removeManagedCompiledArtifact2(
|
|
35788
|
-
|
|
35857
|
+
path52.join(
|
|
35789
35858
|
resolveTargetPath(paths.agents ?? ""),
|
|
35790
|
-
`${
|
|
35859
|
+
`${path52.parse(relativePath).name}.md`
|
|
35791
35860
|
),
|
|
35792
35861
|
"opencode",
|
|
35793
35862
|
relativePath,
|
|
@@ -35797,9 +35866,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
35797
35866
|
}
|
|
35798
35867
|
if (relativePath.startsWith("commands/")) {
|
|
35799
35868
|
removeManagedCompiledArtifact2(
|
|
35800
|
-
|
|
35869
|
+
path52.join(
|
|
35801
35870
|
resolveTargetPath(paths.commands ?? ""),
|
|
35802
|
-
`${
|
|
35871
|
+
`${path52.parse(relativePath).name}.md`
|
|
35803
35872
|
),
|
|
35804
35873
|
"opencode",
|
|
35805
35874
|
relativePath,
|
|
@@ -35831,9 +35900,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
35831
35900
|
}
|
|
35832
35901
|
if (relativePath.startsWith("agents/")) {
|
|
35833
35902
|
removeManagedCompiledArtifact2(
|
|
35834
|
-
|
|
35903
|
+
path52.join(
|
|
35835
35904
|
resolveTargetPath(paths.agents ?? ""),
|
|
35836
|
-
`${
|
|
35905
|
+
`${path52.parse(relativePath).name}.md`
|
|
35837
35906
|
),
|
|
35838
35907
|
"cursor",
|
|
35839
35908
|
relativePath,
|
|
@@ -35843,9 +35912,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
35843
35912
|
}
|
|
35844
35913
|
if (relativePath.startsWith("rules/")) {
|
|
35845
35914
|
removeManagedCompiledArtifact2(
|
|
35846
|
-
|
|
35915
|
+
path52.join(
|
|
35847
35916
|
resolveTargetPath(paths.rules ?? ""),
|
|
35848
|
-
`${
|
|
35917
|
+
`${path52.parse(relativePath).name}.mdc`
|
|
35849
35918
|
),
|
|
35850
35919
|
"cursor",
|
|
35851
35920
|
relativePath,
|
|
@@ -35855,9 +35924,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
35855
35924
|
}
|
|
35856
35925
|
if (relativePath.startsWith("commands/")) {
|
|
35857
35926
|
removeManagedCompiledArtifact2(
|
|
35858
|
-
|
|
35927
|
+
path52.join(
|
|
35859
35928
|
resolveTargetPath(paths.skills ?? ""),
|
|
35860
|
-
|
|
35929
|
+
path52.parse(relativePath).name,
|
|
35861
35930
|
"SKILL.md"
|
|
35862
35931
|
),
|
|
35863
35932
|
"cursor",
|
|
@@ -35901,9 +35970,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
35901
35970
|
}
|
|
35902
35971
|
if (relativePath.startsWith("rules/")) {
|
|
35903
35972
|
removeManagedCompiledArtifact2(
|
|
35904
|
-
|
|
35973
|
+
path52.join(
|
|
35905
35974
|
resolveTargetPath(paths.rules ?? ""),
|
|
35906
|
-
`${
|
|
35975
|
+
`${path52.parse(relativePath).name}.md`
|
|
35907
35976
|
),
|
|
35908
35977
|
"cline",
|
|
35909
35978
|
relativePath,
|
|
@@ -35913,9 +35982,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
35913
35982
|
}
|
|
35914
35983
|
if (relativePath.startsWith("commands/")) {
|
|
35915
35984
|
removeManagedCompiledArtifact2(
|
|
35916
|
-
|
|
35985
|
+
path52.join(
|
|
35917
35986
|
resolveTargetPath(paths.workflows ?? ""),
|
|
35918
|
-
|
|
35987
|
+
path52.basename(relativePath)
|
|
35919
35988
|
),
|
|
35920
35989
|
"cline",
|
|
35921
35990
|
relativePath,
|
|
@@ -36084,7 +36153,7 @@ function removeManagedHookEntries(value, expectedSource) {
|
|
|
36084
36153
|
|
|
36085
36154
|
// src/commands/validate.ts
|
|
36086
36155
|
import fs51 from "fs";
|
|
36087
|
-
import
|
|
36156
|
+
import path53 from "path";
|
|
36088
36157
|
var SUPPORTED_KIT_FORMATS2 = [1];
|
|
36089
36158
|
var SUPPORTED_DISCIPLINE_VERSIONS = [
|
|
36090
36159
|
"0.14.0",
|
|
@@ -36199,11 +36268,11 @@ function checkArchetype(kit) {
|
|
|
36199
36268
|
}
|
|
36200
36269
|
function checkHookScriptsExist(kit) {
|
|
36201
36270
|
const violations = [];
|
|
36202
|
-
const hooksDir =
|
|
36271
|
+
const hooksDir = path53.join(kit.path, "hooks");
|
|
36203
36272
|
const missingSet = new Set(kit.components.hooks.missing);
|
|
36204
36273
|
for (const name of kit.components.hooks.declared) {
|
|
36205
36274
|
if (missingSet.has(name)) continue;
|
|
36206
|
-
const declarationPath =
|
|
36275
|
+
const declarationPath = path53.join(hooksDir, `${name}.md`);
|
|
36207
36276
|
if (!fs51.existsSync(declarationPath)) continue;
|
|
36208
36277
|
let data;
|
|
36209
36278
|
try {
|
|
@@ -36214,7 +36283,7 @@ function checkHookScriptsExist(kit) {
|
|
|
36214
36283
|
if (typeof data.command === "string" && data.command.trim().length > 0) {
|
|
36215
36284
|
continue;
|
|
36216
36285
|
}
|
|
36217
|
-
const scriptPath =
|
|
36286
|
+
const scriptPath = path53.join(hooksDir, "scripts", `${name}.ts`);
|
|
36218
36287
|
if (!fs51.existsSync(scriptPath)) {
|
|
36219
36288
|
violations.push({
|
|
36220
36289
|
code: "hook-script-missing",
|
|
@@ -36228,7 +36297,7 @@ function checkHookScriptsExist(kit) {
|
|
|
36228
36297
|
function checkOptionalSourceDocuments(kit) {
|
|
36229
36298
|
const violations = [];
|
|
36230
36299
|
for (const name of [".mcp.json", "settings.json", ".lsp.json"]) {
|
|
36231
|
-
const filePath =
|
|
36300
|
+
const filePath = path53.join(kit.path, name);
|
|
36232
36301
|
if (!fs51.existsSync(filePath)) continue;
|
|
36233
36302
|
try {
|
|
36234
36303
|
const parsed = JSON.parse(fs51.readFileSync(filePath, "utf8"));
|
|
@@ -36253,7 +36322,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
36253
36322
|
const notices = [];
|
|
36254
36323
|
const canonical = new Set(CANONICAL_SKILL_SUBFOLDERS);
|
|
36255
36324
|
for (const name of kit.components.skills.declared) {
|
|
36256
|
-
const skillDir =
|
|
36325
|
+
const skillDir = path53.join(kit.path, "skills", name);
|
|
36257
36326
|
let entries;
|
|
36258
36327
|
try {
|
|
36259
36328
|
entries = fs51.readdirSync(skillDir, { withFileTypes: true });
|
|
@@ -36274,7 +36343,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
36274
36343
|
return notices;
|
|
36275
36344
|
}
|
|
36276
36345
|
function checkHooksSourceForm(kit) {
|
|
36277
|
-
const hooksDir =
|
|
36346
|
+
const hooksDir = path53.join(kit.path, "hooks");
|
|
36278
36347
|
const message = describeHooksSourceConflict(
|
|
36279
36348
|
hooksDir,
|
|
36280
36349
|
kit.components.hooks.declared
|
|
@@ -36286,12 +36355,12 @@ function checkHooksSourceForm(kit) {
|
|
|
36286
36355
|
} : null;
|
|
36287
36356
|
}
|
|
36288
36357
|
function checkHookDeclarations(kit) {
|
|
36289
|
-
const hooksDir =
|
|
36358
|
+
const hooksDir = path53.join(kit.path, "hooks");
|
|
36290
36359
|
return collectHookRejections(hooksDir, kit.components.hooks.declared).map(
|
|
36291
36360
|
(r) => ({
|
|
36292
36361
|
code: "hook-declaration-invalid",
|
|
36293
|
-
location: `hooks/${
|
|
36294
|
-
message: `hooks: '${
|
|
36362
|
+
location: `hooks/${path53.basename(r.file)}`,
|
|
36363
|
+
message: `hooks: '${path53.basename(r.file, ".md")}' was rejected at '${r.field}' \u2014 ${r.reason}. Until this is fixed the hook is not installed on any target; install and sync report it as an error-severity loss and exit 3. To fix: correct the field named above in this file.`
|
|
36295
36364
|
})
|
|
36296
36365
|
);
|
|
36297
36366
|
}
|
|
@@ -36311,11 +36380,11 @@ function checkKitFormatSupported(kit) {
|
|
|
36311
36380
|
function checkEntrypointExists(kit) {
|
|
36312
36381
|
const declared = kit.entrypoint;
|
|
36313
36382
|
const entrypoint = declared ?? DEFAULT_ENTRYPOINT;
|
|
36314
|
-
const entrypointPath =
|
|
36383
|
+
const entrypointPath = path53.join(kit.path, entrypoint);
|
|
36315
36384
|
if (fs51.existsSync(entrypointPath)) {
|
|
36316
36385
|
return null;
|
|
36317
36386
|
}
|
|
36318
|
-
const legacyPresent = declared === void 0 && fs51.existsSync(
|
|
36387
|
+
const legacyPresent = declared === void 0 && fs51.existsSync(path53.join(kit.path, LEGACY_ENTRYPOINT));
|
|
36319
36388
|
const remedy = legacyPresent ? `This kit has '${LEGACY_ENTRYPOINT}' but not '${DEFAULT_ENTRYPOINT}'. Until now validate looked for '${LEGACY_ENTRYPOINT}' unconditionally; it now reads the manifest's 'entrypoint', defaulting to '${DEFAULT_ENTRYPOINT}' \u2014 the contract's canonical orientation document, of which '${LEGACY_ENTRYPOINT}' is a target translation. To fix: either add "entrypoint: ${LEGACY_ENTRYPOINT}" to tangyr-kit.yaml to keep the current filename, or rename '${LEGACY_ENTRYPOINT}' to '${DEFAULT_ENTRYPOINT}'.` : declared === void 0 ? `No 'entrypoint' is declared in tangyr-kit.yaml, so '${DEFAULT_ENTRYPOINT}' is expected at the kit root. To fix: create it, or declare the file you use with "entrypoint: <filename>".` : `tangyr-kit.yaml declares "entrypoint: ${declared}", and no such file exists at the kit root. To fix: create it, or correct the declaration.`;
|
|
36320
36389
|
return {
|
|
36321
36390
|
code: "entrypoint-missing",
|
|
@@ -36374,9 +36443,9 @@ function checkComponentFrontmatter(kit) {
|
|
|
36374
36443
|
const missingSet = new Set(kit.components[cat].missing);
|
|
36375
36444
|
for (const name of kit.components[cat].declared) {
|
|
36376
36445
|
if (missingSet.has(name)) continue;
|
|
36377
|
-
const filePath = cat === "skills" ?
|
|
36446
|
+
const filePath = cat === "skills" ? path53.join(kit.path, cat, name, "SKILL.md") : path53.join(kit.path, cat, `${name}.md`);
|
|
36378
36447
|
if (!fs51.existsSync(filePath)) continue;
|
|
36379
|
-
const relPath =
|
|
36448
|
+
const relPath = path53.relative(kit.path, filePath);
|
|
36380
36449
|
try {
|
|
36381
36450
|
const { data } = parseMarkdownFrontmatter(filePath);
|
|
36382
36451
|
for (const field of requiredFields) {
|
|
@@ -36421,7 +36490,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
36421
36490
|
const missingSet = new Set(kit.components.commands.missing);
|
|
36422
36491
|
for (const name of kit.components.commands.declared) {
|
|
36423
36492
|
if (missingSet.has(name)) continue;
|
|
36424
|
-
const filePath =
|
|
36493
|
+
const filePath = path53.join(kit.path, "commands", `${name}.md`);
|
|
36425
36494
|
if (!fs51.existsSync(filePath)) continue;
|
|
36426
36495
|
let data;
|
|
36427
36496
|
try {
|
|
@@ -36435,7 +36504,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
36435
36504
|
if (!barred) {
|
|
36436
36505
|
violations.push({
|
|
36437
36506
|
code: "command-human-only-model-invocable",
|
|
36438
|
-
location:
|
|
36507
|
+
location: path53.relative(kit.path, filePath),
|
|
36439
36508
|
message: "commands: 'launch: human-only' requires 'disable-model-invocation: true' so the model cannot start the command; only a Human-typed launch may"
|
|
36440
36509
|
});
|
|
36441
36510
|
}
|
|
@@ -36445,7 +36514,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
36445
36514
|
|
|
36446
36515
|
// src/commands/verify.ts
|
|
36447
36516
|
import fs52 from "fs";
|
|
36448
|
-
import
|
|
36517
|
+
import path54 from "path";
|
|
36449
36518
|
function runVerifyCommand(options, logger) {
|
|
36450
36519
|
if (options.target && !isKnownTarget(options.target)) {
|
|
36451
36520
|
throwUnrecognizedTarget(options.target);
|
|
@@ -36626,7 +36695,7 @@ function verifyClaudeCodeGlobalRoots(roots, manifestKeys, mappings) {
|
|
|
36626
36695
|
if (!slotPath) {
|
|
36627
36696
|
continue;
|
|
36628
36697
|
}
|
|
36629
|
-
const fullPath = subPath ?
|
|
36698
|
+
const fullPath = subPath ? path54.join(slotPath, subPath) : slotPath;
|
|
36630
36699
|
if (!fs52.existsSync(fullPath)) {
|
|
36631
36700
|
failures.push(
|
|
36632
36701
|
`claude-code/${slot}${subPath ? `/${subPath}` : ""} missing in root ${root}: ${fullPath}`
|