@alessandroraffa/tangyr 0.21.2 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +513 -487
- package/package.json +1 -1
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 path48 = __require("path");
|
|
1376
1376
|
var fs46 = __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 = path48.resolve(baseDir, baseName);
|
|
2389
2389
|
if (fs46.existsSync(localBin)) return localBin;
|
|
2390
|
-
if (sourceExt.includes(
|
|
2390
|
+
if (sourceExt.includes(path48.extname(baseName))) return void 0;
|
|
2391
2391
|
const foundExt = sourceExt.find(
|
|
2392
2392
|
(ext) => fs46.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 = path48.resolve(
|
|
2409
|
+
path48.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 = path48.basename(
|
|
2417
2417
|
this._scriptPath,
|
|
2418
|
-
|
|
2418
|
+
path48.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(path48.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 = path48.basename(filename, path48.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(path49) {
|
|
3359
|
+
if (path49 === void 0) return this._executableDir;
|
|
3360
|
+
this._executableDir = path49;
|
|
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, path48) {
|
|
3717
|
+
const ctrl = callVisitor(key, node, visitor, path48);
|
|
3718
3718
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3719
|
-
replaceNode(key,
|
|
3720
|
-
return visit_(key, ctrl, visitor,
|
|
3719
|
+
replaceNode(key, path48, ctrl);
|
|
3720
|
+
return visit_(key, ctrl, visitor, path48);
|
|
3721
3721
|
}
|
|
3722
3722
|
if (typeof ctrl !== "symbol") {
|
|
3723
3723
|
if (identity.isCollection(node)) {
|
|
3724
|
-
|
|
3724
|
+
path48 = Object.freeze(path48.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, path48);
|
|
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
|
+
path48 = Object.freeze(path48.concat(node));
|
|
3738
|
+
const ck = visit_("key", node.key, visitor, path48);
|
|
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, path48);
|
|
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, path48) {
|
|
3765
|
+
const ctrl = await callVisitor(key, node, visitor, path48);
|
|
3766
3766
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3767
|
-
replaceNode(key,
|
|
3768
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3767
|
+
replaceNode(key, path48, ctrl);
|
|
3768
|
+
return visitAsync_(key, ctrl, visitor, path48);
|
|
3769
3769
|
}
|
|
3770
3770
|
if (typeof ctrl !== "symbol") {
|
|
3771
3771
|
if (identity.isCollection(node)) {
|
|
3772
|
-
|
|
3772
|
+
path48 = Object.freeze(path48.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, path48);
|
|
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
|
+
path48 = Object.freeze(path48.concat(node));
|
|
3786
|
+
const ck = await visitAsync_("key", node.key, visitor, path48);
|
|
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, path48);
|
|
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, path48) {
|
|
3819
3819
|
if (typeof visitor === "function")
|
|
3820
|
-
return visitor(key, node,
|
|
3820
|
+
return visitor(key, node, path48);
|
|
3821
3821
|
if (identity.isMap(node))
|
|
3822
|
-
return visitor.Map?.(key, node,
|
|
3822
|
+
return visitor.Map?.(key, node, path48);
|
|
3823
3823
|
if (identity.isSeq(node))
|
|
3824
|
-
return visitor.Seq?.(key, node,
|
|
3824
|
+
return visitor.Seq?.(key, node, path48);
|
|
3825
3825
|
if (identity.isPair(node))
|
|
3826
|
-
return visitor.Pair?.(key, node,
|
|
3826
|
+
return visitor.Pair?.(key, node, path48);
|
|
3827
3827
|
if (identity.isScalar(node))
|
|
3828
|
-
return visitor.Scalar?.(key, node,
|
|
3828
|
+
return visitor.Scalar?.(key, node, path48);
|
|
3829
3829
|
if (identity.isAlias(node))
|
|
3830
|
-
return visitor.Alias?.(key, node,
|
|
3830
|
+
return visitor.Alias?.(key, node, path48);
|
|
3831
3831
|
return void 0;
|
|
3832
3832
|
}
|
|
3833
|
-
function replaceNode(key,
|
|
3834
|
-
const parent =
|
|
3833
|
+
function replaceNode(key, path48, node) {
|
|
3834
|
+
const parent = path48[path48.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, path48, value) {
|
|
4443
4443
|
let v2 = value;
|
|
4444
|
-
for (let i =
|
|
4445
|
-
const k2 =
|
|
4444
|
+
for (let i = path48.length - 1; i >= 0; --i) {
|
|
4445
|
+
const k2 = path48[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 = (path48) => path48 == null || typeof path48 === "object" && !!path48[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(path48, value) {
|
|
4495
|
+
if (isEmptyPath(path48))
|
|
4496
4496
|
this.add(value);
|
|
4497
4497
|
else {
|
|
4498
|
-
const [key, ...rest] =
|
|
4498
|
+
const [key, ...rest] = path48;
|
|
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(path48) {
|
|
4513
|
+
const [key, ...rest] = path48;
|
|
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(path48, keepScalar) {
|
|
4528
|
+
const [key, ...rest] = path48;
|
|
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(path48) {
|
|
4547
|
+
const [key, ...rest] = path48;
|
|
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(path48, value) {
|
|
4558
|
+
const [key, ...rest] = path48;
|
|
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(path48, value) {
|
|
7071
7071
|
if (assertCollection(this.contents))
|
|
7072
|
-
this.contents.addIn(
|
|
7072
|
+
this.contents.addIn(path48, 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(path48) {
|
|
7148
|
+
if (Collection.isEmptyPath(path48)) {
|
|
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(path48) : 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(path48, keepScalar) {
|
|
7170
|
+
if (Collection.isEmptyPath(path48))
|
|
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(path48, 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(path48) {
|
|
7184
|
+
if (Collection.isEmptyPath(path48))
|
|
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(path48) : 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(path48, value) {
|
|
7204
|
+
if (Collection.isEmptyPath(path48)) {
|
|
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(path48), value);
|
|
7208
7208
|
} else if (assertCollection(this.contents)) {
|
|
7209
|
-
this.contents.setIn(
|
|
7209
|
+
this.contents.setIn(path48, 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, path48) => {
|
|
9167
9167
|
let item = cst;
|
|
9168
|
-
for (const [field, index] of
|
|
9168
|
+
for (const [field, index] of path48) {
|
|
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, path48) => {
|
|
9178
|
+
const parent = visit.itemAtPath(cst, path48.slice(0, -1));
|
|
9179
|
+
const field = path48[path48.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(path48, item, visitor) {
|
|
9186
|
+
let ctrl = visitor(item, path48);
|
|
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(path48.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, path48);
|
|
9205
9205
|
}
|
|
9206
9206
|
}
|
|
9207
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9207
|
+
return typeof ctrl === "function" ? ctrl(item, path48) : ctrl;
|
|
9208
9208
|
}
|
|
9209
9209
|
exports2.visit = visit;
|
|
9210
9210
|
}
|
|
@@ -17875,7 +17875,7 @@ async function runCacheClearCommand(options, logger) {
|
|
|
17875
17875
|
|
|
17876
17876
|
// src/commands/cleanup.ts
|
|
17877
17877
|
import fs27 from "fs";
|
|
17878
|
-
import
|
|
17878
|
+
import path25 from "path";
|
|
17879
17879
|
|
|
17880
17880
|
// node_modules/glob/dist/esm/index.min.js
|
|
17881
17881
|
import { fileURLToPath as Wi } from "url";
|
|
@@ -21022,7 +21022,7 @@ function removeManagedEntries(filePath, parser, serializer, removeManaged, logge
|
|
|
21022
21022
|
|
|
21023
21023
|
// src/commands/uninstall.ts
|
|
21024
21024
|
import fs26 from "fs";
|
|
21025
|
-
import
|
|
21025
|
+
import path24 from "path";
|
|
21026
21026
|
|
|
21027
21027
|
// src/core/managed-sources.ts
|
|
21028
21028
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
@@ -21599,6 +21599,26 @@ function isSymlinkTo(linkPath, source) {
|
|
|
21599
21599
|
}
|
|
21600
21600
|
}
|
|
21601
21601
|
|
|
21602
|
+
// src/core/shared-artifacts.ts
|
|
21603
|
+
import path23 from "path";
|
|
21604
|
+
var SHARED_NAMESPACE = "shared";
|
|
21605
|
+
var SHARED_INSTRUCTIONS_KEY = `${SHARED_NAMESPACE}/AGENTS.md`;
|
|
21606
|
+
var SHARED_INSTRUCTIONS_FILE = "AGENTS.md";
|
|
21607
|
+
function sharedArtifactKey(destination, scope, projectRoot) {
|
|
21608
|
+
if (scope !== "project") {
|
|
21609
|
+
return null;
|
|
21610
|
+
}
|
|
21611
|
+
const root = projectRoot ?? process.cwd();
|
|
21612
|
+
const shared = path23.resolve(root, SHARED_INSTRUCTIONS_FILE);
|
|
21613
|
+
return path23.resolve(destination) === shared ? SHARED_INSTRUCTIONS_KEY : null;
|
|
21614
|
+
}
|
|
21615
|
+
function resolveSharedArtifactKey(key, scope, projectRoot) {
|
|
21616
|
+
if (key !== SHARED_INSTRUCTIONS_KEY || scope !== "project") {
|
|
21617
|
+
return null;
|
|
21618
|
+
}
|
|
21619
|
+
return path23.join(projectRoot ?? process.cwd(), SHARED_INSTRUCTIONS_FILE);
|
|
21620
|
+
}
|
|
21621
|
+
|
|
21602
21622
|
// src/core/remove.ts
|
|
21603
21623
|
import fs25 from "fs";
|
|
21604
21624
|
function removeManagedPath(managedPath) {
|
|
@@ -21769,7 +21789,7 @@ async function runUninstallCommand(options, logger) {
|
|
|
21769
21789
|
for (const backup of manifest.backups) {
|
|
21770
21790
|
restoreBackup(backup, logger);
|
|
21771
21791
|
}
|
|
21772
|
-
const manifestPath =
|
|
21792
|
+
const manifestPath = path24.join(scopePath, "manifest.json");
|
|
21773
21793
|
if (fs26.existsSync(manifestPath)) {
|
|
21774
21794
|
fs26.unlinkSync(manifestPath);
|
|
21775
21795
|
logger.verbose(` removed manifest: ${manifestPath}`);
|
|
@@ -21811,7 +21831,7 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21811
21831
|
if (component === "hook_scripts") {
|
|
21812
21832
|
return resolveSharedHookScriptsPath(runtime, scope, projectRoot);
|
|
21813
21833
|
}
|
|
21814
|
-
return
|
|
21834
|
+
return resolveSharedArtifactKey(key, scope, projectRoot);
|
|
21815
21835
|
}
|
|
21816
21836
|
if (tool === "claude-code") {
|
|
21817
21837
|
const claudePaths = resolveClaudeCodePaths(runtime, scope, projectRoot);
|
|
@@ -21827,7 +21847,7 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21827
21847
|
if (!slotPath) {
|
|
21828
21848
|
return null;
|
|
21829
21849
|
}
|
|
21830
|
-
return subPath ?
|
|
21850
|
+
return subPath ? path24.join(slotPath, subPath) : slotPath;
|
|
21831
21851
|
}
|
|
21832
21852
|
if (tool === "copilot") {
|
|
21833
21853
|
const copilotPaths = resolveCopilotPaths(runtime, scope, projectRoot);
|
|
@@ -21835,21 +21855,21 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21835
21855
|
return copilotPaths.skills;
|
|
21836
21856
|
}
|
|
21837
21857
|
if (component.startsWith("agents/")) {
|
|
21838
|
-
return
|
|
21858
|
+
return path24.join(copilotPaths.agents, component.slice("agents/".length));
|
|
21839
21859
|
}
|
|
21840
21860
|
if (component.startsWith("prompts/")) {
|
|
21841
|
-
return
|
|
21861
|
+
return path24.join(
|
|
21842
21862
|
copilotPaths.prompts,
|
|
21843
21863
|
component.slice("prompts/".length)
|
|
21844
21864
|
);
|
|
21845
21865
|
}
|
|
21846
21866
|
if (component.startsWith("hooks/")) {
|
|
21847
|
-
return
|
|
21867
|
+
return path24.join(copilotPaths.hooks, component.slice("hooks/".length));
|
|
21848
21868
|
}
|
|
21849
|
-
if (component ===
|
|
21869
|
+
if (component === path24.basename(copilotPaths.mcpSharedFile)) {
|
|
21850
21870
|
return copilotPaths.mcpSharedFile;
|
|
21851
21871
|
}
|
|
21852
|
-
if (copilotPaths.instructions !== null && component ===
|
|
21872
|
+
if (copilotPaths.instructions !== null && component === path24.basename(copilotPaths.instructions)) {
|
|
21853
21873
|
return copilotPaths.instructions;
|
|
21854
21874
|
}
|
|
21855
21875
|
return null;
|
|
@@ -21863,15 +21883,15 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21863
21883
|
return codexPaths.skills;
|
|
21864
21884
|
}
|
|
21865
21885
|
if (component.startsWith("agents/")) {
|
|
21866
|
-
return
|
|
21886
|
+
return path24.join(codexPaths.agents, component.slice("agents/".length));
|
|
21867
21887
|
}
|
|
21868
21888
|
if (component.startsWith("rules/")) {
|
|
21869
|
-
return
|
|
21889
|
+
return path24.join(codexPaths.rules, component.slice("rules/".length));
|
|
21870
21890
|
}
|
|
21871
|
-
if (component ===
|
|
21891
|
+
if (component === path24.basename(codexPaths.hooksSharedFile)) {
|
|
21872
21892
|
return codexPaths.hooksSharedFile;
|
|
21873
21893
|
}
|
|
21874
|
-
if (component ===
|
|
21894
|
+
if (component === path24.basename(codexPaths.mcpSharedFile)) {
|
|
21875
21895
|
return codexPaths.mcpSharedFile;
|
|
21876
21896
|
}
|
|
21877
21897
|
return null;
|
|
@@ -21888,15 +21908,15 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21888
21908
|
return opencodePaths.skillsShared;
|
|
21889
21909
|
}
|
|
21890
21910
|
if (component.startsWith("agents/")) {
|
|
21891
|
-
return
|
|
21911
|
+
return path24.join(opencodePaths.agents, component.slice("agents/".length));
|
|
21892
21912
|
}
|
|
21893
21913
|
if (component.startsWith("commands/")) {
|
|
21894
|
-
return
|
|
21914
|
+
return path24.join(
|
|
21895
21915
|
opencodePaths.commands,
|
|
21896
21916
|
component.slice("commands/".length)
|
|
21897
21917
|
);
|
|
21898
21918
|
}
|
|
21899
|
-
if (component ===
|
|
21919
|
+
if (component === path24.basename(opencodePaths.configDoc)) {
|
|
21900
21920
|
return opencodePaths.configDoc;
|
|
21901
21921
|
}
|
|
21902
21922
|
return null;
|
|
@@ -21922,13 +21942,13 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21922
21942
|
return cursorPaths.permissionsFile;
|
|
21923
21943
|
}
|
|
21924
21944
|
if (component.startsWith("agents/")) {
|
|
21925
|
-
return
|
|
21945
|
+
return path24.join(cursorPaths.agents, component.slice("agents/".length));
|
|
21926
21946
|
}
|
|
21927
21947
|
if (component.startsWith("rules/")) {
|
|
21928
|
-
return
|
|
21948
|
+
return path24.join(cursorPaths.rules, component.slice("rules/".length));
|
|
21929
21949
|
}
|
|
21930
21950
|
if (component.startsWith("skills/")) {
|
|
21931
|
-
return
|
|
21951
|
+
return path24.join(cursorPaths.skills, component.slice("skills/".length));
|
|
21932
21952
|
}
|
|
21933
21953
|
return null;
|
|
21934
21954
|
}
|
|
@@ -21944,10 +21964,10 @@ function resolveManifestKeyToPath(key, scope, runtime) {
|
|
|
21944
21964
|
return clinePaths.mcpFile;
|
|
21945
21965
|
}
|
|
21946
21966
|
if (component.startsWith("rules/")) {
|
|
21947
|
-
return
|
|
21967
|
+
return path24.join(clinePaths.rules, component.slice("rules/".length));
|
|
21948
21968
|
}
|
|
21949
21969
|
if (component.startsWith("workflows/")) {
|
|
21950
|
-
return
|
|
21970
|
+
return path24.join(
|
|
21951
21971
|
clinePaths.workflows,
|
|
21952
21972
|
component.slice("workflows/".length)
|
|
21953
21973
|
);
|
|
@@ -21981,22 +22001,22 @@ function resolveClaudeCodePaths(runtime, scope, projectRoot) {
|
|
|
21981
22001
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
21982
22002
|
if (scope === "global") {
|
|
21983
22003
|
return {
|
|
21984
|
-
instructions:
|
|
21985
|
-
agents:
|
|
21986
|
-
skills:
|
|
21987
|
-
commands:
|
|
21988
|
-
rules:
|
|
21989
|
-
output_styles:
|
|
22004
|
+
instructions: path24.join(home, ".claude", "CLAUDE.md"),
|
|
22005
|
+
agents: path24.join(home, ".claude", "agents"),
|
|
22006
|
+
skills: path24.join(home, ".claude", "skills"),
|
|
22007
|
+
commands: path24.join(home, ".claude", "commands"),
|
|
22008
|
+
rules: path24.join(home, ".claude", "rules"),
|
|
22009
|
+
output_styles: path24.join(home, ".claude", "output-styles")
|
|
21990
22010
|
};
|
|
21991
22011
|
}
|
|
21992
22012
|
const root = projectRoot ?? process.cwd();
|
|
21993
22013
|
return {
|
|
21994
|
-
instructions:
|
|
21995
|
-
agents:
|
|
21996
|
-
skills:
|
|
21997
|
-
commands:
|
|
21998
|
-
rules:
|
|
21999
|
-
output_styles:
|
|
22014
|
+
instructions: path24.join(root, "CLAUDE.md"),
|
|
22015
|
+
agents: path24.join(root, ".claude", "agents"),
|
|
22016
|
+
skills: path24.join(root, ".claude", "skills"),
|
|
22017
|
+
commands: path24.join(root, ".claude", "commands"),
|
|
22018
|
+
rules: path24.join(root, ".claude", "rules"),
|
|
22019
|
+
output_styles: path24.join(root, ".claude", "output-styles")
|
|
22000
22020
|
};
|
|
22001
22021
|
}
|
|
22002
22022
|
function resolveClaudeRootsForUninstall(manifest, runtime) {
|
|
@@ -22015,12 +22035,12 @@ function resolveClaudeRootsForUninstall(manifest, runtime) {
|
|
|
22015
22035
|
projectRoot: void 0,
|
|
22016
22036
|
mappings: mappings.platformPaths
|
|
22017
22037
|
})["claude-code"];
|
|
22018
|
-
return [
|
|
22038
|
+
return [path24.dirname(profile.agents)];
|
|
22019
22039
|
} catch {
|
|
22020
22040
|
}
|
|
22021
22041
|
}
|
|
22022
22042
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
22023
|
-
return [
|
|
22043
|
+
return [path24.resolve(expandHome(`${home}/.claude`))];
|
|
22024
22044
|
}
|
|
22025
22045
|
function resolveAllClaudeRoots(manifest, runtime, claudeConfigDirs) {
|
|
22026
22046
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
@@ -22032,13 +22052,13 @@ function resolveAllClaudeRoots(manifest, runtime, claudeConfigDirs) {
|
|
|
22032
22052
|
env: process.env.TANGYR_CLAUDE_CONFIG_DIRS,
|
|
22033
22053
|
config: runtime.config.claudeCodeGlobalPaths
|
|
22034
22054
|
})
|
|
22035
|
-
].map((root) =>
|
|
22055
|
+
].map((root) => path24.resolve(root))
|
|
22036
22056
|
);
|
|
22037
22057
|
if (home && fs26.existsSync(home)) {
|
|
22038
22058
|
try {
|
|
22039
22059
|
for (const entry of fs26.readdirSync(home, { withFileTypes: true })) {
|
|
22040
22060
|
if (entry.isDirectory() && entry.name.startsWith(".claude-")) {
|
|
22041
|
-
roots.add(
|
|
22061
|
+
roots.add(path24.resolve(home, entry.name));
|
|
22042
22062
|
}
|
|
22043
22063
|
}
|
|
22044
22064
|
} catch {
|
|
@@ -22057,13 +22077,13 @@ function resolveManifestKeyToMultiPaths(key, claudeRoots, runtime) {
|
|
|
22057
22077
|
const rootsToResolve = isShared ? [claudeRoots[0]] : claudeRoots;
|
|
22058
22078
|
if (!runtime) {
|
|
22059
22079
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
22060
|
-
const defaultRoot =
|
|
22080
|
+
const defaultRoot = path24.resolve(expandHome(`${home}/.claude`));
|
|
22061
22081
|
return rootsToResolve.flatMap((root) => {
|
|
22062
22082
|
const hardcoded = resolveHardcodedClaudeSlot(root, defaultRoot, slotName);
|
|
22063
22083
|
if (!hardcoded) {
|
|
22064
22084
|
return [];
|
|
22065
22085
|
}
|
|
22066
|
-
return [subPath ?
|
|
22086
|
+
return [subPath ? path24.join(hardcoded, subPath) : hardcoded];
|
|
22067
22087
|
});
|
|
22068
22088
|
}
|
|
22069
22089
|
try {
|
|
@@ -22082,17 +22102,17 @@ function resolveManifestKeyToMultiPaths(key, claudeRoots, runtime) {
|
|
|
22082
22102
|
if (!slotPath) {
|
|
22083
22103
|
return [];
|
|
22084
22104
|
}
|
|
22085
|
-
return [subPath ?
|
|
22105
|
+
return [subPath ? path24.join(slotPath, subPath) : slotPath];
|
|
22086
22106
|
});
|
|
22087
22107
|
} catch {
|
|
22088
22108
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
22089
|
-
const defaultRoot =
|
|
22109
|
+
const defaultRoot = path24.resolve(expandHome(`${home}/.claude`));
|
|
22090
22110
|
return rootsToResolve.flatMap((root) => {
|
|
22091
22111
|
const hardcoded = resolveHardcodedClaudeSlot(root, defaultRoot, slotName);
|
|
22092
22112
|
if (!hardcoded) {
|
|
22093
22113
|
return [];
|
|
22094
22114
|
}
|
|
22095
|
-
return [subPath ?
|
|
22115
|
+
return [subPath ? path24.join(hardcoded, subPath) : hardcoded];
|
|
22096
22116
|
});
|
|
22097
22117
|
}
|
|
22098
22118
|
}
|
|
@@ -22115,9 +22135,9 @@ function resolveHardcodedClaudeSlot(root, defaultRoot, slotName) {
|
|
|
22115
22135
|
return null;
|
|
22116
22136
|
}
|
|
22117
22137
|
if (root === defaultRoot) {
|
|
22118
|
-
return
|
|
22138
|
+
return path24.join(root, relative);
|
|
22119
22139
|
}
|
|
22120
|
-
return
|
|
22140
|
+
return path24.join(root, relative);
|
|
22121
22141
|
}
|
|
22122
22142
|
function resolveRuntimeIfAvailable(options, logger) {
|
|
22123
22143
|
try {
|
|
@@ -22191,7 +22211,7 @@ function addManagedSymlinkChildren(artifacts, directory, runtime, component) {
|
|
|
22191
22211
|
return;
|
|
22192
22212
|
}
|
|
22193
22213
|
for (const entry of entries) {
|
|
22194
|
-
const artifactPath =
|
|
22214
|
+
const artifactPath = path24.join(directory, entry.name);
|
|
22195
22215
|
const artifactClass = classifyArtifact(
|
|
22196
22216
|
artifactPath,
|
|
22197
22217
|
runtime.config,
|
|
@@ -22230,8 +22250,8 @@ function collectStringValuesByKey(value, keyName, values) {
|
|
|
22230
22250
|
}
|
|
22231
22251
|
function addLegacyOperatingGuideCopies(artifacts, claudeRoot) {
|
|
22232
22252
|
for (const artifactPath of [
|
|
22233
|
-
...ts(
|
|
22234
|
-
...ts(
|
|
22253
|
+
...ts(path24.join(claudeRoot, "CLAUDE.md.bak.*")),
|
|
22254
|
+
...ts(path24.join(claudeRoot, "AGENTS.md.bak.*"))
|
|
22235
22255
|
].sort()) {
|
|
22236
22256
|
artifacts.push({
|
|
22237
22257
|
component: "claude-code legacy operating guide backup",
|
|
@@ -22285,7 +22305,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22285
22305
|
for (const skill of runtime.kitInfo.components.skills.declared) {
|
|
22286
22306
|
artifacts.push({
|
|
22287
22307
|
component: "claude-code skill",
|
|
22288
|
-
path:
|
|
22308
|
+
path: path24.join(profile.skills, skill),
|
|
22289
22309
|
kind: "direct"
|
|
22290
22310
|
});
|
|
22291
22311
|
}
|
|
@@ -22304,7 +22324,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22304
22324
|
if (isFullToolUninstall(manifest, selectedTools)) {
|
|
22305
22325
|
addLegacyOperatingGuideCopies(
|
|
22306
22326
|
artifacts,
|
|
22307
|
-
|
|
22327
|
+
path24.dirname(profile.instructions)
|
|
22308
22328
|
);
|
|
22309
22329
|
}
|
|
22310
22330
|
}
|
|
@@ -22327,20 +22347,20 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22327
22347
|
if (selectedTools.has("copilot")) {
|
|
22328
22348
|
addCompiledGlobPlans(
|
|
22329
22349
|
artifacts,
|
|
22330
|
-
|
|
22350
|
+
path24.join(copilotPaths.agents, "*.agent.md"),
|
|
22331
22351
|
"copilot",
|
|
22332
22352
|
"copilot agent residue"
|
|
22333
22353
|
);
|
|
22334
22354
|
addCompiledGlobPlans(
|
|
22335
22355
|
artifacts,
|
|
22336
|
-
|
|
22356
|
+
path24.join(copilotPaths.prompts, "*.prompt.md"),
|
|
22337
22357
|
"copilot",
|
|
22338
22358
|
"copilot prompt residue"
|
|
22339
22359
|
);
|
|
22340
22360
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
22341
22361
|
artifacts.push({
|
|
22342
22362
|
component: "copilot agent",
|
|
22343
|
-
path:
|
|
22363
|
+
path: path24.join(copilotPaths.agents, `${agentEntry}.agent.md`),
|
|
22344
22364
|
kind: "compiled",
|
|
22345
22365
|
expectedTarget: "copilot",
|
|
22346
22366
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -22349,7 +22369,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22349
22369
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
22350
22370
|
artifacts.push({
|
|
22351
22371
|
component: "copilot prompt",
|
|
22352
|
-
path:
|
|
22372
|
+
path: path24.join(copilotPaths.prompts, `${commandEntry}.prompt.md`),
|
|
22353
22373
|
kind: "compiled",
|
|
22354
22374
|
expectedTarget: "copilot",
|
|
22355
22375
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -22365,13 +22385,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22365
22385
|
artifacts.push(
|
|
22366
22386
|
{
|
|
22367
22387
|
component: "copilot hooks",
|
|
22368
|
-
path:
|
|
22388
|
+
path: path24.join(copilotPaths.hooks, "tangyr-managed.json"),
|
|
22369
22389
|
kind: "managed-json",
|
|
22370
22390
|
expectedTarget: "copilot"
|
|
22371
22391
|
},
|
|
22372
22392
|
{
|
|
22373
22393
|
component: "copilot legacy hooks",
|
|
22374
|
-
path:
|
|
22394
|
+
path: path24.join(copilotPaths.hooks, "proteus-managed.json"),
|
|
22375
22395
|
kind: "managed-json",
|
|
22376
22396
|
expectedTarget: "copilot"
|
|
22377
22397
|
}
|
|
@@ -22380,7 +22400,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22380
22400
|
if (hooksSourceExists(runtime.sourceRoot, runtime.config)) {
|
|
22381
22401
|
artifacts.push({
|
|
22382
22402
|
component: "copilot hooks",
|
|
22383
|
-
path:
|
|
22403
|
+
path: path24.join(copilotPaths.hooks, "tangyr-managed.json"),
|
|
22384
22404
|
kind: "compiled",
|
|
22385
22405
|
expectedTarget: "copilot",
|
|
22386
22406
|
expectedSource: hooksSource
|
|
@@ -22410,13 +22430,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22410
22430
|
);
|
|
22411
22431
|
addCompiledGlobPlans(
|
|
22412
22432
|
artifacts,
|
|
22413
|
-
|
|
22433
|
+
path24.join(codexPaths.agents, "*.toml"),
|
|
22414
22434
|
"codex",
|
|
22415
22435
|
"codex agent residue"
|
|
22416
22436
|
);
|
|
22417
22437
|
addCompiledGlobPlans(
|
|
22418
22438
|
artifacts,
|
|
22419
|
-
|
|
22439
|
+
path24.join(codexPaths.rules, "*.rules"),
|
|
22420
22440
|
"codex",
|
|
22421
22441
|
"codex rule residue"
|
|
22422
22442
|
);
|
|
@@ -22430,7 +22450,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22430
22450
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
22431
22451
|
artifacts.push({
|
|
22432
22452
|
component: "codex agent",
|
|
22433
|
-
path:
|
|
22453
|
+
path: path24.join(codexPaths.agents, `${agentEntry}.toml`),
|
|
22434
22454
|
kind: "compiled",
|
|
22435
22455
|
expectedTarget: "codex",
|
|
22436
22456
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -22439,7 +22459,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22439
22459
|
for (const ruleEntry of runtime.kitInfo.components.rules.declared) {
|
|
22440
22460
|
artifacts.push({
|
|
22441
22461
|
component: "codex rule",
|
|
22442
|
-
path:
|
|
22462
|
+
path: path24.join(codexPaths.rules, `${ruleEntry}.rules`),
|
|
22443
22463
|
kind: "compiled",
|
|
22444
22464
|
expectedTarget: "codex",
|
|
22445
22465
|
expectedSource: `rules/${ruleEntry}.md`
|
|
@@ -22491,13 +22511,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22491
22511
|
);
|
|
22492
22512
|
addCompiledGlobPlans(
|
|
22493
22513
|
artifacts,
|
|
22494
|
-
|
|
22514
|
+
path24.join(opencodePaths.agents, "*.md"),
|
|
22495
22515
|
"opencode",
|
|
22496
22516
|
"opencode agent residue"
|
|
22497
22517
|
);
|
|
22498
22518
|
addCompiledGlobPlans(
|
|
22499
22519
|
artifacts,
|
|
22500
|
-
|
|
22520
|
+
path24.join(opencodePaths.commands, "*.md"),
|
|
22501
22521
|
"opencode",
|
|
22502
22522
|
"opencode command residue"
|
|
22503
22523
|
);
|
|
@@ -22516,7 +22536,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22516
22536
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
22517
22537
|
artifacts.push({
|
|
22518
22538
|
component: "opencode agent",
|
|
22519
|
-
path:
|
|
22539
|
+
path: path24.join(opencodePaths.agents, `${agentEntry}.md`),
|
|
22520
22540
|
kind: "compiled",
|
|
22521
22541
|
expectedTarget: "opencode",
|
|
22522
22542
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -22525,7 +22545,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22525
22545
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
22526
22546
|
artifacts.push({
|
|
22527
22547
|
component: "opencode command",
|
|
22528
|
-
path:
|
|
22548
|
+
path: path24.join(opencodePaths.commands, `${commandEntry}.md`),
|
|
22529
22549
|
kind: "compiled",
|
|
22530
22550
|
expectedTarget: "opencode",
|
|
22531
22551
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -22580,19 +22600,19 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22580
22600
|
);
|
|
22581
22601
|
addCompiledGlobPlans(
|
|
22582
22602
|
artifacts,
|
|
22583
|
-
|
|
22603
|
+
path24.join(cursorPaths.agents, "*.md"),
|
|
22584
22604
|
"cursor",
|
|
22585
22605
|
"cursor agent residue"
|
|
22586
22606
|
);
|
|
22587
22607
|
addCompiledGlobPlans(
|
|
22588
22608
|
artifacts,
|
|
22589
|
-
|
|
22609
|
+
path24.join(cursorPaths.rules, "*.mdc"),
|
|
22590
22610
|
"cursor",
|
|
22591
22611
|
"cursor rule residue"
|
|
22592
22612
|
);
|
|
22593
22613
|
addCompiledGlobPlans(
|
|
22594
22614
|
artifacts,
|
|
22595
|
-
|
|
22615
|
+
path24.join(cursorPaths.skills, "*", "SKILL.md"),
|
|
22596
22616
|
"cursor",
|
|
22597
22617
|
"cursor command residue"
|
|
22598
22618
|
);
|
|
@@ -22606,7 +22626,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22606
22626
|
for (const agentEntry of runtime.kitInfo.components.agents.declared) {
|
|
22607
22627
|
artifacts.push({
|
|
22608
22628
|
component: "cursor agent",
|
|
22609
|
-
path:
|
|
22629
|
+
path: path24.join(cursorPaths.agents, `${agentEntry}.md`),
|
|
22610
22630
|
kind: "compiled",
|
|
22611
22631
|
expectedTarget: "cursor",
|
|
22612
22632
|
expectedSource: `agents/${agentEntry}.md`
|
|
@@ -22643,13 +22663,13 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22643
22663
|
);
|
|
22644
22664
|
addCompiledGlobPlans(
|
|
22645
22665
|
artifacts,
|
|
22646
|
-
|
|
22666
|
+
path24.join(clinePaths.rules, "*.md"),
|
|
22647
22667
|
"cline",
|
|
22648
22668
|
"cline rule residue"
|
|
22649
22669
|
);
|
|
22650
22670
|
addCompiledGlobPlans(
|
|
22651
22671
|
artifacts,
|
|
22652
|
-
|
|
22672
|
+
path24.join(clinePaths.workflows, "*.md"),
|
|
22653
22673
|
"cline",
|
|
22654
22674
|
"cline workflow residue"
|
|
22655
22675
|
);
|
|
@@ -22677,7 +22697,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22677
22697
|
for (const ruleEntry of runtime.kitInfo.components.rules.declared) {
|
|
22678
22698
|
artifacts.push({
|
|
22679
22699
|
component: "cline rule",
|
|
22680
|
-
path:
|
|
22700
|
+
path: path24.join(clinePaths.rules, `${ruleEntry}.md`),
|
|
22681
22701
|
kind: "compiled",
|
|
22682
22702
|
expectedTarget: "cline",
|
|
22683
22703
|
expectedSource: `rules/${ruleEntry}.md`
|
|
@@ -22686,7 +22706,7 @@ function resolveKitManagedArtifacts(runtime, scope, selectedTools, manifest, cla
|
|
|
22686
22706
|
for (const commandEntry of runtime.kitInfo.components.commands.declared) {
|
|
22687
22707
|
artifacts.push({
|
|
22688
22708
|
component: "cline workflow",
|
|
22689
|
-
path:
|
|
22709
|
+
path: path24.join(clinePaths.workflows, `${commandEntry}.md`),
|
|
22690
22710
|
kind: "compiled",
|
|
22691
22711
|
expectedTarget: "cline",
|
|
22692
22712
|
expectedSource: `commands/${commandEntry}.md`
|
|
@@ -23021,12 +23041,12 @@ function resolveCopilotPaths(runtime, scope = "global", projectRoot) {
|
|
|
23021
23041
|
if (scope === "project") {
|
|
23022
23042
|
const root = projectRoot ?? process.cwd();
|
|
23023
23043
|
return {
|
|
23024
|
-
instructions:
|
|
23025
|
-
agents:
|
|
23026
|
-
prompts:
|
|
23027
|
-
skills:
|
|
23028
|
-
hooks:
|
|
23029
|
-
mcpSharedFile:
|
|
23044
|
+
instructions: path24.join(root, ".github", "copilot-instructions.md"),
|
|
23045
|
+
agents: path24.join(root, ".github", "agents"),
|
|
23046
|
+
prompts: path24.join(root, ".github", "prompts"),
|
|
23047
|
+
skills: path24.join(root, ".github", "skills"),
|
|
23048
|
+
hooks: path24.join(root, ".github", "hooks"),
|
|
23049
|
+
mcpSharedFile: path24.join(root, ".vscode", "mcp.json")
|
|
23030
23050
|
};
|
|
23031
23051
|
}
|
|
23032
23052
|
return {
|
|
@@ -23066,12 +23086,12 @@ function resolveCodexPaths(runtime, scope = "global", projectRoot) {
|
|
|
23066
23086
|
if (scope === "project") {
|
|
23067
23087
|
const root = projectRoot ?? process.cwd();
|
|
23068
23088
|
return {
|
|
23069
|
-
instructions:
|
|
23070
|
-
agents:
|
|
23071
|
-
rules:
|
|
23072
|
-
skills:
|
|
23073
|
-
hooksSharedFile:
|
|
23074
|
-
mcpSharedFile:
|
|
23089
|
+
instructions: path24.join(root, "AGENTS.md"),
|
|
23090
|
+
agents: path24.join(root, ".codex", "agents"),
|
|
23091
|
+
rules: path24.join(root, ".codex", "rules"),
|
|
23092
|
+
skills: path24.join(root, ".codex", "skills"),
|
|
23093
|
+
hooksSharedFile: path24.join(root, ".codex", "hooks.json"),
|
|
23094
|
+
mcpSharedFile: path24.join(root, ".codex", "config.toml")
|
|
23075
23095
|
};
|
|
23076
23096
|
}
|
|
23077
23097
|
return {
|
|
@@ -23100,7 +23120,7 @@ function resolveSharedHookScriptsPath(runtime, scope, projectRoot) {
|
|
|
23100
23120
|
}
|
|
23101
23121
|
}
|
|
23102
23122
|
if (scope === "project") {
|
|
23103
|
-
return
|
|
23123
|
+
return path24.join(projectRoot ?? process.cwd(), ".agents", "hooks");
|
|
23104
23124
|
}
|
|
23105
23125
|
return resolveTargetPath("~/.agents/hooks");
|
|
23106
23126
|
}
|
|
@@ -23285,7 +23305,7 @@ function isKitPointer(artifact) {
|
|
|
23285
23305
|
}
|
|
23286
23306
|
try {
|
|
23287
23307
|
const recordedPath = fs26.readFileSync(artifact.path, "utf8").trim();
|
|
23288
|
-
return recordedPath.length > 0 &&
|
|
23308
|
+
return recordedPath.length > 0 && path24.resolve(recordedPath) === path24.resolve(artifact.expectedPath);
|
|
23289
23309
|
} catch {
|
|
23290
23310
|
return false;
|
|
23291
23311
|
}
|
|
@@ -23450,7 +23470,7 @@ function restoreBackup(backup, logger) {
|
|
|
23450
23470
|
logger.warn(` backup not found: ${backup.backupLocation}`);
|
|
23451
23471
|
return;
|
|
23452
23472
|
}
|
|
23453
|
-
const destDir =
|
|
23473
|
+
const destDir = path24.dirname(backup.originalPath);
|
|
23454
23474
|
fs26.mkdirSync(destDir, { recursive: true });
|
|
23455
23475
|
fs26.renameSync(backup.backupLocation, backup.originalPath);
|
|
23456
23476
|
logger.verbose(
|
|
@@ -23589,7 +23609,7 @@ function cleanupCopilot(config, sourceRoot, configDir, logger) {
|
|
|
23589
23609
|
logger
|
|
23590
23610
|
);
|
|
23591
23611
|
removeManagedJsonFile(
|
|
23592
|
-
|
|
23612
|
+
path25.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
23593
23613
|
"_tangyr",
|
|
23594
23614
|
logger
|
|
23595
23615
|
);
|
|
@@ -23751,7 +23771,7 @@ function removeManagedDirectPath(artifactPath, config, sourceRoot, component, lo
|
|
|
23751
23771
|
}
|
|
23752
23772
|
}
|
|
23753
23773
|
function removeManagedCompiledFiles(dir, pattern, expectedTarget, logger) {
|
|
23754
|
-
for (const filePath of ts(
|
|
23774
|
+
for (const filePath of ts(path25.join(dir, pattern)).sort()) {
|
|
23755
23775
|
removeManagedCompiledFile(filePath, expectedTarget, logger);
|
|
23756
23776
|
}
|
|
23757
23777
|
}
|
|
@@ -23862,7 +23882,7 @@ function toVerbosity(value) {
|
|
|
23862
23882
|
// src/commands/detect.ts
|
|
23863
23883
|
import fs28 from "fs";
|
|
23864
23884
|
import os5 from "os";
|
|
23865
|
-
import
|
|
23885
|
+
import path26 from "path";
|
|
23866
23886
|
import { spawnSync } from "child_process";
|
|
23867
23887
|
var copilotEditorCommands = [
|
|
23868
23888
|
"code",
|
|
@@ -23994,7 +24014,7 @@ function detectEditorExtension(label, matchesExtension, logger, dependencies = {
|
|
|
23994
24014
|
}
|
|
23995
24015
|
}
|
|
23996
24016
|
for (const relativeDirectory of copilotExtensionDirectories) {
|
|
23997
|
-
const extensionDirectory =
|
|
24017
|
+
const extensionDirectory = path26.join(homeDirectory, relativeDirectory);
|
|
23998
24018
|
if (!pathExists(extensionDirectory)) {
|
|
23999
24019
|
continue;
|
|
24000
24020
|
}
|
|
@@ -24017,7 +24037,7 @@ function cursorExecutablePaths(platform, homeDirectory) {
|
|
|
24017
24037
|
}
|
|
24018
24038
|
return [
|
|
24019
24039
|
...systemPaths,
|
|
24020
|
-
|
|
24040
|
+
path26.join(
|
|
24021
24041
|
homeDirectory,
|
|
24022
24042
|
"Applications/Cursor.app/Contents/Resources/app/bin/cursor"
|
|
24023
24043
|
)
|
|
@@ -24078,7 +24098,7 @@ function logDetectionError(attemptedCommand, error, logger) {
|
|
|
24078
24098
|
|
|
24079
24099
|
// src/commands/doctor.ts
|
|
24080
24100
|
import fs29 from "fs";
|
|
24081
|
-
import
|
|
24101
|
+
import path27 from "path";
|
|
24082
24102
|
function runDoctorCommand(options, logger) {
|
|
24083
24103
|
const { config, configDir, configPath, sourceRoot } = resolveRuntime(
|
|
24084
24104
|
options,
|
|
@@ -24088,7 +24108,7 @@ function runDoctorCommand(options, logger) {
|
|
|
24088
24108
|
if (!fs29.existsSync(configPath)) {
|
|
24089
24109
|
findings.push(`${configPath}: missing`);
|
|
24090
24110
|
}
|
|
24091
|
-
const hooksJsonPath =
|
|
24111
|
+
const hooksJsonPath = path27.join(
|
|
24092
24112
|
sourceRoot,
|
|
24093
24113
|
config.source.hooks,
|
|
24094
24114
|
"hooks.json"
|
|
@@ -24160,18 +24180,18 @@ function checkClaudeCode(options, findings, config, sourceRoot, configDir, logge
|
|
|
24160
24180
|
projectRoot
|
|
24161
24181
|
)) {
|
|
24162
24182
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
24163
|
-
const sourcePath = artifact.sourceKey ?
|
|
24183
|
+
const sourcePath = artifact.sourceKey ? path27.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
24164
24184
|
if (artifactClass === "managed-stale") {
|
|
24165
24185
|
findings.push(
|
|
24166
24186
|
`${artifact.component}: managed stale artifact at ${artifact.path}`
|
|
24167
24187
|
);
|
|
24168
24188
|
if (options.fix && sourcePath && isOurStaleSymlink(
|
|
24169
24189
|
artifact.path,
|
|
24170
|
-
/* @__PURE__ */ new Set([
|
|
24190
|
+
/* @__PURE__ */ new Set([path27.resolve(artifact.path)]),
|
|
24171
24191
|
config
|
|
24172
24192
|
)) {
|
|
24173
24193
|
fs29.unlinkSync(artifact.path);
|
|
24174
|
-
ensureDir(
|
|
24194
|
+
ensureDir(path27.dirname(artifact.path));
|
|
24175
24195
|
const symlinkType = fs29.statSync(sourcePath).isDirectory() ? "dir" : "file";
|
|
24176
24196
|
createRelativeSymlink(sourcePath, artifact.path, symlinkType, {
|
|
24177
24197
|
logger,
|
|
@@ -24185,8 +24205,8 @@ function checkClaudeCode(options, findings, config, sourceRoot, configDir, logge
|
|
|
24185
24205
|
logger.info(`${artifact.component}: recreated managed symlink`);
|
|
24186
24206
|
}
|
|
24187
24207
|
}
|
|
24188
|
-
if (options.fix && !fs29.existsSync(
|
|
24189
|
-
ensureDir(
|
|
24208
|
+
if (options.fix && !fs29.existsSync(path27.dirname(artifact.path))) {
|
|
24209
|
+
ensureDir(path27.dirname(artifact.path));
|
|
24190
24210
|
}
|
|
24191
24211
|
checkParentWritablePath(artifact.path, artifact.component, findings);
|
|
24192
24212
|
}
|
|
@@ -24201,7 +24221,7 @@ function checkCopilot(config, sourceRoot, configDir, findings) {
|
|
|
24201
24221
|
continue;
|
|
24202
24222
|
}
|
|
24203
24223
|
const label = `copilot: ${rawPath}`;
|
|
24204
|
-
if (key.endsWith("_shared_file") ||
|
|
24224
|
+
if (key.endsWith("_shared_file") || path27.extname(rawPath).length > 0) {
|
|
24205
24225
|
checkParentWritablePath(resolveTargetPath(rawPath), label, findings);
|
|
24206
24226
|
continue;
|
|
24207
24227
|
}
|
|
@@ -24221,7 +24241,7 @@ function checkCodex(config, sourceRoot, configDir, findings, logger) {
|
|
|
24221
24241
|
continue;
|
|
24222
24242
|
}
|
|
24223
24243
|
const label = `codex: ${rawPath}`;
|
|
24224
|
-
if (key.endsWith("_shared_file") ||
|
|
24244
|
+
if (key.endsWith("_shared_file") || path27.extname(rawPath).length > 0) {
|
|
24225
24245
|
checkParentWritablePath(resolveTargetPath(rawPath), label, findings);
|
|
24226
24246
|
continue;
|
|
24227
24247
|
}
|
|
@@ -24238,13 +24258,13 @@ function resolveHooksScriptPath(config, sourceRoot, configDir) {
|
|
|
24238
24258
|
scope: "global",
|
|
24239
24259
|
mappings: mappings.platformPaths
|
|
24240
24260
|
});
|
|
24241
|
-
return
|
|
24261
|
+
return path27.join(profile["claude-code"].hooks, "scripts");
|
|
24242
24262
|
} catch {
|
|
24243
24263
|
return resolveTargetPath("~/.agents/hooks/scripts");
|
|
24244
24264
|
}
|
|
24245
24265
|
}
|
|
24246
24266
|
function checkParentWritablePath(targetPath, label, findings) {
|
|
24247
|
-
checkWritablePath(
|
|
24267
|
+
checkWritablePath(path27.dirname(targetPath), `${label} parent`, findings);
|
|
24248
24268
|
}
|
|
24249
24269
|
function checkWritablePath(checkPath, label, findings) {
|
|
24250
24270
|
if (!fs29.existsSync(checkPath)) {
|
|
@@ -24261,7 +24281,7 @@ function walkHookScripts(dir) {
|
|
|
24261
24281
|
if (!fs29.existsSync(dir)) {
|
|
24262
24282
|
return [];
|
|
24263
24283
|
}
|
|
24264
|
-
return fs29.readdirSync(dir).map((entry) =>
|
|
24284
|
+
return fs29.readdirSync(dir).map((entry) => path27.join(dir, entry)).filter((entryPath) => fs29.statSync(entryPath).isFile());
|
|
24265
24285
|
}
|
|
24266
24286
|
function fixManagedHookScriptModes(scriptRoot, sourceRoot, logger) {
|
|
24267
24287
|
if (!fs29.existsSync(scriptRoot)) {
|
|
@@ -24278,16 +24298,16 @@ function fixManagedHookScriptModes(scriptRoot, sourceRoot, logger) {
|
|
|
24278
24298
|
}
|
|
24279
24299
|
}
|
|
24280
24300
|
function hasSymlinkAncestor(targetPath, stopAt) {
|
|
24281
|
-
const relative =
|
|
24282
|
-
|
|
24283
|
-
|
|
24301
|
+
const relative = path27.relative(
|
|
24302
|
+
path27.resolve(stopAt),
|
|
24303
|
+
path27.resolve(targetPath)
|
|
24284
24304
|
);
|
|
24285
|
-
if (relative.startsWith("..") ||
|
|
24305
|
+
if (relative.startsWith("..") || path27.isAbsolute(relative)) {
|
|
24286
24306
|
return false;
|
|
24287
24307
|
}
|
|
24288
|
-
return relative.split(
|
|
24289
|
-
const candidate =
|
|
24290
|
-
|
|
24308
|
+
return relative.split(path27.sep).some((_segment, index, segments) => {
|
|
24309
|
+
const candidate = path27.join(
|
|
24310
|
+
path27.resolve(stopAt),
|
|
24291
24311
|
...segments.slice(0, index + 1)
|
|
24292
24312
|
);
|
|
24293
24313
|
try {
|
|
@@ -24298,8 +24318,8 @@ function hasSymlinkAncestor(targetPath, stopAt) {
|
|
|
24298
24318
|
});
|
|
24299
24319
|
}
|
|
24300
24320
|
function isInside(childPath, parentPath) {
|
|
24301
|
-
const relative =
|
|
24302
|
-
return relative.length === 0 || !relative.startsWith("..") && !
|
|
24321
|
+
const relative = path27.relative(parentPath, childPath);
|
|
24322
|
+
return relative.length === 0 || !relative.startsWith("..") && !path27.isAbsolute(relative);
|
|
24303
24323
|
}
|
|
24304
24324
|
function realPathOrInput2(filePath) {
|
|
24305
24325
|
try {
|
|
@@ -24311,12 +24331,12 @@ function realPathOrInput2(filePath) {
|
|
|
24311
24331
|
|
|
24312
24332
|
// src/commands/init.ts
|
|
24313
24333
|
import fs30 from "fs";
|
|
24314
|
-
import
|
|
24334
|
+
import path28 from "path";
|
|
24315
24335
|
var import_yaml7 = __toESM(require_dist(), 1);
|
|
24316
24336
|
async function runInitCommand(_options, logger) {
|
|
24317
24337
|
const sourceRoot = await dist_default6({
|
|
24318
24338
|
message: "Canonical Tangyr kit root",
|
|
24319
|
-
default:
|
|
24339
|
+
default: path28.resolve("projects/tangyr/agent-coding")
|
|
24320
24340
|
});
|
|
24321
24341
|
const componentCount = [
|
|
24322
24342
|
"CLAUDE.md",
|
|
@@ -24326,7 +24346,7 @@ async function runInitCommand(_options, logger) {
|
|
|
24326
24346
|
"rules",
|
|
24327
24347
|
"hooks"
|
|
24328
24348
|
].filter(
|
|
24329
|
-
(relativePath) => fs30.existsSync(
|
|
24349
|
+
(relativePath) => fs30.existsSync(path28.join(sourceRoot, relativePath))
|
|
24330
24350
|
).length;
|
|
24331
24351
|
const detectedTargets = detectTargets(logger);
|
|
24332
24352
|
const enabledTargets = await dist_default4({
|
|
@@ -24346,7 +24366,7 @@ async function runInitCommand(_options, logger) {
|
|
|
24346
24366
|
value
|
|
24347
24367
|
}))
|
|
24348
24368
|
});
|
|
24349
|
-
const configPath =
|
|
24369
|
+
const configPath = path28.join(sourceRoot, "tangyr.config.yaml");
|
|
24350
24370
|
if (fs30.existsSync(configPath)) {
|
|
24351
24371
|
const overwrite = await dist_default5({
|
|
24352
24372
|
message: `${configPath} exists. Overwrite?`,
|
|
@@ -24401,14 +24421,14 @@ function toConflictPolicy2(value) {
|
|
|
24401
24421
|
|
|
24402
24422
|
// src/commands/install.ts
|
|
24403
24423
|
import fs39 from "fs";
|
|
24404
|
-
import
|
|
24424
|
+
import path40 from "path";
|
|
24405
24425
|
|
|
24406
24426
|
// src/core/channel-state.ts
|
|
24407
24427
|
import fs31 from "fs";
|
|
24408
|
-
import
|
|
24428
|
+
import path29 from "path";
|
|
24409
24429
|
var CHANNEL_STATE_FILENAME = ".tangyr-channels.json";
|
|
24410
24430
|
function stateFilePath(cacheRoot) {
|
|
24411
|
-
return
|
|
24431
|
+
return path29.join(cacheRoot, CHANNEL_STATE_FILENAME);
|
|
24412
24432
|
}
|
|
24413
24433
|
function channelKey(kit, channel) {
|
|
24414
24434
|
return `${kit}/${channel}`;
|
|
@@ -24464,7 +24484,7 @@ function writeChannelSequence(params) {
|
|
|
24464
24484
|
[key]: { sequence, version, seenAt: now.toISOString() }
|
|
24465
24485
|
};
|
|
24466
24486
|
const filePath = stateFilePath(cacheRoot);
|
|
24467
|
-
fs31.mkdirSync(
|
|
24487
|
+
fs31.mkdirSync(path29.dirname(filePath), { recursive: true, mode: 448 });
|
|
24468
24488
|
const tempPath = `${filePath}.${process.pid}.tmp`;
|
|
24469
24489
|
fs31.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
24470
24490
|
`, {
|
|
@@ -24487,7 +24507,7 @@ var DEFAULT_CHANNEL = "stable";
|
|
|
24487
24507
|
|
|
24488
24508
|
// src/core/materialize.ts
|
|
24489
24509
|
import fs32 from "fs";
|
|
24490
|
-
import
|
|
24510
|
+
import path30 from "path";
|
|
24491
24511
|
|
|
24492
24512
|
// src/core/integrity.ts
|
|
24493
24513
|
import crypto3 from "crypto";
|
|
@@ -24823,7 +24843,7 @@ function assertFileWithinCeiling(entryPath, byteLength) {
|
|
|
24823
24843
|
}
|
|
24824
24844
|
var WINDOWS_DRIVE_ABSOLUTE = /^[a-zA-Z]:[\\/]/u;
|
|
24825
24845
|
function sanitizeBundleFilePath(entryPath, stagingDir) {
|
|
24826
|
-
if (
|
|
24846
|
+
if (path30.isAbsolute(entryPath) || WINDOWS_DRIVE_ABSOLUTE.test(entryPath)) {
|
|
24827
24847
|
throw new IntegrityError(
|
|
24828
24848
|
`Bundle file path "${entryPath}" is absolute \u2014 every file inside a bundle must use a relative path (REQ-INT-004).`
|
|
24829
24849
|
);
|
|
@@ -24839,13 +24859,13 @@ function sanitizeBundleFilePath(entryPath, stagingDir) {
|
|
|
24839
24859
|
`Bundle file path "${entryPath}" contains a ".." segment \u2014 directory traversal is rejected (REQ-INT-004).`
|
|
24840
24860
|
);
|
|
24841
24861
|
}
|
|
24842
|
-
const resolved =
|
|
24862
|
+
const resolved = path30.resolve(stagingDir, entryPath);
|
|
24843
24863
|
if (resolved === stagingDir) {
|
|
24844
24864
|
throw new IntegrityError(
|
|
24845
24865
|
`Bundle file path "${entryPath}" resolves to the staging directory itself \u2014 every entry must be a file inside it (REQ-INT-004).`
|
|
24846
24866
|
);
|
|
24847
24867
|
}
|
|
24848
|
-
if (!resolved.startsWith(stagingDir +
|
|
24868
|
+
if (!resolved.startsWith(stagingDir + path30.sep)) {
|
|
24849
24869
|
throw new IntegrityError(
|
|
24850
24870
|
`Bundle file path "${entryPath}" escapes the staging directory \u2014 refusing to write (REQ-INT-004).`
|
|
24851
24871
|
);
|
|
@@ -24897,7 +24917,7 @@ function verifyBundleFileHashes(bundle) {
|
|
|
24897
24917
|
function writeStagedFiles(stagingDir, decoded) {
|
|
24898
24918
|
for (const [rawPath, bytes] of decoded) {
|
|
24899
24919
|
const target = sanitizeBundleFilePath(rawPath, stagingDir);
|
|
24900
|
-
fs32.mkdirSync(
|
|
24920
|
+
fs32.mkdirSync(path30.dirname(target), { recursive: true, mode: 448 });
|
|
24901
24921
|
let existingStat;
|
|
24902
24922
|
try {
|
|
24903
24923
|
existingStat = fs32.lstatSync(target);
|
|
@@ -25311,12 +25331,12 @@ function sleep(ms2) {
|
|
|
25311
25331
|
var TOML3 = __toESM(require_toml(), 1);
|
|
25312
25332
|
import crypto5 from "crypto";
|
|
25313
25333
|
import fs34 from "fs";
|
|
25314
|
-
import
|
|
25334
|
+
import path34 from "path";
|
|
25315
25335
|
|
|
25316
25336
|
// src/compiler/agents.ts
|
|
25317
25337
|
var TOML = __toESM(require_toml(), 1);
|
|
25318
25338
|
var import_yaml8 = __toESM(require_dist(), 1);
|
|
25319
|
-
import
|
|
25339
|
+
import path31 from "path";
|
|
25320
25340
|
var writeCapabilityClasses = /* @__PURE__ */ new Set(["filesystem-write", "shell-execution"]);
|
|
25321
25341
|
var copilotToolAliasesByClass = {
|
|
25322
25342
|
delegation: "agent",
|
|
@@ -25328,7 +25348,7 @@ var copilotToolAliasesByClass = {
|
|
|
25328
25348
|
};
|
|
25329
25349
|
function compileAgent(sourceFile, target, mappings, extensions, lossReport) {
|
|
25330
25350
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
25331
|
-
const relativeSource = `agents/${
|
|
25351
|
+
const relativeSource = `agents/${path31.basename(sourceFile)}`;
|
|
25332
25352
|
if (target === "opencode") {
|
|
25333
25353
|
return compileOpenCodeAgent(
|
|
25334
25354
|
sourceFile,
|
|
@@ -25369,7 +25389,7 @@ function compileAgent(sourceFile, target, mappings, extensions, lossReport) {
|
|
|
25369
25389
|
mappings,
|
|
25370
25390
|
lossReport
|
|
25371
25391
|
);
|
|
25372
|
-
const overlayKey = `agents/${
|
|
25392
|
+
const overlayKey = `agents/${path31.basename(sourceFile, ".md")}.${target}.yaml`;
|
|
25373
25393
|
const targetFields = {
|
|
25374
25394
|
...translated.fields,
|
|
25375
25395
|
...extensions[overlayKey] ?? {}
|
|
@@ -25403,7 +25423,7 @@ ${TOML.stringify({
|
|
|
25403
25423
|
function compileOpenCodeAgent(sourceFile, data, body, relativeSource, lossReport) {
|
|
25404
25424
|
if (typeof data.description !== "string" || data.description.trim() === "") {
|
|
25405
25425
|
throw new Error(
|
|
25406
|
-
`${
|
|
25426
|
+
`${path31.basename(sourceFile)}: OpenCode agent requires a non-empty description field`
|
|
25407
25427
|
);
|
|
25408
25428
|
}
|
|
25409
25429
|
const frontmatter = {
|
|
@@ -25457,7 +25477,7 @@ function compileOpenCodeAgent(sourceFile, data, body, relativeSource, lossReport
|
|
|
25457
25477
|
"permission",
|
|
25458
25478
|
"permission-coarsening"
|
|
25459
25479
|
),
|
|
25460
|
-
detail: `${
|
|
25480
|
+
detail: `${path31.basename(sourceFile)}: per-tool permission '${tool}' mapped to coarse allow|deny action`
|
|
25461
25481
|
}
|
|
25462
25482
|
]
|
|
25463
25483
|
});
|
|
@@ -25482,7 +25502,7 @@ ${(0, import_yaml8.stringify)(frontmatter).trim()}
|
|
|
25482
25502
|
function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport) {
|
|
25483
25503
|
if (typeof data.description !== "string" || data.description.trim() === "") {
|
|
25484
25504
|
throw new Error(
|
|
25485
|
-
`${
|
|
25505
|
+
`${path31.basename(sourceFile)}: Cursor agent requires a non-empty description field`
|
|
25486
25506
|
);
|
|
25487
25507
|
}
|
|
25488
25508
|
const frontmatter = {
|
|
@@ -25519,7 +25539,7 @@ function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport)
|
|
|
25519
25539
|
"permission",
|
|
25520
25540
|
"permission-coarsening"
|
|
25521
25541
|
),
|
|
25522
|
-
detail: `${
|
|
25542
|
+
detail: `${path31.basename(sourceFile)}: per-agent tool allow set coarsened to readonly=${readonly} boolean (Cursor only exposes readonly control)`
|
|
25523
25543
|
}
|
|
25524
25544
|
]
|
|
25525
25545
|
});
|
|
@@ -25538,7 +25558,7 @@ function compileCursorAgent(sourceFile, data, body, relativeSource, lossReport)
|
|
|
25538
25558
|
"provider",
|
|
25539
25559
|
"provider-not-representable"
|
|
25540
25560
|
),
|
|
25541
|
-
detail: `${
|
|
25561
|
+
detail: `${path31.basename(sourceFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
25542
25562
|
}
|
|
25543
25563
|
]
|
|
25544
25564
|
});
|
|
@@ -25570,7 +25590,7 @@ function compileClineAgent(sourceFile, _data, _body, relativeSource, lossReport)
|
|
|
25570
25590
|
"persona",
|
|
25571
25591
|
"persona-not-representable"
|
|
25572
25592
|
),
|
|
25573
|
-
detail: `${
|
|
25593
|
+
detail: `${path31.basename(sourceFile)}: Cline has no committable per-agent persona file for the VSCode extension target; configure the agent through Cline Settings \u2192 Agent.`
|
|
25574
25594
|
}
|
|
25575
25595
|
]
|
|
25576
25596
|
});
|
|
@@ -25618,7 +25638,7 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
25618
25638
|
field,
|
|
25619
25639
|
"model-not-representable"
|
|
25620
25640
|
),
|
|
25621
|
-
detail: `${
|
|
25641
|
+
detail: `${path31.basename(sourceFile)}: model tier '${String(value)}' has no stable Copilot model literal; omitted so VS Code uses the selected model.`
|
|
25622
25642
|
});
|
|
25623
25643
|
return;
|
|
25624
25644
|
}
|
|
@@ -25636,9 +25656,9 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
25636
25656
|
lossReport,
|
|
25637
25657
|
target,
|
|
25638
25658
|
"agents",
|
|
25639
|
-
`agents/${
|
|
25659
|
+
`agents/${path31.basename(sourceFile)}`,
|
|
25640
25660
|
"info",
|
|
25641
|
-
`${
|
|
25661
|
+
`${path31.basename(sourceFile)}: ${field} is delivered through another managed surface.`
|
|
25642
25662
|
);
|
|
25643
25663
|
return;
|
|
25644
25664
|
}
|
|
@@ -25647,7 +25667,7 @@ function applyFieldAction(sourceFile, field, value, action, target, mappings, tr
|
|
|
25647
25667
|
field,
|
|
25648
25668
|
action: entryType,
|
|
25649
25669
|
severity: resolveLossSeverity("agent-field", field, entryType),
|
|
25650
|
-
detail: `${
|
|
25670
|
+
detail: `${path31.basename(sourceFile)}: ${field} has no emitted field for this target.`
|
|
25651
25671
|
});
|
|
25652
25672
|
}
|
|
25653
25673
|
function mapToolsToCapabilities(value, mappings) {
|
|
@@ -26057,23 +26077,23 @@ function addHookLoss(lossReport, target, eventName, sourceLabel, severity, reaso
|
|
|
26057
26077
|
}
|
|
26058
26078
|
|
|
26059
26079
|
// src/core/hook-scripts.ts
|
|
26060
|
-
import
|
|
26080
|
+
import path32 from "path";
|
|
26061
26081
|
function hookScriptsDir(bridge, target) {
|
|
26062
26082
|
const globalBridge = resolveTargetPath("~/.agents/hooks");
|
|
26063
|
-
if (
|
|
26083
|
+
if (path32.resolve(bridge) === path32.resolve(globalBridge)) {
|
|
26064
26084
|
return { prefix: GLOBAL_HOOK_SCRIPTS_DIR, machineLocal: false };
|
|
26065
26085
|
}
|
|
26066
|
-
const relative =
|
|
26067
|
-
const insideProject = !relative.startsWith("..") && !
|
|
26086
|
+
const relative = path32.relative(process.cwd(), bridge);
|
|
26087
|
+
const insideProject = !relative.startsWith("..") && !path32.isAbsolute(relative) && relative !== "";
|
|
26068
26088
|
const variable = PROJECT_DIR_VARIABLE[target];
|
|
26069
26089
|
if (insideProject && variable) {
|
|
26070
|
-
const posix =
|
|
26071
|
-
relative.split(
|
|
26090
|
+
const posix = path32.posix.join(
|
|
26091
|
+
relative.split(path32.sep).join("/"),
|
|
26072
26092
|
"scripts"
|
|
26073
26093
|
);
|
|
26074
26094
|
return { prefix: `$${variable.slice(1)}/${posix}`, machineLocal: false };
|
|
26075
26095
|
}
|
|
26076
|
-
return { prefix:
|
|
26096
|
+
return { prefix: path32.join(bridge, "scripts"), machineLocal: true };
|
|
26077
26097
|
}
|
|
26078
26098
|
var PROJECT_DIR_VARIABLE = {
|
|
26079
26099
|
"claude-code": "$CLAUDE_PROJECT_DIR"
|
|
@@ -26361,7 +26381,7 @@ function compileOpenCodeMcp(sourceMcpJson, lossReport, sourceLabel) {
|
|
|
26361
26381
|
}
|
|
26362
26382
|
|
|
26363
26383
|
// src/compiler/rules.ts
|
|
26364
|
-
import
|
|
26384
|
+
import path33 from "path";
|
|
26365
26385
|
var import_yaml9 = __toESM(require_dist(), 1);
|
|
26366
26386
|
import fs33 from "fs";
|
|
26367
26387
|
function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
@@ -26400,13 +26420,13 @@ function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
|
26400
26420
|
}
|
|
26401
26421
|
const appendixParts = [];
|
|
26402
26422
|
const dotRulesFiles = [];
|
|
26403
|
-
for (const ruleFile of ts(
|
|
26423
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26404
26424
|
const parsed = parseRule(ruleFile);
|
|
26405
|
-
const name =
|
|
26425
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26406
26426
|
if (parsed.mode === "exec-policy") {
|
|
26407
26427
|
dotRulesFiles.push({
|
|
26408
26428
|
name: `${name}.rules`,
|
|
26409
|
-
content: `${formatProvenanceMarker("toml", `rules/${
|
|
26429
|
+
content: `${formatProvenanceMarker("toml", `rules/${path33.basename(ruleFile)}`, computeSourceHash(ruleFile), "codex")}
|
|
26410
26430
|
${parsed.body}`
|
|
26411
26431
|
});
|
|
26412
26432
|
continue;
|
|
@@ -26415,7 +26435,7 @@ ${parsed.body}`
|
|
|
26415
26435
|
|
|
26416
26436
|
${parsed.body.trim()}`);
|
|
26417
26437
|
addLoss(lossReport, "codex", "rules", {
|
|
26418
|
-
source: `rules/${
|
|
26438
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26419
26439
|
fields: [
|
|
26420
26440
|
{
|
|
26421
26441
|
field: "mode",
|
|
@@ -26425,7 +26445,7 @@ ${parsed.body.trim()}`);
|
|
|
26425
26445
|
"mode",
|
|
26426
26446
|
"rule-as-instruction"
|
|
26427
26447
|
),
|
|
26428
|
-
detail: `${
|
|
26448
|
+
detail: `${path33.basename(ruleFile)} is appended to the managed Codex instructions file as guidance.`
|
|
26429
26449
|
}
|
|
26430
26450
|
]
|
|
26431
26451
|
});
|
|
@@ -26457,14 +26477,14 @@ function isRuleMode(value) {
|
|
|
26457
26477
|
}
|
|
26458
26478
|
function compileOpenCodeRules(sourceRulesDir, lossReport) {
|
|
26459
26479
|
const appendixParts = [];
|
|
26460
|
-
for (const ruleFile of ts(
|
|
26480
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26461
26481
|
const parsed = parseRule(ruleFile);
|
|
26462
|
-
const name =
|
|
26482
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26463
26483
|
appendixParts.push(`## ${name}
|
|
26464
26484
|
|
|
26465
26485
|
${parsed.body.trim()}`);
|
|
26466
26486
|
addLoss(lossReport, "opencode", "rules", {
|
|
26467
|
-
source: `rules/${
|
|
26487
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26468
26488
|
fields: [
|
|
26469
26489
|
{
|
|
26470
26490
|
field: "rule",
|
|
@@ -26474,7 +26494,7 @@ ${parsed.body.trim()}`);
|
|
|
26474
26494
|
"rule",
|
|
26475
26495
|
"rule-path-scoping"
|
|
26476
26496
|
),
|
|
26477
|
-
detail: `${
|
|
26497
|
+
detail: `${path33.basename(ruleFile)}: OpenCode has no per-agent rule scoping \u2014 rule appended to AGENTS.md instructions`
|
|
26478
26498
|
}
|
|
26479
26499
|
]
|
|
26480
26500
|
});
|
|
@@ -26483,9 +26503,9 @@ ${parsed.body.trim()}`);
|
|
|
26483
26503
|
}
|
|
26484
26504
|
function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
26485
26505
|
const dotRulesFiles = [];
|
|
26486
|
-
for (const ruleFile of ts(
|
|
26506
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26487
26507
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26488
|
-
const name =
|
|
26508
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26489
26509
|
let frontmatterData = {};
|
|
26490
26510
|
let body = content;
|
|
26491
26511
|
if (content.startsWith("---\n")) {
|
|
@@ -26514,7 +26534,7 @@ function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
|
26514
26534
|
}
|
|
26515
26535
|
const marker = formatProvenanceMarker(
|
|
26516
26536
|
"markdown",
|
|
26517
|
-
`rules/${
|
|
26537
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26518
26538
|
computeSourceHash(ruleFile),
|
|
26519
26539
|
"cursor"
|
|
26520
26540
|
);
|
|
@@ -26530,9 +26550,9 @@ ${body}`;
|
|
|
26530
26550
|
}
|
|
26531
26551
|
function compileClineRules(sourceRulesDir, lossReport) {
|
|
26532
26552
|
const dotRulesFiles = [];
|
|
26533
|
-
for (const ruleFile of ts(
|
|
26553
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26534
26554
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26535
|
-
const name =
|
|
26555
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26536
26556
|
let frontmatterData = {};
|
|
26537
26557
|
let body = content;
|
|
26538
26558
|
if (content.startsWith("---\n")) {
|
|
@@ -26549,13 +26569,13 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26549
26569
|
}
|
|
26550
26570
|
const marker = formatProvenanceMarker(
|
|
26551
26571
|
"markdown",
|
|
26552
|
-
`rules/${
|
|
26572
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26553
26573
|
computeSourceHash(ruleFile),
|
|
26554
26574
|
"cline"
|
|
26555
26575
|
);
|
|
26556
26576
|
if (frontmatterData.mode === "exec-policy") {
|
|
26557
26577
|
addLoss(lossReport, "cline", "rules", {
|
|
26558
|
-
source: `rules/${
|
|
26578
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26559
26579
|
fields: [
|
|
26560
26580
|
{
|
|
26561
26581
|
field: "mode",
|
|
@@ -26565,7 +26585,7 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26565
26585
|
"mode",
|
|
26566
26586
|
"rule-mode-downgrade"
|
|
26567
26587
|
),
|
|
26568
|
-
detail: `${
|
|
26588
|
+
detail: `${path33.basename(ruleFile)}: Cline rules have no exec-policy mode; rule emitted as guidance.`
|
|
26569
26589
|
}
|
|
26570
26590
|
]
|
|
26571
26591
|
});
|
|
@@ -26611,7 +26631,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26611
26631
|
rules: profile.rules
|
|
26612
26632
|
};
|
|
26613
26633
|
const rules = compileRules(
|
|
26614
|
-
|
|
26634
|
+
path34.join(sourceRoot, config.source.rules),
|
|
26615
26635
|
"codex",
|
|
26616
26636
|
mappings,
|
|
26617
26637
|
lossReport
|
|
@@ -26677,7 +26697,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26677
26697
|
if (!shouldSkipComponent(options, "hooks")) {
|
|
26678
26698
|
outcomes.push(
|
|
26679
26699
|
syncHookScriptsBridge({
|
|
26680
|
-
source:
|
|
26700
|
+
source: path34.resolve(sourceRoot, config.source.hooks),
|
|
26681
26701
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
26682
26702
|
config,
|
|
26683
26703
|
sourceRoot,
|
|
@@ -26776,9 +26796,9 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26776
26796
|
function buildProviderTomlSection(config, sourceRoot, mappings, scope, lossReport) {
|
|
26777
26797
|
const cp = mappings.modelTiers.custom_provider;
|
|
26778
26798
|
if (!cp) return "";
|
|
26779
|
-
const agentsDir =
|
|
26799
|
+
const agentsDir = path34.join(sourceRoot, config.source.agents);
|
|
26780
26800
|
if (!fs34.existsSync(agentsDir)) return "";
|
|
26781
|
-
const agentFiles = ts(
|
|
26801
|
+
const agentFiles = ts(path34.join(agentsDir, "*.md")).sort();
|
|
26782
26802
|
const hasProviderAgent = agentFiles.some((agentFile) => {
|
|
26783
26803
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
26784
26804
|
return typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
@@ -26843,7 +26863,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26843
26863
|
}
|
|
26844
26864
|
];
|
|
26845
26865
|
for (const ruleFile of rules.dotRulesFiles) {
|
|
26846
|
-
const destination =
|
|
26866
|
+
const destination = path34.join(rulesRoot, ruleFile.name);
|
|
26847
26867
|
if (options.dryRun) {
|
|
26848
26868
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
26849
26869
|
outcomes.push({
|
|
@@ -26871,7 +26891,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26871
26891
|
return outcomes;
|
|
26872
26892
|
}
|
|
26873
26893
|
function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
26874
|
-
const source =
|
|
26894
|
+
const source = path34.join(sourceRoot, config.source.instructions);
|
|
26875
26895
|
const destination = resolveTargetPath(paths.instructions);
|
|
26876
26896
|
const composed = `${fs34.readFileSync(source, "utf8").trim()}
|
|
26877
26897
|
|
|
@@ -26879,7 +26899,7 @@ function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, lo
|
|
|
26879
26899
|
${agentsAppendix}`.trim();
|
|
26880
26900
|
const marker = formatProvenanceMarker(
|
|
26881
26901
|
"markdown",
|
|
26882
|
-
|
|
26902
|
+
path34.basename(config.source.instructions),
|
|
26883
26903
|
hashString(composed),
|
|
26884
26904
|
"codex"
|
|
26885
26905
|
);
|
|
@@ -26906,7 +26926,7 @@ ${composed}
|
|
|
26906
26926
|
);
|
|
26907
26927
|
}
|
|
26908
26928
|
function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
26909
|
-
const source =
|
|
26929
|
+
const source = path34.resolve(sourceRoot, config.source.skills);
|
|
26910
26930
|
const destination = resolveTargetPath(paths.skills);
|
|
26911
26931
|
if (!fs34.existsSync(source)) {
|
|
26912
26932
|
return skippedMissingSource("skills", source);
|
|
@@ -26931,22 +26951,22 @@ function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopeP
|
|
|
26931
26951
|
} else if (artifactClass === "managed-symlink") {
|
|
26932
26952
|
fs34.unlinkSync(destination);
|
|
26933
26953
|
}
|
|
26934
|
-
ensureDir(
|
|
26954
|
+
ensureDir(path34.dirname(destination));
|
|
26935
26955
|
createRelativeSymlink(source, destination, "dir");
|
|
26936
26956
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
26937
26957
|
return { component: "skills", status: "success", path: destination };
|
|
26938
26958
|
}
|
|
26939
26959
|
function syncAgents(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
26940
|
-
const sourceAgentsRoot =
|
|
26960
|
+
const sourceAgentsRoot = path34.join(sourceRoot, config.source.agents);
|
|
26941
26961
|
if (!fs34.existsSync(sourceAgentsRoot)) {
|
|
26942
26962
|
return [skippedMissingSource("agents", sourceAgentsRoot)];
|
|
26943
26963
|
}
|
|
26944
|
-
const sourceAgents = ts(
|
|
26964
|
+
const sourceAgents = ts(path34.join(sourceAgentsRoot, "*.md")).sort();
|
|
26945
26965
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
26946
26966
|
return sourceAgents.map((agentFile) => {
|
|
26947
|
-
const destination =
|
|
26967
|
+
const destination = path34.join(
|
|
26948
26968
|
agentsRoot,
|
|
26949
|
-
`${
|
|
26969
|
+
`${path34.basename(agentFile, ".md")}.toml`
|
|
26950
26970
|
);
|
|
26951
26971
|
const compiled = compileAgent(
|
|
26952
26972
|
agentFile,
|
|
@@ -27073,7 +27093,7 @@ function writeCompiledArtifact(component, destination, content, expectedHash, co
|
|
|
27073
27093
|
if (artifactClass === "unmanaged-conflict" && !handleConflict(destination, config, options, logger, manifest, scopePath)) {
|
|
27074
27094
|
return { component, status: "conflict", path: destination };
|
|
27075
27095
|
}
|
|
27076
|
-
ensureDir(
|
|
27096
|
+
ensureDir(path34.dirname(destination));
|
|
27077
27097
|
fs34.writeFileSync(destination, content);
|
|
27078
27098
|
return { component, status: "success", path: destination };
|
|
27079
27099
|
}
|
|
@@ -27094,7 +27114,7 @@ ${managedMcpEnd}
|
|
|
27094
27114
|
if (current === next.trimStart()) {
|
|
27095
27115
|
return false;
|
|
27096
27116
|
}
|
|
27097
|
-
ensureDir(
|
|
27117
|
+
ensureDir(path34.dirname(destination));
|
|
27098
27118
|
fs34.writeFileSync(destination, next.trimStart());
|
|
27099
27119
|
return true;
|
|
27100
27120
|
}
|
|
@@ -27176,15 +27196,15 @@ function hashString(value) {
|
|
|
27176
27196
|
// src/adapters/copilot.ts
|
|
27177
27197
|
import crypto6 from "crypto";
|
|
27178
27198
|
import fs35 from "fs";
|
|
27179
|
-
import
|
|
27199
|
+
import path36 from "path";
|
|
27180
27200
|
|
|
27181
27201
|
// src/compiler/commands.ts
|
|
27182
27202
|
var import_yaml10 = __toESM(require_dist(), 1);
|
|
27183
|
-
import
|
|
27203
|
+
import path35 from "path";
|
|
27184
27204
|
function compileCommandPrompt(sourceFile) {
|
|
27185
27205
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
27186
|
-
const relativeSource = `commands/${
|
|
27187
|
-
const fields = promptFrontmatter(data,
|
|
27206
|
+
const relativeSource = `commands/${path35.basename(sourceFile)}`;
|
|
27207
|
+
const fields = promptFrontmatter(data, path35.basename(sourceFile, ".md"));
|
|
27188
27208
|
const marker = formatProvenanceMarker(
|
|
27189
27209
|
"markdown",
|
|
27190
27210
|
relativeSource,
|
|
@@ -27299,7 +27319,7 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27299
27319
|
if (!shouldSkipComponent2(options, "hooks")) {
|
|
27300
27320
|
outcomes.push(
|
|
27301
27321
|
syncHookScriptsBridge({
|
|
27302
|
-
source:
|
|
27322
|
+
source: path36.resolve(sourceRoot, config.source.hooks),
|
|
27303
27323
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27304
27324
|
config,
|
|
27305
27325
|
sourceRoot,
|
|
@@ -27380,13 +27400,13 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27380
27400
|
}
|
|
27381
27401
|
function syncProviderLoss(config, sourceRoot, mappings, lossReport) {
|
|
27382
27402
|
if (!mappings.modelTiers.custom_provider) return;
|
|
27383
|
-
const agentsDir =
|
|
27403
|
+
const agentsDir = path36.join(sourceRoot, config.source.agents);
|
|
27384
27404
|
if (!fs35.existsSync(agentsDir)) return;
|
|
27385
|
-
for (const agentFile of ts(
|
|
27405
|
+
for (const agentFile of ts(path36.join(agentsDir, "*.md")).sort()) {
|
|
27386
27406
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
27387
27407
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
27388
27408
|
if (hasProvider) {
|
|
27389
|
-
const basename =
|
|
27409
|
+
const basename = path36.basename(agentFile);
|
|
27390
27410
|
addLoss(lossReport, "copilot", "agents", {
|
|
27391
27411
|
source: `agents/${basename}`,
|
|
27392
27412
|
fields: [
|
|
@@ -27411,7 +27431,7 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27411
27431
|
logger.verbose(message);
|
|
27412
27432
|
return [{ component: "instructions", status: "skipped", path: message }];
|
|
27413
27433
|
}
|
|
27414
|
-
const source =
|
|
27434
|
+
const source = path36.resolve(sourceRoot, config.source.instructions);
|
|
27415
27435
|
if (!fs35.existsSync(source)) {
|
|
27416
27436
|
return [skippedMissingSource2("instructions", source)];
|
|
27417
27437
|
}
|
|
@@ -27419,15 +27439,15 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27419
27439
|
const contentHash = hashString2(rawContent);
|
|
27420
27440
|
const marker = formatProvenanceMarker(
|
|
27421
27441
|
"markdown",
|
|
27422
|
-
|
|
27442
|
+
path36.basename(config.source.instructions),
|
|
27423
27443
|
contentHash,
|
|
27424
27444
|
"copilot"
|
|
27425
27445
|
);
|
|
27426
27446
|
const composedContent = `${marker}
|
|
27427
27447
|
${rawContent}`;
|
|
27428
27448
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
27429
|
-
const agentsMdDest =
|
|
27430
|
-
const mirrorDest =
|
|
27449
|
+
const agentsMdDest = path36.resolve(projectRoot, "AGENTS.md");
|
|
27450
|
+
const mirrorDest = path36.resolve(
|
|
27431
27451
|
projectRoot,
|
|
27432
27452
|
".github",
|
|
27433
27453
|
"copilot-instructions.md"
|
|
@@ -27481,7 +27501,7 @@ function writeInstructionsFile(component, destination, content, contentHash, con
|
|
|
27481
27501
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27482
27502
|
return { component, status: "conflict", path: destination };
|
|
27483
27503
|
}
|
|
27484
|
-
ensureDir(
|
|
27504
|
+
ensureDir(path36.dirname(destination));
|
|
27485
27505
|
fs35.writeFileSync(destination, content);
|
|
27486
27506
|
return { component, status: "success", path: destination };
|
|
27487
27507
|
}
|
|
@@ -27489,7 +27509,7 @@ function hashString2(value) {
|
|
|
27489
27509
|
return `sha256:${crypto6.createHash("sha256").update(value).digest("hex")}`;
|
|
27490
27510
|
}
|
|
27491
27511
|
function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27492
|
-
const source =
|
|
27512
|
+
const source = path36.resolve(sourceRoot, config.source.skills);
|
|
27493
27513
|
const destination = resolveTargetPath(paths.skills);
|
|
27494
27514
|
if (!fs35.existsSync(source)) {
|
|
27495
27515
|
return skippedMissingSource2("skills", source);
|
|
@@ -27513,21 +27533,21 @@ function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
27513
27533
|
} else if (artifactClass === "managed-symlink") {
|
|
27514
27534
|
fs35.unlinkSync(destination);
|
|
27515
27535
|
}
|
|
27516
|
-
ensureDir(
|
|
27536
|
+
ensureDir(path36.dirname(destination));
|
|
27517
27537
|
createRelativeSymlink(source, destination, "dir");
|
|
27518
27538
|
return { component: "skills", status: "success", path: destination };
|
|
27519
27539
|
}
|
|
27520
27540
|
function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27521
|
-
const sourceAgentsRoot =
|
|
27541
|
+
const sourceAgentsRoot = path36.join(sourceRoot, config.source.agents);
|
|
27522
27542
|
if (!fs35.existsSync(sourceAgentsRoot)) {
|
|
27523
27543
|
return [skippedMissingSource2("agents", sourceAgentsRoot)];
|
|
27524
27544
|
}
|
|
27525
|
-
const sourceAgents = ts(
|
|
27545
|
+
const sourceAgents = ts(path36.join(sourceAgentsRoot, "*.md")).sort();
|
|
27526
27546
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
27527
27547
|
return sourceAgents.map((agentFile) => {
|
|
27528
|
-
const destination =
|
|
27548
|
+
const destination = path36.join(
|
|
27529
27549
|
agentsRoot,
|
|
27530
|
-
`${
|
|
27550
|
+
`${path36.basename(agentFile, ".md")}.agent.md`
|
|
27531
27551
|
);
|
|
27532
27552
|
const compiled = compileAgent(
|
|
27533
27553
|
agentFile,
|
|
@@ -27555,16 +27575,16 @@ function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
27555
27575
|
});
|
|
27556
27576
|
}
|
|
27557
27577
|
function syncCommands(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27558
|
-
const sourceCommandsRoot =
|
|
27578
|
+
const sourceCommandsRoot = path36.join(sourceRoot, config.source.commands);
|
|
27559
27579
|
if (!fs35.existsSync(sourceCommandsRoot)) {
|
|
27560
27580
|
return [skippedMissingSource2("commands", sourceCommandsRoot)];
|
|
27561
27581
|
}
|
|
27562
|
-
const sourceCommands = ts(
|
|
27582
|
+
const sourceCommands = ts(path36.join(sourceCommandsRoot, "*.md")).sort();
|
|
27563
27583
|
const promptsRoot = resolveTargetPath(paths.prompts);
|
|
27564
27584
|
return sourceCommands.map((commandFile) => {
|
|
27565
|
-
const destination =
|
|
27585
|
+
const destination = path36.join(
|
|
27566
27586
|
promptsRoot,
|
|
27567
|
-
`${
|
|
27587
|
+
`${path36.basename(commandFile, ".md")}.prompt.md`
|
|
27568
27588
|
);
|
|
27569
27589
|
const compiled = compileCommandPrompt(commandFile);
|
|
27570
27590
|
if (options.dryRun) {
|
|
@@ -27588,7 +27608,7 @@ function syncCommands(config, sourceRoot, paths, options, logger, manifest, scop
|
|
|
27588
27608
|
});
|
|
27589
27609
|
}
|
|
27590
27610
|
function syncHooks2(config, sourceRoot, paths, mappings, options, lossReport, logger) {
|
|
27591
|
-
const destination =
|
|
27611
|
+
const destination = path36.join(
|
|
27592
27612
|
resolveTargetPath(paths.hooks),
|
|
27593
27613
|
"tangyr-managed.json"
|
|
27594
27614
|
);
|
|
@@ -27683,7 +27703,7 @@ function writeCompiledArtifact2(component, destination, content, expectedHash, c
|
|
|
27683
27703
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27684
27704
|
return { component, status: "conflict", path: destination };
|
|
27685
27705
|
}
|
|
27686
|
-
ensureDir(
|
|
27706
|
+
ensureDir(path36.dirname(destination));
|
|
27687
27707
|
fs35.writeFileSync(destination, content);
|
|
27688
27708
|
return { component, status: "success", path: destination };
|
|
27689
27709
|
}
|
|
@@ -27725,12 +27745,12 @@ function shouldSkipComponent2(options, component) {
|
|
|
27725
27745
|
function cleanupLegacyAgents(paths, options, logger) {
|
|
27726
27746
|
const currentAgentsRoot = resolveTargetPath(paths.agents);
|
|
27727
27747
|
const legacyAgentsRoot = resolveTargetPath(legacyCopilotAgentsPath);
|
|
27728
|
-
if (
|
|
27748
|
+
if (path36.resolve(currentAgentsRoot) === path36.resolve(legacyAgentsRoot)) {
|
|
27729
27749
|
return [];
|
|
27730
27750
|
}
|
|
27731
27751
|
const outcomes = [];
|
|
27732
27752
|
for (const filePath of ts(
|
|
27733
|
-
|
|
27753
|
+
path36.join(legacyAgentsRoot, "*.agent.md")
|
|
27734
27754
|
).sort()) {
|
|
27735
27755
|
if (!isCopilotManagedCompiledFile(filePath)) {
|
|
27736
27756
|
continue;
|
|
@@ -27770,7 +27790,7 @@ function isSymlinkTo3(linkPath, source) {
|
|
|
27770
27790
|
// src/adapters/cursor.ts
|
|
27771
27791
|
import crypto7 from "crypto";
|
|
27772
27792
|
import fs36 from "fs";
|
|
27773
|
-
import
|
|
27793
|
+
import path37 from "path";
|
|
27774
27794
|
function syncCursor(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27775
27795
|
const scope = options.scope ?? "global";
|
|
27776
27796
|
const profile = resolveTargetPaths({
|
|
@@ -27882,7 +27902,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27882
27902
|
if (!shouldSkipComponent3(options, "hooks")) {
|
|
27883
27903
|
outcomes.push(
|
|
27884
27904
|
syncHookScriptsBridge({
|
|
27885
|
-
source:
|
|
27905
|
+
source: path37.resolve(sourceRoot, config.source.hooks),
|
|
27886
27906
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27887
27907
|
config,
|
|
27888
27908
|
sourceRoot,
|
|
@@ -27942,7 +27962,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27942
27962
|
return { target: "cursor", outcomes };
|
|
27943
27963
|
}
|
|
27944
27964
|
function syncInstructions2(config, sourceRoot, paths, options, lossReport, logger, manifest, scopePath) {
|
|
27945
|
-
const source =
|
|
27965
|
+
const source = path37.join(sourceRoot, config.source.instructions);
|
|
27946
27966
|
const destination = resolveTargetPath(paths.instructions);
|
|
27947
27967
|
const baseContent = fs36.existsSync(source) ? fs36.readFileSync(source, "utf8").trim() : "";
|
|
27948
27968
|
const personaContent = extractPrimaryPersonaContent(
|
|
@@ -27957,7 +27977,7 @@ function syncInstructions2(config, sourceRoot, paths, options, lossReport, logge
|
|
|
27957
27977
|
${personaContent}`.trim() : baseContent;
|
|
27958
27978
|
const marker = formatProvenanceMarker(
|
|
27959
27979
|
"markdown",
|
|
27960
|
-
|
|
27980
|
+
path37.basename(config.source.instructions),
|
|
27961
27981
|
hashString3(composed),
|
|
27962
27982
|
"cursor"
|
|
27963
27983
|
);
|
|
@@ -27982,11 +28002,11 @@ ${composed}
|
|
|
27982
28002
|
);
|
|
27983
28003
|
}
|
|
27984
28004
|
function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
27985
|
-
const agentsDir =
|
|
28005
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
27986
28006
|
if (!fs36.existsSync(agentsDir)) {
|
|
27987
28007
|
return null;
|
|
27988
28008
|
}
|
|
27989
|
-
const agentFiles = ts(
|
|
28009
|
+
const agentFiles = ts(path37.join(agentsDir, "*.md")).sort();
|
|
27990
28010
|
if (agentFiles.length === 0) {
|
|
27991
28011
|
return null;
|
|
27992
28012
|
}
|
|
@@ -28009,7 +28029,7 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
28009
28029
|
return null;
|
|
28010
28030
|
}
|
|
28011
28031
|
addLoss(lossReport, "cursor", "instructions", {
|
|
28012
|
-
source: `agents/${
|
|
28032
|
+
source: `agents/${path37.basename(primaryFile)}`,
|
|
28013
28033
|
fields: [
|
|
28014
28034
|
{
|
|
28015
28035
|
field: "persona",
|
|
@@ -28019,23 +28039,23 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
28019
28039
|
"persona",
|
|
28020
28040
|
"instructions-shim"
|
|
28021
28041
|
),
|
|
28022
|
-
detail: `Primary persona from ${
|
|
28042
|
+
detail: `Primary persona from ${path37.basename(primaryFile)} folded into AGENTS.md (Cursor has no custom modes surface)`
|
|
28023
28043
|
}
|
|
28024
28044
|
]
|
|
28025
28045
|
});
|
|
28026
28046
|
return body.trim();
|
|
28027
28047
|
}
|
|
28028
28048
|
function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28029
|
-
const sourceAgentsRoot =
|
|
28049
|
+
const sourceAgentsRoot = path37.join(sourceRoot, config.source.agents);
|
|
28030
28050
|
if (!fs36.existsSync(sourceAgentsRoot)) {
|
|
28031
28051
|
return [skippedMissingSource3("agents", sourceAgentsRoot)];
|
|
28032
28052
|
}
|
|
28033
|
-
const sourceAgents = ts(
|
|
28053
|
+
const sourceAgents = ts(path37.join(sourceAgentsRoot, "*.md")).sort();
|
|
28034
28054
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
28035
28055
|
return sourceAgents.map((agentFile) => {
|
|
28036
|
-
const destination =
|
|
28056
|
+
const destination = path37.join(
|
|
28037
28057
|
agentsRoot,
|
|
28038
|
-
`${
|
|
28058
|
+
`${path37.basename(agentFile, ".md")}.md`
|
|
28039
28059
|
);
|
|
28040
28060
|
let compiled;
|
|
28041
28061
|
try {
|
|
@@ -28076,14 +28096,14 @@ function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
28076
28096
|
});
|
|
28077
28097
|
}
|
|
28078
28098
|
function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28079
|
-
const sourceRulesDir =
|
|
28099
|
+
const sourceRulesDir = path37.join(sourceRoot, config.source.rules);
|
|
28080
28100
|
if (!fs36.existsSync(sourceRulesDir)) {
|
|
28081
28101
|
return [skippedMissingSource3("rules", sourceRulesDir)];
|
|
28082
28102
|
}
|
|
28083
28103
|
const compiled = compileRules(sourceRulesDir, "cursor", mappings, lossReport);
|
|
28084
28104
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28085
28105
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28086
|
-
const destination =
|
|
28106
|
+
const destination = path37.join(rulesDir, name);
|
|
28087
28107
|
if (options.dryRun) {
|
|
28088
28108
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28089
28109
|
return {
|
|
@@ -28107,17 +28127,17 @@ function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28107
28127
|
});
|
|
28108
28128
|
}
|
|
28109
28129
|
function syncCommands2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28110
|
-
const sourceCommandsRoot =
|
|
28130
|
+
const sourceCommandsRoot = path37.join(sourceRoot, config.source.commands);
|
|
28111
28131
|
if (!fs36.existsSync(sourceCommandsRoot)) {
|
|
28112
28132
|
return [skippedMissingSource3("commands", sourceCommandsRoot)];
|
|
28113
28133
|
}
|
|
28114
|
-
const sourceCommands = ts(
|
|
28134
|
+
const sourceCommands = ts(path37.join(sourceCommandsRoot, "*.md")).sort();
|
|
28115
28135
|
const skillsRoot = resolveTargetPath(paths.skills);
|
|
28116
28136
|
return sourceCommands.map((commandFile) => {
|
|
28117
|
-
const baseName =
|
|
28118
|
-
const destination =
|
|
28137
|
+
const baseName = path37.basename(commandFile, ".md");
|
|
28138
|
+
const destination = path37.join(skillsRoot, baseName, "SKILL.md");
|
|
28119
28139
|
const commandContent = fs36.readFileSync(commandFile, "utf8");
|
|
28120
|
-
const relativeSource = `commands/${
|
|
28140
|
+
const relativeSource = `commands/${path37.basename(commandFile)}`;
|
|
28121
28141
|
const marker = formatProvenanceMarker(
|
|
28122
28142
|
"markdown",
|
|
28123
28143
|
relativeSource,
|
|
@@ -28156,7 +28176,7 @@ ${commandContent.trim()}
|
|
|
28156
28176
|
});
|
|
28157
28177
|
}
|
|
28158
28178
|
function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, component = "skills", destination = "", asSymlink = false) {
|
|
28159
|
-
const source =
|
|
28179
|
+
const source = path37.resolve(sourceRoot, config.source.skills);
|
|
28160
28180
|
if (!fs36.existsSync(source)) {
|
|
28161
28181
|
return skippedMissingSource3(component, source);
|
|
28162
28182
|
}
|
|
@@ -28177,7 +28197,7 @@ function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, c
|
|
|
28177
28197
|
} else if (artifactClass === "managed-symlink") {
|
|
28178
28198
|
fs36.unlinkSync(destination);
|
|
28179
28199
|
}
|
|
28180
|
-
ensureDir(
|
|
28200
|
+
ensureDir(path37.dirname(destination));
|
|
28181
28201
|
createRelativeSymlink(source, destination, "dir");
|
|
28182
28202
|
logger.verbose(`Skills: created shared skills symlink ${destination}`);
|
|
28183
28203
|
return { component, status: "success", path: destination };
|
|
@@ -28222,7 +28242,7 @@ function syncHooks3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28222
28242
|
}
|
|
28223
28243
|
const hooksFileContent = `${JSON.stringify({ version: 1, hooks: compiled.payload }, null, 2)}
|
|
28224
28244
|
`;
|
|
28225
|
-
ensureDir(
|
|
28245
|
+
ensureDir(path37.dirname(destination));
|
|
28226
28246
|
fs36.writeFileSync(destination, hooksFileContent);
|
|
28227
28247
|
return { component: "hooks", status: "success", path: destination };
|
|
28228
28248
|
}
|
|
@@ -28284,13 +28304,13 @@ function syncPermissions(config, paths, options, _lossReport, logger, manifest,
|
|
|
28284
28304
|
);
|
|
28285
28305
|
}
|
|
28286
28306
|
function syncProviderPin(config, sourceRoot, lossReport) {
|
|
28287
|
-
const agentsDir =
|
|
28307
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
28288
28308
|
if (!fs36.existsSync(agentsDir)) return;
|
|
28289
|
-
for (const agentFile of ts(
|
|
28309
|
+
for (const agentFile of ts(path37.join(agentsDir, "*.md")).sort()) {
|
|
28290
28310
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28291
28311
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28292
28312
|
if (hasCustomProvider) {
|
|
28293
|
-
const relativeSource = `agents/${
|
|
28313
|
+
const relativeSource = `agents/${path37.basename(agentFile)}`;
|
|
28294
28314
|
addLoss(lossReport, "cursor", "agents", {
|
|
28295
28315
|
source: relativeSource,
|
|
28296
28316
|
fields: [
|
|
@@ -28302,7 +28322,7 @@ function syncProviderPin(config, sourceRoot, lossReport) {
|
|
|
28302
28322
|
"provider",
|
|
28303
28323
|
"provider-not-representable"
|
|
28304
28324
|
),
|
|
28305
|
-
detail: `${
|
|
28325
|
+
detail: `${path37.basename(agentFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
28306
28326
|
}
|
|
28307
28327
|
]
|
|
28308
28328
|
});
|
|
@@ -28317,7 +28337,7 @@ function writeCompiledArtifact3(component, destination, content, expectedHash, c
|
|
|
28317
28337
|
if (artifactClass === "unmanaged-conflict" && !handleConflict3(destination, config, options, logger, manifest, scopePath)) {
|
|
28318
28338
|
return { component, status: "conflict", path: destination };
|
|
28319
28339
|
}
|
|
28320
|
-
ensureDir(
|
|
28340
|
+
ensureDir(path37.dirname(destination));
|
|
28321
28341
|
fs36.writeFileSync(destination, content);
|
|
28322
28342
|
return { component, status: "success", path: destination };
|
|
28323
28343
|
}
|
|
@@ -28377,7 +28397,7 @@ function hashString3(value) {
|
|
|
28377
28397
|
// src/adapters/cline.ts
|
|
28378
28398
|
import crypto8 from "crypto";
|
|
28379
28399
|
import fs37 from "fs";
|
|
28380
|
-
import
|
|
28400
|
+
import path38 from "path";
|
|
28381
28401
|
function syncCline(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28382
28402
|
const scope = options.scope ?? "global";
|
|
28383
28403
|
const profile = resolveTargetPaths({
|
|
@@ -28490,7 +28510,7 @@ function syncCline(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
28490
28510
|
function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport, logger, manifest, scopePath) {
|
|
28491
28511
|
if (scope === "global" || paths.instructions === null) {
|
|
28492
28512
|
addLoss(lossReport, "cline", "instructions", {
|
|
28493
|
-
source:
|
|
28513
|
+
source: path38.basename(config.source.instructions),
|
|
28494
28514
|
fields: [
|
|
28495
28515
|
{
|
|
28496
28516
|
field: "instructions",
|
|
@@ -28510,12 +28530,12 @@ function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport
|
|
|
28510
28530
|
path: "cline/global/instructions: no committable global path"
|
|
28511
28531
|
};
|
|
28512
28532
|
}
|
|
28513
|
-
const source =
|
|
28533
|
+
const source = path38.join(sourceRoot, config.source.instructions);
|
|
28514
28534
|
const destination = resolveTargetPath(paths.instructions);
|
|
28515
28535
|
const baseContent = fs37.existsSync(source) ? fs37.readFileSync(source, "utf8").trim() : "";
|
|
28516
28536
|
const marker = formatProvenanceMarker(
|
|
28517
28537
|
"markdown",
|
|
28518
|
-
|
|
28538
|
+
path38.basename(config.source.instructions),
|
|
28519
28539
|
hashString4(baseContent),
|
|
28520
28540
|
"cline"
|
|
28521
28541
|
);
|
|
@@ -28540,11 +28560,11 @@ ${baseContent}
|
|
|
28540
28560
|
);
|
|
28541
28561
|
}
|
|
28542
28562
|
function syncAgents4(config, sourceRoot, mappings, extensions, options, lossReport, logger) {
|
|
28543
|
-
const sourceAgentsRoot =
|
|
28563
|
+
const sourceAgentsRoot = path38.join(sourceRoot, config.source.agents);
|
|
28544
28564
|
if (!fs37.existsSync(sourceAgentsRoot)) {
|
|
28545
28565
|
return [skippedMissingSource4("agents", sourceAgentsRoot)];
|
|
28546
28566
|
}
|
|
28547
|
-
const sourceAgents = ts(
|
|
28567
|
+
const sourceAgents = ts(path38.join(sourceAgentsRoot, "*.md")).sort();
|
|
28548
28568
|
return sourceAgents.map((agentFile) => {
|
|
28549
28569
|
compileAgent(agentFile, "cline", mappings, extensions, lossReport);
|
|
28550
28570
|
if (options.dryRun) {
|
|
@@ -28560,14 +28580,14 @@ function syncAgents4(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
28560
28580
|
});
|
|
28561
28581
|
}
|
|
28562
28582
|
function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28563
|
-
const sourceRulesDir =
|
|
28583
|
+
const sourceRulesDir = path38.join(sourceRoot, config.source.rules);
|
|
28564
28584
|
if (!fs37.existsSync(sourceRulesDir)) {
|
|
28565
28585
|
return [skippedMissingSource4("rules", sourceRulesDir)];
|
|
28566
28586
|
}
|
|
28567
28587
|
const compiled = compileRules(sourceRulesDir, "cline", mappings, lossReport);
|
|
28568
28588
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28569
28589
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28570
|
-
const destination =
|
|
28590
|
+
const destination = path38.join(rulesDir, name);
|
|
28571
28591
|
if (options.dryRun) {
|
|
28572
28592
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28573
28593
|
return {
|
|
@@ -28591,17 +28611,17 @@ function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28591
28611
|
});
|
|
28592
28612
|
}
|
|
28593
28613
|
function syncCommands3(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28594
|
-
const sourceCommandsRoot =
|
|
28614
|
+
const sourceCommandsRoot = path38.join(sourceRoot, config.source.commands);
|
|
28595
28615
|
if (!fs37.existsSync(sourceCommandsRoot)) {
|
|
28596
28616
|
return [skippedMissingSource4("commands", sourceCommandsRoot)];
|
|
28597
28617
|
}
|
|
28598
|
-
const sourceCommands = ts(
|
|
28618
|
+
const sourceCommands = ts(path38.join(sourceCommandsRoot, "*.md")).sort();
|
|
28599
28619
|
const workflowsRoot = resolveTargetPath(paths.workflows);
|
|
28600
28620
|
return sourceCommands.map((commandFile) => {
|
|
28601
|
-
const baseName =
|
|
28602
|
-
const destination =
|
|
28621
|
+
const baseName = path38.basename(commandFile);
|
|
28622
|
+
const destination = path38.join(workflowsRoot, baseName);
|
|
28603
28623
|
const commandContent = fs37.readFileSync(commandFile, "utf8");
|
|
28604
|
-
const relativeSource = `commands/${
|
|
28624
|
+
const relativeSource = `commands/${path38.basename(commandFile)}`;
|
|
28605
28625
|
const marker = formatProvenanceMarker(
|
|
28606
28626
|
"markdown",
|
|
28607
28627
|
relativeSource,
|
|
@@ -28636,7 +28656,7 @@ ${commandContent.trim()}
|
|
|
28636
28656
|
});
|
|
28637
28657
|
}
|
|
28638
28658
|
function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28639
|
-
const source =
|
|
28659
|
+
const source = path38.resolve(sourceRoot, config.source.skills);
|
|
28640
28660
|
const destination = resolveTargetPath(paths.skills);
|
|
28641
28661
|
if (!fs37.existsSync(source)) {
|
|
28642
28662
|
return skippedMissingSource4("skills", source);
|
|
@@ -28660,7 +28680,7 @@ function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
28660
28680
|
} else if (artifactClass === "managed-symlink") {
|
|
28661
28681
|
fs37.unlinkSync(destination);
|
|
28662
28682
|
}
|
|
28663
|
-
ensureDir(
|
|
28683
|
+
ensureDir(path38.dirname(destination));
|
|
28664
28684
|
createRelativeSymlink(source, destination, "dir");
|
|
28665
28685
|
logger.verbose(`Skills: created Cline skills symlink ${destination}`);
|
|
28666
28686
|
return { component: "skills", status: "success", path: destination };
|
|
@@ -28730,11 +28750,11 @@ function syncSettings(lossReport) {
|
|
|
28730
28750
|
};
|
|
28731
28751
|
}
|
|
28732
28752
|
function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
28733
|
-
const agentsDir =
|
|
28753
|
+
const agentsDir = path38.join(sourceRoot, config.source.agents);
|
|
28734
28754
|
if (!fs37.existsSync(agentsDir)) return;
|
|
28735
|
-
for (const agentFile of ts(
|
|
28755
|
+
for (const agentFile of ts(path38.join(agentsDir, "*.md")).sort()) {
|
|
28736
28756
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28737
|
-
const relativeSource = `agents/${
|
|
28757
|
+
const relativeSource = `agents/${path38.basename(agentFile)}`;
|
|
28738
28758
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28739
28759
|
if (hasCustomProvider) {
|
|
28740
28760
|
addLoss(lossReport, "cline", "agents", {
|
|
@@ -28748,7 +28768,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28748
28768
|
"provider",
|
|
28749
28769
|
"provider-not-representable"
|
|
28750
28770
|
),
|
|
28751
|
-
detail: `${
|
|
28771
|
+
detail: `${path38.basename(agentFile)}: Cline provider is interface-only (Settings \u2192 API Provider); configure manually.`
|
|
28752
28772
|
}
|
|
28753
28773
|
]
|
|
28754
28774
|
});
|
|
@@ -28766,7 +28786,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28766
28786
|
"model",
|
|
28767
28787
|
"model-not-representable"
|
|
28768
28788
|
),
|
|
28769
|
-
detail: `${
|
|
28789
|
+
detail: `${path38.basename(agentFile)}: Cline model pin is interface-only (Settings \u2192 Model); configure manually.`
|
|
28770
28790
|
}
|
|
28771
28791
|
]
|
|
28772
28792
|
});
|
|
@@ -28781,7 +28801,7 @@ function writeCompiledArtifact4(component, destination, content, expectedHash, c
|
|
|
28781
28801
|
if (artifactClass === "unmanaged-conflict" && !handleConflict4(destination, config, options, logger, manifest, scopePath)) {
|
|
28782
28802
|
return { component, status: "conflict", path: destination };
|
|
28783
28803
|
}
|
|
28784
|
-
ensureDir(
|
|
28804
|
+
ensureDir(path38.dirname(destination));
|
|
28785
28805
|
fs37.writeFileSync(destination, content);
|
|
28786
28806
|
return { component, status: "success", path: destination };
|
|
28787
28807
|
}
|
|
@@ -28842,7 +28862,7 @@ function hashString4(value) {
|
|
|
28842
28862
|
import crypto9 from "crypto";
|
|
28843
28863
|
import fs38 from "fs";
|
|
28844
28864
|
import os6 from "os";
|
|
28845
|
-
import
|
|
28865
|
+
import path39 from "path";
|
|
28846
28866
|
var import_yaml11 = __toESM(require_dist(), 1);
|
|
28847
28867
|
function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28848
28868
|
const scope = options.scope ?? "global";
|
|
@@ -28860,7 +28880,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28860
28880
|
config_doc: profile.config_doc
|
|
28861
28881
|
};
|
|
28862
28882
|
const rules = compileRules(
|
|
28863
|
-
|
|
28883
|
+
path39.join(sourceRoot, config.source.rules),
|
|
28864
28884
|
"opencode",
|
|
28865
28885
|
mappings,
|
|
28866
28886
|
lossReport
|
|
@@ -28962,7 +28982,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28962
28982
|
return { target: "opencode", outcomes };
|
|
28963
28983
|
}
|
|
28964
28984
|
function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
28965
|
-
const source =
|
|
28985
|
+
const source = path39.join(sourceRoot, config.source.instructions);
|
|
28966
28986
|
const destination = resolveTargetPath(paths.instructions);
|
|
28967
28987
|
const baseContent = fs38.existsSync(source) ? fs38.readFileSync(source, "utf8").trim() : "";
|
|
28968
28988
|
const composed = agentsAppendix ? `${baseContent}
|
|
@@ -28971,7 +28991,7 @@ function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, l
|
|
|
28971
28991
|
${agentsAppendix}`.trim() : baseContent;
|
|
28972
28992
|
const marker = formatProvenanceMarker(
|
|
28973
28993
|
"markdown",
|
|
28974
|
-
|
|
28994
|
+
path39.basename(config.source.instructions),
|
|
28975
28995
|
hashString5(composed),
|
|
28976
28996
|
"opencode"
|
|
28977
28997
|
);
|
|
@@ -28998,16 +29018,16 @@ ${composed}
|
|
|
28998
29018
|
);
|
|
28999
29019
|
}
|
|
29000
29020
|
function syncAgents5(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
29001
|
-
const sourceAgentsRoot =
|
|
29021
|
+
const sourceAgentsRoot = path39.join(sourceRoot, config.source.agents);
|
|
29002
29022
|
if (!fs38.existsSync(sourceAgentsRoot)) {
|
|
29003
29023
|
return [skippedMissingSource5("agents", sourceAgentsRoot)];
|
|
29004
29024
|
}
|
|
29005
|
-
const sourceAgents = ts(
|
|
29025
|
+
const sourceAgents = ts(path39.join(sourceAgentsRoot, "*.md")).sort();
|
|
29006
29026
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
29007
29027
|
return sourceAgents.map((agentFile) => {
|
|
29008
|
-
const destination =
|
|
29028
|
+
const destination = path39.join(
|
|
29009
29029
|
agentsRoot,
|
|
29010
|
-
`${
|
|
29030
|
+
`${path39.basename(agentFile, ".md")}.md`
|
|
29011
29031
|
);
|
|
29012
29032
|
let compiled;
|
|
29013
29033
|
try {
|
|
@@ -29071,11 +29091,11 @@ function applyProviderModelBinding(compiled, mappings) {
|
|
|
29071
29091
|
return `${before}${(0, import_yaml11.stringify)(fields).trim()}${after}`;
|
|
29072
29092
|
}
|
|
29073
29093
|
function syncCommands4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
29074
|
-
const sourceCommandsRoot =
|
|
29094
|
+
const sourceCommandsRoot = path39.join(sourceRoot, config.source.commands);
|
|
29075
29095
|
if (!fs38.existsSync(sourceCommandsRoot)) {
|
|
29076
29096
|
return [skippedMissingSource5("commands", sourceCommandsRoot)];
|
|
29077
29097
|
}
|
|
29078
|
-
const sourceCommands = ts(
|
|
29098
|
+
const sourceCommands = ts(path39.join(sourceCommandsRoot, "*.md")).sort();
|
|
29079
29099
|
const commandsRoot = resolveTargetPath(paths.commands);
|
|
29080
29100
|
return sourceCommands.map((commandFile) => {
|
|
29081
29101
|
const { data, body } = parseCommandFile(commandFile);
|
|
@@ -29089,7 +29109,7 @@ function syncCommands4(config, sourceRoot, paths, options, logger, manifest, sco
|
|
|
29089
29109
|
if (typeof data.model === "string") {
|
|
29090
29110
|
frontmatter.model = data.model;
|
|
29091
29111
|
}
|
|
29092
|
-
const relativeSource = `commands/${
|
|
29112
|
+
const relativeSource = `commands/${path39.basename(commandFile)}`;
|
|
29093
29113
|
const marker = formatProvenanceMarker(
|
|
29094
29114
|
"markdown",
|
|
29095
29115
|
relativeSource,
|
|
@@ -29105,9 +29125,9 @@ ${body.trimEnd()}
|
|
|
29105
29125
|
` : `${marker}
|
|
29106
29126
|
${body.trimEnd()}
|
|
29107
29127
|
`;
|
|
29108
|
-
const destination =
|
|
29128
|
+
const destination = path39.join(
|
|
29109
29129
|
commandsRoot,
|
|
29110
|
-
`${
|
|
29130
|
+
`${path39.basename(commandFile, ".md")}.md`
|
|
29111
29131
|
);
|
|
29112
29132
|
if (options.dryRun) {
|
|
29113
29133
|
logger.info(
|
|
@@ -29134,7 +29154,7 @@ ${body.trimEnd()}
|
|
|
29134
29154
|
});
|
|
29135
29155
|
}
|
|
29136
29156
|
function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scopePath, component = "skills", destination = "") {
|
|
29137
|
-
const source =
|
|
29157
|
+
const source = path39.resolve(sourceRoot, config.source.skills);
|
|
29138
29158
|
if (!fs38.existsSync(source)) {
|
|
29139
29159
|
return skippedMissingSource5(component, source);
|
|
29140
29160
|
}
|
|
@@ -29153,7 +29173,7 @@ function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scop
|
|
|
29153
29173
|
} else if (artifactClass === "managed-symlink") {
|
|
29154
29174
|
fs38.unlinkSync(destination);
|
|
29155
29175
|
}
|
|
29156
|
-
ensureDir(
|
|
29176
|
+
ensureDir(path39.dirname(destination));
|
|
29157
29177
|
createRelativeSymlink(source, destination, "dir");
|
|
29158
29178
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
29159
29179
|
return { component, status: "success", path: destination };
|
|
@@ -29261,7 +29281,7 @@ function syncConfigDoc(paths, mcpEntries, _lossReport, permissionMap, mappings)
|
|
|
29261
29281
|
};
|
|
29262
29282
|
}
|
|
29263
29283
|
}
|
|
29264
|
-
ensureDir(
|
|
29284
|
+
ensureDir(path39.dirname(destination));
|
|
29265
29285
|
fs38.writeFileSync(destination, `${JSON.stringify(config, null, 2)}
|
|
29266
29286
|
`);
|
|
29267
29287
|
}
|
|
@@ -29273,7 +29293,7 @@ function writeCompiledArtifact5(component, destination, content, expectedHash, c
|
|
|
29273
29293
|
if (artifactClass === "unmanaged-conflict" && !handleConflict5(destination, config, options, logger, manifest, scopePath)) {
|
|
29274
29294
|
return { component, status: "conflict", path: destination };
|
|
29275
29295
|
}
|
|
29276
|
-
ensureDir(
|
|
29296
|
+
ensureDir(path39.dirname(destination));
|
|
29277
29297
|
fs38.writeFileSync(destination, content);
|
|
29278
29298
|
return { component, status: "success", path: destination };
|
|
29279
29299
|
}
|
|
@@ -29363,9 +29383,9 @@ function isBackupableFile(targetPath) {
|
|
|
29363
29383
|
}
|
|
29364
29384
|
function backupConflictingTarget(targetPath, scopePath) {
|
|
29365
29385
|
const ts2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu, "").replace("T", "T").replace(/\.\d+Z$/u, "Z");
|
|
29366
|
-
const relativeToRoot =
|
|
29367
|
-
const backupPath =
|
|
29368
|
-
fs39.mkdirSync(
|
|
29386
|
+
const relativeToRoot = path40.relative("/", targetPath).replace(/^\.\.\/+/gu, "");
|
|
29387
|
+
const backupPath = path40.join(scopePath, "backups", ts2, relativeToRoot);
|
|
29388
|
+
fs39.mkdirSync(path40.dirname(backupPath), { recursive: true });
|
|
29369
29389
|
fs39.copyFileSync(targetPath, backupPath);
|
|
29370
29390
|
return backupPath;
|
|
29371
29391
|
}
|
|
@@ -29395,7 +29415,7 @@ async function runInstallCommand(options, logger) {
|
|
|
29395
29415
|
);
|
|
29396
29416
|
}
|
|
29397
29417
|
const kitName = resolvedKitName ?? config.kit;
|
|
29398
|
-
const kitPath = kitPathOverride ?? (options.kitPath ?
|
|
29418
|
+
const kitPath = kitPathOverride ?? (options.kitPath ? path40.resolve(options.kitPath) : config.kitPath);
|
|
29399
29419
|
if (!kitName && !kitPath) {
|
|
29400
29420
|
logger.error(
|
|
29401
29421
|
"No kit specified. Use --kit <name>, --kit-path <path>, or set 'kit'/'kitPath' in tangyr.config.yaml."
|
|
@@ -29651,20 +29671,20 @@ SKIPPED CONFLICTS (${skippedTargetPaths.size} target(s) left unchanged):`
|
|
|
29651
29671
|
writeManifest(scopePath, manifest);
|
|
29652
29672
|
logger.info(`
|
|
29653
29673
|
Installation complete: ${installedCount} files installed.`);
|
|
29654
|
-
logger.info(`Manifest written to ${
|
|
29674
|
+
logger.info(`Manifest written to ${path40.join(scopePath, "manifest.json")}`);
|
|
29655
29675
|
logger.info(`Kit: ${kitInfo.name} (archetype: ${kitInfo.archetype})`);
|
|
29656
29676
|
logger.info(`Scope: ${scope}`);
|
|
29657
29677
|
logger.info(`Tools: ${tools.join(", ")}`);
|
|
29658
29678
|
reportHookRejections(
|
|
29659
29679
|
installLossReport,
|
|
29660
29680
|
tools,
|
|
29661
|
-
|
|
29681
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29662
29682
|
kitInfo.components.hooks.declared
|
|
29663
29683
|
);
|
|
29664
29684
|
const hooksConflict = reportHooksSourceConflict(
|
|
29665
29685
|
installLossReport,
|
|
29666
29686
|
tools,
|
|
29667
|
-
|
|
29687
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29668
29688
|
kitInfo.components.hooks.declared
|
|
29669
29689
|
);
|
|
29670
29690
|
if (hooksConflict) {
|
|
@@ -29809,7 +29829,7 @@ function applyClaudeCodePlacements(placements, manifest, skippedTargetPaths, log
|
|
|
29809
29829
|
logger.verbose(` skipped (operator choice): ${placement.destination}`);
|
|
29810
29830
|
continue;
|
|
29811
29831
|
}
|
|
29812
|
-
const destDir =
|
|
29832
|
+
const destDir = path40.dirname(placement.destination);
|
|
29813
29833
|
fs39.mkdirSync(destDir, { recursive: true });
|
|
29814
29834
|
if (placement.type === "symlink") {
|
|
29815
29835
|
if (fs39.existsSync(placement.destination) || isSymlink2(placement.destination)) {
|
|
@@ -30062,6 +30082,10 @@ function countInstalledArtifacts(outcomes) {
|
|
|
30062
30082
|
).length;
|
|
30063
30083
|
}
|
|
30064
30084
|
function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", projectRoot) {
|
|
30085
|
+
const shared = sharedArtifactKey(outcome.path, scope, projectRoot);
|
|
30086
|
+
if (shared) {
|
|
30087
|
+
return shared;
|
|
30088
|
+
}
|
|
30065
30089
|
if (tool !== "copilot" && tool !== "codex" && tool !== "opencode" && tool !== "cursor" && tool !== "cline") {
|
|
30066
30090
|
if (isDeferredTarget(tool)) {
|
|
30067
30091
|
throw new Error(
|
|
@@ -30090,11 +30114,11 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30090
30114
|
if (outcome.path === mcpFile2) {
|
|
30091
30115
|
return "cline/mcp.json";
|
|
30092
30116
|
}
|
|
30093
|
-
if (outcome.path.startsWith(`${workflowsRoot}${
|
|
30094
|
-
return `cline/workflows/${
|
|
30117
|
+
if (outcome.path.startsWith(`${workflowsRoot}${path40.sep}`)) {
|
|
30118
|
+
return `cline/workflows/${path40.basename(outcome.path)}`;
|
|
30095
30119
|
}
|
|
30096
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30097
|
-
return `cline/rules/${
|
|
30120
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30121
|
+
return `cline/rules/${path40.basename(outcome.path)}`;
|
|
30098
30122
|
}
|
|
30099
30123
|
return null;
|
|
30100
30124
|
}
|
|
@@ -30130,14 +30154,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30130
30154
|
if (outcome.path === permissionsFile) {
|
|
30131
30155
|
return "cursor/permissions.json";
|
|
30132
30156
|
}
|
|
30133
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30134
|
-
return `cursor/agents/${
|
|
30157
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30158
|
+
return `cursor/agents/${path40.basename(outcome.path)}`;
|
|
30135
30159
|
}
|
|
30136
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30137
|
-
return `cursor/rules/${
|
|
30160
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30161
|
+
return `cursor/rules/${path40.basename(outcome.path)}`;
|
|
30138
30162
|
}
|
|
30139
|
-
if (outcome.path.startsWith(`${skillsRoot2}${
|
|
30140
|
-
const rel =
|
|
30163
|
+
if (outcome.path.startsWith(`${skillsRoot2}${path40.sep}`)) {
|
|
30164
|
+
const rel = path40.relative(skillsRoot2, outcome.path);
|
|
30141
30165
|
return `cursor/skills/${rel}`;
|
|
30142
30166
|
}
|
|
30143
30167
|
return null;
|
|
@@ -30163,14 +30187,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30163
30187
|
if (outcome.path === skillsSharedRoot) {
|
|
30164
30188
|
return "opencode/skills_shared";
|
|
30165
30189
|
}
|
|
30166
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30167
|
-
return `opencode/agents/${
|
|
30190
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30191
|
+
return `opencode/agents/${path40.basename(outcome.path)}`;
|
|
30168
30192
|
}
|
|
30169
|
-
if (outcome.path.startsWith(`${commandsRoot}${
|
|
30170
|
-
return `opencode/commands/${
|
|
30193
|
+
if (outcome.path.startsWith(`${commandsRoot}${path40.sep}`)) {
|
|
30194
|
+
return `opencode/commands/${path40.basename(outcome.path)}`;
|
|
30171
30195
|
}
|
|
30172
30196
|
if (outcome.path === configDocFile) {
|
|
30173
|
-
return `opencode/${
|
|
30197
|
+
return `opencode/${path40.basename(outcome.path)}`;
|
|
30174
30198
|
}
|
|
30175
30199
|
return null;
|
|
30176
30200
|
}
|
|
@@ -30191,19 +30215,19 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30191
30215
|
return "copilot/skills";
|
|
30192
30216
|
}
|
|
30193
30217
|
if (instructionsMirror !== null && outcome.path === instructionsMirror) {
|
|
30194
|
-
return `copilot/${
|
|
30218
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30195
30219
|
}
|
|
30196
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30197
|
-
return `copilot/agents/${
|
|
30220
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30221
|
+
return `copilot/agents/${path40.basename(outcome.path)}`;
|
|
30198
30222
|
}
|
|
30199
|
-
if (outcome.path.startsWith(`${promptsRoot}${
|
|
30200
|
-
return `copilot/prompts/${
|
|
30223
|
+
if (outcome.path.startsWith(`${promptsRoot}${path40.sep}`)) {
|
|
30224
|
+
return `copilot/prompts/${path40.basename(outcome.path)}`;
|
|
30201
30225
|
}
|
|
30202
|
-
if (outcome.path.startsWith(`${hooksRoot}${
|
|
30203
|
-
return `copilot/hooks/${
|
|
30226
|
+
if (outcome.path.startsWith(`${hooksRoot}${path40.sep}`)) {
|
|
30227
|
+
return `copilot/hooks/${path40.basename(outcome.path)}`;
|
|
30204
30228
|
}
|
|
30205
30229
|
if (outcome.path === mcpFile2) {
|
|
30206
|
-
return `copilot/${
|
|
30230
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30207
30231
|
}
|
|
30208
30232
|
return null;
|
|
30209
30233
|
}
|
|
@@ -30220,17 +30244,17 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30220
30244
|
if (outcome.path === skillsRoot) {
|
|
30221
30245
|
return "codex/skills";
|
|
30222
30246
|
}
|
|
30223
|
-
if (outcome.path.startsWith(`${agentsRoot}${
|
|
30224
|
-
return `codex/agents/${
|
|
30247
|
+
if (outcome.path.startsWith(`${agentsRoot}${path40.sep}`)) {
|
|
30248
|
+
return `codex/agents/${path40.basename(outcome.path)}`;
|
|
30225
30249
|
}
|
|
30226
|
-
if (outcome.path.startsWith(`${rulesRoot}${
|
|
30227
|
-
return `codex/rules/${
|
|
30250
|
+
if (outcome.path.startsWith(`${rulesRoot}${path40.sep}`)) {
|
|
30251
|
+
return `codex/rules/${path40.basename(outcome.path)}`;
|
|
30228
30252
|
}
|
|
30229
30253
|
if (outcome.path === hooksFile) {
|
|
30230
|
-
return `codex/${
|
|
30254
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30231
30255
|
}
|
|
30232
30256
|
if (outcome.path === mcpFile) {
|
|
30233
|
-
return `codex/${
|
|
30257
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30234
30258
|
}
|
|
30235
30259
|
return null;
|
|
30236
30260
|
}
|
|
@@ -30270,7 +30294,9 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30270
30294
|
placements.push({
|
|
30271
30295
|
source: entrypoint.file,
|
|
30272
30296
|
destination: resolvedPaths.instructions,
|
|
30273
|
-
|
|
30297
|
+
// Shared at project scope, where this resolves to the same AGENTS.md
|
|
30298
|
+
// codex, copilot, opencode and cline write.
|
|
30299
|
+
manifestKey: sharedArtifactKey(resolvedPaths.instructions, scope, projectRoot) ?? `claude-code/${entrypoint.name}`,
|
|
30274
30300
|
type: "symlink",
|
|
30275
30301
|
isDir: false
|
|
30276
30302
|
});
|
|
@@ -30282,7 +30308,7 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30282
30308
|
rules: resolvedPaths.rules
|
|
30283
30309
|
};
|
|
30284
30310
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30285
|
-
const componentDir =
|
|
30311
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30286
30312
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30287
30313
|
placements.push({
|
|
30288
30314
|
source: componentDir,
|
|
@@ -30314,7 +30340,7 @@ function getClaudeCodePlacementsFromProfile(kitInfo, profile) {
|
|
|
30314
30340
|
rules: profile.rules
|
|
30315
30341
|
};
|
|
30316
30342
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30317
|
-
const componentDir =
|
|
30343
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30318
30344
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30319
30345
|
placements.push({
|
|
30320
30346
|
source: componentDir,
|
|
@@ -30340,8 +30366,8 @@ function collectAllFiles(kitInfo) {
|
|
|
30340
30366
|
const missingSet = new Set(reconciliation.missing);
|
|
30341
30367
|
for (const entry of reconciliation.declared) {
|
|
30342
30368
|
if (missingSet.has(entry)) continue;
|
|
30343
|
-
const relPath = isSkills ?
|
|
30344
|
-
files.set(relPath,
|
|
30369
|
+
const relPath = isSkills ? path40.join(component, entry) : path40.join(component, `${entry}.md`);
|
|
30370
|
+
files.set(relPath, path40.join(kitInfo.path, relPath));
|
|
30345
30371
|
}
|
|
30346
30372
|
}
|
|
30347
30373
|
return files;
|
|
@@ -30393,14 +30419,14 @@ async function runKitUpdateCommand(options, logger) {
|
|
|
30393
30419
|
}
|
|
30394
30420
|
|
|
30395
30421
|
// src/commands/list.ts
|
|
30396
|
-
import
|
|
30422
|
+
import path41 from "path";
|
|
30397
30423
|
function runListCommand(options, logger) {
|
|
30398
30424
|
let searchPaths = [];
|
|
30399
|
-
let directKitPath = options.kitPath ?
|
|
30425
|
+
let directKitPath = options.kitPath ? path41.resolve(options.kitPath) : void 0;
|
|
30400
30426
|
try {
|
|
30401
30427
|
const { config, configDir } = resolveConfig(options.config);
|
|
30402
30428
|
searchPaths = config.kitSearchPaths ?? [
|
|
30403
|
-
|
|
30429
|
+
path41.join(configDir, "operating-kits")
|
|
30404
30430
|
];
|
|
30405
30431
|
directKitPath = directKitPath ?? config.kitPath;
|
|
30406
30432
|
} catch (err) {
|
|
@@ -30475,7 +30501,7 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30475
30501
|
return kits;
|
|
30476
30502
|
}
|
|
30477
30503
|
const directKit = loadKit(directKitPath);
|
|
30478
|
-
if (kits.some((kit) =>
|
|
30504
|
+
if (kits.some((kit) => path41.resolve(kit.path) === directKit.path)) {
|
|
30479
30505
|
return kits;
|
|
30480
30506
|
}
|
|
30481
30507
|
return [...kits, directKit];
|
|
@@ -30484,14 +30510,14 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30484
30510
|
// src/commands/probe.ts
|
|
30485
30511
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
30486
30512
|
import fs40 from "fs";
|
|
30487
|
-
import
|
|
30513
|
+
import path42 from "path";
|
|
30488
30514
|
function runProbeCommand(options, logger) {
|
|
30489
30515
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30490
30516
|
options,
|
|
30491
30517
|
import.meta.url
|
|
30492
30518
|
);
|
|
30493
30519
|
const platformPaths = readYamlObject(
|
|
30494
|
-
|
|
30520
|
+
path42.join(
|
|
30495
30521
|
resolveConfiguredPath(config.mappings, configDir, sourceRoot, "mappings"),
|
|
30496
30522
|
"platform-paths.yaml"
|
|
30497
30523
|
)
|
|
@@ -30571,7 +30597,7 @@ function commandProbeRows(target, key, command, args) {
|
|
|
30571
30597
|
// src/commands/status.ts
|
|
30572
30598
|
import crypto10 from "crypto";
|
|
30573
30599
|
import fs41 from "fs";
|
|
30574
|
-
import
|
|
30600
|
+
import path43 from "path";
|
|
30575
30601
|
function runStatusCommand(options, logger) {
|
|
30576
30602
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30577
30603
|
options,
|
|
@@ -30650,21 +30676,21 @@ function classifyCodexFiles(config, sourceRoot, configDir) {
|
|
|
30650
30676
|
rules: paths.rules
|
|
30651
30677
|
};
|
|
30652
30678
|
const rules = compileRules(
|
|
30653
|
-
|
|
30679
|
+
path43.join(sourceRoot, config.source.rules),
|
|
30654
30680
|
"codex",
|
|
30655
30681
|
mappings,
|
|
30656
30682
|
createLossReport()
|
|
30657
30683
|
);
|
|
30658
|
-
const instructionsSource = fs41.readFileSync(
|
|
30684
|
+
const instructionsSource = fs41.readFileSync(path43.join(sourceRoot, config.source.instructions), "utf8").trim();
|
|
30659
30685
|
const composedInstructions = `${instructionsSource}
|
|
30660
30686
|
|
|
30661
30687
|
--- tangyr managed rules ---
|
|
30662
30688
|
${rules.agentsAppendix}`.trim();
|
|
30663
30689
|
const agentFiles = ts(
|
|
30664
|
-
|
|
30690
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30665
30691
|
).sort();
|
|
30666
|
-
const hooksSource =
|
|
30667
|
-
const mcpSource =
|
|
30692
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30693
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30668
30694
|
const ruleRows = rules.dotRulesFiles.length === 0 ? [
|
|
30669
30695
|
{
|
|
30670
30696
|
component: "rules",
|
|
@@ -30675,7 +30701,7 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30675
30701
|
] : rules.dotRulesFiles.map(
|
|
30676
30702
|
(ruleFile) => classifyCompiledFile(
|
|
30677
30703
|
`rules/${ruleFile.name}`,
|
|
30678
|
-
|
|
30704
|
+
path43.join(resolveTargetPath(codexPaths.rules), ruleFile.name),
|
|
30679
30705
|
"codex",
|
|
30680
30706
|
void 0,
|
|
30681
30707
|
config,
|
|
@@ -30693,10 +30719,10 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30693
30719
|
),
|
|
30694
30720
|
...agentFiles.map(
|
|
30695
30721
|
(agentFile) => classifyCompiledFile(
|
|
30696
|
-
`agents/${
|
|
30697
|
-
|
|
30722
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30723
|
+
path43.join(
|
|
30698
30724
|
resolveTargetPath(codexPaths.agents),
|
|
30699
|
-
`${
|
|
30725
|
+
`${path43.basename(agentFile, ".md")}.toml`
|
|
30700
30726
|
),
|
|
30701
30727
|
"codex",
|
|
30702
30728
|
computeSourceHash(agentFile),
|
|
@@ -30776,20 +30802,20 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30776
30802
|
mcpSharedFile: paths.mcp_shared_file
|
|
30777
30803
|
};
|
|
30778
30804
|
const agentFiles = ts(
|
|
30779
|
-
|
|
30805
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30780
30806
|
).sort();
|
|
30781
30807
|
const commandFiles = ts(
|
|
30782
|
-
|
|
30808
|
+
path43.join(sourceRoot, config.source.commands, "*.md")
|
|
30783
30809
|
).sort();
|
|
30784
|
-
const hooksSource =
|
|
30785
|
-
const mcpSource =
|
|
30810
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30811
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30786
30812
|
return [
|
|
30787
30813
|
...agentFiles.map(
|
|
30788
30814
|
(agentFile) => classifyCompiledFile(
|
|
30789
|
-
`agents/${
|
|
30790
|
-
|
|
30815
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30816
|
+
path43.join(
|
|
30791
30817
|
resolveTargetPath(copilotPaths.agents),
|
|
30792
|
-
`${
|
|
30818
|
+
`${path43.basename(agentFile, ".md")}.agent.md`
|
|
30793
30819
|
),
|
|
30794
30820
|
"copilot",
|
|
30795
30821
|
computeSourceHash(agentFile),
|
|
@@ -30806,10 +30832,10 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30806
30832
|
),
|
|
30807
30833
|
...commandFiles.map(
|
|
30808
30834
|
(commandFile) => classifyCompiledFile(
|
|
30809
|
-
`commands/${
|
|
30810
|
-
|
|
30835
|
+
`commands/${path43.basename(commandFile, ".md")}`,
|
|
30836
|
+
path43.join(
|
|
30811
30837
|
resolveTargetPath(copilotPaths.prompts),
|
|
30812
|
-
`${
|
|
30838
|
+
`${path43.basename(commandFile, ".md")}.prompt.md`
|
|
30813
30839
|
),
|
|
30814
30840
|
"copilot",
|
|
30815
30841
|
computeSourceHash(commandFile),
|
|
@@ -30829,7 +30855,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30829
30855
|
),
|
|
30830
30856
|
fs41.existsSync(hooksSource) ? classifyCompiledFile(
|
|
30831
30857
|
"hooks",
|
|
30832
|
-
|
|
30858
|
+
path43.join(
|
|
30833
30859
|
resolveTargetPath(copilotPaths.hooks),
|
|
30834
30860
|
"tangyr-managed.json"
|
|
30835
30861
|
),
|
|
@@ -30839,7 +30865,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30839
30865
|
sourceRoot
|
|
30840
30866
|
) : notConfiguredRow(
|
|
30841
30867
|
"hooks",
|
|
30842
|
-
|
|
30868
|
+
path43.join(
|
|
30843
30869
|
resolveTargetPath(copilotPaths.hooks),
|
|
30844
30870
|
"tangyr-managed.json"
|
|
30845
30871
|
)
|
|
@@ -30864,7 +30890,7 @@ function notConfiguredRow(component, filePath) {
|
|
|
30864
30890
|
}
|
|
30865
30891
|
function classifyDirectArtifact(artifact, config, sourceRoot) {
|
|
30866
30892
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
30867
|
-
const sourcePath = artifact.sourceKey ?
|
|
30893
|
+
const sourcePath = artifact.sourceKey ? path43.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
30868
30894
|
if (artifactClass === "managed-symlink" && sourcePath && !isSymlinkCurrent(artifact.path, sourcePath)) {
|
|
30869
30895
|
return {
|
|
30870
30896
|
component: artifact.component,
|
|
@@ -30953,9 +30979,9 @@ function classifyClaudeSharedFiles(config, sourceRoot) {
|
|
|
30953
30979
|
classifyHooks(settingsPath),
|
|
30954
30980
|
classifySettings(
|
|
30955
30981
|
settingsPath,
|
|
30956
|
-
|
|
30982
|
+
path43.resolve(sourceRoot, config.source.settings)
|
|
30957
30983
|
),
|
|
30958
|
-
classifyMcp(claudeJsonPath,
|
|
30984
|
+
classifyMcp(claudeJsonPath, path43.resolve(sourceRoot, config.source.mcp))
|
|
30959
30985
|
];
|
|
30960
30986
|
}
|
|
30961
30987
|
function classifyHooks(filePath) {
|
|
@@ -31088,7 +31114,7 @@ function hashString6(value) {
|
|
|
31088
31114
|
|
|
31089
31115
|
// src/commands/sync.ts
|
|
31090
31116
|
import fs43 from "fs";
|
|
31091
|
-
import
|
|
31117
|
+
import path45 from "path";
|
|
31092
31118
|
|
|
31093
31119
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
31094
31120
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -31587,7 +31613,7 @@ var source_default = chalk;
|
|
|
31587
31613
|
|
|
31588
31614
|
// src/adapters/claude-code.ts
|
|
31589
31615
|
import fs42 from "fs";
|
|
31590
|
-
import
|
|
31616
|
+
import path44 from "path";
|
|
31591
31617
|
|
|
31592
31618
|
// src/core/shim.ts
|
|
31593
31619
|
import crypto11 from "crypto";
|
|
@@ -31698,7 +31724,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31698
31724
|
}
|
|
31699
31725
|
if (!shouldSkipComponent6(options, "instructions") && manifest && scopePath) {
|
|
31700
31726
|
const shimPath = profile.instructions_shim;
|
|
31701
|
-
const agentsMdPath =
|
|
31727
|
+
const agentsMdPath = path44.resolve(sourceRoot, config.source.instructions);
|
|
31702
31728
|
if (!options.dryRun) {
|
|
31703
31729
|
applyClaudeCodeShimUpgrade(
|
|
31704
31730
|
shimPath,
|
|
@@ -31716,7 +31742,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31716
31742
|
if (!shouldSkipComponent6(options, "hooks")) {
|
|
31717
31743
|
outcomes.push(
|
|
31718
31744
|
syncHookScriptsBridge({
|
|
31719
|
-
source:
|
|
31745
|
+
source: path44.resolve(sourceRoot, config.source.hooks),
|
|
31720
31746
|
destination: profile.hook_scripts,
|
|
31721
31747
|
config,
|
|
31722
31748
|
sourceRoot,
|
|
@@ -31768,13 +31794,13 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31768
31794
|
}
|
|
31769
31795
|
function syncProviderLoss2(config, sourceRoot, mappings, lossReport) {
|
|
31770
31796
|
if (!mappings.modelTiers.custom_provider) return;
|
|
31771
|
-
const agentsDir =
|
|
31797
|
+
const agentsDir = path44.join(sourceRoot, config.source.agents);
|
|
31772
31798
|
if (!fs42.existsSync(agentsDir)) return;
|
|
31773
|
-
for (const agentFile of ts(
|
|
31799
|
+
for (const agentFile of ts(path44.join(agentsDir, "*.md")).sort()) {
|
|
31774
31800
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
31775
31801
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
31776
31802
|
if (hasProvider) {
|
|
31777
|
-
const basename =
|
|
31803
|
+
const basename = path44.basename(agentFile);
|
|
31778
31804
|
addLoss(lossReport, "claude-code", "agents", {
|
|
31779
31805
|
source: `agents/${basename}`,
|
|
31780
31806
|
fields: [
|
|
@@ -31801,12 +31827,12 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31801
31827
|
const shimContent = buildAgentsMdShim(shimPath, agentsMdPath, "claude-code");
|
|
31802
31828
|
if (!fs42.existsSync(shimPath)) {
|
|
31803
31829
|
manifest.artifacts.push({
|
|
31804
|
-
relativePath:
|
|
31830
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31805
31831
|
hash: expectedBodyHash,
|
|
31806
31832
|
origin: "tangyr-managed"
|
|
31807
31833
|
});
|
|
31808
31834
|
writeManifest(scopePath, manifest);
|
|
31809
|
-
fs42.mkdirSync(
|
|
31835
|
+
fs42.mkdirSync(path44.dirname(shimPath), { recursive: true });
|
|
31810
31836
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31811
31837
|
logger?.verbose(`instructions-shim: wrote @AGENTS.md shim -> ${shimPath}`);
|
|
31812
31838
|
return;
|
|
@@ -31824,14 +31850,14 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31824
31850
|
writeManifest(scopePath, manifest);
|
|
31825
31851
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31826
31852
|
manifest.artifacts.push({
|
|
31827
|
-
relativePath:
|
|
31853
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31828
31854
|
hash: expectedBodyHash,
|
|
31829
31855
|
origin: "tangyr-managed"
|
|
31830
31856
|
});
|
|
31831
31857
|
logger?.verbose(`instructions-shim: backed up and replaced -> ${shimPath}`);
|
|
31832
31858
|
}
|
|
31833
31859
|
function syncDirectComponent(config, sourceRoot, options, logger, directComponent, manifest, scopePath) {
|
|
31834
|
-
const source =
|
|
31860
|
+
const source = path44.resolve(
|
|
31835
31861
|
sourceRoot,
|
|
31836
31862
|
config.source[directComponent.sourceKey]
|
|
31837
31863
|
);
|
|
@@ -31868,7 +31894,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31868
31894
|
} else if (artifactClass === "managed-symlink") {
|
|
31869
31895
|
fs42.unlinkSync(destination);
|
|
31870
31896
|
}
|
|
31871
|
-
ensureDir(
|
|
31897
|
+
ensureDir(path44.dirname(destination));
|
|
31872
31898
|
createRelativeSymlink(source, destination, directComponent.type, {
|
|
31873
31899
|
logger,
|
|
31874
31900
|
provenanceMarker: directComponent.type === "file" ? formatProvenanceMarker(
|
|
@@ -31885,7 +31911,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31885
31911
|
};
|
|
31886
31912
|
}
|
|
31887
31913
|
function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination, manifest, scopePath) {
|
|
31888
|
-
const source =
|
|
31914
|
+
const source = path44.resolve(sourceRoot, config.source.skills);
|
|
31889
31915
|
if (!fs42.existsSync(source)) {
|
|
31890
31916
|
return [skippedMissingSource6("skills", source)];
|
|
31891
31917
|
}
|
|
@@ -31896,7 +31922,7 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31896
31922
|
if (isLegacyWholesaleSymlink) {
|
|
31897
31923
|
for (const name of foreignSkillNames(source, declaredNames)) {
|
|
31898
31924
|
logger.info(
|
|
31899
|
-
`[dry-run] skills: migrate foreign skill ${
|
|
31925
|
+
`[dry-run] skills: migrate foreign skill ${path44.join(source, name)} -> ${path44.join(destination, name)}`
|
|
31900
31926
|
);
|
|
31901
31927
|
}
|
|
31902
31928
|
logger.info(
|
|
@@ -31904,9 +31930,9 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31904
31930
|
);
|
|
31905
31931
|
}
|
|
31906
31932
|
for (const name of declaredNames ?? listSkillDirNames(source)) {
|
|
31907
|
-
const skillDestination =
|
|
31933
|
+
const skillDestination = path44.join(destination, name);
|
|
31908
31934
|
logger.info(
|
|
31909
|
-
`[dry-run] skills: symlink ${
|
|
31935
|
+
`[dry-run] skills: symlink ${path44.join(source, name)} -> ${skillDestination}`
|
|
31910
31936
|
);
|
|
31911
31937
|
outcomes2.push({
|
|
31912
31938
|
component: "skills",
|
|
@@ -31939,8 +31965,8 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31939
31965
|
return outcomes;
|
|
31940
31966
|
}
|
|
31941
31967
|
function syncSingleSkill(config, sourceRoot, options, logger, source, destination, name, manifest, scopePath) {
|
|
31942
|
-
const skillSource =
|
|
31943
|
-
const skillDestination =
|
|
31968
|
+
const skillSource = path44.join(source, name);
|
|
31969
|
+
const skillDestination = path44.join(destination, name);
|
|
31944
31970
|
if (!fs42.existsSync(skillSource)) {
|
|
31945
31971
|
return skippedMissingSource6("skills", skillSource);
|
|
31946
31972
|
}
|
|
@@ -31974,8 +32000,8 @@ function migrateWholesaleSkillsSymlink(source, destination, declaredNames, logge
|
|
|
31974
32000
|
fs42.unlinkSync(destination);
|
|
31975
32001
|
ensureDir(destination);
|
|
31976
32002
|
for (const name of foreignNames) {
|
|
31977
|
-
const from =
|
|
31978
|
-
const to =
|
|
32003
|
+
const from = path44.join(source, name);
|
|
32004
|
+
const to = path44.join(destination, name);
|
|
31979
32005
|
if (fs42.existsSync(to)) {
|
|
31980
32006
|
logger.warn(
|
|
31981
32007
|
`skills migration: ${to} already exists \u2014 skipping ${from} to avoid overwrite. Nothing in the kit was changed.`
|
|
@@ -32038,7 +32064,7 @@ function syncHooks6(config, sourceRoot, options, logger, destination, scriptsBri
|
|
|
32038
32064
|
};
|
|
32039
32065
|
}
|
|
32040
32066
|
function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
32041
|
-
const source =
|
|
32067
|
+
const source = path44.resolve(sourceRoot, config.source.mcp);
|
|
32042
32068
|
if (!fs42.existsSync(source)) {
|
|
32043
32069
|
return skippedMissingSource6("mcp", source);
|
|
32044
32070
|
}
|
|
@@ -32074,7 +32100,7 @@ function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
|
32074
32100
|
};
|
|
32075
32101
|
}
|
|
32076
32102
|
function syncSettings2(config, sourceRoot, options, logger, destination) {
|
|
32077
|
-
const source =
|
|
32103
|
+
const source = path44.resolve(sourceRoot, config.source.settings);
|
|
32078
32104
|
if (!fs42.existsSync(source)) {
|
|
32079
32105
|
return skippedMissingSource6("settings", source);
|
|
32080
32106
|
}
|
|
@@ -32343,13 +32369,13 @@ async function runSyncCommand(options, logger) {
|
|
|
32343
32369
|
reportHookRejections(
|
|
32344
32370
|
lossReport,
|
|
32345
32371
|
targets,
|
|
32346
|
-
|
|
32372
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32347
32373
|
kitInfo.components.hooks.declared
|
|
32348
32374
|
);
|
|
32349
32375
|
const hooksConflict = reportHooksSourceConflict(
|
|
32350
32376
|
lossReport,
|
|
32351
32377
|
targets,
|
|
32352
|
-
|
|
32378
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32353
32379
|
kitInfo.components.hooks.declared
|
|
32354
32380
|
);
|
|
32355
32381
|
if (hooksConflict) {
|
|
@@ -32460,7 +32486,7 @@ function updateManifest(kitInfo, kitSync) {
|
|
|
32460
32486
|
writeManifest(kitSync.scopePath, kitSync.manifest);
|
|
32461
32487
|
}
|
|
32462
32488
|
function resolveKitFilePath(kitPath, relativePath) {
|
|
32463
|
-
const fullPath =
|
|
32489
|
+
const fullPath = path45.join(kitPath, relativePath);
|
|
32464
32490
|
return fs43.existsSync(fullPath) ? fullPath : null;
|
|
32465
32491
|
}
|
|
32466
32492
|
function cleanupRemovedManagedArtifacts(config, mappings, targets, options, removedSourcePaths, logger) {
|
|
@@ -32524,9 +32550,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32524
32550
|
}
|
|
32525
32551
|
if (relativePath.startsWith("agents/")) {
|
|
32526
32552
|
removeManagedCompiledArtifact2(
|
|
32527
|
-
|
|
32553
|
+
path45.join(
|
|
32528
32554
|
resolveTargetPath(paths.agents ?? ""),
|
|
32529
|
-
`${
|
|
32555
|
+
`${path45.parse(relativePath).name}.agent.md`
|
|
32530
32556
|
),
|
|
32531
32557
|
"copilot",
|
|
32532
32558
|
relativePath,
|
|
@@ -32536,9 +32562,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32536
32562
|
}
|
|
32537
32563
|
if (relativePath.startsWith("commands/")) {
|
|
32538
32564
|
removeManagedCompiledArtifact2(
|
|
32539
|
-
|
|
32565
|
+
path45.join(
|
|
32540
32566
|
resolveTargetPath(paths.prompts ?? ""),
|
|
32541
|
-
`${
|
|
32567
|
+
`${path45.parse(relativePath).name}.prompt.md`
|
|
32542
32568
|
),
|
|
32543
32569
|
"copilot",
|
|
32544
32570
|
relativePath,
|
|
@@ -32548,7 +32574,7 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32548
32574
|
}
|
|
32549
32575
|
if (relativePath.endsWith("hooks.json")) {
|
|
32550
32576
|
removeManagedCompiledArtifact2(
|
|
32551
|
-
|
|
32577
|
+
path45.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
32552
32578
|
"copilot",
|
|
32553
32579
|
relativePath,
|
|
32554
32580
|
logger
|
|
@@ -32578,9 +32604,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32578
32604
|
}
|
|
32579
32605
|
if (relativePath.startsWith("agents/")) {
|
|
32580
32606
|
removeManagedCompiledArtifact2(
|
|
32581
|
-
|
|
32607
|
+
path45.join(
|
|
32582
32608
|
resolveTargetPath(paths.agents ?? ""),
|
|
32583
|
-
`${
|
|
32609
|
+
`${path45.parse(relativePath).name}.toml`
|
|
32584
32610
|
),
|
|
32585
32611
|
"codex",
|
|
32586
32612
|
relativePath,
|
|
@@ -32590,9 +32616,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32590
32616
|
}
|
|
32591
32617
|
if (relativePath.startsWith("rules/")) {
|
|
32592
32618
|
removeManagedCompiledArtifact2(
|
|
32593
|
-
|
|
32619
|
+
path45.join(
|
|
32594
32620
|
resolveTargetPath(paths.rules ?? ""),
|
|
32595
|
-
`${
|
|
32621
|
+
`${path45.parse(relativePath).name}.rules`
|
|
32596
32622
|
),
|
|
32597
32623
|
"codex",
|
|
32598
32624
|
relativePath,
|
|
@@ -32631,9 +32657,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32631
32657
|
}
|
|
32632
32658
|
if (relativePath.startsWith("agents/")) {
|
|
32633
32659
|
removeManagedCompiledArtifact2(
|
|
32634
|
-
|
|
32660
|
+
path45.join(
|
|
32635
32661
|
resolveTargetPath(paths.agents ?? ""),
|
|
32636
|
-
`${
|
|
32662
|
+
`${path45.parse(relativePath).name}.md`
|
|
32637
32663
|
),
|
|
32638
32664
|
"opencode",
|
|
32639
32665
|
relativePath,
|
|
@@ -32643,9 +32669,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32643
32669
|
}
|
|
32644
32670
|
if (relativePath.startsWith("commands/")) {
|
|
32645
32671
|
removeManagedCompiledArtifact2(
|
|
32646
|
-
|
|
32672
|
+
path45.join(
|
|
32647
32673
|
resolveTargetPath(paths.commands ?? ""),
|
|
32648
|
-
`${
|
|
32674
|
+
`${path45.parse(relativePath).name}.md`
|
|
32649
32675
|
),
|
|
32650
32676
|
"opencode",
|
|
32651
32677
|
relativePath,
|
|
@@ -32677,9 +32703,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32677
32703
|
}
|
|
32678
32704
|
if (relativePath.startsWith("agents/")) {
|
|
32679
32705
|
removeManagedCompiledArtifact2(
|
|
32680
|
-
|
|
32706
|
+
path45.join(
|
|
32681
32707
|
resolveTargetPath(paths.agents ?? ""),
|
|
32682
|
-
`${
|
|
32708
|
+
`${path45.parse(relativePath).name}.md`
|
|
32683
32709
|
),
|
|
32684
32710
|
"cursor",
|
|
32685
32711
|
relativePath,
|
|
@@ -32689,9 +32715,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32689
32715
|
}
|
|
32690
32716
|
if (relativePath.startsWith("rules/")) {
|
|
32691
32717
|
removeManagedCompiledArtifact2(
|
|
32692
|
-
|
|
32718
|
+
path45.join(
|
|
32693
32719
|
resolveTargetPath(paths.rules ?? ""),
|
|
32694
|
-
`${
|
|
32720
|
+
`${path45.parse(relativePath).name}.mdc`
|
|
32695
32721
|
),
|
|
32696
32722
|
"cursor",
|
|
32697
32723
|
relativePath,
|
|
@@ -32701,9 +32727,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32701
32727
|
}
|
|
32702
32728
|
if (relativePath.startsWith("commands/")) {
|
|
32703
32729
|
removeManagedCompiledArtifact2(
|
|
32704
|
-
|
|
32730
|
+
path45.join(
|
|
32705
32731
|
resolveTargetPath(paths.skills ?? ""),
|
|
32706
|
-
|
|
32732
|
+
path45.parse(relativePath).name,
|
|
32707
32733
|
"SKILL.md"
|
|
32708
32734
|
),
|
|
32709
32735
|
"cursor",
|
|
@@ -32747,9 +32773,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32747
32773
|
}
|
|
32748
32774
|
if (relativePath.startsWith("rules/")) {
|
|
32749
32775
|
removeManagedCompiledArtifact2(
|
|
32750
|
-
|
|
32776
|
+
path45.join(
|
|
32751
32777
|
resolveTargetPath(paths.rules ?? ""),
|
|
32752
|
-
`${
|
|
32778
|
+
`${path45.parse(relativePath).name}.md`
|
|
32753
32779
|
),
|
|
32754
32780
|
"cline",
|
|
32755
32781
|
relativePath,
|
|
@@ -32759,9 +32785,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32759
32785
|
}
|
|
32760
32786
|
if (relativePath.startsWith("commands/")) {
|
|
32761
32787
|
removeManagedCompiledArtifact2(
|
|
32762
|
-
|
|
32788
|
+
path45.join(
|
|
32763
32789
|
resolveTargetPath(paths.workflows ?? ""),
|
|
32764
|
-
|
|
32790
|
+
path45.basename(relativePath)
|
|
32765
32791
|
),
|
|
32766
32792
|
"cline",
|
|
32767
32793
|
relativePath,
|
|
@@ -32930,7 +32956,7 @@ function removeManagedHookEntries(value, expectedSource) {
|
|
|
32930
32956
|
|
|
32931
32957
|
// src/commands/validate.ts
|
|
32932
32958
|
import fs44 from "fs";
|
|
32933
|
-
import
|
|
32959
|
+
import path46 from "path";
|
|
32934
32960
|
var SUPPORTED_KIT_FORMATS2 = [1];
|
|
32935
32961
|
var SUPPORTED_DISCIPLINE_VERSIONS = [
|
|
32936
32962
|
"0.14.0",
|
|
@@ -33024,7 +33050,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33024
33050
|
const notices = [];
|
|
33025
33051
|
const canonical = new Set(CANONICAL_SKILL_SUBFOLDERS);
|
|
33026
33052
|
for (const name of kit.components.skills.declared) {
|
|
33027
|
-
const skillDir =
|
|
33053
|
+
const skillDir = path46.join(kit.path, "skills", name);
|
|
33028
33054
|
let entries;
|
|
33029
33055
|
try {
|
|
33030
33056
|
entries = fs44.readdirSync(skillDir, { withFileTypes: true });
|
|
@@ -33045,7 +33071,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33045
33071
|
return notices;
|
|
33046
33072
|
}
|
|
33047
33073
|
function checkHooksSourceForm(kit) {
|
|
33048
|
-
const hooksDir =
|
|
33074
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33049
33075
|
const message = describeHooksSourceConflict(
|
|
33050
33076
|
hooksDir,
|
|
33051
33077
|
kit.components.hooks.declared
|
|
@@ -33057,12 +33083,12 @@ function checkHooksSourceForm(kit) {
|
|
|
33057
33083
|
} : null;
|
|
33058
33084
|
}
|
|
33059
33085
|
function checkHookDeclarations(kit) {
|
|
33060
|
-
const hooksDir =
|
|
33086
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33061
33087
|
return collectHookRejections(hooksDir, kit.components.hooks.declared).map(
|
|
33062
33088
|
(r) => ({
|
|
33063
33089
|
code: "hook-declaration-invalid",
|
|
33064
|
-
location: `hooks/${
|
|
33065
|
-
message: `hooks: '${
|
|
33090
|
+
location: `hooks/${path46.basename(r.file)}`,
|
|
33091
|
+
message: `hooks: '${path46.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.`
|
|
33066
33092
|
})
|
|
33067
33093
|
);
|
|
33068
33094
|
}
|
|
@@ -33082,11 +33108,11 @@ function checkKitFormatSupported(kit) {
|
|
|
33082
33108
|
function checkEntrypointExists(kit) {
|
|
33083
33109
|
const declared = kit.entrypoint;
|
|
33084
33110
|
const entrypoint = declared ?? DEFAULT_ENTRYPOINT;
|
|
33085
|
-
const entrypointPath =
|
|
33111
|
+
const entrypointPath = path46.join(kit.path, entrypoint);
|
|
33086
33112
|
if (fs44.existsSync(entrypointPath)) {
|
|
33087
33113
|
return null;
|
|
33088
33114
|
}
|
|
33089
|
-
const legacyPresent = declared === void 0 && fs44.existsSync(
|
|
33115
|
+
const legacyPresent = declared === void 0 && fs44.existsSync(path46.join(kit.path, LEGACY_ENTRYPOINT));
|
|
33090
33116
|
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.`;
|
|
33091
33117
|
return {
|
|
33092
33118
|
code: "entrypoint-missing",
|
|
@@ -33142,9 +33168,9 @@ function checkComponentFrontmatter(kit) {
|
|
|
33142
33168
|
const missingSet = new Set(kit.components[cat].missing);
|
|
33143
33169
|
for (const name of kit.components[cat].declared) {
|
|
33144
33170
|
if (missingSet.has(name)) continue;
|
|
33145
|
-
const filePath = cat === "skills" ?
|
|
33171
|
+
const filePath = cat === "skills" ? path46.join(kit.path, cat, name, "SKILL.md") : path46.join(kit.path, cat, `${name}.md`);
|
|
33146
33172
|
if (!fs44.existsSync(filePath)) continue;
|
|
33147
|
-
const relPath =
|
|
33173
|
+
const relPath = path46.relative(kit.path, filePath);
|
|
33148
33174
|
try {
|
|
33149
33175
|
const { data } = parseMarkdownFrontmatter(filePath);
|
|
33150
33176
|
for (const field of requiredFields) {
|
|
@@ -33189,7 +33215,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33189
33215
|
const missingSet = new Set(kit.components.commands.missing);
|
|
33190
33216
|
for (const name of kit.components.commands.declared) {
|
|
33191
33217
|
if (missingSet.has(name)) continue;
|
|
33192
|
-
const filePath =
|
|
33218
|
+
const filePath = path46.join(kit.path, "commands", `${name}.md`);
|
|
33193
33219
|
if (!fs44.existsSync(filePath)) continue;
|
|
33194
33220
|
let data;
|
|
33195
33221
|
try {
|
|
@@ -33203,7 +33229,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33203
33229
|
if (!barred) {
|
|
33204
33230
|
violations.push({
|
|
33205
33231
|
code: "command-human-only-model-invocable",
|
|
33206
|
-
location:
|
|
33232
|
+
location: path46.relative(kit.path, filePath),
|
|
33207
33233
|
message: "commands: 'launch: human-only' requires 'disable-model-invocation: true' so the model cannot start the command; only a Human-typed launch may"
|
|
33208
33234
|
});
|
|
33209
33235
|
}
|
|
@@ -33213,7 +33239,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33213
33239
|
|
|
33214
33240
|
// src/commands/verify.ts
|
|
33215
33241
|
import fs45 from "fs";
|
|
33216
|
-
import
|
|
33242
|
+
import path47 from "path";
|
|
33217
33243
|
function runVerifyCommand(options, logger) {
|
|
33218
33244
|
const { config, configDir, sourceRoot, kitInfo } = resolveRuntime(
|
|
33219
33245
|
options,
|
|
@@ -33304,7 +33330,7 @@ function verifyClaudeCodeGlobalRoots(roots, manifestKeys, mappings) {
|
|
|
33304
33330
|
if (!slotPath) {
|
|
33305
33331
|
continue;
|
|
33306
33332
|
}
|
|
33307
|
-
const fullPath = subPath ?
|
|
33333
|
+
const fullPath = subPath ? path47.join(slotPath, subPath) : slotPath;
|
|
33308
33334
|
if (!fs45.existsSync(fullPath)) {
|
|
33309
33335
|
failures.push(
|
|
33310
33336
|
`claude-code/${slot}${subPath ? `/${subPath}` : ""} missing in root ${root}: ${fullPath}`
|