aiblueprint-cli 1.4.66 → 1.4.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +1957 -1747
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34891,953 +34891,732 @@ async function symlinkCommand(params = {}) {
|
|
|
34891
34891
|
}
|
|
34892
34892
|
}
|
|
34893
34893
|
|
|
34894
|
-
//
|
|
34895
|
-
var
|
|
34896
|
-
|
|
34897
|
-
import
|
|
34898
|
-
import
|
|
34899
|
-
|
|
34900
|
-
|
|
34901
|
-
|
|
34902
|
-
"
|
|
34903
|
-
|
|
34904
|
-
function uniqueByPath(candidates) {
|
|
34905
|
-
const seen = new Set;
|
|
34906
|
-
const unique = [];
|
|
34907
|
-
for (const candidate of candidates) {
|
|
34908
|
-
const resolved = path16.resolve(candidate.path);
|
|
34909
|
-
if (seen.has(resolved))
|
|
34910
|
-
continue;
|
|
34911
|
-
seen.add(resolved);
|
|
34912
|
-
unique.push({ ...candidate, path: resolved });
|
|
34913
|
-
}
|
|
34914
|
-
return unique;
|
|
34915
|
-
}
|
|
34916
|
-
function getContainerCandidates(options) {
|
|
34917
|
-
const folders = resolveFolders(options);
|
|
34918
|
-
const cursorDir = path16.join(folders.rootDir, ".cursor");
|
|
34919
|
-
const factoryDir = path16.join(folders.rootDir, ".factory");
|
|
34920
|
-
const opencodeDir = path16.join(folders.rootDir, ".config", "opencode");
|
|
34921
|
-
return uniqueByPath([
|
|
34922
|
-
{
|
|
34923
|
-
category: "skills",
|
|
34924
|
-
label: "agents-skills",
|
|
34925
|
-
path: path16.join(folders.agentsDir, "skills"),
|
|
34926
|
-
isDestination: true
|
|
34927
|
-
},
|
|
34928
|
-
{
|
|
34929
|
-
category: "skills",
|
|
34930
|
-
label: "claude-skills",
|
|
34931
|
-
path: path16.join(folders.claudeDir, "skills"),
|
|
34932
|
-
linkWhenMissing: true
|
|
34933
|
-
},
|
|
34934
|
-
{
|
|
34935
|
-
category: "skills",
|
|
34936
|
-
label: "codex-skills",
|
|
34937
|
-
path: path16.join(folders.codexDir, "skills"),
|
|
34938
|
-
linkWhenMissing: true
|
|
34939
|
-
},
|
|
34940
|
-
{
|
|
34941
|
-
category: "skills",
|
|
34942
|
-
label: "cursor-skills",
|
|
34943
|
-
path: path16.join(cursorDir, "skills"),
|
|
34944
|
-
linkWhenParentExists: true
|
|
34945
|
-
},
|
|
34946
|
-
{
|
|
34947
|
-
category: "skills",
|
|
34948
|
-
label: "cursor-skills-cursor",
|
|
34949
|
-
path: path16.join(cursorDir, "skills-cursor"),
|
|
34950
|
-
linkWhenParentExists: true
|
|
34951
|
-
},
|
|
34952
|
-
{
|
|
34953
|
-
category: "skills",
|
|
34954
|
-
label: "factory-skills",
|
|
34955
|
-
path: path16.join(factoryDir, "skills"),
|
|
34956
|
-
linkWhenParentExists: true
|
|
34957
|
-
},
|
|
34958
|
-
{
|
|
34959
|
-
category: "skills",
|
|
34960
|
-
label: "opencode-skill",
|
|
34961
|
-
path: path16.join(opencodeDir, "skill"),
|
|
34962
|
-
linkWhenParentExists: true
|
|
34963
|
-
},
|
|
34964
|
-
{
|
|
34965
|
-
category: "skills",
|
|
34966
|
-
label: "opencode-skills",
|
|
34967
|
-
path: path16.join(opencodeDir, "skills"),
|
|
34968
|
-
linkWhenParentExists: true
|
|
34969
|
-
},
|
|
34970
|
-
{
|
|
34971
|
-
category: "agents",
|
|
34972
|
-
label: "agents-agents",
|
|
34973
|
-
path: path16.join(folders.agentsDir, "agents"),
|
|
34974
|
-
isDestination: true
|
|
34975
|
-
},
|
|
34976
|
-
{
|
|
34977
|
-
category: "agents",
|
|
34978
|
-
label: "claude-agents",
|
|
34979
|
-
path: path16.join(folders.claudeDir, "agents"),
|
|
34980
|
-
linkWhenMissing: true
|
|
34981
|
-
},
|
|
34982
|
-
{
|
|
34983
|
-
category: "agents",
|
|
34984
|
-
label: "claude-agnets",
|
|
34985
|
-
path: path16.join(folders.claudeDir, "agnets")
|
|
34986
|
-
},
|
|
34987
|
-
{
|
|
34988
|
-
category: "agents",
|
|
34989
|
-
label: "cursor-agents",
|
|
34990
|
-
path: path16.join(cursorDir, "agents"),
|
|
34991
|
-
linkWhenParentExists: true
|
|
34992
|
-
},
|
|
34993
|
-
{
|
|
34994
|
-
category: "agents",
|
|
34995
|
-
label: "factory-droids",
|
|
34996
|
-
path: path16.join(factoryDir, "droids"),
|
|
34997
|
-
linkWhenParentExists: true
|
|
34998
|
-
},
|
|
34999
|
-
{
|
|
35000
|
-
category: "agents",
|
|
35001
|
-
label: "opencode-agent",
|
|
35002
|
-
path: path16.join(opencodeDir, "agent"),
|
|
35003
|
-
linkWhenParentExists: true
|
|
35004
|
-
},
|
|
35005
|
-
{
|
|
35006
|
-
category: "agents",
|
|
35007
|
-
label: "opencode-agents",
|
|
35008
|
-
path: path16.join(opencodeDir, "agents"),
|
|
35009
|
-
linkWhenParentExists: true
|
|
35010
|
-
}
|
|
35011
|
-
]);
|
|
35012
|
-
}
|
|
35013
|
-
function getInstructionFileCandidates(options) {
|
|
35014
|
-
const folders = resolveFolders(options);
|
|
35015
|
-
return uniqueByPath([
|
|
35016
|
-
{
|
|
35017
|
-
label: "agents-instructions",
|
|
35018
|
-
path: path16.join(folders.agentsDir, "AGENTS.md"),
|
|
35019
|
-
isDestination: true
|
|
35020
|
-
},
|
|
35021
|
-
{
|
|
35022
|
-
label: "claude-instructions",
|
|
35023
|
-
path: path16.join(folders.claudeDir, "CLAUDE.md"),
|
|
35024
|
-
linkWhenMissing: true
|
|
35025
|
-
},
|
|
35026
|
-
{
|
|
35027
|
-
label: "codex-instructions",
|
|
35028
|
-
path: path16.join(folders.codexDir, "AGENTS.md"),
|
|
35029
|
-
linkWhenMissing: true
|
|
35030
|
-
}
|
|
35031
|
-
]);
|
|
35032
|
-
}
|
|
35033
|
-
function getRepositoryContainerCandidates(options) {
|
|
35034
|
-
const folders = resolveFolders(options);
|
|
35035
|
-
const cursorDir = path16.join(folders.rootDir, ".cursor");
|
|
35036
|
-
return uniqueByPath([
|
|
35037
|
-
...getContainerCandidates(options),
|
|
35038
|
-
{
|
|
35039
|
-
category: "rules",
|
|
35040
|
-
label: "agents-rules",
|
|
35041
|
-
path: path16.join(folders.agentsDir, "rules"),
|
|
35042
|
-
isDestination: true
|
|
35043
|
-
},
|
|
35044
|
-
{
|
|
35045
|
-
category: "rules",
|
|
35046
|
-
label: "claude-rules",
|
|
35047
|
-
path: path16.join(folders.claudeDir, "rules"),
|
|
35048
|
-
linkWhenMissing: true
|
|
35049
|
-
},
|
|
35050
|
-
{
|
|
35051
|
-
category: "rules",
|
|
35052
|
-
label: "codex-rules",
|
|
35053
|
-
path: path16.join(folders.codexDir, "rules"),
|
|
35054
|
-
linkWhenParentExists: true
|
|
35055
|
-
},
|
|
35056
|
-
{
|
|
35057
|
-
category: "rules",
|
|
35058
|
-
label: "cursor-rules",
|
|
35059
|
-
path: path16.join(cursorDir, "rules"),
|
|
35060
|
-
linkWhenParentExists: true
|
|
35061
|
-
},
|
|
35062
|
-
{
|
|
35063
|
-
category: "rules",
|
|
35064
|
-
label: "claude-memories",
|
|
35065
|
-
path: path16.join(folders.claudeDir, "memories"),
|
|
35066
|
-
linkSource: false
|
|
35067
|
-
},
|
|
35068
|
-
{
|
|
35069
|
-
category: "rules",
|
|
35070
|
-
label: "codex-memories",
|
|
35071
|
-
path: path16.join(folders.codexDir, "memories"),
|
|
35072
|
-
linkSource: false
|
|
35073
|
-
},
|
|
35074
|
-
{
|
|
35075
|
-
category: "rules",
|
|
35076
|
-
label: "cursor-memories",
|
|
35077
|
-
path: path16.join(cursorDir, "memories"),
|
|
35078
|
-
linkSource: false
|
|
35079
|
-
},
|
|
35080
|
-
{
|
|
35081
|
-
category: "rules",
|
|
35082
|
-
label: "claude-memory",
|
|
35083
|
-
path: path16.join(folders.claudeDir, "memory.md"),
|
|
35084
|
-
linkSource: false
|
|
35085
|
-
},
|
|
35086
|
-
{
|
|
35087
|
-
category: "rules",
|
|
35088
|
-
label: "codex-memory",
|
|
35089
|
-
path: path16.join(folders.codexDir, "memory.md"),
|
|
35090
|
-
linkSource: false
|
|
35091
|
-
},
|
|
35092
|
-
{
|
|
35093
|
-
category: "rules",
|
|
35094
|
-
label: "cursor-memory",
|
|
35095
|
-
path: path16.join(cursorDir, "memory.md"),
|
|
35096
|
-
linkSource: false
|
|
35097
|
-
},
|
|
35098
|
-
{
|
|
35099
|
-
category: "rules",
|
|
35100
|
-
label: "claude-memory-uppercase",
|
|
35101
|
-
path: path16.join(folders.claudeDir, "MEMORY.md"),
|
|
35102
|
-
linkSource: false
|
|
35103
|
-
},
|
|
35104
|
-
{
|
|
35105
|
-
category: "rules",
|
|
35106
|
-
label: "codex-memory-uppercase",
|
|
35107
|
-
path: path16.join(folders.codexDir, "MEMORY.md"),
|
|
35108
|
-
linkSource: false
|
|
35109
|
-
},
|
|
35110
|
-
{
|
|
35111
|
-
category: "rules",
|
|
35112
|
-
label: "cursor-memory-uppercase",
|
|
35113
|
-
path: path16.join(cursorDir, "MEMORY.md"),
|
|
35114
|
-
linkSource: false
|
|
35115
|
-
}
|
|
35116
|
-
]);
|
|
35117
|
-
}
|
|
35118
|
-
async function pathExistsOrSymlink(targetPath) {
|
|
35119
|
-
const stat = await import_fs_extra12.default.lstat(targetPath).catch(() => null);
|
|
35120
|
-
return Boolean(stat);
|
|
35121
|
-
}
|
|
35122
|
-
async function realPathIfPossible(targetPath) {
|
|
35123
|
-
try {
|
|
35124
|
-
return await import_fs_extra12.default.realpath(targetPath);
|
|
35125
|
-
} catch {
|
|
35126
|
-
return null;
|
|
35127
|
-
}
|
|
35128
|
-
}
|
|
35129
|
-
function samePath(a, b) {
|
|
35130
|
-
return path16.resolve(a) === path16.resolve(b);
|
|
35131
|
-
}
|
|
35132
|
-
function hashString(value) {
|
|
35133
|
-
return crypto.createHash("sha256").update(value).digest("hex");
|
|
35134
|
-
}
|
|
35135
|
-
async function hashPath(targetPath) {
|
|
35136
|
-
const stat = await import_fs_extra12.default.lstat(targetPath);
|
|
35137
|
-
if (stat.isSymbolicLink()) {
|
|
35138
|
-
const linkTarget = await import_fs_extra12.default.readlink(targetPath);
|
|
35139
|
-
return hashString(`symlink:${linkTarget}`);
|
|
35140
|
-
}
|
|
35141
|
-
if (stat.isFile()) {
|
|
35142
|
-
const fileHash = crypto.createHash("sha256");
|
|
35143
|
-
fileHash.update("file:");
|
|
35144
|
-
fileHash.update(await import_fs_extra12.default.readFile(targetPath));
|
|
35145
|
-
return fileHash.digest("hex");
|
|
35146
|
-
}
|
|
35147
|
-
if (stat.isDirectory()) {
|
|
35148
|
-
const entries = (await import_fs_extra12.default.readdir(targetPath, { withFileTypes: true })).filter((entry) => !IGNORED_ENTRY_NAMES2.has(entry.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
35149
|
-
const dirHash = crypto.createHash("sha256");
|
|
35150
|
-
dirHash.update("dir:");
|
|
35151
|
-
for (const entry of entries) {
|
|
35152
|
-
dirHash.update(entry.name);
|
|
35153
|
-
dirHash.update("\x00");
|
|
35154
|
-
dirHash.update(await hashPath(path16.join(targetPath, entry.name)));
|
|
35155
|
-
dirHash.update("\x00");
|
|
35156
|
-
}
|
|
35157
|
-
return dirHash.digest("hex");
|
|
35158
|
-
}
|
|
35159
|
-
return hashString(`other:${stat.mode}:${stat.size}`);
|
|
35160
|
-
}
|
|
35161
|
-
var TEXT_EXTENSIONS = new Set([
|
|
35162
|
-
".cjs",
|
|
35163
|
-
".js",
|
|
35164
|
-
".json",
|
|
35165
|
-
".jsonc",
|
|
35166
|
-
".md",
|
|
35167
|
-
".mdc",
|
|
35168
|
-
".mjs",
|
|
35169
|
-
".sh",
|
|
35170
|
-
".toml",
|
|
35171
|
-
".ts",
|
|
35172
|
-
".tsx",
|
|
35173
|
-
".txt",
|
|
35174
|
-
".yaml",
|
|
35175
|
-
".yml"
|
|
35176
|
-
]);
|
|
35177
|
-
var PORTABLE_PATH_REPLACEMENTS = [
|
|
35178
|
-
[/\.claude\/skills/g, ".agents/skills"],
|
|
35179
|
-
[/\.codex\/skills/g, ".agents/skills"],
|
|
35180
|
-
[/\.cursor\/skills-cursor/g, ".agents/skills"],
|
|
35181
|
-
[/\.cursor\/skills/g, ".agents/skills"],
|
|
35182
|
-
[/\.claude\/agents/g, ".agents/agents"],
|
|
35183
|
-
[/\.codex\/agents/g, ".agents/agents"],
|
|
35184
|
-
[/\.cursor\/agents/g, ".agents/agents"],
|
|
35185
|
-
[/\.claude\/rules/g, ".agents/rules"],
|
|
35186
|
-
[/\.codex\/rules/g, ".agents/rules"],
|
|
35187
|
-
[/\.cursor\/rules/g, ".agents/rules"],
|
|
35188
|
-
[/\.claude\/memories/g, ".agents/rules"],
|
|
35189
|
-
[/\.codex\/memories/g, ".agents/rules"],
|
|
35190
|
-
[/\.cursor\/memories/g, ".agents/rules"]
|
|
35191
|
-
];
|
|
35192
|
-
function normalizePortableText(content) {
|
|
35193
|
-
let normalized = content;
|
|
35194
|
-
for (const [pattern, replacement] of PORTABLE_PATH_REPLACEMENTS) {
|
|
35195
|
-
normalized = normalized.replace(pattern, replacement);
|
|
35196
|
-
}
|
|
35197
|
-
return normalized;
|
|
35198
|
-
}
|
|
35199
|
-
function isLikelyTextFile(filePath) {
|
|
35200
|
-
const ext = path16.extname(filePath).toLowerCase();
|
|
35201
|
-
if (TEXT_EXTENSIONS.has(ext))
|
|
35202
|
-
return true;
|
|
35203
|
-
return path16.basename(filePath) === "SKILL.md";
|
|
34894
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
34895
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
34896
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
34897
|
+
import { stdin as j, stdout as M } from "node:process";
|
|
34898
|
+
import * as g from "node:readline";
|
|
34899
|
+
import O from "node:readline";
|
|
34900
|
+
import { Writable as X } from "node:stream";
|
|
34901
|
+
function DD({ onlyFirst: e = false } = {}) {
|
|
34902
|
+
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
34903
|
+
return new RegExp(t, e ? undefined : "g");
|
|
35204
34904
|
}
|
|
35205
|
-
|
|
35206
|
-
|
|
35207
|
-
if (
|
|
35208
|
-
|
|
35209
|
-
|
|
35210
|
-
const entries = await import_fs_extra12.default.readdir(targetPath);
|
|
35211
|
-
for (const entry of entries) {
|
|
35212
|
-
if (IGNORED_ENTRY_NAMES2.has(entry))
|
|
35213
|
-
continue;
|
|
35214
|
-
await normalizePortableContent(path16.join(targetPath, entry));
|
|
35215
|
-
}
|
|
35216
|
-
return;
|
|
35217
|
-
}
|
|
35218
|
-
if (!stat.isFile() || !isLikelyTextFile(targetPath))
|
|
35219
|
-
return;
|
|
35220
|
-
const content = await import_fs_extra12.default.readFile(targetPath, "utf-8").catch(() => null);
|
|
35221
|
-
if (content === null || content.includes("\x00"))
|
|
35222
|
-
return;
|
|
35223
|
-
const normalized = normalizePortableText(content);
|
|
35224
|
-
if (normalized !== content) {
|
|
35225
|
-
await import_fs_extra12.default.writeFile(targetPath, normalized, "utf-8");
|
|
35226
|
-
}
|
|
34905
|
+
var uD = DD();
|
|
34906
|
+
function P(e) {
|
|
34907
|
+
if (typeof e != "string")
|
|
34908
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
34909
|
+
return e.replace(uD, "");
|
|
35227
34910
|
}
|
|
35228
|
-
function
|
|
35229
|
-
return
|
|
34911
|
+
function L(e) {
|
|
34912
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
35230
34913
|
}
|
|
35231
|
-
|
|
35232
|
-
|
|
35233
|
-
|
|
35234
|
-
|
|
35235
|
-
|
|
34914
|
+
var W = { exports: {} };
|
|
34915
|
+
(function(e) {
|
|
34916
|
+
var u = {};
|
|
34917
|
+
e.exports = u, u.eastAsianWidth = function(F) {
|
|
34918
|
+
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
34919
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
34920
|
+
}, u.characterLength = function(F) {
|
|
34921
|
+
var s = this.eastAsianWidth(F);
|
|
34922
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
34923
|
+
};
|
|
34924
|
+
function t(F) {
|
|
34925
|
+
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
35236
34926
|
}
|
|
35237
|
-
|
|
35238
|
-
|
|
35239
|
-
|
|
35240
|
-
|
|
35241
|
-
|
|
35242
|
-
|
|
35243
|
-
|
|
35244
|
-
|
|
35245
|
-
|
|
34927
|
+
u.length = function(F) {
|
|
34928
|
+
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
34929
|
+
i = i + this.characterLength(s[D]);
|
|
34930
|
+
return i;
|
|
34931
|
+
}, u.slice = function(F, s, i) {
|
|
34932
|
+
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
34933
|
+
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
34934
|
+
var a = n[E], o = u.length(a);
|
|
34935
|
+
if (C >= s - (o == 2 ? 1 : 0))
|
|
34936
|
+
if (C + o <= i)
|
|
34937
|
+
D += a;
|
|
34938
|
+
else
|
|
34939
|
+
break;
|
|
34940
|
+
C += o;
|
|
34941
|
+
}
|
|
34942
|
+
return D;
|
|
34943
|
+
};
|
|
34944
|
+
})(W);
|
|
34945
|
+
var tD = W.exports;
|
|
34946
|
+
var eD = L(tD);
|
|
34947
|
+
var FD = function() {
|
|
34948
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
34949
|
+
};
|
|
34950
|
+
var sD = L(FD);
|
|
34951
|
+
function p(e, u = {}) {
|
|
34952
|
+
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
34953
|
+
return 0;
|
|
34954
|
+
e = e.replace(sD(), " ");
|
|
34955
|
+
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
34956
|
+
let F = 0;
|
|
34957
|
+
for (const s of e) {
|
|
34958
|
+
const i = s.codePointAt(0);
|
|
34959
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
34960
|
+
continue;
|
|
34961
|
+
switch (eD.eastAsianWidth(s)) {
|
|
34962
|
+
case "F":
|
|
34963
|
+
case "W":
|
|
34964
|
+
F += 2;
|
|
34965
|
+
break;
|
|
34966
|
+
case "A":
|
|
34967
|
+
F += t;
|
|
34968
|
+
break;
|
|
34969
|
+
default:
|
|
34970
|
+
F += 1;
|
|
35246
34971
|
}
|
|
35247
|
-
index++;
|
|
35248
34972
|
}
|
|
34973
|
+
return F;
|
|
35249
34974
|
}
|
|
35250
|
-
|
|
35251
|
-
|
|
35252
|
-
|
|
35253
|
-
|
|
35254
|
-
|
|
35255
|
-
|
|
35256
|
-
|
|
35257
|
-
|
|
35258
|
-
|
|
34975
|
+
var w = 10;
|
|
34976
|
+
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
34977
|
+
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
34978
|
+
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
34979
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
34980
|
+
Object.keys(r.modifier);
|
|
34981
|
+
var iD = Object.keys(r.color);
|
|
34982
|
+
var CD = Object.keys(r.bgColor);
|
|
34983
|
+
[...iD, ...CD];
|
|
34984
|
+
function rD() {
|
|
34985
|
+
const e = new Map;
|
|
34986
|
+
for (const [u, t] of Object.entries(r)) {
|
|
34987
|
+
for (const [F, s] of Object.entries(t))
|
|
34988
|
+
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
34989
|
+
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
35259
34990
|
}
|
|
34991
|
+
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
34992
|
+
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
34993
|
+
if (!t)
|
|
34994
|
+
return [0, 0, 0];
|
|
34995
|
+
let [F] = t;
|
|
34996
|
+
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
34997
|
+
const s = Number.parseInt(F, 16);
|
|
34998
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
34999
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
35000
|
+
if (u < 8)
|
|
35001
|
+
return 30 + u;
|
|
35002
|
+
if (u < 16)
|
|
35003
|
+
return 90 + (u - 8);
|
|
35004
|
+
let t, F, s;
|
|
35005
|
+
if (u >= 232)
|
|
35006
|
+
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
35007
|
+
else {
|
|
35008
|
+
u -= 16;
|
|
35009
|
+
const C = u % 36;
|
|
35010
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
35011
|
+
}
|
|
35012
|
+
const i = Math.max(t, F, s) * 2;
|
|
35013
|
+
if (i === 0)
|
|
35014
|
+
return 30;
|
|
35015
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
35016
|
+
return i === 2 && (D += 60), D;
|
|
35017
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
35260
35018
|
}
|
|
35261
|
-
|
|
35262
|
-
|
|
35263
|
-
|
|
35264
|
-
|
|
35265
|
-
|
|
35266
|
-
|
|
35267
|
-
|
|
35268
|
-
|
|
35269
|
-
|
|
35270
|
-
|
|
35271
|
-
|
|
35272
|
-
|
|
35273
|
-
|
|
35019
|
+
var ED = rD();
|
|
35020
|
+
var d = new Set(["\x1B", ""]);
|
|
35021
|
+
var oD = 39;
|
|
35022
|
+
var y = "\x07";
|
|
35023
|
+
var V = "[";
|
|
35024
|
+
var nD = "]";
|
|
35025
|
+
var G = "m";
|
|
35026
|
+
var _2 = `${nD}8;;`;
|
|
35027
|
+
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
35028
|
+
var K = (e) => `${d.values().next().value}${_2}${e}${y}`;
|
|
35029
|
+
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
35030
|
+
var k = (e, u, t) => {
|
|
35031
|
+
const F = [...u];
|
|
35032
|
+
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
35033
|
+
for (const [C, n] of F.entries()) {
|
|
35034
|
+
const E = p(n);
|
|
35035
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_2)), s) {
|
|
35036
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
35274
35037
|
continue;
|
|
35275
35038
|
}
|
|
35276
|
-
|
|
35277
|
-
|
|
35278
|
-
|
|
35279
|
-
|
|
35280
|
-
|
|
35281
|
-
|
|
35282
|
-
|
|
35039
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
35040
|
+
}
|
|
35041
|
+
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
35042
|
+
};
|
|
35043
|
+
var hD = (e) => {
|
|
35044
|
+
const u = e.split(" ");
|
|
35045
|
+
let t = u.length;
|
|
35046
|
+
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
35047
|
+
t--;
|
|
35048
|
+
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
35049
|
+
};
|
|
35050
|
+
var lD = (e, u, t = {}) => {
|
|
35051
|
+
if (t.trim !== false && e.trim() === "")
|
|
35052
|
+
return "";
|
|
35053
|
+
let F = "", s, i;
|
|
35054
|
+
const D = aD(e);
|
|
35055
|
+
let C = [""];
|
|
35056
|
+
for (const [E, a] of e.split(" ").entries()) {
|
|
35057
|
+
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
35058
|
+
let o = p(C[C.length - 1]);
|
|
35059
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
35060
|
+
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
35061
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
35283
35062
|
continue;
|
|
35284
35063
|
}
|
|
35285
|
-
|
|
35286
|
-
if (
|
|
35287
|
-
|
|
35288
|
-
const sourcePath = entry.path;
|
|
35289
|
-
const sourceHash = await hashPath(sourcePath);
|
|
35290
|
-
const existingName = knownHashes.get(sourceHash);
|
|
35291
|
-
if (existingName) {
|
|
35292
|
-
result.duplicates.push({
|
|
35293
|
-
category,
|
|
35294
|
-
name: entry.name,
|
|
35295
|
-
from: sourcePath,
|
|
35296
|
-
keptAs: path16.join(destinationDir, existingName)
|
|
35297
|
-
});
|
|
35064
|
+
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
35065
|
+
if (t.wordWrap === false && o < u) {
|
|
35066
|
+
k(C, a, u);
|
|
35298
35067
|
continue;
|
|
35299
35068
|
}
|
|
35300
|
-
|
|
35301
|
-
let targetPath = path16.join(destinationDir, targetName);
|
|
35302
|
-
if (await pathExistsOrSymlink(targetPath)) {
|
|
35303
|
-
targetName = await findTargetName(destinationDir, entry.name, candidate.label);
|
|
35304
|
-
targetPath = path16.join(destinationDir, targetName);
|
|
35305
|
-
result.renamed.push({
|
|
35306
|
-
category,
|
|
35307
|
-
name: entry.name,
|
|
35308
|
-
from: sourcePath,
|
|
35309
|
-
to: targetPath,
|
|
35310
|
-
reason: "Same name with different content"
|
|
35311
|
-
});
|
|
35312
|
-
}
|
|
35313
|
-
await import_fs_extra12.default.copy(sourcePath, targetPath, {
|
|
35314
|
-
dereference: false,
|
|
35315
|
-
overwrite: false
|
|
35316
|
-
});
|
|
35317
|
-
await normalizePortableContent(targetPath);
|
|
35318
|
-
knownHashes.set(sourceHash, targetName);
|
|
35319
|
-
result.imported.push({
|
|
35320
|
-
category,
|
|
35321
|
-
name: entry.name,
|
|
35322
|
-
from: sourcePath,
|
|
35323
|
-
to: targetPath
|
|
35324
|
-
});
|
|
35069
|
+
C.push("");
|
|
35325
35070
|
}
|
|
35071
|
+
if (o + D[E] > u && t.wordWrap === false) {
|
|
35072
|
+
k(C, a, u);
|
|
35073
|
+
continue;
|
|
35074
|
+
}
|
|
35075
|
+
C[C.length - 1] += a;
|
|
35326
35076
|
}
|
|
35327
|
-
|
|
35328
|
-
|
|
35329
|
-
|
|
35330
|
-
|
|
35331
|
-
|
|
35332
|
-
|
|
35333
|
-
|
|
35334
|
-
|
|
35335
|
-
|
|
35336
|
-
|
|
35337
|
-
|
|
35338
|
-
const targetStat = await import_fs_extra12.default.stat(candidate.path).catch(() => null);
|
|
35339
|
-
if (targetStat?.isDirectory()) {
|
|
35340
|
-
const entries = await import_fs_extra12.default.readdir(candidate.path, { withFileTypes: true });
|
|
35341
|
-
return entries.map((entry) => ({
|
|
35342
|
-
name: entry.name,
|
|
35343
|
-
path: path16.join(candidate.path, entry.name)
|
|
35344
|
-
}));
|
|
35077
|
+
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
35078
|
+
const n = [...C.join(`
|
|
35079
|
+
`)];
|
|
35080
|
+
for (const [E, a] of n.entries()) {
|
|
35081
|
+
if (F += a, d.has(a)) {
|
|
35082
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_2}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
35083
|
+
if (c.code !== undefined) {
|
|
35084
|
+
const f = Number.parseFloat(c.code);
|
|
35085
|
+
s = f === oD ? undefined : f;
|
|
35086
|
+
} else
|
|
35087
|
+
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
35345
35088
|
}
|
|
35089
|
+
const o = ED.codes.get(Number(s));
|
|
35090
|
+
n[E + 1] === `
|
|
35091
|
+
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
35092
|
+
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
35346
35093
|
}
|
|
35347
|
-
return
|
|
35348
|
-
|
|
35349
|
-
|
|
35350
|
-
|
|
35094
|
+
return F;
|
|
35095
|
+
};
|
|
35096
|
+
function Y(e, u, t) {
|
|
35097
|
+
return String(e).normalize().replace(/\r\n/g, `
|
|
35098
|
+
`).split(`
|
|
35099
|
+
`).map((F) => lD(F, u, t)).join(`
|
|
35100
|
+
`);
|
|
35351
35101
|
}
|
|
35352
|
-
|
|
35353
|
-
|
|
35354
|
-
|
|
35355
|
-
if (
|
|
35356
|
-
return
|
|
35357
|
-
|
|
35358
|
-
|
|
35359
|
-
|
|
35360
|
-
|
|
35361
|
-
|
|
35102
|
+
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
35103
|
+
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
35104
|
+
function $(e, u) {
|
|
35105
|
+
if (typeof e == "string")
|
|
35106
|
+
return B.aliases.get(e) === u;
|
|
35107
|
+
for (const t of e)
|
|
35108
|
+
if (t !== undefined && $(t, u))
|
|
35109
|
+
return true;
|
|
35110
|
+
return false;
|
|
35111
|
+
}
|
|
35112
|
+
function BD(e, u) {
|
|
35113
|
+
if (e === u)
|
|
35114
|
+
return;
|
|
35115
|
+
const t = e.split(`
|
|
35116
|
+
`), F = u.split(`
|
|
35117
|
+
`), s = [];
|
|
35118
|
+
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
35119
|
+
t[i] !== F[i] && s.push(i);
|
|
35120
|
+
return s;
|
|
35362
35121
|
}
|
|
35363
|
-
|
|
35364
|
-
|
|
35122
|
+
var AD = globalThis.process.platform.startsWith("win");
|
|
35123
|
+
var S = Symbol("clack:cancel");
|
|
35124
|
+
function pD(e) {
|
|
35125
|
+
return e === S;
|
|
35365
35126
|
}
|
|
35366
|
-
function
|
|
35367
|
-
const
|
|
35368
|
-
|
|
35369
|
-
return path16.join("external", targetPath.replace(/[^a-zA-Z0-9._-]+/g, "-"));
|
|
35370
|
-
}
|
|
35371
|
-
return relativePath;
|
|
35127
|
+
function m(e, u) {
|
|
35128
|
+
const t = e;
|
|
35129
|
+
t.isTTY && t.setRawMode(u);
|
|
35372
35130
|
}
|
|
35373
|
-
function
|
|
35374
|
-
|
|
35131
|
+
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
35132
|
+
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
35133
|
+
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
35134
|
+
const i = (D, { name: C, sequence: n }) => {
|
|
35135
|
+
const E = String(D);
|
|
35136
|
+
if ($([E, C, n], "cancel")) {
|
|
35137
|
+
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
35138
|
+
return;
|
|
35139
|
+
}
|
|
35140
|
+
if (!t)
|
|
35141
|
+
return;
|
|
35142
|
+
const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
|
|
35143
|
+
g.moveCursor(u, a, o, () => {
|
|
35144
|
+
g.clearLine(u, 1, () => {
|
|
35145
|
+
e.once("keypress", i);
|
|
35146
|
+
});
|
|
35147
|
+
});
|
|
35148
|
+
};
|
|
35149
|
+
return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i), () => {
|
|
35150
|
+
e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
|
|
35151
|
+
};
|
|
35375
35152
|
}
|
|
35376
|
-
|
|
35377
|
-
|
|
35378
|
-
|
|
35379
|
-
|
|
35153
|
+
var gD = Object.defineProperty;
|
|
35154
|
+
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
35155
|
+
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
35156
|
+
|
|
35157
|
+
class x {
|
|
35158
|
+
constructor(u, t = true) {
|
|
35159
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
35160
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
35161
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
35380
35162
|
}
|
|
35381
|
-
|
|
35382
|
-
|
|
35383
|
-
async function createDirectorySymlink(source, target) {
|
|
35384
|
-
await import_fs_extra12.default.ensureDir(path16.dirname(target));
|
|
35385
|
-
if (os13.platform() === "win32") {
|
|
35386
|
-
await import_fs_extra12.default.symlink(source, target, "junction");
|
|
35387
|
-
return;
|
|
35163
|
+
unsubscribe() {
|
|
35164
|
+
this._subscribers.clear();
|
|
35388
35165
|
}
|
|
35389
|
-
|
|
35390
|
-
|
|
35391
|
-
|
|
35392
|
-
await import_fs_extra12.default.ensureDir(path16.dirname(target));
|
|
35393
|
-
if (os13.platform() === "win32") {
|
|
35394
|
-
await import_fs_extra12.default.symlink(source, target, "file");
|
|
35395
|
-
return;
|
|
35166
|
+
setSubscriber(u, t) {
|
|
35167
|
+
const F = this._subscribers.get(u) ?? [];
|
|
35168
|
+
F.push(t), this._subscribers.set(u, F);
|
|
35396
35169
|
}
|
|
35397
|
-
|
|
35398
|
-
}
|
|
35399
|
-
async function shouldLinkMissingContainer(candidate) {
|
|
35400
|
-
if (candidate.linkWhenMissing)
|
|
35401
|
-
return true;
|
|
35402
|
-
if (!candidate.linkWhenParentExists)
|
|
35403
|
-
return false;
|
|
35404
|
-
return import_fs_extra12.default.pathExists(path16.dirname(candidate.path));
|
|
35405
|
-
}
|
|
35406
|
-
async function linkContainer(candidate, destinationDir, result) {
|
|
35407
|
-
if (candidate.linkSource === false) {
|
|
35408
|
-
return;
|
|
35170
|
+
on(u, t) {
|
|
35171
|
+
this.setSubscriber(u, { cb: t });
|
|
35409
35172
|
}
|
|
35410
|
-
|
|
35411
|
-
|
|
35173
|
+
once(u, t) {
|
|
35174
|
+
this.setSubscriber(u, { cb: t, once: true });
|
|
35412
35175
|
}
|
|
35413
|
-
|
|
35414
|
-
|
|
35415
|
-
|
|
35416
|
-
|
|
35417
|
-
|
|
35418
|
-
|
|
35419
|
-
result.linked.push({
|
|
35420
|
-
category: candidate.category,
|
|
35421
|
-
from: candidate.path,
|
|
35422
|
-
to: destinationDir
|
|
35423
|
-
});
|
|
35424
|
-
return;
|
|
35176
|
+
emit(u, ...t) {
|
|
35177
|
+
const F = this._subscribers.get(u) ?? [], s = [];
|
|
35178
|
+
for (const i of F)
|
|
35179
|
+
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
35180
|
+
for (const i of s)
|
|
35181
|
+
i();
|
|
35425
35182
|
}
|
|
35426
|
-
|
|
35427
|
-
|
|
35428
|
-
|
|
35429
|
-
|
|
35430
|
-
|
|
35431
|
-
|
|
35432
|
-
|
|
35183
|
+
prompt() {
|
|
35184
|
+
return new Promise((u, t) => {
|
|
35185
|
+
if (this._abortSignal) {
|
|
35186
|
+
if (this._abortSignal.aborted)
|
|
35187
|
+
return this.state = "cancel", this.close(), u(S);
|
|
35188
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
35189
|
+
this.state = "cancel", this.close();
|
|
35190
|
+
}, { once: true });
|
|
35191
|
+
}
|
|
35192
|
+
const F = new X;
|
|
35193
|
+
F._write = (s, i, D) => {
|
|
35194
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
35195
|
+
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
35196
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
35197
|
+
}), this.once("cancel", () => {
|
|
35198
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
35433
35199
|
});
|
|
35434
|
-
return;
|
|
35435
|
-
}
|
|
35436
|
-
await import_fs_extra12.default.remove(candidate.path);
|
|
35437
|
-
await createDirectorySymlink(destinationDir, candidate.path);
|
|
35438
|
-
result.linked.push({
|
|
35439
|
-
category: candidate.category,
|
|
35440
|
-
from: candidate.path,
|
|
35441
|
-
to: destinationDir
|
|
35442
35200
|
});
|
|
35443
|
-
return;
|
|
35444
35201
|
}
|
|
35445
|
-
|
|
35446
|
-
|
|
35447
|
-
|
|
35448
|
-
|
|
35449
|
-
|
|
35450
|
-
|
|
35451
|
-
|
|
35452
|
-
from: candidate.path,
|
|
35453
|
-
to: destinationDir,
|
|
35454
|
-
movedToBackup: backupTarget
|
|
35455
|
-
});
|
|
35456
|
-
}
|
|
35457
|
-
async function importInstructionFiles(candidates, destinationPath, result) {
|
|
35458
|
-
await import_fs_extra12.default.ensureDir(path16.dirname(destinationPath));
|
|
35459
|
-
const destinationRealPath = await realPathIfPossible(destinationPath);
|
|
35460
|
-
let destinationHash = await pathExistsOrSymlink(destinationPath) ? await hashPath(destinationPath) : null;
|
|
35461
|
-
for (const candidate of candidates) {
|
|
35462
|
-
if (candidate.isDestination)
|
|
35463
|
-
continue;
|
|
35464
|
-
const sourceStat = await import_fs_extra12.default.lstat(candidate.path).catch(() => null);
|
|
35465
|
-
if (!sourceStat)
|
|
35466
|
-
continue;
|
|
35467
|
-
const sourceRealPath = await realPathIfPossible(candidate.path);
|
|
35468
|
-
if (destinationRealPath && sourceRealPath && samePath(destinationRealPath, sourceRealPath)) {
|
|
35469
|
-
continue;
|
|
35470
|
-
}
|
|
35471
|
-
const sourceHash = await hashPath(candidate.path);
|
|
35472
|
-
if (!destinationHash) {
|
|
35473
|
-
await import_fs_extra12.default.copy(candidate.path, destinationPath, {
|
|
35474
|
-
dereference: false,
|
|
35475
|
-
overwrite: false
|
|
35476
|
-
});
|
|
35477
|
-
destinationHash = sourceHash;
|
|
35478
|
-
result.imported.push({
|
|
35479
|
-
category: "instructions",
|
|
35480
|
-
name: path16.basename(candidate.path),
|
|
35481
|
-
from: candidate.path,
|
|
35482
|
-
to: destinationPath
|
|
35483
|
-
});
|
|
35484
|
-
continue;
|
|
35202
|
+
onKeypress(u, t) {
|
|
35203
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
35204
|
+
if (this.opts.validate) {
|
|
35205
|
+
const F = this.opts.validate(this.value);
|
|
35206
|
+
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
35207
|
+
}
|
|
35208
|
+
this.state !== "error" && (this.state = "submit");
|
|
35485
35209
|
}
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35490
|
-
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35210
|
+
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
35211
|
+
}
|
|
35212
|
+
close() {
|
|
35213
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
35214
|
+
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
35215
|
+
}
|
|
35216
|
+
restoreCursor() {
|
|
35217
|
+
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
35218
|
+
`).length - 1;
|
|
35219
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
35220
|
+
}
|
|
35221
|
+
render() {
|
|
35222
|
+
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
35223
|
+
if (u !== this._prevFrame) {
|
|
35224
|
+
if (this.state === "initial")
|
|
35225
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
35226
|
+
else {
|
|
35227
|
+
const t = BD(this._prevFrame, u);
|
|
35228
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
35229
|
+
const F = t[0];
|
|
35230
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
35231
|
+
const s = u.split(`
|
|
35232
|
+
`);
|
|
35233
|
+
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
35234
|
+
return;
|
|
35235
|
+
}
|
|
35236
|
+
if (t && t?.length > 1) {
|
|
35237
|
+
const F = t[0];
|
|
35238
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
35239
|
+
const s = u.split(`
|
|
35240
|
+
`).slice(F);
|
|
35241
|
+
this.output.write(s.join(`
|
|
35242
|
+
`)), this._prevFrame = u;
|
|
35243
|
+
return;
|
|
35244
|
+
}
|
|
35245
|
+
this.output.write(import_sisteransi.erase.down());
|
|
35246
|
+
}
|
|
35247
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
35494
35248
|
}
|
|
35495
|
-
|
|
35496
|
-
|
|
35497
|
-
|
|
35498
|
-
|
|
35499
|
-
|
|
35249
|
+
}
|
|
35250
|
+
}
|
|
35251
|
+
|
|
35252
|
+
class dD extends x {
|
|
35253
|
+
get cursor() {
|
|
35254
|
+
return this.value ? 0 : 1;
|
|
35255
|
+
}
|
|
35256
|
+
get _value() {
|
|
35257
|
+
return this.cursor === 0;
|
|
35258
|
+
}
|
|
35259
|
+
constructor(u) {
|
|
35260
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
35261
|
+
this.value = this._value;
|
|
35262
|
+
}), this.on("confirm", (t) => {
|
|
35263
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
35264
|
+
}), this.on("cursor", () => {
|
|
35265
|
+
this.value = !this.value;
|
|
35500
35266
|
});
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
35506
|
-
|
|
35267
|
+
}
|
|
35268
|
+
}
|
|
35269
|
+
var A;
|
|
35270
|
+
A = new WeakMap;
|
|
35271
|
+
var kD = Object.defineProperty;
|
|
35272
|
+
var $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
35273
|
+
var H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
35274
|
+
var SD = class extends x {
|
|
35275
|
+
constructor(u) {
|
|
35276
|
+
super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
35277
|
+
t === "a" && this.toggleAll();
|
|
35278
|
+
}), this.on("cursor", (t) => {
|
|
35279
|
+
switch (t) {
|
|
35280
|
+
case "left":
|
|
35281
|
+
case "up":
|
|
35282
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
35283
|
+
break;
|
|
35284
|
+
case "down":
|
|
35285
|
+
case "right":
|
|
35286
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
35287
|
+
break;
|
|
35288
|
+
case "space":
|
|
35289
|
+
this.toggleValue();
|
|
35290
|
+
break;
|
|
35291
|
+
}
|
|
35507
35292
|
});
|
|
35508
35293
|
}
|
|
35509
|
-
|
|
35510
|
-
|
|
35511
|
-
if (candidate.linkWhenMissing)
|
|
35512
|
-
return true;
|
|
35513
|
-
return false;
|
|
35514
|
-
}
|
|
35515
|
-
async function linkInstructionFile(candidate, destinationPath, result) {
|
|
35516
|
-
if (candidate.isDestination || samePath(candidate.path, destinationPath)) {
|
|
35517
|
-
return;
|
|
35518
|
-
}
|
|
35519
|
-
if (!await pathExistsOrSymlink(destinationPath)) {
|
|
35520
|
-
return;
|
|
35294
|
+
get _value() {
|
|
35295
|
+
return this.options[this.cursor].value;
|
|
35521
35296
|
}
|
|
35522
|
-
|
|
35523
|
-
|
|
35524
|
-
|
|
35525
|
-
if (!await shouldLinkMissingInstruction(candidate))
|
|
35526
|
-
return;
|
|
35527
|
-
await createFileSymlink(destinationPath, candidate.path);
|
|
35528
|
-
result.linked.push({
|
|
35529
|
-
category: "instructions",
|
|
35530
|
-
from: candidate.path,
|
|
35531
|
-
to: destinationPath
|
|
35532
|
-
});
|
|
35533
|
-
return;
|
|
35297
|
+
toggleAll() {
|
|
35298
|
+
const u = this.value.length === this.options.length;
|
|
35299
|
+
this.value = u ? [] : this.options.map((t) => t.value);
|
|
35534
35300
|
}
|
|
35535
|
-
|
|
35536
|
-
const
|
|
35537
|
-
|
|
35538
|
-
result.alreadyLinked.push({
|
|
35539
|
-
category: "instructions",
|
|
35540
|
-
from: candidate.path,
|
|
35541
|
-
to: destinationPath
|
|
35542
|
-
});
|
|
35543
|
-
return;
|
|
35544
|
-
}
|
|
35545
|
-
await import_fs_extra12.default.remove(candidate.path);
|
|
35546
|
-
await createFileSymlink(destinationPath, candidate.path);
|
|
35547
|
-
result.linked.push({
|
|
35548
|
-
category: "instructions",
|
|
35549
|
-
from: candidate.path,
|
|
35550
|
-
to: destinationPath
|
|
35551
|
-
});
|
|
35552
|
-
return;
|
|
35301
|
+
toggleValue() {
|
|
35302
|
+
const u = this.value.includes(this._value);
|
|
35303
|
+
this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
35553
35304
|
}
|
|
35554
|
-
|
|
35555
|
-
|
|
35556
|
-
|
|
35557
|
-
|
|
35558
|
-
|
|
35559
|
-
|
|
35560
|
-
|
|
35561
|
-
|
|
35562
|
-
|
|
35563
|
-
|
|
35564
|
-
|
|
35565
|
-
|
|
35566
|
-
|
|
35567
|
-
|
|
35568
|
-
|
|
35569
|
-
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
|
|
35573
|
-
const heading = content.match(/^#\s+(.+)$/m)?.[1]?.trim();
|
|
35574
|
-
return heading || titleFromRulePath(rulePath);
|
|
35575
|
-
}
|
|
35576
|
-
async function collectRuleIndexEntries(rulesDir, rootDir, currentDir = rulesDir) {
|
|
35577
|
-
const entries = await import_fs_extra12.default.readdir(currentDir, { withFileTypes: true }).catch(() => []);
|
|
35578
|
-
const rules = [];
|
|
35579
|
-
for (const entry of entries) {
|
|
35580
|
-
if (IGNORED_ENTRY_NAMES2.has(entry.name))
|
|
35581
|
-
continue;
|
|
35582
|
-
const entryPath = path16.join(currentDir, entry.name);
|
|
35583
|
-
if (entry.isDirectory()) {
|
|
35584
|
-
rules.push(...await collectRuleIndexEntries(rulesDir, rootDir, entryPath));
|
|
35585
|
-
continue;
|
|
35586
|
-
}
|
|
35587
|
-
if (!entry.isFile() && !entry.isSymbolicLink())
|
|
35588
|
-
continue;
|
|
35589
|
-
if (![".md", ".mdc"].includes(path16.extname(entry.name).toLowerCase()))
|
|
35590
|
-
continue;
|
|
35591
|
-
rules.push({
|
|
35592
|
-
title: await readRuleTitle(entryPath),
|
|
35593
|
-
relativePath: path16.relative(rootDir, entryPath)
|
|
35305
|
+
};
|
|
35306
|
+
var OD = Object.defineProperty;
|
|
35307
|
+
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
35308
|
+
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
35309
|
+
|
|
35310
|
+
class LD extends x {
|
|
35311
|
+
constructor(u) {
|
|
35312
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
35313
|
+
switch (t) {
|
|
35314
|
+
case "left":
|
|
35315
|
+
case "up":
|
|
35316
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
35317
|
+
break;
|
|
35318
|
+
case "down":
|
|
35319
|
+
case "right":
|
|
35320
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
35321
|
+
break;
|
|
35322
|
+
}
|
|
35323
|
+
this.changeValue();
|
|
35594
35324
|
});
|
|
35595
35325
|
}
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
function stripGeneratedRulesIndex(content) {
|
|
35599
|
-
const start = content.indexOf(RULES_INDEX_START);
|
|
35600
|
-
const end = content.indexOf(RULES_INDEX_END);
|
|
35601
|
-
if (start === -1 || end === -1 || end < start) {
|
|
35602
|
-
return content.trimEnd();
|
|
35326
|
+
get _value() {
|
|
35327
|
+
return this.options[this.cursor];
|
|
35603
35328
|
}
|
|
35604
|
-
|
|
35605
|
-
|
|
35606
|
-
## Rules`);
|
|
35607
|
-
const blockStart = headingIndex === -1 ? start : headingIndex + 1;
|
|
35608
|
-
return `${content.slice(0, blockStart).trimEnd()}
|
|
35609
|
-
${content.slice(end + RULES_INDEX_END.length).trimStart()}`.trimEnd();
|
|
35610
|
-
}
|
|
35611
|
-
function renderRulesIndexBlock(rules) {
|
|
35612
|
-
const lines = [
|
|
35613
|
-
"## Rules",
|
|
35614
|
-
"",
|
|
35615
|
-
"Detailed focused rules live in `.agents/rules/`. Read the relevant file before acting:",
|
|
35616
|
-
"",
|
|
35617
|
-
RULES_INDEX_START
|
|
35618
|
-
];
|
|
35619
|
-
if (rules.length === 0) {
|
|
35620
|
-
lines.push("- No repository rules found yet.");
|
|
35621
|
-
} else {
|
|
35622
|
-
for (const rule of rules) {
|
|
35623
|
-
lines.push(`- **${rule.title}** - [${rule.relativePath}](${rule.relativePath})`);
|
|
35624
|
-
}
|
|
35329
|
+
changeValue() {
|
|
35330
|
+
this.value = this._value.value;
|
|
35625
35331
|
}
|
|
35626
|
-
lines.push(RULES_INDEX_END);
|
|
35627
|
-
return lines.join(`
|
|
35628
|
-
`);
|
|
35629
35332
|
}
|
|
35630
|
-
|
|
35631
|
-
|
|
35632
|
-
|
|
35633
|
-
|
|
35634
|
-
|
|
35635
|
-
|
|
35636
|
-
|
|
35637
|
-
|
|
35638
|
-
## Previous Claude Instructions
|
|
35639
|
-
|
|
35640
|
-
${claudeContent.trimStart()}`;
|
|
35333
|
+
class RD extends x {
|
|
35334
|
+
get valueWithCursor() {
|
|
35335
|
+
if (this.state === "submit")
|
|
35336
|
+
return this.value;
|
|
35337
|
+
if (this.cursor >= this.value.length)
|
|
35338
|
+
return `${this.value}█`;
|
|
35339
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
35340
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
35641
35341
|
}
|
|
35642
|
-
|
|
35643
|
-
return
|
|
35644
|
-
if (claudeContent !== null)
|
|
35645
|
-
return claudeContent;
|
|
35646
|
-
return `# Repository Instructions
|
|
35647
|
-
`;
|
|
35648
|
-
}
|
|
35649
|
-
async function copyPathToBackup(result, targetPath) {
|
|
35650
|
-
const stat = await import_fs_extra12.default.lstat(targetPath).catch(() => null);
|
|
35651
|
-
if (!stat)
|
|
35652
|
-
return null;
|
|
35653
|
-
const backupRoot = await ensureBackupPath(result);
|
|
35654
|
-
const backupTarget = path16.join(backupRoot, safeRelativePath(result.rootDir, targetPath));
|
|
35655
|
-
await import_fs_extra12.default.ensureDir(path16.dirname(backupTarget));
|
|
35656
|
-
await import_fs_extra12.default.copy(targetPath, backupTarget, {
|
|
35657
|
-
dereference: false,
|
|
35658
|
-
overwrite: false
|
|
35659
|
-
});
|
|
35660
|
-
return backupTarget;
|
|
35661
|
-
}
|
|
35662
|
-
async function replaceWithFileSymlink(sourcePath, targetPath) {
|
|
35663
|
-
await import_fs_extra12.default.ensureDir(path16.dirname(targetPath));
|
|
35664
|
-
const relativeSource = path16.relative(path16.dirname(targetPath), sourcePath) || path16.basename(sourcePath);
|
|
35665
|
-
await import_fs_extra12.default.symlink(relativeSource, targetPath, "file");
|
|
35666
|
-
}
|
|
35667
|
-
async function ensureClaudeInstructionSymlink(result, agentsPath, claudePath) {
|
|
35668
|
-
const agentsRealPath = await realPathIfPossible(agentsPath);
|
|
35669
|
-
const claudeStat = await import_fs_extra12.default.lstat(claudePath).catch(() => null);
|
|
35670
|
-
if (claudeStat?.isSymbolicLink()) {
|
|
35671
|
-
const claudeRealPath = await realPathIfPossible(claudePath);
|
|
35672
|
-
if (agentsRealPath && claudeRealPath && samePath(agentsRealPath, claudeRealPath)) {
|
|
35673
|
-
return;
|
|
35674
|
-
}
|
|
35342
|
+
get cursor() {
|
|
35343
|
+
return this._cursor;
|
|
35675
35344
|
}
|
|
35676
|
-
|
|
35677
|
-
|
|
35678
|
-
|
|
35345
|
+
constructor(u) {
|
|
35346
|
+
super(u), this.on("finalize", () => {
|
|
35347
|
+
this.value || (this.value = u.defaultValue);
|
|
35348
|
+
});
|
|
35679
35349
|
}
|
|
35680
|
-
await replaceWithFileSymlink(agentsPath, claudePath);
|
|
35681
35350
|
}
|
|
35682
|
-
async function writeRepositoryInstructionIndex(result, folders) {
|
|
35683
|
-
const rulesDir = path16.join(folders.agentsDir, "rules");
|
|
35684
|
-
await import_fs_extra12.default.ensureDir(rulesDir);
|
|
35685
|
-
const rules = await collectRuleIndexEntries(rulesDir, folders.rootDir);
|
|
35686
|
-
const existing = stripGeneratedRulesIndex(await readExistingInstructions(folders.rootDir));
|
|
35687
|
-
const content = `${existing}
|
|
35688
35351
|
|
|
35689
|
-
|
|
35690
|
-
|
|
35691
|
-
|
|
35692
|
-
|
|
35693
|
-
|
|
35694
|
-
|
|
35695
|
-
await copyPathToBackup(result, agentsPath);
|
|
35696
|
-
if (agentsStat.isSymbolicLink()) {
|
|
35697
|
-
await import_fs_extra12.default.remove(agentsPath);
|
|
35698
|
-
}
|
|
35699
|
-
}
|
|
35700
|
-
await import_fs_extra12.default.writeFile(agentsPath, content, "utf-8");
|
|
35701
|
-
await ensureClaudeInstructionSymlink(result, agentsPath, claudePath);
|
|
35702
|
-
result.instructionIndex = {
|
|
35703
|
-
agentsPath,
|
|
35704
|
-
claudePath,
|
|
35705
|
-
indexedRules: rules.map((rule) => rule.relativePath)
|
|
35706
|
-
};
|
|
35352
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
35353
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
35354
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
35355
|
+
import y2 from "node:process";
|
|
35356
|
+
function ce() {
|
|
35357
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
35707
35358
|
}
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35711
|
-
|
|
35712
|
-
|
|
35713
|
-
|
|
35714
|
-
|
|
35715
|
-
|
|
35716
|
-
|
|
35717
|
-
|
|
35718
|
-
|
|
35719
|
-
|
|
35720
|
-
|
|
35721
|
-
|
|
35722
|
-
|
|
35723
|
-
|
|
35724
|
-
|
|
35725
|
-
|
|
35726
|
-
|
|
35727
|
-
|
|
35728
|
-
|
|
35729
|
-
|
|
35730
|
-
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35737
|
-
|
|
35738
|
-
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
|
|
35742
|
-
await linkInstructionFile(candidate, destinationByCategory.instructions, result);
|
|
35359
|
+
var V2 = ce();
|
|
35360
|
+
var u = (t, n) => V2 ? t : n;
|
|
35361
|
+
var le = u("◆", "*");
|
|
35362
|
+
var L2 = u("■", "x");
|
|
35363
|
+
var W2 = u("▲", "x");
|
|
35364
|
+
var C = u("◇", "o");
|
|
35365
|
+
var ue = u("┌", "T");
|
|
35366
|
+
var o = u("│", "|");
|
|
35367
|
+
var d2 = u("└", "—");
|
|
35368
|
+
var k2 = u("●", ">");
|
|
35369
|
+
var P2 = u("○", " ");
|
|
35370
|
+
var A2 = u("◻", "[•]");
|
|
35371
|
+
var T = u("◼", "[+]");
|
|
35372
|
+
var F = u("◻", "[ ]");
|
|
35373
|
+
var $e = u("▪", "•");
|
|
35374
|
+
var _3 = u("─", "-");
|
|
35375
|
+
var me = u("╮", "+");
|
|
35376
|
+
var de = u("├", "+");
|
|
35377
|
+
var pe = u("╯", "+");
|
|
35378
|
+
var q = u("●", "•");
|
|
35379
|
+
var D = u("◆", "*");
|
|
35380
|
+
var U = u("▲", "!");
|
|
35381
|
+
var K2 = u("■", "x");
|
|
35382
|
+
var b2 = (t) => {
|
|
35383
|
+
switch (t) {
|
|
35384
|
+
case "initial":
|
|
35385
|
+
case "active":
|
|
35386
|
+
return import_picocolors2.default.cyan(le);
|
|
35387
|
+
case "cancel":
|
|
35388
|
+
return import_picocolors2.default.red(L2);
|
|
35389
|
+
case "error":
|
|
35390
|
+
return import_picocolors2.default.yellow(W2);
|
|
35391
|
+
case "submit":
|
|
35392
|
+
return import_picocolors2.default.green(C);
|
|
35743
35393
|
}
|
|
35744
|
-
|
|
35745
|
-
|
|
35394
|
+
};
|
|
35395
|
+
var G2 = (t) => {
|
|
35396
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
35397
|
+
let l2 = 0;
|
|
35398
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
35399
|
+
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
35400
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
35401
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
35402
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
35403
|
+
});
|
|
35404
|
+
};
|
|
35405
|
+
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
35406
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
35407
|
+
${b2(this.state)} ${t.message}
|
|
35408
|
+
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
35409
|
+
switch (this.state) {
|
|
35410
|
+
case "error":
|
|
35411
|
+
return `${n.trim()}
|
|
35412
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
35413
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
35414
|
+
`;
|
|
35415
|
+
case "submit":
|
|
35416
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
35417
|
+
case "cancel":
|
|
35418
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
35419
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
35420
|
+
default:
|
|
35421
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
35422
|
+
${import_picocolors2.default.cyan(d2)}
|
|
35423
|
+
`;
|
|
35746
35424
|
}
|
|
35747
|
-
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
|
|
35753
|
-
|
|
35754
|
-
|
|
35755
|
-
|
|
35756
|
-
|
|
35757
|
-
|
|
35758
|
-
|
|
35759
|
-
|
|
35760
|
-
|
|
35761
|
-
}
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
console.log(source_default.blue.bold(`
|
|
35765
|
-
AIBlueprint agents unify ${source_default.gray(`v${getVersion()}`)}
|
|
35766
|
-
`));
|
|
35767
|
-
console.log(source_default.gray(`Scope: ${params.scope ?? "global"}`));
|
|
35768
|
-
console.log(source_default.gray("Centralizing reusable agent configuration into .agents, then rendering Codex agents"));
|
|
35769
|
-
const result = await unifyAgentsConfiguration(params);
|
|
35770
|
-
const codexResult = await renderCodexAgentsFromMarkdown(params);
|
|
35771
|
-
console.log(source_default.green(`
|
|
35772
|
-
Unify complete`));
|
|
35773
|
-
console.log(source_default.gray(` Shared folder: ${result.agentsDir}`));
|
|
35774
|
-
printCategorySummary(result, "instructions");
|
|
35775
|
-
printCategorySummary(result, "skills");
|
|
35776
|
-
printCategorySummary(result, "agents");
|
|
35777
|
-
if (result.scope === "repository") {
|
|
35778
|
-
printCategorySummary(result, "rules");
|
|
35425
|
+
} }).prompt();
|
|
35426
|
+
var ye = (t) => {
|
|
35427
|
+
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
35428
|
+
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
35429
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
35430
|
+
${b2(this.state)} ${t.message}
|
|
35431
|
+
`, s = this.value ? n : r2;
|
|
35432
|
+
switch (this.state) {
|
|
35433
|
+
case "submit":
|
|
35434
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
35435
|
+
case "cancel":
|
|
35436
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
35437
|
+
${import_picocolors2.default.gray(o)}`;
|
|
35438
|
+
default:
|
|
35439
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
35440
|
+
${import_picocolors2.default.cyan(d2)}
|
|
35441
|
+
`;
|
|
35779
35442
|
}
|
|
35780
|
-
|
|
35781
|
-
|
|
35782
|
-
|
|
35783
|
-
|
|
35443
|
+
} }).prompt();
|
|
35444
|
+
};
|
|
35445
|
+
var ve = (t) => {
|
|
35446
|
+
const n = (r2, i) => {
|
|
35447
|
+
const s = r2.label ?? String(r2.value);
|
|
35448
|
+
switch (i) {
|
|
35449
|
+
case "selected":
|
|
35450
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
35451
|
+
case "active":
|
|
35452
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
35453
|
+
case "cancelled":
|
|
35454
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
35455
|
+
default:
|
|
35456
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
35784
35457
|
}
|
|
35785
|
-
|
|
35786
|
-
|
|
35458
|
+
};
|
|
35459
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
35460
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
35461
|
+
${b2(this.state)} ${t.message}
|
|
35462
|
+
`;
|
|
35463
|
+
switch (this.state) {
|
|
35464
|
+
case "submit":
|
|
35465
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
35466
|
+
case "cancel":
|
|
35467
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
35468
|
+
${import_picocolors2.default.gray(o)}`;
|
|
35469
|
+
default:
|
|
35470
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
35471
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
35472
|
+
${import_picocolors2.default.cyan(d2)}
|
|
35473
|
+
`;
|
|
35787
35474
|
}
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35475
|
+
} }).prompt();
|
|
35476
|
+
};
|
|
35477
|
+
var fe = (t) => {
|
|
35478
|
+
const n = (r2, i) => {
|
|
35479
|
+
const s = r2.label ?? String(r2.value);
|
|
35480
|
+
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
35481
|
+
};
|
|
35482
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
35483
|
+
if (this.required && r2.length === 0)
|
|
35484
|
+
return `Please select at least one option.
|
|
35485
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
35486
|
+
}, render() {
|
|
35487
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
35488
|
+
${b2(this.state)} ${t.message}
|
|
35489
|
+
`, i = (s, c) => {
|
|
35490
|
+
const a = this.value.includes(s.value);
|
|
35491
|
+
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
35492
|
+
};
|
|
35493
|
+
switch (this.state) {
|
|
35494
|
+
case "submit":
|
|
35495
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
35496
|
+
case "cancel": {
|
|
35497
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
35498
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
35499
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
35500
|
+
}
|
|
35501
|
+
case "error": {
|
|
35502
|
+
const s = this.error.split(`
|
|
35503
|
+
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
35504
|
+
`);
|
|
35505
|
+
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
35506
|
+
${import_picocolors2.default.yellow(o)} `)}
|
|
35507
|
+
${s}
|
|
35508
|
+
`;
|
|
35793
35509
|
}
|
|
35510
|
+
default:
|
|
35511
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
35512
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
35513
|
+
${import_picocolors2.default.cyan(d2)}
|
|
35514
|
+
`;
|
|
35794
35515
|
}
|
|
35795
|
-
}
|
|
35796
|
-
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
}
|
|
35800
|
-
}
|
|
35516
|
+
} }).prompt();
|
|
35517
|
+
};
|
|
35518
|
+
var xe = (t = "") => {
|
|
35519
|
+
process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
|
|
35801
35520
|
|
|
35802
|
-
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
|
|
35806
|
-
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
|
|
35810
|
-
|
|
35811
|
-
|
|
35812
|
-
|
|
35813
|
-
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35521
|
+
`);
|
|
35522
|
+
};
|
|
35523
|
+
var Ie = (t = "") => {
|
|
35524
|
+
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
35525
|
+
`);
|
|
35526
|
+
};
|
|
35527
|
+
var Se = (t = "") => {
|
|
35528
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
35529
|
+
${import_picocolors2.default.gray(d2)} ${t}
|
|
35530
|
+
|
|
35531
|
+
`);
|
|
35532
|
+
};
|
|
35533
|
+
var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
35534
|
+
const r2 = [`${import_picocolors2.default.gray(o)}`];
|
|
35535
|
+
if (t) {
|
|
35536
|
+
const [i, ...s] = t.split(`
|
|
35537
|
+
`);
|
|
35538
|
+
r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
35539
|
+
}
|
|
35540
|
+
process.stdout.write(`${r2.join(`
|
|
35541
|
+
`)}
|
|
35542
|
+
`);
|
|
35543
|
+
}, info: (t) => {
|
|
35544
|
+
M2.message(t, { symbol: import_picocolors2.default.blue(q) });
|
|
35545
|
+
}, success: (t) => {
|
|
35546
|
+
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
35547
|
+
}, step: (t) => {
|
|
35548
|
+
M2.message(t, { symbol: import_picocolors2.default.green(C) });
|
|
35549
|
+
}, warn: (t) => {
|
|
35550
|
+
M2.message(t, { symbol: import_picocolors2.default.yellow(U) });
|
|
35551
|
+
}, warning: (t) => {
|
|
35552
|
+
M2.warn(t);
|
|
35553
|
+
}, error: (t) => {
|
|
35554
|
+
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
35555
|
+
} };
|
|
35556
|
+
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
35557
|
+
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
35558
|
+
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
35559
|
+
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
35560
|
+
const p2 = (m2) => {
|
|
35561
|
+
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
35562
|
+
a && N2(h2, m2);
|
|
35563
|
+
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
35564
|
+
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
35565
|
+
}, E = () => {
|
|
35566
|
+
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
35567
|
+
}, B2 = () => {
|
|
35568
|
+
if ($2 === undefined)
|
|
35569
|
+
return;
|
|
35570
|
+
i && process.stdout.write(`
|
|
35571
|
+
`);
|
|
35572
|
+
const m2 = $2.split(`
|
|
35573
|
+
`);
|
|
35574
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
|
|
35575
|
+
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
35576
|
+
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
35577
|
+
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
35578
|
+
}, H2 = (m2 = "") => {
|
|
35579
|
+
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
35580
|
+
`);
|
|
35581
|
+
let h2 = 0, w2 = 0;
|
|
35582
|
+
j2(), c = setInterval(() => {
|
|
35583
|
+
if (i && l2 === $2)
|
|
35584
|
+
return;
|
|
35585
|
+
B2(), $2 = l2;
|
|
35586
|
+
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
35587
|
+
if (i)
|
|
35588
|
+
process.stdout.write(`${I2} ${l2}...`);
|
|
35589
|
+
else if (t === "timer")
|
|
35590
|
+
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
35591
|
+
else {
|
|
35592
|
+
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
35593
|
+
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
35821
35594
|
}
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
}
|
|
35828
|
-
}
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35595
|
+
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
35596
|
+
}, r2);
|
|
35597
|
+
}, N2 = (m2 = "", h2 = 0) => {
|
|
35598
|
+
a = false, clearInterval(c), B2();
|
|
35599
|
+
const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
35600
|
+
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
35601
|
+
`) : process.stdout.write(`${w2} ${l2}
|
|
35602
|
+
`), E(), s();
|
|
35603
|
+
};
|
|
35604
|
+
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
35605
|
+
l2 = R2(m2 ?? l2);
|
|
35606
|
+
} };
|
|
35607
|
+
};
|
|
35835
35608
|
|
|
35836
|
-
// src/lib/
|
|
35609
|
+
// src/lib/agents-unifier.ts
|
|
35837
35610
|
var import_fs_extra13 = __toESM(require_lib4(), 1);
|
|
35838
|
-
import
|
|
35611
|
+
import crypto from "crypto";
|
|
35839
35612
|
import os14 from "os";
|
|
35840
|
-
|
|
35613
|
+
import path17 from "path";
|
|
35614
|
+
|
|
35615
|
+
// src/lib/backup-utils.ts
|
|
35616
|
+
var import_fs_extra12 = __toESM(require_lib4(), 1);
|
|
35617
|
+
import path16 from "path";
|
|
35618
|
+
import os13 from "os";
|
|
35619
|
+
var BACKUP_BASE_DIR = path16.join(os13.homedir(), ".config", "aiblueprint", "backup");
|
|
35841
35620
|
function getBackupDir() {
|
|
35842
35621
|
return process.env.AIBLUEPRINT_BACKUP_DIR || BACKUP_BASE_DIR;
|
|
35843
35622
|
}
|
|
@@ -35845,47 +35624,56 @@ function formatDate(date) {
|
|
|
35845
35624
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
35846
35625
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}-${pad(date.getHours())}-${pad(date.getMinutes())}-${pad(date.getSeconds())}`;
|
|
35847
35626
|
}
|
|
35627
|
+
function createBackupNameSuffix(value) {
|
|
35628
|
+
return value.trim().replace(/^[a-zA-Z]:/, (drive) => drive.replace(":", "")).replace(/[\\/]+/g, "--").replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "root";
|
|
35629
|
+
}
|
|
35630
|
+
function createTimestampedBackupName(suffix, date = new Date) {
|
|
35631
|
+
const base = formatDate(date);
|
|
35632
|
+
if (!suffix)
|
|
35633
|
+
return base;
|
|
35634
|
+
return `${base}--${createBackupNameSuffix(suffix)}`;
|
|
35635
|
+
}
|
|
35848
35636
|
async function listBackups() {
|
|
35849
35637
|
const backupBaseDir = getBackupDir();
|
|
35850
|
-
const exists = await
|
|
35638
|
+
const exists = await import_fs_extra12.default.pathExists(backupBaseDir);
|
|
35851
35639
|
if (!exists) {
|
|
35852
35640
|
return [];
|
|
35853
35641
|
}
|
|
35854
|
-
const entries = await
|
|
35642
|
+
const entries = await import_fs_extra12.default.readdir(backupBaseDir, { withFileTypes: true });
|
|
35855
35643
|
const backups = [];
|
|
35856
35644
|
for (const entry of entries) {
|
|
35857
35645
|
if (!entry.isDirectory())
|
|
35858
35646
|
continue;
|
|
35859
|
-
const match = entry.name.match(/^(\d{4})-(\d{2})-(\d{2})-(\d{2})-(\d{2})-(\d{2})
|
|
35647
|
+
const match = entry.name.match(/^(\d{4})-(\d{2})-(\d{2})-(\d{2})-(\d{2})-(\d{2})(?:--.+)?$/);
|
|
35860
35648
|
if (!match)
|
|
35861
35649
|
continue;
|
|
35862
35650
|
const [, year, month, day, hour, minute, second] = match;
|
|
35863
35651
|
const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute), parseInt(second));
|
|
35864
35652
|
backups.push({
|
|
35865
35653
|
name: entry.name,
|
|
35866
|
-
path:
|
|
35654
|
+
path: path16.join(backupBaseDir, entry.name),
|
|
35867
35655
|
date
|
|
35868
35656
|
});
|
|
35869
35657
|
}
|
|
35870
|
-
return backups.sort((a,
|
|
35658
|
+
return backups.sort((a, b3) => b3.date.getTime() - a.date.getTime());
|
|
35871
35659
|
}
|
|
35872
35660
|
var AGENTS_BACKUP_SUBDIR = ".agents";
|
|
35873
35661
|
var CLAUDE_ITEMS = ["commands", "agents", "skills", "scripts", "settings.json"];
|
|
35874
35662
|
var MANAGED_FOLDERS = [".claude", ".codex", ".agents"];
|
|
35875
35663
|
async function copyForBackup(sourcePath, destPath) {
|
|
35876
|
-
await
|
|
35664
|
+
await import_fs_extra12.default.copy(sourcePath, destPath, {
|
|
35877
35665
|
overwrite: true,
|
|
35878
35666
|
dereference: false
|
|
35879
35667
|
});
|
|
35880
35668
|
}
|
|
35881
35669
|
async function hasMeaningfulContent(dir) {
|
|
35882
|
-
if (!await
|
|
35670
|
+
if (!await import_fs_extra12.default.pathExists(dir))
|
|
35883
35671
|
return false;
|
|
35884
|
-
const files = await
|
|
35672
|
+
const files = await import_fs_extra12.default.readdir(dir);
|
|
35885
35673
|
return files.some((f) => f !== ".DS_Store");
|
|
35886
35674
|
}
|
|
35887
35675
|
async function loadBackup(backupPath, claudeDir, codexDir, agentsDir) {
|
|
35888
|
-
const exists = await
|
|
35676
|
+
const exists = await import_fs_extra12.default.pathExists(backupPath);
|
|
35889
35677
|
if (!exists) {
|
|
35890
35678
|
throw new Error(`Backup not found: ${backupPath}`);
|
|
35891
35679
|
}
|
|
@@ -35896,27 +35684,27 @@ async function loadBackup(backupPath, claudeDir, codexDir, agentsDir) {
|
|
|
35896
35684
|
};
|
|
35897
35685
|
let restoredManagedFolder = false;
|
|
35898
35686
|
for (const folderName of MANAGED_FOLDERS) {
|
|
35899
|
-
const sourcePath =
|
|
35687
|
+
const sourcePath = path16.join(backupPath, folderName);
|
|
35900
35688
|
const destPath = managedDestinations[folderName];
|
|
35901
|
-
if (!destPath || !await
|
|
35689
|
+
if (!destPath || !await import_fs_extra12.default.pathExists(sourcePath))
|
|
35902
35690
|
continue;
|
|
35903
|
-
await
|
|
35691
|
+
await import_fs_extra12.default.ensureDir(destPath);
|
|
35904
35692
|
await copyForBackup(sourcePath, destPath);
|
|
35905
35693
|
restoredManagedFolder = true;
|
|
35906
35694
|
}
|
|
35907
35695
|
if (!restoredManagedFolder) {
|
|
35908
|
-
await
|
|
35696
|
+
await import_fs_extra12.default.ensureDir(claudeDir);
|
|
35909
35697
|
for (const item of CLAUDE_ITEMS) {
|
|
35910
|
-
const sourcePath =
|
|
35911
|
-
const destPath =
|
|
35912
|
-
if (await
|
|
35698
|
+
const sourcePath = path16.join(backupPath, item);
|
|
35699
|
+
const destPath = path16.join(claudeDir, item);
|
|
35700
|
+
if (await import_fs_extra12.default.pathExists(sourcePath)) {
|
|
35913
35701
|
await copyForBackup(sourcePath, destPath);
|
|
35914
35702
|
}
|
|
35915
35703
|
}
|
|
35916
35704
|
if (agentsDir) {
|
|
35917
|
-
const agentsBackupPath =
|
|
35918
|
-
if (await
|
|
35919
|
-
await
|
|
35705
|
+
const agentsBackupPath = path16.join(backupPath, AGENTS_BACKUP_SUBDIR);
|
|
35706
|
+
if (await import_fs_extra12.default.pathExists(agentsBackupPath)) {
|
|
35707
|
+
await import_fs_extra12.default.ensureDir(agentsDir);
|
|
35920
35708
|
await copyForBackup(agentsBackupPath, agentsDir);
|
|
35921
35709
|
}
|
|
35922
35710
|
}
|
|
@@ -35929,971 +35717,1393 @@ async function createBackup(claudeDir, codexDir, agentsDir) {
|
|
|
35929
35717
|
if (!claudeHasContent && !codexHasContent && !agentsHasContent) {
|
|
35930
35718
|
return null;
|
|
35931
35719
|
}
|
|
35932
|
-
const
|
|
35933
|
-
|
|
35934
|
-
await import_fs_extra13.default.ensureDir(backupPath);
|
|
35720
|
+
const backupPath = path16.join(getBackupDir(), createTimestampedBackupName());
|
|
35721
|
+
await import_fs_extra12.default.ensureDir(backupPath);
|
|
35935
35722
|
if (claudeHasContent) {
|
|
35936
|
-
await copyForBackup(claudeDir,
|
|
35723
|
+
await copyForBackup(claudeDir, path16.join(backupPath, ".claude"));
|
|
35937
35724
|
}
|
|
35938
35725
|
if (codexHasContent && codexDir) {
|
|
35939
|
-
await copyForBackup(codexDir,
|
|
35726
|
+
await copyForBackup(codexDir, path16.join(backupPath, ".codex"));
|
|
35940
35727
|
}
|
|
35941
35728
|
if (agentsHasContent && agentsDir) {
|
|
35942
|
-
const destPath =
|
|
35729
|
+
const destPath = path16.join(backupPath, AGENTS_BACKUP_SUBDIR);
|
|
35943
35730
|
await copyForBackup(agentsDir, destPath);
|
|
35944
35731
|
}
|
|
35945
35732
|
return backupPath;
|
|
35946
35733
|
}
|
|
35947
35734
|
|
|
35948
|
-
// src/lib/
|
|
35949
|
-
var
|
|
35950
|
-
|
|
35951
|
-
".
|
|
35952
|
-
"
|
|
35953
|
-
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
|
|
35957
|
-
|
|
35958
|
-
|
|
35959
|
-
|
|
35960
|
-
|
|
35961
|
-
|
|
35962
|
-
|
|
35963
|
-
}));
|
|
35964
|
-
}
|
|
35965
|
-
async function collectSnapshotSources(folders) {
|
|
35966
|
-
const storePaths = getConfigStorePaths(folders.rootDir);
|
|
35967
|
-
const sources = [
|
|
35968
|
-
...await listSnapshotSources(storePaths.configsDir, "config"),
|
|
35969
|
-
...await listSnapshotSources(storePaths.backupsDir, "backup")
|
|
35970
|
-
];
|
|
35971
|
-
if (path18.resolve(folders.rootDir) === os15.homedir()) {
|
|
35972
|
-
sources.push(...await listSnapshotSources(getBackupDir(), "legacy-backup"));
|
|
35735
|
+
// src/lib/agents-unifier.ts
|
|
35736
|
+
var IGNORED_ENTRY_NAMES2 = new Set([
|
|
35737
|
+
".DS_Store",
|
|
35738
|
+
".git",
|
|
35739
|
+
"node_modules"
|
|
35740
|
+
]);
|
|
35741
|
+
function uniqueByPath(candidates) {
|
|
35742
|
+
const seen = new Set;
|
|
35743
|
+
const unique = [];
|
|
35744
|
+
for (const candidate of candidates) {
|
|
35745
|
+
const resolved = path17.resolve(candidate.path);
|
|
35746
|
+
if (seen.has(resolved))
|
|
35747
|
+
continue;
|
|
35748
|
+
seen.add(resolved);
|
|
35749
|
+
unique.push({ ...candidate, path: resolved });
|
|
35973
35750
|
}
|
|
35974
|
-
return
|
|
35751
|
+
return unique;
|
|
35975
35752
|
}
|
|
35976
|
-
|
|
35977
|
-
const
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35985
|
-
|
|
35753
|
+
function getContainerCandidates(options, includeCodex = true) {
|
|
35754
|
+
const folders = resolveFolders(options);
|
|
35755
|
+
const cursorDir = path17.join(folders.rootDir, ".cursor");
|
|
35756
|
+
const factoryDir = path17.join(folders.rootDir, ".factory");
|
|
35757
|
+
const opencodeDir = path17.join(folders.rootDir, ".config", "opencode");
|
|
35758
|
+
return uniqueByPath([
|
|
35759
|
+
{
|
|
35760
|
+
category: "skills",
|
|
35761
|
+
label: "agents-skills",
|
|
35762
|
+
path: path17.join(folders.agentsDir, "skills"),
|
|
35763
|
+
isDestination: true
|
|
35764
|
+
},
|
|
35765
|
+
{
|
|
35766
|
+
category: "skills",
|
|
35767
|
+
label: "claude-skills",
|
|
35768
|
+
path: path17.join(folders.claudeDir, "skills"),
|
|
35769
|
+
linkWhenMissing: true
|
|
35770
|
+
},
|
|
35771
|
+
...includeCodex ? [{
|
|
35772
|
+
category: "skills",
|
|
35773
|
+
label: "codex-skills",
|
|
35774
|
+
path: path17.join(folders.codexDir, "skills"),
|
|
35775
|
+
linkWhenMissing: true
|
|
35776
|
+
}] : [],
|
|
35777
|
+
{
|
|
35778
|
+
category: "skills",
|
|
35779
|
+
label: "cursor-skills",
|
|
35780
|
+
path: path17.join(cursorDir, "skills"),
|
|
35781
|
+
linkWhenParentExists: true
|
|
35782
|
+
},
|
|
35783
|
+
{
|
|
35784
|
+
category: "skills",
|
|
35785
|
+
label: "cursor-skills-cursor",
|
|
35786
|
+
path: path17.join(cursorDir, "skills-cursor"),
|
|
35787
|
+
linkWhenParentExists: true
|
|
35788
|
+
},
|
|
35789
|
+
{
|
|
35790
|
+
category: "skills",
|
|
35791
|
+
label: "factory-skills",
|
|
35792
|
+
path: path17.join(factoryDir, "skills"),
|
|
35793
|
+
linkWhenParentExists: true
|
|
35794
|
+
},
|
|
35795
|
+
{
|
|
35796
|
+
category: "skills",
|
|
35797
|
+
label: "opencode-skill",
|
|
35798
|
+
path: path17.join(opencodeDir, "skill"),
|
|
35799
|
+
linkWhenParentExists: true
|
|
35800
|
+
},
|
|
35801
|
+
{
|
|
35802
|
+
category: "skills",
|
|
35803
|
+
label: "opencode-skills",
|
|
35804
|
+
path: path17.join(opencodeDir, "skills"),
|
|
35805
|
+
linkWhenParentExists: true
|
|
35806
|
+
},
|
|
35807
|
+
{
|
|
35808
|
+
category: "agents",
|
|
35809
|
+
label: "agents-agents",
|
|
35810
|
+
path: path17.join(folders.agentsDir, "agents"),
|
|
35811
|
+
isDestination: true
|
|
35812
|
+
},
|
|
35813
|
+
{
|
|
35814
|
+
category: "agents",
|
|
35815
|
+
label: "claude-agents",
|
|
35816
|
+
path: path17.join(folders.claudeDir, "agents"),
|
|
35817
|
+
linkWhenMissing: true
|
|
35818
|
+
},
|
|
35819
|
+
{
|
|
35820
|
+
category: "agents",
|
|
35821
|
+
label: "claude-agnets",
|
|
35822
|
+
path: path17.join(folders.claudeDir, "agnets")
|
|
35823
|
+
},
|
|
35824
|
+
{
|
|
35825
|
+
category: "agents",
|
|
35826
|
+
label: "cursor-agents",
|
|
35827
|
+
path: path17.join(cursorDir, "agents"),
|
|
35828
|
+
linkWhenParentExists: true
|
|
35829
|
+
},
|
|
35830
|
+
{
|
|
35831
|
+
category: "agents",
|
|
35832
|
+
label: "factory-droids",
|
|
35833
|
+
path: path17.join(factoryDir, "droids"),
|
|
35834
|
+
linkWhenParentExists: true
|
|
35835
|
+
},
|
|
35836
|
+
{
|
|
35837
|
+
category: "agents",
|
|
35838
|
+
label: "opencode-agent",
|
|
35839
|
+
path: path17.join(opencodeDir, "agent"),
|
|
35840
|
+
linkWhenParentExists: true
|
|
35841
|
+
},
|
|
35842
|
+
{
|
|
35843
|
+
category: "agents",
|
|
35844
|
+
label: "opencode-agents",
|
|
35845
|
+
path: path17.join(opencodeDir, "agents"),
|
|
35846
|
+
linkWhenParentExists: true
|
|
35986
35847
|
}
|
|
35987
|
-
|
|
35988
|
-
return null;
|
|
35848
|
+
]);
|
|
35989
35849
|
}
|
|
35990
|
-
function
|
|
35991
|
-
|
|
35850
|
+
function getInstructionFileCandidates(options, includeCodex = true) {
|
|
35851
|
+
const folders = resolveFolders(options);
|
|
35852
|
+
return uniqueByPath([
|
|
35853
|
+
{
|
|
35854
|
+
label: "agents-instructions",
|
|
35855
|
+
path: path17.join(folders.agentsDir, "AGENTS.md"),
|
|
35856
|
+
isDestination: true
|
|
35857
|
+
},
|
|
35858
|
+
{
|
|
35859
|
+
label: "claude-instructions",
|
|
35860
|
+
path: path17.join(folders.claudeDir, "CLAUDE.md"),
|
|
35861
|
+
linkWhenMissing: true
|
|
35862
|
+
},
|
|
35863
|
+
...includeCodex ? [{
|
|
35864
|
+
label: "codex-instructions",
|
|
35865
|
+
path: path17.join(folders.codexDir, "AGENTS.md"),
|
|
35866
|
+
linkWhenMissing: true
|
|
35867
|
+
}] : []
|
|
35868
|
+
]);
|
|
35992
35869
|
}
|
|
35993
|
-
function
|
|
35994
|
-
const
|
|
35995
|
-
const
|
|
35996
|
-
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
35870
|
+
function getRepositoryContainerCandidates(options) {
|
|
35871
|
+
const folders = resolveFolders(options);
|
|
35872
|
+
const cursorDir = path17.join(folders.rootDir, ".cursor");
|
|
35873
|
+
return uniqueByPath([
|
|
35874
|
+
...getContainerCandidates(options, false),
|
|
35875
|
+
{
|
|
35876
|
+
category: "rules",
|
|
35877
|
+
label: "agents-rules",
|
|
35878
|
+
path: path17.join(folders.agentsDir, "rules"),
|
|
35879
|
+
isDestination: true
|
|
35880
|
+
},
|
|
35881
|
+
{
|
|
35882
|
+
category: "rules",
|
|
35883
|
+
label: "claude-rules",
|
|
35884
|
+
path: path17.join(folders.claudeDir, "rules"),
|
|
35885
|
+
linkWhenMissing: true
|
|
35886
|
+
},
|
|
35887
|
+
{
|
|
35888
|
+
category: "rules",
|
|
35889
|
+
label: "cursor-rules",
|
|
35890
|
+
path: path17.join(cursorDir, "rules"),
|
|
35891
|
+
linkWhenParentExists: true
|
|
35892
|
+
},
|
|
35893
|
+
{
|
|
35894
|
+
category: "rules",
|
|
35895
|
+
label: "claude-memories",
|
|
35896
|
+
path: path17.join(folders.claudeDir, "memories"),
|
|
35897
|
+
linkSource: false
|
|
35898
|
+
},
|
|
35899
|
+
{
|
|
35900
|
+
category: "rules",
|
|
35901
|
+
label: "cursor-memories",
|
|
35902
|
+
path: path17.join(cursorDir, "memories"),
|
|
35903
|
+
linkSource: false
|
|
35904
|
+
},
|
|
35905
|
+
{
|
|
35906
|
+
category: "rules",
|
|
35907
|
+
label: "claude-memory",
|
|
35908
|
+
path: path17.join(folders.claudeDir, "memory.md"),
|
|
35909
|
+
linkSource: false
|
|
35910
|
+
},
|
|
35911
|
+
{
|
|
35912
|
+
category: "rules",
|
|
35913
|
+
label: "cursor-memory",
|
|
35914
|
+
path: path17.join(cursorDir, "memory.md"),
|
|
35915
|
+
linkSource: false
|
|
35916
|
+
},
|
|
35917
|
+
{
|
|
35918
|
+
category: "rules",
|
|
35919
|
+
label: "claude-memory-uppercase",
|
|
35920
|
+
path: path17.join(folders.claudeDir, "MEMORY.md"),
|
|
35921
|
+
linkSource: false
|
|
35922
|
+
},
|
|
35923
|
+
{
|
|
35924
|
+
category: "rules",
|
|
35925
|
+
label: "cursor-memory-uppercase",
|
|
35926
|
+
path: path17.join(cursorDir, "MEMORY.md"),
|
|
35927
|
+
linkSource: false
|
|
35928
|
+
}
|
|
35929
|
+
]);
|
|
36000
35930
|
}
|
|
36001
|
-
async function
|
|
36002
|
-
|
|
36003
|
-
|
|
36004
|
-
|
|
36005
|
-
|
|
36006
|
-
|
|
36007
|
-
|
|
35931
|
+
async function pathExistsOrSymlink(targetPath) {
|
|
35932
|
+
const stat = await import_fs_extra13.default.lstat(targetPath).catch(() => null);
|
|
35933
|
+
return Boolean(stat);
|
|
35934
|
+
}
|
|
35935
|
+
async function realPathIfPossible(targetPath) {
|
|
35936
|
+
try {
|
|
35937
|
+
return await import_fs_extra13.default.realpath(targetPath);
|
|
35938
|
+
} catch {
|
|
35939
|
+
return null;
|
|
36008
35940
|
}
|
|
36009
35941
|
}
|
|
36010
|
-
function
|
|
36011
|
-
return
|
|
35942
|
+
function samePath(a, b3) {
|
|
35943
|
+
return path17.resolve(a) === path17.resolve(b3);
|
|
36012
35944
|
}
|
|
36013
|
-
|
|
36014
|
-
|
|
35945
|
+
function hashString(value) {
|
|
35946
|
+
return crypto.createHash("sha256").update(value).digest("hex");
|
|
35947
|
+
}
|
|
35948
|
+
async function hashPath(targetPath) {
|
|
35949
|
+
const stat = await import_fs_extra13.default.lstat(targetPath);
|
|
36015
35950
|
if (stat.isSymbolicLink()) {
|
|
36016
|
-
|
|
35951
|
+
const linkTarget = await import_fs_extra13.default.readlink(targetPath);
|
|
35952
|
+
return hashString(`symlink:${linkTarget}`);
|
|
36017
35953
|
}
|
|
36018
35954
|
if (stat.isFile()) {
|
|
36019
|
-
const
|
|
36020
|
-
|
|
36021
|
-
|
|
36022
|
-
return
|
|
35955
|
+
const fileHash = crypto.createHash("sha256");
|
|
35956
|
+
fileHash.update("file:");
|
|
35957
|
+
fileHash.update(await import_fs_extra13.default.readFile(targetPath));
|
|
35958
|
+
return fileHash.digest("hex");
|
|
36023
35959
|
}
|
|
36024
35960
|
if (stat.isDirectory()) {
|
|
36025
|
-
const entries = (await
|
|
36026
|
-
const
|
|
36027
|
-
|
|
35961
|
+
const entries = (await import_fs_extra13.default.readdir(targetPath, { withFileTypes: true })).filter((entry) => !IGNORED_ENTRY_NAMES2.has(entry.name)).sort((a, b3) => a.name.localeCompare(b3.name));
|
|
35962
|
+
const dirHash = crypto.createHash("sha256");
|
|
35963
|
+
dirHash.update("dir:");
|
|
36028
35964
|
for (const entry of entries) {
|
|
36029
|
-
|
|
36030
|
-
|
|
36031
|
-
|
|
36032
|
-
|
|
35965
|
+
dirHash.update(entry.name);
|
|
35966
|
+
dirHash.update("\x00");
|
|
35967
|
+
dirHash.update(await hashPath(path17.join(targetPath, entry.name)));
|
|
35968
|
+
dirHash.update("\x00");
|
|
36033
35969
|
}
|
|
36034
|
-
return
|
|
35970
|
+
return dirHash.digest("hex");
|
|
36035
35971
|
}
|
|
36036
|
-
return
|
|
35972
|
+
return hashString(`other:${stat.mode}:${stat.size}`);
|
|
36037
35973
|
}
|
|
36038
|
-
|
|
36039
|
-
|
|
36040
|
-
|
|
36041
|
-
|
|
36042
|
-
|
|
36043
|
-
|
|
36044
|
-
|
|
36045
|
-
|
|
36046
|
-
|
|
36047
|
-
|
|
36048
|
-
|
|
36049
|
-
|
|
35974
|
+
var TEXT_EXTENSIONS = new Set([
|
|
35975
|
+
".cjs",
|
|
35976
|
+
".js",
|
|
35977
|
+
".json",
|
|
35978
|
+
".jsonc",
|
|
35979
|
+
".md",
|
|
35980
|
+
".mdc",
|
|
35981
|
+
".mjs",
|
|
35982
|
+
".sh",
|
|
35983
|
+
".toml",
|
|
35984
|
+
".ts",
|
|
35985
|
+
".tsx",
|
|
35986
|
+
".txt",
|
|
35987
|
+
".yaml",
|
|
35988
|
+
".yml"
|
|
35989
|
+
]);
|
|
35990
|
+
var PORTABLE_PATH_REPLACEMENTS = [
|
|
35991
|
+
[/\.claude\/skills/g, ".agents/skills"],
|
|
35992
|
+
[/\.codex\/skills/g, ".agents/skills"],
|
|
35993
|
+
[/\.cursor\/skills-cursor/g, ".agents/skills"],
|
|
35994
|
+
[/\.cursor\/skills/g, ".agents/skills"],
|
|
35995
|
+
[/\.claude\/agents/g, ".agents/agents"],
|
|
35996
|
+
[/\.codex\/agents/g, ".agents/agents"],
|
|
35997
|
+
[/\.cursor\/agents/g, ".agents/agents"],
|
|
35998
|
+
[/\.claude\/rules/g, ".agents/rules"],
|
|
35999
|
+
[/\.codex\/rules/g, ".agents/rules"],
|
|
36000
|
+
[/\.cursor\/rules/g, ".agents/rules"],
|
|
36001
|
+
[/\.claude\/memories/g, ".agents/rules"],
|
|
36002
|
+
[/\.codex\/memories/g, ".agents/rules"],
|
|
36003
|
+
[/\.cursor\/memories/g, ".agents/rules"]
|
|
36004
|
+
];
|
|
36005
|
+
function normalizePortableText(content) {
|
|
36006
|
+
let normalized = content;
|
|
36007
|
+
for (const [pattern, replacement] of PORTABLE_PATH_REPLACEMENTS) {
|
|
36008
|
+
normalized = normalized.replace(pattern, replacement);
|
|
36009
|
+
}
|
|
36010
|
+
return normalized;
|
|
36011
|
+
}
|
|
36012
|
+
function isLikelyTextFile(filePath) {
|
|
36013
|
+
const ext = path17.extname(filePath).toLowerCase();
|
|
36014
|
+
if (TEXT_EXTENSIONS.has(ext))
|
|
36015
|
+
return true;
|
|
36016
|
+
return path17.basename(filePath) === "SKILL.md";
|
|
36017
|
+
}
|
|
36018
|
+
async function normalizePortableContent(targetPath) {
|
|
36019
|
+
const stat = await import_fs_extra13.default.lstat(targetPath).catch(() => null);
|
|
36020
|
+
if (!stat || stat.isSymbolicLink())
|
|
36050
36021
|
return;
|
|
36051
|
-
|
|
36052
|
-
|
|
36053
|
-
const entries = await import_fs_extra14.default.readdir(sourcePath);
|
|
36054
|
-
await import_fs_extra14.default.ensureDir(destinationPath);
|
|
36022
|
+
if (stat.isDirectory()) {
|
|
36023
|
+
const entries = await import_fs_extra13.default.readdir(targetPath);
|
|
36055
36024
|
for (const entry of entries) {
|
|
36056
|
-
|
|
36057
|
-
|
|
36058
|
-
|
|
36059
|
-
folder,
|
|
36060
|
-
sessionRoot,
|
|
36061
|
-
snapshot,
|
|
36062
|
-
sourceTag,
|
|
36063
|
-
result
|
|
36064
|
-
});
|
|
36025
|
+
if (IGNORED_ENTRY_NAMES2.has(entry))
|
|
36026
|
+
continue;
|
|
36027
|
+
await normalizePortableContent(path17.join(targetPath, entry));
|
|
36065
36028
|
}
|
|
36066
36029
|
return;
|
|
36067
36030
|
}
|
|
36068
|
-
if (!
|
|
36069
|
-
|
|
36070
|
-
|
|
36071
|
-
|
|
36072
|
-
dereference: false
|
|
36073
|
-
});
|
|
36074
|
-
result.imported.push({
|
|
36075
|
-
folder,
|
|
36076
|
-
sessionRoot,
|
|
36077
|
-
from: sourcePath,
|
|
36078
|
-
to: destinationPath,
|
|
36079
|
-
snapshot: snapshot.name
|
|
36080
|
-
});
|
|
36031
|
+
if (!stat.isFile() || !isLikelyTextFile(targetPath))
|
|
36032
|
+
return;
|
|
36033
|
+
const content = await import_fs_extra13.default.readFile(targetPath, "utf-8").catch(() => null);
|
|
36034
|
+
if (content === null || content.includes("\x00"))
|
|
36081
36035
|
return;
|
|
36036
|
+
const normalized = normalizePortableText(content);
|
|
36037
|
+
if (normalized !== content) {
|
|
36038
|
+
await import_fs_extra13.default.writeFile(targetPath, normalized, "utf-8");
|
|
36082
36039
|
}
|
|
36083
|
-
|
|
36084
|
-
|
|
36085
|
-
|
|
36086
|
-
|
|
36087
|
-
|
|
36088
|
-
|
|
36089
|
-
|
|
36090
|
-
|
|
36040
|
+
}
|
|
36041
|
+
function suffixFromLabel(label) {
|
|
36042
|
+
return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "source";
|
|
36043
|
+
}
|
|
36044
|
+
function nameWithSuffix(name, suffix, index) {
|
|
36045
|
+
const parsed = path17.parse(name);
|
|
36046
|
+
const numberedSuffix = index === 1 ? suffix : `${suffix}-${index}`;
|
|
36047
|
+
if (parsed.ext && parsed.name) {
|
|
36048
|
+
return `${parsed.name}--${numberedSuffix}${parsed.ext}`;
|
|
36049
|
+
}
|
|
36050
|
+
return `${name}--${numberedSuffix}`;
|
|
36051
|
+
}
|
|
36052
|
+
async function addExistingDestinationHashes(destinationDir, knownHashes) {
|
|
36053
|
+
if (!await import_fs_extra13.default.pathExists(destinationDir))
|
|
36091
36054
|
return;
|
|
36055
|
+
const entries = await import_fs_extra13.default.readdir(destinationDir, { withFileTypes: true });
|
|
36056
|
+
for (const entry of entries) {
|
|
36057
|
+
if (IGNORED_ENTRY_NAMES2.has(entry.name))
|
|
36058
|
+
continue;
|
|
36059
|
+
const entryPath = path17.join(destinationDir, entry.name);
|
|
36060
|
+
knownHashes.set(await hashPath(entryPath), entry.name);
|
|
36092
36061
|
}
|
|
36093
|
-
const conflictPath = await uniqueConflictPath(destinationPath, sourceTag);
|
|
36094
|
-
await import_fs_extra14.default.ensureDir(path18.dirname(conflictPath));
|
|
36095
|
-
await import_fs_extra14.default.copy(sourcePath, conflictPath, {
|
|
36096
|
-
overwrite: false,
|
|
36097
|
-
dereference: false
|
|
36098
|
-
});
|
|
36099
|
-
result.conflicts.push({
|
|
36100
|
-
folder,
|
|
36101
|
-
sessionRoot,
|
|
36102
|
-
from: sourcePath,
|
|
36103
|
-
to: conflictPath,
|
|
36104
|
-
snapshot: snapshot.name,
|
|
36105
|
-
reason: "Same session path with different content"
|
|
36106
|
-
});
|
|
36107
36062
|
}
|
|
36108
|
-
async function
|
|
36109
|
-
const
|
|
36110
|
-
const
|
|
36111
|
-
const
|
|
36112
|
-
|
|
36113
|
-
|
|
36114
|
-
|
|
36115
|
-
|
|
36116
|
-
|
|
36117
|
-
|
|
36118
|
-
|
|
36119
|
-
|
|
36120
|
-
|
|
36121
|
-
|
|
36122
|
-
|
|
36123
|
-
|
|
36124
|
-
|
|
36125
|
-
|
|
36126
|
-
|
|
36127
|
-
|
|
36063
|
+
async function importCategoryEntries(category, candidates, destinationDir, result, dryRun = false) {
|
|
36064
|
+
const sourceEntries = [];
|
|
36065
|
+
const destinationExists = await pathExistsOrSymlink(destinationDir);
|
|
36066
|
+
const destinationRealPath = destinationExists ? await realPathIfPossible(destinationDir) : null;
|
|
36067
|
+
for (const candidate of candidates) {
|
|
36068
|
+
if (candidate.category !== category || candidate.isDestination)
|
|
36069
|
+
continue;
|
|
36070
|
+
const candidateStat = await import_fs_extra13.default.lstat(candidate.path).catch(() => null);
|
|
36071
|
+
if (!candidateStat)
|
|
36072
|
+
continue;
|
|
36073
|
+
const candidateRealPath = await realPathIfPossible(candidate.path);
|
|
36074
|
+
if (destinationRealPath && candidateRealPath && samePath(destinationRealPath, candidateRealPath)) {
|
|
36075
|
+
continue;
|
|
36076
|
+
}
|
|
36077
|
+
const entries = await collectCandidateEntries(candidate).catch(() => null);
|
|
36078
|
+
if (!entries) {
|
|
36079
|
+
result.skipped.push({
|
|
36080
|
+
category,
|
|
36081
|
+
path: candidate.path,
|
|
36082
|
+
reason: "Could not read directory"
|
|
36083
|
+
});
|
|
36084
|
+
continue;
|
|
36085
|
+
}
|
|
36086
|
+
const collectableEntries = [];
|
|
36087
|
+
for (const entry of entries) {
|
|
36088
|
+
if (!await shouldCollectPath(category, entry.name, entry.path))
|
|
36128
36089
|
continue;
|
|
36129
|
-
|
|
36130
|
-
|
|
36131
|
-
|
|
36132
|
-
|
|
36133
|
-
|
|
36134
|
-
|
|
36135
|
-
|
|
36136
|
-
|
|
36137
|
-
|
|
36138
|
-
|
|
36139
|
-
|
|
36140
|
-
|
|
36090
|
+
collectableEntries.push(entry);
|
|
36091
|
+
}
|
|
36092
|
+
if (collectableEntries.length > 0) {
|
|
36093
|
+
sourceEntries.push({ candidate, entries: collectableEntries });
|
|
36094
|
+
}
|
|
36095
|
+
}
|
|
36096
|
+
if (!destinationExists && sourceEntries.length === 0) {
|
|
36097
|
+
return false;
|
|
36098
|
+
}
|
|
36099
|
+
if (!dryRun) {
|
|
36100
|
+
await import_fs_extra13.default.ensureDir(destinationDir);
|
|
36101
|
+
}
|
|
36102
|
+
const knownHashes = new Map;
|
|
36103
|
+
await addExistingDestinationHashes(destinationDir, knownHashes);
|
|
36104
|
+
const knownNames = new Set(knownHashes.values());
|
|
36105
|
+
for (const { candidate, entries } of sourceEntries) {
|
|
36106
|
+
for (const entry of entries) {
|
|
36107
|
+
const sourcePath = entry.path;
|
|
36108
|
+
const sourceHash = await hashPath(sourcePath);
|
|
36109
|
+
const existingName = knownHashes.get(sourceHash);
|
|
36110
|
+
if (existingName) {
|
|
36111
|
+
result.duplicates.push({
|
|
36112
|
+
category,
|
|
36113
|
+
name: entry.name,
|
|
36114
|
+
from: sourcePath,
|
|
36115
|
+
keptAs: path17.join(destinationDir, existingName)
|
|
36116
|
+
});
|
|
36117
|
+
continue;
|
|
36118
|
+
}
|
|
36119
|
+
let targetName = entry.name;
|
|
36120
|
+
let targetPath = path17.join(destinationDir, targetName);
|
|
36121
|
+
if (await pathExistsOrSymlink(targetPath) || knownNames.has(targetName)) {
|
|
36122
|
+
targetName = await findAvailableTargetName(destinationDir, entry.name, candidate.label, knownNames);
|
|
36123
|
+
targetPath = path17.join(destinationDir, targetName);
|
|
36124
|
+
result.renamed.push({
|
|
36125
|
+
category,
|
|
36126
|
+
name: entry.name,
|
|
36127
|
+
from: sourcePath,
|
|
36128
|
+
to: targetPath,
|
|
36129
|
+
reason: "Same name with different content"
|
|
36130
|
+
});
|
|
36131
|
+
}
|
|
36132
|
+
if (!dryRun) {
|
|
36133
|
+
await import_fs_extra13.default.copy(sourcePath, targetPath, {
|
|
36134
|
+
dereference: false,
|
|
36135
|
+
overwrite: false
|
|
36141
36136
|
});
|
|
36137
|
+
await normalizePortableContent(targetPath);
|
|
36142
36138
|
}
|
|
36139
|
+
knownNames.add(targetName);
|
|
36140
|
+
knownHashes.set(dryRun ? sourceHash : await hashPath(targetPath), targetName);
|
|
36141
|
+
result.imported.push({
|
|
36142
|
+
category,
|
|
36143
|
+
name: entry.name,
|
|
36144
|
+
from: sourcePath,
|
|
36145
|
+
to: targetPath
|
|
36146
|
+
});
|
|
36147
|
+
}
|
|
36148
|
+
}
|
|
36149
|
+
return true;
|
|
36150
|
+
}
|
|
36151
|
+
async function findAvailableTargetName(destinationDir, originalName, label, knownNames) {
|
|
36152
|
+
const suffix = suffixFromLabel(label);
|
|
36153
|
+
let index = 1;
|
|
36154
|
+
while (true) {
|
|
36155
|
+
const candidate = nameWithSuffix(originalName, suffix, index);
|
|
36156
|
+
if (!knownNames.has(candidate) && !await pathExistsOrSymlink(path17.join(destinationDir, candidate))) {
|
|
36157
|
+
return candidate;
|
|
36158
|
+
}
|
|
36159
|
+
index++;
|
|
36160
|
+
}
|
|
36161
|
+
}
|
|
36162
|
+
async function collectCandidateEntries(candidate) {
|
|
36163
|
+
const stat = await import_fs_extra13.default.lstat(candidate.path);
|
|
36164
|
+
if (stat.isDirectory()) {
|
|
36165
|
+
const entries = await import_fs_extra13.default.readdir(candidate.path, { withFileTypes: true });
|
|
36166
|
+
return entries.map((entry) => ({
|
|
36167
|
+
name: entry.name,
|
|
36168
|
+
path: path17.join(candidate.path, entry.name)
|
|
36169
|
+
}));
|
|
36170
|
+
}
|
|
36171
|
+
if (stat.isSymbolicLink()) {
|
|
36172
|
+
const targetStat = await import_fs_extra13.default.stat(candidate.path).catch(() => null);
|
|
36173
|
+
if (targetStat?.isDirectory()) {
|
|
36174
|
+
const entries = await import_fs_extra13.default.readdir(candidate.path, { withFileTypes: true });
|
|
36175
|
+
return entries.map((entry) => ({
|
|
36176
|
+
name: entry.name,
|
|
36177
|
+
path: path17.join(candidate.path, entry.name)
|
|
36178
|
+
}));
|
|
36143
36179
|
}
|
|
36144
36180
|
}
|
|
36145
|
-
return
|
|
36181
|
+
return [{
|
|
36182
|
+
name: path17.basename(candidate.path),
|
|
36183
|
+
path: candidate.path
|
|
36184
|
+
}];
|
|
36185
|
+
}
|
|
36186
|
+
async function shouldCollectPath(category, name, sourcePath) {
|
|
36187
|
+
if (IGNORED_ENTRY_NAMES2.has(name))
|
|
36188
|
+
return false;
|
|
36189
|
+
if (category === "skills" && name === ".cursor-managed-skills-manifest.json") {
|
|
36190
|
+
return true;
|
|
36191
|
+
}
|
|
36192
|
+
const stat = await import_fs_extra13.default.lstat(sourcePath).catch(() => null);
|
|
36193
|
+
if (!stat)
|
|
36194
|
+
return false;
|
|
36195
|
+
return stat.isFile() || stat.isDirectory() || stat.isSymbolicLink();
|
|
36146
36196
|
}
|
|
36147
|
-
|
|
36148
|
-
|
|
36149
|
-
|
|
36150
|
-
|
|
36151
|
-
for (const entry of entries) {
|
|
36152
|
-
counts.set(entry.folder, (counts.get(entry.folder) ?? 0) + 1);
|
|
36197
|
+
function safeRelativePath(rootDir, targetPath) {
|
|
36198
|
+
const relativePath = path17.relative(rootDir, targetPath);
|
|
36199
|
+
if (!relativePath || relativePath.startsWith("..") || path17.isAbsolute(relativePath)) {
|
|
36200
|
+
return path17.join("external", targetPath.replace(/[^a-zA-Z0-9._-]+/g, "-"));
|
|
36153
36201
|
}
|
|
36154
|
-
|
|
36155
|
-
return "none";
|
|
36156
|
-
return [...counts.entries()].map(([folder, count]) => `${folder}: ${count}`).join(", ");
|
|
36202
|
+
return relativePath;
|
|
36157
36203
|
}
|
|
36158
|
-
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
|
|
36164
|
-
|
|
36165
|
-
|
|
36166
|
-
|
|
36167
|
-
if (result.conflicts.length > 0) {
|
|
36168
|
-
console.log(source_default.yellow(`
|
|
36169
|
-
Conflicting session paths were copied with source suffixes:`));
|
|
36170
|
-
for (const conflict of result.conflicts.slice(0, 10)) {
|
|
36171
|
-
console.log(source_default.yellow(` ${conflict.to}`));
|
|
36172
|
-
}
|
|
36173
|
-
if (result.conflicts.length > 10) {
|
|
36174
|
-
console.log(source_default.yellow(` ...and ${result.conflicts.length - 10} more`));
|
|
36175
|
-
}
|
|
36204
|
+
function createBackupPath(rootDir) {
|
|
36205
|
+
const projectKey = createBackupNameSuffix(path17.resolve(rootDir));
|
|
36206
|
+
return path17.join(getBackupDir(), createTimestampedBackupName(`project-${projectKey}-agents-unify-sources`));
|
|
36207
|
+
}
|
|
36208
|
+
async function ensureBackupPath(result, dryRun = false) {
|
|
36209
|
+
if (!result.backupPath) {
|
|
36210
|
+
result.backupPath = createBackupPath(result.rootDir);
|
|
36211
|
+
if (!dryRun) {
|
|
36212
|
+
await import_fs_extra13.default.ensureDir(result.backupPath);
|
|
36176
36213
|
}
|
|
36177
|
-
} catch (error) {
|
|
36178
|
-
console.error(source_default.red("Session unify failed:"), error);
|
|
36179
|
-
process.exit(1);
|
|
36180
36214
|
}
|
|
36215
|
+
return result.backupPath;
|
|
36181
36216
|
}
|
|
36182
|
-
|
|
36183
|
-
|
|
36184
|
-
|
|
36185
|
-
|
|
36186
|
-
|
|
36187
|
-
|
|
36188
|
-
|
|
36189
|
-
import { Writable as X } from "node:stream";
|
|
36190
|
-
function DD({ onlyFirst: e = false } = {}) {
|
|
36191
|
-
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
36192
|
-
return new RegExp(t, e ? undefined : "g");
|
|
36217
|
+
async function createDirectorySymlink(source, target) {
|
|
36218
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(target));
|
|
36219
|
+
if (os14.platform() === "win32") {
|
|
36220
|
+
await import_fs_extra13.default.symlink(source, target, "junction");
|
|
36221
|
+
return;
|
|
36222
|
+
}
|
|
36223
|
+
await import_fs_extra13.default.symlink(source, target, "dir");
|
|
36193
36224
|
}
|
|
36194
|
-
|
|
36195
|
-
|
|
36196
|
-
if (
|
|
36197
|
-
|
|
36198
|
-
|
|
36225
|
+
async function createFileSymlink(source, target) {
|
|
36226
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(target));
|
|
36227
|
+
if (os14.platform() === "win32") {
|
|
36228
|
+
await import_fs_extra13.default.symlink(source, target, "file");
|
|
36229
|
+
return;
|
|
36230
|
+
}
|
|
36231
|
+
await import_fs_extra13.default.symlink(source, target);
|
|
36199
36232
|
}
|
|
36200
|
-
function
|
|
36201
|
-
|
|
36233
|
+
async function shouldLinkMissingContainer(candidate) {
|
|
36234
|
+
if (candidate.linkWhenMissing)
|
|
36235
|
+
return true;
|
|
36236
|
+
if (!candidate.linkWhenParentExists)
|
|
36237
|
+
return false;
|
|
36238
|
+
return import_fs_extra13.default.pathExists(path17.dirname(candidate.path));
|
|
36202
36239
|
}
|
|
36203
|
-
|
|
36204
|
-
(
|
|
36205
|
-
|
|
36206
|
-
e.exports = u, u.eastAsianWidth = function(F) {
|
|
36207
|
-
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
36208
|
-
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
36209
|
-
}, u.characterLength = function(F) {
|
|
36210
|
-
var s = this.eastAsianWidth(F);
|
|
36211
|
-
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
36212
|
-
};
|
|
36213
|
-
function t(F) {
|
|
36214
|
-
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
36240
|
+
async function linkContainer(candidate, destinationDir, result, dryRun = false) {
|
|
36241
|
+
if (candidate.linkSource === false) {
|
|
36242
|
+
return;
|
|
36215
36243
|
}
|
|
36216
|
-
|
|
36217
|
-
|
|
36218
|
-
i = i + this.characterLength(s[D]);
|
|
36219
|
-
return i;
|
|
36220
|
-
}, u.slice = function(F, s, i) {
|
|
36221
|
-
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
36222
|
-
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
36223
|
-
var a = n[E], o = u.length(a);
|
|
36224
|
-
if (C >= s - (o == 2 ? 1 : 0))
|
|
36225
|
-
if (C + o <= i)
|
|
36226
|
-
D += a;
|
|
36227
|
-
else
|
|
36228
|
-
break;
|
|
36229
|
-
C += o;
|
|
36230
|
-
}
|
|
36231
|
-
return D;
|
|
36232
|
-
};
|
|
36233
|
-
})(W);
|
|
36234
|
-
var tD = W.exports;
|
|
36235
|
-
var eD = L(tD);
|
|
36236
|
-
var FD = function() {
|
|
36237
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
36238
|
-
};
|
|
36239
|
-
var sD = L(FD);
|
|
36240
|
-
function p(e, u = {}) {
|
|
36241
|
-
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
36242
|
-
return 0;
|
|
36243
|
-
e = e.replace(sD(), " ");
|
|
36244
|
-
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
36245
|
-
let F = 0;
|
|
36246
|
-
for (const s of e) {
|
|
36247
|
-
const i = s.codePointAt(0);
|
|
36248
|
-
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
36249
|
-
continue;
|
|
36250
|
-
switch (eD.eastAsianWidth(s)) {
|
|
36251
|
-
case "F":
|
|
36252
|
-
case "W":
|
|
36253
|
-
F += 2;
|
|
36254
|
-
break;
|
|
36255
|
-
case "A":
|
|
36256
|
-
F += t;
|
|
36257
|
-
break;
|
|
36258
|
-
default:
|
|
36259
|
-
F += 1;
|
|
36260
|
-
}
|
|
36244
|
+
if (candidate.isDestination || samePath(candidate.path, destinationDir)) {
|
|
36245
|
+
return;
|
|
36261
36246
|
}
|
|
36262
|
-
|
|
36263
|
-
|
|
36264
|
-
|
|
36265
|
-
|
|
36266
|
-
|
|
36267
|
-
|
|
36268
|
-
|
|
36269
|
-
|
|
36270
|
-
|
|
36271
|
-
|
|
36272
|
-
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
for (const [F, s] of Object.entries(t))
|
|
36277
|
-
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
36278
|
-
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
36247
|
+
const destinationRealPath = await realPathIfPossible(destinationDir);
|
|
36248
|
+
const stat = await import_fs_extra13.default.lstat(candidate.path).catch(() => null);
|
|
36249
|
+
if (!stat) {
|
|
36250
|
+
if (!await shouldLinkMissingContainer(candidate))
|
|
36251
|
+
return;
|
|
36252
|
+
if (!dryRun) {
|
|
36253
|
+
await createDirectorySymlink(destinationDir, candidate.path);
|
|
36254
|
+
}
|
|
36255
|
+
result.linked.push({
|
|
36256
|
+
category: candidate.category,
|
|
36257
|
+
from: candidate.path,
|
|
36258
|
+
to: destinationDir
|
|
36259
|
+
});
|
|
36260
|
+
return;
|
|
36279
36261
|
}
|
|
36280
|
-
|
|
36281
|
-
const
|
|
36282
|
-
if (
|
|
36283
|
-
|
|
36284
|
-
|
|
36285
|
-
|
|
36286
|
-
|
|
36287
|
-
|
|
36288
|
-
|
|
36289
|
-
if (u < 8)
|
|
36290
|
-
return 30 + u;
|
|
36291
|
-
if (u < 16)
|
|
36292
|
-
return 90 + (u - 8);
|
|
36293
|
-
let t, F, s;
|
|
36294
|
-
if (u >= 232)
|
|
36295
|
-
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
36296
|
-
else {
|
|
36297
|
-
u -= 16;
|
|
36298
|
-
const C = u % 36;
|
|
36299
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
36262
|
+
if (stat.isSymbolicLink()) {
|
|
36263
|
+
const existingRealPath = await realPathIfPossible(candidate.path);
|
|
36264
|
+
if (destinationRealPath && existingRealPath && samePath(destinationRealPath, existingRealPath)) {
|
|
36265
|
+
result.alreadyLinked.push({
|
|
36266
|
+
category: candidate.category,
|
|
36267
|
+
from: candidate.path,
|
|
36268
|
+
to: destinationDir
|
|
36269
|
+
});
|
|
36270
|
+
return;
|
|
36300
36271
|
}
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
|
|
36304
|
-
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
36305
|
-
return i === 2 && (D += 60), D;
|
|
36306
|
-
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
36307
|
-
}
|
|
36308
|
-
var ED = rD();
|
|
36309
|
-
var d = new Set(["\x1B", ""]);
|
|
36310
|
-
var oD = 39;
|
|
36311
|
-
var y = "\x07";
|
|
36312
|
-
var V = "[";
|
|
36313
|
-
var nD = "]";
|
|
36314
|
-
var G = "m";
|
|
36315
|
-
var _2 = `${nD}8;;`;
|
|
36316
|
-
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
36317
|
-
var K = (e) => `${d.values().next().value}${_2}${e}${y}`;
|
|
36318
|
-
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
36319
|
-
var k = (e, u, t) => {
|
|
36320
|
-
const F = [...u];
|
|
36321
|
-
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
36322
|
-
for (const [C, n] of F.entries()) {
|
|
36323
|
-
const E = p(n);
|
|
36324
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_2)), s) {
|
|
36325
|
-
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
36326
|
-
continue;
|
|
36272
|
+
if (!dryRun) {
|
|
36273
|
+
await import_fs_extra13.default.remove(candidate.path);
|
|
36274
|
+
await createDirectorySymlink(destinationDir, candidate.path);
|
|
36327
36275
|
}
|
|
36328
|
-
|
|
36276
|
+
result.linked.push({
|
|
36277
|
+
category: candidate.category,
|
|
36278
|
+
from: candidate.path,
|
|
36279
|
+
to: destinationDir
|
|
36280
|
+
});
|
|
36281
|
+
return;
|
|
36329
36282
|
}
|
|
36330
|
-
|
|
36331
|
-
|
|
36332
|
-
|
|
36333
|
-
|
|
36334
|
-
|
|
36335
|
-
|
|
36336
|
-
|
|
36337
|
-
|
|
36338
|
-
|
|
36339
|
-
|
|
36340
|
-
|
|
36341
|
-
|
|
36342
|
-
|
|
36343
|
-
|
|
36344
|
-
|
|
36345
|
-
|
|
36346
|
-
|
|
36347
|
-
|
|
36348
|
-
|
|
36349
|
-
|
|
36350
|
-
|
|
36283
|
+
const backupRoot = await ensureBackupPath(result, dryRun);
|
|
36284
|
+
const backupTarget = path17.join(backupRoot, safeRelativePath(result.rootDir, candidate.path));
|
|
36285
|
+
if (!dryRun) {
|
|
36286
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(backupTarget));
|
|
36287
|
+
await import_fs_extra13.default.move(candidate.path, backupTarget, { overwrite: false });
|
|
36288
|
+
await createDirectorySymlink(destinationDir, candidate.path);
|
|
36289
|
+
}
|
|
36290
|
+
result.linked.push({
|
|
36291
|
+
category: candidate.category,
|
|
36292
|
+
from: candidate.path,
|
|
36293
|
+
to: destinationDir,
|
|
36294
|
+
movedToBackup: backupTarget
|
|
36295
|
+
});
|
|
36296
|
+
}
|
|
36297
|
+
async function importInstructionFiles(candidates, destinationPath, result, dryRun = false) {
|
|
36298
|
+
const destinationExists = await pathExistsOrSymlink(destinationPath);
|
|
36299
|
+
const destinationRealPath = destinationExists ? await realPathIfPossible(destinationPath) : null;
|
|
36300
|
+
const sourceCandidates = [];
|
|
36301
|
+
for (const candidate of candidates) {
|
|
36302
|
+
if (candidate.isDestination)
|
|
36303
|
+
continue;
|
|
36304
|
+
const sourceStat = await import_fs_extra13.default.lstat(candidate.path).catch(() => null);
|
|
36305
|
+
if (!sourceStat)
|
|
36306
|
+
continue;
|
|
36307
|
+
const sourceRealPath = await realPathIfPossible(candidate.path);
|
|
36308
|
+
if (destinationRealPath && sourceRealPath && samePath(destinationRealPath, sourceRealPath)) {
|
|
36351
36309
|
continue;
|
|
36352
36310
|
}
|
|
36353
|
-
|
|
36354
|
-
|
|
36355
|
-
|
|
36356
|
-
|
|
36311
|
+
sourceCandidates.push(candidate);
|
|
36312
|
+
}
|
|
36313
|
+
if (!destinationExists && sourceCandidates.length === 0) {
|
|
36314
|
+
return false;
|
|
36315
|
+
}
|
|
36316
|
+
if (!dryRun) {
|
|
36317
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(destinationPath));
|
|
36318
|
+
}
|
|
36319
|
+
let destinationHash = destinationExists ? await hashPath(destinationPath) : null;
|
|
36320
|
+
const plannedNames = new Set;
|
|
36321
|
+
for (const candidate of sourceCandidates) {
|
|
36322
|
+
const sourceHash = await hashPath(candidate.path);
|
|
36323
|
+
if (!destinationHash) {
|
|
36324
|
+
if (!dryRun) {
|
|
36325
|
+
await import_fs_extra13.default.copy(candidate.path, destinationPath, {
|
|
36326
|
+
dereference: false,
|
|
36327
|
+
overwrite: false
|
|
36328
|
+
});
|
|
36357
36329
|
}
|
|
36358
|
-
|
|
36330
|
+
destinationHash = sourceHash;
|
|
36331
|
+
plannedNames.add(path17.basename(destinationPath));
|
|
36332
|
+
result.imported.push({
|
|
36333
|
+
category: "instructions",
|
|
36334
|
+
name: path17.basename(candidate.path),
|
|
36335
|
+
from: candidate.path,
|
|
36336
|
+
to: destinationPath
|
|
36337
|
+
});
|
|
36338
|
+
continue;
|
|
36359
36339
|
}
|
|
36360
|
-
if (
|
|
36361
|
-
|
|
36340
|
+
if (sourceHash === destinationHash) {
|
|
36341
|
+
result.duplicates.push({
|
|
36342
|
+
category: "instructions",
|
|
36343
|
+
name: path17.basename(candidate.path),
|
|
36344
|
+
from: candidate.path,
|
|
36345
|
+
keptAs: destinationPath
|
|
36346
|
+
});
|
|
36362
36347
|
continue;
|
|
36363
36348
|
}
|
|
36364
|
-
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
|
|
36368
|
-
|
|
36369
|
-
|
|
36370
|
-
|
|
36371
|
-
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_2}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
36372
|
-
if (c.code !== undefined) {
|
|
36373
|
-
const f = Number.parseFloat(c.code);
|
|
36374
|
-
s = f === oD ? undefined : f;
|
|
36375
|
-
} else
|
|
36376
|
-
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
36349
|
+
const targetName = await findAvailableTargetName(path17.dirname(destinationPath), path17.basename(destinationPath), candidate.label, plannedNames);
|
|
36350
|
+
const targetPath = path17.join(path17.dirname(destinationPath), targetName);
|
|
36351
|
+
if (!dryRun) {
|
|
36352
|
+
await import_fs_extra13.default.copy(candidate.path, targetPath, {
|
|
36353
|
+
dereference: false,
|
|
36354
|
+
overwrite: false
|
|
36355
|
+
});
|
|
36377
36356
|
}
|
|
36378
|
-
|
|
36379
|
-
|
|
36380
|
-
|
|
36381
|
-
|
|
36357
|
+
plannedNames.add(targetName);
|
|
36358
|
+
result.renamed.push({
|
|
36359
|
+
category: "instructions",
|
|
36360
|
+
name: path17.basename(candidate.path),
|
|
36361
|
+
from: candidate.path,
|
|
36362
|
+
to: targetPath,
|
|
36363
|
+
reason: "Shared instruction file already exists with different content"
|
|
36364
|
+
});
|
|
36382
36365
|
}
|
|
36383
|
-
return
|
|
36384
|
-
};
|
|
36385
|
-
function Y(e, u, t) {
|
|
36386
|
-
return String(e).normalize().replace(/\r\n/g, `
|
|
36387
|
-
`).split(`
|
|
36388
|
-
`).map((F) => lD(F, u, t)).join(`
|
|
36389
|
-
`);
|
|
36366
|
+
return true;
|
|
36390
36367
|
}
|
|
36391
|
-
|
|
36392
|
-
|
|
36393
|
-
|
|
36394
|
-
if (typeof e == "string")
|
|
36395
|
-
return B.aliases.get(e) === u;
|
|
36396
|
-
for (const t of e)
|
|
36397
|
-
if (t !== undefined && $(t, u))
|
|
36398
|
-
return true;
|
|
36368
|
+
async function shouldLinkMissingInstruction(candidate) {
|
|
36369
|
+
if (candidate.linkWhenMissing)
|
|
36370
|
+
return true;
|
|
36399
36371
|
return false;
|
|
36400
36372
|
}
|
|
36401
|
-
function
|
|
36402
|
-
if (
|
|
36373
|
+
async function linkInstructionFile(candidate, destinationPath, result, dryRun = false) {
|
|
36374
|
+
if (candidate.isDestination || samePath(candidate.path, destinationPath)) {
|
|
36403
36375
|
return;
|
|
36404
|
-
|
|
36405
|
-
|
|
36406
|
-
|
|
36407
|
-
|
|
36408
|
-
|
|
36409
|
-
|
|
36376
|
+
}
|
|
36377
|
+
if (!await pathExistsOrSymlink(destinationPath)) {
|
|
36378
|
+
return;
|
|
36379
|
+
}
|
|
36380
|
+
const destinationRealPath = await realPathIfPossible(destinationPath);
|
|
36381
|
+
const stat = await import_fs_extra13.default.lstat(candidate.path).catch(() => null);
|
|
36382
|
+
if (!stat) {
|
|
36383
|
+
if (!await shouldLinkMissingInstruction(candidate))
|
|
36384
|
+
return;
|
|
36385
|
+
if (!dryRun) {
|
|
36386
|
+
await createFileSymlink(destinationPath, candidate.path);
|
|
36387
|
+
}
|
|
36388
|
+
result.linked.push({
|
|
36389
|
+
category: "instructions",
|
|
36390
|
+
from: candidate.path,
|
|
36391
|
+
to: destinationPath
|
|
36392
|
+
});
|
|
36393
|
+
return;
|
|
36394
|
+
}
|
|
36395
|
+
if (stat.isSymbolicLink()) {
|
|
36396
|
+
const existingRealPath = await realPathIfPossible(candidate.path);
|
|
36397
|
+
if (destinationRealPath && existingRealPath && samePath(destinationRealPath, existingRealPath)) {
|
|
36398
|
+
result.alreadyLinked.push({
|
|
36399
|
+
category: "instructions",
|
|
36400
|
+
from: candidate.path,
|
|
36401
|
+
to: destinationPath
|
|
36402
|
+
});
|
|
36403
|
+
return;
|
|
36404
|
+
}
|
|
36405
|
+
if (!dryRun) {
|
|
36406
|
+
await import_fs_extra13.default.remove(candidate.path);
|
|
36407
|
+
await createFileSymlink(destinationPath, candidate.path);
|
|
36408
|
+
}
|
|
36409
|
+
result.linked.push({
|
|
36410
|
+
category: "instructions",
|
|
36411
|
+
from: candidate.path,
|
|
36412
|
+
to: destinationPath
|
|
36413
|
+
});
|
|
36414
|
+
return;
|
|
36415
|
+
}
|
|
36416
|
+
const backupRoot = await ensureBackupPath(result, dryRun);
|
|
36417
|
+
const backupTarget = path17.join(backupRoot, safeRelativePath(result.rootDir, candidate.path));
|
|
36418
|
+
if (!dryRun) {
|
|
36419
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(backupTarget));
|
|
36420
|
+
await import_fs_extra13.default.move(candidate.path, backupTarget, { overwrite: false });
|
|
36421
|
+
await createFileSymlink(destinationPath, candidate.path);
|
|
36422
|
+
}
|
|
36423
|
+
result.linked.push({
|
|
36424
|
+
category: "instructions",
|
|
36425
|
+
from: candidate.path,
|
|
36426
|
+
to: destinationPath,
|
|
36427
|
+
movedToBackup: backupTarget
|
|
36428
|
+
});
|
|
36410
36429
|
}
|
|
36411
|
-
var
|
|
36412
|
-
var
|
|
36413
|
-
function
|
|
36414
|
-
return
|
|
36430
|
+
var RULES_INDEX_START = "<!-- AIBLUEPRINT:RULES:START -->";
|
|
36431
|
+
var RULES_INDEX_END = "<!-- AIBLUEPRINT:RULES:END -->";
|
|
36432
|
+
function titleFromRulePath(rulePath) {
|
|
36433
|
+
return path17.basename(rulePath, path17.extname(rulePath)).replace(/[-_]+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
36415
36434
|
}
|
|
36416
|
-
function
|
|
36417
|
-
const
|
|
36418
|
-
|
|
36435
|
+
async function readRuleTitle(rulePath) {
|
|
36436
|
+
const content = await import_fs_extra13.default.readFile(rulePath, "utf-8").catch(() => "");
|
|
36437
|
+
const heading = content.match(/^#\s+(.+)$/m)?.[1]?.trim();
|
|
36438
|
+
return heading || titleFromRulePath(rulePath);
|
|
36419
36439
|
}
|
|
36420
|
-
function
|
|
36421
|
-
const
|
|
36422
|
-
|
|
36423
|
-
|
|
36424
|
-
|
|
36425
|
-
|
|
36426
|
-
|
|
36427
|
-
|
|
36440
|
+
async function collectRuleIndexEntries(rulesDir, rootDir, currentDir = rulesDir) {
|
|
36441
|
+
const entries = await import_fs_extra13.default.readdir(currentDir, { withFileTypes: true }).catch(() => []);
|
|
36442
|
+
const rules = [];
|
|
36443
|
+
for (const entry of entries) {
|
|
36444
|
+
if (IGNORED_ENTRY_NAMES2.has(entry.name))
|
|
36445
|
+
continue;
|
|
36446
|
+
const entryPath = path17.join(currentDir, entry.name);
|
|
36447
|
+
if (entry.isDirectory()) {
|
|
36448
|
+
rules.push(...await collectRuleIndexEntries(rulesDir, rootDir, entryPath));
|
|
36449
|
+
continue;
|
|
36428
36450
|
}
|
|
36429
|
-
if (!
|
|
36430
|
-
|
|
36431
|
-
|
|
36432
|
-
|
|
36433
|
-
|
|
36434
|
-
|
|
36435
|
-
|
|
36451
|
+
if (!entry.isFile() && !entry.isSymbolicLink())
|
|
36452
|
+
continue;
|
|
36453
|
+
if (![".md", ".mdc"].includes(path17.extname(entry.name).toLowerCase()))
|
|
36454
|
+
continue;
|
|
36455
|
+
rules.push({
|
|
36456
|
+
title: await readRuleTitle(entryPath),
|
|
36457
|
+
relativePath: path17.relative(rootDir, entryPath)
|
|
36436
36458
|
});
|
|
36437
|
-
}
|
|
36438
|
-
return
|
|
36439
|
-
e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
|
|
36440
|
-
};
|
|
36459
|
+
}
|
|
36460
|
+
return rules.sort((a, b3) => a.relativePath.localeCompare(b3.relativePath));
|
|
36441
36461
|
}
|
|
36442
|
-
|
|
36443
|
-
|
|
36444
|
-
|
|
36462
|
+
function stripGeneratedRulesIndex(content) {
|
|
36463
|
+
const start = content.indexOf(RULES_INDEX_START);
|
|
36464
|
+
const end = content.indexOf(RULES_INDEX_END);
|
|
36465
|
+
if (start === -1 || end === -1 || end < start) {
|
|
36466
|
+
return content.trimEnd();
|
|
36467
|
+
}
|
|
36468
|
+
const beforeStart = content.slice(0, start);
|
|
36469
|
+
const headingIndex = beforeStart.lastIndexOf(`
|
|
36470
|
+
## Rules`);
|
|
36471
|
+
const blockStart = headingIndex === -1 ? start : headingIndex + 1;
|
|
36472
|
+
return `${content.slice(0, blockStart).trimEnd()}
|
|
36473
|
+
${content.slice(end + RULES_INDEX_END.length).trimStart()}`.trimEnd();
|
|
36474
|
+
}
|
|
36475
|
+
function renderRulesIndexBlock(rules) {
|
|
36476
|
+
const lines = [
|
|
36477
|
+
"## Rules",
|
|
36478
|
+
"",
|
|
36479
|
+
"Detailed focused rules live in `.agents/rules/`. Read the relevant file before acting:",
|
|
36480
|
+
"",
|
|
36481
|
+
RULES_INDEX_START
|
|
36482
|
+
];
|
|
36483
|
+
if (rules.length === 0) {
|
|
36484
|
+
lines.push("- No repository rules found yet.");
|
|
36485
|
+
} else {
|
|
36486
|
+
for (const rule of rules) {
|
|
36487
|
+
lines.push(`- **${rule.title}** - [${rule.relativePath}](${rule.relativePath})`);
|
|
36488
|
+
}
|
|
36489
|
+
}
|
|
36490
|
+
lines.push(RULES_INDEX_END);
|
|
36491
|
+
return lines.join(`
|
|
36492
|
+
`);
|
|
36493
|
+
}
|
|
36494
|
+
async function readExistingInstructions(rootDir) {
|
|
36495
|
+
const agentsPath = path17.join(rootDir, "AGENTS.md");
|
|
36496
|
+
const claudePath = path17.join(rootDir, "CLAUDE.md");
|
|
36497
|
+
const agentsContent = await import_fs_extra13.default.readFile(agentsPath, "utf-8").catch(() => null);
|
|
36498
|
+
const claudeContent = await import_fs_extra13.default.readFile(claudePath, "utf-8").catch(() => null);
|
|
36499
|
+
if (agentsContent !== null && claudeContent !== null && agentsContent.trim() !== claudeContent.trim()) {
|
|
36500
|
+
return `${agentsContent.trimEnd()}
|
|
36445
36501
|
|
|
36446
|
-
|
|
36447
|
-
|
|
36448
|
-
|
|
36449
|
-
|
|
36450
|
-
|
|
36502
|
+
## Previous Claude Instructions
|
|
36503
|
+
|
|
36504
|
+
${claudeContent.trimStart()}`;
|
|
36505
|
+
}
|
|
36506
|
+
if (agentsContent !== null)
|
|
36507
|
+
return agentsContent;
|
|
36508
|
+
if (claudeContent !== null)
|
|
36509
|
+
return claudeContent;
|
|
36510
|
+
return `# Repository Instructions
|
|
36511
|
+
`;
|
|
36512
|
+
}
|
|
36513
|
+
async function copyPathToBackup(result, targetPath) {
|
|
36514
|
+
const stat = await import_fs_extra13.default.lstat(targetPath).catch(() => null);
|
|
36515
|
+
if (!stat)
|
|
36516
|
+
return null;
|
|
36517
|
+
const backupRoot = await ensureBackupPath(result);
|
|
36518
|
+
const backupTarget = path17.join(backupRoot, safeRelativePath(result.rootDir, targetPath));
|
|
36519
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(backupTarget));
|
|
36520
|
+
await import_fs_extra13.default.copy(targetPath, backupTarget, {
|
|
36521
|
+
dereference: false,
|
|
36522
|
+
overwrite: false
|
|
36523
|
+
});
|
|
36524
|
+
return backupTarget;
|
|
36525
|
+
}
|
|
36526
|
+
async function planPathBackup(result, targetPath) {
|
|
36527
|
+
const stat = await import_fs_extra13.default.lstat(targetPath).catch(() => null);
|
|
36528
|
+
if (!stat)
|
|
36529
|
+
return null;
|
|
36530
|
+
const backupRoot = await ensureBackupPath(result, true);
|
|
36531
|
+
return path17.join(backupRoot, safeRelativePath(result.rootDir, targetPath));
|
|
36532
|
+
}
|
|
36533
|
+
async function replaceWithFileSymlink(sourcePath, targetPath) {
|
|
36534
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(targetPath));
|
|
36535
|
+
const relativeSource = path17.relative(path17.dirname(targetPath), sourcePath) || path17.basename(sourcePath);
|
|
36536
|
+
await import_fs_extra13.default.symlink(relativeSource, targetPath, "file");
|
|
36537
|
+
}
|
|
36538
|
+
async function ensureClaudeInstructionSymlink(result, agentsPath, claudePath, dryRun = false) {
|
|
36539
|
+
const agentsRealPath = await realPathIfPossible(agentsPath);
|
|
36540
|
+
const claudeStat = await import_fs_extra13.default.lstat(claudePath).catch(() => null);
|
|
36541
|
+
if (claudeStat?.isSymbolicLink()) {
|
|
36542
|
+
const claudeRealPath = await realPathIfPossible(claudePath);
|
|
36543
|
+
if (agentsRealPath && claudeRealPath && samePath(agentsRealPath, claudeRealPath)) {
|
|
36544
|
+
return;
|
|
36545
|
+
}
|
|
36546
|
+
}
|
|
36547
|
+
if (claudeStat) {
|
|
36548
|
+
if (dryRun) {
|
|
36549
|
+
await planPathBackup(result, claudePath);
|
|
36550
|
+
} else {
|
|
36551
|
+
await copyPathToBackup(result, claudePath);
|
|
36552
|
+
await import_fs_extra13.default.remove(claudePath);
|
|
36553
|
+
}
|
|
36451
36554
|
}
|
|
36452
|
-
|
|
36453
|
-
|
|
36555
|
+
if (!dryRun) {
|
|
36556
|
+
await replaceWithFileSymlink(agentsPath, claudePath);
|
|
36454
36557
|
}
|
|
36455
|
-
|
|
36456
|
-
|
|
36457
|
-
|
|
36558
|
+
result.linked.push({
|
|
36559
|
+
category: "instructions",
|
|
36560
|
+
from: claudePath,
|
|
36561
|
+
to: agentsPath
|
|
36562
|
+
});
|
|
36563
|
+
}
|
|
36564
|
+
async function writeRepositoryInstructionIndex(result, folders, dryRun = false) {
|
|
36565
|
+
const rulesDir = path17.join(folders.agentsDir, "rules");
|
|
36566
|
+
if (!dryRun && !await pathExistsOrSymlink(rulesDir)) {
|
|
36567
|
+
return;
|
|
36458
36568
|
}
|
|
36459
|
-
|
|
36460
|
-
|
|
36569
|
+
const rules = dryRun ? await collectPlannedRuleIndexEntries(result, folders.rootDir) : await collectRuleIndexEntries(rulesDir, folders.rootDir);
|
|
36570
|
+
if (rules.length === 0) {
|
|
36571
|
+
return;
|
|
36461
36572
|
}
|
|
36462
|
-
|
|
36463
|
-
|
|
36573
|
+
const existing = stripGeneratedRulesIndex(await readExistingInstructions(folders.rootDir));
|
|
36574
|
+
const content = `${existing}
|
|
36575
|
+
|
|
36576
|
+
${renderRulesIndexBlock(rules)}
|
|
36577
|
+
`;
|
|
36578
|
+
const agentsPath = path17.join(folders.rootDir, "AGENTS.md");
|
|
36579
|
+
const claudePath = path17.join(folders.rootDir, "CLAUDE.md");
|
|
36580
|
+
const agentsStat = await import_fs_extra13.default.lstat(agentsPath).catch(() => null);
|
|
36581
|
+
if (agentsStat) {
|
|
36582
|
+
if (dryRun) {
|
|
36583
|
+
await planPathBackup(result, agentsPath);
|
|
36584
|
+
} else {
|
|
36585
|
+
await copyPathToBackup(result, agentsPath);
|
|
36586
|
+
if (agentsStat.isSymbolicLink()) {
|
|
36587
|
+
await import_fs_extra13.default.remove(agentsPath);
|
|
36588
|
+
}
|
|
36589
|
+
}
|
|
36464
36590
|
}
|
|
36465
|
-
|
|
36466
|
-
|
|
36467
|
-
for (const i of F)
|
|
36468
|
-
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
36469
|
-
for (const i of s)
|
|
36470
|
-
i();
|
|
36591
|
+
if (!dryRun) {
|
|
36592
|
+
await import_fs_extra13.default.writeFile(agentsPath, content, "utf-8");
|
|
36471
36593
|
}
|
|
36472
|
-
|
|
36473
|
-
|
|
36474
|
-
|
|
36475
|
-
|
|
36476
|
-
|
|
36477
|
-
|
|
36478
|
-
|
|
36479
|
-
|
|
36480
|
-
|
|
36481
|
-
|
|
36482
|
-
|
|
36483
|
-
|
|
36484
|
-
|
|
36485
|
-
|
|
36486
|
-
|
|
36487
|
-
|
|
36488
|
-
|
|
36594
|
+
await ensureClaudeInstructionSymlink(result, agentsPath, claudePath, dryRun);
|
|
36595
|
+
result.instructionIndex = {
|
|
36596
|
+
agentsPath,
|
|
36597
|
+
claudePath,
|
|
36598
|
+
indexedRules: rules.map((rule) => rule.relativePath)
|
|
36599
|
+
};
|
|
36600
|
+
}
|
|
36601
|
+
async function collectPlannedRuleIndexEntries(result, rootDir) {
|
|
36602
|
+
const rules = [];
|
|
36603
|
+
const plannedRuleEntries = [
|
|
36604
|
+
...result.imported.filter((entry) => entry.category === "rules"),
|
|
36605
|
+
...result.renamed.filter((entry) => entry.category === "rules")
|
|
36606
|
+
];
|
|
36607
|
+
for (const entry of plannedRuleEntries) {
|
|
36608
|
+
const ext = path17.extname(entry.to).toLowerCase();
|
|
36609
|
+
if (![".md", ".mdc"].includes(ext))
|
|
36610
|
+
continue;
|
|
36611
|
+
rules.push({
|
|
36612
|
+
title: await readRuleTitle(entry.from),
|
|
36613
|
+
relativePath: path17.relative(rootDir, entry.to)
|
|
36489
36614
|
});
|
|
36490
36615
|
}
|
|
36491
|
-
|
|
36492
|
-
|
|
36493
|
-
|
|
36494
|
-
|
|
36495
|
-
|
|
36496
|
-
|
|
36497
|
-
|
|
36616
|
+
if (await pathExistsOrSymlink(path17.join(rootDir, ".agents", "rules"))) {
|
|
36617
|
+
rules.push(...await collectRuleIndexEntries(path17.join(rootDir, ".agents", "rules"), rootDir));
|
|
36618
|
+
}
|
|
36619
|
+
const byPath = new Map;
|
|
36620
|
+
for (const rule of rules) {
|
|
36621
|
+
byPath.set(rule.relativePath, rule);
|
|
36622
|
+
}
|
|
36623
|
+
return [...byPath.values()].sort((a, b3) => a.relativePath.localeCompare(b3.relativePath));
|
|
36624
|
+
}
|
|
36625
|
+
async function unifyAgentsConfiguration(options = {}) {
|
|
36626
|
+
const scope = options.scope ?? "global";
|
|
36627
|
+
const dryRun = Boolean(options.dryRun);
|
|
36628
|
+
const folders = resolveFolders(options);
|
|
36629
|
+
const includeCodex = scope !== "repository";
|
|
36630
|
+
const instructionCandidates = getInstructionFileCandidates(options, includeCodex);
|
|
36631
|
+
const candidates = scope === "repository" ? getRepositoryContainerCandidates(options) : getContainerCandidates(options);
|
|
36632
|
+
const result = {
|
|
36633
|
+
rootDir: folders.rootDir,
|
|
36634
|
+
agentsDir: folders.agentsDir,
|
|
36635
|
+
scope,
|
|
36636
|
+
backupPath: null,
|
|
36637
|
+
imported: [],
|
|
36638
|
+
duplicates: [],
|
|
36639
|
+
renamed: [],
|
|
36640
|
+
linked: [],
|
|
36641
|
+
alreadyLinked: [],
|
|
36642
|
+
skipped: [],
|
|
36643
|
+
instructionIndex: null
|
|
36644
|
+
};
|
|
36645
|
+
const destinationByCategory = {
|
|
36646
|
+
skills: path17.join(folders.agentsDir, "skills"),
|
|
36647
|
+
agents: path17.join(folders.agentsDir, "agents"),
|
|
36648
|
+
instructions: path17.join(folders.agentsDir, "AGENTS.md"),
|
|
36649
|
+
rules: path17.join(folders.agentsDir, "rules")
|
|
36650
|
+
};
|
|
36651
|
+
await importInstructionFiles(instructionCandidates, destinationByCategory.instructions, result, dryRun);
|
|
36652
|
+
const categories = scope === "repository" ? ["skills", "agents", "rules"] : ["skills", "agents"];
|
|
36653
|
+
const activeCategories = new Set;
|
|
36654
|
+
for (const category of categories) {
|
|
36655
|
+
const isActive = await importCategoryEntries(category, candidates, destinationByCategory[category], result, dryRun);
|
|
36656
|
+
if (isActive) {
|
|
36657
|
+
activeCategories.add(category);
|
|
36498
36658
|
}
|
|
36499
|
-
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
36500
36659
|
}
|
|
36501
|
-
|
|
36502
|
-
|
|
36503
|
-
|
|
36660
|
+
for (const candidate of candidates) {
|
|
36661
|
+
if (!activeCategories.has(candidate.category))
|
|
36662
|
+
continue;
|
|
36663
|
+
await linkContainer(candidate, destinationByCategory[candidate.category], result, dryRun);
|
|
36504
36664
|
}
|
|
36505
|
-
|
|
36506
|
-
|
|
36507
|
-
`).length - 1;
|
|
36508
|
-
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
36665
|
+
for (const candidate of instructionCandidates) {
|
|
36666
|
+
await linkInstructionFile(candidate, destinationByCategory.instructions, result, dryRun);
|
|
36509
36667
|
}
|
|
36510
|
-
|
|
36511
|
-
|
|
36512
|
-
if (u !== this._prevFrame) {
|
|
36513
|
-
if (this.state === "initial")
|
|
36514
|
-
this.output.write(import_sisteransi.cursor.hide);
|
|
36515
|
-
else {
|
|
36516
|
-
const t = BD(this._prevFrame, u);
|
|
36517
|
-
if (this.restoreCursor(), t && t?.length === 1) {
|
|
36518
|
-
const F = t[0];
|
|
36519
|
-
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
36520
|
-
const s = u.split(`
|
|
36521
|
-
`);
|
|
36522
|
-
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
36523
|
-
return;
|
|
36524
|
-
}
|
|
36525
|
-
if (t && t?.length > 1) {
|
|
36526
|
-
const F = t[0];
|
|
36527
|
-
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
36528
|
-
const s = u.split(`
|
|
36529
|
-
`).slice(F);
|
|
36530
|
-
this.output.write(s.join(`
|
|
36531
|
-
`)), this._prevFrame = u;
|
|
36532
|
-
return;
|
|
36533
|
-
}
|
|
36534
|
-
this.output.write(import_sisteransi.erase.down());
|
|
36535
|
-
}
|
|
36536
|
-
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
36537
|
-
}
|
|
36668
|
+
if (scope === "repository") {
|
|
36669
|
+
await writeRepositoryInstructionIndex(result, folders, dryRun);
|
|
36538
36670
|
}
|
|
36671
|
+
return result;
|
|
36672
|
+
}
|
|
36673
|
+
async function previewAgentsConfiguration(options = {}) {
|
|
36674
|
+
return unifyAgentsConfiguration({ ...options, dryRun: true });
|
|
36539
36675
|
}
|
|
36540
36676
|
|
|
36541
|
-
|
|
36542
|
-
|
|
36543
|
-
|
|
36544
|
-
|
|
36545
|
-
|
|
36546
|
-
|
|
36677
|
+
// src/commands/agents-unify.ts
|
|
36678
|
+
function countByCategory(result, key, category) {
|
|
36679
|
+
return result[key].filter((entry) => entry.category === category).length;
|
|
36680
|
+
}
|
|
36681
|
+
function printCategorySummary(result, category) {
|
|
36682
|
+
const imported = countByCategory(result, "imported", category);
|
|
36683
|
+
const duplicates = countByCategory(result, "duplicates", category);
|
|
36684
|
+
const renamed = countByCategory(result, "renamed", category);
|
|
36685
|
+
const linked = countByCategory(result, "linked", category);
|
|
36686
|
+
const alreadyLinked = countByCategory(result, "alreadyLinked", category);
|
|
36687
|
+
console.log(source_default.gray(` ${category}: ${imported} imported, ${duplicates} duplicates skipped, ${renamed} renamed, ${linked} linked, ${alreadyLinked} already linked`));
|
|
36688
|
+
}
|
|
36689
|
+
function printPreviewList(title, entries) {
|
|
36690
|
+
if (entries.length === 0)
|
|
36691
|
+
return;
|
|
36692
|
+
console.log(source_default.gray(`
|
|
36693
|
+
${title}:`));
|
|
36694
|
+
for (const entry of entries.slice(0, 12)) {
|
|
36695
|
+
console.log(source_default.gray(` - ${entry}`));
|
|
36547
36696
|
}
|
|
36548
|
-
|
|
36549
|
-
|
|
36550
|
-
this.value = this._value;
|
|
36551
|
-
}), this.on("confirm", (t) => {
|
|
36552
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
36553
|
-
}), this.on("cursor", () => {
|
|
36554
|
-
this.value = !this.value;
|
|
36555
|
-
});
|
|
36697
|
+
if (entries.length > 12) {
|
|
36698
|
+
console.log(source_default.gray(` ...and ${entries.length - 12} more`));
|
|
36556
36699
|
}
|
|
36557
36700
|
}
|
|
36558
|
-
|
|
36559
|
-
|
|
36560
|
-
|
|
36561
|
-
|
|
36562
|
-
|
|
36563
|
-
|
|
36564
|
-
|
|
36565
|
-
|
|
36566
|
-
|
|
36567
|
-
|
|
36568
|
-
|
|
36569
|
-
|
|
36570
|
-
|
|
36571
|
-
|
|
36572
|
-
|
|
36573
|
-
|
|
36574
|
-
|
|
36575
|
-
|
|
36576
|
-
|
|
36577
|
-
|
|
36578
|
-
|
|
36579
|
-
|
|
36580
|
-
|
|
36581
|
-
|
|
36582
|
-
|
|
36583
|
-
get _value() {
|
|
36584
|
-
return this.options[this.cursor].value;
|
|
36701
|
+
function printAgentsUnifyPreview(result) {
|
|
36702
|
+
console.log(source_default.yellow(`
|
|
36703
|
+
Planned changes`));
|
|
36704
|
+
console.log(source_default.gray(` Root: ${result.rootDir}`));
|
|
36705
|
+
console.log(source_default.gray(` Shared folder: ${result.agentsDir}`));
|
|
36706
|
+
console.log(source_default.gray(` Imports: ${result.imported.length}`));
|
|
36707
|
+
console.log(source_default.gray(` Renames: ${result.renamed.length}`));
|
|
36708
|
+
console.log(source_default.gray(` Symlinks/relinks: ${result.linked.length}`));
|
|
36709
|
+
console.log(source_default.gray(` Already linked: ${result.alreadyLinked.length}`));
|
|
36710
|
+
console.log(source_default.gray(` Duplicates skipped: ${result.duplicates.length}`));
|
|
36711
|
+
if (result.backupPath) {
|
|
36712
|
+
console.log(source_default.gray(` Backups: ${result.backupPath}`));
|
|
36713
|
+
}
|
|
36714
|
+
if (result.instructionIndex) {
|
|
36715
|
+
console.log(source_default.gray(` AGENTS.md rules index: ${result.instructionIndex.indexedRules.length} rules`));
|
|
36716
|
+
console.log(source_default.gray(` CLAUDE.md symlink target: ${result.instructionIndex.agentsPath}`));
|
|
36717
|
+
}
|
|
36718
|
+
printPreviewList("Files/folders to import", result.imported.map((entry) => `${entry.from} -> ${entry.to}`));
|
|
36719
|
+
printPreviewList("Name conflicts to preserve", result.renamed.map((entry) => `${entry.from} -> ${entry.to} (${entry.reason})`));
|
|
36720
|
+
printPreviewList("Symlinks/relinks to create", result.linked.map((entry) => entry.movedToBackup ? `${entry.from} -> ${entry.to} (backup: ${entry.movedToBackup})` : `${entry.from} -> ${entry.to}`));
|
|
36721
|
+
printPreviewList("Skipped duplicates", result.duplicates.map((entry) => `${entry.from} (kept: ${entry.keptAs})`));
|
|
36722
|
+
}
|
|
36723
|
+
async function confirmUnify() {
|
|
36724
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
36725
|
+
return true;
|
|
36585
36726
|
}
|
|
36586
|
-
|
|
36587
|
-
|
|
36588
|
-
|
|
36727
|
+
const answer = await ye({
|
|
36728
|
+
message: "Continue with these unify changes?",
|
|
36729
|
+
initialValue: false
|
|
36730
|
+
});
|
|
36731
|
+
if (pD(answer)) {
|
|
36732
|
+
return false;
|
|
36589
36733
|
}
|
|
36590
|
-
|
|
36591
|
-
|
|
36592
|
-
|
|
36734
|
+
return Boolean(answer);
|
|
36735
|
+
}
|
|
36736
|
+
async function agentsUnifyCommand(params = {}) {
|
|
36737
|
+
try {
|
|
36738
|
+
console.log(source_default.blue.bold(`
|
|
36739
|
+
AIBlueprint agents unify ${source_default.gray(`v${getVersion()}`)}
|
|
36740
|
+
`));
|
|
36741
|
+
console.log(source_default.gray(`Scope: ${params.scope ?? "global"}`));
|
|
36742
|
+
console.log(source_default.gray(params.scope === "repository" ? "Centralizing project agent configuration into .agents" : "Centralizing reusable agent configuration into .agents, then rendering Codex agents"));
|
|
36743
|
+
const preview = await previewAgentsConfiguration(params);
|
|
36744
|
+
printAgentsUnifyPreview(preview);
|
|
36745
|
+
if (!await confirmUnify()) {
|
|
36746
|
+
console.log(source_default.gray(`
|
|
36747
|
+
Unify cancelled`));
|
|
36748
|
+
return;
|
|
36749
|
+
}
|
|
36750
|
+
const result = await unifyAgentsConfiguration(params);
|
|
36751
|
+
const codexResult = params.scope === "repository" ? null : await renderCodexAgentsFromMarkdown(params);
|
|
36752
|
+
console.log(source_default.green(`
|
|
36753
|
+
Unify complete`));
|
|
36754
|
+
console.log(source_default.gray(` Shared folder: ${result.agentsDir}`));
|
|
36755
|
+
printCategorySummary(result, "instructions");
|
|
36756
|
+
printCategorySummary(result, "skills");
|
|
36757
|
+
printCategorySummary(result, "agents");
|
|
36758
|
+
if (result.scope === "repository") {
|
|
36759
|
+
printCategorySummary(result, "rules");
|
|
36760
|
+
}
|
|
36761
|
+
if (codexResult) {
|
|
36762
|
+
console.log(source_default.gray(` codex agents: ${codexResult.rendered.length} rendered, ${codexResult.skipped.length} skipped`));
|
|
36763
|
+
}
|
|
36764
|
+
if (result.instructionIndex) {
|
|
36765
|
+
console.log(source_default.gray(` rules index: ${result.instructionIndex.indexedRules.length} rules indexed in ${result.instructionIndex.agentsPath}`));
|
|
36766
|
+
console.log(source_default.gray(` Claude instructions: ${result.instructionIndex.claudePath}`));
|
|
36767
|
+
}
|
|
36768
|
+
if (result.backupPath) {
|
|
36769
|
+
console.log(source_default.gray(` Source backups: ${result.backupPath}`));
|
|
36770
|
+
}
|
|
36771
|
+
if (result.skipped.length > 0) {
|
|
36772
|
+
console.log(source_default.yellow(`
|
|
36773
|
+
Skipped paths:`));
|
|
36774
|
+
for (const skipped of result.skipped) {
|
|
36775
|
+
console.log(source_default.yellow(` ${skipped.path}: ${skipped.reason}`));
|
|
36776
|
+
}
|
|
36777
|
+
}
|
|
36778
|
+
} catch (error) {
|
|
36779
|
+
console.error(source_default.red(`
|
|
36780
|
+
Agents unify failed:`), error);
|
|
36781
|
+
process.exit(1);
|
|
36593
36782
|
}
|
|
36594
|
-
}
|
|
36595
|
-
var OD = Object.defineProperty;
|
|
36596
|
-
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
36597
|
-
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
36783
|
+
}
|
|
36598
36784
|
|
|
36599
|
-
|
|
36600
|
-
|
|
36601
|
-
|
|
36602
|
-
|
|
36603
|
-
|
|
36604
|
-
|
|
36605
|
-
|
|
36606
|
-
|
|
36607
|
-
|
|
36608
|
-
|
|
36609
|
-
|
|
36610
|
-
|
|
36785
|
+
// src/commands/codex-agents.ts
|
|
36786
|
+
async function codexAgentsCommand(options = {}) {
|
|
36787
|
+
try {
|
|
36788
|
+
console.log(source_default.blue.bold(`
|
|
36789
|
+
AIBlueprint Codex agents ${source_default.gray(`v${getVersion()}`)}
|
|
36790
|
+
`));
|
|
36791
|
+
console.log(source_default.gray("Rendering shared Markdown agents into Codex TOML custom agents"));
|
|
36792
|
+
const result = await renderCodexAgentsFromMarkdown(options);
|
|
36793
|
+
console.log(source_default.green(`
|
|
36794
|
+
Codex agents rendered`));
|
|
36795
|
+
console.log(source_default.gray(` Source: ${result.sourceDir}`));
|
|
36796
|
+
console.log(source_default.gray(` Target: ${result.targetDir}`));
|
|
36797
|
+
console.log(source_default.gray(` Rendered: ${result.rendered.length}`));
|
|
36798
|
+
console.log(source_default.gray(` Skipped: ${result.skipped.length}`));
|
|
36799
|
+
if (result.skipped.length > 0) {
|
|
36800
|
+
console.log(source_default.yellow(`
|
|
36801
|
+
Skipped agents:`));
|
|
36802
|
+
for (const skipped of result.skipped) {
|
|
36803
|
+
console.log(source_default.yellow(` ${skipped.source}: ${skipped.reason}`));
|
|
36611
36804
|
}
|
|
36612
|
-
|
|
36613
|
-
|
|
36614
|
-
|
|
36615
|
-
|
|
36616
|
-
|
|
36805
|
+
}
|
|
36806
|
+
} catch (error) {
|
|
36807
|
+
console.error(source_default.red(`
|
|
36808
|
+
Codex agents render failed:`), error);
|
|
36809
|
+
process.exit(1);
|
|
36617
36810
|
}
|
|
36618
|
-
|
|
36619
|
-
|
|
36811
|
+
}
|
|
36812
|
+
|
|
36813
|
+
// src/lib/session-unifier.ts
|
|
36814
|
+
var import_fs_extra14 = __toESM(require_lib4(), 1);
|
|
36815
|
+
import crypto2 from "crypto";
|
|
36816
|
+
import os15 from "os";
|
|
36817
|
+
import path18 from "path";
|
|
36818
|
+
var MANAGED_FOLDERS2 = [".claude", ".codex", ".agents"];
|
|
36819
|
+
var SESSION_PATHS = {
|
|
36820
|
+
".claude": ["projects", "sessions"],
|
|
36821
|
+
".codex": ["sessions", "archived_sessions", "browser/sessions"],
|
|
36822
|
+
".agents": ["sessions"]
|
|
36823
|
+
};
|
|
36824
|
+
async function listSnapshotSources(parentDir, type) {
|
|
36825
|
+
if (!await import_fs_extra14.default.pathExists(parentDir))
|
|
36826
|
+
return [];
|
|
36827
|
+
const entries = await import_fs_extra14.default.readdir(parentDir, { withFileTypes: true });
|
|
36828
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => ({
|
|
36829
|
+
name: entry.name,
|
|
36830
|
+
path: path18.join(parentDir, entry.name),
|
|
36831
|
+
type
|
|
36832
|
+
}));
|
|
36833
|
+
}
|
|
36834
|
+
async function collectSnapshotSources(folders) {
|
|
36835
|
+
const storePaths = getConfigStorePaths(folders.rootDir);
|
|
36836
|
+
const sources = [
|
|
36837
|
+
...await listSnapshotSources(storePaths.configsDir, "config"),
|
|
36838
|
+
...await listSnapshotSources(storePaths.backupsDir, "backup")
|
|
36839
|
+
];
|
|
36840
|
+
if (path18.resolve(folders.rootDir) === os15.homedir()) {
|
|
36841
|
+
sources.push(...await listSnapshotSources(getBackupDir(), "legacy-backup"));
|
|
36620
36842
|
}
|
|
36843
|
+
return sources.sort((a, b3) => a.name.localeCompare(b3.name));
|
|
36621
36844
|
}
|
|
36622
|
-
|
|
36623
|
-
|
|
36624
|
-
|
|
36625
|
-
|
|
36626
|
-
|
|
36627
|
-
|
|
36628
|
-
|
|
36629
|
-
|
|
36845
|
+
async function snapshotFolderPath(snapshot, folder) {
|
|
36846
|
+
const managedPath = path18.join(snapshot.path, folder);
|
|
36847
|
+
if (await import_fs_extra14.default.pathExists(managedPath))
|
|
36848
|
+
return managedPath;
|
|
36849
|
+
if (snapshot.type === "legacy-backup") {
|
|
36850
|
+
if (folder === ".claude")
|
|
36851
|
+
return snapshot.path;
|
|
36852
|
+
const legacyAgentsPath = path18.join(snapshot.path, ".agents");
|
|
36853
|
+
if (folder === ".agents" && await import_fs_extra14.default.pathExists(legacyAgentsPath)) {
|
|
36854
|
+
return legacyAgentsPath;
|
|
36855
|
+
}
|
|
36630
36856
|
}
|
|
36631
|
-
|
|
36632
|
-
|
|
36857
|
+
return null;
|
|
36858
|
+
}
|
|
36859
|
+
function sanitizeSourceTag(snapshot) {
|
|
36860
|
+
return `${snapshot.type}-${snapshot.name}`.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "snapshot";
|
|
36861
|
+
}
|
|
36862
|
+
function withSourceSuffix(targetPath, sourceTag, index) {
|
|
36863
|
+
const parsed = path18.parse(targetPath);
|
|
36864
|
+
const suffix = index === 1 ? sourceTag : `${sourceTag}-${index}`;
|
|
36865
|
+
if (parsed.ext && parsed.name) {
|
|
36866
|
+
return path18.join(parsed.dir, `${parsed.name}--${suffix}${parsed.ext}`);
|
|
36633
36867
|
}
|
|
36634
|
-
|
|
36635
|
-
|
|
36636
|
-
|
|
36637
|
-
|
|
36868
|
+
return path18.join(parsed.dir, `${parsed.base}--${suffix}`);
|
|
36869
|
+
}
|
|
36870
|
+
async function uniqueConflictPath(targetPath, sourceTag) {
|
|
36871
|
+
let index = 1;
|
|
36872
|
+
while (true) {
|
|
36873
|
+
const candidate = withSourceSuffix(targetPath, sourceTag, index);
|
|
36874
|
+
if (!await import_fs_extra14.default.pathExists(candidate))
|
|
36875
|
+
return candidate;
|
|
36876
|
+
index++;
|
|
36638
36877
|
}
|
|
36639
36878
|
}
|
|
36640
|
-
|
|
36641
|
-
|
|
36642
|
-
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
36643
|
-
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
36644
|
-
import y2 from "node:process";
|
|
36645
|
-
function ce() {
|
|
36646
|
-
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
36879
|
+
function hashString2(value) {
|
|
36880
|
+
return crypto2.createHash("sha256").update(value).digest("hex");
|
|
36647
36881
|
}
|
|
36648
|
-
|
|
36649
|
-
|
|
36650
|
-
|
|
36651
|
-
|
|
36652
|
-
var W2 = u("▲", "x");
|
|
36653
|
-
var C = u("◇", "o");
|
|
36654
|
-
var ue = u("┌", "T");
|
|
36655
|
-
var o = u("│", "|");
|
|
36656
|
-
var d2 = u("└", "—");
|
|
36657
|
-
var k2 = u("●", ">");
|
|
36658
|
-
var P2 = u("○", " ");
|
|
36659
|
-
var A2 = u("◻", "[•]");
|
|
36660
|
-
var T = u("◼", "[+]");
|
|
36661
|
-
var F = u("◻", "[ ]");
|
|
36662
|
-
var $e = u("▪", "•");
|
|
36663
|
-
var _3 = u("─", "-");
|
|
36664
|
-
var me = u("╮", "+");
|
|
36665
|
-
var de = u("├", "+");
|
|
36666
|
-
var pe = u("╯", "+");
|
|
36667
|
-
var q = u("●", "•");
|
|
36668
|
-
var D = u("◆", "*");
|
|
36669
|
-
var U = u("▲", "!");
|
|
36670
|
-
var K2 = u("■", "x");
|
|
36671
|
-
var b2 = (t) => {
|
|
36672
|
-
switch (t) {
|
|
36673
|
-
case "initial":
|
|
36674
|
-
case "active":
|
|
36675
|
-
return import_picocolors2.default.cyan(le);
|
|
36676
|
-
case "cancel":
|
|
36677
|
-
return import_picocolors2.default.red(L2);
|
|
36678
|
-
case "error":
|
|
36679
|
-
return import_picocolors2.default.yellow(W2);
|
|
36680
|
-
case "submit":
|
|
36681
|
-
return import_picocolors2.default.green(C);
|
|
36882
|
+
async function hashPath2(targetPath) {
|
|
36883
|
+
const stat = await import_fs_extra14.default.lstat(targetPath);
|
|
36884
|
+
if (stat.isSymbolicLink()) {
|
|
36885
|
+
return hashString2(`symlink:${await import_fs_extra14.default.readlink(targetPath)}`);
|
|
36682
36886
|
}
|
|
36683
|
-
|
|
36684
|
-
|
|
36685
|
-
|
|
36686
|
-
|
|
36687
|
-
|
|
36688
|
-
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
36689
|
-
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
36690
|
-
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
36691
|
-
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
36692
|
-
});
|
|
36693
|
-
};
|
|
36694
|
-
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
36695
|
-
const n = `${import_picocolors2.default.gray(o)}
|
|
36696
|
-
${b2(this.state)} ${t.message}
|
|
36697
|
-
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
36698
|
-
switch (this.state) {
|
|
36699
|
-
case "error":
|
|
36700
|
-
return `${n.trim()}
|
|
36701
|
-
${import_picocolors2.default.yellow(o)} ${i}
|
|
36702
|
-
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
36703
|
-
`;
|
|
36704
|
-
case "submit":
|
|
36705
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
36706
|
-
case "cancel":
|
|
36707
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
36708
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
36709
|
-
default:
|
|
36710
|
-
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
36711
|
-
${import_picocolors2.default.cyan(d2)}
|
|
36712
|
-
`;
|
|
36887
|
+
if (stat.isFile()) {
|
|
36888
|
+
const hash = crypto2.createHash("sha256");
|
|
36889
|
+
hash.update("file:");
|
|
36890
|
+
hash.update(await import_fs_extra14.default.readFile(targetPath));
|
|
36891
|
+
return hash.digest("hex");
|
|
36713
36892
|
}
|
|
36714
|
-
|
|
36715
|
-
|
|
36716
|
-
|
|
36717
|
-
|
|
36718
|
-
const
|
|
36719
|
-
|
|
36720
|
-
|
|
36721
|
-
|
|
36722
|
-
|
|
36723
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
36724
|
-
case "cancel":
|
|
36725
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
36726
|
-
${import_picocolors2.default.gray(o)}`;
|
|
36727
|
-
default:
|
|
36728
|
-
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
36729
|
-
${import_picocolors2.default.cyan(d2)}
|
|
36730
|
-
`;
|
|
36893
|
+
if (stat.isDirectory()) {
|
|
36894
|
+
const entries = (await import_fs_extra14.default.readdir(targetPath, { withFileTypes: true })).sort((a, b3) => a.name.localeCompare(b3.name));
|
|
36895
|
+
const hash = crypto2.createHash("sha256");
|
|
36896
|
+
hash.update("dir:");
|
|
36897
|
+
for (const entry of entries) {
|
|
36898
|
+
hash.update(entry.name);
|
|
36899
|
+
hash.update("\x00");
|
|
36900
|
+
hash.update(await hashPath2(path18.join(targetPath, entry.name)));
|
|
36901
|
+
hash.update("\x00");
|
|
36731
36902
|
}
|
|
36732
|
-
|
|
36733
|
-
}
|
|
36734
|
-
|
|
36735
|
-
|
|
36736
|
-
|
|
36737
|
-
|
|
36738
|
-
|
|
36739
|
-
|
|
36740
|
-
|
|
36741
|
-
|
|
36742
|
-
|
|
36743
|
-
|
|
36744
|
-
|
|
36745
|
-
|
|
36903
|
+
return hash.digest("hex");
|
|
36904
|
+
}
|
|
36905
|
+
return hashString2(`other:${stat.mode}:${stat.size}`);
|
|
36906
|
+
}
|
|
36907
|
+
async function mergeSessionPath(params) {
|
|
36908
|
+
const {
|
|
36909
|
+
sourcePath,
|
|
36910
|
+
destinationPath,
|
|
36911
|
+
folder,
|
|
36912
|
+
sessionRoot,
|
|
36913
|
+
snapshot,
|
|
36914
|
+
sourceTag,
|
|
36915
|
+
result,
|
|
36916
|
+
dryRun
|
|
36917
|
+
} = params;
|
|
36918
|
+
const sourceStat = await import_fs_extra14.default.lstat(sourcePath).catch(() => null);
|
|
36919
|
+
if (!sourceStat)
|
|
36920
|
+
return;
|
|
36921
|
+
const destinationStat = await import_fs_extra14.default.lstat(destinationPath).catch(() => null);
|
|
36922
|
+
if (sourceStat.isDirectory() && (destinationStat?.isDirectory() || dryRun)) {
|
|
36923
|
+
const entries = await import_fs_extra14.default.readdir(sourcePath);
|
|
36924
|
+
if (!dryRun && destinationStat?.isDirectory()) {
|
|
36925
|
+
await import_fs_extra14.default.ensureDir(destinationPath);
|
|
36926
|
+
}
|
|
36927
|
+
for (const entry of entries) {
|
|
36928
|
+
await mergeSessionPath({
|
|
36929
|
+
sourcePath: path18.join(sourcePath, entry),
|
|
36930
|
+
destinationPath: path18.join(destinationPath, entry),
|
|
36931
|
+
folder,
|
|
36932
|
+
sessionRoot,
|
|
36933
|
+
snapshot,
|
|
36934
|
+
sourceTag,
|
|
36935
|
+
result,
|
|
36936
|
+
dryRun
|
|
36937
|
+
});
|
|
36938
|
+
}
|
|
36939
|
+
return;
|
|
36940
|
+
}
|
|
36941
|
+
if (!destinationStat) {
|
|
36942
|
+
if (!dryRun) {
|
|
36943
|
+
await import_fs_extra14.default.ensureDir(path18.dirname(destinationPath));
|
|
36944
|
+
await import_fs_extra14.default.copy(sourcePath, destinationPath, {
|
|
36945
|
+
overwrite: false,
|
|
36946
|
+
dereference: false
|
|
36947
|
+
});
|
|
36746
36948
|
}
|
|
36949
|
+
result.imported.push({
|
|
36950
|
+
folder,
|
|
36951
|
+
sessionRoot,
|
|
36952
|
+
from: sourcePath,
|
|
36953
|
+
to: destinationPath,
|
|
36954
|
+
snapshot: snapshot.name
|
|
36955
|
+
});
|
|
36956
|
+
return;
|
|
36957
|
+
}
|
|
36958
|
+
if (await hashPath2(sourcePath) === await hashPath2(destinationPath)) {
|
|
36959
|
+
result.duplicates.push({
|
|
36960
|
+
folder,
|
|
36961
|
+
sessionRoot,
|
|
36962
|
+
from: sourcePath,
|
|
36963
|
+
existing: destinationPath,
|
|
36964
|
+
snapshot: snapshot.name
|
|
36965
|
+
});
|
|
36966
|
+
return;
|
|
36967
|
+
}
|
|
36968
|
+
const conflictPath = await uniqueConflictPath(destinationPath, sourceTag);
|
|
36969
|
+
if (!dryRun) {
|
|
36970
|
+
await import_fs_extra14.default.ensureDir(path18.dirname(conflictPath));
|
|
36971
|
+
await import_fs_extra14.default.copy(sourcePath, conflictPath, {
|
|
36972
|
+
overwrite: false,
|
|
36973
|
+
dereference: false
|
|
36974
|
+
});
|
|
36975
|
+
}
|
|
36976
|
+
result.conflicts.push({
|
|
36977
|
+
folder,
|
|
36978
|
+
sessionRoot,
|
|
36979
|
+
from: sourcePath,
|
|
36980
|
+
to: conflictPath,
|
|
36981
|
+
snapshot: snapshot.name,
|
|
36982
|
+
reason: "Same session path with different content"
|
|
36983
|
+
});
|
|
36984
|
+
}
|
|
36985
|
+
async function unifySessionsFromSnapshots(options = {}) {
|
|
36986
|
+
const folders = resolveFolders(options);
|
|
36987
|
+
const dryRun = Boolean(options.dryRun);
|
|
36988
|
+
const snapshots = await collectSnapshotSources(folders);
|
|
36989
|
+
const destinationByFolder = {
|
|
36990
|
+
".claude": folders.claudeDir,
|
|
36991
|
+
".codex": folders.codexDir,
|
|
36992
|
+
".agents": folders.agentsDir
|
|
36747
36993
|
};
|
|
36748
|
-
|
|
36749
|
-
|
|
36750
|
-
|
|
36751
|
-
|
|
36752
|
-
|
|
36753
|
-
|
|
36754
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
36755
|
-
case "cancel":
|
|
36756
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
36757
|
-
${import_picocolors2.default.gray(o)}`;
|
|
36758
|
-
default:
|
|
36759
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
36760
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
36761
|
-
${import_picocolors2.default.cyan(d2)}
|
|
36762
|
-
`;
|
|
36763
|
-
}
|
|
36764
|
-
} }).prompt();
|
|
36765
|
-
};
|
|
36766
|
-
var fe = (t) => {
|
|
36767
|
-
const n = (r2, i) => {
|
|
36768
|
-
const s = r2.label ?? String(r2.value);
|
|
36769
|
-
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
36994
|
+
const result = {
|
|
36995
|
+
rootDir: folders.rootDir,
|
|
36996
|
+
scannedSnapshots: snapshots,
|
|
36997
|
+
imported: [],
|
|
36998
|
+
duplicates: [],
|
|
36999
|
+
conflicts: []
|
|
36770
37000
|
};
|
|
36771
|
-
|
|
36772
|
-
|
|
36773
|
-
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
const s = this.error.split(`
|
|
36792
|
-
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
36793
|
-
`);
|
|
36794
|
-
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
36795
|
-
${import_picocolors2.default.yellow(o)} `)}
|
|
36796
|
-
${s}
|
|
36797
|
-
`;
|
|
37001
|
+
for (const snapshot of snapshots) {
|
|
37002
|
+
const sourceTag = sanitizeSourceTag(snapshot);
|
|
37003
|
+
for (const folder of MANAGED_FOLDERS2) {
|
|
37004
|
+
const sourceFolder = await snapshotFolderPath(snapshot, folder);
|
|
37005
|
+
if (!sourceFolder)
|
|
37006
|
+
continue;
|
|
37007
|
+
for (const sessionRoot of SESSION_PATHS[folder]) {
|
|
37008
|
+
const sourcePath = path18.join(sourceFolder, sessionRoot);
|
|
37009
|
+
if (!await import_fs_extra14.default.pathExists(sourcePath))
|
|
37010
|
+
continue;
|
|
37011
|
+
await mergeSessionPath({
|
|
37012
|
+
sourcePath,
|
|
37013
|
+
destinationPath: path18.join(destinationByFolder[folder], sessionRoot),
|
|
37014
|
+
folder,
|
|
37015
|
+
sessionRoot,
|
|
37016
|
+
snapshot,
|
|
37017
|
+
sourceTag,
|
|
37018
|
+
result,
|
|
37019
|
+
dryRun
|
|
37020
|
+
});
|
|
36798
37021
|
}
|
|
36799
|
-
default:
|
|
36800
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
36801
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
36802
|
-
${import_picocolors2.default.cyan(d2)}
|
|
36803
|
-
`;
|
|
36804
37022
|
}
|
|
36805
|
-
}
|
|
36806
|
-
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
|
|
36810
|
-
|
|
36811
|
-
};
|
|
36812
|
-
var Ie = (t = "") => {
|
|
36813
|
-
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
36814
|
-
`);
|
|
36815
|
-
};
|
|
36816
|
-
var Se = (t = "") => {
|
|
36817
|
-
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
36818
|
-
${import_picocolors2.default.gray(d2)} ${t}
|
|
37023
|
+
}
|
|
37024
|
+
return result;
|
|
37025
|
+
}
|
|
37026
|
+
async function previewSessionsFromSnapshots(options = {}) {
|
|
37027
|
+
return unifySessionsFromSnapshots({ ...options, dryRun: true });
|
|
37028
|
+
}
|
|
36819
37029
|
|
|
36820
|
-
|
|
36821
|
-
|
|
36822
|
-
|
|
36823
|
-
const
|
|
36824
|
-
|
|
36825
|
-
const [i, ...s] = t.split(`
|
|
36826
|
-
`);
|
|
36827
|
-
r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
37030
|
+
// src/commands/session-unify.ts
|
|
37031
|
+
function summarizeByFolder(entries) {
|
|
37032
|
+
const counts = new Map;
|
|
37033
|
+
for (const entry of entries) {
|
|
37034
|
+
counts.set(entry.folder, (counts.get(entry.folder) ?? 0) + 1);
|
|
36828
37035
|
}
|
|
36829
|
-
|
|
36830
|
-
|
|
36831
|
-
`);
|
|
36832
|
-
}
|
|
36833
|
-
|
|
36834
|
-
|
|
36835
|
-
|
|
36836
|
-
|
|
36837
|
-
|
|
36838
|
-
|
|
36839
|
-
|
|
36840
|
-
}
|
|
36841
|
-
|
|
36842
|
-
|
|
36843
|
-
|
|
36844
|
-
}
|
|
36845
|
-
|
|
36846
|
-
|
|
36847
|
-
|
|
36848
|
-
|
|
36849
|
-
|
|
36850
|
-
|
|
36851
|
-
|
|
36852
|
-
|
|
36853
|
-
|
|
36854
|
-
|
|
36855
|
-
|
|
36856
|
-
|
|
36857
|
-
|
|
37036
|
+
if (counts.size === 0)
|
|
37037
|
+
return "none";
|
|
37038
|
+
return [...counts.entries()].map(([folder, count]) => `${folder}: ${count}`).join(", ");
|
|
37039
|
+
}
|
|
37040
|
+
function printPreviewList2(title, entries) {
|
|
37041
|
+
if (entries.length === 0)
|
|
37042
|
+
return;
|
|
37043
|
+
console.log(source_default.gray(`
|
|
37044
|
+
${title}:`));
|
|
37045
|
+
for (const entry of entries.slice(0, 12)) {
|
|
37046
|
+
console.log(source_default.gray(` - ${entry}`));
|
|
37047
|
+
}
|
|
37048
|
+
if (entries.length > 12) {
|
|
37049
|
+
console.log(source_default.gray(` ...and ${entries.length - 12} more`));
|
|
37050
|
+
}
|
|
37051
|
+
}
|
|
37052
|
+
function printSessionUnifyPreview(result) {
|
|
37053
|
+
console.log(source_default.yellow(`
|
|
37054
|
+
Planned session changes`));
|
|
37055
|
+
console.log(source_default.gray(` Root: ${result.rootDir}`));
|
|
37056
|
+
console.log(source_default.gray(` Snapshots to scan: ${result.scannedSnapshots.length}`));
|
|
37057
|
+
console.log(source_default.gray(` Sessions to import: ${result.imported.length} (${summarizeByFolder(result.imported)})`));
|
|
37058
|
+
console.log(source_default.gray(` Duplicates to skip: ${result.duplicates.length}`));
|
|
37059
|
+
console.log(source_default.gray(` Conflicts to preserve: ${result.conflicts.length}`));
|
|
37060
|
+
printPreviewList2("Session files/folders to import", result.imported.map((entry) => `${entry.from} -> ${entry.to}`));
|
|
37061
|
+
printPreviewList2("Conflicting sessions to copy with source suffix", result.conflicts.map((entry) => `${entry.from} -> ${entry.to}`));
|
|
37062
|
+
}
|
|
37063
|
+
async function confirmUnify2() {
|
|
37064
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
37065
|
+
return true;
|
|
37066
|
+
}
|
|
37067
|
+
const answer = await ye({
|
|
37068
|
+
message: "Continue with these session unify changes?",
|
|
37069
|
+
initialValue: false
|
|
37070
|
+
});
|
|
37071
|
+
if (pD(answer)) {
|
|
37072
|
+
return false;
|
|
37073
|
+
}
|
|
37074
|
+
return Boolean(answer);
|
|
37075
|
+
}
|
|
37076
|
+
async function sessionsUnifyCommand(params = {}) {
|
|
37077
|
+
try {
|
|
37078
|
+
console.log(source_default.blue("Unifying saved sessions from configs and backups..."));
|
|
37079
|
+
const preview = await previewSessionsFromSnapshots(params);
|
|
37080
|
+
printSessionUnifyPreview(preview);
|
|
37081
|
+
if (!await confirmUnify2()) {
|
|
37082
|
+
console.log(source_default.gray(`
|
|
37083
|
+
Session unify cancelled`));
|
|
36858
37084
|
return;
|
|
36859
|
-
|
|
36860
|
-
|
|
36861
|
-
|
|
36862
|
-
`);
|
|
36863
|
-
|
|
36864
|
-
|
|
36865
|
-
|
|
36866
|
-
|
|
36867
|
-
|
|
36868
|
-
|
|
36869
|
-
|
|
36870
|
-
|
|
36871
|
-
j2(), c = setInterval(() => {
|
|
36872
|
-
if (i && l2 === $2)
|
|
36873
|
-
return;
|
|
36874
|
-
B2(), $2 = l2;
|
|
36875
|
-
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
36876
|
-
if (i)
|
|
36877
|
-
process.stdout.write(`${I2} ${l2}...`);
|
|
36878
|
-
else if (t === "timer")
|
|
36879
|
-
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
36880
|
-
else {
|
|
36881
|
-
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
36882
|
-
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
37085
|
+
}
|
|
37086
|
+
const result = await unifySessionsFromSnapshots(params);
|
|
37087
|
+
console.log(source_default.green("Session unify complete"));
|
|
37088
|
+
console.log(source_default.gray(` Snapshots scanned: ${result.scannedSnapshots.length}`));
|
|
37089
|
+
console.log(source_default.gray(` Imported: ${result.imported.length} (${summarizeByFolder(result.imported)})`));
|
|
37090
|
+
console.log(source_default.gray(` Duplicates skipped: ${result.duplicates.length}`));
|
|
37091
|
+
console.log(source_default.gray(` Conflicts preserved: ${result.conflicts.length}`));
|
|
37092
|
+
if (result.conflicts.length > 0) {
|
|
37093
|
+
console.log(source_default.yellow(`
|
|
37094
|
+
Conflicting session paths were copied with source suffixes:`));
|
|
37095
|
+
for (const conflict of result.conflicts.slice(0, 10)) {
|
|
37096
|
+
console.log(source_default.yellow(` ${conflict.to}`));
|
|
36883
37097
|
}
|
|
36884
|
-
|
|
36885
|
-
|
|
36886
|
-
|
|
36887
|
-
|
|
36888
|
-
|
|
36889
|
-
|
|
36890
|
-
|
|
36891
|
-
|
|
36892
|
-
|
|
36893
|
-
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
36894
|
-
l2 = R2(m2 ?? l2);
|
|
36895
|
-
} };
|
|
36896
|
-
};
|
|
37098
|
+
if (result.conflicts.length > 10) {
|
|
37099
|
+
console.log(source_default.yellow(` ...and ${result.conflicts.length - 10} more`));
|
|
37100
|
+
}
|
|
37101
|
+
}
|
|
37102
|
+
} catch (error) {
|
|
37103
|
+
console.error(source_default.red("Session unify failed:"), error);
|
|
37104
|
+
process.exit(1);
|
|
37105
|
+
}
|
|
37106
|
+
}
|
|
36897
37107
|
|
|
36898
37108
|
// src/commands/pro.ts
|
|
36899
37109
|
import path21 from "path";
|