@alessandroraffa/tangyr 0.21.2 → 0.21.4
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 +574 -495
- package/mappings/hook-events.yaml +44 -34
- 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) {
|
|
@@ -25757,7 +25777,11 @@ function compileCursorHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25757
25777
|
}
|
|
25758
25778
|
const untranslatable = /* @__PURE__ */ new Set();
|
|
25759
25779
|
hooks[mapping.target_event] = entries.map((entry) => {
|
|
25760
|
-
const matcher = entry.matcher === void 0 ? void 0 :
|
|
25780
|
+
const matcher = entry.matcher === void 0 ? void 0 : translateMatcher(
|
|
25781
|
+
entry.matcher,
|
|
25782
|
+
CURSOR_TOOL_NAMES,
|
|
25783
|
+
untranslatable
|
|
25784
|
+
);
|
|
25761
25785
|
return {
|
|
25762
25786
|
type: "command",
|
|
25763
25787
|
command: entry.command,
|
|
@@ -25795,6 +25819,23 @@ function compileCursorHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25795
25819
|
}
|
|
25796
25820
|
return { payload: hooks, translated, dropped, droppedEvents };
|
|
25797
25821
|
}
|
|
25822
|
+
function translateCopilotMatchers(payload, untranslatable) {
|
|
25823
|
+
const entries = Array.isArray(payload) ? payload : [payload];
|
|
25824
|
+
const translated = entries.map((entry) => {
|
|
25825
|
+
if (!isRecord(entry) || typeof entry.matcher !== "string") {
|
|
25826
|
+
return entry;
|
|
25827
|
+
}
|
|
25828
|
+
return {
|
|
25829
|
+
...entry,
|
|
25830
|
+
matcher: translateMatcher(
|
|
25831
|
+
entry.matcher,
|
|
25832
|
+
COPILOT_TOOL_NAMES,
|
|
25833
|
+
untranslatable
|
|
25834
|
+
)
|
|
25835
|
+
};
|
|
25836
|
+
});
|
|
25837
|
+
return Array.isArray(payload) ? translated : translated[0];
|
|
25838
|
+
}
|
|
25798
25839
|
function compileOpenCodeHooks(sourceHooksJson, lossReport, sourceLabel) {
|
|
25799
25840
|
const sourceHooks = isRecord(sourceHooksJson) && isRecord(sourceHooksJson.hooks) ? sourceHooksJson.hooks : {};
|
|
25800
25841
|
for (const eventName of Object.keys(sourceHooks)) {
|
|
@@ -25898,8 +25939,22 @@ function compileCopilotHooks(sourceHooksJson, mappings, lossReport, sourceLabel)
|
|
|
25898
25939
|
sourceEvent
|
|
25899
25940
|
);
|
|
25900
25941
|
if (mapping.status === "mapped" && mapping.target_event) {
|
|
25901
|
-
|
|
25942
|
+
const untranslatable = /* @__PURE__ */ new Set();
|
|
25943
|
+
hooks[mapping.target_event] = translateCopilotMatchers(
|
|
25944
|
+
payload,
|
|
25945
|
+
untranslatable
|
|
25946
|
+
);
|
|
25902
25947
|
translated += 1;
|
|
25948
|
+
if (untranslatable.size > 0) {
|
|
25949
|
+
addInformational(
|
|
25950
|
+
lossReport,
|
|
25951
|
+
"copilot",
|
|
25952
|
+
"hooks",
|
|
25953
|
+
sourceLabel,
|
|
25954
|
+
"warning",
|
|
25955
|
+
`${sourceEvent}: ${[...untranslatable].map((m) => `'${m}'`).join(", ")} ${untranslatable.size === 1 ? "names a tool" : "name tools"} with no known Copilot equivalent and ${untranslatable.size === 1 ? "was" : "were"} written through unchanged. Copilot matches on its own tool names \u2014 measured: bash, view, create, edit, grep \u2014 and the match is a full, case-sensitive regex, so a hook scoped to a name it does not use is accepted and never runs. To fix: add the name to COPILOT_TOOL_NAMES in the compiler once its Copilot equivalent has been measured.`
|
|
25956
|
+
);
|
|
25957
|
+
}
|
|
25903
25958
|
if (mapping.severity || mapping.reason) {
|
|
25904
25959
|
addInformational(
|
|
25905
25960
|
lossReport,
|
|
@@ -25943,21 +25998,39 @@ var CURSOR_TOOL_NAMES = {
|
|
|
25943
25998
|
Write: "Write",
|
|
25944
25999
|
Grep: "Grep"
|
|
25945
26000
|
};
|
|
25946
|
-
|
|
26001
|
+
var COPILOT_TOOL_NAMES = {
|
|
26002
|
+
Bash: "bash",
|
|
26003
|
+
Read: "view",
|
|
26004
|
+
Write: "create",
|
|
26005
|
+
Edit: "edit",
|
|
26006
|
+
MultiEdit: "edit",
|
|
26007
|
+
Grep: "grep",
|
|
26008
|
+
// Copilot's own names map to themselves, so a kit written against this
|
|
26009
|
+
// mapping is not reported as using something unknown.
|
|
26010
|
+
bash: "bash",
|
|
26011
|
+
view: "view",
|
|
26012
|
+
create: "create",
|
|
26013
|
+
edit: "edit",
|
|
26014
|
+
grep: "grep"
|
|
26015
|
+
};
|
|
26016
|
+
function translateMatcher(matcher, table, untranslatable) {
|
|
25947
26017
|
const translated = [];
|
|
25948
26018
|
for (const token of matcher.split("|")) {
|
|
25949
26019
|
const trimmed = token.trim();
|
|
25950
26020
|
if (!trimmed) continue;
|
|
25951
|
-
const mapped =
|
|
25952
|
-
if (mapped
|
|
25953
|
-
|
|
25954
|
-
if (!translated.includes(trimmed)) translated.push(trimmed);
|
|
26021
|
+
const mapped = table[trimmed];
|
|
26022
|
+
if (mapped !== void 0) {
|
|
26023
|
+
if (!translated.includes(mapped)) translated.push(mapped);
|
|
25955
26024
|
continue;
|
|
25956
26025
|
}
|
|
25957
|
-
if (
|
|
26026
|
+
if (PLAIN_TOOL_NAME.test(trimmed)) {
|
|
26027
|
+
untranslatable.add(trimmed);
|
|
26028
|
+
}
|
|
26029
|
+
if (!translated.includes(trimmed)) translated.push(trimmed);
|
|
25958
26030
|
}
|
|
25959
26031
|
return translated.join("|");
|
|
25960
26032
|
}
|
|
26033
|
+
var PLAIN_TOOL_NAME = /^[A-Za-z][A-Za-z0-9_-]*$/u;
|
|
25961
26034
|
function extractHookCommands(payload) {
|
|
25962
26035
|
const entries = Array.isArray(payload) ? payload : [payload];
|
|
25963
26036
|
const found = [];
|
|
@@ -26057,23 +26130,23 @@ function addHookLoss(lossReport, target, eventName, sourceLabel, severity, reaso
|
|
|
26057
26130
|
}
|
|
26058
26131
|
|
|
26059
26132
|
// src/core/hook-scripts.ts
|
|
26060
|
-
import
|
|
26133
|
+
import path32 from "path";
|
|
26061
26134
|
function hookScriptsDir(bridge, target) {
|
|
26062
26135
|
const globalBridge = resolveTargetPath("~/.agents/hooks");
|
|
26063
|
-
if (
|
|
26136
|
+
if (path32.resolve(bridge) === path32.resolve(globalBridge)) {
|
|
26064
26137
|
return { prefix: GLOBAL_HOOK_SCRIPTS_DIR, machineLocal: false };
|
|
26065
26138
|
}
|
|
26066
|
-
const relative =
|
|
26067
|
-
const insideProject = !relative.startsWith("..") && !
|
|
26139
|
+
const relative = path32.relative(process.cwd(), bridge);
|
|
26140
|
+
const insideProject = !relative.startsWith("..") && !path32.isAbsolute(relative) && relative !== "";
|
|
26068
26141
|
const variable = PROJECT_DIR_VARIABLE[target];
|
|
26069
26142
|
if (insideProject && variable) {
|
|
26070
|
-
const posix =
|
|
26071
|
-
relative.split(
|
|
26143
|
+
const posix = path32.posix.join(
|
|
26144
|
+
relative.split(path32.sep).join("/"),
|
|
26072
26145
|
"scripts"
|
|
26073
26146
|
);
|
|
26074
26147
|
return { prefix: `$${variable.slice(1)}/${posix}`, machineLocal: false };
|
|
26075
26148
|
}
|
|
26076
|
-
return { prefix:
|
|
26149
|
+
return { prefix: path32.join(bridge, "scripts"), machineLocal: true };
|
|
26077
26150
|
}
|
|
26078
26151
|
var PROJECT_DIR_VARIABLE = {
|
|
26079
26152
|
"claude-code": "$CLAUDE_PROJECT_DIR"
|
|
@@ -26361,7 +26434,7 @@ function compileOpenCodeMcp(sourceMcpJson, lossReport, sourceLabel) {
|
|
|
26361
26434
|
}
|
|
26362
26435
|
|
|
26363
26436
|
// src/compiler/rules.ts
|
|
26364
|
-
import
|
|
26437
|
+
import path33 from "path";
|
|
26365
26438
|
var import_yaml9 = __toESM(require_dist(), 1);
|
|
26366
26439
|
import fs33 from "fs";
|
|
26367
26440
|
function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
@@ -26400,13 +26473,13 @@ function compileRules(sourceRulesDir, target, _mappings, lossReport) {
|
|
|
26400
26473
|
}
|
|
26401
26474
|
const appendixParts = [];
|
|
26402
26475
|
const dotRulesFiles = [];
|
|
26403
|
-
for (const ruleFile of ts(
|
|
26476
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26404
26477
|
const parsed = parseRule(ruleFile);
|
|
26405
|
-
const name =
|
|
26478
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26406
26479
|
if (parsed.mode === "exec-policy") {
|
|
26407
26480
|
dotRulesFiles.push({
|
|
26408
26481
|
name: `${name}.rules`,
|
|
26409
|
-
content: `${formatProvenanceMarker("toml", `rules/${
|
|
26482
|
+
content: `${formatProvenanceMarker("toml", `rules/${path33.basename(ruleFile)}`, computeSourceHash(ruleFile), "codex")}
|
|
26410
26483
|
${parsed.body}`
|
|
26411
26484
|
});
|
|
26412
26485
|
continue;
|
|
@@ -26415,7 +26488,7 @@ ${parsed.body}`
|
|
|
26415
26488
|
|
|
26416
26489
|
${parsed.body.trim()}`);
|
|
26417
26490
|
addLoss(lossReport, "codex", "rules", {
|
|
26418
|
-
source: `rules/${
|
|
26491
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26419
26492
|
fields: [
|
|
26420
26493
|
{
|
|
26421
26494
|
field: "mode",
|
|
@@ -26425,7 +26498,7 @@ ${parsed.body.trim()}`);
|
|
|
26425
26498
|
"mode",
|
|
26426
26499
|
"rule-as-instruction"
|
|
26427
26500
|
),
|
|
26428
|
-
detail: `${
|
|
26501
|
+
detail: `${path33.basename(ruleFile)} is appended to the managed Codex instructions file as guidance.`
|
|
26429
26502
|
}
|
|
26430
26503
|
]
|
|
26431
26504
|
});
|
|
@@ -26457,14 +26530,14 @@ function isRuleMode(value) {
|
|
|
26457
26530
|
}
|
|
26458
26531
|
function compileOpenCodeRules(sourceRulesDir, lossReport) {
|
|
26459
26532
|
const appendixParts = [];
|
|
26460
|
-
for (const ruleFile of ts(
|
|
26533
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26461
26534
|
const parsed = parseRule(ruleFile);
|
|
26462
|
-
const name =
|
|
26535
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26463
26536
|
appendixParts.push(`## ${name}
|
|
26464
26537
|
|
|
26465
26538
|
${parsed.body.trim()}`);
|
|
26466
26539
|
addLoss(lossReport, "opencode", "rules", {
|
|
26467
|
-
source: `rules/${
|
|
26540
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26468
26541
|
fields: [
|
|
26469
26542
|
{
|
|
26470
26543
|
field: "rule",
|
|
@@ -26474,7 +26547,7 @@ ${parsed.body.trim()}`);
|
|
|
26474
26547
|
"rule",
|
|
26475
26548
|
"rule-path-scoping"
|
|
26476
26549
|
),
|
|
26477
|
-
detail: `${
|
|
26550
|
+
detail: `${path33.basename(ruleFile)}: OpenCode has no per-agent rule scoping \u2014 rule appended to AGENTS.md instructions`
|
|
26478
26551
|
}
|
|
26479
26552
|
]
|
|
26480
26553
|
});
|
|
@@ -26483,9 +26556,9 @@ ${parsed.body.trim()}`);
|
|
|
26483
26556
|
}
|
|
26484
26557
|
function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
26485
26558
|
const dotRulesFiles = [];
|
|
26486
|
-
for (const ruleFile of ts(
|
|
26559
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26487
26560
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26488
|
-
const name =
|
|
26561
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26489
26562
|
let frontmatterData = {};
|
|
26490
26563
|
let body = content;
|
|
26491
26564
|
if (content.startsWith("---\n")) {
|
|
@@ -26514,7 +26587,7 @@ function compileCursorRules(sourceRulesDir, _lossReport) {
|
|
|
26514
26587
|
}
|
|
26515
26588
|
const marker = formatProvenanceMarker(
|
|
26516
26589
|
"markdown",
|
|
26517
|
-
`rules/${
|
|
26590
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26518
26591
|
computeSourceHash(ruleFile),
|
|
26519
26592
|
"cursor"
|
|
26520
26593
|
);
|
|
@@ -26530,9 +26603,9 @@ ${body}`;
|
|
|
26530
26603
|
}
|
|
26531
26604
|
function compileClineRules(sourceRulesDir, lossReport) {
|
|
26532
26605
|
const dotRulesFiles = [];
|
|
26533
|
-
for (const ruleFile of ts(
|
|
26606
|
+
for (const ruleFile of ts(path33.join(sourceRulesDir, "*.md")).sort()) {
|
|
26534
26607
|
const content = fs33.readFileSync(ruleFile, "utf8");
|
|
26535
|
-
const name =
|
|
26608
|
+
const name = path33.basename(ruleFile, ".md");
|
|
26536
26609
|
let frontmatterData = {};
|
|
26537
26610
|
let body = content;
|
|
26538
26611
|
if (content.startsWith("---\n")) {
|
|
@@ -26549,13 +26622,13 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26549
26622
|
}
|
|
26550
26623
|
const marker = formatProvenanceMarker(
|
|
26551
26624
|
"markdown",
|
|
26552
|
-
`rules/${
|
|
26625
|
+
`rules/${path33.basename(ruleFile)}`,
|
|
26553
26626
|
computeSourceHash(ruleFile),
|
|
26554
26627
|
"cline"
|
|
26555
26628
|
);
|
|
26556
26629
|
if (frontmatterData.mode === "exec-policy") {
|
|
26557
26630
|
addLoss(lossReport, "cline", "rules", {
|
|
26558
|
-
source: `rules/${
|
|
26631
|
+
source: `rules/${path33.basename(ruleFile)}`,
|
|
26559
26632
|
fields: [
|
|
26560
26633
|
{
|
|
26561
26634
|
field: "mode",
|
|
@@ -26565,7 +26638,7 @@ function compileClineRules(sourceRulesDir, lossReport) {
|
|
|
26565
26638
|
"mode",
|
|
26566
26639
|
"rule-mode-downgrade"
|
|
26567
26640
|
),
|
|
26568
|
-
detail: `${
|
|
26641
|
+
detail: `${path33.basename(ruleFile)}: Cline rules have no exec-policy mode; rule emitted as guidance.`
|
|
26569
26642
|
}
|
|
26570
26643
|
]
|
|
26571
26644
|
});
|
|
@@ -26611,7 +26684,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26611
26684
|
rules: profile.rules
|
|
26612
26685
|
};
|
|
26613
26686
|
const rules = compileRules(
|
|
26614
|
-
|
|
26687
|
+
path34.join(sourceRoot, config.source.rules),
|
|
26615
26688
|
"codex",
|
|
26616
26689
|
mappings,
|
|
26617
26690
|
lossReport
|
|
@@ -26677,7 +26750,7 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26677
26750
|
if (!shouldSkipComponent(options, "hooks")) {
|
|
26678
26751
|
outcomes.push(
|
|
26679
26752
|
syncHookScriptsBridge({
|
|
26680
|
-
source:
|
|
26753
|
+
source: path34.resolve(sourceRoot, config.source.hooks),
|
|
26681
26754
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
26682
26755
|
config,
|
|
26683
26756
|
sourceRoot,
|
|
@@ -26776,9 +26849,9 @@ function syncCodex(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
26776
26849
|
function buildProviderTomlSection(config, sourceRoot, mappings, scope, lossReport) {
|
|
26777
26850
|
const cp = mappings.modelTiers.custom_provider;
|
|
26778
26851
|
if (!cp) return "";
|
|
26779
|
-
const agentsDir =
|
|
26852
|
+
const agentsDir = path34.join(sourceRoot, config.source.agents);
|
|
26780
26853
|
if (!fs34.existsSync(agentsDir)) return "";
|
|
26781
|
-
const agentFiles = ts(
|
|
26854
|
+
const agentFiles = ts(path34.join(agentsDir, "*.md")).sort();
|
|
26782
26855
|
const hasProviderAgent = agentFiles.some((agentFile) => {
|
|
26783
26856
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
26784
26857
|
return typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
@@ -26843,7 +26916,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26843
26916
|
}
|
|
26844
26917
|
];
|
|
26845
26918
|
for (const ruleFile of rules.dotRulesFiles) {
|
|
26846
|
-
const destination =
|
|
26919
|
+
const destination = path34.join(rulesRoot, ruleFile.name);
|
|
26847
26920
|
if (options.dryRun) {
|
|
26848
26921
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
26849
26922
|
outcomes.push({
|
|
@@ -26871,7 +26944,7 @@ function syncRules(config, sourceRoot, paths, rules, options, logger, manifest,
|
|
|
26871
26944
|
return outcomes;
|
|
26872
26945
|
}
|
|
26873
26946
|
function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
26874
|
-
const source =
|
|
26947
|
+
const source = path34.join(sourceRoot, config.source.instructions);
|
|
26875
26948
|
const destination = resolveTargetPath(paths.instructions);
|
|
26876
26949
|
const composed = `${fs34.readFileSync(source, "utf8").trim()}
|
|
26877
26950
|
|
|
@@ -26879,7 +26952,7 @@ function syncInstructions(config, sourceRoot, paths, agentsAppendix, options, lo
|
|
|
26879
26952
|
${agentsAppendix}`.trim();
|
|
26880
26953
|
const marker = formatProvenanceMarker(
|
|
26881
26954
|
"markdown",
|
|
26882
|
-
|
|
26955
|
+
path34.basename(config.source.instructions),
|
|
26883
26956
|
hashString(composed),
|
|
26884
26957
|
"codex"
|
|
26885
26958
|
);
|
|
@@ -26906,7 +26979,7 @@ ${composed}
|
|
|
26906
26979
|
);
|
|
26907
26980
|
}
|
|
26908
26981
|
function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
26909
|
-
const source =
|
|
26982
|
+
const source = path34.resolve(sourceRoot, config.source.skills);
|
|
26910
26983
|
const destination = resolveTargetPath(paths.skills);
|
|
26911
26984
|
if (!fs34.existsSync(source)) {
|
|
26912
26985
|
return skippedMissingSource("skills", source);
|
|
@@ -26931,22 +27004,22 @@ function syncSkills(config, sourceRoot, paths, options, logger, manifest, scopeP
|
|
|
26931
27004
|
} else if (artifactClass === "managed-symlink") {
|
|
26932
27005
|
fs34.unlinkSync(destination);
|
|
26933
27006
|
}
|
|
26934
|
-
ensureDir(
|
|
27007
|
+
ensureDir(path34.dirname(destination));
|
|
26935
27008
|
createRelativeSymlink(source, destination, "dir");
|
|
26936
27009
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
26937
27010
|
return { component: "skills", status: "success", path: destination };
|
|
26938
27011
|
}
|
|
26939
27012
|
function syncAgents(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
26940
|
-
const sourceAgentsRoot =
|
|
27013
|
+
const sourceAgentsRoot = path34.join(sourceRoot, config.source.agents);
|
|
26941
27014
|
if (!fs34.existsSync(sourceAgentsRoot)) {
|
|
26942
27015
|
return [skippedMissingSource("agents", sourceAgentsRoot)];
|
|
26943
27016
|
}
|
|
26944
|
-
const sourceAgents = ts(
|
|
27017
|
+
const sourceAgents = ts(path34.join(sourceAgentsRoot, "*.md")).sort();
|
|
26945
27018
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
26946
27019
|
return sourceAgents.map((agentFile) => {
|
|
26947
|
-
const destination =
|
|
27020
|
+
const destination = path34.join(
|
|
26948
27021
|
agentsRoot,
|
|
26949
|
-
`${
|
|
27022
|
+
`${path34.basename(agentFile, ".md")}.toml`
|
|
26950
27023
|
);
|
|
26951
27024
|
const compiled = compileAgent(
|
|
26952
27025
|
agentFile,
|
|
@@ -27073,7 +27146,7 @@ function writeCompiledArtifact(component, destination, content, expectedHash, co
|
|
|
27073
27146
|
if (artifactClass === "unmanaged-conflict" && !handleConflict(destination, config, options, logger, manifest, scopePath)) {
|
|
27074
27147
|
return { component, status: "conflict", path: destination };
|
|
27075
27148
|
}
|
|
27076
|
-
ensureDir(
|
|
27149
|
+
ensureDir(path34.dirname(destination));
|
|
27077
27150
|
fs34.writeFileSync(destination, content);
|
|
27078
27151
|
return { component, status: "success", path: destination };
|
|
27079
27152
|
}
|
|
@@ -27094,7 +27167,7 @@ ${managedMcpEnd}
|
|
|
27094
27167
|
if (current === next.trimStart()) {
|
|
27095
27168
|
return false;
|
|
27096
27169
|
}
|
|
27097
|
-
ensureDir(
|
|
27170
|
+
ensureDir(path34.dirname(destination));
|
|
27098
27171
|
fs34.writeFileSync(destination, next.trimStart());
|
|
27099
27172
|
return true;
|
|
27100
27173
|
}
|
|
@@ -27176,15 +27249,15 @@ function hashString(value) {
|
|
|
27176
27249
|
// src/adapters/copilot.ts
|
|
27177
27250
|
import crypto6 from "crypto";
|
|
27178
27251
|
import fs35 from "fs";
|
|
27179
|
-
import
|
|
27252
|
+
import path36 from "path";
|
|
27180
27253
|
|
|
27181
27254
|
// src/compiler/commands.ts
|
|
27182
27255
|
var import_yaml10 = __toESM(require_dist(), 1);
|
|
27183
|
-
import
|
|
27256
|
+
import path35 from "path";
|
|
27184
27257
|
function compileCommandPrompt(sourceFile) {
|
|
27185
27258
|
const { data, body } = parseMarkdownFrontmatter(sourceFile);
|
|
27186
|
-
const relativeSource = `commands/${
|
|
27187
|
-
const fields = promptFrontmatter(data,
|
|
27259
|
+
const relativeSource = `commands/${path35.basename(sourceFile)}`;
|
|
27260
|
+
const fields = promptFrontmatter(data, path35.basename(sourceFile, ".md"));
|
|
27188
27261
|
const marker = formatProvenanceMarker(
|
|
27189
27262
|
"markdown",
|
|
27190
27263
|
relativeSource,
|
|
@@ -27299,7 +27372,7 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27299
27372
|
if (!shouldSkipComponent2(options, "hooks")) {
|
|
27300
27373
|
outcomes.push(
|
|
27301
27374
|
syncHookScriptsBridge({
|
|
27302
|
-
source:
|
|
27375
|
+
source: path36.resolve(sourceRoot, config.source.hooks),
|
|
27303
27376
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27304
27377
|
config,
|
|
27305
27378
|
sourceRoot,
|
|
@@ -27380,13 +27453,13 @@ function syncCopilot(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
27380
27453
|
}
|
|
27381
27454
|
function syncProviderLoss(config, sourceRoot, mappings, lossReport) {
|
|
27382
27455
|
if (!mappings.modelTiers.custom_provider) return;
|
|
27383
|
-
const agentsDir =
|
|
27456
|
+
const agentsDir = path36.join(sourceRoot, config.source.agents);
|
|
27384
27457
|
if (!fs35.existsSync(agentsDir)) return;
|
|
27385
|
-
for (const agentFile of ts(
|
|
27458
|
+
for (const agentFile of ts(path36.join(agentsDir, "*.md")).sort()) {
|
|
27386
27459
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
27387
27460
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
27388
27461
|
if (hasProvider) {
|
|
27389
|
-
const basename =
|
|
27462
|
+
const basename = path36.basename(agentFile);
|
|
27390
27463
|
addLoss(lossReport, "copilot", "agents", {
|
|
27391
27464
|
source: `agents/${basename}`,
|
|
27392
27465
|
fields: [
|
|
@@ -27411,7 +27484,7 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27411
27484
|
logger.verbose(message);
|
|
27412
27485
|
return [{ component: "instructions", status: "skipped", path: message }];
|
|
27413
27486
|
}
|
|
27414
|
-
const source =
|
|
27487
|
+
const source = path36.resolve(sourceRoot, config.source.instructions);
|
|
27415
27488
|
if (!fs35.existsSync(source)) {
|
|
27416
27489
|
return [skippedMissingSource2("instructions", source)];
|
|
27417
27490
|
}
|
|
@@ -27419,15 +27492,15 @@ function syncCopilotInstructions(config, sourceRoot, options, lossReport, logger
|
|
|
27419
27492
|
const contentHash = hashString2(rawContent);
|
|
27420
27493
|
const marker = formatProvenanceMarker(
|
|
27421
27494
|
"markdown",
|
|
27422
|
-
|
|
27495
|
+
path36.basename(config.source.instructions),
|
|
27423
27496
|
contentHash,
|
|
27424
27497
|
"copilot"
|
|
27425
27498
|
);
|
|
27426
27499
|
const composedContent = `${marker}
|
|
27427
27500
|
${rawContent}`;
|
|
27428
27501
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
27429
|
-
const agentsMdDest =
|
|
27430
|
-
const mirrorDest =
|
|
27502
|
+
const agentsMdDest = path36.resolve(projectRoot, "AGENTS.md");
|
|
27503
|
+
const mirrorDest = path36.resolve(
|
|
27431
27504
|
projectRoot,
|
|
27432
27505
|
".github",
|
|
27433
27506
|
"copilot-instructions.md"
|
|
@@ -27481,7 +27554,7 @@ function writeInstructionsFile(component, destination, content, contentHash, con
|
|
|
27481
27554
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27482
27555
|
return { component, status: "conflict", path: destination };
|
|
27483
27556
|
}
|
|
27484
|
-
ensureDir(
|
|
27557
|
+
ensureDir(path36.dirname(destination));
|
|
27485
27558
|
fs35.writeFileSync(destination, content);
|
|
27486
27559
|
return { component, status: "success", path: destination };
|
|
27487
27560
|
}
|
|
@@ -27489,7 +27562,7 @@ function hashString2(value) {
|
|
|
27489
27562
|
return `sha256:${crypto6.createHash("sha256").update(value).digest("hex")}`;
|
|
27490
27563
|
}
|
|
27491
27564
|
function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27492
|
-
const source =
|
|
27565
|
+
const source = path36.resolve(sourceRoot, config.source.skills);
|
|
27493
27566
|
const destination = resolveTargetPath(paths.skills);
|
|
27494
27567
|
if (!fs35.existsSync(source)) {
|
|
27495
27568
|
return skippedMissingSource2("skills", source);
|
|
@@ -27513,21 +27586,21 @@ function syncSkills2(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
27513
27586
|
} else if (artifactClass === "managed-symlink") {
|
|
27514
27587
|
fs35.unlinkSync(destination);
|
|
27515
27588
|
}
|
|
27516
|
-
ensureDir(
|
|
27589
|
+
ensureDir(path36.dirname(destination));
|
|
27517
27590
|
createRelativeSymlink(source, destination, "dir");
|
|
27518
27591
|
return { component: "skills", status: "success", path: destination };
|
|
27519
27592
|
}
|
|
27520
27593
|
function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27521
|
-
const sourceAgentsRoot =
|
|
27594
|
+
const sourceAgentsRoot = path36.join(sourceRoot, config.source.agents);
|
|
27522
27595
|
if (!fs35.existsSync(sourceAgentsRoot)) {
|
|
27523
27596
|
return [skippedMissingSource2("agents", sourceAgentsRoot)];
|
|
27524
27597
|
}
|
|
27525
|
-
const sourceAgents = ts(
|
|
27598
|
+
const sourceAgents = ts(path36.join(sourceAgentsRoot, "*.md")).sort();
|
|
27526
27599
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
27527
27600
|
return sourceAgents.map((agentFile) => {
|
|
27528
|
-
const destination =
|
|
27601
|
+
const destination = path36.join(
|
|
27529
27602
|
agentsRoot,
|
|
27530
|
-
`${
|
|
27603
|
+
`${path36.basename(agentFile, ".md")}.agent.md`
|
|
27531
27604
|
);
|
|
27532
27605
|
const compiled = compileAgent(
|
|
27533
27606
|
agentFile,
|
|
@@ -27555,16 +27628,16 @@ function syncAgents2(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
27555
27628
|
});
|
|
27556
27629
|
}
|
|
27557
27630
|
function syncCommands(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
27558
|
-
const sourceCommandsRoot =
|
|
27631
|
+
const sourceCommandsRoot = path36.join(sourceRoot, config.source.commands);
|
|
27559
27632
|
if (!fs35.existsSync(sourceCommandsRoot)) {
|
|
27560
27633
|
return [skippedMissingSource2("commands", sourceCommandsRoot)];
|
|
27561
27634
|
}
|
|
27562
|
-
const sourceCommands = ts(
|
|
27635
|
+
const sourceCommands = ts(path36.join(sourceCommandsRoot, "*.md")).sort();
|
|
27563
27636
|
const promptsRoot = resolveTargetPath(paths.prompts);
|
|
27564
27637
|
return sourceCommands.map((commandFile) => {
|
|
27565
|
-
const destination =
|
|
27638
|
+
const destination = path36.join(
|
|
27566
27639
|
promptsRoot,
|
|
27567
|
-
`${
|
|
27640
|
+
`${path36.basename(commandFile, ".md")}.prompt.md`
|
|
27568
27641
|
);
|
|
27569
27642
|
const compiled = compileCommandPrompt(commandFile);
|
|
27570
27643
|
if (options.dryRun) {
|
|
@@ -27588,7 +27661,7 @@ function syncCommands(config, sourceRoot, paths, options, logger, manifest, scop
|
|
|
27588
27661
|
});
|
|
27589
27662
|
}
|
|
27590
27663
|
function syncHooks2(config, sourceRoot, paths, mappings, options, lossReport, logger) {
|
|
27591
|
-
const destination =
|
|
27664
|
+
const destination = path36.join(
|
|
27592
27665
|
resolveTargetPath(paths.hooks),
|
|
27593
27666
|
"tangyr-managed.json"
|
|
27594
27667
|
);
|
|
@@ -27683,7 +27756,7 @@ function writeCompiledArtifact2(component, destination, content, expectedHash, c
|
|
|
27683
27756
|
if (artifactClass === "unmanaged-conflict" && !handleConflict2(destination, config, options, logger, manifest, scopePath)) {
|
|
27684
27757
|
return { component, status: "conflict", path: destination };
|
|
27685
27758
|
}
|
|
27686
|
-
ensureDir(
|
|
27759
|
+
ensureDir(path36.dirname(destination));
|
|
27687
27760
|
fs35.writeFileSync(destination, content);
|
|
27688
27761
|
return { component, status: "success", path: destination };
|
|
27689
27762
|
}
|
|
@@ -27725,12 +27798,12 @@ function shouldSkipComponent2(options, component) {
|
|
|
27725
27798
|
function cleanupLegacyAgents(paths, options, logger) {
|
|
27726
27799
|
const currentAgentsRoot = resolveTargetPath(paths.agents);
|
|
27727
27800
|
const legacyAgentsRoot = resolveTargetPath(legacyCopilotAgentsPath);
|
|
27728
|
-
if (
|
|
27801
|
+
if (path36.resolve(currentAgentsRoot) === path36.resolve(legacyAgentsRoot)) {
|
|
27729
27802
|
return [];
|
|
27730
27803
|
}
|
|
27731
27804
|
const outcomes = [];
|
|
27732
27805
|
for (const filePath of ts(
|
|
27733
|
-
|
|
27806
|
+
path36.join(legacyAgentsRoot, "*.agent.md")
|
|
27734
27807
|
).sort()) {
|
|
27735
27808
|
if (!isCopilotManagedCompiledFile(filePath)) {
|
|
27736
27809
|
continue;
|
|
@@ -27770,7 +27843,7 @@ function isSymlinkTo3(linkPath, source) {
|
|
|
27770
27843
|
// src/adapters/cursor.ts
|
|
27771
27844
|
import crypto7 from "crypto";
|
|
27772
27845
|
import fs36 from "fs";
|
|
27773
|
-
import
|
|
27846
|
+
import path37 from "path";
|
|
27774
27847
|
function syncCursor(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
27775
27848
|
const scope = options.scope ?? "global";
|
|
27776
27849
|
const profile = resolveTargetPaths({
|
|
@@ -27882,7 +27955,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27882
27955
|
if (!shouldSkipComponent3(options, "hooks")) {
|
|
27883
27956
|
outcomes.push(
|
|
27884
27957
|
syncHookScriptsBridge({
|
|
27885
|
-
source:
|
|
27958
|
+
source: path37.resolve(sourceRoot, config.source.hooks),
|
|
27886
27959
|
destination: resolveTargetPath(paths.hook_scripts),
|
|
27887
27960
|
config,
|
|
27888
27961
|
sourceRoot,
|
|
@@ -27942,7 +28015,7 @@ function syncCursor(config, sourceRoot, mappings, extensions, options, lossRepor
|
|
|
27942
28015
|
return { target: "cursor", outcomes };
|
|
27943
28016
|
}
|
|
27944
28017
|
function syncInstructions2(config, sourceRoot, paths, options, lossReport, logger, manifest, scopePath) {
|
|
27945
|
-
const source =
|
|
28018
|
+
const source = path37.join(sourceRoot, config.source.instructions);
|
|
27946
28019
|
const destination = resolveTargetPath(paths.instructions);
|
|
27947
28020
|
const baseContent = fs36.existsSync(source) ? fs36.readFileSync(source, "utf8").trim() : "";
|
|
27948
28021
|
const personaContent = extractPrimaryPersonaContent(
|
|
@@ -27957,7 +28030,7 @@ function syncInstructions2(config, sourceRoot, paths, options, lossReport, logge
|
|
|
27957
28030
|
${personaContent}`.trim() : baseContent;
|
|
27958
28031
|
const marker = formatProvenanceMarker(
|
|
27959
28032
|
"markdown",
|
|
27960
|
-
|
|
28033
|
+
path37.basename(config.source.instructions),
|
|
27961
28034
|
hashString3(composed),
|
|
27962
28035
|
"cursor"
|
|
27963
28036
|
);
|
|
@@ -27982,11 +28055,11 @@ ${composed}
|
|
|
27982
28055
|
);
|
|
27983
28056
|
}
|
|
27984
28057
|
function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
27985
|
-
const agentsDir =
|
|
28058
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
27986
28059
|
if (!fs36.existsSync(agentsDir)) {
|
|
27987
28060
|
return null;
|
|
27988
28061
|
}
|
|
27989
|
-
const agentFiles = ts(
|
|
28062
|
+
const agentFiles = ts(path37.join(agentsDir, "*.md")).sort();
|
|
27990
28063
|
if (agentFiles.length === 0) {
|
|
27991
28064
|
return null;
|
|
27992
28065
|
}
|
|
@@ -28009,7 +28082,7 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
28009
28082
|
return null;
|
|
28010
28083
|
}
|
|
28011
28084
|
addLoss(lossReport, "cursor", "instructions", {
|
|
28012
|
-
source: `agents/${
|
|
28085
|
+
source: `agents/${path37.basename(primaryFile)}`,
|
|
28013
28086
|
fields: [
|
|
28014
28087
|
{
|
|
28015
28088
|
field: "persona",
|
|
@@ -28019,23 +28092,23 @@ function extractPrimaryPersonaContent(config, sourceRoot, lossReport) {
|
|
|
28019
28092
|
"persona",
|
|
28020
28093
|
"instructions-shim"
|
|
28021
28094
|
),
|
|
28022
|
-
detail: `Primary persona from ${
|
|
28095
|
+
detail: `Primary persona from ${path37.basename(primaryFile)} folded into AGENTS.md (Cursor has no custom modes surface)`
|
|
28023
28096
|
}
|
|
28024
28097
|
]
|
|
28025
28098
|
});
|
|
28026
28099
|
return body.trim();
|
|
28027
28100
|
}
|
|
28028
28101
|
function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28029
|
-
const sourceAgentsRoot =
|
|
28102
|
+
const sourceAgentsRoot = path37.join(sourceRoot, config.source.agents);
|
|
28030
28103
|
if (!fs36.existsSync(sourceAgentsRoot)) {
|
|
28031
28104
|
return [skippedMissingSource3("agents", sourceAgentsRoot)];
|
|
28032
28105
|
}
|
|
28033
|
-
const sourceAgents = ts(
|
|
28106
|
+
const sourceAgents = ts(path37.join(sourceAgentsRoot, "*.md")).sort();
|
|
28034
28107
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
28035
28108
|
return sourceAgents.map((agentFile) => {
|
|
28036
|
-
const destination =
|
|
28109
|
+
const destination = path37.join(
|
|
28037
28110
|
agentsRoot,
|
|
28038
|
-
`${
|
|
28111
|
+
`${path37.basename(agentFile, ".md")}.md`
|
|
28039
28112
|
);
|
|
28040
28113
|
let compiled;
|
|
28041
28114
|
try {
|
|
@@ -28076,14 +28149,14 @@ function syncAgents3(config, sourceRoot, paths, mappings, extensions, options, l
|
|
|
28076
28149
|
});
|
|
28077
28150
|
}
|
|
28078
28151
|
function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28079
|
-
const sourceRulesDir =
|
|
28152
|
+
const sourceRulesDir = path37.join(sourceRoot, config.source.rules);
|
|
28080
28153
|
if (!fs36.existsSync(sourceRulesDir)) {
|
|
28081
28154
|
return [skippedMissingSource3("rules", sourceRulesDir)];
|
|
28082
28155
|
}
|
|
28083
28156
|
const compiled = compileRules(sourceRulesDir, "cursor", mappings, lossReport);
|
|
28084
28157
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28085
28158
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28086
|
-
const destination =
|
|
28159
|
+
const destination = path37.join(rulesDir, name);
|
|
28087
28160
|
if (options.dryRun) {
|
|
28088
28161
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28089
28162
|
return {
|
|
@@ -28107,17 +28180,17 @@ function syncRules2(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28107
28180
|
});
|
|
28108
28181
|
}
|
|
28109
28182
|
function syncCommands2(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28110
|
-
const sourceCommandsRoot =
|
|
28183
|
+
const sourceCommandsRoot = path37.join(sourceRoot, config.source.commands);
|
|
28111
28184
|
if (!fs36.existsSync(sourceCommandsRoot)) {
|
|
28112
28185
|
return [skippedMissingSource3("commands", sourceCommandsRoot)];
|
|
28113
28186
|
}
|
|
28114
|
-
const sourceCommands = ts(
|
|
28187
|
+
const sourceCommands = ts(path37.join(sourceCommandsRoot, "*.md")).sort();
|
|
28115
28188
|
const skillsRoot = resolveTargetPath(paths.skills);
|
|
28116
28189
|
return sourceCommands.map((commandFile) => {
|
|
28117
|
-
const baseName =
|
|
28118
|
-
const destination =
|
|
28190
|
+
const baseName = path37.basename(commandFile, ".md");
|
|
28191
|
+
const destination = path37.join(skillsRoot, baseName, "SKILL.md");
|
|
28119
28192
|
const commandContent = fs36.readFileSync(commandFile, "utf8");
|
|
28120
|
-
const relativeSource = `commands/${
|
|
28193
|
+
const relativeSource = `commands/${path37.basename(commandFile)}`;
|
|
28121
28194
|
const marker = formatProvenanceMarker(
|
|
28122
28195
|
"markdown",
|
|
28123
28196
|
relativeSource,
|
|
@@ -28156,7 +28229,7 @@ ${commandContent.trim()}
|
|
|
28156
28229
|
});
|
|
28157
28230
|
}
|
|
28158
28231
|
function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, component = "skills", destination = "", asSymlink = false) {
|
|
28159
|
-
const source =
|
|
28232
|
+
const source = path37.resolve(sourceRoot, config.source.skills);
|
|
28160
28233
|
if (!fs36.existsSync(source)) {
|
|
28161
28234
|
return skippedMissingSource3(component, source);
|
|
28162
28235
|
}
|
|
@@ -28177,7 +28250,7 @@ function syncSkills3(config, sourceRoot, options, logger, manifest, scopePath, c
|
|
|
28177
28250
|
} else if (artifactClass === "managed-symlink") {
|
|
28178
28251
|
fs36.unlinkSync(destination);
|
|
28179
28252
|
}
|
|
28180
|
-
ensureDir(
|
|
28253
|
+
ensureDir(path37.dirname(destination));
|
|
28181
28254
|
createRelativeSymlink(source, destination, "dir");
|
|
28182
28255
|
logger.verbose(`Skills: created shared skills symlink ${destination}`);
|
|
28183
28256
|
return { component, status: "success", path: destination };
|
|
@@ -28222,7 +28295,7 @@ function syncHooks3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28222
28295
|
}
|
|
28223
28296
|
const hooksFileContent = `${JSON.stringify({ version: 1, hooks: compiled.payload }, null, 2)}
|
|
28224
28297
|
`;
|
|
28225
|
-
ensureDir(
|
|
28298
|
+
ensureDir(path37.dirname(destination));
|
|
28226
28299
|
fs36.writeFileSync(destination, hooksFileContent);
|
|
28227
28300
|
return { component: "hooks", status: "success", path: destination };
|
|
28228
28301
|
}
|
|
@@ -28284,13 +28357,13 @@ function syncPermissions(config, paths, options, _lossReport, logger, manifest,
|
|
|
28284
28357
|
);
|
|
28285
28358
|
}
|
|
28286
28359
|
function syncProviderPin(config, sourceRoot, lossReport) {
|
|
28287
|
-
const agentsDir =
|
|
28360
|
+
const agentsDir = path37.join(sourceRoot, config.source.agents);
|
|
28288
28361
|
if (!fs36.existsSync(agentsDir)) return;
|
|
28289
|
-
for (const agentFile of ts(
|
|
28362
|
+
for (const agentFile of ts(path37.join(agentsDir, "*.md")).sort()) {
|
|
28290
28363
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28291
28364
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28292
28365
|
if (hasCustomProvider) {
|
|
28293
|
-
const relativeSource = `agents/${
|
|
28366
|
+
const relativeSource = `agents/${path37.basename(agentFile)}`;
|
|
28294
28367
|
addLoss(lossReport, "cursor", "agents", {
|
|
28295
28368
|
source: relativeSource,
|
|
28296
28369
|
fields: [
|
|
@@ -28302,7 +28375,7 @@ function syncProviderPin(config, sourceRoot, lossReport) {
|
|
|
28302
28375
|
"provider",
|
|
28303
28376
|
"provider-not-representable"
|
|
28304
28377
|
),
|
|
28305
|
-
detail: `${
|
|
28378
|
+
detail: `${path37.basename(agentFile)}: custom provider cannot be expressed in Cursor subagent frontmatter \u2014 configure manually via Cursor settings`
|
|
28306
28379
|
}
|
|
28307
28380
|
]
|
|
28308
28381
|
});
|
|
@@ -28317,7 +28390,7 @@ function writeCompiledArtifact3(component, destination, content, expectedHash, c
|
|
|
28317
28390
|
if (artifactClass === "unmanaged-conflict" && !handleConflict3(destination, config, options, logger, manifest, scopePath)) {
|
|
28318
28391
|
return { component, status: "conflict", path: destination };
|
|
28319
28392
|
}
|
|
28320
|
-
ensureDir(
|
|
28393
|
+
ensureDir(path37.dirname(destination));
|
|
28321
28394
|
fs36.writeFileSync(destination, content);
|
|
28322
28395
|
return { component, status: "success", path: destination };
|
|
28323
28396
|
}
|
|
@@ -28377,7 +28450,7 @@ function hashString3(value) {
|
|
|
28377
28450
|
// src/adapters/cline.ts
|
|
28378
28451
|
import crypto8 from "crypto";
|
|
28379
28452
|
import fs37 from "fs";
|
|
28380
|
-
import
|
|
28453
|
+
import path38 from "path";
|
|
28381
28454
|
function syncCline(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28382
28455
|
const scope = options.scope ?? "global";
|
|
28383
28456
|
const profile = resolveTargetPaths({
|
|
@@ -28490,7 +28563,7 @@ function syncCline(config, sourceRoot, mappings, extensions, options, lossReport
|
|
|
28490
28563
|
function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport, logger, manifest, scopePath) {
|
|
28491
28564
|
if (scope === "global" || paths.instructions === null) {
|
|
28492
28565
|
addLoss(lossReport, "cline", "instructions", {
|
|
28493
|
-
source:
|
|
28566
|
+
source: path38.basename(config.source.instructions),
|
|
28494
28567
|
fields: [
|
|
28495
28568
|
{
|
|
28496
28569
|
field: "instructions",
|
|
@@ -28510,12 +28583,12 @@ function syncInstructions3(config, sourceRoot, paths, scope, options, lossReport
|
|
|
28510
28583
|
path: "cline/global/instructions: no committable global path"
|
|
28511
28584
|
};
|
|
28512
28585
|
}
|
|
28513
|
-
const source =
|
|
28586
|
+
const source = path38.join(sourceRoot, config.source.instructions);
|
|
28514
28587
|
const destination = resolveTargetPath(paths.instructions);
|
|
28515
28588
|
const baseContent = fs37.existsSync(source) ? fs37.readFileSync(source, "utf8").trim() : "";
|
|
28516
28589
|
const marker = formatProvenanceMarker(
|
|
28517
28590
|
"markdown",
|
|
28518
|
-
|
|
28591
|
+
path38.basename(config.source.instructions),
|
|
28519
28592
|
hashString4(baseContent),
|
|
28520
28593
|
"cline"
|
|
28521
28594
|
);
|
|
@@ -28540,11 +28613,11 @@ ${baseContent}
|
|
|
28540
28613
|
);
|
|
28541
28614
|
}
|
|
28542
28615
|
function syncAgents4(config, sourceRoot, mappings, extensions, options, lossReport, logger) {
|
|
28543
|
-
const sourceAgentsRoot =
|
|
28616
|
+
const sourceAgentsRoot = path38.join(sourceRoot, config.source.agents);
|
|
28544
28617
|
if (!fs37.existsSync(sourceAgentsRoot)) {
|
|
28545
28618
|
return [skippedMissingSource4("agents", sourceAgentsRoot)];
|
|
28546
28619
|
}
|
|
28547
|
-
const sourceAgents = ts(
|
|
28620
|
+
const sourceAgents = ts(path38.join(sourceAgentsRoot, "*.md")).sort();
|
|
28548
28621
|
return sourceAgents.map((agentFile) => {
|
|
28549
28622
|
compileAgent(agentFile, "cline", mappings, extensions, lossReport);
|
|
28550
28623
|
if (options.dryRun) {
|
|
@@ -28560,14 +28633,14 @@ function syncAgents4(config, sourceRoot, mappings, extensions, options, lossRepo
|
|
|
28560
28633
|
});
|
|
28561
28634
|
}
|
|
28562
28635
|
function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, logger, manifest, scopePath) {
|
|
28563
|
-
const sourceRulesDir =
|
|
28636
|
+
const sourceRulesDir = path38.join(sourceRoot, config.source.rules);
|
|
28564
28637
|
if (!fs37.existsSync(sourceRulesDir)) {
|
|
28565
28638
|
return [skippedMissingSource4("rules", sourceRulesDir)];
|
|
28566
28639
|
}
|
|
28567
28640
|
const compiled = compileRules(sourceRulesDir, "cline", mappings, lossReport);
|
|
28568
28641
|
const rulesDir = resolveTargetPath(paths.rules);
|
|
28569
28642
|
return compiled.dotRulesFiles.map(({ name, content }) => {
|
|
28570
|
-
const destination =
|
|
28643
|
+
const destination = path38.join(rulesDir, name);
|
|
28571
28644
|
if (options.dryRun) {
|
|
28572
28645
|
logger.info(`[dry-run] rules: write ${destination}`);
|
|
28573
28646
|
return {
|
|
@@ -28591,17 +28664,17 @@ function syncRules3(config, sourceRoot, paths, mappings, options, lossReport, lo
|
|
|
28591
28664
|
});
|
|
28592
28665
|
}
|
|
28593
28666
|
function syncCommands3(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28594
|
-
const sourceCommandsRoot =
|
|
28667
|
+
const sourceCommandsRoot = path38.join(sourceRoot, config.source.commands);
|
|
28595
28668
|
if (!fs37.existsSync(sourceCommandsRoot)) {
|
|
28596
28669
|
return [skippedMissingSource4("commands", sourceCommandsRoot)];
|
|
28597
28670
|
}
|
|
28598
|
-
const sourceCommands = ts(
|
|
28671
|
+
const sourceCommands = ts(path38.join(sourceCommandsRoot, "*.md")).sort();
|
|
28599
28672
|
const workflowsRoot = resolveTargetPath(paths.workflows);
|
|
28600
28673
|
return sourceCommands.map((commandFile) => {
|
|
28601
|
-
const baseName =
|
|
28602
|
-
const destination =
|
|
28674
|
+
const baseName = path38.basename(commandFile);
|
|
28675
|
+
const destination = path38.join(workflowsRoot, baseName);
|
|
28603
28676
|
const commandContent = fs37.readFileSync(commandFile, "utf8");
|
|
28604
|
-
const relativeSource = `commands/${
|
|
28677
|
+
const relativeSource = `commands/${path38.basename(commandFile)}`;
|
|
28605
28678
|
const marker = formatProvenanceMarker(
|
|
28606
28679
|
"markdown",
|
|
28607
28680
|
relativeSource,
|
|
@@ -28636,7 +28709,7 @@ ${commandContent.trim()}
|
|
|
28636
28709
|
});
|
|
28637
28710
|
}
|
|
28638
28711
|
function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
28639
|
-
const source =
|
|
28712
|
+
const source = path38.resolve(sourceRoot, config.source.skills);
|
|
28640
28713
|
const destination = resolveTargetPath(paths.skills);
|
|
28641
28714
|
if (!fs37.existsSync(source)) {
|
|
28642
28715
|
return skippedMissingSource4("skills", source);
|
|
@@ -28660,7 +28733,7 @@ function syncSkills4(config, sourceRoot, paths, options, logger, manifest, scope
|
|
|
28660
28733
|
} else if (artifactClass === "managed-symlink") {
|
|
28661
28734
|
fs37.unlinkSync(destination);
|
|
28662
28735
|
}
|
|
28663
|
-
ensureDir(
|
|
28736
|
+
ensureDir(path38.dirname(destination));
|
|
28664
28737
|
createRelativeSymlink(source, destination, "dir");
|
|
28665
28738
|
logger.verbose(`Skills: created Cline skills symlink ${destination}`);
|
|
28666
28739
|
return { component: "skills", status: "success", path: destination };
|
|
@@ -28730,11 +28803,11 @@ function syncSettings(lossReport) {
|
|
|
28730
28803
|
};
|
|
28731
28804
|
}
|
|
28732
28805
|
function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
28733
|
-
const agentsDir =
|
|
28806
|
+
const agentsDir = path38.join(sourceRoot, config.source.agents);
|
|
28734
28807
|
if (!fs37.existsSync(agentsDir)) return;
|
|
28735
|
-
for (const agentFile of ts(
|
|
28808
|
+
for (const agentFile of ts(path38.join(agentsDir, "*.md")).sort()) {
|
|
28736
28809
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
28737
|
-
const relativeSource = `agents/${
|
|
28810
|
+
const relativeSource = `agents/${path38.basename(agentFile)}`;
|
|
28738
28811
|
const hasCustomProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
28739
28812
|
if (hasCustomProvider) {
|
|
28740
28813
|
addLoss(lossReport, "cline", "agents", {
|
|
@@ -28748,7 +28821,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28748
28821
|
"provider",
|
|
28749
28822
|
"provider-not-representable"
|
|
28750
28823
|
),
|
|
28751
|
-
detail: `${
|
|
28824
|
+
detail: `${path38.basename(agentFile)}: Cline provider is interface-only (Settings \u2192 API Provider); configure manually.`
|
|
28752
28825
|
}
|
|
28753
28826
|
]
|
|
28754
28827
|
});
|
|
@@ -28766,7 +28839,7 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
|
|
|
28766
28839
|
"model",
|
|
28767
28840
|
"model-not-representable"
|
|
28768
28841
|
),
|
|
28769
|
-
detail: `${
|
|
28842
|
+
detail: `${path38.basename(agentFile)}: Cline model pin is interface-only (Settings \u2192 Model); configure manually.`
|
|
28770
28843
|
}
|
|
28771
28844
|
]
|
|
28772
28845
|
});
|
|
@@ -28781,7 +28854,7 @@ function writeCompiledArtifact4(component, destination, content, expectedHash, c
|
|
|
28781
28854
|
if (artifactClass === "unmanaged-conflict" && !handleConflict4(destination, config, options, logger, manifest, scopePath)) {
|
|
28782
28855
|
return { component, status: "conflict", path: destination };
|
|
28783
28856
|
}
|
|
28784
|
-
ensureDir(
|
|
28857
|
+
ensureDir(path38.dirname(destination));
|
|
28785
28858
|
fs37.writeFileSync(destination, content);
|
|
28786
28859
|
return { component, status: "success", path: destination };
|
|
28787
28860
|
}
|
|
@@ -28842,7 +28915,7 @@ function hashString4(value) {
|
|
|
28842
28915
|
import crypto9 from "crypto";
|
|
28843
28916
|
import fs38 from "fs";
|
|
28844
28917
|
import os6 from "os";
|
|
28845
|
-
import
|
|
28918
|
+
import path39 from "path";
|
|
28846
28919
|
var import_yaml11 = __toESM(require_dist(), 1);
|
|
28847
28920
|
function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
28848
28921
|
const scope = options.scope ?? "global";
|
|
@@ -28860,7 +28933,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28860
28933
|
config_doc: profile.config_doc
|
|
28861
28934
|
};
|
|
28862
28935
|
const rules = compileRules(
|
|
28863
|
-
|
|
28936
|
+
path39.join(sourceRoot, config.source.rules),
|
|
28864
28937
|
"opencode",
|
|
28865
28938
|
mappings,
|
|
28866
28939
|
lossReport
|
|
@@ -28962,7 +29035,7 @@ function syncOpenCode(config, sourceRoot, mappings, extensions, options, lossRep
|
|
|
28962
29035
|
return { target: "opencode", outcomes };
|
|
28963
29036
|
}
|
|
28964
29037
|
function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, logger, manifest, scopePath) {
|
|
28965
|
-
const source =
|
|
29038
|
+
const source = path39.join(sourceRoot, config.source.instructions);
|
|
28966
29039
|
const destination = resolveTargetPath(paths.instructions);
|
|
28967
29040
|
const baseContent = fs38.existsSync(source) ? fs38.readFileSync(source, "utf8").trim() : "";
|
|
28968
29041
|
const composed = agentsAppendix ? `${baseContent}
|
|
@@ -28971,7 +29044,7 @@ function syncInstructions4(config, sourceRoot, paths, agentsAppendix, options, l
|
|
|
28971
29044
|
${agentsAppendix}`.trim() : baseContent;
|
|
28972
29045
|
const marker = formatProvenanceMarker(
|
|
28973
29046
|
"markdown",
|
|
28974
|
-
|
|
29047
|
+
path39.basename(config.source.instructions),
|
|
28975
29048
|
hashString5(composed),
|
|
28976
29049
|
"opencode"
|
|
28977
29050
|
);
|
|
@@ -28998,16 +29071,16 @@ ${composed}
|
|
|
28998
29071
|
);
|
|
28999
29072
|
}
|
|
29000
29073
|
function syncAgents5(config, sourceRoot, paths, mappings, extensions, options, lossReport, logger, manifest, scopePath) {
|
|
29001
|
-
const sourceAgentsRoot =
|
|
29074
|
+
const sourceAgentsRoot = path39.join(sourceRoot, config.source.agents);
|
|
29002
29075
|
if (!fs38.existsSync(sourceAgentsRoot)) {
|
|
29003
29076
|
return [skippedMissingSource5("agents", sourceAgentsRoot)];
|
|
29004
29077
|
}
|
|
29005
|
-
const sourceAgents = ts(
|
|
29078
|
+
const sourceAgents = ts(path39.join(sourceAgentsRoot, "*.md")).sort();
|
|
29006
29079
|
const agentsRoot = resolveTargetPath(paths.agents);
|
|
29007
29080
|
return sourceAgents.map((agentFile) => {
|
|
29008
|
-
const destination =
|
|
29081
|
+
const destination = path39.join(
|
|
29009
29082
|
agentsRoot,
|
|
29010
|
-
`${
|
|
29083
|
+
`${path39.basename(agentFile, ".md")}.md`
|
|
29011
29084
|
);
|
|
29012
29085
|
let compiled;
|
|
29013
29086
|
try {
|
|
@@ -29071,11 +29144,11 @@ function applyProviderModelBinding(compiled, mappings) {
|
|
|
29071
29144
|
return `${before}${(0, import_yaml11.stringify)(fields).trim()}${after}`;
|
|
29072
29145
|
}
|
|
29073
29146
|
function syncCommands4(config, sourceRoot, paths, options, logger, manifest, scopePath) {
|
|
29074
|
-
const sourceCommandsRoot =
|
|
29147
|
+
const sourceCommandsRoot = path39.join(sourceRoot, config.source.commands);
|
|
29075
29148
|
if (!fs38.existsSync(sourceCommandsRoot)) {
|
|
29076
29149
|
return [skippedMissingSource5("commands", sourceCommandsRoot)];
|
|
29077
29150
|
}
|
|
29078
|
-
const sourceCommands = ts(
|
|
29151
|
+
const sourceCommands = ts(path39.join(sourceCommandsRoot, "*.md")).sort();
|
|
29079
29152
|
const commandsRoot = resolveTargetPath(paths.commands);
|
|
29080
29153
|
return sourceCommands.map((commandFile) => {
|
|
29081
29154
|
const { data, body } = parseCommandFile(commandFile);
|
|
@@ -29089,7 +29162,7 @@ function syncCommands4(config, sourceRoot, paths, options, logger, manifest, sco
|
|
|
29089
29162
|
if (typeof data.model === "string") {
|
|
29090
29163
|
frontmatter.model = data.model;
|
|
29091
29164
|
}
|
|
29092
|
-
const relativeSource = `commands/${
|
|
29165
|
+
const relativeSource = `commands/${path39.basename(commandFile)}`;
|
|
29093
29166
|
const marker = formatProvenanceMarker(
|
|
29094
29167
|
"markdown",
|
|
29095
29168
|
relativeSource,
|
|
@@ -29105,9 +29178,9 @@ ${body.trimEnd()}
|
|
|
29105
29178
|
` : `${marker}
|
|
29106
29179
|
${body.trimEnd()}
|
|
29107
29180
|
`;
|
|
29108
|
-
const destination =
|
|
29181
|
+
const destination = path39.join(
|
|
29109
29182
|
commandsRoot,
|
|
29110
|
-
`${
|
|
29183
|
+
`${path39.basename(commandFile, ".md")}.md`
|
|
29111
29184
|
);
|
|
29112
29185
|
if (options.dryRun) {
|
|
29113
29186
|
logger.info(
|
|
@@ -29134,7 +29207,7 @@ ${body.trimEnd()}
|
|
|
29134
29207
|
});
|
|
29135
29208
|
}
|
|
29136
29209
|
function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scopePath, component = "skills", destination = "") {
|
|
29137
|
-
const source =
|
|
29210
|
+
const source = path39.resolve(sourceRoot, config.source.skills);
|
|
29138
29211
|
if (!fs38.existsSync(source)) {
|
|
29139
29212
|
return skippedMissingSource5(component, source);
|
|
29140
29213
|
}
|
|
@@ -29153,7 +29226,7 @@ function syncSkills5(config, sourceRoot, _paths, options, logger, manifest, scop
|
|
|
29153
29226
|
} else if (artifactClass === "managed-symlink") {
|
|
29154
29227
|
fs38.unlinkSync(destination);
|
|
29155
29228
|
}
|
|
29156
|
-
ensureDir(
|
|
29229
|
+
ensureDir(path39.dirname(destination));
|
|
29157
29230
|
createRelativeSymlink(source, destination, "dir");
|
|
29158
29231
|
logger.verbose(`Skills: created skills path ${destination}`);
|
|
29159
29232
|
return { component, status: "success", path: destination };
|
|
@@ -29261,7 +29334,7 @@ function syncConfigDoc(paths, mcpEntries, _lossReport, permissionMap, mappings)
|
|
|
29261
29334
|
};
|
|
29262
29335
|
}
|
|
29263
29336
|
}
|
|
29264
|
-
ensureDir(
|
|
29337
|
+
ensureDir(path39.dirname(destination));
|
|
29265
29338
|
fs38.writeFileSync(destination, `${JSON.stringify(config, null, 2)}
|
|
29266
29339
|
`);
|
|
29267
29340
|
}
|
|
@@ -29273,7 +29346,7 @@ function writeCompiledArtifact5(component, destination, content, expectedHash, c
|
|
|
29273
29346
|
if (artifactClass === "unmanaged-conflict" && !handleConflict5(destination, config, options, logger, manifest, scopePath)) {
|
|
29274
29347
|
return { component, status: "conflict", path: destination };
|
|
29275
29348
|
}
|
|
29276
|
-
ensureDir(
|
|
29349
|
+
ensureDir(path39.dirname(destination));
|
|
29277
29350
|
fs38.writeFileSync(destination, content);
|
|
29278
29351
|
return { component, status: "success", path: destination };
|
|
29279
29352
|
}
|
|
@@ -29363,9 +29436,9 @@ function isBackupableFile(targetPath) {
|
|
|
29363
29436
|
}
|
|
29364
29437
|
function backupConflictingTarget(targetPath, scopePath) {
|
|
29365
29438
|
const ts2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu, "").replace("T", "T").replace(/\.\d+Z$/u, "Z");
|
|
29366
|
-
const relativeToRoot =
|
|
29367
|
-
const backupPath =
|
|
29368
|
-
fs39.mkdirSync(
|
|
29439
|
+
const relativeToRoot = path40.relative("/", targetPath).replace(/^\.\.\/+/gu, "");
|
|
29440
|
+
const backupPath = path40.join(scopePath, "backups", ts2, relativeToRoot);
|
|
29441
|
+
fs39.mkdirSync(path40.dirname(backupPath), { recursive: true });
|
|
29369
29442
|
fs39.copyFileSync(targetPath, backupPath);
|
|
29370
29443
|
return backupPath;
|
|
29371
29444
|
}
|
|
@@ -29395,7 +29468,7 @@ async function runInstallCommand(options, logger) {
|
|
|
29395
29468
|
);
|
|
29396
29469
|
}
|
|
29397
29470
|
const kitName = resolvedKitName ?? config.kit;
|
|
29398
|
-
const kitPath = kitPathOverride ?? (options.kitPath ?
|
|
29471
|
+
const kitPath = kitPathOverride ?? (options.kitPath ? path40.resolve(options.kitPath) : config.kitPath);
|
|
29399
29472
|
if (!kitName && !kitPath) {
|
|
29400
29473
|
logger.error(
|
|
29401
29474
|
"No kit specified. Use --kit <name>, --kit-path <path>, or set 'kit'/'kitPath' in tangyr.config.yaml."
|
|
@@ -29651,20 +29724,20 @@ SKIPPED CONFLICTS (${skippedTargetPaths.size} target(s) left unchanged):`
|
|
|
29651
29724
|
writeManifest(scopePath, manifest);
|
|
29652
29725
|
logger.info(`
|
|
29653
29726
|
Installation complete: ${installedCount} files installed.`);
|
|
29654
|
-
logger.info(`Manifest written to ${
|
|
29727
|
+
logger.info(`Manifest written to ${path40.join(scopePath, "manifest.json")}`);
|
|
29655
29728
|
logger.info(`Kit: ${kitInfo.name} (archetype: ${kitInfo.archetype})`);
|
|
29656
29729
|
logger.info(`Scope: ${scope}`);
|
|
29657
29730
|
logger.info(`Tools: ${tools.join(", ")}`);
|
|
29658
29731
|
reportHookRejections(
|
|
29659
29732
|
installLossReport,
|
|
29660
29733
|
tools,
|
|
29661
|
-
|
|
29734
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29662
29735
|
kitInfo.components.hooks.declared
|
|
29663
29736
|
);
|
|
29664
29737
|
const hooksConflict = reportHooksSourceConflict(
|
|
29665
29738
|
installLossReport,
|
|
29666
29739
|
tools,
|
|
29667
|
-
|
|
29740
|
+
path40.resolve(kitInfo.path, "hooks"),
|
|
29668
29741
|
kitInfo.components.hooks.declared
|
|
29669
29742
|
);
|
|
29670
29743
|
if (hooksConflict) {
|
|
@@ -29809,7 +29882,7 @@ function applyClaudeCodePlacements(placements, manifest, skippedTargetPaths, log
|
|
|
29809
29882
|
logger.verbose(` skipped (operator choice): ${placement.destination}`);
|
|
29810
29883
|
continue;
|
|
29811
29884
|
}
|
|
29812
|
-
const destDir =
|
|
29885
|
+
const destDir = path40.dirname(placement.destination);
|
|
29813
29886
|
fs39.mkdirSync(destDir, { recursive: true });
|
|
29814
29887
|
if (placement.type === "symlink") {
|
|
29815
29888
|
if (fs39.existsSync(placement.destination) || isSymlink2(placement.destination)) {
|
|
@@ -30062,6 +30135,10 @@ function countInstalledArtifacts(outcomes) {
|
|
|
30062
30135
|
).length;
|
|
30063
30136
|
}
|
|
30064
30137
|
function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", projectRoot) {
|
|
30138
|
+
const shared = sharedArtifactKey(outcome.path, scope, projectRoot);
|
|
30139
|
+
if (shared) {
|
|
30140
|
+
return shared;
|
|
30141
|
+
}
|
|
30065
30142
|
if (tool !== "copilot" && tool !== "codex" && tool !== "opencode" && tool !== "cursor" && tool !== "cline") {
|
|
30066
30143
|
if (isDeferredTarget(tool)) {
|
|
30067
30144
|
throw new Error(
|
|
@@ -30090,11 +30167,11 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30090
30167
|
if (outcome.path === mcpFile2) {
|
|
30091
30168
|
return "cline/mcp.json";
|
|
30092
30169
|
}
|
|
30093
|
-
if (outcome.path.startsWith(`${workflowsRoot}${
|
|
30094
|
-
return `cline/workflows/${
|
|
30170
|
+
if (outcome.path.startsWith(`${workflowsRoot}${path40.sep}`)) {
|
|
30171
|
+
return `cline/workflows/${path40.basename(outcome.path)}`;
|
|
30095
30172
|
}
|
|
30096
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30097
|
-
return `cline/rules/${
|
|
30173
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30174
|
+
return `cline/rules/${path40.basename(outcome.path)}`;
|
|
30098
30175
|
}
|
|
30099
30176
|
return null;
|
|
30100
30177
|
}
|
|
@@ -30130,14 +30207,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30130
30207
|
if (outcome.path === permissionsFile) {
|
|
30131
30208
|
return "cursor/permissions.json";
|
|
30132
30209
|
}
|
|
30133
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30134
|
-
return `cursor/agents/${
|
|
30210
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30211
|
+
return `cursor/agents/${path40.basename(outcome.path)}`;
|
|
30135
30212
|
}
|
|
30136
|
-
if (outcome.path.startsWith(`${rulesRoot2}${
|
|
30137
|
-
return `cursor/rules/${
|
|
30213
|
+
if (outcome.path.startsWith(`${rulesRoot2}${path40.sep}`)) {
|
|
30214
|
+
return `cursor/rules/${path40.basename(outcome.path)}`;
|
|
30138
30215
|
}
|
|
30139
|
-
if (outcome.path.startsWith(`${skillsRoot2}${
|
|
30140
|
-
const rel =
|
|
30216
|
+
if (outcome.path.startsWith(`${skillsRoot2}${path40.sep}`)) {
|
|
30217
|
+
const rel = path40.relative(skillsRoot2, outcome.path);
|
|
30141
30218
|
return `cursor/skills/${rel}`;
|
|
30142
30219
|
}
|
|
30143
30220
|
return null;
|
|
@@ -30163,14 +30240,14 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30163
30240
|
if (outcome.path === skillsSharedRoot) {
|
|
30164
30241
|
return "opencode/skills_shared";
|
|
30165
30242
|
}
|
|
30166
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30167
|
-
return `opencode/agents/${
|
|
30243
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30244
|
+
return `opencode/agents/${path40.basename(outcome.path)}`;
|
|
30168
30245
|
}
|
|
30169
|
-
if (outcome.path.startsWith(`${commandsRoot}${
|
|
30170
|
-
return `opencode/commands/${
|
|
30246
|
+
if (outcome.path.startsWith(`${commandsRoot}${path40.sep}`)) {
|
|
30247
|
+
return `opencode/commands/${path40.basename(outcome.path)}`;
|
|
30171
30248
|
}
|
|
30172
30249
|
if (outcome.path === configDocFile) {
|
|
30173
|
-
return `opencode/${
|
|
30250
|
+
return `opencode/${path40.basename(outcome.path)}`;
|
|
30174
30251
|
}
|
|
30175
30252
|
return null;
|
|
30176
30253
|
}
|
|
@@ -30191,19 +30268,19 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30191
30268
|
return "copilot/skills";
|
|
30192
30269
|
}
|
|
30193
30270
|
if (instructionsMirror !== null && outcome.path === instructionsMirror) {
|
|
30194
|
-
return `copilot/${
|
|
30271
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30195
30272
|
}
|
|
30196
|
-
if (outcome.path.startsWith(`${agentsRoot2}${
|
|
30197
|
-
return `copilot/agents/${
|
|
30273
|
+
if (outcome.path.startsWith(`${agentsRoot2}${path40.sep}`)) {
|
|
30274
|
+
return `copilot/agents/${path40.basename(outcome.path)}`;
|
|
30198
30275
|
}
|
|
30199
|
-
if (outcome.path.startsWith(`${promptsRoot}${
|
|
30200
|
-
return `copilot/prompts/${
|
|
30276
|
+
if (outcome.path.startsWith(`${promptsRoot}${path40.sep}`)) {
|
|
30277
|
+
return `copilot/prompts/${path40.basename(outcome.path)}`;
|
|
30201
30278
|
}
|
|
30202
|
-
if (outcome.path.startsWith(`${hooksRoot}${
|
|
30203
|
-
return `copilot/hooks/${
|
|
30279
|
+
if (outcome.path.startsWith(`${hooksRoot}${path40.sep}`)) {
|
|
30280
|
+
return `copilot/hooks/${path40.basename(outcome.path)}`;
|
|
30204
30281
|
}
|
|
30205
30282
|
if (outcome.path === mcpFile2) {
|
|
30206
|
-
return `copilot/${
|
|
30283
|
+
return `copilot/${path40.basename(outcome.path)}`;
|
|
30207
30284
|
}
|
|
30208
30285
|
return null;
|
|
30209
30286
|
}
|
|
@@ -30220,17 +30297,17 @@ function syncOutcomeToManifestKey(tool, outcome, mappings, scope = "global", pro
|
|
|
30220
30297
|
if (outcome.path === skillsRoot) {
|
|
30221
30298
|
return "codex/skills";
|
|
30222
30299
|
}
|
|
30223
|
-
if (outcome.path.startsWith(`${agentsRoot}${
|
|
30224
|
-
return `codex/agents/${
|
|
30300
|
+
if (outcome.path.startsWith(`${agentsRoot}${path40.sep}`)) {
|
|
30301
|
+
return `codex/agents/${path40.basename(outcome.path)}`;
|
|
30225
30302
|
}
|
|
30226
|
-
if (outcome.path.startsWith(`${rulesRoot}${
|
|
30227
|
-
return `codex/rules/${
|
|
30303
|
+
if (outcome.path.startsWith(`${rulesRoot}${path40.sep}`)) {
|
|
30304
|
+
return `codex/rules/${path40.basename(outcome.path)}`;
|
|
30228
30305
|
}
|
|
30229
30306
|
if (outcome.path === hooksFile) {
|
|
30230
|
-
return `codex/${
|
|
30307
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30231
30308
|
}
|
|
30232
30309
|
if (outcome.path === mcpFile) {
|
|
30233
|
-
return `codex/${
|
|
30310
|
+
return `codex/${path40.basename(outcome.path)}`;
|
|
30234
30311
|
}
|
|
30235
30312
|
return null;
|
|
30236
30313
|
}
|
|
@@ -30270,7 +30347,9 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30270
30347
|
placements.push({
|
|
30271
30348
|
source: entrypoint.file,
|
|
30272
30349
|
destination: resolvedPaths.instructions,
|
|
30273
|
-
|
|
30350
|
+
// Shared at project scope, where this resolves to the same AGENTS.md
|
|
30351
|
+
// codex, copilot, opencode and cline write.
|
|
30352
|
+
manifestKey: sharedArtifactKey(resolvedPaths.instructions, scope, projectRoot) ?? `claude-code/${entrypoint.name}`,
|
|
30274
30353
|
type: "symlink",
|
|
30275
30354
|
isDir: false
|
|
30276
30355
|
});
|
|
@@ -30282,7 +30361,7 @@ function getClaudeCodePlacements(kitInfo, scope = "global", projectRoot, mapping
|
|
|
30282
30361
|
rules: resolvedPaths.rules
|
|
30283
30362
|
};
|
|
30284
30363
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30285
|
-
const componentDir =
|
|
30364
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30286
30365
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30287
30366
|
placements.push({
|
|
30288
30367
|
source: componentDir,
|
|
@@ -30314,7 +30393,7 @@ function getClaudeCodePlacementsFromProfile(kitInfo, profile) {
|
|
|
30314
30393
|
rules: profile.rules
|
|
30315
30394
|
};
|
|
30316
30395
|
for (const [component, targetPath] of Object.entries(componentDirMap)) {
|
|
30317
|
-
const componentDir =
|
|
30396
|
+
const componentDir = path40.join(kitInfo.path, component);
|
|
30318
30397
|
if (fs39.existsSync(componentDir) && fs39.statSync(componentDir).isDirectory()) {
|
|
30319
30398
|
placements.push({
|
|
30320
30399
|
source: componentDir,
|
|
@@ -30340,8 +30419,8 @@ function collectAllFiles(kitInfo) {
|
|
|
30340
30419
|
const missingSet = new Set(reconciliation.missing);
|
|
30341
30420
|
for (const entry of reconciliation.declared) {
|
|
30342
30421
|
if (missingSet.has(entry)) continue;
|
|
30343
|
-
const relPath = isSkills ?
|
|
30344
|
-
files.set(relPath,
|
|
30422
|
+
const relPath = isSkills ? path40.join(component, entry) : path40.join(component, `${entry}.md`);
|
|
30423
|
+
files.set(relPath, path40.join(kitInfo.path, relPath));
|
|
30345
30424
|
}
|
|
30346
30425
|
}
|
|
30347
30426
|
return files;
|
|
@@ -30393,14 +30472,14 @@ async function runKitUpdateCommand(options, logger) {
|
|
|
30393
30472
|
}
|
|
30394
30473
|
|
|
30395
30474
|
// src/commands/list.ts
|
|
30396
|
-
import
|
|
30475
|
+
import path41 from "path";
|
|
30397
30476
|
function runListCommand(options, logger) {
|
|
30398
30477
|
let searchPaths = [];
|
|
30399
|
-
let directKitPath = options.kitPath ?
|
|
30478
|
+
let directKitPath = options.kitPath ? path41.resolve(options.kitPath) : void 0;
|
|
30400
30479
|
try {
|
|
30401
30480
|
const { config, configDir } = resolveConfig(options.config);
|
|
30402
30481
|
searchPaths = config.kitSearchPaths ?? [
|
|
30403
|
-
|
|
30482
|
+
path41.join(configDir, "operating-kits")
|
|
30404
30483
|
];
|
|
30405
30484
|
directKitPath = directKitPath ?? config.kitPath;
|
|
30406
30485
|
} catch (err) {
|
|
@@ -30475,7 +30554,7 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30475
30554
|
return kits;
|
|
30476
30555
|
}
|
|
30477
30556
|
const directKit = loadKit(directKitPath);
|
|
30478
|
-
if (kits.some((kit) =>
|
|
30557
|
+
if (kits.some((kit) => path41.resolve(kit.path) === directKit.path)) {
|
|
30479
30558
|
return kits;
|
|
30480
30559
|
}
|
|
30481
30560
|
return [...kits, directKit];
|
|
@@ -30484,14 +30563,14 @@ function withDirectKit(kits, directKitPath) {
|
|
|
30484
30563
|
// src/commands/probe.ts
|
|
30485
30564
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
30486
30565
|
import fs40 from "fs";
|
|
30487
|
-
import
|
|
30566
|
+
import path42 from "path";
|
|
30488
30567
|
function runProbeCommand(options, logger) {
|
|
30489
30568
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30490
30569
|
options,
|
|
30491
30570
|
import.meta.url
|
|
30492
30571
|
);
|
|
30493
30572
|
const platformPaths = readYamlObject(
|
|
30494
|
-
|
|
30573
|
+
path42.join(
|
|
30495
30574
|
resolveConfiguredPath(config.mappings, configDir, sourceRoot, "mappings"),
|
|
30496
30575
|
"platform-paths.yaml"
|
|
30497
30576
|
)
|
|
@@ -30571,7 +30650,7 @@ function commandProbeRows(target, key, command, args) {
|
|
|
30571
30650
|
// src/commands/status.ts
|
|
30572
30651
|
import crypto10 from "crypto";
|
|
30573
30652
|
import fs41 from "fs";
|
|
30574
|
-
import
|
|
30653
|
+
import path43 from "path";
|
|
30575
30654
|
function runStatusCommand(options, logger) {
|
|
30576
30655
|
const { config, configDir, sourceRoot } = resolveRuntime(
|
|
30577
30656
|
options,
|
|
@@ -30650,21 +30729,21 @@ function classifyCodexFiles(config, sourceRoot, configDir) {
|
|
|
30650
30729
|
rules: paths.rules
|
|
30651
30730
|
};
|
|
30652
30731
|
const rules = compileRules(
|
|
30653
|
-
|
|
30732
|
+
path43.join(sourceRoot, config.source.rules),
|
|
30654
30733
|
"codex",
|
|
30655
30734
|
mappings,
|
|
30656
30735
|
createLossReport()
|
|
30657
30736
|
);
|
|
30658
|
-
const instructionsSource = fs41.readFileSync(
|
|
30737
|
+
const instructionsSource = fs41.readFileSync(path43.join(sourceRoot, config.source.instructions), "utf8").trim();
|
|
30659
30738
|
const composedInstructions = `${instructionsSource}
|
|
30660
30739
|
|
|
30661
30740
|
--- tangyr managed rules ---
|
|
30662
30741
|
${rules.agentsAppendix}`.trim();
|
|
30663
30742
|
const agentFiles = ts(
|
|
30664
|
-
|
|
30743
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30665
30744
|
).sort();
|
|
30666
|
-
const hooksSource =
|
|
30667
|
-
const mcpSource =
|
|
30745
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30746
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30668
30747
|
const ruleRows = rules.dotRulesFiles.length === 0 ? [
|
|
30669
30748
|
{
|
|
30670
30749
|
component: "rules",
|
|
@@ -30675,7 +30754,7 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30675
30754
|
] : rules.dotRulesFiles.map(
|
|
30676
30755
|
(ruleFile) => classifyCompiledFile(
|
|
30677
30756
|
`rules/${ruleFile.name}`,
|
|
30678
|
-
|
|
30757
|
+
path43.join(resolveTargetPath(codexPaths.rules), ruleFile.name),
|
|
30679
30758
|
"codex",
|
|
30680
30759
|
void 0,
|
|
30681
30760
|
config,
|
|
@@ -30693,10 +30772,10 @@ ${rules.agentsAppendix}`.trim();
|
|
|
30693
30772
|
),
|
|
30694
30773
|
...agentFiles.map(
|
|
30695
30774
|
(agentFile) => classifyCompiledFile(
|
|
30696
|
-
`agents/${
|
|
30697
|
-
|
|
30775
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30776
|
+
path43.join(
|
|
30698
30777
|
resolveTargetPath(codexPaths.agents),
|
|
30699
|
-
`${
|
|
30778
|
+
`${path43.basename(agentFile, ".md")}.toml`
|
|
30700
30779
|
),
|
|
30701
30780
|
"codex",
|
|
30702
30781
|
computeSourceHash(agentFile),
|
|
@@ -30776,20 +30855,20 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30776
30855
|
mcpSharedFile: paths.mcp_shared_file
|
|
30777
30856
|
};
|
|
30778
30857
|
const agentFiles = ts(
|
|
30779
|
-
|
|
30858
|
+
path43.join(sourceRoot, config.source.agents, "*.md")
|
|
30780
30859
|
).sort();
|
|
30781
30860
|
const commandFiles = ts(
|
|
30782
|
-
|
|
30861
|
+
path43.join(sourceRoot, config.source.commands, "*.md")
|
|
30783
30862
|
).sort();
|
|
30784
|
-
const hooksSource =
|
|
30785
|
-
const mcpSource =
|
|
30863
|
+
const hooksSource = path43.join(sourceRoot, config.source.hooks, "hooks.json");
|
|
30864
|
+
const mcpSource = path43.join(sourceRoot, config.source.mcp);
|
|
30786
30865
|
return [
|
|
30787
30866
|
...agentFiles.map(
|
|
30788
30867
|
(agentFile) => classifyCompiledFile(
|
|
30789
|
-
`agents/${
|
|
30790
|
-
|
|
30868
|
+
`agents/${path43.basename(agentFile, ".md")}`,
|
|
30869
|
+
path43.join(
|
|
30791
30870
|
resolveTargetPath(copilotPaths.agents),
|
|
30792
|
-
`${
|
|
30871
|
+
`${path43.basename(agentFile, ".md")}.agent.md`
|
|
30793
30872
|
),
|
|
30794
30873
|
"copilot",
|
|
30795
30874
|
computeSourceHash(agentFile),
|
|
@@ -30806,10 +30885,10 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30806
30885
|
),
|
|
30807
30886
|
...commandFiles.map(
|
|
30808
30887
|
(commandFile) => classifyCompiledFile(
|
|
30809
|
-
`commands/${
|
|
30810
|
-
|
|
30888
|
+
`commands/${path43.basename(commandFile, ".md")}`,
|
|
30889
|
+
path43.join(
|
|
30811
30890
|
resolveTargetPath(copilotPaths.prompts),
|
|
30812
|
-
`${
|
|
30891
|
+
`${path43.basename(commandFile, ".md")}.prompt.md`
|
|
30813
30892
|
),
|
|
30814
30893
|
"copilot",
|
|
30815
30894
|
computeSourceHash(commandFile),
|
|
@@ -30829,7 +30908,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30829
30908
|
),
|
|
30830
30909
|
fs41.existsSync(hooksSource) ? classifyCompiledFile(
|
|
30831
30910
|
"hooks",
|
|
30832
|
-
|
|
30911
|
+
path43.join(
|
|
30833
30912
|
resolveTargetPath(copilotPaths.hooks),
|
|
30834
30913
|
"tangyr-managed.json"
|
|
30835
30914
|
),
|
|
@@ -30839,7 +30918,7 @@ function classifyCopilotFiles(config, sourceRoot, configDir) {
|
|
|
30839
30918
|
sourceRoot
|
|
30840
30919
|
) : notConfiguredRow(
|
|
30841
30920
|
"hooks",
|
|
30842
|
-
|
|
30921
|
+
path43.join(
|
|
30843
30922
|
resolveTargetPath(copilotPaths.hooks),
|
|
30844
30923
|
"tangyr-managed.json"
|
|
30845
30924
|
)
|
|
@@ -30864,7 +30943,7 @@ function notConfiguredRow(component, filePath) {
|
|
|
30864
30943
|
}
|
|
30865
30944
|
function classifyDirectArtifact(artifact, config, sourceRoot) {
|
|
30866
30945
|
const artifactClass = classifyArtifact(artifact.path, config, sourceRoot);
|
|
30867
|
-
const sourcePath = artifact.sourceKey ?
|
|
30946
|
+
const sourcePath = artifact.sourceKey ? path43.resolve(sourceRoot, config.source[artifact.sourceKey]) : void 0;
|
|
30868
30947
|
if (artifactClass === "managed-symlink" && sourcePath && !isSymlinkCurrent(artifact.path, sourcePath)) {
|
|
30869
30948
|
return {
|
|
30870
30949
|
component: artifact.component,
|
|
@@ -30953,9 +31032,9 @@ function classifyClaudeSharedFiles(config, sourceRoot) {
|
|
|
30953
31032
|
classifyHooks(settingsPath),
|
|
30954
31033
|
classifySettings(
|
|
30955
31034
|
settingsPath,
|
|
30956
|
-
|
|
31035
|
+
path43.resolve(sourceRoot, config.source.settings)
|
|
30957
31036
|
),
|
|
30958
|
-
classifyMcp(claudeJsonPath,
|
|
31037
|
+
classifyMcp(claudeJsonPath, path43.resolve(sourceRoot, config.source.mcp))
|
|
30959
31038
|
];
|
|
30960
31039
|
}
|
|
30961
31040
|
function classifyHooks(filePath) {
|
|
@@ -31088,7 +31167,7 @@ function hashString6(value) {
|
|
|
31088
31167
|
|
|
31089
31168
|
// src/commands/sync.ts
|
|
31090
31169
|
import fs43 from "fs";
|
|
31091
|
-
import
|
|
31170
|
+
import path45 from "path";
|
|
31092
31171
|
|
|
31093
31172
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
31094
31173
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -31587,7 +31666,7 @@ var source_default = chalk;
|
|
|
31587
31666
|
|
|
31588
31667
|
// src/adapters/claude-code.ts
|
|
31589
31668
|
import fs42 from "fs";
|
|
31590
|
-
import
|
|
31669
|
+
import path44 from "path";
|
|
31591
31670
|
|
|
31592
31671
|
// src/core/shim.ts
|
|
31593
31672
|
import crypto11 from "crypto";
|
|
@@ -31698,7 +31777,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31698
31777
|
}
|
|
31699
31778
|
if (!shouldSkipComponent6(options, "instructions") && manifest && scopePath) {
|
|
31700
31779
|
const shimPath = profile.instructions_shim;
|
|
31701
|
-
const agentsMdPath =
|
|
31780
|
+
const agentsMdPath = path44.resolve(sourceRoot, config.source.instructions);
|
|
31702
31781
|
if (!options.dryRun) {
|
|
31703
31782
|
applyClaudeCodeShimUpgrade(
|
|
31704
31783
|
shimPath,
|
|
@@ -31716,7 +31795,7 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31716
31795
|
if (!shouldSkipComponent6(options, "hooks")) {
|
|
31717
31796
|
outcomes.push(
|
|
31718
31797
|
syncHookScriptsBridge({
|
|
31719
|
-
source:
|
|
31798
|
+
source: path44.resolve(sourceRoot, config.source.hooks),
|
|
31720
31799
|
destination: profile.hook_scripts,
|
|
31721
31800
|
config,
|
|
31722
31801
|
sourceRoot,
|
|
@@ -31768,13 +31847,13 @@ function syncClaudeCode(config, sourceRoot, options, logger, mappings, manifest,
|
|
|
31768
31847
|
}
|
|
31769
31848
|
function syncProviderLoss2(config, sourceRoot, mappings, lossReport) {
|
|
31770
31849
|
if (!mappings.modelTiers.custom_provider) return;
|
|
31771
|
-
const agentsDir =
|
|
31850
|
+
const agentsDir = path44.join(sourceRoot, config.source.agents);
|
|
31772
31851
|
if (!fs42.existsSync(agentsDir)) return;
|
|
31773
|
-
for (const agentFile of ts(
|
|
31852
|
+
for (const agentFile of ts(path44.join(agentsDir, "*.md")).sort()) {
|
|
31774
31853
|
const { data } = parseMarkdownFrontmatter(agentFile);
|
|
31775
31854
|
const hasProvider = typeof data.provider === "string" || typeof data.provider === "object" && data.provider !== null && Object.keys(data.provider).length > 0;
|
|
31776
31855
|
if (hasProvider) {
|
|
31777
|
-
const basename =
|
|
31856
|
+
const basename = path44.basename(agentFile);
|
|
31778
31857
|
addLoss(lossReport, "claude-code", "agents", {
|
|
31779
31858
|
source: `agents/${basename}`,
|
|
31780
31859
|
fields: [
|
|
@@ -31801,12 +31880,12 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31801
31880
|
const shimContent = buildAgentsMdShim(shimPath, agentsMdPath, "claude-code");
|
|
31802
31881
|
if (!fs42.existsSync(shimPath)) {
|
|
31803
31882
|
manifest.artifacts.push({
|
|
31804
|
-
relativePath:
|
|
31883
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31805
31884
|
hash: expectedBodyHash,
|
|
31806
31885
|
origin: "tangyr-managed"
|
|
31807
31886
|
});
|
|
31808
31887
|
writeManifest(scopePath, manifest);
|
|
31809
|
-
fs42.mkdirSync(
|
|
31888
|
+
fs42.mkdirSync(path44.dirname(shimPath), { recursive: true });
|
|
31810
31889
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31811
31890
|
logger?.verbose(`instructions-shim: wrote @AGENTS.md shim -> ${shimPath}`);
|
|
31812
31891
|
return;
|
|
@@ -31824,14 +31903,14 @@ function applyClaudeCodeShimUpgrade(shimPath, agentsMdPath, manifest, scopePath,
|
|
|
31824
31903
|
writeManifest(scopePath, manifest);
|
|
31825
31904
|
fs42.writeFileSync(shimPath, shimContent);
|
|
31826
31905
|
manifest.artifacts.push({
|
|
31827
|
-
relativePath:
|
|
31906
|
+
relativePath: path44.relative(scopePath, shimPath),
|
|
31828
31907
|
hash: expectedBodyHash,
|
|
31829
31908
|
origin: "tangyr-managed"
|
|
31830
31909
|
});
|
|
31831
31910
|
logger?.verbose(`instructions-shim: backed up and replaced -> ${shimPath}`);
|
|
31832
31911
|
}
|
|
31833
31912
|
function syncDirectComponent(config, sourceRoot, options, logger, directComponent, manifest, scopePath) {
|
|
31834
|
-
const source =
|
|
31913
|
+
const source = path44.resolve(
|
|
31835
31914
|
sourceRoot,
|
|
31836
31915
|
config.source[directComponent.sourceKey]
|
|
31837
31916
|
);
|
|
@@ -31868,7 +31947,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31868
31947
|
} else if (artifactClass === "managed-symlink") {
|
|
31869
31948
|
fs42.unlinkSync(destination);
|
|
31870
31949
|
}
|
|
31871
|
-
ensureDir(
|
|
31950
|
+
ensureDir(path44.dirname(destination));
|
|
31872
31951
|
createRelativeSymlink(source, destination, directComponent.type, {
|
|
31873
31952
|
logger,
|
|
31874
31953
|
provenanceMarker: directComponent.type === "file" ? formatProvenanceMarker(
|
|
@@ -31885,7 +31964,7 @@ function syncDirectComponent(config, sourceRoot, options, logger, directComponen
|
|
|
31885
31964
|
};
|
|
31886
31965
|
}
|
|
31887
31966
|
function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination, manifest, scopePath) {
|
|
31888
|
-
const source =
|
|
31967
|
+
const source = path44.resolve(sourceRoot, config.source.skills);
|
|
31889
31968
|
if (!fs42.existsSync(source)) {
|
|
31890
31969
|
return [skippedMissingSource6("skills", source)];
|
|
31891
31970
|
}
|
|
@@ -31896,7 +31975,7 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31896
31975
|
if (isLegacyWholesaleSymlink) {
|
|
31897
31976
|
for (const name of foreignSkillNames(source, declaredNames)) {
|
|
31898
31977
|
logger.info(
|
|
31899
|
-
`[dry-run] skills: migrate foreign skill ${
|
|
31978
|
+
`[dry-run] skills: migrate foreign skill ${path44.join(source, name)} -> ${path44.join(destination, name)}`
|
|
31900
31979
|
);
|
|
31901
31980
|
}
|
|
31902
31981
|
logger.info(
|
|
@@ -31904,9 +31983,9 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31904
31983
|
);
|
|
31905
31984
|
}
|
|
31906
31985
|
for (const name of declaredNames ?? listSkillDirNames(source)) {
|
|
31907
|
-
const skillDestination =
|
|
31986
|
+
const skillDestination = path44.join(destination, name);
|
|
31908
31987
|
logger.info(
|
|
31909
|
-
`[dry-run] skills: symlink ${
|
|
31988
|
+
`[dry-run] skills: symlink ${path44.join(source, name)} -> ${skillDestination}`
|
|
31910
31989
|
);
|
|
31911
31990
|
outcomes2.push({
|
|
31912
31991
|
component: "skills",
|
|
@@ -31939,8 +32018,8 @@ function syncClaudeCodeSkills(config, sourceRoot, options, logger, destination,
|
|
|
31939
32018
|
return outcomes;
|
|
31940
32019
|
}
|
|
31941
32020
|
function syncSingleSkill(config, sourceRoot, options, logger, source, destination, name, manifest, scopePath) {
|
|
31942
|
-
const skillSource =
|
|
31943
|
-
const skillDestination =
|
|
32021
|
+
const skillSource = path44.join(source, name);
|
|
32022
|
+
const skillDestination = path44.join(destination, name);
|
|
31944
32023
|
if (!fs42.existsSync(skillSource)) {
|
|
31945
32024
|
return skippedMissingSource6("skills", skillSource);
|
|
31946
32025
|
}
|
|
@@ -31974,8 +32053,8 @@ function migrateWholesaleSkillsSymlink(source, destination, declaredNames, logge
|
|
|
31974
32053
|
fs42.unlinkSync(destination);
|
|
31975
32054
|
ensureDir(destination);
|
|
31976
32055
|
for (const name of foreignNames) {
|
|
31977
|
-
const from =
|
|
31978
|
-
const to =
|
|
32056
|
+
const from = path44.join(source, name);
|
|
32057
|
+
const to = path44.join(destination, name);
|
|
31979
32058
|
if (fs42.existsSync(to)) {
|
|
31980
32059
|
logger.warn(
|
|
31981
32060
|
`skills migration: ${to} already exists \u2014 skipping ${from} to avoid overwrite. Nothing in the kit was changed.`
|
|
@@ -32038,7 +32117,7 @@ function syncHooks6(config, sourceRoot, options, logger, destination, scriptsBri
|
|
|
32038
32117
|
};
|
|
32039
32118
|
}
|
|
32040
32119
|
function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
32041
|
-
const source =
|
|
32120
|
+
const source = path44.resolve(sourceRoot, config.source.mcp);
|
|
32042
32121
|
if (!fs42.existsSync(source)) {
|
|
32043
32122
|
return skippedMissingSource6("mcp", source);
|
|
32044
32123
|
}
|
|
@@ -32074,7 +32153,7 @@ function syncMcp6(config, sourceRoot, options, logger, destination) {
|
|
|
32074
32153
|
};
|
|
32075
32154
|
}
|
|
32076
32155
|
function syncSettings2(config, sourceRoot, options, logger, destination) {
|
|
32077
|
-
const source =
|
|
32156
|
+
const source = path44.resolve(sourceRoot, config.source.settings);
|
|
32078
32157
|
if (!fs42.existsSync(source)) {
|
|
32079
32158
|
return skippedMissingSource6("settings", source);
|
|
32080
32159
|
}
|
|
@@ -32343,13 +32422,13 @@ async function runSyncCommand(options, logger) {
|
|
|
32343
32422
|
reportHookRejections(
|
|
32344
32423
|
lossReport,
|
|
32345
32424
|
targets,
|
|
32346
|
-
|
|
32425
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32347
32426
|
kitInfo.components.hooks.declared
|
|
32348
32427
|
);
|
|
32349
32428
|
const hooksConflict = reportHooksSourceConflict(
|
|
32350
32429
|
lossReport,
|
|
32351
32430
|
targets,
|
|
32352
|
-
|
|
32431
|
+
path45.resolve(kitInfo.path, "hooks"),
|
|
32353
32432
|
kitInfo.components.hooks.declared
|
|
32354
32433
|
);
|
|
32355
32434
|
if (hooksConflict) {
|
|
@@ -32460,7 +32539,7 @@ function updateManifest(kitInfo, kitSync) {
|
|
|
32460
32539
|
writeManifest(kitSync.scopePath, kitSync.manifest);
|
|
32461
32540
|
}
|
|
32462
32541
|
function resolveKitFilePath(kitPath, relativePath) {
|
|
32463
|
-
const fullPath =
|
|
32542
|
+
const fullPath = path45.join(kitPath, relativePath);
|
|
32464
32543
|
return fs43.existsSync(fullPath) ? fullPath : null;
|
|
32465
32544
|
}
|
|
32466
32545
|
function cleanupRemovedManagedArtifacts(config, mappings, targets, options, removedSourcePaths, logger) {
|
|
@@ -32524,9 +32603,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32524
32603
|
}
|
|
32525
32604
|
if (relativePath.startsWith("agents/")) {
|
|
32526
32605
|
removeManagedCompiledArtifact2(
|
|
32527
|
-
|
|
32606
|
+
path45.join(
|
|
32528
32607
|
resolveTargetPath(paths.agents ?? ""),
|
|
32529
|
-
`${
|
|
32608
|
+
`${path45.parse(relativePath).name}.agent.md`
|
|
32530
32609
|
),
|
|
32531
32610
|
"copilot",
|
|
32532
32611
|
relativePath,
|
|
@@ -32536,9 +32615,9 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32536
32615
|
}
|
|
32537
32616
|
if (relativePath.startsWith("commands/")) {
|
|
32538
32617
|
removeManagedCompiledArtifact2(
|
|
32539
|
-
|
|
32618
|
+
path45.join(
|
|
32540
32619
|
resolveTargetPath(paths.prompts ?? ""),
|
|
32541
|
-
`${
|
|
32620
|
+
`${path45.parse(relativePath).name}.prompt.md`
|
|
32542
32621
|
),
|
|
32543
32622
|
"copilot",
|
|
32544
32623
|
relativePath,
|
|
@@ -32548,7 +32627,7 @@ function cleanupRemovedCopilotArtifact(relativePath, paths, logger) {
|
|
|
32548
32627
|
}
|
|
32549
32628
|
if (relativePath.endsWith("hooks.json")) {
|
|
32550
32629
|
removeManagedCompiledArtifact2(
|
|
32551
|
-
|
|
32630
|
+
path45.join(resolveTargetPath(paths.hooks ?? ""), "tangyr-managed.json"),
|
|
32552
32631
|
"copilot",
|
|
32553
32632
|
relativePath,
|
|
32554
32633
|
logger
|
|
@@ -32578,9 +32657,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32578
32657
|
}
|
|
32579
32658
|
if (relativePath.startsWith("agents/")) {
|
|
32580
32659
|
removeManagedCompiledArtifact2(
|
|
32581
|
-
|
|
32660
|
+
path45.join(
|
|
32582
32661
|
resolveTargetPath(paths.agents ?? ""),
|
|
32583
|
-
`${
|
|
32662
|
+
`${path45.parse(relativePath).name}.toml`
|
|
32584
32663
|
),
|
|
32585
32664
|
"codex",
|
|
32586
32665
|
relativePath,
|
|
@@ -32590,9 +32669,9 @@ function cleanupRemovedCodexArtifact(relativePath, paths, logger) {
|
|
|
32590
32669
|
}
|
|
32591
32670
|
if (relativePath.startsWith("rules/")) {
|
|
32592
32671
|
removeManagedCompiledArtifact2(
|
|
32593
|
-
|
|
32672
|
+
path45.join(
|
|
32594
32673
|
resolveTargetPath(paths.rules ?? ""),
|
|
32595
|
-
`${
|
|
32674
|
+
`${path45.parse(relativePath).name}.rules`
|
|
32596
32675
|
),
|
|
32597
32676
|
"codex",
|
|
32598
32677
|
relativePath,
|
|
@@ -32631,9 +32710,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32631
32710
|
}
|
|
32632
32711
|
if (relativePath.startsWith("agents/")) {
|
|
32633
32712
|
removeManagedCompiledArtifact2(
|
|
32634
|
-
|
|
32713
|
+
path45.join(
|
|
32635
32714
|
resolveTargetPath(paths.agents ?? ""),
|
|
32636
|
-
`${
|
|
32715
|
+
`${path45.parse(relativePath).name}.md`
|
|
32637
32716
|
),
|
|
32638
32717
|
"opencode",
|
|
32639
32718
|
relativePath,
|
|
@@ -32643,9 +32722,9 @@ function cleanupRemovedOpenCodeArtifact(relativePath, paths, logger) {
|
|
|
32643
32722
|
}
|
|
32644
32723
|
if (relativePath.startsWith("commands/")) {
|
|
32645
32724
|
removeManagedCompiledArtifact2(
|
|
32646
|
-
|
|
32725
|
+
path45.join(
|
|
32647
32726
|
resolveTargetPath(paths.commands ?? ""),
|
|
32648
|
-
`${
|
|
32727
|
+
`${path45.parse(relativePath).name}.md`
|
|
32649
32728
|
),
|
|
32650
32729
|
"opencode",
|
|
32651
32730
|
relativePath,
|
|
@@ -32677,9 +32756,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32677
32756
|
}
|
|
32678
32757
|
if (relativePath.startsWith("agents/")) {
|
|
32679
32758
|
removeManagedCompiledArtifact2(
|
|
32680
|
-
|
|
32759
|
+
path45.join(
|
|
32681
32760
|
resolveTargetPath(paths.agents ?? ""),
|
|
32682
|
-
`${
|
|
32761
|
+
`${path45.parse(relativePath).name}.md`
|
|
32683
32762
|
),
|
|
32684
32763
|
"cursor",
|
|
32685
32764
|
relativePath,
|
|
@@ -32689,9 +32768,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32689
32768
|
}
|
|
32690
32769
|
if (relativePath.startsWith("rules/")) {
|
|
32691
32770
|
removeManagedCompiledArtifact2(
|
|
32692
|
-
|
|
32771
|
+
path45.join(
|
|
32693
32772
|
resolveTargetPath(paths.rules ?? ""),
|
|
32694
|
-
`${
|
|
32773
|
+
`${path45.parse(relativePath).name}.mdc`
|
|
32695
32774
|
),
|
|
32696
32775
|
"cursor",
|
|
32697
32776
|
relativePath,
|
|
@@ -32701,9 +32780,9 @@ function cleanupRemovedCursorArtifact(relativePath, paths, logger) {
|
|
|
32701
32780
|
}
|
|
32702
32781
|
if (relativePath.startsWith("commands/")) {
|
|
32703
32782
|
removeManagedCompiledArtifact2(
|
|
32704
|
-
|
|
32783
|
+
path45.join(
|
|
32705
32784
|
resolveTargetPath(paths.skills ?? ""),
|
|
32706
|
-
|
|
32785
|
+
path45.parse(relativePath).name,
|
|
32707
32786
|
"SKILL.md"
|
|
32708
32787
|
),
|
|
32709
32788
|
"cursor",
|
|
@@ -32747,9 +32826,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32747
32826
|
}
|
|
32748
32827
|
if (relativePath.startsWith("rules/")) {
|
|
32749
32828
|
removeManagedCompiledArtifact2(
|
|
32750
|
-
|
|
32829
|
+
path45.join(
|
|
32751
32830
|
resolveTargetPath(paths.rules ?? ""),
|
|
32752
|
-
`${
|
|
32831
|
+
`${path45.parse(relativePath).name}.md`
|
|
32753
32832
|
),
|
|
32754
32833
|
"cline",
|
|
32755
32834
|
relativePath,
|
|
@@ -32759,9 +32838,9 @@ function cleanupRemovedClineArtifact(relativePath, paths, logger) {
|
|
|
32759
32838
|
}
|
|
32760
32839
|
if (relativePath.startsWith("commands/")) {
|
|
32761
32840
|
removeManagedCompiledArtifact2(
|
|
32762
|
-
|
|
32841
|
+
path45.join(
|
|
32763
32842
|
resolveTargetPath(paths.workflows ?? ""),
|
|
32764
|
-
|
|
32843
|
+
path45.basename(relativePath)
|
|
32765
32844
|
),
|
|
32766
32845
|
"cline",
|
|
32767
32846
|
relativePath,
|
|
@@ -32930,7 +33009,7 @@ function removeManagedHookEntries(value, expectedSource) {
|
|
|
32930
33009
|
|
|
32931
33010
|
// src/commands/validate.ts
|
|
32932
33011
|
import fs44 from "fs";
|
|
32933
|
-
import
|
|
33012
|
+
import path46 from "path";
|
|
32934
33013
|
var SUPPORTED_KIT_FORMATS2 = [1];
|
|
32935
33014
|
var SUPPORTED_DISCIPLINE_VERSIONS = [
|
|
32936
33015
|
"0.14.0",
|
|
@@ -33024,7 +33103,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33024
33103
|
const notices = [];
|
|
33025
33104
|
const canonical = new Set(CANONICAL_SKILL_SUBFOLDERS);
|
|
33026
33105
|
for (const name of kit.components.skills.declared) {
|
|
33027
|
-
const skillDir =
|
|
33106
|
+
const skillDir = path46.join(kit.path, "skills", name);
|
|
33028
33107
|
let entries;
|
|
33029
33108
|
try {
|
|
33030
33109
|
entries = fs44.readdirSync(skillDir, { withFileTypes: true });
|
|
@@ -33045,7 +33124,7 @@ function checkSkillSubfolderNames(kit) {
|
|
|
33045
33124
|
return notices;
|
|
33046
33125
|
}
|
|
33047
33126
|
function checkHooksSourceForm(kit) {
|
|
33048
|
-
const hooksDir =
|
|
33127
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33049
33128
|
const message = describeHooksSourceConflict(
|
|
33050
33129
|
hooksDir,
|
|
33051
33130
|
kit.components.hooks.declared
|
|
@@ -33057,12 +33136,12 @@ function checkHooksSourceForm(kit) {
|
|
|
33057
33136
|
} : null;
|
|
33058
33137
|
}
|
|
33059
33138
|
function checkHookDeclarations(kit) {
|
|
33060
|
-
const hooksDir =
|
|
33139
|
+
const hooksDir = path46.join(kit.path, "hooks");
|
|
33061
33140
|
return collectHookRejections(hooksDir, kit.components.hooks.declared).map(
|
|
33062
33141
|
(r) => ({
|
|
33063
33142
|
code: "hook-declaration-invalid",
|
|
33064
|
-
location: `hooks/${
|
|
33065
|
-
message: `hooks: '${
|
|
33143
|
+
location: `hooks/${path46.basename(r.file)}`,
|
|
33144
|
+
message: `hooks: '${path46.basename(r.file, ".md")}' was rejected at '${r.field}' \u2014 ${r.reason}. Until this is fixed the hook is not installed on any target; install and sync report it as an error-severity loss and exit 3. To fix: correct the field named above in this file.`
|
|
33066
33145
|
})
|
|
33067
33146
|
);
|
|
33068
33147
|
}
|
|
@@ -33082,11 +33161,11 @@ function checkKitFormatSupported(kit) {
|
|
|
33082
33161
|
function checkEntrypointExists(kit) {
|
|
33083
33162
|
const declared = kit.entrypoint;
|
|
33084
33163
|
const entrypoint = declared ?? DEFAULT_ENTRYPOINT;
|
|
33085
|
-
const entrypointPath =
|
|
33164
|
+
const entrypointPath = path46.join(kit.path, entrypoint);
|
|
33086
33165
|
if (fs44.existsSync(entrypointPath)) {
|
|
33087
33166
|
return null;
|
|
33088
33167
|
}
|
|
33089
|
-
const legacyPresent = declared === void 0 && fs44.existsSync(
|
|
33168
|
+
const legacyPresent = declared === void 0 && fs44.existsSync(path46.join(kit.path, LEGACY_ENTRYPOINT));
|
|
33090
33169
|
const remedy = legacyPresent ? `This kit has '${LEGACY_ENTRYPOINT}' but not '${DEFAULT_ENTRYPOINT}'. Until now validate looked for '${LEGACY_ENTRYPOINT}' unconditionally; it now reads the manifest's 'entrypoint', defaulting to '${DEFAULT_ENTRYPOINT}' \u2014 the contract's canonical orientation document, of which '${LEGACY_ENTRYPOINT}' is a target translation. To fix: either add "entrypoint: ${LEGACY_ENTRYPOINT}" to tangyr-kit.yaml to keep the current filename, or rename '${LEGACY_ENTRYPOINT}' to '${DEFAULT_ENTRYPOINT}'.` : declared === void 0 ? `No 'entrypoint' is declared in tangyr-kit.yaml, so '${DEFAULT_ENTRYPOINT}' is expected at the kit root. To fix: create it, or declare the file you use with "entrypoint: <filename>".` : `tangyr-kit.yaml declares "entrypoint: ${declared}", and no such file exists at the kit root. To fix: create it, or correct the declaration.`;
|
|
33091
33170
|
return {
|
|
33092
33171
|
code: "entrypoint-missing",
|
|
@@ -33142,9 +33221,9 @@ function checkComponentFrontmatter(kit) {
|
|
|
33142
33221
|
const missingSet = new Set(kit.components[cat].missing);
|
|
33143
33222
|
for (const name of kit.components[cat].declared) {
|
|
33144
33223
|
if (missingSet.has(name)) continue;
|
|
33145
|
-
const filePath = cat === "skills" ?
|
|
33224
|
+
const filePath = cat === "skills" ? path46.join(kit.path, cat, name, "SKILL.md") : path46.join(kit.path, cat, `${name}.md`);
|
|
33146
33225
|
if (!fs44.existsSync(filePath)) continue;
|
|
33147
|
-
const relPath =
|
|
33226
|
+
const relPath = path46.relative(kit.path, filePath);
|
|
33148
33227
|
try {
|
|
33149
33228
|
const { data } = parseMarkdownFrontmatter(filePath);
|
|
33150
33229
|
for (const field of requiredFields) {
|
|
@@ -33189,7 +33268,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33189
33268
|
const missingSet = new Set(kit.components.commands.missing);
|
|
33190
33269
|
for (const name of kit.components.commands.declared) {
|
|
33191
33270
|
if (missingSet.has(name)) continue;
|
|
33192
|
-
const filePath =
|
|
33271
|
+
const filePath = path46.join(kit.path, "commands", `${name}.md`);
|
|
33193
33272
|
if (!fs44.existsSync(filePath)) continue;
|
|
33194
33273
|
let data;
|
|
33195
33274
|
try {
|
|
@@ -33203,7 +33282,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33203
33282
|
if (!barred) {
|
|
33204
33283
|
violations.push({
|
|
33205
33284
|
code: "command-human-only-model-invocable",
|
|
33206
|
-
location:
|
|
33285
|
+
location: path46.relative(kit.path, filePath),
|
|
33207
33286
|
message: "commands: 'launch: human-only' requires 'disable-model-invocation: true' so the model cannot start the command; only a Human-typed launch may"
|
|
33208
33287
|
});
|
|
33209
33288
|
}
|
|
@@ -33213,7 +33292,7 @@ function checkHumanOnlyCommandInvocation(kit) {
|
|
|
33213
33292
|
|
|
33214
33293
|
// src/commands/verify.ts
|
|
33215
33294
|
import fs45 from "fs";
|
|
33216
|
-
import
|
|
33295
|
+
import path47 from "path";
|
|
33217
33296
|
function runVerifyCommand(options, logger) {
|
|
33218
33297
|
const { config, configDir, sourceRoot, kitInfo } = resolveRuntime(
|
|
33219
33298
|
options,
|
|
@@ -33304,7 +33383,7 @@ function verifyClaudeCodeGlobalRoots(roots, manifestKeys, mappings) {
|
|
|
33304
33383
|
if (!slotPath) {
|
|
33305
33384
|
continue;
|
|
33306
33385
|
}
|
|
33307
|
-
const fullPath = subPath ?
|
|
33386
|
+
const fullPath = subPath ? path47.join(slotPath, subPath) : slotPath;
|
|
33308
33387
|
if (!fs45.existsSync(fullPath)) {
|
|
33309
33388
|
failures.push(
|
|
33310
33389
|
`claude-code/${slot}${subPath ? `/${subPath}` : ""} missing in root ${root}: ${fullPath}`
|