@alessandroraffa/tangyr 0.21.1 → 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 +556 -512
- package/mappings/hook-events.yaml +40 -60
- 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) {
|
|
@@ -25741,8 +25761,8 @@ function compileCursorHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25741
25761
|
sourceEvent
|
|
25742
25762
|
);
|
|
25743
25763
|
if (mapping.status === "mapped" && mapping.target_event) {
|
|
25744
|
-
const
|
|
25745
|
-
if (
|
|
25764
|
+
const entries = extractHookCommands(payload);
|
|
25765
|
+
if (entries.length === 0) {
|
|
25746
25766
|
droppedEvents.push(sourceEvent);
|
|
25747
25767
|
addHookLoss(
|
|
25748
25768
|
lossReport,
|
|
@@ -25755,26 +25775,24 @@ function compileCursorHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25755
25775
|
dropped += 1;
|
|
25756
25776
|
continue;
|
|
25757
25777
|
}
|
|
25758
|
-
|
|
25778
|
+
const untranslatable = /* @__PURE__ */ new Set();
|
|
25779
|
+
hooks[mapping.target_event] = entries.map((entry) => {
|
|
25780
|
+
const matcher = entry.matcher === void 0 ? void 0 : translateCursorMatcher(entry.matcher, untranslatable);
|
|
25781
|
+
return {
|
|
25782
|
+
type: "command",
|
|
25783
|
+
command: entry.command,
|
|
25784
|
+
...matcher !== void 0 ? { matcher } : {}
|
|
25785
|
+
};
|
|
25786
|
+
});
|
|
25759
25787
|
translated += 1;
|
|
25760
|
-
if (
|
|
25761
|
-
addHookLoss(
|
|
25762
|
-
lossReport,
|
|
25763
|
-
"cursor",
|
|
25764
|
-
sourceEvent,
|
|
25765
|
-
sourceLabel,
|
|
25766
|
-
"error",
|
|
25767
|
-
`${sourceEvent}: the source registers ${extracted.remaining.length + 1} hooks on this event and Cursor's entry holds one command. Only '${extracted.command}' was written; ${extracted.remaining.map((c) => `'${c}'`).join(", ")} ${extracted.remaining.length === 1 ? "does" : "do"} not run under Cursor. To fix: give this event a single entry point that dispatches to the others, or accept the loss knowingly.`
|
|
25768
|
-
);
|
|
25769
|
-
}
|
|
25770
|
-
if (extracted.matcher) {
|
|
25788
|
+
if (untranslatable.size > 0) {
|
|
25771
25789
|
addInformational(
|
|
25772
25790
|
lossReport,
|
|
25773
25791
|
"cursor",
|
|
25774
25792
|
"hooks",
|
|
25775
25793
|
sourceLabel,
|
|
25776
25794
|
"warning",
|
|
25777
|
-
`${sourceEvent}:
|
|
25795
|
+
`${sourceEvent}: ${[...untranslatable].map((m) => `'${m}'`).join(", ")} ${untranslatable.size === 1 ? "names a tool" : "name tools"} with no known Cursor equivalent and ${untranslatable.size === 1 ? "was" : "were"} written through unchanged. Cursor matches on its own tool names \u2014 measured: Shell, Read, Write, Grep \u2014 so a hook scoped to a name it does not use will not run. To fix: add the name to CURSOR_TOOL_NAMES in the compiler once its Cursor equivalent has been measured.`
|
|
25778
25796
|
);
|
|
25779
25797
|
}
|
|
25780
25798
|
continue;
|
|
@@ -25932,7 +25950,35 @@ function compileCopilotHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25932
25950
|
}
|
|
25933
25951
|
return { payload: { hooks }, translated, dropped, droppedEvents };
|
|
25934
25952
|
}
|
|
25935
|
-
|
|
25953
|
+
var CURSOR_TOOL_NAMES = {
|
|
25954
|
+
Bash: "Shell",
|
|
25955
|
+
Edit: "Write",
|
|
25956
|
+
MultiEdit: "Write",
|
|
25957
|
+
// Cursor's own names map to themselves. Without these a kit that already
|
|
25958
|
+
// writes a Cursor matcher — the natural thing to do once this mapping is
|
|
25959
|
+
// documented — would have it reported as untranslatable and warned about,
|
|
25960
|
+
// while it is in fact the only spelling that works.
|
|
25961
|
+
Shell: "Shell",
|
|
25962
|
+
Read: "Read",
|
|
25963
|
+
Write: "Write",
|
|
25964
|
+
Grep: "Grep"
|
|
25965
|
+
};
|
|
25966
|
+
function translateCursorMatcher(matcher, untranslatable) {
|
|
25967
|
+
const translated = [];
|
|
25968
|
+
for (const token of matcher.split("|")) {
|
|
25969
|
+
const trimmed = token.trim();
|
|
25970
|
+
if (!trimmed) continue;
|
|
25971
|
+
const mapped = CURSOR_TOOL_NAMES[trimmed];
|
|
25972
|
+
if (mapped === void 0) {
|
|
25973
|
+
untranslatable.add(trimmed);
|
|
25974
|
+
if (!translated.includes(trimmed)) translated.push(trimmed);
|
|
25975
|
+
continue;
|
|
25976
|
+
}
|
|
25977
|
+
if (!translated.includes(mapped)) translated.push(mapped);
|
|
25978
|
+
}
|
|
25979
|
+
return translated.join("|");
|
|
25980
|
+
}
|
|
25981
|
+
function extractHookCommands(payload) {
|
|
25936
25982
|
const entries = Array.isArray(payload) ? payload : [payload];
|
|
25937
25983
|
const found = [];
|
|
25938
25984
|
for (const entry of entries) {
|
|
@@ -25949,15 +25995,7 @@ function extractHookCommand(payload) {
|
|
|
25949
25995
|
}
|
|
25950
25996
|
}
|
|
25951
25997
|
}
|
|
25952
|
-
|
|
25953
|
-
return { command: "", remaining: [] };
|
|
25954
|
-
}
|
|
25955
|
-
const [first, ...rest] = found;
|
|
25956
|
-
return {
|
|
25957
|
-
command: first.command,
|
|
25958
|
-
...first.matcher !== void 0 ? { matcher: first.matcher } : {},
|
|
25959
|
-
remaining: rest.map((r) => r.command)
|
|
25960
|
-
};
|
|
25998
|
+
return found;
|
|
25961
25999
|
}
|
|
25962
26000
|
function normalizeHookEventRule(value, target, sourceEvent) {
|
|
25963
26001
|
if (typeof value === "string") {
|
|
@@ -26039,23 +26077,23 @@ function addHookLoss(lossReport, target, eventName, sourceLabel, severity, reaso
|
|
|
26039
26077
|
}
|
|
26040
26078
|
|
|
26041
26079
|
// src/core/hook-scripts.ts
|
|
26042
|
-
import
|
|
26080
|
+
import path32 from "path";
|
|
26043
26081
|
function hookScriptsDir(bridge, target) {
|
|
26044
26082
|
const globalBridge = resolveTargetPath("~/.agents/hooks");
|
|
26045
|
-
if (
|
|
26083
|
+
if (path32.resolve(bridge) === path32.resolve(globalBridge)) {
|
|
26046
26084
|
return { prefix: GLOBAL_HOOK_SCRIPTS_DIR, machineLocal: false };
|
|
26047
26085
|
}
|
|
26048
|
-
const relative =
|
|
26049
|
-
const insideProject = !relative.startsWith("..") && !
|
|
26086
|
+
const relative = path32.relative(process.cwd(), bridge);
|
|
26087
|
+
const insideProject = !relative.startsWith("..") && !path32.isAbsolute(relative) && relative !== "";
|
|
26050
26088
|
const variable = PROJECT_DIR_VARIABLE[target];
|
|
26051
26089
|
if (insideProject && variable) {
|
|
26052
|
-
const posix =
|
|
26053
|
-
relative.split(
|
|
26090
|
+
const posix = path32.posix.join(
|
|
26091
|
+
relative.split(path32.sep).join("/"),
|
|
26054
26092
|
"scripts"
|
|
26055
26093
|
);
|
|
26056
26094
|
return { prefix: `$${variable.slice(1)}/${posix}`, machineLocal: false };
|
|
26057
26095
|
}
|
|
26058
|
-
return { prefix:
|
|
26096
|
+
return { prefix: path32.join(bridge, "scripts"), machineLocal: true };
|
|
26059
26097
|
}
|
|
26060
26098
|
var PROJECT_DIR_VARIABLE = {
|
|
26061
26099
|
"claude-code": "$CLAUDE_PROJECT_DIR"
|
|
@@ -26343,7 +26381,7 @@ function compileOpenCodeMcp(sourceMcpJson, lossReport, sourceLabel) {
|
|
|
26343
26381
|
}
|
|
26344
26382
|
|
|
26345
26383
|
// src/compiler/rules.ts
|
|
26346
|
-
import
|
|
26384
|
+
import path33 from "path";
|
|
26347
26385
|
var import_yaml9 = __toESM(require_dist(), 1);
|
|
26348
26386
|
import fs33 from "fs";
|
|
26349
26387
|
function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
@@ -26382,13 +26420,13 @@ function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
|
26382
26420
|
}
|
|
26383
26421
|
const appendixParts = [];
|
|
26384
26422
|
const dotRulesFiles = [];
|
|
26385
|
-
for (const ruleFile of ts(
|
|
26423
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26386
26424
|
const parsed = parseRule(ruleFile);
|
|
26387
|
-
const name =
|
|
26425
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26388
26426
|
if (parsed.mode === "exec-policy") {
|
|
26389
26427
|
dotRulesFiles.push({
|
|
26390
26428
|
name: `${name}.rules`,
|
|
26391
|
-
content: `${formatProvenanceMarker("toml", `rules/${
|
|
26429
|
+
content: `${formatProvenanceMarker("toml", `rules/${path33.basename(ruleFile)}`, computeSourceHash(ruleFile), "codex")}
|
|
26392
26430
|
${parsed.body}`
|
|
26393
26431
|
});
|
|
26394
26432
|
continue;
|
|
@@ -26397,7 +26435,7 @@ ${parsed.body}`
|
|
|
26397
26435
|
|
|
26398
26436
|
${parsed.body.trim()}`);
|
|
26399
26437
|
addLoss(lossReport, "codex", "rules", {
|
|
26400
|
-
source: `rules/${
|
|
26438
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26401
26439
|
fields: [
|
|
26402
26440
|
{
|
|
26403
26441
|
field: "mode",
|
|
@@ -26407,7 +26445,7 @@ ${parsed.body.trim()}`);
|
|
|
26407
26445
|
"mode",
|
|
26408
26446
|
"rule-as-instruction"
|
|
26409
26447
|
),
|
|
26410
|
-
detail: `${
|
|
26448
|
+
detail: `${path33.basename(ruleFile)} is appended to the managed Codex instructions file as guidance.`
|
|
26411
26449
|
}
|
|
26412
26450
|
]
|
|
26413
26451
|
});
|
|
@@ -26439,14 +26477,14 @@ function isRuleMode(value) {
|
|
|
26439
26477
|
}
|
|
26440
26478
|
function compileOpenCodeRules(sourceRulesDir, lossReport) {
|
|
26441
26479
|
const appendixParts = [];
|
|
26442
|
-
for (const ruleFile of ts(
|
|
26480
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26443
26481
|
const parsed = parseRule(ruleFile);
|
|
26444
|
-
const name =
|
|
26482
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26445
26483
|
appendixParts.push(`## ${name}
|
|
26446
26484
|
|
|
26447
26485
|
${parsed.body.trim()}`);
|
|
26448
26486
|
addLoss(lossReport, "opencode", "rules", {
|
|
26449
|
-
source: `rules/${
|
|
26487
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26450
26488
|
fields: [
|
|
26451
26489
|
{
|
|
26452
26490
|
field: "rule",
|
|
@@ -26456,7 +26494,7 @@ ${parsed.body.trim()}`);
|
|
|
26456
26494
|
"rule",
|
|
26457
26495
|
"rule-path-scoping"
|
|
26458
26496
|
),
|
|
26459
|
-
detail: `${
|
|
26497
|
+
detail: `${path33.basename(ruleFile)}: OpenCode has no per-agent rule scoping \u2014 rule appended to AGENTS.md instructions`
|
|
26460
26498
|
}
|
|
26461
26499
|
]
|
|
26462
26500
|
});
|
|
@@ -26465,9 +26503,9 @@ ${parsed.body.trim()}`);
|
|
|
26465
26503
|
}
|
|
26466
26504
|
function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
26467
26505
|
const dotRulesFiles = [];
|
|
26468
|
-
for (const ruleFile of ts(
|
|
26506
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26469
26507
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26470
|
-
const name =
|
|
26508
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26471
26509
|
let frontmatterData = {};
|
|
26472
26510
|
let body = content;
|
|
26473
26511
|
if (content.startsWith("---\n")) {
|
|
@@ -26496,7 +26534,7 @@ function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
|
26496
26534
|
}
|
|
26497
26535
|
const marker = formatProvenanceMarker(
|
|
26498
26536
|
"markdown",
|
|
26499
|
-
`rules/${
|
|
26537
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26500
26538
|
computeSourceHash(ruleFile),
|
|
26501
26539
|
"cursor"
|
|
26502
26540
|
);
|
|
@@ -26512,9 +26550,9 @@ ${body}`;
|
|
|
26512
26550
|
}
|
|
26513
26551
|
function compileClineRules(sourceRulesDir, lossReport) {
|
|
26514
26552
|
const dotRulesFiles = [];
|
|
26515
|
-
for (const ruleFile of ts(
|
|
26553
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26516
26554
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26517
|
-
const name =
|
|
26555
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26518
26556
|
let frontmatterData = {};
|
|
26519
26557
|
let body = content;
|
|
26520
26558
|
if (content.startsWith("---\n")) {
|
|
@@ -26531,13 +26569,13 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26531
26569
|
}
|
|
26532
26570
|
const marker = formatProvenanceMarker(
|
|
26533
26571
|
"markdown",
|
|
26534
|
-
`rules/${
|
|
26572
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26535
26573
|
computeSourceHash(ruleFile),
|
|
26536
26574
|
"cline"
|
|
26537
26575
|
);
|
|
26538
26576
|
if (frontmatterData.mode === "exec-policy") {
|
|
26539
26577
|
addLoss(lossReport, "cline", "rules", {
|
|
26540
|
-
source: `rules/${
|
|
26578
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26541
26579
|
fields: [
|
|
26542
26580
|
{
|
|
26543
26581
|
field: "mode",
|
|
@@ -26547,7 +26585,7 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26547
26585
|
"mode",
|
|
26548
26586
|
"rule-mode-downgrade"
|
|
26549
26587
|
),
|
|
26550
|
-
detail: `${
|
|
26588
|
+
detail: `${path33.basename(ruleFile)}: Cline rules have no exec-policy mode; rule emitted as guidance.`
|
|
26551
26589
|
}
|
|
26552
26590
|
]
|
|
26553
26591
|
});
|
|
@@ -26593,7 +26631,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26593
26631
|
rules: profile.rules
|
|
26594
26632
|
};
|
|
26595
26633
|
const rules = compileRules(
|
|
26596
|
-
|
|
26634
|
+
path34.join(sourceRoot, config.source.rules),
|
|
26597
26635
|
"codex",
|
|
26598
26636
|
mappings,
|
|
26599
26637
|
lossReport
|
|
@@ -26659,7 +26697,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26659
26697
|
if (!shouldSkipComponent(options, "hooks")) {
|
|
26660
26698
|
outcomes.push(
|
|
26661
26699
|
syncHookScriptsBridge({
|
|
26662
|
-
source:
|
|
26700
|
+
source: path34.resolve(sourceRoot, config.source.hooks),
|
|
26663
26701
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
26664
26702
|
config,
|
|
26665
26703
|
sourceRoot,
|
|
@@ -26758,9 +26796,9 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26758
26796
|
function buildProviderTomlSection(config, sourceRoot, mappings, scope, lossReport) {
|
|
26759
26797
|
const cp = mappings.modelTiers.custom_provider;
|
|
26760
26798
|
if (!cp) return "";
|
|
26761
|
-
const agentsDir =
|
|
26799
|
+
const agentsDir = path34.join(sourceRoot, config.source.agents);
|
|
26762
26800
|
if (!fs34.existsSync(agentsDir)) return "";
|
|
26763
|
-
const agentFiles = ts(
|
|
26801
|
+
const agentFiles = ts(path34.join(agentsDir, "*.md")).sort();
|
|
26764
26802
|
const hasProviderAgent = agentFiles.some((agentFile) => {
|
|
26765
26803
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
26766
26804
|
return typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
@@ -26825,7 +26863,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26825
26863
|
}
|
|
26826
26864
|
];
|
|
26827
26865
|
for (const ruleFile of rules.dotRulesFiles) {
|
|
26828
|
-
const destination =
|
|
26866
|
+
const destination = path34.join(rulesRoot, ruleFile.name);
|
|
26829
26867
|
if (options.dryRun) {
|
|
26830
26868
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
26831
26869
|
outcomes.push({
|
|
@@ -26853,7 +26891,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26853
26891
|
return outcomes;
|
|
26854
26892
|
}
|
|
26855
26893
|
function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
26856
|
-
const source =
|
|
26894
|
+
const source = path34.join(sourceRoot, config.source.instructions);
|
|
26857
26895
|
const destination = resolveTargetPath(paths.instructions);
|
|
26858
26896
|
const composed = `${fs34.readFileSync(source, "utf8").trim()}
|
|
26859
26897
|
|
|
@@ -26861,7 +26899,7 @@ function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, lo
|
|
|
26861
26899
|
${agentsAppendix}`.trim();
|
|
26862
26900
|
const marker = formatProvenanceMarker(
|
|
26863
26901
|
"markdown",
|
|
26864
|
-
|
|
26902
|
+
path34.basename(config.source.instructions),
|
|
26865
26903
|
hashString(composed),
|
|
26866
26904
|
"codex"
|
|
26867
26905
|
);
|
|
@@ -26888,7 +26926,7 @@ ${composed}
|
|
|
26888
26926
|
);
|
|
26889
26927
|
}
|
|
26890
26928
|
function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
26891
|
-
const source =
|
|
26929
|
+
const source = path34.resolve(sourceRoot, config.source.skills);
|
|
26892
26930
|
const destination = resolveTargetPath(paths.skills);
|
|
26893
26931
|
if (!fs34.existsSync(source)) {
|
|
26894
26932
|
return skippedMissingSource("skills", source);
|
|
@@ -26913,22 +26951,22 @@ function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopeP
|
|
|
26913
26951
|
} else if (artifactClass === "managed-symlink") {
|
|
26914
26952
|
fs34.unlinkSync(destination);
|
|
26915
26953
|
}
|
|
26916
|
-
ensureDir(
|
|
26954
|
+
ensureDir(path34.dirname(destination));
|
|
26917
26955
|
createRelativeSymlink(source, destination, "dir");
|
|
26918
26956
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
26919
26957
|
return { component: "skills", status: "success", path: destination };
|
|
26920
26958
|
}
|
|
26921
26959
|
function syncAgents(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
26922
|
-
const sourceAgentsRoot =
|
|
26960
|
+
const sourceAgentsRoot = path34.join(sourceRoot, config.source.agents);
|
|
26923
26961
|
if (!fs34.existsSync(sourceAgentsRoot)) {
|
|
26924
26962
|
return [skippedMissingSource("agents", sourceAgentsRoot)];
|
|
26925
26963
|
}
|
|
26926
|
-
const sourceAgents = ts(
|
|
26964
|
+
const sourceAgents = ts(path34.join(sourceAgentsRoot, "*.md")).sort();
|
|
26927
26965
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
26928
26966
|
return sourceAgents.map((agentFile) => {
|
|
26929
|
-
const destination =
|
|
26967
|
+
const destination = path34.join(
|
|
26930
26968
|
agentsRoot,
|
|
26931
|
-
`${
|
|
26969
|
+
`${path34.basename(agentFile, ".md")}.toml`
|
|
26932
26970
|
);
|
|
26933
26971
|
const compiled = compileAgent(
|
|
26934
26972
|
agentFile,
|
|
@@ -27055,7 +27093,7 @@ function writeCompiledArtifact(component, destination, content, expectedHash, co
|
|
|
27055
27093
|
if (artifactClass === "unmanaged-conflict" && !handleConflict(destination, config, options, logger, manifest, scopePath)) {
|
|
27056
27094
|
return { component, status: "conflict", path: destination };
|
|
27057
27095
|
}
|
|
27058
|
-
ensureDir(
|
|
27096
|
+
ensureDir(path34.dirname(destination));
|
|
27059
27097
|
fs34.writeFileSync(destination, content);
|
|
27060
27098
|
return { component, status: "success", path: destination };
|
|
27061
27099
|
}
|
|
@@ -27076,7 +27114,7 @@ ${managedMcpEnd}
|
|
|
27076
27114
|
if (current === next.trimStart()) {
|
|
27077
27115
|
return false;
|
|
27078
27116
|
}
|
|
27079
|
-
ensureDir(
|
|
27117
|
+
ensureDir(path34.dirname(destination));
|
|
27080
27118
|
fs34.writeFileSync(destination, next.trimStart());
|
|
27081
27119
|
return true;
|
|
27082
27120
|
}
|
|
@@ -27158,15 +27196,15 @@ function hashString(value) {
|
|
|
27158
27196
|
// src/adapters/copilot.ts
|
|
27159
27197
|
import crypto6 from "crypto";
|
|
27160
27198
|
import fs35 from "fs";
|
|
27161
|
-
import
|
|
27199
|
+
import path36 from "path";
|
|
27162
27200
|
|
|
27163
27201
|
// src/compiler/commands.ts
|
|
27164
27202
|
var import_yaml10 = __toESM(require_dist(), 1);
|
|
27165
|
-
import
|
|
27203
|
+
import path35 from "path";
|
|
27166
27204
|
function compileCommandPrompt(sourceFile) {
|
|
27167
27205
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
27168
|
-
const relativeSource = `commands/${
|
|
27169
|
-
const fields = promptFrontmatter(data,
|
|
27206
|
+
const relativeSource = `commands/${path35.basename(sourceFile)}`;
|
|
27207
|
+
const fields = promptFrontmatter(data, path35.basename(sourceFile, ".md"));
|
|
27170
27208
|
const marker = formatProvenanceMarker(
|
|
27171
27209
|
"markdown",
|
|
27172
27210
|
relativeSource,
|
|
@@ -27281,7 +27319,7 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27281
27319
|
if (!shouldSkipComponent2(options, "hooks")) {
|
|
27282
27320
|
outcomes.push(
|
|
27283
27321
|
syncHookScriptsBridge({
|
|
27284
|
-
source:
|
|
27322
|
+
source: path36.resolve(sourceRoot, config.source.hooks),
|
|
27285
27323
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27286
27324
|
config,
|
|
27287
27325
|
sourceRoot,
|
|
@@ -27362,13 +27400,13 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27362
27400
|
}
|
|
27363
27401
|
function syncProviderLoss(config, sourceRoot, mappings, lossReport) {
|
|
27364
27402
|
if (!mappings.modelTiers.custom_provider) return;
|
|
27365
|
-
const agentsDir =
|
|
27403
|
+
const agentsDir = path36.join(sourceRoot, config.source.agents);
|
|
27366
27404
|
if (!fs35.existsSync(agentsDir)) return;
|
|
27367
|
-
for (const agentFile of ts(
|
|
27405
|
+
for (const agentFile of ts(path36.join(agentsDir, "*.md")).sort()) {
|
|
27368
27406
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
27369
27407
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
27370
27408
|
if (hasProvider) {
|
|
27371
|
-
const basename =
|
|
27409
|
+
const basename = path36.basename(agentFile);
|
|
27372
27410
|
addLoss(lossReport, "copilot", "agents", {
|
|
27373
27411
|
source: `agents/${basename}`,
|
|
27374
27412
|
fields: [
|
|
@@ -27393,7 +27431,7 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27393
27431
|
logger.verbose(message);
|
|
27394
27432
|
return [{ component: "instructions", status: "skipped", path: message }];
|
|
27395
27433
|
}
|
|
27396
|
-
const source =
|
|
27434
|
+
const source = path36.resolve(sourceRoot, config.source.instructions);
|
|
27397
27435
|
if (!fs35.existsSync(source)) {
|
|
27398
27436
|
return [skippedMissingSource2("instructions", source)];
|
|
27399
27437
|
}
|
|
@@ -27401,15 +27439,15 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27401
27439
|
const contentHash = hashString2(rawContent);
|
|
27402
27440
|
const marker = formatProvenanceMarker(
|
|
27403
27441
|
"markdown",
|
|
27404
|
-
|
|
27442
|
+
path36.basename(config.source.instructions),
|
|
27405
27443
|
contentHash,
|
|
27406
27444
|
"copilot"
|
|
27407
27445
|
);
|
|
27408
27446
|
const composedContent = `${marker}
|
|
27409
27447
|
${rawContent}`;
|
|
27410
27448
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
27411
|
-
const agentsMdDest =
|
|
27412
|
-
const mirrorDest =
|
|
27449
|
+
const agentsMdDest = path36.resolve(projectRoot, "AGENTS.md");
|
|
27450
|
+
const mirrorDest = path36.resolve(
|
|
27413
27451
|
projectRoot,
|
|
27414
27452
|
".github",
|
|
27415
27453
|
"copilot-instructions.md"
|
|
@@ -27463,7 +27501,7 @@ function writeInstructionsFile(component, destination, content, contentHash, con
|
|
|
27463
27501
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27464
27502
|
return { component, status: "conflict", path: destination };
|
|
27465
27503
|
}
|
|
27466
|
-
ensureDir(
|
|
27504
|
+
ensureDir(path36.dirname(destination));
|
|
27467
27505
|
fs35.writeFileSync(destination, content);
|
|
27468
27506
|
return { component, status: "success", path: destination };
|
|
27469
27507
|
}
|
|
@@ -27471,7 +27509,7 @@ function hashString2(value) {
|
|
|
27471
27509
|
return `sha256:${crypto6.createHash("sha256").update(value).digest("hex")}`;
|
|
27472
27510
|
}
|
|
27473
27511
|
function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27474
|
-
const source =
|
|
27512
|
+
const source = path36.resolve(sourceRoot, config.source.skills);
|
|
27475
27513
|
const destination = resolveTargetPath(paths.skills);
|
|
27476
27514
|
if (!fs35.existsSync(source)) {
|
|
27477
27515
|
return skippedMissingSource2("skills", source);
|
|
@@ -27495,21 +27533,21 @@ function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
27495
27533
|
} else if (artifactClass === "managed-symlink") {
|
|
27496
27534
|
fs35.unlinkSync(destination);
|
|
27497
27535
|
}
|
|
27498
|
-
ensureDir(
|
|
27536
|
+
ensureDir(path36.dirname(destination));
|
|
27499
27537
|
createRelativeSymlink(source, destination, "dir");
|
|
27500
27538
|
return { component: "skills", status: "success", path: destination };
|
|
27501
27539
|
}
|
|
27502
27540
|
function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27503
|
-
const sourceAgentsRoot =
|
|
27541
|
+
const sourceAgentsRoot = path36.join(sourceRoot, config.source.agents);
|
|
27504
27542
|
if (!fs35.existsSync(sourceAgentsRoot)) {
|
|
27505
27543
|
return [skippedMissingSource2("agents", sourceAgentsRoot)];
|
|
27506
27544
|
}
|
|
27507
|
-
const sourceAgents = ts(
|
|
27545
|
+
const sourceAgents = ts(path36.join(sourceAgentsRoot, "*.md")).sort();
|
|
27508
27546
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
27509
27547
|
return sourceAgents.map((agentFile) => {
|
|
27510
|
-
const destination =
|
|
27548
|
+
const destination = path36.join(
|
|
27511
27549
|
agentsRoot,
|
|
27512
|
-
`${
|
|
27550
|
+
`${path36.basename(agentFile, ".md")}.agent.md`
|
|
27513
27551
|
);
|
|
27514
27552
|
const compiled = compileAgent(
|
|
27515
27553
|
agentFile,
|
|
@@ -27537,16 +27575,16 @@ function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
27537
27575
|
});
|
|
27538
27576
|
}
|
|
27539
27577
|
function syncCommands(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27540
|
-
const sourceCommandsRoot =
|
|
27578
|
+
const sourceCommandsRoot = path36.join(sourceRoot, config.source.commands);
|
|
27541
27579
|
if (!fs35.existsSync(sourceCommandsRoot)) {
|
|
27542
27580
|
return [skippedMissingSource2("commands", sourceCommandsRoot)];
|
|
27543
27581
|
}
|
|
27544
|
-
const sourceCommands = ts(
|
|
27582
|
+
const sourceCommands = ts(path36.join(sourceCommandsRoot, "*.md")).sort();
|
|
27545
27583
|
const promptsRoot = resolveTargetPath(paths.prompts);
|
|
27546
27584
|
return sourceCommands.map((commandFile) => {
|
|
27547
|
-
const destination =
|
|
27585
|
+
const destination = path36.join(
|
|
27548
27586
|
promptsRoot,
|
|
27549
|
-
`${
|
|
27587
|
+
`${path36.basename(commandFile, ".md")}.prompt.md`
|
|
27550
27588
|
);
|
|
27551
27589
|
const compiled = compileCommandPrompt(commandFile);
|
|
27552
27590
|
if (options.dryRun) {
|
|
@@ -27570,7 +27608,7 @@ function syncCommands(config, sourceRoot, paths, options, logger, manifest, scop
|
|
|
27570
27608
|
});
|
|
27571
27609
|
}
|
|
27572
27610
|
function syncHooks2(config, sourceRoot, paths, mappings, options, lossReport, logger) {
|
|
27573
|
-
const destination =
|
|
27611
|
+
const destination = path36.join(
|
|
27574
27612
|
resolveTargetPath(paths.hooks),
|
|
27575
27613
|
"tangyr-managed.json"
|
|
27576
27614
|
);
|
|
@@ -27665,7 +27703,7 @@ function writeCompiledArtifact2(component, destination, content, expectedHash, c
|
|
|
27665
27703
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27666
27704
|
return { component, status: "conflict", path: destination };
|
|
27667
27705
|
}
|
|
27668
|
-
ensureDir(
|
|
27706
|
+
ensureDir(path36.dirname(destination));
|
|
27669
27707
|
fs35.writeFileSync(destination, content);
|
|
27670
27708
|
return { component, status: "success", path: destination };
|
|
27671
27709
|
}
|
|
@@ -27707,12 +27745,12 @@ function shouldSkipComponent2(options, component) {
|
|
|
27707
27745
|
function cleanupLegacyAgents(paths, options, logger) {
|
|
27708
27746
|
const currentAgentsRoot = resolveTargetPath(paths.agents);
|
|
27709
27747
|
const legacyAgentsRoot = resolveTargetPath(legacyCopilotAgentsPath);
|
|
27710
|
-
if (
|
|
27748
|
+
if (path36.resolve(currentAgentsRoot) === path36.resolve(legacyAgentsRoot)) {
|
|
27711
27749
|
return [];
|
|
27712
27750
|
}
|
|
27713
27751
|
const outcomes = [];
|
|
27714
27752
|
for (const filePath of ts(
|
|
27715
|
-
|
|
27753
|
+
path36.join(legacyAgentsRoot, "*.agent.md")
|
|
27716
27754
|
).sort()) {
|
|
27717
27755
|
if (!isCopilotManagedCompiledFile(filePath)) {
|
|
27718
27756
|
continue;
|
|
@@ -27752,7 +27790,7 @@ function isSymlinkTo3(linkPath, source) {
|
|
|
27752
27790
|
// src/adapters/cursor.ts
|
|
27753
27791
|
import crypto7 from "crypto";
|
|
27754
27792
|
import fs36 from "fs";
|
|
27755
|
-
import
|
|
27793
|
+
import path37 from "path";
|
|
27756
27794
|
function syncCursor(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27757
27795
|
const scope = options.scope ?? "global";
|
|
27758
27796
|
const profile = resolveTargetPaths({
|
|
@@ -27864,7 +27902,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27864
27902
|
if (!shouldSkipComponent3(options, "hooks")) {
|
|
27865
27903
|
outcomes.push(
|
|
27866
27904
|
syncHookScriptsBridge({
|
|
27867
|
-
source:
|
|
27905
|
+
source: path37.resolve(sourceRoot, config.source.hooks),
|
|
27868
27906
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27869
27907
|
config,
|
|
27870
27908
|
sourceRoot,
|
|
@@ -27924,7 +27962,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27924
27962
|
return { target: "cursor", outcomes };
|
|
27925
27963
|
}
|
|
27926
27964
|
function syncInstructions2(config, sourceRoot, paths, options, lossReport, logger, manifest, scopePath) {
|
|
27927
|
-
const source =
|
|
27965
|
+
const source = path37.join(sourceRoot, config.source.instructions);
|
|
27928
27966
|
const destination = resolveTargetPath(paths.instructions);
|
|
27929
27967
|
const baseContent = fs36.existsSync(source) ? fs36.readFileSync(source, "utf8").trim() : "";
|
|
27930
27968
|
const personaContent = extractPrimaryPersonaContent(
|
|
@@ -27939,7 +27977,7 @@ function syncInstructions2(config, sourceRoot, paths, options, lossReport, logge
|
|
|
27939
27977
|
${personaContent}`.trim() : baseContent;
|
|
27940
27978
|
const marker = formatProvenanceMarker(
|
|
27941
27979
|
"markdown",
|
|
27942
|
-
|
|
27980
|
+
path37.basename(config.source.instructions),
|
|
27943
27981
|
hashString3(composed),
|
|
27944
27982
|
"cursor"
|
|
27945
27983
|
);
|
|
@@ -27964,11 +28002,11 @@ ${composed}
|
|
|
27964
28002
|
);
|
|
27965
28003
|
}
|
|
27966
28004
|
function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
27967
|
-
const agentsDir =
|
|
28005
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
27968
28006
|
if (!fs36.existsSync(agentsDir)) {
|
|
27969
28007
|
return null;
|
|
27970
28008
|
}
|
|
27971
|
-
const agentFiles = ts(
|
|
28009
|
+
const agentFiles = ts(path37.join(agentsDir, "*.md")).sort();
|
|
27972
28010
|
if (agentFiles.length === 0) {
|
|
27973
28011
|
return null;
|
|
27974
28012
|
}
|
|
@@ -27991,7 +28029,7 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
27991
28029
|
return null;
|
|
27992
28030
|
}
|
|
27993
28031
|
addLoss(lossReport, "cursor", "instructions", {
|
|
27994
|
-
source: `agents/${
|
|
28032
|
+
source: `agents/${path37.basename(primaryFile)}`,
|
|
27995
28033
|
fields: [
|
|
27996
28034
|
{
|
|
27997
28035
|
field: "persona",
|
|
@@ -28001,23 +28039,23 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
28001
28039
|
"persona",
|
|
28002
28040
|
"instructions-shim"
|
|
28003
28041
|
),
|
|
28004
|
-
detail: `Primary persona from ${
|
|
28042
|
+
detail: `Primary persona from ${path37.basename(primaryFile)} folded into AGENTS.md (Cursor has no custom modes surface)`
|
|
28005
28043
|
}
|
|
28006
28044
|
]
|
|
28007
28045
|
});
|
|
28008
28046
|
return body.trim();
|
|
28009
28047
|
}
|
|
28010
28048
|
function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28011
|
-
const sourceAgentsRoot =
|
|
28049
|
+
const sourceAgentsRoot = path37.join(sourceRoot, config.source.agents);
|
|
28012
28050
|
if (!fs36.existsSync(sourceAgentsRoot)) {
|
|
28013
28051
|
return [skippedMissingSource3("agents", sourceAgentsRoot)];
|
|
28014
28052
|
}
|
|
28015
|
-
const sourceAgents = ts(
|
|
28053
|
+
const sourceAgents = ts(path37.join(sourceAgentsRoot, "*.md")).sort();
|
|
28016
28054
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
28017
28055
|
return sourceAgents.map((agentFile) => {
|
|
28018
|
-
const destination =
|
|
28056
|
+
const destination = path37.join(
|
|
28019
28057
|
agentsRoot,
|
|
28020
|
-
`${
|
|
28058
|
+
`${path37.basename(agentFile, ".md")}.md`
|
|
28021
28059
|
);
|
|
28022
28060
|
let compiled;
|
|
28023
28061
|
try {
|
|
@@ -28058,14 +28096,14 @@ function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
28058
28096
|
});
|
|
28059
28097
|
}
|
|
28060
28098
|
function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28061
|
-
const sourceRulesDir =
|
|
28099
|
+
const sourceRulesDir = path37.join(sourceRoot, config.source.rules);
|
|
28062
28100
|
if (!fs36.existsSync(sourceRulesDir)) {
|
|
28063
28101
|
return [skippedMissingSource3("rules", sourceRulesDir)];
|
|
28064
28102
|
}
|
|
28065
28103
|
const compiled = compileRules(sourceRulesDir, "cursor", mappings, lossReport);
|
|
28066
28104
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28067
28105
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28068
|
-
const destination =
|
|
28106
|
+
const destination = path37.join(rulesDir, name);
|
|
28069
28107
|
if (options.dryRun) {
|
|
28070
28108
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28071
28109
|
return {
|
|
@@ -28089,17 +28127,17 @@ function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28089
28127
|
});
|
|
28090
28128
|
}
|
|
28091
28129
|
function syncCommands2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28092
|
-
const sourceCommandsRoot =
|
|
28130
|
+
const sourceCommandsRoot = path37.join(sourceRoot, config.source.commands);
|
|
28093
28131
|
if (!fs36.existsSync(sourceCommandsRoot)) {
|
|
28094
28132
|
return [skippedMissingSource3("commands", sourceCommandsRoot)];
|
|
28095
28133
|
}
|
|
28096
|
-
const sourceCommands = ts(
|
|
28134
|
+
const sourceCommands = ts(path37.join(sourceCommandsRoot, "*.md")).sort();
|
|
28097
28135
|
const skillsRoot = resolveTargetPath(paths.skills);
|
|
28098
28136
|
return sourceCommands.map((commandFile) => {
|
|
28099
|
-
const baseName =
|
|
28100
|
-
const destination =
|
|
28137
|
+
const baseName = path37.basename(commandFile, ".md");
|
|
28138
|
+
const destination = path37.join(skillsRoot, baseName, "SKILL.md");
|
|
28101
28139
|
const commandContent = fs36.readFileSync(commandFile, "utf8");
|
|
28102
|
-
const relativeSource = `commands/${
|
|
28140
|
+
const relativeSource = `commands/${path37.basename(commandFile)}`;
|
|
28103
28141
|
const marker = formatProvenanceMarker(
|
|
28104
28142
|
"markdown",
|
|
28105
28143
|
relativeSource,
|
|
@@ -28138,7 +28176,7 @@ ${commandContent.trim()}
|
|
|
28138
28176
|
});
|
|
28139
28177
|
}
|
|
28140
28178
|
function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, component = "skills", destination = "", asSymlink = false) {
|
|
28141
|
-
const source =
|
|
28179
|
+
const source = path37.resolve(sourceRoot, config.source.skills);
|
|
28142
28180
|
if (!fs36.existsSync(source)) {
|
|
28143
28181
|
return skippedMissingSource3(component, source);
|
|
28144
28182
|
}
|
|
@@ -28159,7 +28197,7 @@ function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, c
|
|
|
28159
28197
|
} else if (artifactClass === "managed-symlink") {
|
|
28160
28198
|
fs36.unlinkSync(destination);
|
|
28161
28199
|
}
|
|
28162
|
-
ensureDir(
|
|
28200
|
+
ensureDir(path37.dirname(destination));
|
|
28163
28201
|
createRelativeSymlink(source, destination, "dir");
|
|
28164
28202
|
logger.verbose(`Skills: created shared skills symlink ${destination}`);
|
|
28165
28203
|
return { component, status: "success", path: destination };
|
|
@@ -28204,7 +28242,7 @@ function syncHooks3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28204
28242
|
}
|
|
28205
28243
|
const hooksFileContent = `${JSON.stringify({ version: 1, hooks: compiled.payload }, null, 2)}
|
|
28206
28244
|
`;
|
|
28207
|
-
ensureDir(
|
|
28245
|
+
ensureDir(path37.dirname(destination));
|
|
28208
28246
|
fs36.writeFileSync(destination, hooksFileContent);
|
|
28209
28247
|
return { component: "hooks", status: "success", path: destination };
|
|
28210
28248
|
}
|
|
@@ -28266,13 +28304,13 @@ function syncPermissions(config, paths, options, _lossReport, logger, manifest,
|
|
|
28266
28304
|
);
|
|
28267
28305
|
}
|
|
28268
28306
|
function syncProviderPin(config, sourceRoot, lossReport) {
|
|
28269
|
-
const agentsDir =
|
|
28307
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
28270
28308
|
if (!fs36.existsSync(agentsDir)) return;
|
|
28271
|
-
for (const agentFile of ts(
|
|
28309
|
+
for (const agentFile of ts(path37.join(agentsDir, "*.md")).sort()) {
|
|
28272
28310
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28273
28311
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28274
28312
|
if (hasCustomProvider) {
|
|
28275
|
-
const relativeSource = `agents/${
|
|
28313
|
+
const relativeSource = `agents/${path37.basename(agentFile)}`;
|
|
28276
28314
|
addLoss(lossReport, "cursor", "agents", {
|
|
28277
28315
|
source: relativeSource,
|
|
28278
28316
|
fields: [
|
|
@@ -28284,7 +28322,7 @@ function syncProviderPin(config, sourceRoot, lossReport) {
|
|
|
28284
28322
|
"provider",
|
|
28285
28323
|
"provider-not-representable"
|
|
28286
28324
|
),
|
|
28287
|
-
detail: `${
|
|
28325
|
+
detail: `${path37.basename(agentFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
28288
28326
|
}
|
|
28289
28327
|
]
|
|
28290
28328
|
});
|
|
@@ -28299,7 +28337,7 @@ function writeCompiledArtifact3(component, destination, content, expectedHash, c
|
|
|
28299
28337
|
if (artifactClass === "unmanaged-conflict" && !handleConflict3(destination, config, options, logger, manifest, scopePath)) {
|
|
28300
28338
|
return { component, status: "conflict", path: destination };
|
|
28301
28339
|
}
|
|
28302
|
-
ensureDir(
|
|
28340
|
+
ensureDir(path37.dirname(destination));
|
|
28303
28341
|
fs36.writeFileSync(destination, content);
|
|
28304
28342
|
return { component, status: "success", path: destination };
|
|
28305
28343
|
}
|
|
@@ -28359,7 +28397,7 @@ function hashString3(value) {
|
|
|
28359
28397
|
// src/adapters/cline.ts
|
|
28360
28398
|
import crypto8 from "crypto";
|
|
28361
28399
|
import fs37 from "fs";
|
|
28362
|
-
import
|
|
28400
|
+
import path38 from "path";
|
|
28363
28401
|
function syncCline(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28364
28402
|
const scope = options.scope ?? "global";
|
|
28365
28403
|
const profile = resolveTargetPaths({
|
|
@@ -28472,7 +28510,7 @@ function syncCline(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
28472
28510
|
function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport, logger, manifest, scopePath) {
|
|
28473
28511
|
if (scope === "global" || paths.instructions === null) {
|
|
28474
28512
|
addLoss(lossReport, "cline", "instructions", {
|
|
28475
|
-
source:
|
|
28513
|
+
source: path38.basename(config.source.instructions),
|
|
28476
28514
|
fields: [
|
|
28477
28515
|
{
|
|
28478
28516
|
field: "instructions",
|
|
@@ -28492,12 +28530,12 @@ function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport
|
|
|
28492
28530
|
path: "cline/global/instructions: no committable global path"
|
|
28493
28531
|
};
|
|
28494
28532
|
}
|
|
28495
|
-
const source =
|
|
28533
|
+
const source = path38.join(sourceRoot, config.source.instructions);
|
|
28496
28534
|
const destination = resolveTargetPath(paths.instructions);
|
|
28497
28535
|
const baseContent = fs37.existsSync(source) ? fs37.readFileSync(source, "utf8").trim() : "";
|
|
28498
28536
|
const marker = formatProvenanceMarker(
|
|
28499
28537
|
"markdown",
|
|
28500
|
-
|
|
28538
|
+
path38.basename(config.source.instructions),
|
|
28501
28539
|
hashString4(baseContent),
|
|
28502
28540
|
"cline"
|
|
28503
28541
|
);
|
|
@@ -28522,11 +28560,11 @@ ${baseContent}
|
|
|
28522
28560
|
);
|
|
28523
28561
|
}
|
|
28524
28562
|
function syncAgents4(config, sourceRoot, mappings, extensions, options, lossReport, logger) {
|
|
28525
|
-
const sourceAgentsRoot =
|
|
28563
|
+
const sourceAgentsRoot = path38.join(sourceRoot, config.source.agents);
|
|
28526
28564
|
if (!fs37.existsSync(sourceAgentsRoot)) {
|
|
28527
28565
|
return [skippedMissingSource4("agents", sourceAgentsRoot)];
|
|
28528
28566
|
}
|
|
28529
|
-
const sourceAgents = ts(
|
|
28567
|
+
const sourceAgents = ts(path38.join(sourceAgentsRoot, "*.md")).sort();
|
|
28530
28568
|
return sourceAgents.map((agentFile) => {
|
|
28531
28569
|
compileAgent(agentFile, "cline", mappings, extensions, lossReport);
|
|
28532
28570
|
if (options.dryRun) {
|
|
@@ -28542,14 +28580,14 @@ function syncAgents4(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
28542
28580
|
});
|
|
28543
28581
|
}
|
|
28544
28582
|
function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28545
|
-
const sourceRulesDir =
|
|
28583
|
+
const sourceRulesDir = path38.join(sourceRoot, config.source.rules);
|
|
28546
28584
|
if (!fs37.existsSync(sourceRulesDir)) {
|
|
28547
28585
|
return [skippedMissingSource4("rules", sourceRulesDir)];
|
|
28548
28586
|
}
|
|
28549
28587
|
const compiled = compileRules(sourceRulesDir, "cline", mappings, lossReport);
|
|
28550
28588
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28551
28589
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28552
|
-
const destination =
|
|
28590
|
+
const destination = path38.join(rulesDir, name);
|
|
28553
28591
|
if (options.dryRun) {
|
|
28554
28592
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28555
28593
|
return {
|
|
@@ -28573,17 +28611,17 @@ function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28573
28611
|
});
|
|
28574
28612
|
}
|
|
28575
28613
|
function syncCommands3(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28576
|
-
const sourceCommandsRoot =
|
|
28614
|
+
const sourceCommandsRoot = path38.join(sourceRoot, config.source.commands);
|
|
28577
28615
|
if (!fs37.existsSync(sourceCommandsRoot)) {
|
|
28578
28616
|
return [skippedMissingSource4("commands", sourceCommandsRoot)];
|
|
28579
28617
|
}
|
|
28580
|
-
const sourceCommands = ts(
|
|
28618
|
+
const sourceCommands = ts(path38.join(sourceCommandsRoot, "*.md")).sort();
|
|
28581
28619
|
const workflowsRoot = resolveTargetPath(paths.workflows);
|
|
28582
28620
|
return sourceCommands.map((commandFile) => {
|
|
28583
|
-
const baseName =
|
|
28584
|
-
const destination =
|
|
28621
|
+
const baseName = path38.basename(commandFile);
|
|
28622
|
+
const destination = path38.join(workflowsRoot, baseName);
|
|
28585
28623
|
const commandContent = fs37.readFileSync(commandFile, "utf8");
|
|
28586
|
-
const relativeSource = `commands/${
|
|
28624
|
+
const relativeSource = `commands/${path38.basename(commandFile)}`;
|
|
28587
28625
|
const marker = formatProvenanceMarker(
|
|
28588
28626
|
"markdown",
|
|
28589
28627
|
relativeSource,
|
|
@@ -28618,7 +28656,7 @@ ${commandContent.trim()}
|
|
|
28618
28656
|
});
|
|
28619
28657
|
}
|
|
28620
28658
|
function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28621
|
-
const source =
|
|
28659
|
+
const source = path38.resolve(sourceRoot, config.source.skills);
|
|
28622
28660
|
const destination = resolveTargetPath(paths.skills);
|
|
28623
28661
|
if (!fs37.existsSync(source)) {
|
|
28624
28662
|
return skippedMissingSource4("skills", source);
|
|
@@ -28642,7 +28680,7 @@ function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
28642
28680
|
} else if (artifactClass === "managed-symlink") {
|
|
28643
28681
|
fs37.unlinkSync(destination);
|
|
28644
28682
|
}
|
|
28645
|
-
ensureDir(
|
|
28683
|
+
ensureDir(path38.dirname(destination));
|
|
28646
28684
|
createRelativeSymlink(source, destination, "dir");
|
|
28647
28685
|
logger.verbose(`Skills: created Cline skills symlink ${destination}`);
|
|
28648
28686
|
return { component: "skills", status: "success", path: destination };
|
|
@@ -28712,11 +28750,11 @@ function syncSettings(lossReport) {
|
|
|
28712
28750
|
};
|
|
28713
28751
|
}
|
|
28714
28752
|
function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
28715
|
-
const agentsDir =
|
|
28753
|
+
const agentsDir = path38.join(sourceRoot, config.source.agents);
|
|
28716
28754
|
if (!fs37.existsSync(agentsDir)) return;
|
|
28717
|
-
for (const agentFile of ts(
|
|
28755
|
+
for (const agentFile of ts(path38.join(agentsDir, "*.md")).sort()) {
|
|
28718
28756
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28719
|
-
const relativeSource = `agents/${
|
|
28757
|
+
const relativeSource = `agents/${path38.basename(agentFile)}`;
|
|
28720
28758
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28721
28759
|
if (hasCustomProvider) {
|
|
28722
28760
|
addLoss(lossReport, "cline", "agents", {
|
|
@@ -28730,7 +28768,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28730
28768
|
"provider",
|
|
28731
28769
|
"provider-not-representable"
|
|
28732
28770
|
),
|
|
28733
|
-
detail: `${
|
|
28771
|
+
detail: `${path38.basename(agentFile)}: Cline provider is interface-only (Settings \u2192 API Provider); configure manually.`
|
|
28734
28772
|
}
|
|
28735
28773
|
]
|
|
28736
28774
|
});
|
|
@@ -28748,7 +28786,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28748
28786
|
"model",
|
|
28749
28787
|
"model-not-representable"
|
|
28750
28788
|
),
|
|
28751
|
-
detail: `${
|
|
28789
|
+
detail: `${path38.basename(agentFile)}: Cline model pin is interface-only (Settings \u2192 Model); configure manually.`
|
|
28752
28790
|
}
|
|
28753
28791
|
]
|
|
28754
28792
|
});
|
|
@@ -28763,7 +28801,7 @@ function writeCompiledArtifact4(component, destination, content, expectedHash, c
|
|
|
28763
28801
|
if (artifactClass === "unmanaged-conflict" && !handleConflict4(destination, config, options, logger, manifest, scopePath)) {
|
|
28764
28802
|
return { component, status: "conflict", path: destination };
|
|
28765
28803
|
}
|
|
28766
|
-
ensureDir(
|
|
28804
|
+
ensureDir(path38.dirname(destination));
|
|
28767
28805
|
fs37.writeFileSync(destination, content);
|
|
28768
28806
|
return { component, status: "success", path: destination };
|
|
28769
28807
|
}
|
|
@@ -28824,7 +28862,7 @@ function hashString4(value) {
|
|
|
28824
28862
|
import crypto9 from "crypto";
|
|
28825
28863
|
import fs38 from "fs";
|
|
28826
28864
|
import os6 from "os";
|
|
28827
|
-
import
|
|
28865
|
+
import path39 from "path";
|
|
28828
28866
|
var import_yaml11 = __toESM(require_dist(), 1);
|
|
28829
28867
|
function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28830
28868
|
const scope = options.scope ?? "global";
|
|
@@ -28842,7 +28880,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28842
28880
|
config_doc: profile.config_doc
|
|
28843
28881
|
};
|
|
28844
28882
|
const rules = compileRules(
|
|
28845
|
-
|
|
28883
|
+
path39.join(sourceRoot, config.source.rules),
|
|
28846
28884
|
"opencode",
|
|
28847
28885
|
mappings,
|
|
28848
28886
|
lossReport
|
|
@@ -28944,7 +28982,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28944
28982
|
return { target: "opencode", outcomes };
|
|
28945
28983
|
}
|
|
28946
28984
|
function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
28947
|
-
const source =
|
|
28985
|
+
const source = path39.join(sourceRoot, config.source.instructions);
|
|
28948
28986
|
const destination = resolveTargetPath(paths.instructions);
|
|
28949
28987
|
const baseContent = fs38.existsSync(source) ? fs38.readFileSync(source, "utf8").trim() : "";
|
|
28950
28988
|
const composed = agentsAppendix ? `${baseContent}
|
|
@@ -28953,7 +28991,7 @@ function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, l
|
|
|
28953
28991
|
${agentsAppendix}`.trim() : baseContent;
|
|
28954
28992
|
const marker = formatProvenanceMarker(
|
|
28955
28993
|
"markdown",
|
|
28956
|
-
|
|
28994
|
+
path39.basename(config.source.instructions),
|
|
28957
28995
|
hashString5(composed),
|
|
28958
28996
|
"opencode"
|
|
28959
28997
|
);
|
|
@@ -28980,16 +29018,16 @@ ${composed}
|
|
|
28980
29018
|
);
|
|
28981
29019
|
}
|
|
28982
29020
|
function syncAgents5(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28983
|
-
const sourceAgentsRoot =
|
|
29021
|
+
const sourceAgentsRoot = path39.join(sourceRoot, config.source.agents);
|
|
28984
29022
|
if (!fs38.existsSync(sourceAgentsRoot)) {
|
|
28985
29023
|
return [skippedMissingSource5("agents", sourceAgentsRoot)];
|
|
28986
29024
|
}
|
|
28987
|
-
const sourceAgents = ts(
|
|
29025
|
+
const sourceAgents = ts(path39.join(sourceAgentsRoot, "*.md")).sort();
|
|
28988
29026
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
28989
29027
|
return sourceAgents.map((agentFile) => {
|
|
28990
|
-
const destination =
|
|
29028
|
+
const destination = path39.join(
|
|
28991
29029
|
agentsRoot,
|
|
28992
|
-
`${
|
|
29030
|
+
`${path39.basename(agentFile, ".md")}.md`
|
|
28993
29031
|
);
|
|
28994
29032
|
let compiled;
|
|
28995
29033
|
try {
|
|
@@ -29053,11 +29091,11 @@ function applyProviderModelBinding(compiled, mappings) {
|
|
|
29053
29091
|
return `${before}${(0, import_yaml11.stringify)(fields).trim()}${after}`;
|
|
29054
29092
|
}
|
|
29055
29093
|
function syncCommands4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
29056
|
-
const sourceCommandsRoot =
|
|
29094
|
+
const sourceCommandsRoot = path39.join(sourceRoot, config.source.commands);
|
|
29057
29095
|
if (!fs38.existsSync(sourceCommandsRoot)) {
|
|
29058
29096
|
return [skippedMissingSource5("commands", sourceCommandsRoot)];
|
|
29059
29097
|
}
|
|
29060
|
-
const sourceCommands = ts(
|
|
29098
|
+
const sourceCommands = ts(path39.join(sourceCommandsRoot, "*.md")).sort();
|
|
29061
29099
|
const commandsRoot = resolveTargetPath(paths.commands);
|
|
29062
29100
|
return sourceCommands.map((commandFile) => {
|
|
29063
29101
|
const { data, body } = parseCommandFile(commandFile);
|
|
@@ -29071,7 +29109,7 @@ function syncCommands4(config, sourceRoot, paths, options, logger, manifest, sco
|
|
|
29071
29109
|
if (typeof data.model === "string") {
|
|
29072
29110
|
frontmatter.model = data.model;
|
|
29073
29111
|
}
|
|
29074
|
-
const relativeSource = `commands/${
|
|
29112
|
+
const relativeSource = `commands/${path39.basename(commandFile)}`;
|
|
29075
29113
|
const marker = formatProvenanceMarker(
|
|
29076
29114
|
"markdown",
|
|
29077
29115
|
relativeSource,
|
|
@@ -29087,9 +29125,9 @@ ${body.trimEnd()}
|
|
|
29087
29125
|
` : `${marker}
|
|
29088
29126
|
${body.trimEnd()}
|
|
29089
29127
|
`;
|
|
29090
|
-
const destination =
|
|
29128
|
+
const destination = path39.join(
|
|
29091
29129
|
commandsRoot,
|
|
29092
|
-
`${
|
|
29130
|
+
`${path39.basename(commandFile, ".md")}.md`
|
|
29093
29131
|
);
|
|
29094
29132
|
if (options.dryRun) {
|
|
29095
29133
|
logger.info(
|
|
@@ -29116,7 +29154,7 @@ ${body.trimEnd()}
|
|
|
29116
29154
|
});
|
|
29117
29155
|
}
|
|
29118
29156
|
function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scopePath, component = "skills", destination = "") {
|
|
29119
|
-
const source =
|
|
29157
|
+
const source = path39.resolve(sourceRoot, config.source.skills);
|
|
29120
29158
|
if (!fs38.existsSync(source)) {
|
|
29121
29159
|
return skippedMissingSource5(component, source);
|
|
29122
29160
|
}
|
|
@@ -29135,7 +29173,7 @@ function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scop
|
|
|
29135
29173
|
} else if (artifactClass === "managed-symlink") {
|
|
29136
29174
|
fs38.unlinkSync(destination);
|
|
29137
29175
|
}
|
|
29138
|
-
ensureDir(
|
|
29176
|
+
ensureDir(path39.dirname(destination));
|
|
29139
29177
|
createRelativeSymlink(source, destination, "dir");
|
|
29140
29178
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
29141
29179
|
return { component, status: "success", path: destination };
|
|
@@ -29243,7 +29281,7 @@ function syncConfigDoc(paths, mcpEntries, _lossReport, permissionMap, mappings)
|
|
|
29243
29281
|
};
|
|
29244
29282
|
}
|
|
29245
29283
|
}
|
|
29246
|
-
ensureDir(
|
|
29284
|
+
ensureDir(path39.dirname(destination));
|
|
29247
29285
|
fs38.writeFileSync(destination, `${JSON.stringify(config, null, 2)}
|
|
29248
29286
|
`);
|
|
29249
29287
|
}
|
|
@@ -29255,7 +29293,7 @@ function writeCompiledArtifact5(component, destination, content, expectedHash, c
|
|
|
29255
29293
|
if (artifactClass === "unmanaged-conflict" && !handleConflict5(destination, config, options, logger, manifest, scopePath)) {
|
|
29256
29294
|
return { component, status: "conflict", path: destination };
|
|
29257
29295
|
}
|
|
29258
|
-
ensureDir(
|
|
29296
|
+
ensureDir(path39.dirname(destination));
|
|
29259
29297
|
fs38.writeFileSync(destination, content);
|
|
29260
29298
|
return { component, status: "success", path: destination };
|
|
29261
29299
|
}
|
|
@@ -29345,9 +29383,9 @@ function isBackupableFile(targetPath) {
|
|
|
29345
29383
|
}
|
|
29346
29384
|
function backupConflictingTarget(targetPath, scopePath) {
|
|
29347
29385
|
const ts2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu, "").replace("T", "T").replace(/\.\d+Z$/u, "Z");
|
|
29348
|
-
const relativeToRoot =
|
|
29349
|
-
const backupPath =
|
|
29350
|
-
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 });
|
|
29351
29389
|
fs39.copyFileSync(targetPath, backupPath);
|
|
29352
29390
|
return backupPath;
|
|
29353
29391
|
}
|
|
@@ -29377,7 +29415,7 @@ async function runInstallCommand(options, logger) {
|
|
|
29377
29415
|
);
|
|
29378
29416
|
}
|
|
29379
29417
|
const kitName = resolvedKitName ?? config.kit;
|
|
29380
|
-
const kitPath = kitPathOverride ?? (options.kitPath ?
|
|
29418
|
+
const kitPath = kitPathOverride ?? (options.kitPath ? path40.resolve(options.kitPath) : config.kitPath);
|
|
29381
29419
|
if (!kitName && !kitPath) {
|
|
29382
29420
|
logger.error(
|
|
29383
29421
|
"No kit specified. Use --kit <name>, --kit-path <path>, or set 'kit'/'kitPath' in tangyr.config.yaml."
|
|
@@ -29633,20 +29671,20 @@ SKIPPED CONFLICTS (${skippedTargetPaths.size} target(s) left unchanged):`
|
|
|
29633
29671
|
writeManifest(scopePath, manifest);
|
|
29634
29672
|
logger.info(`
|
|
29635
29673
|
Installation complete: ${installedCount} files installed.`);
|
|
29636
|
-
logger.info(`Manifest written to ${
|
|
29674
|
+
logger.info(`Manifest written to ${path40.join(scopePath, "manifest.json")}`);
|
|
29637
29675
|
logger.info(`Kit: ${kitInfo.name} (archetype: ${kitInfo.archetype})`);
|
|
29638
29676
|
logger.info(`Scope: ${scope}`);
|
|
29639
29677
|
logger.info(`Tools: ${tools.join(", ")}`);
|
|
29640
29678
|
reportHookRejections(
|
|
29641
29679
|
installLossReport,
|
|
29642
29680
|
tools,
|
|
29643
|
-
|
|
29681
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29644
29682
|
kitInfo.components.hooks.declared
|
|
29645
29683
|
);
|
|
29646
29684
|
const hooksConflict = reportHooksSourceConflict(
|
|
29647
29685
|
installLossReport,
|
|
29648
29686
|
tools,
|
|
29649
|
-
|
|
29687
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29650
29688
|
kitInfo.components.hooks.declared
|
|
29651
29689
|
);
|
|
29652
29690
|
if (hooksConflict) {
|
|
@@ -29791,7 +29829,7 @@ function applyClaudeCodePlacements(placements, manifest, skippedTargetPaths, log
|
|
|
29791
29829
|
logger.verbose(` skipped (operator choice): ${placement.destination}`);
|
|
29792
29830
|
continue;
|
|
29793
29831
|
}
|
|
29794
|
-
const destDir =
|
|
29832
|
+
const destDir = path40.dirname(placement.destination);
|
|
29795
29833
|
fs39.mkdirSync(destDir, { recursive: true });
|
|
29796
29834
|
if (placement.type === "symlink") {
|
|
29797
29835
|
if (fs39.existsSync(placement.destination) || isSymlink2(placement.destination)) {
|
|
@@ -30044,6 +30082,10 @@ function countInstalledArtifacts(outcomes) {
|
|
|
30044
30082
|
).length;
|
|
30045
30083
|
}
|
|
30046
30084
|
function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", projectRoot) {
|
|
30085
|
+
const shared = sharedArtifactKey(outcome.path, scope, projectRoot);
|
|
30086
|
+
if (shared) {
|
|
30087
|
+
return shared;
|
|
30088
|
+
}
|
|
30047
30089
|
if (tool !== "copilot" && tool !== "codex" && tool !== "opencode" && tool !== "cursor" && tool !== "cline") {
|
|
30048
30090
|
if (isDeferredTarget(tool)) {
|
|
30049
30091
|
throw new Error(
|
|
@@ -30072,11 +30114,11 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30072
30114
|
if (outcome.path === mcpFile2) {
|
|
30073
30115
|
return "cline/mcp.json";
|
|
30074
30116
|
}
|
|
30075
|
-
if (outcome.path.startsWith(`${workflowsRoot}${
|
|
30076
|
-
return `cline/workflows/${
|
|
30117
|
+
if (outcome.path.startsWith(`${workflowsRoot}${path40.sep}`)) {
|
|
30118
|
+
return `cline/workflows/${path40.basename(outcome.path)}`;
|
|
30077
30119
|
}
|
|
30078
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30079
|
-
return `cline/rules/${
|
|
30120
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30121
|
+
return `cline/rules/${path40.basename(outcome.path)}`;
|
|
30080
30122
|
}
|
|
30081
30123
|
return null;
|
|
30082
30124
|
}
|
|
@@ -30112,14 +30154,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30112
30154
|
if (outcome.path === permissionsFile) {
|
|
30113
30155
|
return "cursor/permissions.json";
|
|
30114
30156
|
}
|
|
30115
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30116
|
-
return `cursor/agents/${
|
|
30157
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30158
|
+
return `cursor/agents/${path40.basename(outcome.path)}`;
|
|
30117
30159
|
}
|
|
30118
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30119
|
-
return `cursor/rules/${
|
|
30160
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30161
|
+
return `cursor/rules/${path40.basename(outcome.path)}`;
|
|
30120
30162
|
}
|
|
30121
|
-
if (outcome.path.startsWith(`${skillsRoot2}${
|
|
30122
|
-
const rel =
|
|
30163
|
+
if (outcome.path.startsWith(`${skillsRoot2}${path40.sep}`)) {
|
|
30164
|
+
const rel = path40.relative(skillsRoot2, outcome.path);
|
|
30123
30165
|
return `cursor/skills/${rel}`;
|
|
30124
30166
|
}
|
|
30125
30167
|
return null;
|
|
@@ -30145,14 +30187,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30145
30187
|
if (outcome.path === skillsSharedRoot) {
|
|
30146
30188
|
return "opencode/skills_shared";
|
|
30147
30189
|
}
|
|
30148
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30149
|
-
return `opencode/agents/${
|
|
30190
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30191
|
+
return `opencode/agents/${path40.basename(outcome.path)}`;
|
|
30150
30192
|
}
|
|
30151
|
-
if (outcome.path.startsWith(`${commandsRoot}${
|
|
30152
|
-
return `opencode/commands/${
|
|
30193
|
+
if (outcome.path.startsWith(`${commandsRoot}${path40.sep}`)) {
|
|
30194
|
+
return `opencode/commands/${path40.basename(outcome.path)}`;
|
|
30153
30195
|
}
|
|
30154
30196
|
if (outcome.path === configDocFile) {
|
|
30155
|
-
return `opencode/${
|
|
30197
|
+
return `opencode/${path40.basename(outcome.path)}`;
|
|
30156
30198
|
}
|
|
30157
30199
|
return null;
|
|
30158
30200
|
}
|
|
@@ -30173,19 +30215,19 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30173
30215
|
return "copilot/skills";
|
|
30174
30216
|
}
|
|
30175
30217
|
if (instructionsMirror !== null && outcome.path === instructionsMirror) {
|
|
30176
|
-
return `copilot/${
|
|
30218
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30177
30219
|
}
|
|
30178
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30179
|
-
return `copilot/agents/${
|
|
30220
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30221
|
+
return `copilot/agents/${path40.basename(outcome.path)}`;
|
|
30180
30222
|
}
|
|
30181
|
-
if (outcome.path.startsWith(`${promptsRoot}${
|
|
30182
|
-
return `copilot/prompts/${
|
|
30223
|
+
if (outcome.path.startsWith(`${promptsRoot}${path40.sep}`)) {
|
|
30224
|
+
return `copilot/prompts/${path40.basename(outcome.path)}`;
|
|
30183
30225
|
}
|
|
30184
|
-
if (outcome.path.startsWith(`${hooksRoot}${
|
|
30185
|
-
return `copilot/hooks/${
|
|
30226
|
+
if (outcome.path.startsWith(`${hooksRoot}${path40.sep}`)) {
|
|
30227
|
+
return `copilot/hooks/${path40.basename(outcome.path)}`;
|
|
30186
30228
|
}
|
|
30187
30229
|
if (outcome.path === mcpFile2) {
|
|
30188
|
-
return `copilot/${
|
|
30230
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30189
30231
|
}
|
|
30190
30232
|
return null;
|
|
30191
30233
|
}
|
|
@@ -30202,17 +30244,17 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30202
30244
|
if (outcome.path === skillsRoot) {
|
|
30203
30245
|
return "codex/skills";
|
|
30204
30246
|
}
|
|
30205
|
-
if (outcome.path.startsWith(`${agentsRoot}${
|
|
30206
|
-
return `codex/agents/${
|
|
30247
|
+
if (outcome.path.startsWith(`${agentsRoot}${path40.sep}`)) {
|
|
30248
|
+
return `codex/agents/${path40.basename(outcome.path)}`;
|
|
30207
30249
|
}
|
|
30208
|
-
if (outcome.path.startsWith(`${rulesRoot}${
|
|
30209
|
-
return `codex/rules/${
|
|
30250
|
+
if (outcome.path.startsWith(`${rulesRoot}${path40.sep}`)) {
|
|
30251
|
+
return `codex/rules/${path40.basename(outcome.path)}`;
|
|
30210
30252
|
}
|
|
30211
30253
|
if (outcome.path === hooksFile) {
|
|
30212
|
-
return `codex/${
|
|
30254
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30213
30255
|
}
|
|
30214
30256
|
if (outcome.path === mcpFile) {
|
|
30215
|
-
return `codex/${
|
|
30257
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30216
30258
|
}
|
|
30217
30259
|
return null;
|
|
30218
30260
|
}
|
|
@@ -30252,7 +30294,9 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30252
30294
|
placements.push({
|
|
30253
30295
|
source: entrypoint.file,
|
|
30254
30296
|
destination: resolvedPaths.instructions,
|
|
30255
|
-
|
|
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}`,
|
|
30256
30300
|
type: "symlink",
|
|
30257
30301
|
isDir: false
|
|
30258
30302
|
});
|
|
@@ -30264,7 +30308,7 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30264
30308
|
rules: resolvedPaths.rules
|
|
30265
30309
|
};
|
|
30266
30310
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30267
|
-
const componentDir =
|
|
30311
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30268
30312
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30269
30313
|
placements.push({
|
|
30270
30314
|
source: componentDir,
|
|
@@ -30296,7 +30340,7 @@ function getClaudeCodePlacementsFromProfile(kitInfo, profile) {
|
|
|
30296
30340
|
rules: profile.rules
|
|
30297
30341
|
};
|
|
30298
30342
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30299
|
-
const componentDir =
|
|
30343
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30300
30344
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30301
30345
|
placements.push({
|
|
30302
30346
|
source: componentDir,
|
|
@@ -30322,8 +30366,8 @@ function collectAllFiles(kitInfo) {
|
|
|
30322
30366
|
const missingSet = new Set(reconciliation.missing);
|
|
30323
30367
|
for (const entry of reconciliation.declared) {
|
|
30324
30368
|
if (missingSet.has(entry)) continue;
|
|
30325
|
-
const relPath = isSkills ?
|
|
30326
|
-
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));
|
|
30327
30371
|
}
|
|
30328
30372
|
}
|
|
30329
30373
|
return files;
|
|
@@ -30375,14 +30419,14 @@ async function runKitUpdateCommand(options, logger) {
|
|
|
30375
30419
|
}
|
|
30376
30420
|
|
|
30377
30421
|
// src/commands/list.ts
|
|
30378
|
-
import
|
|
30422
|
+
import path41 from "path";
|
|
30379
30423
|
function runListCommand(options, logger) {
|
|
30380
30424
|
let searchPaths = [];
|
|
30381
|
-
let directKitPath = options.kitPath ?
|
|
30425
|
+
let directKitPath = options.kitPath ? path41.resolve(options.kitPath) : void 0;
|
|
30382
30426
|
try {
|
|
30383
30427
|
const { config, configDir } = resolveConfig(options.config);
|
|
30384
30428
|
searchPaths = config.kitSearchPaths ?? [
|
|
30385
|
-
|
|
30429
|
+
path41.join(configDir, "operating-kits")
|
|
30386
30430
|
];
|
|
30387
30431
|
directKitPath = directKitPath ?? config.kitPath;
|
|
30388
30432
|
} catch (err) {
|
|
@@ -30457,7 +30501,7 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30457
30501
|
return kits;
|
|
30458
30502
|
}
|
|
30459
30503
|
const directKit = loadKit(directKitPath);
|
|
30460
|
-
if (kits.some((kit) =>
|
|
30504
|
+
if (kits.some((kit) => path41.resolve(kit.path) === directKit.path)) {
|
|
30461
30505
|
return kits;
|
|
30462
30506
|
}
|
|
30463
30507
|
return [...kits, directKit];
|
|
@@ -30466,14 +30510,14 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30466
30510
|
// src/commands/probe.ts
|
|
30467
30511
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
30468
30512
|
import fs40 from "fs";
|
|
30469
|
-
import
|
|
30513
|
+
import path42 from "path";
|
|
30470
30514
|
function runProbeCommand(options, logger) {
|
|
30471
30515
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30472
30516
|
options,
|
|
30473
30517
|
import.meta.url
|
|
30474
30518
|
);
|
|
30475
30519
|
const platformPaths = readYamlObject(
|
|
30476
|
-
|
|
30520
|
+
path42.join(
|
|
30477
30521
|
resolveConfiguredPath(config.mappings, configDir, sourceRoot, "mappings"),
|
|
30478
30522
|
"platform-paths.yaml"
|
|
30479
30523
|
)
|
|
@@ -30553,7 +30597,7 @@ function commandProbeRows(target, key, command, args) {
|
|
|
30553
30597
|
// src/commands/status.ts
|
|
30554
30598
|
import crypto10 from "crypto";
|
|
30555
30599
|
import fs41 from "fs";
|
|
30556
|
-
import
|
|
30600
|
+
import path43 from "path";
|
|
30557
30601
|
function runStatusCommand(options, logger) {
|
|
30558
30602
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30559
30603
|
options,
|
|
@@ -30632,21 +30676,21 @@ function classifyCodexFiles(config, sourceRoot, configDir) {
|
|
|
30632
30676
|
rules: paths.rules
|
|
30633
30677
|
};
|
|
30634
30678
|
const rules = compileRules(
|
|
30635
|
-
|
|
30679
|
+
path43.join(sourceRoot, config.source.rules),
|
|
30636
30680
|
"codex",
|
|
30637
30681
|
mappings,
|
|
30638
30682
|
createLossReport()
|
|
30639
30683
|
);
|
|
30640
|
-
const instructionsSource = fs41.readFileSync(
|
|
30684
|
+
const instructionsSource = fs41.readFileSync(path43.join(sourceRoot, config.source.instructions), "utf8").trim();
|
|
30641
30685
|
const composedInstructions = `${instructionsSource}
|
|
30642
30686
|
|
|
30643
30687
|
--- tangyr managed rules ---
|
|
30644
30688
|
${rules.agentsAppendix}`.trim();
|
|
30645
30689
|
const agentFiles = ts(
|
|
30646
|
-
|
|
30690
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30647
30691
|
).sort();
|
|
30648
|
-
const hooksSource =
|
|
30649
|
-
const mcpSource =
|
|
30692
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30693
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30650
30694
|
const ruleRows = rules.dotRulesFiles.length === 0 ? [
|
|
30651
30695
|
{
|
|
30652
30696
|
component: "rules",
|
|
@@ -30657,7 +30701,7 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30657
30701
|
] : rules.dotRulesFiles.map(
|
|
30658
30702
|
(ruleFile) => classifyCompiledFile(
|
|
30659
30703
|
`rules/${ruleFile.name}`,
|
|
30660
|
-
|
|
30704
|
+
path43.join(resolveTargetPath(codexPaths.rules), ruleFile.name),
|
|
30661
30705
|
"codex",
|
|
30662
30706
|
void 0,
|
|
30663
30707
|
config,
|
|
@@ -30675,10 +30719,10 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30675
30719
|
),
|
|
30676
30720
|
...agentFiles.map(
|
|
30677
30721
|
(agentFile) => classifyCompiledFile(
|
|
30678
|
-
`agents/${
|
|
30679
|
-
|
|
30722
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30723
|
+
path43.join(
|
|
30680
30724
|
resolveTargetPath(codexPaths.agents),
|
|
30681
|
-
`${
|
|
30725
|
+
`${path43.basename(agentFile, ".md")}.toml`
|
|
30682
30726
|
),
|
|
30683
30727
|
"codex",
|
|
30684
30728
|
computeSourceHash(agentFile),
|
|
@@ -30758,20 +30802,20 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30758
30802
|
mcpSharedFile: paths.mcp_shared_file
|
|
30759
30803
|
};
|
|
30760
30804
|
const agentFiles = ts(
|
|
30761
|
-
|
|
30805
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30762
30806
|
).sort();
|
|
30763
30807
|
const commandFiles = ts(
|
|
30764
|
-
|
|
30808
|
+
path43.join(sourceRoot, config.source.commands, "*.md")
|
|
30765
30809
|
).sort();
|
|
30766
|
-
const hooksSource =
|
|
30767
|
-
const mcpSource =
|
|
30810
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30811
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30768
30812
|
return [
|
|
30769
30813
|
...agentFiles.map(
|
|
30770
30814
|
(agentFile) => classifyCompiledFile(
|
|
30771
|
-
`agents/${
|
|
30772
|
-
|
|
30815
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30816
|
+
path43.join(
|
|
30773
30817
|
resolveTargetPath(copilotPaths.agents),
|
|
30774
|
-
`${
|
|
30818
|
+
`${path43.basename(agentFile, ".md")}.agent.md`
|
|
30775
30819
|
),
|
|
30776
30820
|
"copilot",
|
|
30777
30821
|
computeSourceHash(agentFile),
|
|
@@ -30788,10 +30832,10 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30788
30832
|
),
|
|
30789
30833
|
...commandFiles.map(
|
|
30790
30834
|
(commandFile) => classifyCompiledFile(
|
|
30791
|
-
`commands/${
|
|
30792
|
-
|
|
30835
|
+
`commands/${path43.basename(commandFile, ".md")}`,
|
|
30836
|
+
path43.join(
|
|
30793
30837
|
resolveTargetPath(copilotPaths.prompts),
|
|
30794
|
-
`${
|
|
30838
|
+
`${path43.basename(commandFile, ".md")}.prompt.md`
|
|
30795
30839
|
),
|
|
30796
30840
|
"copilot",
|
|
30797
30841
|
computeSourceHash(commandFile),
|
|
@@ -30811,7 +30855,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30811
30855
|
),
|
|
30812
30856
|
fs41.existsSync(hooksSource) ? classifyCompiledFile(
|
|
30813
30857
|
"hooks",
|
|
30814
|
-
|
|
30858
|
+
path43.join(
|
|
30815
30859
|
resolveTargetPath(copilotPaths.hooks),
|
|
30816
30860
|
"tangyr-managed.json"
|
|
30817
30861
|
),
|
|
@@ -30821,7 +30865,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30821
30865
|
sourceRoot
|
|
30822
30866
|
) : notConfiguredRow(
|
|
30823
30867
|
"hooks",
|
|
30824
|
-
|
|
30868
|
+
path43.join(
|
|
30825
30869
|
resolveTargetPath(copilotPaths.hooks),
|
|
30826
30870
|
"tangyr-managed.json"
|
|
30827
30871
|
)
|
|
@@ -30846,7 +30890,7 @@ function notConfiguredRow(component, filePath) {
|
|
|
30846
30890
|
}
|
|
30847
30891
|
function classifyDirectArtifact(artifact, config, sourceRoot) {
|
|
30848
30892
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
30849
|
-
const sourcePath = artifact.sourceKey ?
|
|
30893
|
+
const sourcePath = artifact.sourceKey ? path43.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
30850
30894
|
if (artifactClass === "managed-symlink" && sourcePath && !isSymlinkCurrent(artifact.path, sourcePath)) {
|
|
30851
30895
|
return {
|
|
30852
30896
|
component: artifact.component,
|
|
@@ -30935,9 +30979,9 @@ function classifyClaudeSharedFiles(config, sourceRoot) {
|
|
|
30935
30979
|
classifyHooks(settingsPath),
|
|
30936
30980
|
classifySettings(
|
|
30937
30981
|
settingsPath,
|
|
30938
|
-
|
|
30982
|
+
path43.resolve(sourceRoot, config.source.settings)
|
|
30939
30983
|
),
|
|
30940
|
-
classifyMcp(claudeJsonPath,
|
|
30984
|
+
classifyMcp(claudeJsonPath, path43.resolve(sourceRoot, config.source.mcp))
|
|
30941
30985
|
];
|
|
30942
30986
|
}
|
|
30943
30987
|
function classifyHooks(filePath) {
|
|
@@ -31070,7 +31114,7 @@ function hashString6(value) {
|
|
|
31070
31114
|
|
|
31071
31115
|
// src/commands/sync.ts
|
|
31072
31116
|
import fs43 from "fs";
|
|
31073
|
-
import
|
|
31117
|
+
import path45 from "path";
|
|
31074
31118
|
|
|
31075
31119
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
31076
31120
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -31569,7 +31613,7 @@ var source_default = chalk;
|
|
|
31569
31613
|
|
|
31570
31614
|
// src/adapters/claude-code.ts
|
|
31571
31615
|
import fs42 from "fs";
|
|
31572
|
-
import
|
|
31616
|
+
import path44 from "path";
|
|
31573
31617
|
|
|
31574
31618
|
// src/core/shim.ts
|
|
31575
31619
|
import crypto11 from "crypto";
|
|
@@ -31680,7 +31724,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31680
31724
|
}
|
|
31681
31725
|
if (!shouldSkipComponent6(options, "instructions") && manifest && scopePath) {
|
|
31682
31726
|
const shimPath = profile.instructions_shim;
|
|
31683
|
-
const agentsMdPath =
|
|
31727
|
+
const agentsMdPath = path44.resolve(sourceRoot, config.source.instructions);
|
|
31684
31728
|
if (!options.dryRun) {
|
|
31685
31729
|
applyClaudeCodeShimUpgrade(
|
|
31686
31730
|
shimPath,
|
|
@@ -31698,7 +31742,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31698
31742
|
if (!shouldSkipComponent6(options, "hooks")) {
|
|
31699
31743
|
outcomes.push(
|
|
31700
31744
|
syncHookScriptsBridge({
|
|
31701
|
-
source:
|
|
31745
|
+
source: path44.resolve(sourceRoot, config.source.hooks),
|
|
31702
31746
|
destination: profile.hook_scripts,
|
|
31703
31747
|
config,
|
|
31704
31748
|
sourceRoot,
|
|
@@ -31750,13 +31794,13 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31750
31794
|
}
|
|
31751
31795
|
function syncProviderLoss2(config, sourceRoot, mappings, lossReport) {
|
|
31752
31796
|
if (!mappings.modelTiers.custom_provider) return;
|
|
31753
|
-
const agentsDir =
|
|
31797
|
+
const agentsDir = path44.join(sourceRoot, config.source.agents);
|
|
31754
31798
|
if (!fs42.existsSync(agentsDir)) return;
|
|
31755
|
-
for (const agentFile of ts(
|
|
31799
|
+
for (const agentFile of ts(path44.join(agentsDir, "*.md")).sort()) {
|
|
31756
31800
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
31757
31801
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
31758
31802
|
if (hasProvider) {
|
|
31759
|
-
const basename =
|
|
31803
|
+
const basename = path44.basename(agentFile);
|
|
31760
31804
|
addLoss(lossReport, "claude-code", "agents", {
|
|
31761
31805
|
source: `agents/${basename}`,
|
|
31762
31806
|
fields: [
|
|
@@ -31783,12 +31827,12 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31783
31827
|
const shimContent = buildAgentsMdShim(shimPath, agentsMdPath, "claude-code");
|
|
31784
31828
|
if (!fs42.existsSync(shimPath)) {
|
|
31785
31829
|
manifest.artifacts.push({
|
|
31786
|
-
relativePath:
|
|
31830
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31787
31831
|
hash: expectedBodyHash,
|
|
31788
31832
|
origin: "tangyr-managed"
|
|
31789
31833
|
});
|
|
31790
31834
|
writeManifest(scopePath, manifest);
|
|
31791
|
-
fs42.mkdirSync(
|
|
31835
|
+
fs42.mkdirSync(path44.dirname(shimPath), { recursive: true });
|
|
31792
31836
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31793
31837
|
logger?.verbose(`instructions-shim: wrote @AGENTS.md shim -> ${shimPath}`);
|
|
31794
31838
|
return;
|
|
@@ -31806,14 +31850,14 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31806
31850
|
writeManifest(scopePath, manifest);
|
|
31807
31851
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31808
31852
|
manifest.artifacts.push({
|
|
31809
|
-
relativePath:
|
|
31853
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31810
31854
|
hash: expectedBodyHash,
|
|
31811
31855
|
origin: "tangyr-managed"
|
|
31812
31856
|
});
|
|
31813
31857
|
logger?.verbose(`instructions-shim: backed up and replaced -> ${shimPath}`);
|
|
31814
31858
|
}
|
|
31815
31859
|
function syncDirectComponent(config, sourceRoot, options, logger, directComponent, manifest, scopePath) {
|
|
31816
|
-
const source =
|
|
31860
|
+
const source = path44.resolve(
|
|
31817
31861
|
sourceRoot,
|
|
31818
31862
|
config.source[directComponent.sourceKey]
|
|
31819
31863
|
);
|
|
@@ -31850,7 +31894,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31850
31894
|
} else if (artifactClass === "managed-symlink") {
|
|
31851
31895
|
fs42.unlinkSync(destination);
|
|
31852
31896
|
}
|
|
31853
|
-
ensureDir(
|
|
31897
|
+
ensureDir(path44.dirname(destination));
|
|
31854
31898
|
createRelativeSymlink(source, destination, directComponent.type, {
|
|
31855
31899
|
logger,
|
|
31856
31900
|
provenanceMarker: directComponent.type === "file" ? formatProvenanceMarker(
|
|
@@ -31867,7 +31911,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31867
31911
|
};
|
|
31868
31912
|
}
|
|
31869
31913
|
function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination, manifest, scopePath) {
|
|
31870
|
-
const source =
|
|
31914
|
+
const source = path44.resolve(sourceRoot, config.source.skills);
|
|
31871
31915
|
if (!fs42.existsSync(source)) {
|
|
31872
31916
|
return [skippedMissingSource6("skills", source)];
|
|
31873
31917
|
}
|
|
@@ -31878,7 +31922,7 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31878
31922
|
if (isLegacyWholesaleSymlink) {
|
|
31879
31923
|
for (const name of foreignSkillNames(source, declaredNames)) {
|
|
31880
31924
|
logger.info(
|
|
31881
|
-
`[dry-run] skills: migrate foreign skill ${
|
|
31925
|
+
`[dry-run] skills: migrate foreign skill ${path44.join(source, name)} -> ${path44.join(destination, name)}`
|
|
31882
31926
|
);
|
|
31883
31927
|
}
|
|
31884
31928
|
logger.info(
|
|
@@ -31886,9 +31930,9 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31886
31930
|
);
|
|
31887
31931
|
}
|
|
31888
31932
|
for (const name of declaredNames ?? listSkillDirNames(source)) {
|
|
31889
|
-
const skillDestination =
|
|
31933
|
+
const skillDestination = path44.join(destination, name);
|
|
31890
31934
|
logger.info(
|
|
31891
|
-
`[dry-run] skills: symlink ${
|
|
31935
|
+
`[dry-run] skills: symlink ${path44.join(source, name)} -> ${skillDestination}`
|
|
31892
31936
|
);
|
|
31893
31937
|
outcomes2.push({
|
|
31894
31938
|
component: "skills",
|
|
@@ -31921,8 +31965,8 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31921
31965
|
return outcomes;
|
|
31922
31966
|
}
|
|
31923
31967
|
function syncSingleSkill(config, sourceRoot, options, logger, source, destination, name, manifest, scopePath) {
|
|
31924
|
-
const skillSource =
|
|
31925
|
-
const skillDestination =
|
|
31968
|
+
const skillSource = path44.join(source, name);
|
|
31969
|
+
const skillDestination = path44.join(destination, name);
|
|
31926
31970
|
if (!fs42.existsSync(skillSource)) {
|
|
31927
31971
|
return skippedMissingSource6("skills", skillSource);
|
|
31928
31972
|
}
|
|
@@ -31956,8 +32000,8 @@ function migrateWholesaleSkillsSymlink(source, destination, declaredNames, logge
|
|
|
31956
32000
|
fs42.unlinkSync(destination);
|
|
31957
32001
|
ensureDir(destination);
|
|
31958
32002
|
for (const name of foreignNames) {
|
|
31959
|
-
const from =
|
|
31960
|
-
const to =
|
|
32003
|
+
const from = path44.join(source, name);
|
|
32004
|
+
const to = path44.join(destination, name);
|
|
31961
32005
|
if (fs42.existsSync(to)) {
|
|
31962
32006
|
logger.warn(
|
|
31963
32007
|
`skills migration: ${to} already exists \u2014 skipping ${from} to avoid overwrite. Nothing in the kit was changed.`
|
|
@@ -32020,7 +32064,7 @@ function syncHooks6(config, sourceRoot, options, logger, destination, scriptsBri
|
|
|
32020
32064
|
};
|
|
32021
32065
|
}
|
|
32022
32066
|
function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
32023
|
-
const source =
|
|
32067
|
+
const source = path44.resolve(sourceRoot, config.source.mcp);
|
|
32024
32068
|
if (!fs42.existsSync(source)) {
|
|
32025
32069
|
return skippedMissingSource6("mcp", source);
|
|
32026
32070
|
}
|
|
@@ -32056,7 +32100,7 @@ function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
|
32056
32100
|
};
|
|
32057
32101
|
}
|
|
32058
32102
|
function syncSettings2(config, sourceRoot, options, logger, destination) {
|
|
32059
|
-
const source =
|
|
32103
|
+
const source = path44.resolve(sourceRoot, config.source.settings);
|
|
32060
32104
|
if (!fs42.existsSync(source)) {
|
|
32061
32105
|
return skippedMissingSource6("settings", source);
|
|
32062
32106
|
}
|
|
@@ -32325,13 +32369,13 @@ async function runSyncCommand(options, logger) {
|
|
|
32325
32369
|
reportHookRejections(
|
|
32326
32370
|
lossReport,
|
|
32327
32371
|
targets,
|
|
32328
|
-
|
|
32372
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32329
32373
|
kitInfo.components.hooks.declared
|
|
32330
32374
|
);
|
|
32331
32375
|
const hooksConflict = reportHooksSourceConflict(
|
|
32332
32376
|
lossReport,
|
|
32333
32377
|
targets,
|
|
32334
|
-
|
|
32378
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32335
32379
|
kitInfo.components.hooks.declared
|
|
32336
32380
|
);
|
|
32337
32381
|
if (hooksConflict) {
|
|
@@ -32442,7 +32486,7 @@ function updateManifest(kitInfo, kitSync) {
|
|
|
32442
32486
|
writeManifest(kitSync.scopePath, kitSync.manifest);
|
|
32443
32487
|
}
|
|
32444
32488
|
function resolveKitFilePath(kitPath, relativePath) {
|
|
32445
|
-
const fullPath =
|
|
32489
|
+
const fullPath = path45.join(kitPath, relativePath);
|
|
32446
32490
|
return fs43.existsSync(fullPath) ? fullPath : null;
|
|
32447
32491
|
}
|
|
32448
32492
|
function cleanupRemovedManagedArtifacts(config, mappings, targets, options, removedSourcePaths, logger) {
|
|
@@ -32506,9 +32550,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32506
32550
|
}
|
|
32507
32551
|
if (relativePath.startsWith("agents/")) {
|
|
32508
32552
|
removeManagedCompiledArtifact2(
|
|
32509
|
-
|
|
32553
|
+
path45.join(
|
|
32510
32554
|
resolveTargetPath(paths.agents ?? ""),
|
|
32511
|
-
`${
|
|
32555
|
+
`${path45.parse(relativePath).name}.agent.md`
|
|
32512
32556
|
),
|
|
32513
32557
|
"copilot",
|
|
32514
32558
|
relativePath,
|
|
@@ -32518,9 +32562,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32518
32562
|
}
|
|
32519
32563
|
if (relativePath.startsWith("commands/")) {
|
|
32520
32564
|
removeManagedCompiledArtifact2(
|
|
32521
|
-
|
|
32565
|
+
path45.join(
|
|
32522
32566
|
resolveTargetPath(paths.prompts ?? ""),
|
|
32523
|
-
`${
|
|
32567
|
+
`${path45.parse(relativePath).name}.prompt.md`
|
|
32524
32568
|
),
|
|
32525
32569
|
"copilot",
|
|
32526
32570
|
relativePath,
|
|
@@ -32530,7 +32574,7 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32530
32574
|
}
|
|
32531
32575
|
if (relativePath.endsWith("hooks.json")) {
|
|
32532
32576
|
removeManagedCompiledArtifact2(
|
|
32533
|
-
|
|
32577
|
+
path45.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
32534
32578
|
"copilot",
|
|
32535
32579
|
relativePath,
|
|
32536
32580
|
logger
|
|
@@ -32560,9 +32604,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32560
32604
|
}
|
|
32561
32605
|
if (relativePath.startsWith("agents/")) {
|
|
32562
32606
|
removeManagedCompiledArtifact2(
|
|
32563
|
-
|
|
32607
|
+
path45.join(
|
|
32564
32608
|
resolveTargetPath(paths.agents ?? ""),
|
|
32565
|
-
`${
|
|
32609
|
+
`${path45.parse(relativePath).name}.toml`
|
|
32566
32610
|
),
|
|
32567
32611
|
"codex",
|
|
32568
32612
|
relativePath,
|
|
@@ -32572,9 +32616,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32572
32616
|
}
|
|
32573
32617
|
if (relativePath.startsWith("rules/")) {
|
|
32574
32618
|
removeManagedCompiledArtifact2(
|
|
32575
|
-
|
|
32619
|
+
path45.join(
|
|
32576
32620
|
resolveTargetPath(paths.rules ?? ""),
|
|
32577
|
-
`${
|
|
32621
|
+
`${path45.parse(relativePath).name}.rules`
|
|
32578
32622
|
),
|
|
32579
32623
|
"codex",
|
|
32580
32624
|
relativePath,
|
|
@@ -32613,9 +32657,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32613
32657
|
}
|
|
32614
32658
|
if (relativePath.startsWith("agents/")) {
|
|
32615
32659
|
removeManagedCompiledArtifact2(
|
|
32616
|
-
|
|
32660
|
+
path45.join(
|
|
32617
32661
|
resolveTargetPath(paths.agents ?? ""),
|
|
32618
|
-
`${
|
|
32662
|
+
`${path45.parse(relativePath).name}.md`
|
|
32619
32663
|
),
|
|
32620
32664
|
"opencode",
|
|
32621
32665
|
relativePath,
|
|
@@ -32625,9 +32669,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32625
32669
|
}
|
|
32626
32670
|
if (relativePath.startsWith("commands/")) {
|
|
32627
32671
|
removeManagedCompiledArtifact2(
|
|
32628
|
-
|
|
32672
|
+
path45.join(
|
|
32629
32673
|
resolveTargetPath(paths.commands ?? ""),
|
|
32630
|
-
`${
|
|
32674
|
+
`${path45.parse(relativePath).name}.md`
|
|
32631
32675
|
),
|
|
32632
32676
|
"opencode",
|
|
32633
32677
|
relativePath,
|
|
@@ -32659,9 +32703,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32659
32703
|
}
|
|
32660
32704
|
if (relativePath.startsWith("agents/")) {
|
|
32661
32705
|
removeManagedCompiledArtifact2(
|
|
32662
|
-
|
|
32706
|
+
path45.join(
|
|
32663
32707
|
resolveTargetPath(paths.agents ?? ""),
|
|
32664
|
-
`${
|
|
32708
|
+
`${path45.parse(relativePath).name}.md`
|
|
32665
32709
|
),
|
|
32666
32710
|
"cursor",
|
|
32667
32711
|
relativePath,
|
|
@@ -32671,9 +32715,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32671
32715
|
}
|
|
32672
32716
|
if (relativePath.startsWith("rules/")) {
|
|
32673
32717
|
removeManagedCompiledArtifact2(
|
|
32674
|
-
|
|
32718
|
+
path45.join(
|
|
32675
32719
|
resolveTargetPath(paths.rules ?? ""),
|
|
32676
|
-
`${
|
|
32720
|
+
`${path45.parse(relativePath).name}.mdc`
|
|
32677
32721
|
),
|
|
32678
32722
|
"cursor",
|
|
32679
32723
|
relativePath,
|
|
@@ -32683,9 +32727,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32683
32727
|
}
|
|
32684
32728
|
if (relativePath.startsWith("commands/")) {
|
|
32685
32729
|
removeManagedCompiledArtifact2(
|
|
32686
|
-
|
|
32730
|
+
path45.join(
|
|
32687
32731
|
resolveTargetPath(paths.skills ?? ""),
|
|
32688
|
-
|
|
32732
|
+
path45.parse(relativePath).name,
|
|
32689
32733
|
"SKILL.md"
|
|
32690
32734
|
),
|
|
32691
32735
|
"cursor",
|
|
@@ -32729,9 +32773,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32729
32773
|
}
|
|
32730
32774
|
if (relativePath.startsWith("rules/")) {
|
|
32731
32775
|
removeManagedCompiledArtifact2(
|
|
32732
|
-
|
|
32776
|
+
path45.join(
|
|
32733
32777
|
resolveTargetPath(paths.rules ?? ""),
|
|
32734
|
-
`${
|
|
32778
|
+
`${path45.parse(relativePath).name}.md`
|
|
32735
32779
|
),
|
|
32736
32780
|
"cline",
|
|
32737
32781
|
relativePath,
|
|
@@ -32741,9 +32785,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32741
32785
|
}
|
|
32742
32786
|
if (relativePath.startsWith("commands/")) {
|
|
32743
32787
|
removeManagedCompiledArtifact2(
|
|
32744
|
-
|
|
32788
|
+
path45.join(
|
|
32745
32789
|
resolveTargetPath(paths.workflows ?? ""),
|
|
32746
|
-
|
|
32790
|
+
path45.basename(relativePath)
|
|
32747
32791
|
),
|
|
32748
32792
|
"cline",
|
|
32749
32793
|
relativePath,
|
|
@@ -32912,7 +32956,7 @@ function removeManagedHookEntries(value, expectedSource) {
|
|
|
32912
32956
|
|
|
32913
32957
|
// src/commands/validate.ts
|
|
32914
32958
|
import fs44 from "fs";
|
|
32915
|
-
import
|
|
32959
|
+
import path46 from "path";
|
|
32916
32960
|
var SUPPORTED_KIT_FORMATS2 = [1];
|
|
32917
32961
|
var SUPPORTED_DISCIPLINE_VERSIONS = [
|
|
32918
32962
|
"0.14.0",
|
|
@@ -33006,7 +33050,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33006
33050
|
const notices = [];
|
|
33007
33051
|
const canonical = new Set(CANONICAL_SKILL_SUBFOLDERS);
|
|
33008
33052
|
for (const name of kit.components.skills.declared) {
|
|
33009
|
-
const skillDir =
|
|
33053
|
+
const skillDir = path46.join(kit.path, "skills", name);
|
|
33010
33054
|
let entries;
|
|
33011
33055
|
try {
|
|
33012
33056
|
entries = fs44.readdirSync(skillDir, { withFileTypes: true });
|
|
@@ -33027,7 +33071,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33027
33071
|
return notices;
|
|
33028
33072
|
}
|
|
33029
33073
|
function checkHooksSourceForm(kit) {
|
|
33030
|
-
const hooksDir =
|
|
33074
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33031
33075
|
const message = describeHooksSourceConflict(
|
|
33032
33076
|
hooksDir,
|
|
33033
33077
|
kit.components.hooks.declared
|
|
@@ -33039,12 +33083,12 @@ function checkHooksSourceForm(kit) {
|
|
|
33039
33083
|
} : null;
|
|
33040
33084
|
}
|
|
33041
33085
|
function checkHookDeclarations(kit) {
|
|
33042
|
-
const hooksDir =
|
|
33086
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33043
33087
|
return collectHookRejections(hooksDir, kit.components.hooks.declared).map(
|
|
33044
33088
|
(r) => ({
|
|
33045
33089
|
code: "hook-declaration-invalid",
|
|
33046
|
-
location: `hooks/${
|
|
33047
|
-
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.`
|
|
33048
33092
|
})
|
|
33049
33093
|
);
|
|
33050
33094
|
}
|
|
@@ -33064,11 +33108,11 @@ function checkKitFormatSupported(kit) {
|
|
|
33064
33108
|
function checkEntrypointExists(kit) {
|
|
33065
33109
|
const declared = kit.entrypoint;
|
|
33066
33110
|
const entrypoint = declared ?? DEFAULT_ENTRYPOINT;
|
|
33067
|
-
const entrypointPath =
|
|
33111
|
+
const entrypointPath = path46.join(kit.path, entrypoint);
|
|
33068
33112
|
if (fs44.existsSync(entrypointPath)) {
|
|
33069
33113
|
return null;
|
|
33070
33114
|
}
|
|
33071
|
-
const legacyPresent = declared === void 0 && fs44.existsSync(
|
|
33115
|
+
const legacyPresent = declared === void 0 && fs44.existsSync(path46.join(kit.path, LEGACY_ENTRYPOINT));
|
|
33072
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.`;
|
|
33073
33117
|
return {
|
|
33074
33118
|
code: "entrypoint-missing",
|
|
@@ -33124,9 +33168,9 @@ function checkComponentFrontmatter(kit) {
|
|
|
33124
33168
|
const missingSet = new Set(kit.components[cat].missing);
|
|
33125
33169
|
for (const name of kit.components[cat].declared) {
|
|
33126
33170
|
if (missingSet.has(name)) continue;
|
|
33127
|
-
const filePath = cat === "skills" ?
|
|
33171
|
+
const filePath = cat === "skills" ? path46.join(kit.path, cat, name, "SKILL.md") : path46.join(kit.path, cat, `${name}.md`);
|
|
33128
33172
|
if (!fs44.existsSync(filePath)) continue;
|
|
33129
|
-
const relPath =
|
|
33173
|
+
const relPath = path46.relative(kit.path, filePath);
|
|
33130
33174
|
try {
|
|
33131
33175
|
const { data } = parseMarkdownFrontmatter(filePath);
|
|
33132
33176
|
for (const field of requiredFields) {
|
|
@@ -33171,7 +33215,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33171
33215
|
const missingSet = new Set(kit.components.commands.missing);
|
|
33172
33216
|
for (const name of kit.components.commands.declared) {
|
|
33173
33217
|
if (missingSet.has(name)) continue;
|
|
33174
|
-
const filePath =
|
|
33218
|
+
const filePath = path46.join(kit.path, "commands", `${name}.md`);
|
|
33175
33219
|
if (!fs44.existsSync(filePath)) continue;
|
|
33176
33220
|
let data;
|
|
33177
33221
|
try {
|
|
@@ -33185,7 +33229,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33185
33229
|
if (!barred) {
|
|
33186
33230
|
violations.push({
|
|
33187
33231
|
code: "command-human-only-model-invocable",
|
|
33188
|
-
location:
|
|
33232
|
+
location: path46.relative(kit.path, filePath),
|
|
33189
33233
|
message: "commands: 'launch: human-only' requires 'disable-model-invocation: true' so the model cannot start the command; only a Human-typed launch may"
|
|
33190
33234
|
});
|
|
33191
33235
|
}
|
|
@@ -33195,7 +33239,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33195
33239
|
|
|
33196
33240
|
// src/commands/verify.ts
|
|
33197
33241
|
import fs45 from "fs";
|
|
33198
|
-
import
|
|
33242
|
+
import path47 from "path";
|
|
33199
33243
|
function runVerifyCommand(options, logger) {
|
|
33200
33244
|
const { config, configDir, sourceRoot, kitInfo } = resolveRuntime(
|
|
33201
33245
|
options,
|
|
@@ -33286,7 +33330,7 @@ function verifyClaudeCodeGlobalRoots(roots, manifestKeys, mappings) {
|
|
|
33286
33330
|
if (!slotPath) {
|
|
33287
33331
|
continue;
|
|
33288
33332
|
}
|
|
33289
|
-
const fullPath = subPath ?
|
|
33333
|
+
const fullPath = subPath ? path47.join(slotPath, subPath) : slotPath;
|
|
33290
33334
|
if (!fs45.existsSync(fullPath)) {
|
|
33291
33335
|
failures.push(
|
|
33292
33336
|
`claude-code/${slot}${subPath ? `/${subPath}` : ""} missing in root ${root}: ${fullPath}`
|