@sunasteriskrnd/takumi 0.1.0 → 0.2.0
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 +39 -46
- package/bin/{takumi.js → tkm.js} +1 -1
- package/dist/index.js +1358 -971
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5,60 +5,39 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
function __accessProp(key) {
|
|
9
|
-
return this[key];
|
|
10
|
-
}
|
|
11
|
-
var __toESMCache_node;
|
|
12
|
-
var __toESMCache_esm;
|
|
13
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
-
var canCache = mod != null && typeof mod === "object";
|
|
15
|
-
if (canCache) {
|
|
16
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
-
var cached = cache.get(mod);
|
|
18
|
-
if (cached)
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
10
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
11
|
for (let key of __getOwnPropNames(mod))
|
|
24
12
|
if (!__hasOwnProp.call(to, key))
|
|
25
13
|
__defProp(to, key, {
|
|
26
|
-
get:
|
|
14
|
+
get: () => mod[key],
|
|
27
15
|
enumerable: true
|
|
28
16
|
});
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
17
|
return to;
|
|
32
18
|
};
|
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
33
20
|
var __toCommonJS = (from) => {
|
|
34
|
-
var entry =
|
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
|
35
22
|
if (entry)
|
|
36
23
|
return entry;
|
|
37
24
|
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
-
});
|
|
45
|
-
}
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
+
get: () => from[key],
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
}));
|
|
46
30
|
__moduleCache.set(from, entry);
|
|
47
31
|
return entry;
|
|
48
32
|
};
|
|
49
|
-
var __moduleCache;
|
|
50
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
51
|
-
var __returnValue = (v) => v;
|
|
52
|
-
function __exportSetter(name, newValue) {
|
|
53
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
54
|
-
}
|
|
55
34
|
var __export = (target, all) => {
|
|
56
35
|
for (var name in all)
|
|
57
36
|
__defProp(target, name, {
|
|
58
37
|
get: all[name],
|
|
59
38
|
enumerable: true,
|
|
60
39
|
configurable: true,
|
|
61
|
-
set:
|
|
40
|
+
set: (newValue) => all[name] = () => newValue
|
|
62
41
|
});
|
|
63
42
|
};
|
|
64
43
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -1995,9 +1974,9 @@ GFS4: `);
|
|
|
1995
1974
|
function readdir(path, options2, cb) {
|
|
1996
1975
|
if (typeof options2 === "function")
|
|
1997
1976
|
cb = options2, options2 = null;
|
|
1998
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$
|
|
1977
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path2, options3, cb2, startTime) {
|
|
1999
1978
|
return fs$readdir(path2, fs$readdirCallback(path2, options3, cb2, startTime));
|
|
2000
|
-
} : function go$
|
|
1979
|
+
} : function go$readdir(path2, options3, cb2, startTime) {
|
|
2001
1980
|
return fs$readdir(path2, options3, fs$readdirCallback(path2, options3, cb2, startTime));
|
|
2002
1981
|
};
|
|
2003
1982
|
return go$readdir(path, options2, cb);
|
|
@@ -2472,7 +2451,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
2472
2451
|
emitter.on(ev, cb);
|
|
2473
2452
|
return remove;
|
|
2474
2453
|
};
|
|
2475
|
-
unload = function
|
|
2454
|
+
unload = function unload() {
|
|
2476
2455
|
if (!loaded || !processOk(global.process)) {
|
|
2477
2456
|
return;
|
|
2478
2457
|
}
|
|
@@ -2487,7 +2466,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
2487
2466
|
emitter.count -= 1;
|
|
2488
2467
|
};
|
|
2489
2468
|
module.exports.unload = unload;
|
|
2490
|
-
emit = function
|
|
2469
|
+
emit = function emit(event, code, signal) {
|
|
2491
2470
|
if (emitter.emitted[event]) {
|
|
2492
2471
|
return;
|
|
2493
2472
|
}
|
|
@@ -2516,7 +2495,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
2516
2495
|
return signals;
|
|
2517
2496
|
};
|
|
2518
2497
|
loaded = false;
|
|
2519
|
-
load = function
|
|
2498
|
+
load = function load() {
|
|
2520
2499
|
if (loaded || !processOk(global.process)) {
|
|
2521
2500
|
return;
|
|
2522
2501
|
}
|
|
@@ -2535,7 +2514,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
2535
2514
|
};
|
|
2536
2515
|
module.exports.load = load;
|
|
2537
2516
|
originalProcessReallyExit = process2.reallyExit;
|
|
2538
|
-
processReallyExit = function
|
|
2517
|
+
processReallyExit = function processReallyExit(code) {
|
|
2539
2518
|
if (!processOk(global.process)) {
|
|
2540
2519
|
return;
|
|
2541
2520
|
}
|
|
@@ -2545,7 +2524,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
2545
2524
|
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
2546
2525
|
};
|
|
2547
2526
|
originalProcessEmit = process2.emit;
|
|
2548
|
-
processEmit = function
|
|
2527
|
+
processEmit = function processEmit(ev, arg) {
|
|
2549
2528
|
if (ev === "exit" && processOk(global.process)) {
|
|
2550
2529
|
if (arg !== undefined) {
|
|
2551
2530
|
process2.exitCode = arg;
|
|
@@ -11276,16 +11255,17 @@ var init_kit = __esm(() => {
|
|
|
11276
11255
|
"__pycache__/**",
|
|
11277
11256
|
"**/.venv/**",
|
|
11278
11257
|
"**/venv/**",
|
|
11279
|
-
"**/__pycache__/**"
|
|
11258
|
+
"**/__pycache__/**",
|
|
11259
|
+
"/CLAUDE.md",
|
|
11260
|
+
"/README.md",
|
|
11261
|
+
"/AGENTS.md"
|
|
11280
11262
|
];
|
|
11281
11263
|
USER_CONFIG_PATTERNS = [
|
|
11282
11264
|
".gitignore",
|
|
11283
11265
|
".repomixignore",
|
|
11284
11266
|
".mcp.json",
|
|
11285
11267
|
".skignore",
|
|
11286
|
-
".takumi.json"
|
|
11287
|
-
"CLAUDE.md",
|
|
11288
|
-
"AGENTS.md"
|
|
11268
|
+
".takumi.json"
|
|
11289
11269
|
];
|
|
11290
11270
|
PROTECTED_PATTERNS = [...NEVER_COPY_PATTERNS, ...USER_CONFIG_PATTERNS];
|
|
11291
11271
|
});
|
|
@@ -11722,7 +11702,7 @@ function normalizeTakumiConfigInput(value) {
|
|
|
11722
11702
|
}
|
|
11723
11703
|
return normalized;
|
|
11724
11704
|
}
|
|
11725
|
-
var PlanValidationModeSchema, PlanFocusAreaSchema, PlanResolutionOrderSchema, ProjectTypeSchema, PackageManagerSchema, FrameworkSchema, GEMINI_MODEL_VALUES, LEGACY_GEMINI_MODEL_ALIASES, GeminiModelSchema, StatuslineModeSchema, StatuslineSectionIdSchema, StatuslineSectionConfigSchema, StatuslineThemeSchema, StatuslineLayoutSchema, CodingLevelSchema, PlanResolutionSchema, PlanValidationSchema, SkPlanConfigSchema, SkDocsConfigSchema, SkPathsConfigSchema, SkLocaleConfigSchema, SkTrustConfigSchema, SkProjectConfigSchema, SkGeminiConfigSchema, SkSkillsConfigSchema, UpdatePipelineSchema, ResolvedModelConfigSchema, ModelTierMapSchema, SkModelTaxonomySchema, SkAssertionSchema, SkHooksConfigSchema, TakumiConfigSchema,
|
|
11705
|
+
var PlanValidationModeSchema, PlanFocusAreaSchema, PlanResolutionOrderSchema, ProjectTypeSchema, PackageManagerSchema, FrameworkSchema, GEMINI_MODEL_VALUES, LEGACY_GEMINI_MODEL_ALIASES, GeminiModelSchema, StatuslineModeSchema, StatuslineSectionIdSchema, StatuslineSectionConfigSchema, StatuslineThemeSchema, StatuslineLayoutSchema, CodingLevelSchema, PlanResolutionSchema, PlanValidationSchema, SkPlanConfigSchema, SkDocsConfigSchema, SkPathsConfigSchema, SkLocaleConfigSchema, SkTrustConfigSchema, SkProjectConfigSchema, SkGeminiConfigSchema, SkSkillsConfigSchema, UpdatePipelineSchema, ResolvedModelConfigSchema, ModelTierMapSchema, SkModelTaxonomySchema, SkAssertionSchema, SkHooksConfigSchema, TakumiConfigSchema, DEFAULT_TAKUMI_CONFIG, TAKUMI_HOOK_NAMES;
|
|
11726
11706
|
var init_takumi_config = __esm(() => {
|
|
11727
11707
|
init_zod();
|
|
11728
11708
|
PlanValidationModeSchema = exports_external.enum(["prompt", "auto", "strict", "none"]);
|
|
@@ -11909,7 +11889,7 @@ var init_takumi_config = __esm(() => {
|
|
|
11909
11889
|
updatePipeline: UpdatePipelineSchema.optional(),
|
|
11910
11890
|
modelTaxonomy: SkModelTaxonomySchema.optional()
|
|
11911
11891
|
}).passthrough();
|
|
11912
|
-
|
|
11892
|
+
DEFAULT_TAKUMI_CONFIG = {
|
|
11913
11893
|
codingLevel: -1,
|
|
11914
11894
|
statusline: "full",
|
|
11915
11895
|
statuslineColors: true,
|
|
@@ -11978,7 +11958,7 @@ var init_takumi_config = __esm(() => {
|
|
|
11978
11958
|
migrateProviders: "auto"
|
|
11979
11959
|
}
|
|
11980
11960
|
};
|
|
11981
|
-
|
|
11961
|
+
TAKUMI_HOOK_NAMES = [
|
|
11982
11962
|
"session-init",
|
|
11983
11963
|
"subagent-init",
|
|
11984
11964
|
"descriptive-name",
|
|
@@ -12050,6 +12030,7 @@ __export(exports_types, {
|
|
|
12050
12030
|
TakumiPackageMetadataSchema: () => TakumiPackageMetadataSchema,
|
|
12051
12031
|
TakumiError: () => TakumiError,
|
|
12052
12032
|
TakumiConfigSchema: () => TakumiConfigSchema,
|
|
12033
|
+
TAKUMI_HOOK_NAMES: () => TAKUMI_HOOK_NAMES,
|
|
12053
12034
|
StatuslineThemeSchema: () => StatuslineThemeSchema,
|
|
12054
12035
|
StatuslineSectionIdSchema: () => StatuslineSectionIdSchema,
|
|
12055
12036
|
StatuslineSectionConfigSchema: () => StatuslineSectionConfigSchema,
|
|
@@ -12069,7 +12050,6 @@ __export(exports_types, {
|
|
|
12069
12050
|
SkAssertionSchema: () => SkAssertionSchema,
|
|
12070
12051
|
ServicesListSchema: () => ServicesListSchema,
|
|
12071
12052
|
ServiceSchema: () => ServiceSchema,
|
|
12072
|
-
SK_HOOK_NAMES: () => SK_HOOK_NAMES,
|
|
12073
12053
|
SECTION_LABELS: () => SECTION_LABELS,
|
|
12074
12054
|
SECTION_DESCRIPTIONS: () => SECTION_DESCRIPTIONS,
|
|
12075
12055
|
ReviewwebOptionsSchema: () => ReviewwebOptionsSchema,
|
|
@@ -12105,8 +12085,8 @@ __export(exports_types, {
|
|
|
12105
12085
|
ExtractionError: () => ExtractionError,
|
|
12106
12086
|
ExcludePatternSchema: () => ExcludePatternSchema,
|
|
12107
12087
|
DownloadError: () => DownloadError,
|
|
12088
|
+
DEFAULT_TAKUMI_CONFIG: () => DEFAULT_TAKUMI_CONFIG,
|
|
12108
12089
|
DEFAULT_STATUSLINE_LINES: () => DEFAULT_STATUSLINE_LINES,
|
|
12109
|
-
DEFAULT_SK_CONFIG: () => DEFAULT_SK_CONFIG,
|
|
12110
12090
|
DEFAULT_SECTION_CONFIG: () => DEFAULT_SECTION_CONFIG,
|
|
12111
12091
|
DEFAULT_PROJECTS_REGISTRY: () => DEFAULT_PROJECTS_REGISTRY,
|
|
12112
12092
|
DEFAULT_KIT_LAYOUT: () => DEFAULT_KIT_LAYOUT,
|
|
@@ -14113,7 +14093,7 @@ class TakumiConfigManager {
|
|
|
14113
14093
|
const projectPath = projectDir ? TakumiConfigManager.getProjectConfigPath(projectDir) : null;
|
|
14114
14094
|
const globalConfig = await TakumiConfigManager.loadConfigFile(globalPath);
|
|
14115
14095
|
const projectConfig = projectPath ? await TakumiConfigManager.loadConfigFile(projectPath) : null;
|
|
14116
|
-
let merged = { ...
|
|
14096
|
+
let merged = { ...DEFAULT_TAKUMI_CONFIG };
|
|
14117
14097
|
if (globalConfig) {
|
|
14118
14098
|
merged = deepMerge(merged, globalConfig);
|
|
14119
14099
|
}
|
|
@@ -14259,7 +14239,7 @@ function getCliVersion2() {
|
|
|
14259
14239
|
function getCliUserAgent() {
|
|
14260
14240
|
return `${TAKUMI_CLI_NPM_PACKAGE_NAME}/${getCliVersion2()}`;
|
|
14261
14241
|
}
|
|
14262
|
-
var TAKUMI_CLI_NPM_PACKAGE_NAME = "@
|
|
14242
|
+
var TAKUMI_CLI_NPM_PACKAGE_NAME = "@toanpv0639/takumi", TAKUMI_CLI_NPM_PACKAGE_URL, TAKUMI_CLI_GLOBAL_INSTALL_COMMAND, TAKUMI_CLI_INSTALL_COMMANDS, DEFAULT_NETWORK_TIMEOUT_MS = 3000;
|
|
14263
14243
|
var init_takumi_constants = __esm(() => {
|
|
14264
14244
|
TAKUMI_CLI_NPM_PACKAGE_URL = `https://www.npmjs.com/package/${TAKUMI_CLI_NPM_PACKAGE_NAME}`;
|
|
14265
14245
|
TAKUMI_CLI_GLOBAL_INSTALL_COMMAND = `npm install -g ${TAKUMI_CLI_NPM_PACKAGE_NAME}`;
|
|
@@ -14986,7 +14966,7 @@ var require_empty = __commonJS((exports, module) => {
|
|
|
14986
14966
|
var path2 = __require("path");
|
|
14987
14967
|
var mkdir6 = require_mkdirs();
|
|
14988
14968
|
var remove = require_remove();
|
|
14989
|
-
var emptyDir = u(async function
|
|
14969
|
+
var emptyDir = u(async function emptyDir(dir) {
|
|
14990
14970
|
let items;
|
|
14991
14971
|
try {
|
|
14992
14972
|
items = await fs.readdir(dir);
|
|
@@ -15999,7 +15979,7 @@ function suggestActions(category) {
|
|
|
15999
15979
|
UNKNOWN: [
|
|
16000
15980
|
{
|
|
16001
15981
|
title: "Get more details",
|
|
16002
|
-
commands: ["
|
|
15982
|
+
commands: ["tkm <command> --verbose"],
|
|
16003
15983
|
notes: ["Run the command with --verbose flag to see detailed error information"]
|
|
16004
15984
|
}
|
|
16005
15985
|
]
|
|
@@ -16032,7 +16012,7 @@ var init_error = () => {};
|
|
|
16032
16012
|
|
|
16033
16013
|
// src/domains/github/client/error-handler.ts
|
|
16034
16014
|
async function handleHttpError(error, context) {
|
|
16035
|
-
const { kit, operation, verboseFlag = "
|
|
16015
|
+
const { kit, operation, verboseFlag = "tkm new --verbose" } = context;
|
|
16036
16016
|
if (error?.status === 401) {
|
|
16037
16017
|
await invalidateAuth();
|
|
16038
16018
|
}
|
|
@@ -16603,7 +16583,7 @@ class ReleasesApi {
|
|
|
16603
16583
|
return handleHttpError(error, {
|
|
16604
16584
|
kit,
|
|
16605
16585
|
operation: "fetch release",
|
|
16606
|
-
verboseFlag: "
|
|
16586
|
+
verboseFlag: "tkm new --verbose"
|
|
16607
16587
|
});
|
|
16608
16588
|
}
|
|
16609
16589
|
});
|
|
@@ -16624,20 +16604,20 @@ class ReleasesApi {
|
|
|
16624
16604
|
throw new GitHubError(`Release '${tag}' not found for ${kit.name}.
|
|
16625
16605
|
|
|
16626
16606
|
Possible causes:
|
|
16627
|
-
• Release version doesn't exist (check:
|
|
16607
|
+
• Release version doesn't exist (check: tkm versions --kit ${kit.name.toLowerCase()})
|
|
16628
16608
|
• You don't have repository access
|
|
16629
16609
|
|
|
16630
16610
|
Solutions:
|
|
16631
|
-
1. List available versions:
|
|
16611
|
+
1. List available versions: tkm versions --kit ${kit.name.toLowerCase()}
|
|
16632
16612
|
2. Check email for GitHub invitation and accept it
|
|
16633
16613
|
3. Re-authenticate: gh auth login (select 'Login with a web browser')
|
|
16634
16614
|
|
|
16635
|
-
Need help? Run with:
|
|
16615
|
+
Need help? Run with: tkm new --verbose`, 404);
|
|
16636
16616
|
}
|
|
16637
16617
|
return handleHttpError(error, {
|
|
16638
16618
|
kit,
|
|
16639
16619
|
operation: "fetch release",
|
|
16640
|
-
verboseFlag: "
|
|
16620
|
+
verboseFlag: "tkm new --verbose"
|
|
16641
16621
|
});
|
|
16642
16622
|
}
|
|
16643
16623
|
});
|
|
@@ -16681,7 +16661,7 @@ Need help? Run with: takumi new --verbose`, 404);
|
|
|
16681
16661
|
return handleHttpError(error, {
|
|
16682
16662
|
kit,
|
|
16683
16663
|
operation: "list releases",
|
|
16684
|
-
verboseFlag: "
|
|
16664
|
+
verboseFlag: "tkm versions --verbose"
|
|
16685
16665
|
});
|
|
16686
16666
|
}
|
|
16687
16667
|
});
|
|
@@ -16800,12 +16780,12 @@ Solutions:
|
|
|
16800
16780
|
3. Verify you're using the correct GitHub account
|
|
16801
16781
|
4. Wait 2-5 minutes after accepting invitation for permissions to sync
|
|
16802
16782
|
|
|
16803
|
-
Need help? Run with:
|
|
16783
|
+
Need help? Run with: tkm new --verbose`, 404);
|
|
16804
16784
|
}
|
|
16805
16785
|
return handleHttpError(error, {
|
|
16806
16786
|
kit,
|
|
16807
16787
|
operation: "check repository access",
|
|
16808
|
-
verboseFlag: "
|
|
16788
|
+
verboseFlag: "tkm new --verbose"
|
|
16809
16789
|
});
|
|
16810
16790
|
}
|
|
16811
16791
|
}
|
|
@@ -24670,7 +24650,11 @@ function resolveMonorepoRoot() {
|
|
|
24670
24650
|
}
|
|
24671
24651
|
var ACCEPTED_METADATA_NAMES;
|
|
24672
24652
|
var init_monorepo_resolver = __esm(() => {
|
|
24673
|
-
ACCEPTED_METADATA_NAMES = new Set([
|
|
24653
|
+
ACCEPTED_METADATA_NAMES = new Set([
|
|
24654
|
+
"sun-prototype-kit",
|
|
24655
|
+
"takumi-engineer",
|
|
24656
|
+
"takumi-agent-kit-engineer"
|
|
24657
|
+
]);
|
|
24674
24658
|
});
|
|
24675
24659
|
|
|
24676
24660
|
// src/commands/watch/phases/implementation-git-helpers.ts
|
|
@@ -27591,6 +27575,84 @@ var init_content = __esm(() => {
|
|
|
27591
27575
|
init_content_subcommands();
|
|
27592
27576
|
});
|
|
27593
27577
|
|
|
27578
|
+
// src/domains/help/help-colors.ts
|
|
27579
|
+
function stripColors(text) {
|
|
27580
|
+
return text.replace(/\x1b\[[0-9;]*m/g, "");
|
|
27581
|
+
}
|
|
27582
|
+
function getVisibleLength(text) {
|
|
27583
|
+
return stripColors(text).length;
|
|
27584
|
+
}
|
|
27585
|
+
function padEnd(text, width) {
|
|
27586
|
+
const visibleLength = getVisibleLength(text);
|
|
27587
|
+
const padding = Math.max(0, width - visibleLength);
|
|
27588
|
+
return text + " ".repeat(padding);
|
|
27589
|
+
}
|
|
27590
|
+
var import_picocolors39, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
|
|
27591
|
+
var init_help_colors = __esm(() => {
|
|
27592
|
+
import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
27593
|
+
NO_COLOR = process.env.NO_COLOR !== undefined;
|
|
27594
|
+
isColorSupported = !NO_COLOR && Boolean(process.stdout.isTTY);
|
|
27595
|
+
colors = {
|
|
27596
|
+
banner: isColorSupported ? import_picocolors39.default.cyan : identity,
|
|
27597
|
+
command: isColorSupported ? import_picocolors39.default.bold : identity,
|
|
27598
|
+
heading: isColorSupported ? import_picocolors39.default.yellow : identity,
|
|
27599
|
+
flag: isColorSupported ? import_picocolors39.default.green : identity,
|
|
27600
|
+
description: isColorSupported ? import_picocolors39.default.gray : identity,
|
|
27601
|
+
example: isColorSupported ? import_picocolors39.default.blue : identity,
|
|
27602
|
+
warning: isColorSupported ? import_picocolors39.default.yellow : identity,
|
|
27603
|
+
error: isColorSupported ? import_picocolors39.default.red : identity,
|
|
27604
|
+
muted: isColorSupported ? import_picocolors39.default.dim : identity,
|
|
27605
|
+
success: isColorSupported ? import_picocolors39.default.green : identity
|
|
27606
|
+
};
|
|
27607
|
+
defaultTheme = {
|
|
27608
|
+
banner: colors.banner,
|
|
27609
|
+
command: colors.command,
|
|
27610
|
+
heading: colors.heading,
|
|
27611
|
+
flag: colors.flag,
|
|
27612
|
+
description: colors.description,
|
|
27613
|
+
example: colors.example,
|
|
27614
|
+
warning: colors.warning,
|
|
27615
|
+
error: colors.error,
|
|
27616
|
+
muted: colors.muted,
|
|
27617
|
+
success: colors.success
|
|
27618
|
+
};
|
|
27619
|
+
});
|
|
27620
|
+
|
|
27621
|
+
// src/domains/help/help-banner.ts
|
|
27622
|
+
function getBanner() {
|
|
27623
|
+
return BANNER_LINES.map((line) => defaultTheme.banner(line)).join(`
|
|
27624
|
+
`);
|
|
27625
|
+
}
|
|
27626
|
+
function getCenteredBanner(width = 80) {
|
|
27627
|
+
if (width < BANNER_WIDTH + 4) {
|
|
27628
|
+
return getBanner();
|
|
27629
|
+
}
|
|
27630
|
+
const padding = Math.floor((width - BANNER_WIDTH) / 2);
|
|
27631
|
+
const paddingStr = " ".repeat(padding);
|
|
27632
|
+
return BANNER_LINES.map((line) => paddingStr + defaultTheme.banner(line)).join(`
|
|
27633
|
+
`);
|
|
27634
|
+
}
|
|
27635
|
+
function getBannerWithVersion(version, width = 80) {
|
|
27636
|
+
const banner = getCenteredBanner(width);
|
|
27637
|
+
const versionLine = defaultTheme.muted(`v${version}`);
|
|
27638
|
+
const versionPadding = Math.floor((width - getVisibleLength(versionLine)) / 2);
|
|
27639
|
+
const centeredVersion = " ".repeat(Math.max(0, versionPadding)) + versionLine;
|
|
27640
|
+
return `${banner}
|
|
27641
|
+
${centeredVersion}`;
|
|
27642
|
+
}
|
|
27643
|
+
var BANNER_LINES, BANNER_WIDTH = 49;
|
|
27644
|
+
var init_help_banner = __esm(() => {
|
|
27645
|
+
init_help_colors();
|
|
27646
|
+
BANNER_LINES = [
|
|
27647
|
+
" ████████╗ █████╗ ██╗ ██╗██╗ ██╗███╗ ███╗██╗",
|
|
27648
|
+
" ╚══██╔══╝██╔══██╗██║ ██╔╝██║ ██║████╗ ████║██║",
|
|
27649
|
+
" ██║ ███████║█████╔╝ ██║ ██║██╔████╔██║██║",
|
|
27650
|
+
" ██║ ██╔══██║██╔═██╗ ██║ ██║██║╚██╔╝██║██║",
|
|
27651
|
+
" ██║ ██║ ██║██║ ██╗╚██████╔╝██║ ╚═╝ ██║██║",
|
|
27652
|
+
" ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝"
|
|
27653
|
+
];
|
|
27654
|
+
});
|
|
27655
|
+
|
|
27594
27656
|
// src/domains/help/commands/common-options.ts
|
|
27595
27657
|
var filterOptionsGroup, folderOptionsGroup;
|
|
27596
27658
|
var init_common_options = __esm(() => {
|
|
@@ -27635,14 +27697,14 @@ var init_new_command_help = __esm(() => {
|
|
|
27635
27697
|
newCommandHelp = {
|
|
27636
27698
|
name: "new",
|
|
27637
27699
|
description: "Bootstrap a new Takumi project (with interactive version selection)",
|
|
27638
|
-
usage: "
|
|
27700
|
+
usage: "tkm new [options]",
|
|
27639
27701
|
examples: [
|
|
27640
27702
|
{
|
|
27641
|
-
command: "
|
|
27703
|
+
command: "tkm new --kit engineer --dir ./my-project",
|
|
27642
27704
|
description: "Create engineer kit project in specific directory"
|
|
27643
27705
|
},
|
|
27644
27706
|
{
|
|
27645
|
-
command: "
|
|
27707
|
+
command: "tkm new -y --use-git --release v2.1.0",
|
|
27646
27708
|
description: "Non-interactive with git clone (no GitHub API needed)"
|
|
27647
27709
|
}
|
|
27648
27710
|
],
|
|
@@ -27724,14 +27786,14 @@ var init_init_command_help = __esm(() => {
|
|
|
27724
27786
|
initCommandHelp = {
|
|
27725
27787
|
name: "init",
|
|
27726
27788
|
description: "Initialize or update Takumi project (with interactive version selection)",
|
|
27727
|
-
usage: "
|
|
27789
|
+
usage: "tkm init [options]",
|
|
27728
27790
|
examples: [
|
|
27729
27791
|
{
|
|
27730
|
-
command: "
|
|
27792
|
+
command: "tkm init --kit engineer",
|
|
27731
27793
|
description: "Update local project with latest engineer kit"
|
|
27732
27794
|
},
|
|
27733
27795
|
{
|
|
27734
|
-
command: "
|
|
27796
|
+
command: "tkm init --use-git --release v2.1.0 -y",
|
|
27735
27797
|
description: "Non-interactive with git clone (no GitHub API needed)"
|
|
27736
27798
|
}
|
|
27737
27799
|
],
|
|
@@ -27852,18 +27914,18 @@ var init_doctor_command_help = __esm(() => {
|
|
|
27852
27914
|
doctorCommandHelp = {
|
|
27853
27915
|
name: "doctor",
|
|
27854
27916
|
description: "Comprehensive health check for Takumi",
|
|
27855
|
-
usage: "
|
|
27917
|
+
usage: "tkm doctor [options]",
|
|
27856
27918
|
examples: [
|
|
27857
27919
|
{
|
|
27858
|
-
command: "
|
|
27920
|
+
command: "tkm doctor",
|
|
27859
27921
|
description: "Run full health check interactively"
|
|
27860
27922
|
},
|
|
27861
27923
|
{
|
|
27862
|
-
command: "
|
|
27924
|
+
command: "tkm doctor --fix",
|
|
27863
27925
|
description: "Auto-fix all fixable issues"
|
|
27864
27926
|
},
|
|
27865
27927
|
{
|
|
27866
|
-
command: "
|
|
27928
|
+
command: "tkm doctor --check-only",
|
|
27867
27929
|
description: "CI mode: exit 1 on failures, no prompts"
|
|
27868
27930
|
}
|
|
27869
27931
|
],
|
|
@@ -27903,14 +27965,14 @@ var init_uninstall_command_help = __esm(() => {
|
|
|
27903
27965
|
uninstallCommandHelp = {
|
|
27904
27966
|
name: "uninstall",
|
|
27905
27967
|
description: "Remove Takumi installations (ownership-aware)",
|
|
27906
|
-
usage: "
|
|
27968
|
+
usage: "tkm uninstall [options]",
|
|
27907
27969
|
examples: [
|
|
27908
27970
|
{
|
|
27909
|
-
command: "
|
|
27971
|
+
command: "tkm uninstall --local --yes",
|
|
27910
27972
|
description: "Remove local installation without confirmation"
|
|
27911
27973
|
},
|
|
27912
27974
|
{
|
|
27913
|
-
command: "
|
|
27975
|
+
command: "tkm uninstall --dry-run",
|
|
27914
27976
|
description: "Preview what would be removed without deleting"
|
|
27915
27977
|
}
|
|
27916
27978
|
],
|
|
@@ -27969,14 +28031,14 @@ var init_update_command_help = __esm(() => {
|
|
|
27969
28031
|
updateCommandHelp = {
|
|
27970
28032
|
name: "update",
|
|
27971
28033
|
description: "Update Takumi CLI tool only (not kit content)",
|
|
27972
|
-
usage: "
|
|
28034
|
+
usage: "tkm update [options]",
|
|
27973
28035
|
examples: [
|
|
27974
28036
|
{
|
|
27975
|
-
command: "
|
|
28037
|
+
command: "tkm update --check",
|
|
27976
28038
|
description: "Check for CLI updates without installing"
|
|
27977
28039
|
},
|
|
27978
28040
|
{
|
|
27979
|
-
command: "
|
|
28041
|
+
command: "tkm update --beta --yes",
|
|
27980
28042
|
description: "Update to latest beta version without confirmation"
|
|
27981
28043
|
}
|
|
27982
28044
|
],
|
|
@@ -28011,18 +28073,18 @@ var init_update_command_help = __esm(() => {
|
|
|
28011
28073
|
options: [
|
|
28012
28074
|
{
|
|
28013
28075
|
flags: "--kit <kit>",
|
|
28014
|
-
description: "This option is no longer supported with '
|
|
28076
|
+
description: "This option is no longer supported with 'tkm update'",
|
|
28015
28077
|
deprecated: {
|
|
28016
|
-
message: "Use '
|
|
28017
|
-
alternative: "
|
|
28078
|
+
message: "Use 'tkm init --kit <kit>' to update kit installations",
|
|
28079
|
+
alternative: "tkm init --kit <kit>"
|
|
28018
28080
|
}
|
|
28019
28081
|
},
|
|
28020
28082
|
{
|
|
28021
28083
|
flags: "-g, --global",
|
|
28022
|
-
description: "This option is no longer supported with '
|
|
28084
|
+
description: "This option is no longer supported with 'tkm update'",
|
|
28023
28085
|
deprecated: {
|
|
28024
|
-
message: "Use '
|
|
28025
|
-
alternative: "
|
|
28086
|
+
message: "Use 'tkm init --global' to update global kit",
|
|
28087
|
+
alternative: "tkm init --global"
|
|
28026
28088
|
}
|
|
28027
28089
|
}
|
|
28028
28090
|
]
|
|
@@ -28031,7 +28093,7 @@ var init_update_command_help = __esm(() => {
|
|
|
28031
28093
|
sections: [
|
|
28032
28094
|
{
|
|
28033
28095
|
title: "Note",
|
|
28034
|
-
content: "'
|
|
28096
|
+
content: "'tkm update' updates the CLI tool only and defaults to the latest stable release. Use '--beta' to opt into prerelease CLI builds. To update kit content (skills, commands, rules), use 'tkm init' for local or 'tkm init -g' for global. Use --yes to skip all prompts (both CLI and kit content update) for non-interactive/CI usage."
|
|
28035
28097
|
}
|
|
28036
28098
|
]
|
|
28037
28099
|
};
|
|
@@ -28043,14 +28105,14 @@ var init_versions_command_help = __esm(() => {
|
|
|
28043
28105
|
versionsCommandHelp = {
|
|
28044
28106
|
name: "versions",
|
|
28045
28107
|
description: "List available versions of Takumi repositories",
|
|
28046
|
-
usage: "
|
|
28108
|
+
usage: "tkm versions [options]",
|
|
28047
28109
|
examples: [
|
|
28048
28110
|
{
|
|
28049
|
-
command: "
|
|
28111
|
+
command: "tkm versions --kit engineer --limit 10",
|
|
28050
28112
|
description: "Show latest 10 versions of engineer kit"
|
|
28051
28113
|
},
|
|
28052
28114
|
{
|
|
28053
|
-
command: "
|
|
28115
|
+
command: "tkm versions --all",
|
|
28054
28116
|
description: "Show all releases including prereleases"
|
|
28055
28117
|
}
|
|
28056
28118
|
],
|
|
@@ -28083,14 +28145,14 @@ var init_skills_command_help = __esm(() => {
|
|
|
28083
28145
|
skillsCommandHelp = {
|
|
28084
28146
|
name: "skills",
|
|
28085
28147
|
description: "Install, uninstall, and manage Takumi skills across coding agents",
|
|
28086
|
-
usage: "
|
|
28148
|
+
usage: "tkm skills [options]",
|
|
28087
28149
|
examples: [
|
|
28088
28150
|
{
|
|
28089
|
-
command: "
|
|
28151
|
+
command: "tkm skills --name frontend-design --agent claude-code -g",
|
|
28090
28152
|
description: "Install skill to Claude Code globally"
|
|
28091
28153
|
},
|
|
28092
28154
|
{
|
|
28093
|
-
command: "
|
|
28155
|
+
command: "tkm skills --list --installed",
|
|
28094
28156
|
description: "Show all installed skills with their locations"
|
|
28095
28157
|
}
|
|
28096
28158
|
],
|
|
@@ -28185,18 +28247,18 @@ var init_config_command_help = __esm(() => {
|
|
|
28185
28247
|
configCommandHelp = {
|
|
28186
28248
|
name: "config",
|
|
28187
28249
|
description: "Manage Takumi configuration",
|
|
28188
|
-
usage: "
|
|
28250
|
+
usage: "tkm config [action] [key] [value] [options]",
|
|
28189
28251
|
examples: [
|
|
28190
28252
|
{
|
|
28191
|
-
command: "
|
|
28253
|
+
command: "tkm config get defaults.kit",
|
|
28192
28254
|
description: "Read a config value"
|
|
28193
28255
|
},
|
|
28194
28256
|
{
|
|
28195
|
-
command: "
|
|
28257
|
+
command: "tkm config set defaults.kit engineer",
|
|
28196
28258
|
description: "Set a config value from the CLI"
|
|
28197
28259
|
},
|
|
28198
28260
|
{
|
|
28199
|
-
command: "
|
|
28261
|
+
command: "tkm config show --json",
|
|
28200
28262
|
description: "Print merged config as JSON"
|
|
28201
28263
|
}
|
|
28202
28264
|
],
|
|
@@ -28256,14 +28318,14 @@ var init_projects_command_help = __esm(() => {
|
|
|
28256
28318
|
projectsCommandHelp = {
|
|
28257
28319
|
name: "projects",
|
|
28258
28320
|
description: "Manage local Takumi project registry entries",
|
|
28259
|
-
usage: "
|
|
28321
|
+
usage: "tkm projects <subcommand> [options]",
|
|
28260
28322
|
examples: [
|
|
28261
28323
|
{
|
|
28262
|
-
command: "
|
|
28324
|
+
command: "tkm projects list --pinned",
|
|
28263
28325
|
description: "Show only pinned projects"
|
|
28264
28326
|
},
|
|
28265
28327
|
{
|
|
28266
|
-
command: "
|
|
28328
|
+
command: "tkm projects add . --alias engine --pinned",
|
|
28267
28329
|
description: "Add current directory with an alias and pin it"
|
|
28268
28330
|
}
|
|
28269
28331
|
],
|
|
@@ -28325,14 +28387,14 @@ var init_setup_command_help = __esm(() => {
|
|
|
28325
28387
|
setupCommandHelp = {
|
|
28326
28388
|
name: "setup",
|
|
28327
28389
|
description: "Run guided setup for API keys and optional packages",
|
|
28328
|
-
usage: "
|
|
28390
|
+
usage: "tkm setup [options]",
|
|
28329
28391
|
examples: [
|
|
28330
28392
|
{
|
|
28331
|
-
command: "
|
|
28393
|
+
command: "tkm setup",
|
|
28332
28394
|
description: "Run setup wizard in current project"
|
|
28333
28395
|
},
|
|
28334
28396
|
{
|
|
28335
|
-
command: "
|
|
28397
|
+
command: "tkm setup --global --skip-packages",
|
|
28336
28398
|
description: "Configure global setup without package installation"
|
|
28337
28399
|
}
|
|
28338
28400
|
],
|
|
@@ -28365,14 +28427,14 @@ var init_agents_command_help = __esm(() => {
|
|
|
28365
28427
|
agentsCommandHelp = {
|
|
28366
28428
|
name: "agents",
|
|
28367
28429
|
description: "Install, uninstall, and manage Claude Code agents across providers",
|
|
28368
|
-
usage: "
|
|
28430
|
+
usage: "tkm agents [options]",
|
|
28369
28431
|
examples: [
|
|
28370
28432
|
{
|
|
28371
|
-
command: "
|
|
28433
|
+
command: "tkm agents --name maintainer --agent codex",
|
|
28372
28434
|
description: "Install one agent to Codex"
|
|
28373
28435
|
},
|
|
28374
28436
|
{
|
|
28375
|
-
command: "
|
|
28437
|
+
command: "tkm agents --list --installed",
|
|
28376
28438
|
description: "Show installed agents and locations"
|
|
28377
28439
|
}
|
|
28378
28440
|
],
|
|
@@ -28442,14 +28504,14 @@ var init_commands_command_help = __esm(() => {
|
|
|
28442
28504
|
commandsCommandHelp = {
|
|
28443
28505
|
name: "commands",
|
|
28444
28506
|
description: "Install, uninstall, and manage Claude commands across providers",
|
|
28445
|
-
usage: "
|
|
28507
|
+
usage: "tkm commands [options]",
|
|
28446
28508
|
examples: [
|
|
28447
28509
|
{
|
|
28448
|
-
command: "
|
|
28510
|
+
command: "tkm commands --name plan --agent codex",
|
|
28449
28511
|
description: "Install one slash command to Codex"
|
|
28450
28512
|
},
|
|
28451
28513
|
{
|
|
28452
|
-
command: "
|
|
28514
|
+
command: "tkm commands --list",
|
|
28453
28515
|
description: "List available commands from source"
|
|
28454
28516
|
}
|
|
28455
28517
|
],
|
|
@@ -28519,18 +28581,18 @@ var init_content_command_help = __esm(() => {
|
|
|
28519
28581
|
contentCommandHelp = {
|
|
28520
28582
|
name: "content",
|
|
28521
28583
|
description: "Multi-channel content automation engine",
|
|
28522
|
-
usage: "
|
|
28584
|
+
usage: "tkm content [action] [id] [options]",
|
|
28523
28585
|
examples: [
|
|
28524
28586
|
{
|
|
28525
|
-
command: "
|
|
28587
|
+
command: "tkm content start",
|
|
28526
28588
|
description: "Start the content daemon (default action)"
|
|
28527
28589
|
},
|
|
28528
28590
|
{
|
|
28529
|
-
command: "
|
|
28591
|
+
command: "tkm content setup",
|
|
28530
28592
|
description: "Interactive configuration wizard"
|
|
28531
28593
|
},
|
|
28532
28594
|
{
|
|
28533
|
-
command: "
|
|
28595
|
+
command: "tkm content queue",
|
|
28534
28596
|
description: "List pending content items for review"
|
|
28535
28597
|
}
|
|
28536
28598
|
],
|
|
@@ -28613,18 +28675,18 @@ var init_migrate_command_help = __esm(() => {
|
|
|
28613
28675
|
migrateCommandHelp = {
|
|
28614
28676
|
name: "migrate",
|
|
28615
28677
|
description: "Migrate agents, commands, skills, config, rules, and hooks to other providers",
|
|
28616
|
-
usage: "
|
|
28678
|
+
usage: "tkm migrate [options]",
|
|
28617
28679
|
examples: [
|
|
28618
28680
|
{
|
|
28619
|
-
command: "
|
|
28681
|
+
command: "tkm migrate --agent droid --agent codex",
|
|
28620
28682
|
description: "Migrate to specific providers"
|
|
28621
28683
|
},
|
|
28622
28684
|
{
|
|
28623
|
-
command: "
|
|
28685
|
+
command: "tkm migrate --all --global",
|
|
28624
28686
|
description: "Migrate globally to all supported providers"
|
|
28625
28687
|
},
|
|
28626
28688
|
{
|
|
28627
|
-
command: "
|
|
28689
|
+
command: "tkm migrate --dry-run",
|
|
28628
28690
|
description: "Preview migration plan without writing files"
|
|
28629
28691
|
}
|
|
28630
28692
|
],
|
|
@@ -28701,14 +28763,14 @@ var init_watch_command_help = __esm(() => {
|
|
|
28701
28763
|
watchCommandHelp = {
|
|
28702
28764
|
name: "watch",
|
|
28703
28765
|
description: "Watch GitHub issues and auto-respond with AI analysis",
|
|
28704
|
-
usage: "
|
|
28766
|
+
usage: "tkm watch [options]",
|
|
28705
28767
|
examples: [
|
|
28706
28768
|
{
|
|
28707
|
-
command: "
|
|
28769
|
+
command: "tkm watch --dry-run",
|
|
28708
28770
|
description: "Preview issue detection without posting responses"
|
|
28709
28771
|
},
|
|
28710
28772
|
{
|
|
28711
|
-
command: "
|
|
28773
|
+
command: "tkm watch --interval 60000",
|
|
28712
28774
|
description: "Poll every 60 seconds instead of default 30s"
|
|
28713
28775
|
}
|
|
28714
28776
|
],
|
|
@@ -28782,49 +28844,6 @@ var init_help_commands = __esm(() => {
|
|
|
28782
28844
|
};
|
|
28783
28845
|
});
|
|
28784
28846
|
|
|
28785
|
-
// src/domains/help/help-colors.ts
|
|
28786
|
-
function stripColors(text) {
|
|
28787
|
-
return text.replace(/\x1b\[[0-9;]*m/g, "");
|
|
28788
|
-
}
|
|
28789
|
-
function getVisibleLength(text) {
|
|
28790
|
-
return stripColors(text).length;
|
|
28791
|
-
}
|
|
28792
|
-
function padEnd(text, width) {
|
|
28793
|
-
const visibleLength = getVisibleLength(text);
|
|
28794
|
-
const padding = Math.max(0, width - visibleLength);
|
|
28795
|
-
return text + " ".repeat(padding);
|
|
28796
|
-
}
|
|
28797
|
-
var import_picocolors42, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
|
|
28798
|
-
var init_help_colors = __esm(() => {
|
|
28799
|
-
import_picocolors42 = __toESM(require_picocolors(), 1);
|
|
28800
|
-
NO_COLOR = process.env.NO_COLOR !== undefined;
|
|
28801
|
-
isColorSupported = !NO_COLOR && Boolean(process.stdout.isTTY);
|
|
28802
|
-
colors = {
|
|
28803
|
-
banner: isColorSupported ? import_picocolors42.default.cyan : identity,
|
|
28804
|
-
command: isColorSupported ? import_picocolors42.default.bold : identity,
|
|
28805
|
-
heading: isColorSupported ? import_picocolors42.default.yellow : identity,
|
|
28806
|
-
flag: isColorSupported ? import_picocolors42.default.green : identity,
|
|
28807
|
-
description: isColorSupported ? import_picocolors42.default.gray : identity,
|
|
28808
|
-
example: isColorSupported ? import_picocolors42.default.blue : identity,
|
|
28809
|
-
warning: isColorSupported ? import_picocolors42.default.yellow : identity,
|
|
28810
|
-
error: isColorSupported ? import_picocolors42.default.red : identity,
|
|
28811
|
-
muted: isColorSupported ? import_picocolors42.default.dim : identity,
|
|
28812
|
-
success: isColorSupported ? import_picocolors42.default.green : identity
|
|
28813
|
-
};
|
|
28814
|
-
defaultTheme = {
|
|
28815
|
-
banner: colors.banner,
|
|
28816
|
-
command: colors.command,
|
|
28817
|
-
heading: colors.heading,
|
|
28818
|
-
flag: colors.flag,
|
|
28819
|
-
description: colors.description,
|
|
28820
|
-
example: colors.example,
|
|
28821
|
-
warning: colors.warning,
|
|
28822
|
-
error: colors.error,
|
|
28823
|
-
muted: colors.muted,
|
|
28824
|
-
success: colors.success
|
|
28825
|
-
};
|
|
28826
|
-
});
|
|
28827
|
-
|
|
28828
28847
|
// src/domains/help/help-interactive.ts
|
|
28829
28848
|
import { spawn as spawn9 } from "node:child_process";
|
|
28830
28849
|
import * as readline from "node:readline";
|
|
@@ -28941,24 +28960,6 @@ var init_help_interactive = __esm(() => {
|
|
|
28941
28960
|
init_help_colors();
|
|
28942
28961
|
});
|
|
28943
28962
|
|
|
28944
|
-
// src/domains/help/help-banner.ts
|
|
28945
|
-
function getBanner() {
|
|
28946
|
-
return BANNER_LINES.map((line) => defaultTheme.banner(line)).join(`
|
|
28947
|
-
`);
|
|
28948
|
-
}
|
|
28949
|
-
var BANNER_LINES;
|
|
28950
|
-
var init_help_banner = __esm(() => {
|
|
28951
|
-
init_help_colors();
|
|
28952
|
-
BANNER_LINES = [
|
|
28953
|
-
" ████████╗ █████╗ ██╗ ██╗██╗ ██╗███╗ ███╗██╗",
|
|
28954
|
-
" ╚══██╔══╝██╔══██╗██║ ██╔╝██║ ██║████╗ ████║██║",
|
|
28955
|
-
" ██║ ███████║█████╔╝ ██║ ██║██╔████╔██║██║",
|
|
28956
|
-
" ██║ ██╔══██║██╔═██╗ ██║ ██║██║╚██╔╝██║██║",
|
|
28957
|
-
" ██║ ██║ ██║██║ ██╗╚██████╔╝██║ ╚═╝ ██║██║",
|
|
28958
|
-
" ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝"
|
|
28959
|
-
];
|
|
28960
|
-
});
|
|
28961
|
-
|
|
28962
28963
|
// src/domains/help/help-renderer.ts
|
|
28963
28964
|
function renderBanner(options2) {
|
|
28964
28965
|
if (!options2.showBanner)
|
|
@@ -29085,10 +29086,10 @@ function renderGlobalHelp(commands, options2 = DEFAULT_HELP_OPTIONS) {
|
|
|
29085
29086
|
}
|
|
29086
29087
|
lines.push("");
|
|
29087
29088
|
lines.push(theme.heading("Quick Start:"));
|
|
29088
|
-
lines.push(` ${padEnd(theme.example("
|
|
29089
|
-
lines.push(` ${padEnd(theme.example("
|
|
29090
|
-
lines.push(` ${padEnd(theme.example("
|
|
29091
|
-
lines.push(` ${padEnd(theme.example("
|
|
29089
|
+
lines.push(` ${padEnd(theme.example("tkm config show"), 24)}${theme.description("View current configuration")}`);
|
|
29090
|
+
lines.push(` ${padEnd(theme.example("tkm config --help"), 24)}${theme.description("See all config actions")}`);
|
|
29091
|
+
lines.push(` ${padEnd(theme.example("tkm skills --help"), 24)}${theme.description("Discover skill installation workflows")}`);
|
|
29092
|
+
lines.push(` ${padEnd(theme.example("tkm migrate --help"), 24)}${theme.description("Migrate agents/commands/skills across providers")}`);
|
|
29092
29093
|
lines.push("");
|
|
29093
29094
|
lines.push(theme.heading("Global Options:"));
|
|
29094
29095
|
lines.push(` ${padEnd(theme.flag("--verbose"), 20)}${theme.description("Enable verbose logging")}`);
|
|
@@ -29101,7 +29102,7 @@ function renderGlobalHelp(commands, options2 = DEFAULT_HELP_OPTIONS) {
|
|
|
29101
29102
|
lines.push(` ${padEnd(theme.flag("GITHUB_TOKEN"), 20)}${theme.description("Environment variable for Classic PAT")}`);
|
|
29102
29103
|
lines.push(` ${padEnd(theme.flag("gh auth login"), 20)}${theme.description("GitHub CLI authentication (default)")}`);
|
|
29103
29104
|
lines.push("");
|
|
29104
|
-
lines.push(theme.muted("Run '
|
|
29105
|
+
lines.push(theme.muted("Run 'tkm <command> --help' for details. Start with 'tkm skills --help' and 'tkm config --help'."));
|
|
29105
29106
|
return lines.filter((s3) => s3 !== undefined).join(`
|
|
29106
29107
|
`);
|
|
29107
29108
|
}
|
|
@@ -29787,7 +29788,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
29787
29788
|
|
|
29788
29789
|
// src/cli/cli-config.ts
|
|
29789
29790
|
function createCliInstance() {
|
|
29790
|
-
const cli = cac("
|
|
29791
|
+
const cli = cac("tkm");
|
|
29791
29792
|
cli.option("--verbose", "Enable verbose logging for debugging");
|
|
29792
29793
|
cli.option("--json", "Output machine-readable JSON format");
|
|
29793
29794
|
cli.option("--log-file <path>", "Write logs to file");
|
|
@@ -34074,7 +34075,7 @@ function createApiClient(claudeDir) {
|
|
|
34074
34075
|
const dir = claudeDir ?? join9(homedir7(), ".claude");
|
|
34075
34076
|
const apiKey = readExistingApiKey(dir);
|
|
34076
34077
|
if (!apiKey) {
|
|
34077
|
-
throw new CkApiError("MISSING_API_KEY", "No API key found. Run `
|
|
34078
|
+
throw new CkApiError("MISSING_API_KEY", "No API key found. Run `tkm api setup` to configure your Takumi API key.", 401);
|
|
34078
34079
|
}
|
|
34079
34080
|
return new TakumiHttpClient(apiKey);
|
|
34080
34081
|
}
|
|
@@ -35782,7 +35783,7 @@ async function reviewwebCommand(action, arg, options2) {
|
|
|
35782
35783
|
return;
|
|
35783
35784
|
}
|
|
35784
35785
|
if (!arg) {
|
|
35785
|
-
console.error(`Usage:
|
|
35786
|
+
console.error(`Usage: tkm api reviewweb ${action} <url|domain|keyword>`);
|
|
35786
35787
|
process.exitCode = 1;
|
|
35787
35788
|
return;
|
|
35788
35789
|
}
|
|
@@ -36273,7 +36274,7 @@ async function vidcapCommand(action, arg, options2) {
|
|
|
36273
36274
|
return;
|
|
36274
36275
|
}
|
|
36275
36276
|
if (!arg) {
|
|
36276
|
-
console.error(`Usage:
|
|
36277
|
+
console.error(`Usage: tkm api vidcap ${action} <url${action === "search" ? "|query" : ""}>`);
|
|
36277
36278
|
process.exitCode = 1;
|
|
36278
36279
|
return;
|
|
36279
36280
|
}
|
|
@@ -36303,7 +36304,7 @@ async function apiCommand(action, arg1, arg2, options2) {
|
|
|
36303
36304
|
return handleApiSetup({ key: opts.key, force: opts.force });
|
|
36304
36305
|
if (action === "proxy") {
|
|
36305
36306
|
if (!arg1) {
|
|
36306
|
-
console.error("Usage:
|
|
36307
|
+
console.error("Usage: tkm api proxy <service> <path>");
|
|
36307
36308
|
process.exitCode = 1;
|
|
36308
36309
|
return;
|
|
36309
36310
|
}
|
|
@@ -37832,7 +37833,7 @@ async function handleGet(key, options2) {
|
|
|
37832
37833
|
}
|
|
37833
37834
|
if (value === undefined) {
|
|
37834
37835
|
console.error(`Key not found: ${key}`);
|
|
37835
|
-
console.error(`Run:
|
|
37836
|
+
console.error(`Run: tkm config show --json | jq 'keys'`);
|
|
37836
37837
|
process.exitCode = 1;
|
|
37837
37838
|
return;
|
|
37838
37839
|
}
|
|
@@ -37942,7 +37943,7 @@ async function configCommand(action, keyOrOptions, valueOrOptions, options2) {
|
|
|
37942
37943
|
}
|
|
37943
37944
|
if (action === "get") {
|
|
37944
37945
|
if (typeof keyOrOptions !== "string" || !keyOrOptions.trim()) {
|
|
37945
|
-
console.error("Usage:
|
|
37946
|
+
console.error("Usage: tkm config get <key>");
|
|
37946
37947
|
process.exitCode = 1;
|
|
37947
37948
|
return;
|
|
37948
37949
|
}
|
|
@@ -37950,12 +37951,12 @@ async function configCommand(action, keyOrOptions, valueOrOptions, options2) {
|
|
|
37950
37951
|
}
|
|
37951
37952
|
if (action === "set") {
|
|
37952
37953
|
if (typeof keyOrOptions !== "string" || !keyOrOptions.trim()) {
|
|
37953
|
-
console.error("Usage:
|
|
37954
|
+
console.error("Usage: tkm config set <key> <value>");
|
|
37954
37955
|
process.exitCode = 1;
|
|
37955
37956
|
return;
|
|
37956
37957
|
}
|
|
37957
37958
|
if (typeof valueOrOptions !== "string") {
|
|
37958
|
-
console.error("Usage:
|
|
37959
|
+
console.error("Usage: tkm config set <key> <value>");
|
|
37959
37960
|
process.exitCode = 1;
|
|
37960
37961
|
return;
|
|
37961
37962
|
}
|
|
@@ -39043,9 +39044,9 @@ function getNpmQuery() {
|
|
|
39043
39044
|
checkFn: (stdout) => {
|
|
39044
39045
|
try {
|
|
39045
39046
|
const data = JSON.parse(stdout);
|
|
39046
|
-
return !!data.dependencies?.["@
|
|
39047
|
+
return !!data.dependencies?.["@toanpv0639/takumi"];
|
|
39047
39048
|
} catch {
|
|
39048
|
-
return /"@
|
|
39049
|
+
return /"@toanpv0639\/takumi"\s*:/.test(stdout) || /(?:^|[\s"])@toanpv0639\/takumi@/m.test(stdout);
|
|
39049
39050
|
}
|
|
39050
39051
|
}
|
|
39051
39052
|
};
|
|
@@ -39108,7 +39109,7 @@ function getBunQuery() {
|
|
|
39108
39109
|
return {
|
|
39109
39110
|
pm: "bun",
|
|
39110
39111
|
cmd: "bun pm ls -g",
|
|
39111
|
-
checkFn: (stdout) => /(?:^|[\s"])@
|
|
39112
|
+
checkFn: (stdout) => /(?:^|[\s"])@toanpv0639\/takumi@/m.test(stdout)
|
|
39112
39113
|
};
|
|
39113
39114
|
}
|
|
39114
39115
|
function getBunVersionCommand() {
|
|
@@ -39140,8 +39141,8 @@ init_environment();
|
|
|
39140
39141
|
function getYarnQuery() {
|
|
39141
39142
|
return {
|
|
39142
39143
|
pm: "yarn",
|
|
39143
|
-
cmd: isWindows() ? "yarn.cmd global list --pattern @
|
|
39144
|
-
checkFn: (stdout) => /(?:^|[\s"])@
|
|
39144
|
+
cmd: isWindows() ? "yarn.cmd global list --pattern @toanpv0639/takumi" : "yarn global list --pattern @toanpv0639/takumi",
|
|
39145
|
+
checkFn: (stdout) => /(?:^|[\s"])@toanpv0639\/takumi@/m.test(stdout)
|
|
39145
39146
|
};
|
|
39146
39147
|
}
|
|
39147
39148
|
function getYarnVersionCommand() {
|
|
@@ -39173,8 +39174,8 @@ init_environment();
|
|
|
39173
39174
|
function getPnpmQuery() {
|
|
39174
39175
|
return {
|
|
39175
39176
|
pm: "pnpm",
|
|
39176
|
-
cmd: isWindows() ? "pnpm.cmd ls -g @
|
|
39177
|
-
checkFn: (stdout) => /(?:^|[\s"])@
|
|
39177
|
+
cmd: isWindows() ? "pnpm.cmd ls -g @toanpv0639/takumi" : "pnpm ls -g @toanpv0639/takumi",
|
|
39178
|
+
checkFn: (stdout) => /(?:^|[\s"])@toanpv0639\/takumi(?:@|\s+\d)/m.test(stdout)
|
|
39178
39179
|
};
|
|
39179
39180
|
}
|
|
39180
39181
|
function getPnpmVersionCommand() {
|
|
@@ -39226,7 +39227,7 @@ function detectFromBinaryPath() {
|
|
|
39226
39227
|
if (normalized.includes("/npm/node_modules/") || normalized.includes("/usr/local/lib/node_modules/") || normalized.includes("/usr/lib/node_modules/") || normalized.includes("/opt/homebrew/lib/node_modules/") || normalized.includes("/.nvm/versions/node/") || normalized.includes("/n/versions/node/") || normalized.includes("/appdata/roaming/npm/") || normalized.includes("/appdata/roaming/nvm/")) {
|
|
39227
39228
|
return "npm";
|
|
39228
39229
|
}
|
|
39229
|
-
if (normalized.includes("/node_modules/@
|
|
39230
|
+
if (normalized.includes("/node_modules/@toanpv0639/takumi/")) {
|
|
39230
39231
|
return "npm";
|
|
39231
39232
|
}
|
|
39232
39233
|
return "unknown";
|
|
@@ -39541,7 +39542,7 @@ import { spawnSync } from "node:child_process";
|
|
|
39541
39542
|
var VERSION_CHECK_TIMEOUT_MS = 5000;
|
|
39542
39543
|
async function checkCliVersion() {
|
|
39543
39544
|
try {
|
|
39544
|
-
const versionResult = spawnSync("
|
|
39545
|
+
const versionResult = spawnSync("tkm", ["-V"], {
|
|
39545
39546
|
timeout: VERSION_CHECK_TIMEOUT_MS,
|
|
39546
39547
|
encoding: "utf-8"
|
|
39547
39548
|
});
|
|
@@ -39591,7 +39592,7 @@ async function checkCliVersion() {
|
|
|
39591
39592
|
status: "fail",
|
|
39592
39593
|
message: `v${installedVersion} (latest: v${latestVersion})`,
|
|
39593
39594
|
details: "Major version behind",
|
|
39594
|
-
suggestion: "Run:
|
|
39595
|
+
suggestion: "Run: tkm update",
|
|
39595
39596
|
autoFixable: false
|
|
39596
39597
|
};
|
|
39597
39598
|
}
|
|
@@ -39604,7 +39605,7 @@ async function checkCliVersion() {
|
|
|
39604
39605
|
status: "warn",
|
|
39605
39606
|
message: `v${installedVersion} (latest: v${latestVersion})`,
|
|
39606
39607
|
details: "Minor version behind",
|
|
39607
|
-
suggestion: "Run:
|
|
39608
|
+
suggestion: "Run: tkm update",
|
|
39608
39609
|
autoFixable: false
|
|
39609
39610
|
};
|
|
39610
39611
|
}
|
|
@@ -39617,7 +39618,7 @@ async function checkCliVersion() {
|
|
|
39617
39618
|
status: "info",
|
|
39618
39619
|
message: `v${installedVersion} (latest: v${latestVersion})`,
|
|
39619
39620
|
details: "Patch update available",
|
|
39620
|
-
suggestion: "Run:
|
|
39621
|
+
suggestion: "Run: tkm update",
|
|
39621
39622
|
autoFixable: false
|
|
39622
39623
|
};
|
|
39623
39624
|
}
|
|
@@ -41422,11 +41423,11 @@ class DoctorUIRenderer {
|
|
|
41422
41423
|
console.log(`│ Summary: ${parts.join(" ")}`);
|
|
41423
41424
|
console.log("│");
|
|
41424
41425
|
console.log(`│ ${import_picocolors13.default.dim("Quick Commands:")}`);
|
|
41425
|
-
console.log(`│ ${import_picocolors13.default.dim("
|
|
41426
|
-
console.log(`│ ${import_picocolors13.default.dim("
|
|
41427
|
-
console.log(`│ ${import_picocolors13.default.dim("
|
|
41428
|
-
console.log(`│ ${import_picocolors13.default.dim("
|
|
41429
|
-
console.log(`│ ${import_picocolors13.default.dim("
|
|
41426
|
+
console.log(`│ ${import_picocolors13.default.dim(" tkm init Install/update Takumi in project")}`);
|
|
41427
|
+
console.log(`│ ${import_picocolors13.default.dim(" tkm init -g Install/update Takumi globally")}`);
|
|
41428
|
+
console.log(`│ ${import_picocolors13.default.dim(" tkm update Update the CLI tool")}`);
|
|
41429
|
+
console.log(`│ ${import_picocolors13.default.dim(" tkm uninstall Remove Takumi from project/global")}`);
|
|
41430
|
+
console.log(`│ ${import_picocolors13.default.dim(" tkm --help Show all commands")}`);
|
|
41430
41431
|
}
|
|
41431
41432
|
}
|
|
41432
41433
|
// src/commands/doctor.ts
|
|
@@ -42156,334 +42157,7 @@ class OwnershipChecker {
|
|
|
42156
42157
|
|
|
42157
42158
|
// src/domains/sync/sync-engine.ts
|
|
42158
42159
|
init_logger();
|
|
42159
|
-
// node_modules/diff/libesm/util/string.js
|
|
42160
|
-
function hasOnlyWinLineEndings(string) {
|
|
42161
|
-
return string.includes(`\r
|
|
42162
|
-
`) && !string.startsWith(`
|
|
42163
|
-
`) && !string.match(/[^\r]\n/);
|
|
42164
|
-
}
|
|
42165
|
-
function hasOnlyUnixLineEndings(string) {
|
|
42166
|
-
return !string.includes(`\r
|
|
42167
|
-
`) && string.includes(`
|
|
42168
|
-
`);
|
|
42169
|
-
}
|
|
42170
|
-
|
|
42171
|
-
// node_modules/diff/libesm/patch/line-endings.js
|
|
42172
|
-
function unixToWin(patch) {
|
|
42173
|
-
if (Array.isArray(patch)) {
|
|
42174
|
-
return patch.map((p) => unixToWin(p));
|
|
42175
|
-
}
|
|
42176
|
-
return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line, i) => {
|
|
42177
|
-
var _a;
|
|
42178
|
-
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\")) ? line : line + "\r";
|
|
42179
|
-
}) })) });
|
|
42180
|
-
}
|
|
42181
|
-
function winToUnix(patch) {
|
|
42182
|
-
if (Array.isArray(patch)) {
|
|
42183
|
-
return patch.map((p) => winToUnix(p));
|
|
42184
|
-
}
|
|
42185
|
-
return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line) => line.endsWith("\r") ? line.substring(0, line.length - 1) : line) })) });
|
|
42186
|
-
}
|
|
42187
|
-
function isUnix(patch) {
|
|
42188
|
-
if (!Array.isArray(patch)) {
|
|
42189
|
-
patch = [patch];
|
|
42190
|
-
}
|
|
42191
|
-
return !patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => !line.startsWith("\\") && line.endsWith("\r"))));
|
|
42192
|
-
}
|
|
42193
|
-
function isWin(patch) {
|
|
42194
|
-
if (!Array.isArray(patch)) {
|
|
42195
|
-
patch = [patch];
|
|
42196
|
-
}
|
|
42197
|
-
return patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => line.endsWith("\r")))) && patch.every((index) => index.hunks.every((hunk) => hunk.lines.every((line, i) => {
|
|
42198
|
-
var _a;
|
|
42199
|
-
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\"));
|
|
42200
|
-
})));
|
|
42201
|
-
}
|
|
42202
|
-
|
|
42203
|
-
// node_modules/diff/libesm/patch/parse.js
|
|
42204
|
-
function parsePatch(uniDiff) {
|
|
42205
|
-
const diffstr = uniDiff.split(/\n/), list = [];
|
|
42206
|
-
let i = 0;
|
|
42207
|
-
function parseIndex() {
|
|
42208
|
-
const index = {};
|
|
42209
|
-
list.push(index);
|
|
42210
|
-
while (i < diffstr.length) {
|
|
42211
|
-
const line = diffstr[i];
|
|
42212
|
-
if (/^(---|\+\+\+|@@)\s/.test(line)) {
|
|
42213
|
-
break;
|
|
42214
|
-
}
|
|
42215
|
-
const headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
|
|
42216
|
-
if (headerMatch) {
|
|
42217
|
-
index.index = line.substring(headerMatch[0].length).trim();
|
|
42218
|
-
}
|
|
42219
|
-
i++;
|
|
42220
|
-
}
|
|
42221
|
-
parseFileHeader(index);
|
|
42222
|
-
parseFileHeader(index);
|
|
42223
|
-
index.hunks = [];
|
|
42224
|
-
while (i < diffstr.length) {
|
|
42225
|
-
const line = diffstr[i];
|
|
42226
|
-
if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line)) {
|
|
42227
|
-
break;
|
|
42228
|
-
} else if (/^@@/.test(line)) {
|
|
42229
|
-
index.hunks.push(parseHunk());
|
|
42230
|
-
} else if (line) {
|
|
42231
|
-
throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
|
|
42232
|
-
} else {
|
|
42233
|
-
i++;
|
|
42234
|
-
}
|
|
42235
|
-
}
|
|
42236
|
-
}
|
|
42237
|
-
function parseFileHeader(index) {
|
|
42238
|
-
const fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
|
|
42239
|
-
if (fileHeaderMatch) {
|
|
42240
|
-
const prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split("\t", 2), header = (data[1] || "").trim();
|
|
42241
|
-
let fileName = data[0].replace(/\\\\/g, "\\");
|
|
42242
|
-
if (fileName.startsWith('"') && fileName.endsWith('"')) {
|
|
42243
|
-
fileName = fileName.substr(1, fileName.length - 2);
|
|
42244
|
-
}
|
|
42245
|
-
if (prefix === "---") {
|
|
42246
|
-
index.oldFileName = fileName;
|
|
42247
|
-
index.oldHeader = header;
|
|
42248
|
-
} else {
|
|
42249
|
-
index.newFileName = fileName;
|
|
42250
|
-
index.newHeader = header;
|
|
42251
|
-
}
|
|
42252
|
-
i++;
|
|
42253
|
-
}
|
|
42254
|
-
}
|
|
42255
|
-
function parseHunk() {
|
|
42256
|
-
var _a;
|
|
42257
|
-
const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
42258
|
-
const hunk = {
|
|
42259
|
-
oldStart: +chunkHeader[1],
|
|
42260
|
-
oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
|
|
42261
|
-
newStart: +chunkHeader[3],
|
|
42262
|
-
newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
|
|
42263
|
-
lines: []
|
|
42264
|
-
};
|
|
42265
|
-
if (hunk.oldLines === 0) {
|
|
42266
|
-
hunk.oldStart += 1;
|
|
42267
|
-
}
|
|
42268
|
-
if (hunk.newLines === 0) {
|
|
42269
|
-
hunk.newStart += 1;
|
|
42270
|
-
}
|
|
42271
|
-
let addCount = 0, removeCount = 0;
|
|
42272
|
-
for (;i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === undefined ? undefined : _a.startsWith("\\"))); i++) {
|
|
42273
|
-
const operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
|
|
42274
|
-
if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
|
|
42275
|
-
hunk.lines.push(diffstr[i]);
|
|
42276
|
-
if (operation === "+") {
|
|
42277
|
-
addCount++;
|
|
42278
|
-
} else if (operation === "-") {
|
|
42279
|
-
removeCount++;
|
|
42280
|
-
} else if (operation === " ") {
|
|
42281
|
-
addCount++;
|
|
42282
|
-
removeCount++;
|
|
42283
|
-
}
|
|
42284
|
-
} else {
|
|
42285
|
-
throw new Error(`Hunk at line ${chunkHeaderIndex + 1} contained invalid line ${diffstr[i]}`);
|
|
42286
|
-
}
|
|
42287
|
-
}
|
|
42288
|
-
if (!addCount && hunk.newLines === 1) {
|
|
42289
|
-
hunk.newLines = 0;
|
|
42290
|
-
}
|
|
42291
|
-
if (!removeCount && hunk.oldLines === 1) {
|
|
42292
|
-
hunk.oldLines = 0;
|
|
42293
|
-
}
|
|
42294
|
-
if (addCount !== hunk.newLines) {
|
|
42295
|
-
throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
42296
|
-
}
|
|
42297
|
-
if (removeCount !== hunk.oldLines) {
|
|
42298
|
-
throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
42299
|
-
}
|
|
42300
|
-
return hunk;
|
|
42301
|
-
}
|
|
42302
|
-
while (i < diffstr.length) {
|
|
42303
|
-
parseIndex();
|
|
42304
|
-
}
|
|
42305
|
-
return list;
|
|
42306
|
-
}
|
|
42307
42160
|
|
|
42308
|
-
// node_modules/diff/libesm/util/distance-iterator.js
|
|
42309
|
-
function distance_iterator_default(start, minLine, maxLine) {
|
|
42310
|
-
let wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
|
|
42311
|
-
return function iterator() {
|
|
42312
|
-
if (wantForward && !forwardExhausted) {
|
|
42313
|
-
if (backwardExhausted) {
|
|
42314
|
-
localOffset++;
|
|
42315
|
-
} else {
|
|
42316
|
-
wantForward = false;
|
|
42317
|
-
}
|
|
42318
|
-
if (start + localOffset <= maxLine) {
|
|
42319
|
-
return start + localOffset;
|
|
42320
|
-
}
|
|
42321
|
-
forwardExhausted = true;
|
|
42322
|
-
}
|
|
42323
|
-
if (!backwardExhausted) {
|
|
42324
|
-
if (!forwardExhausted) {
|
|
42325
|
-
wantForward = true;
|
|
42326
|
-
}
|
|
42327
|
-
if (minLine <= start - localOffset) {
|
|
42328
|
-
return start - localOffset++;
|
|
42329
|
-
}
|
|
42330
|
-
backwardExhausted = true;
|
|
42331
|
-
return iterator();
|
|
42332
|
-
}
|
|
42333
|
-
return;
|
|
42334
|
-
};
|
|
42335
|
-
}
|
|
42336
|
-
|
|
42337
|
-
// node_modules/diff/libesm/patch/apply.js
|
|
42338
|
-
function applyPatch(source, patch, options2 = {}) {
|
|
42339
|
-
let patches;
|
|
42340
|
-
if (typeof patch === "string") {
|
|
42341
|
-
patches = parsePatch(patch);
|
|
42342
|
-
} else if (Array.isArray(patch)) {
|
|
42343
|
-
patches = patch;
|
|
42344
|
-
} else {
|
|
42345
|
-
patches = [patch];
|
|
42346
|
-
}
|
|
42347
|
-
if (patches.length > 1) {
|
|
42348
|
-
throw new Error("applyPatch only works with a single input.");
|
|
42349
|
-
}
|
|
42350
|
-
return applyStructuredPatch(source, patches[0], options2);
|
|
42351
|
-
}
|
|
42352
|
-
function applyStructuredPatch(source, patch, options2 = {}) {
|
|
42353
|
-
if (options2.autoConvertLineEndings || options2.autoConvertLineEndings == null) {
|
|
42354
|
-
if (hasOnlyWinLineEndings(source) && isUnix(patch)) {
|
|
42355
|
-
patch = unixToWin(patch);
|
|
42356
|
-
} else if (hasOnlyUnixLineEndings(source) && isWin(patch)) {
|
|
42357
|
-
patch = winToUnix(patch);
|
|
42358
|
-
}
|
|
42359
|
-
}
|
|
42360
|
-
const lines = source.split(`
|
|
42361
|
-
`), hunks = patch.hunks, compareLine = options2.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent), fuzzFactor = options2.fuzzFactor || 0;
|
|
42362
|
-
let minLine = 0;
|
|
42363
|
-
if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {
|
|
42364
|
-
throw new Error("fuzzFactor must be a non-negative integer");
|
|
42365
|
-
}
|
|
42366
|
-
if (!hunks.length) {
|
|
42367
|
-
return source;
|
|
42368
|
-
}
|
|
42369
|
-
let prevLine = "", removeEOFNL = false, addEOFNL = false;
|
|
42370
|
-
for (let i = 0;i < hunks[hunks.length - 1].lines.length; i++) {
|
|
42371
|
-
const line = hunks[hunks.length - 1].lines[i];
|
|
42372
|
-
if (line[0] == "\\") {
|
|
42373
|
-
if (prevLine[0] == "+") {
|
|
42374
|
-
removeEOFNL = true;
|
|
42375
|
-
} else if (prevLine[0] == "-") {
|
|
42376
|
-
addEOFNL = true;
|
|
42377
|
-
}
|
|
42378
|
-
}
|
|
42379
|
-
prevLine = line;
|
|
42380
|
-
}
|
|
42381
|
-
if (removeEOFNL) {
|
|
42382
|
-
if (addEOFNL) {
|
|
42383
|
-
if (!fuzzFactor && lines[lines.length - 1] == "") {
|
|
42384
|
-
return false;
|
|
42385
|
-
}
|
|
42386
|
-
} else if (lines[lines.length - 1] == "") {
|
|
42387
|
-
lines.pop();
|
|
42388
|
-
} else if (!fuzzFactor) {
|
|
42389
|
-
return false;
|
|
42390
|
-
}
|
|
42391
|
-
} else if (addEOFNL) {
|
|
42392
|
-
if (lines[lines.length - 1] != "") {
|
|
42393
|
-
lines.push("");
|
|
42394
|
-
} else if (!fuzzFactor) {
|
|
42395
|
-
return false;
|
|
42396
|
-
}
|
|
42397
|
-
}
|
|
42398
|
-
function applyHunk(hunkLines, toPos, maxErrors, hunkLinesI = 0, lastContextLineMatched = true, patchedLines = [], patchedLinesLength = 0) {
|
|
42399
|
-
let nConsecutiveOldContextLines = 0;
|
|
42400
|
-
let nextContextLineMustMatch = false;
|
|
42401
|
-
for (;hunkLinesI < hunkLines.length; hunkLinesI++) {
|
|
42402
|
-
const hunkLine = hunkLines[hunkLinesI], operation = hunkLine.length > 0 ? hunkLine[0] : " ", content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine;
|
|
42403
|
-
if (operation === "-") {
|
|
42404
|
-
if (compareLine(toPos + 1, lines[toPos], operation, content)) {
|
|
42405
|
-
toPos++;
|
|
42406
|
-
nConsecutiveOldContextLines = 0;
|
|
42407
|
-
} else {
|
|
42408
|
-
if (!maxErrors || lines[toPos] == null) {
|
|
42409
|
-
return null;
|
|
42410
|
-
}
|
|
42411
|
-
patchedLines[patchedLinesLength] = lines[toPos];
|
|
42412
|
-
return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1);
|
|
42413
|
-
}
|
|
42414
|
-
}
|
|
42415
|
-
if (operation === "+") {
|
|
42416
|
-
if (!lastContextLineMatched) {
|
|
42417
|
-
return null;
|
|
42418
|
-
}
|
|
42419
|
-
patchedLines[patchedLinesLength] = content;
|
|
42420
|
-
patchedLinesLength++;
|
|
42421
|
-
nConsecutiveOldContextLines = 0;
|
|
42422
|
-
nextContextLineMustMatch = true;
|
|
42423
|
-
}
|
|
42424
|
-
if (operation === " ") {
|
|
42425
|
-
nConsecutiveOldContextLines++;
|
|
42426
|
-
patchedLines[patchedLinesLength] = lines[toPos];
|
|
42427
|
-
if (compareLine(toPos + 1, lines[toPos], operation, content)) {
|
|
42428
|
-
patchedLinesLength++;
|
|
42429
|
-
lastContextLineMatched = true;
|
|
42430
|
-
nextContextLineMustMatch = false;
|
|
42431
|
-
toPos++;
|
|
42432
|
-
} else {
|
|
42433
|
-
if (nextContextLineMustMatch || !maxErrors) {
|
|
42434
|
-
return null;
|
|
42435
|
-
}
|
|
42436
|
-
return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength);
|
|
42437
|
-
}
|
|
42438
|
-
}
|
|
42439
|
-
}
|
|
42440
|
-
patchedLinesLength -= nConsecutiveOldContextLines;
|
|
42441
|
-
toPos -= nConsecutiveOldContextLines;
|
|
42442
|
-
patchedLines.length = patchedLinesLength;
|
|
42443
|
-
return {
|
|
42444
|
-
patchedLines,
|
|
42445
|
-
oldLineLastI: toPos - 1
|
|
42446
|
-
};
|
|
42447
|
-
}
|
|
42448
|
-
const resultLines = [];
|
|
42449
|
-
let prevHunkOffset = 0;
|
|
42450
|
-
for (let i = 0;i < hunks.length; i++) {
|
|
42451
|
-
const hunk = hunks[i];
|
|
42452
|
-
let hunkResult;
|
|
42453
|
-
const maxLine = lines.length - hunk.oldLines + fuzzFactor;
|
|
42454
|
-
let toPos;
|
|
42455
|
-
for (let maxErrors = 0;maxErrors <= fuzzFactor; maxErrors++) {
|
|
42456
|
-
toPos = hunk.oldStart + prevHunkOffset - 1;
|
|
42457
|
-
const iterator = distance_iterator_default(toPos, minLine, maxLine);
|
|
42458
|
-
for (;toPos !== undefined; toPos = iterator()) {
|
|
42459
|
-
hunkResult = applyHunk(hunk.lines, toPos, maxErrors);
|
|
42460
|
-
if (hunkResult) {
|
|
42461
|
-
break;
|
|
42462
|
-
}
|
|
42463
|
-
}
|
|
42464
|
-
if (hunkResult) {
|
|
42465
|
-
break;
|
|
42466
|
-
}
|
|
42467
|
-
}
|
|
42468
|
-
if (!hunkResult) {
|
|
42469
|
-
return false;
|
|
42470
|
-
}
|
|
42471
|
-
for (let i2 = minLine;i2 < toPos; i2++) {
|
|
42472
|
-
resultLines.push(lines[i2]);
|
|
42473
|
-
}
|
|
42474
|
-
for (let i2 = 0;i2 < hunkResult.patchedLines.length; i2++) {
|
|
42475
|
-
const line = hunkResult.patchedLines[i2];
|
|
42476
|
-
resultLines.push(line);
|
|
42477
|
-
}
|
|
42478
|
-
minLine = hunkResult.oldLineLastI + 1;
|
|
42479
|
-
prevHunkOffset = toPos + 1 - hunk.oldStart;
|
|
42480
|
-
}
|
|
42481
|
-
for (let i = minLine;i < lines.length; i++) {
|
|
42482
|
-
resultLines.push(lines[i]);
|
|
42483
|
-
}
|
|
42484
|
-
return resultLines.join(`
|
|
42485
|
-
`);
|
|
42486
|
-
}
|
|
42487
42161
|
// node_modules/diff/libesm/diff/base.js
|
|
42488
42162
|
class Diff {
|
|
42489
42163
|
diff(oldStr, newStr, options2 = {}) {
|
|
@@ -42565,13 +42239,13 @@ class Diff {
|
|
|
42565
42239
|
editLength++;
|
|
42566
42240
|
};
|
|
42567
42241
|
if (callback) {
|
|
42568
|
-
(function
|
|
42242
|
+
(function exec() {
|
|
42569
42243
|
setTimeout(function() {
|
|
42570
42244
|
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
42571
42245
|
return callback(undefined);
|
|
42572
42246
|
}
|
|
42573
42247
|
if (!execEditLength()) {
|
|
42574
|
-
|
|
42248
|
+
exec();
|
|
42575
42249
|
}
|
|
42576
42250
|
}, 0);
|
|
42577
42251
|
})();
|
|
@@ -42684,6 +42358,285 @@ class Diff {
|
|
|
42684
42358
|
}
|
|
42685
42359
|
}
|
|
42686
42360
|
|
|
42361
|
+
// node_modules/diff/libesm/diff/character.js
|
|
42362
|
+
class CharacterDiff extends Diff {
|
|
42363
|
+
}
|
|
42364
|
+
var characterDiff = new CharacterDiff;
|
|
42365
|
+
|
|
42366
|
+
// node_modules/diff/libesm/util/string.js
|
|
42367
|
+
function longestCommonPrefix(str1, str2) {
|
|
42368
|
+
let i;
|
|
42369
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
42370
|
+
if (str1[i] != str2[i]) {
|
|
42371
|
+
return str1.slice(0, i);
|
|
42372
|
+
}
|
|
42373
|
+
}
|
|
42374
|
+
return str1.slice(0, i);
|
|
42375
|
+
}
|
|
42376
|
+
function longestCommonSuffix(str1, str2) {
|
|
42377
|
+
let i;
|
|
42378
|
+
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
42379
|
+
return "";
|
|
42380
|
+
}
|
|
42381
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
42382
|
+
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
42383
|
+
return str1.slice(-i);
|
|
42384
|
+
}
|
|
42385
|
+
}
|
|
42386
|
+
return str1.slice(-i);
|
|
42387
|
+
}
|
|
42388
|
+
function replacePrefix(string, oldPrefix, newPrefix) {
|
|
42389
|
+
if (string.slice(0, oldPrefix.length) != oldPrefix) {
|
|
42390
|
+
throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
|
|
42391
|
+
}
|
|
42392
|
+
return newPrefix + string.slice(oldPrefix.length);
|
|
42393
|
+
}
|
|
42394
|
+
function replaceSuffix(string, oldSuffix, newSuffix) {
|
|
42395
|
+
if (!oldSuffix) {
|
|
42396
|
+
return string + newSuffix;
|
|
42397
|
+
}
|
|
42398
|
+
if (string.slice(-oldSuffix.length) != oldSuffix) {
|
|
42399
|
+
throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
|
|
42400
|
+
}
|
|
42401
|
+
return string.slice(0, -oldSuffix.length) + newSuffix;
|
|
42402
|
+
}
|
|
42403
|
+
function removePrefix(string, oldPrefix) {
|
|
42404
|
+
return replacePrefix(string, oldPrefix, "");
|
|
42405
|
+
}
|
|
42406
|
+
function removeSuffix(string, oldSuffix) {
|
|
42407
|
+
return replaceSuffix(string, oldSuffix, "");
|
|
42408
|
+
}
|
|
42409
|
+
function maximumOverlap(string1, string2) {
|
|
42410
|
+
return string2.slice(0, overlapCount(string1, string2));
|
|
42411
|
+
}
|
|
42412
|
+
function overlapCount(a3, b3) {
|
|
42413
|
+
let startA = 0;
|
|
42414
|
+
if (a3.length > b3.length) {
|
|
42415
|
+
startA = a3.length - b3.length;
|
|
42416
|
+
}
|
|
42417
|
+
let endB = b3.length;
|
|
42418
|
+
if (a3.length < b3.length) {
|
|
42419
|
+
endB = a3.length;
|
|
42420
|
+
}
|
|
42421
|
+
const map = Array(endB);
|
|
42422
|
+
let k2 = 0;
|
|
42423
|
+
map[0] = 0;
|
|
42424
|
+
for (let j2 = 1;j2 < endB; j2++) {
|
|
42425
|
+
if (b3[j2] == b3[k2]) {
|
|
42426
|
+
map[j2] = map[k2];
|
|
42427
|
+
} else {
|
|
42428
|
+
map[j2] = k2;
|
|
42429
|
+
}
|
|
42430
|
+
while (k2 > 0 && b3[j2] != b3[k2]) {
|
|
42431
|
+
k2 = map[k2];
|
|
42432
|
+
}
|
|
42433
|
+
if (b3[j2] == b3[k2]) {
|
|
42434
|
+
k2++;
|
|
42435
|
+
}
|
|
42436
|
+
}
|
|
42437
|
+
k2 = 0;
|
|
42438
|
+
for (let i = startA;i < a3.length; i++) {
|
|
42439
|
+
while (k2 > 0 && a3[i] != b3[k2]) {
|
|
42440
|
+
k2 = map[k2];
|
|
42441
|
+
}
|
|
42442
|
+
if (a3[i] == b3[k2]) {
|
|
42443
|
+
k2++;
|
|
42444
|
+
}
|
|
42445
|
+
}
|
|
42446
|
+
return k2;
|
|
42447
|
+
}
|
|
42448
|
+
function hasOnlyWinLineEndings(string) {
|
|
42449
|
+
return string.includes(`\r
|
|
42450
|
+
`) && !string.startsWith(`
|
|
42451
|
+
`) && !string.match(/[^\r]\n/);
|
|
42452
|
+
}
|
|
42453
|
+
function hasOnlyUnixLineEndings(string) {
|
|
42454
|
+
return !string.includes(`\r
|
|
42455
|
+
`) && string.includes(`
|
|
42456
|
+
`);
|
|
42457
|
+
}
|
|
42458
|
+
function segment(string, segmenter2) {
|
|
42459
|
+
const parts = [];
|
|
42460
|
+
for (const segmentObj of Array.from(segmenter2.segment(string))) {
|
|
42461
|
+
const segment2 = segmentObj.segment;
|
|
42462
|
+
if (parts.length && /\s/.test(parts[parts.length - 1]) && /\s/.test(segment2)) {
|
|
42463
|
+
parts[parts.length - 1] += segment2;
|
|
42464
|
+
} else {
|
|
42465
|
+
parts.push(segment2);
|
|
42466
|
+
}
|
|
42467
|
+
}
|
|
42468
|
+
return parts;
|
|
42469
|
+
}
|
|
42470
|
+
function trailingWs(string, segmenter2) {
|
|
42471
|
+
if (segmenter2) {
|
|
42472
|
+
return leadingAndTrailingWs(string, segmenter2)[1];
|
|
42473
|
+
}
|
|
42474
|
+
let i;
|
|
42475
|
+
for (i = string.length - 1;i >= 0; i--) {
|
|
42476
|
+
if (!string[i].match(/\s/)) {
|
|
42477
|
+
break;
|
|
42478
|
+
}
|
|
42479
|
+
}
|
|
42480
|
+
return string.substring(i + 1);
|
|
42481
|
+
}
|
|
42482
|
+
function leadingWs(string, segmenter2) {
|
|
42483
|
+
if (segmenter2) {
|
|
42484
|
+
return leadingAndTrailingWs(string, segmenter2)[0];
|
|
42485
|
+
}
|
|
42486
|
+
const match = string.match(/^\s*/);
|
|
42487
|
+
return match ? match[0] : "";
|
|
42488
|
+
}
|
|
42489
|
+
function leadingAndTrailingWs(string, segmenter2) {
|
|
42490
|
+
if (!segmenter2) {
|
|
42491
|
+
return [leadingWs(string), trailingWs(string)];
|
|
42492
|
+
}
|
|
42493
|
+
if (segmenter2.resolvedOptions().granularity != "word") {
|
|
42494
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
42495
|
+
}
|
|
42496
|
+
const segments = segment(string, segmenter2);
|
|
42497
|
+
const firstSeg = segments[0];
|
|
42498
|
+
const lastSeg = segments[segments.length - 1];
|
|
42499
|
+
const head = /\s/.test(firstSeg) ? firstSeg : "";
|
|
42500
|
+
const tail = /\s/.test(lastSeg) ? lastSeg : "";
|
|
42501
|
+
return [head, tail];
|
|
42502
|
+
}
|
|
42503
|
+
|
|
42504
|
+
// node_modules/diff/libesm/diff/word.js
|
|
42505
|
+
var extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
|
|
42506
|
+
var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
|
|
42507
|
+
|
|
42508
|
+
class WordDiff extends Diff {
|
|
42509
|
+
equals(left, right, options2) {
|
|
42510
|
+
if (options2.ignoreCase) {
|
|
42511
|
+
left = left.toLowerCase();
|
|
42512
|
+
right = right.toLowerCase();
|
|
42513
|
+
}
|
|
42514
|
+
return left.trim() === right.trim();
|
|
42515
|
+
}
|
|
42516
|
+
tokenize(value, options2 = {}) {
|
|
42517
|
+
let parts;
|
|
42518
|
+
if (options2.intlSegmenter) {
|
|
42519
|
+
const segmenter2 = options2.intlSegmenter;
|
|
42520
|
+
if (segmenter2.resolvedOptions().granularity != "word") {
|
|
42521
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
42522
|
+
}
|
|
42523
|
+
parts = segment(value, segmenter2);
|
|
42524
|
+
} else {
|
|
42525
|
+
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
42526
|
+
}
|
|
42527
|
+
const tokens = [];
|
|
42528
|
+
let prevPart = null;
|
|
42529
|
+
parts.forEach((part) => {
|
|
42530
|
+
if (/\s/.test(part)) {
|
|
42531
|
+
if (prevPart == null) {
|
|
42532
|
+
tokens.push(part);
|
|
42533
|
+
} else {
|
|
42534
|
+
tokens.push(tokens.pop() + part);
|
|
42535
|
+
}
|
|
42536
|
+
} else if (prevPart != null && /\s/.test(prevPart)) {
|
|
42537
|
+
if (tokens[tokens.length - 1] == prevPart) {
|
|
42538
|
+
tokens.push(tokens.pop() + part);
|
|
42539
|
+
} else {
|
|
42540
|
+
tokens.push(prevPart + part);
|
|
42541
|
+
}
|
|
42542
|
+
} else {
|
|
42543
|
+
tokens.push(part);
|
|
42544
|
+
}
|
|
42545
|
+
prevPart = part;
|
|
42546
|
+
});
|
|
42547
|
+
return tokens;
|
|
42548
|
+
}
|
|
42549
|
+
join(tokens) {
|
|
42550
|
+
return tokens.map((token, i) => {
|
|
42551
|
+
if (i == 0) {
|
|
42552
|
+
return token;
|
|
42553
|
+
} else {
|
|
42554
|
+
return token.replace(/^\s+/, "");
|
|
42555
|
+
}
|
|
42556
|
+
}).join("");
|
|
42557
|
+
}
|
|
42558
|
+
postProcess(changes, options2) {
|
|
42559
|
+
if (!changes || options2.oneChangePerToken) {
|
|
42560
|
+
return changes;
|
|
42561
|
+
}
|
|
42562
|
+
let lastKeep = null;
|
|
42563
|
+
let insertion = null;
|
|
42564
|
+
let deletion = null;
|
|
42565
|
+
changes.forEach((change) => {
|
|
42566
|
+
if (change.added) {
|
|
42567
|
+
insertion = change;
|
|
42568
|
+
} else if (change.removed) {
|
|
42569
|
+
deletion = change;
|
|
42570
|
+
} else {
|
|
42571
|
+
if (insertion || deletion) {
|
|
42572
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options2.intlSegmenter);
|
|
42573
|
+
}
|
|
42574
|
+
lastKeep = change;
|
|
42575
|
+
insertion = null;
|
|
42576
|
+
deletion = null;
|
|
42577
|
+
}
|
|
42578
|
+
});
|
|
42579
|
+
if (insertion || deletion) {
|
|
42580
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options2.intlSegmenter);
|
|
42581
|
+
}
|
|
42582
|
+
return changes;
|
|
42583
|
+
}
|
|
42584
|
+
}
|
|
42585
|
+
var wordDiff = new WordDiff;
|
|
42586
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter2) {
|
|
42587
|
+
if (deletion && insertion) {
|
|
42588
|
+
const [oldWsPrefix, oldWsSuffix] = leadingAndTrailingWs(deletion.value, segmenter2);
|
|
42589
|
+
const [newWsPrefix, newWsSuffix] = leadingAndTrailingWs(insertion.value, segmenter2);
|
|
42590
|
+
if (startKeep) {
|
|
42591
|
+
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
42592
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
42593
|
+
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
42594
|
+
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
42595
|
+
}
|
|
42596
|
+
if (endKeep) {
|
|
42597
|
+
const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
42598
|
+
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
42599
|
+
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
42600
|
+
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
42601
|
+
}
|
|
42602
|
+
} else if (insertion) {
|
|
42603
|
+
if (startKeep) {
|
|
42604
|
+
const ws = leadingWs(insertion.value, segmenter2);
|
|
42605
|
+
insertion.value = insertion.value.substring(ws.length);
|
|
42606
|
+
}
|
|
42607
|
+
if (endKeep) {
|
|
42608
|
+
const ws = leadingWs(endKeep.value, segmenter2);
|
|
42609
|
+
endKeep.value = endKeep.value.substring(ws.length);
|
|
42610
|
+
}
|
|
42611
|
+
} else if (startKeep && endKeep) {
|
|
42612
|
+
const newWsFull = leadingWs(endKeep.value, segmenter2), [delWsStart, delWsEnd] = leadingAndTrailingWs(deletion.value, segmenter2);
|
|
42613
|
+
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
42614
|
+
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
42615
|
+
const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
42616
|
+
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
42617
|
+
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
42618
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
42619
|
+
} else if (endKeep) {
|
|
42620
|
+
const endKeepWsPrefix = leadingWs(endKeep.value, segmenter2);
|
|
42621
|
+
const deletionWsSuffix = trailingWs(deletion.value, segmenter2);
|
|
42622
|
+
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
42623
|
+
deletion.value = removeSuffix(deletion.value, overlap);
|
|
42624
|
+
} else if (startKeep) {
|
|
42625
|
+
const startKeepWsSuffix = trailingWs(startKeep.value, segmenter2);
|
|
42626
|
+
const deletionWsPrefix = leadingWs(deletion.value, segmenter2);
|
|
42627
|
+
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
42628
|
+
deletion.value = removePrefix(deletion.value, overlap);
|
|
42629
|
+
}
|
|
42630
|
+
}
|
|
42631
|
+
|
|
42632
|
+
class WordsWithSpaceDiff extends Diff {
|
|
42633
|
+
tokenize(value) {
|
|
42634
|
+
const regex2 = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
|
|
42635
|
+
return value.match(regex2) || [];
|
|
42636
|
+
}
|
|
42637
|
+
}
|
|
42638
|
+
var wordsWithSpaceDiff = new WordsWithSpaceDiff;
|
|
42639
|
+
|
|
42687
42640
|
// node_modules/diff/libesm/diff/line.js
|
|
42688
42641
|
class LineDiff extends Diff {
|
|
42689
42642
|
constructor() {
|
|
@@ -42737,6 +42690,444 @@ function tokenize(value, options2) {
|
|
|
42737
42690
|
return retLines;
|
|
42738
42691
|
}
|
|
42739
42692
|
|
|
42693
|
+
// node_modules/diff/libesm/diff/sentence.js
|
|
42694
|
+
function isSentenceEndPunct(char) {
|
|
42695
|
+
return char == "." || char == "!" || char == "?";
|
|
42696
|
+
}
|
|
42697
|
+
|
|
42698
|
+
class SentenceDiff extends Diff {
|
|
42699
|
+
tokenize(value) {
|
|
42700
|
+
var _a;
|
|
42701
|
+
const result = [];
|
|
42702
|
+
let tokenStartI = 0;
|
|
42703
|
+
for (let i = 0;i < value.length; i++) {
|
|
42704
|
+
if (i == value.length - 1) {
|
|
42705
|
+
result.push(value.slice(tokenStartI));
|
|
42706
|
+
break;
|
|
42707
|
+
}
|
|
42708
|
+
if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
|
|
42709
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
42710
|
+
i = tokenStartI = i + 1;
|
|
42711
|
+
while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
|
|
42712
|
+
i++;
|
|
42713
|
+
}
|
|
42714
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
42715
|
+
tokenStartI = i + 1;
|
|
42716
|
+
}
|
|
42717
|
+
}
|
|
42718
|
+
return result;
|
|
42719
|
+
}
|
|
42720
|
+
}
|
|
42721
|
+
var sentenceDiff = new SentenceDiff;
|
|
42722
|
+
|
|
42723
|
+
// node_modules/diff/libesm/diff/css.js
|
|
42724
|
+
class CssDiff extends Diff {
|
|
42725
|
+
tokenize(value) {
|
|
42726
|
+
return value.split(/([{}:;,]|\s+)/);
|
|
42727
|
+
}
|
|
42728
|
+
}
|
|
42729
|
+
var cssDiff = new CssDiff;
|
|
42730
|
+
|
|
42731
|
+
// node_modules/diff/libesm/diff/json.js
|
|
42732
|
+
class JsonDiff extends Diff {
|
|
42733
|
+
constructor() {
|
|
42734
|
+
super(...arguments);
|
|
42735
|
+
this.tokenize = tokenize;
|
|
42736
|
+
}
|
|
42737
|
+
get useLongestToken() {
|
|
42738
|
+
return true;
|
|
42739
|
+
}
|
|
42740
|
+
castInput(value, options2) {
|
|
42741
|
+
const { undefinedReplacement, stringifyReplacer = (k2, v2) => typeof v2 === "undefined" ? undefinedReplacement : v2 } = options2;
|
|
42742
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
|
|
42743
|
+
}
|
|
42744
|
+
equals(left, right, options2) {
|
|
42745
|
+
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options2);
|
|
42746
|
+
}
|
|
42747
|
+
}
|
|
42748
|
+
var jsonDiff = new JsonDiff;
|
|
42749
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
42750
|
+
stack = stack || [];
|
|
42751
|
+
replacementStack = replacementStack || [];
|
|
42752
|
+
if (replacer) {
|
|
42753
|
+
obj = replacer(key === undefined ? "" : key, obj);
|
|
42754
|
+
}
|
|
42755
|
+
let i;
|
|
42756
|
+
for (i = 0;i < stack.length; i += 1) {
|
|
42757
|
+
if (stack[i] === obj) {
|
|
42758
|
+
return replacementStack[i];
|
|
42759
|
+
}
|
|
42760
|
+
}
|
|
42761
|
+
let canonicalizedObj;
|
|
42762
|
+
if (Object.prototype.toString.call(obj) === "[object Array]") {
|
|
42763
|
+
stack.push(obj);
|
|
42764
|
+
canonicalizedObj = new Array(obj.length);
|
|
42765
|
+
replacementStack.push(canonicalizedObj);
|
|
42766
|
+
for (i = 0;i < obj.length; i += 1) {
|
|
42767
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
42768
|
+
}
|
|
42769
|
+
stack.pop();
|
|
42770
|
+
replacementStack.pop();
|
|
42771
|
+
return canonicalizedObj;
|
|
42772
|
+
}
|
|
42773
|
+
if (obj && obj.toJSON) {
|
|
42774
|
+
obj = obj.toJSON();
|
|
42775
|
+
}
|
|
42776
|
+
if (typeof obj === "object" && obj !== null) {
|
|
42777
|
+
stack.push(obj);
|
|
42778
|
+
canonicalizedObj = {};
|
|
42779
|
+
replacementStack.push(canonicalizedObj);
|
|
42780
|
+
const sortedKeys = [];
|
|
42781
|
+
let key2;
|
|
42782
|
+
for (key2 in obj) {
|
|
42783
|
+
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
42784
|
+
sortedKeys.push(key2);
|
|
42785
|
+
}
|
|
42786
|
+
}
|
|
42787
|
+
sortedKeys.sort();
|
|
42788
|
+
for (i = 0;i < sortedKeys.length; i += 1) {
|
|
42789
|
+
key2 = sortedKeys[i];
|
|
42790
|
+
canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
|
|
42791
|
+
}
|
|
42792
|
+
stack.pop();
|
|
42793
|
+
replacementStack.pop();
|
|
42794
|
+
} else {
|
|
42795
|
+
canonicalizedObj = obj;
|
|
42796
|
+
}
|
|
42797
|
+
return canonicalizedObj;
|
|
42798
|
+
}
|
|
42799
|
+
|
|
42800
|
+
// node_modules/diff/libesm/diff/array.js
|
|
42801
|
+
class ArrayDiff extends Diff {
|
|
42802
|
+
tokenize(value) {
|
|
42803
|
+
return value.slice();
|
|
42804
|
+
}
|
|
42805
|
+
join(value) {
|
|
42806
|
+
return value;
|
|
42807
|
+
}
|
|
42808
|
+
removeEmpty(value) {
|
|
42809
|
+
return value;
|
|
42810
|
+
}
|
|
42811
|
+
}
|
|
42812
|
+
var arrayDiff = new ArrayDiff;
|
|
42813
|
+
|
|
42814
|
+
// node_modules/diff/libesm/patch/line-endings.js
|
|
42815
|
+
function unixToWin(patch) {
|
|
42816
|
+
if (Array.isArray(patch)) {
|
|
42817
|
+
return patch.map((p) => unixToWin(p));
|
|
42818
|
+
}
|
|
42819
|
+
return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line, i) => {
|
|
42820
|
+
var _a;
|
|
42821
|
+
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\")) ? line : line + "\r";
|
|
42822
|
+
}) })) });
|
|
42823
|
+
}
|
|
42824
|
+
function winToUnix(patch) {
|
|
42825
|
+
if (Array.isArray(patch)) {
|
|
42826
|
+
return patch.map((p) => winToUnix(p));
|
|
42827
|
+
}
|
|
42828
|
+
return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line) => line.endsWith("\r") ? line.substring(0, line.length - 1) : line) })) });
|
|
42829
|
+
}
|
|
42830
|
+
function isUnix(patch) {
|
|
42831
|
+
if (!Array.isArray(patch)) {
|
|
42832
|
+
patch = [patch];
|
|
42833
|
+
}
|
|
42834
|
+
return !patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => !line.startsWith("\\") && line.endsWith("\r"))));
|
|
42835
|
+
}
|
|
42836
|
+
function isWin(patch) {
|
|
42837
|
+
if (!Array.isArray(patch)) {
|
|
42838
|
+
patch = [patch];
|
|
42839
|
+
}
|
|
42840
|
+
return patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => line.endsWith("\r")))) && patch.every((index) => index.hunks.every((hunk) => hunk.lines.every((line, i) => {
|
|
42841
|
+
var _a;
|
|
42842
|
+
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\"));
|
|
42843
|
+
})));
|
|
42844
|
+
}
|
|
42845
|
+
|
|
42846
|
+
// node_modules/diff/libesm/patch/parse.js
|
|
42847
|
+
function parsePatch(uniDiff) {
|
|
42848
|
+
const diffstr = uniDiff.split(/\n/), list = [];
|
|
42849
|
+
let i = 0;
|
|
42850
|
+
function parseIndex() {
|
|
42851
|
+
const index = {};
|
|
42852
|
+
list.push(index);
|
|
42853
|
+
while (i < diffstr.length) {
|
|
42854
|
+
const line = diffstr[i];
|
|
42855
|
+
if (/^(---|\+\+\+|@@)\s/.test(line)) {
|
|
42856
|
+
break;
|
|
42857
|
+
}
|
|
42858
|
+
const headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
|
|
42859
|
+
if (headerMatch) {
|
|
42860
|
+
index.index = line.substring(headerMatch[0].length).trim();
|
|
42861
|
+
}
|
|
42862
|
+
i++;
|
|
42863
|
+
}
|
|
42864
|
+
parseFileHeader(index);
|
|
42865
|
+
parseFileHeader(index);
|
|
42866
|
+
index.hunks = [];
|
|
42867
|
+
while (i < diffstr.length) {
|
|
42868
|
+
const line = diffstr[i];
|
|
42869
|
+
if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line)) {
|
|
42870
|
+
break;
|
|
42871
|
+
} else if (/^@@/.test(line)) {
|
|
42872
|
+
index.hunks.push(parseHunk());
|
|
42873
|
+
} else if (line) {
|
|
42874
|
+
throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
|
|
42875
|
+
} else {
|
|
42876
|
+
i++;
|
|
42877
|
+
}
|
|
42878
|
+
}
|
|
42879
|
+
}
|
|
42880
|
+
function parseFileHeader(index) {
|
|
42881
|
+
const fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
|
|
42882
|
+
if (fileHeaderMatch) {
|
|
42883
|
+
const prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split("\t", 2), header = (data[1] || "").trim();
|
|
42884
|
+
let fileName = data[0].replace(/\\\\/g, "\\");
|
|
42885
|
+
if (fileName.startsWith('"') && fileName.endsWith('"')) {
|
|
42886
|
+
fileName = fileName.substr(1, fileName.length - 2);
|
|
42887
|
+
}
|
|
42888
|
+
if (prefix === "---") {
|
|
42889
|
+
index.oldFileName = fileName;
|
|
42890
|
+
index.oldHeader = header;
|
|
42891
|
+
} else {
|
|
42892
|
+
index.newFileName = fileName;
|
|
42893
|
+
index.newHeader = header;
|
|
42894
|
+
}
|
|
42895
|
+
i++;
|
|
42896
|
+
}
|
|
42897
|
+
}
|
|
42898
|
+
function parseHunk() {
|
|
42899
|
+
var _a;
|
|
42900
|
+
const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
42901
|
+
const hunk = {
|
|
42902
|
+
oldStart: +chunkHeader[1],
|
|
42903
|
+
oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
|
|
42904
|
+
newStart: +chunkHeader[3],
|
|
42905
|
+
newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
|
|
42906
|
+
lines: []
|
|
42907
|
+
};
|
|
42908
|
+
if (hunk.oldLines === 0) {
|
|
42909
|
+
hunk.oldStart += 1;
|
|
42910
|
+
}
|
|
42911
|
+
if (hunk.newLines === 0) {
|
|
42912
|
+
hunk.newStart += 1;
|
|
42913
|
+
}
|
|
42914
|
+
let addCount = 0, removeCount = 0;
|
|
42915
|
+
for (;i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === undefined ? undefined : _a.startsWith("\\"))); i++) {
|
|
42916
|
+
const operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
|
|
42917
|
+
if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
|
|
42918
|
+
hunk.lines.push(diffstr[i]);
|
|
42919
|
+
if (operation === "+") {
|
|
42920
|
+
addCount++;
|
|
42921
|
+
} else if (operation === "-") {
|
|
42922
|
+
removeCount++;
|
|
42923
|
+
} else if (operation === " ") {
|
|
42924
|
+
addCount++;
|
|
42925
|
+
removeCount++;
|
|
42926
|
+
}
|
|
42927
|
+
} else {
|
|
42928
|
+
throw new Error(`Hunk at line ${chunkHeaderIndex + 1} contained invalid line ${diffstr[i]}`);
|
|
42929
|
+
}
|
|
42930
|
+
}
|
|
42931
|
+
if (!addCount && hunk.newLines === 1) {
|
|
42932
|
+
hunk.newLines = 0;
|
|
42933
|
+
}
|
|
42934
|
+
if (!removeCount && hunk.oldLines === 1) {
|
|
42935
|
+
hunk.oldLines = 0;
|
|
42936
|
+
}
|
|
42937
|
+
if (addCount !== hunk.newLines) {
|
|
42938
|
+
throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
42939
|
+
}
|
|
42940
|
+
if (removeCount !== hunk.oldLines) {
|
|
42941
|
+
throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
42942
|
+
}
|
|
42943
|
+
return hunk;
|
|
42944
|
+
}
|
|
42945
|
+
while (i < diffstr.length) {
|
|
42946
|
+
parseIndex();
|
|
42947
|
+
}
|
|
42948
|
+
return list;
|
|
42949
|
+
}
|
|
42950
|
+
|
|
42951
|
+
// node_modules/diff/libesm/util/distance-iterator.js
|
|
42952
|
+
function distance_iterator_default(start, minLine, maxLine) {
|
|
42953
|
+
let wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
|
|
42954
|
+
return function iterator() {
|
|
42955
|
+
if (wantForward && !forwardExhausted) {
|
|
42956
|
+
if (backwardExhausted) {
|
|
42957
|
+
localOffset++;
|
|
42958
|
+
} else {
|
|
42959
|
+
wantForward = false;
|
|
42960
|
+
}
|
|
42961
|
+
if (start + localOffset <= maxLine) {
|
|
42962
|
+
return start + localOffset;
|
|
42963
|
+
}
|
|
42964
|
+
forwardExhausted = true;
|
|
42965
|
+
}
|
|
42966
|
+
if (!backwardExhausted) {
|
|
42967
|
+
if (!forwardExhausted) {
|
|
42968
|
+
wantForward = true;
|
|
42969
|
+
}
|
|
42970
|
+
if (minLine <= start - localOffset) {
|
|
42971
|
+
return start - localOffset++;
|
|
42972
|
+
}
|
|
42973
|
+
backwardExhausted = true;
|
|
42974
|
+
return iterator();
|
|
42975
|
+
}
|
|
42976
|
+
return;
|
|
42977
|
+
};
|
|
42978
|
+
}
|
|
42979
|
+
|
|
42980
|
+
// node_modules/diff/libesm/patch/apply.js
|
|
42981
|
+
function applyPatch(source, patch, options2 = {}) {
|
|
42982
|
+
let patches;
|
|
42983
|
+
if (typeof patch === "string") {
|
|
42984
|
+
patches = parsePatch(patch);
|
|
42985
|
+
} else if (Array.isArray(patch)) {
|
|
42986
|
+
patches = patch;
|
|
42987
|
+
} else {
|
|
42988
|
+
patches = [patch];
|
|
42989
|
+
}
|
|
42990
|
+
if (patches.length > 1) {
|
|
42991
|
+
throw new Error("applyPatch only works with a single input.");
|
|
42992
|
+
}
|
|
42993
|
+
return applyStructuredPatch(source, patches[0], options2);
|
|
42994
|
+
}
|
|
42995
|
+
function applyStructuredPatch(source, patch, options2 = {}) {
|
|
42996
|
+
if (options2.autoConvertLineEndings || options2.autoConvertLineEndings == null) {
|
|
42997
|
+
if (hasOnlyWinLineEndings(source) && isUnix(patch)) {
|
|
42998
|
+
patch = unixToWin(patch);
|
|
42999
|
+
} else if (hasOnlyUnixLineEndings(source) && isWin(patch)) {
|
|
43000
|
+
patch = winToUnix(patch);
|
|
43001
|
+
}
|
|
43002
|
+
}
|
|
43003
|
+
const lines = source.split(`
|
|
43004
|
+
`), hunks = patch.hunks, compareLine = options2.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent), fuzzFactor = options2.fuzzFactor || 0;
|
|
43005
|
+
let minLine = 0;
|
|
43006
|
+
if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {
|
|
43007
|
+
throw new Error("fuzzFactor must be a non-negative integer");
|
|
43008
|
+
}
|
|
43009
|
+
if (!hunks.length) {
|
|
43010
|
+
return source;
|
|
43011
|
+
}
|
|
43012
|
+
let prevLine = "", removeEOFNL = false, addEOFNL = false;
|
|
43013
|
+
for (let i = 0;i < hunks[hunks.length - 1].lines.length; i++) {
|
|
43014
|
+
const line = hunks[hunks.length - 1].lines[i];
|
|
43015
|
+
if (line[0] == "\\") {
|
|
43016
|
+
if (prevLine[0] == "+") {
|
|
43017
|
+
removeEOFNL = true;
|
|
43018
|
+
} else if (prevLine[0] == "-") {
|
|
43019
|
+
addEOFNL = true;
|
|
43020
|
+
}
|
|
43021
|
+
}
|
|
43022
|
+
prevLine = line;
|
|
43023
|
+
}
|
|
43024
|
+
if (removeEOFNL) {
|
|
43025
|
+
if (addEOFNL) {
|
|
43026
|
+
if (!fuzzFactor && lines[lines.length - 1] == "") {
|
|
43027
|
+
return false;
|
|
43028
|
+
}
|
|
43029
|
+
} else if (lines[lines.length - 1] == "") {
|
|
43030
|
+
lines.pop();
|
|
43031
|
+
} else if (!fuzzFactor) {
|
|
43032
|
+
return false;
|
|
43033
|
+
}
|
|
43034
|
+
} else if (addEOFNL) {
|
|
43035
|
+
if (lines[lines.length - 1] != "") {
|
|
43036
|
+
lines.push("");
|
|
43037
|
+
} else if (!fuzzFactor) {
|
|
43038
|
+
return false;
|
|
43039
|
+
}
|
|
43040
|
+
}
|
|
43041
|
+
function applyHunk(hunkLines, toPos, maxErrors, hunkLinesI = 0, lastContextLineMatched = true, patchedLines = [], patchedLinesLength = 0) {
|
|
43042
|
+
let nConsecutiveOldContextLines = 0;
|
|
43043
|
+
let nextContextLineMustMatch = false;
|
|
43044
|
+
for (;hunkLinesI < hunkLines.length; hunkLinesI++) {
|
|
43045
|
+
const hunkLine = hunkLines[hunkLinesI], operation = hunkLine.length > 0 ? hunkLine[0] : " ", content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine;
|
|
43046
|
+
if (operation === "-") {
|
|
43047
|
+
if (compareLine(toPos + 1, lines[toPos], operation, content)) {
|
|
43048
|
+
toPos++;
|
|
43049
|
+
nConsecutiveOldContextLines = 0;
|
|
43050
|
+
} else {
|
|
43051
|
+
if (!maxErrors || lines[toPos] == null) {
|
|
43052
|
+
return null;
|
|
43053
|
+
}
|
|
43054
|
+
patchedLines[patchedLinesLength] = lines[toPos];
|
|
43055
|
+
return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1);
|
|
43056
|
+
}
|
|
43057
|
+
}
|
|
43058
|
+
if (operation === "+") {
|
|
43059
|
+
if (!lastContextLineMatched) {
|
|
43060
|
+
return null;
|
|
43061
|
+
}
|
|
43062
|
+
patchedLines[patchedLinesLength] = content;
|
|
43063
|
+
patchedLinesLength++;
|
|
43064
|
+
nConsecutiveOldContextLines = 0;
|
|
43065
|
+
nextContextLineMustMatch = true;
|
|
43066
|
+
}
|
|
43067
|
+
if (operation === " ") {
|
|
43068
|
+
nConsecutiveOldContextLines++;
|
|
43069
|
+
patchedLines[patchedLinesLength] = lines[toPos];
|
|
43070
|
+
if (compareLine(toPos + 1, lines[toPos], operation, content)) {
|
|
43071
|
+
patchedLinesLength++;
|
|
43072
|
+
lastContextLineMatched = true;
|
|
43073
|
+
nextContextLineMustMatch = false;
|
|
43074
|
+
toPos++;
|
|
43075
|
+
} else {
|
|
43076
|
+
if (nextContextLineMustMatch || !maxErrors) {
|
|
43077
|
+
return null;
|
|
43078
|
+
}
|
|
43079
|
+
return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength);
|
|
43080
|
+
}
|
|
43081
|
+
}
|
|
43082
|
+
}
|
|
43083
|
+
patchedLinesLength -= nConsecutiveOldContextLines;
|
|
43084
|
+
toPos -= nConsecutiveOldContextLines;
|
|
43085
|
+
patchedLines.length = patchedLinesLength;
|
|
43086
|
+
return {
|
|
43087
|
+
patchedLines,
|
|
43088
|
+
oldLineLastI: toPos - 1
|
|
43089
|
+
};
|
|
43090
|
+
}
|
|
43091
|
+
const resultLines = [];
|
|
43092
|
+
let prevHunkOffset = 0;
|
|
43093
|
+
for (let i = 0;i < hunks.length; i++) {
|
|
43094
|
+
const hunk = hunks[i];
|
|
43095
|
+
let hunkResult;
|
|
43096
|
+
const maxLine = lines.length - hunk.oldLines + fuzzFactor;
|
|
43097
|
+
let toPos;
|
|
43098
|
+
for (let maxErrors = 0;maxErrors <= fuzzFactor; maxErrors++) {
|
|
43099
|
+
toPos = hunk.oldStart + prevHunkOffset - 1;
|
|
43100
|
+
const iterator = distance_iterator_default(toPos, minLine, maxLine);
|
|
43101
|
+
for (;toPos !== undefined; toPos = iterator()) {
|
|
43102
|
+
hunkResult = applyHunk(hunk.lines, toPos, maxErrors);
|
|
43103
|
+
if (hunkResult) {
|
|
43104
|
+
break;
|
|
43105
|
+
}
|
|
43106
|
+
}
|
|
43107
|
+
if (hunkResult) {
|
|
43108
|
+
break;
|
|
43109
|
+
}
|
|
43110
|
+
}
|
|
43111
|
+
if (!hunkResult) {
|
|
43112
|
+
return false;
|
|
43113
|
+
}
|
|
43114
|
+
for (let i2 = minLine;i2 < toPos; i2++) {
|
|
43115
|
+
resultLines.push(lines[i2]);
|
|
43116
|
+
}
|
|
43117
|
+
for (let i2 = 0;i2 < hunkResult.patchedLines.length; i2++) {
|
|
43118
|
+
const line = hunkResult.patchedLines[i2];
|
|
43119
|
+
resultLines.push(line);
|
|
43120
|
+
}
|
|
43121
|
+
minLine = hunkResult.oldLineLastI + 1;
|
|
43122
|
+
prevHunkOffset = toPos + 1 - hunk.oldStart;
|
|
43123
|
+
}
|
|
43124
|
+
for (let i = minLine;i < lines.length; i++) {
|
|
43125
|
+
resultLines.push(lines[i]);
|
|
43126
|
+
}
|
|
43127
|
+
return resultLines.join(`
|
|
43128
|
+
`);
|
|
43129
|
+
}
|
|
43130
|
+
|
|
42740
43131
|
// node_modules/diff/libesm/patch/create.js
|
|
42741
43132
|
var INCLUDE_HEADERS = {
|
|
42742
43133
|
includeIndex: true,
|
|
@@ -42923,6 +43314,7 @@ function splitLines(text) {
|
|
|
42923
43314
|
}
|
|
42924
43315
|
return result;
|
|
42925
43316
|
}
|
|
43317
|
+
|
|
42926
43318
|
// src/domains/sync/sync-engine.ts
|
|
42927
43319
|
var MAX_SYNC_FILE_SIZE = 10 * 1024 * 1024;
|
|
42928
43320
|
var MAX_SYMLINK_DEPTH = 20;
|
|
@@ -43333,7 +43725,7 @@ function displayConfigUpdateNotification(currentVersion, latestVersion, isGlobal
|
|
|
43333
43725
|
const headerLen = "\uD83D\uDCE6 Config Updates Available".length;
|
|
43334
43726
|
const versionText = `${import_picocolors15.default.dim(displayCurrent)} ${import_picocolors15.default.white("→")} ${import_picocolors15.default.green(import_picocolors15.default.bold(displayLatest))}`;
|
|
43335
43727
|
const versionLen = displayCurrent.length + 3 + displayLatest.length;
|
|
43336
|
-
const updateCmd = isGlobal ? "
|
|
43728
|
+
const updateCmd = isGlobal ? "tkm init -g --sync" : "tkm init --sync";
|
|
43337
43729
|
const commandText = `Run: ${import_picocolors15.default.cyan(import_picocolors15.default.bold(updateCmd))}`;
|
|
43338
43730
|
const commandLen = `Run: ${updateCmd}`.length;
|
|
43339
43731
|
console.log("");
|
|
@@ -48345,8 +48737,6 @@ init_logger();
|
|
|
48345
48737
|
init_output_manager();
|
|
48346
48738
|
init_types2();
|
|
48347
48739
|
var RELEASE_ROOT_ALLOWLIST = [
|
|
48348
|
-
"CLAUDE.md",
|
|
48349
|
-
"AGENTS.md",
|
|
48350
48740
|
".gitignore",
|
|
48351
48741
|
".repomixignore",
|
|
48352
48742
|
".mcp.json",
|
|
@@ -48548,7 +48938,7 @@ Please verify your token has the correct permissions:
|
|
|
48548
48938
|
• Classic PAT: requires 'repo' scope
|
|
48549
48939
|
• Fine-grained PAT: cannot access collaborator repos
|
|
48550
48940
|
|
|
48551
|
-
Or try:
|
|
48941
|
+
Or try: tkm new --use-git`);
|
|
48552
48942
|
}
|
|
48553
48943
|
const result = await promptForAuth();
|
|
48554
48944
|
switch (result.method) {
|
|
@@ -48917,7 +49307,7 @@ async function handleIdentityResolution(ctx) {
|
|
|
48917
49307
|
}
|
|
48918
49308
|
if (ctx.isNonInteractive) {
|
|
48919
49309
|
logger.warning("GitHub CLI (`gh`) not found or unauthenticated. Skipping identity setup (non-interactive mode).");
|
|
48920
|
-
logger.info("Telemetry / feedback features will be disabled until `gh auth login` is run and `
|
|
49310
|
+
logger.info("Telemetry / feedback features will be disabled until `gh auth login` is run and `tkm init` is re-run.");
|
|
48921
49311
|
return ctx;
|
|
48922
49312
|
}
|
|
48923
49313
|
ctx.prompts.note(`Takumi uses your GitHub login to attribute feedback, ratings, and telemetry.
|
|
@@ -48925,7 +49315,7 @@ No tokens are stored — just the public username.`, "GitHub Identity");
|
|
|
48925
49315
|
for (let attempt = 1;attempt <= MAX_ATTEMPTS2; attempt++) {
|
|
48926
49316
|
const input = await ctx.prompts.text("Enter your GitHub username:", "e.g. octocat");
|
|
48927
49317
|
if (input === undefined) {
|
|
48928
|
-
logger.error("GitHub username is required. Install `gh` CLI (`gh auth login`) or re-run `
|
|
49318
|
+
logger.error("GitHub username is required. Install `gh` CLI (`gh auth login`) or re-run `tkm init`.");
|
|
48929
49319
|
return { ...ctx, cancelled: true };
|
|
48930
49320
|
}
|
|
48931
49321
|
const login = input.trim();
|
|
@@ -52775,11 +53165,11 @@ function buildCommandPatterns() {
|
|
|
52775
53165
|
for (const cmd of COMMAND_ROOTS) {
|
|
52776
53166
|
patterns.push({
|
|
52777
53167
|
regex: new RegExp(`(?:^|(?<=[\\s\`]))(/)(${cmd})(:)(?!/)`, "gm"),
|
|
52778
|
-
replacement: "$
|
|
53168
|
+
replacement: "$1tkm:$2$3"
|
|
52779
53169
|
});
|
|
52780
53170
|
patterns.push({
|
|
52781
53171
|
regex: new RegExp(`(?:^|(?<=[\\s\`]))(/)(${cmd})(?![?/=&:\\w])(?=[\\s\`\\]\\)]|$)`, "gm"),
|
|
52782
|
-
replacement: "$
|
|
53172
|
+
replacement: "$1tkm:$2"
|
|
52783
53173
|
});
|
|
52784
53174
|
}
|
|
52785
53175
|
return patterns;
|
|
@@ -52887,7 +53277,7 @@ async function applyPrefix(extractDir) {
|
|
|
52887
53277
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
52888
53278
|
return;
|
|
52889
53279
|
}
|
|
52890
|
-
logger.info("Applying /
|
|
53280
|
+
logger.info("Applying /tkm: prefix to slash commands...");
|
|
52891
53281
|
const backupDir = join62(extractDir, ".commands-backup");
|
|
52892
53282
|
const tempDir = join62(extractDir, ".commands-prefix-temp");
|
|
52893
53283
|
try {
|
|
@@ -52896,18 +53286,18 @@ async function applyPrefix(extractDir) {
|
|
|
52896
53286
|
logger.verbose("Commands directory is empty, skipping prefix application");
|
|
52897
53287
|
return;
|
|
52898
53288
|
}
|
|
52899
|
-
if (entries.length === 1 && entries[0] === "
|
|
52900
|
-
const ckDir2 = join62(commandsDir, "
|
|
53289
|
+
if (entries.length === 1 && entries[0] === "tkm") {
|
|
53290
|
+
const ckDir2 = join62(commandsDir, "tkm");
|
|
52901
53291
|
const ckStat = await stat8(ckDir2);
|
|
52902
53292
|
if (ckStat.isDirectory()) {
|
|
52903
|
-
logger.verbose("Commands already have /
|
|
53293
|
+
logger.verbose("Commands already have /tkm: prefix, skipping");
|
|
52904
53294
|
return;
|
|
52905
53295
|
}
|
|
52906
53296
|
}
|
|
52907
53297
|
await import_fs_extra15.copy(commandsDir, backupDir);
|
|
52908
53298
|
logger.verbose("Created backup of commands directory");
|
|
52909
53299
|
await mkdir20(tempDir, { recursive: true });
|
|
52910
|
-
const ckDir = join62(tempDir, "
|
|
53300
|
+
const ckDir = join62(tempDir, "tkm");
|
|
52911
53301
|
await mkdir20(ckDir, { recursive: true });
|
|
52912
53302
|
let processedCount = 0;
|
|
52913
53303
|
for (const entry of entries) {
|
|
@@ -52923,7 +53313,7 @@ async function applyPrefix(extractDir) {
|
|
|
52923
53313
|
errorOnExist: true
|
|
52924
53314
|
});
|
|
52925
53315
|
processedCount++;
|
|
52926
|
-
logger.verbose(`Moved ${entry} to
|
|
53316
|
+
logger.verbose(`Moved ${entry} to tkm/${entry}`);
|
|
52927
53317
|
}
|
|
52928
53318
|
if (processedCount === 0) {
|
|
52929
53319
|
logger.warning("No files to move (all were symlinks or invalid)");
|
|
@@ -52934,7 +53324,7 @@ async function applyPrefix(extractDir) {
|
|
|
52934
53324
|
await import_fs_extra15.remove(commandsDir);
|
|
52935
53325
|
await import_fs_extra15.move(tempDir, commandsDir);
|
|
52936
53326
|
await import_fs_extra15.remove(backupDir);
|
|
52937
|
-
logger.success("Successfully reorganized commands to /
|
|
53327
|
+
logger.success("Successfully reorganized commands to /tkm: prefix");
|
|
52938
53328
|
const claudeDir = join62(extractDir, ".claude");
|
|
52939
53329
|
logger.info("Transforming command references in file contents...");
|
|
52940
53330
|
const transformResult = await transformCommandReferences(claudeDir, {
|
|
@@ -52958,7 +53348,7 @@ async function applyPrefix(extractDir) {
|
|
|
52958
53348
|
if (await import_fs_extra15.pathExists(tempDir)) {
|
|
52959
53349
|
await import_fs_extra15.remove(tempDir).catch(() => {});
|
|
52960
53350
|
}
|
|
52961
|
-
logger.error("Failed to apply /
|
|
53351
|
+
logger.error("Failed to apply /tkm: prefix to commands");
|
|
52962
53352
|
throw error;
|
|
52963
53353
|
} finally {
|
|
52964
53354
|
if (await import_fs_extra15.pathExists(backupDir)) {
|
|
@@ -53091,7 +53481,7 @@ function logCleanupSummary(deletedCount, preservedCount, dryRun, results) {
|
|
|
53091
53481
|
|
|
53092
53482
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
53093
53483
|
var KIT_PREFIX_MAP = {
|
|
53094
|
-
|
|
53484
|
+
tkm: "engineer"
|
|
53095
53485
|
};
|
|
53096
53486
|
function createKitSpecificMetadata(metadata, kitType) {
|
|
53097
53487
|
if (metadata.kits?.[kitType]) {
|
|
@@ -53551,13 +53941,11 @@ var PRESERVED_SKILLS = [
|
|
|
53551
53941
|
"claude-code",
|
|
53552
53942
|
"better-auth",
|
|
53553
53943
|
"chrome-devtools",
|
|
53554
|
-
"shopify",
|
|
53555
53944
|
"mcp-builder",
|
|
53556
53945
|
"docs-seeker",
|
|
53557
53946
|
"repomix",
|
|
53558
53947
|
"skill-creator",
|
|
53559
|
-
"template-skill"
|
|
53560
|
-
"google-adk-python"
|
|
53948
|
+
"template-skill"
|
|
53561
53949
|
];
|
|
53562
53950
|
function getCategoryForSkill(skillName) {
|
|
53563
53951
|
if (PRESERVED_SKILLS.includes(skillName)) {
|
|
@@ -54792,239 +55180,7 @@ Choose one approach.`);
|
|
|
54792
55180
|
};
|
|
54793
55181
|
}
|
|
54794
55182
|
// src/commands/init/phases/post-install-handler.ts
|
|
54795
|
-
import { join as join78 } from "node:path";
|
|
54796
|
-
|
|
54797
|
-
// src/domains/installation/setup-wizard.ts
|
|
54798
55183
|
import { join as join77 } from "node:path";
|
|
54799
|
-
init_logger();
|
|
54800
|
-
init_path_resolver();
|
|
54801
|
-
init_dist2();
|
|
54802
|
-
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
54803
|
-
var REQUIRED_ENV_KEYS = [
|
|
54804
|
-
{ key: "GEMINI_API_KEY", label: "Gemini API Key" }
|
|
54805
|
-
];
|
|
54806
|
-
async function checkRequiredKeysExist(envPath) {
|
|
54807
|
-
const envExists = await import_fs_extra28.pathExists(envPath);
|
|
54808
|
-
if (!envExists) {
|
|
54809
|
-
return { allPresent: false, missing: REQUIRED_ENV_KEYS, envExists: false };
|
|
54810
|
-
}
|
|
54811
|
-
const env2 = await parseEnvFile(envPath);
|
|
54812
|
-
const missing = [];
|
|
54813
|
-
for (const required of REQUIRED_ENV_KEYS) {
|
|
54814
|
-
const value = env2[required.key];
|
|
54815
|
-
if (!value || value.trim() === "") {
|
|
54816
|
-
missing.push(required);
|
|
54817
|
-
}
|
|
54818
|
-
}
|
|
54819
|
-
return {
|
|
54820
|
-
allPresent: missing.length === 0,
|
|
54821
|
-
missing,
|
|
54822
|
-
envExists: true
|
|
54823
|
-
};
|
|
54824
|
-
}
|
|
54825
|
-
var ESSENTIAL_CONFIGS = [
|
|
54826
|
-
{
|
|
54827
|
-
key: "GEMINI_API_KEY",
|
|
54828
|
-
label: "Google Gemini API Key",
|
|
54829
|
-
hint: "Required for ai-multimodal skill. Get from: https://aistudio.google.com/apikey",
|
|
54830
|
-
required: true,
|
|
54831
|
-
validate: VALIDATION_PATTERNS.GEMINI_API_KEY,
|
|
54832
|
-
mask: true
|
|
54833
|
-
},
|
|
54834
|
-
{
|
|
54835
|
-
key: "DISCORD_WEBHOOK_URL",
|
|
54836
|
-
label: "Discord Webhook URL (optional)",
|
|
54837
|
-
hint: "For Discord notifications. Leave empty to skip.",
|
|
54838
|
-
required: false,
|
|
54839
|
-
validate: VALIDATION_PATTERNS.DISCORD_WEBHOOK_URL,
|
|
54840
|
-
mask: false
|
|
54841
|
-
},
|
|
54842
|
-
{
|
|
54843
|
-
key: "TELEGRAM_BOT_TOKEN",
|
|
54844
|
-
label: "Telegram Bot Token (optional)",
|
|
54845
|
-
hint: "For Telegram notifications. Leave empty to skip.",
|
|
54846
|
-
required: false,
|
|
54847
|
-
validate: VALIDATION_PATTERNS.TELEGRAM_BOT_TOKEN,
|
|
54848
|
-
mask: true
|
|
54849
|
-
}
|
|
54850
|
-
];
|
|
54851
|
-
async function parseEnvFile(path5) {
|
|
54852
|
-
try {
|
|
54853
|
-
const content = await import_fs_extra28.readFile(path5, "utf-8");
|
|
54854
|
-
const env2 = {};
|
|
54855
|
-
for (const line of content.split(`
|
|
54856
|
-
`)) {
|
|
54857
|
-
let trimmed = line.trim();
|
|
54858
|
-
if (!trimmed || trimmed.startsWith("#"))
|
|
54859
|
-
continue;
|
|
54860
|
-
if (trimmed.startsWith("export ")) {
|
|
54861
|
-
trimmed = trimmed.slice(7);
|
|
54862
|
-
}
|
|
54863
|
-
const [key, ...valueParts] = trimmed.split("=");
|
|
54864
|
-
if (key) {
|
|
54865
|
-
let value = valueParts.join("=").trim();
|
|
54866
|
-
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
54867
|
-
value = value.slice(1, -1);
|
|
54868
|
-
}
|
|
54869
|
-
env2[key.trim()] = value.trim();
|
|
54870
|
-
}
|
|
54871
|
-
}
|
|
54872
|
-
return env2;
|
|
54873
|
-
} catch (error) {
|
|
54874
|
-
logger.debug(`Failed to parse .env file at ${path5}: ${error}`);
|
|
54875
|
-
return {};
|
|
54876
|
-
}
|
|
54877
|
-
}
|
|
54878
|
-
async function checkGlobalConfig() {
|
|
54879
|
-
const globalEnvPath = join77(PathResolver.getGlobalKitDir(), ".env");
|
|
54880
|
-
if (!await import_fs_extra28.pathExists(globalEnvPath))
|
|
54881
|
-
return false;
|
|
54882
|
-
const env2 = await parseEnvFile(globalEnvPath);
|
|
54883
|
-
return Object.keys(env2).length > 0;
|
|
54884
|
-
}
|
|
54885
|
-
async function runSetupWizard(options2) {
|
|
54886
|
-
const { targetDir, isGlobal } = options2;
|
|
54887
|
-
if (isGlobal) {
|
|
54888
|
-
f2.info("Configuring global defaults (shared across all projects)");
|
|
54889
|
-
} else {
|
|
54890
|
-
f2.info("Configuring project-specific settings");
|
|
54891
|
-
}
|
|
54892
|
-
let globalEnv = {};
|
|
54893
|
-
const hasGlobalConfig = !isGlobal && await checkGlobalConfig();
|
|
54894
|
-
if (!isGlobal) {
|
|
54895
|
-
const globalEnvPath = join77(PathResolver.getGlobalKitDir(), ".env");
|
|
54896
|
-
if (await import_fs_extra28.pathExists(globalEnvPath)) {
|
|
54897
|
-
globalEnv = await parseEnvFile(globalEnvPath);
|
|
54898
|
-
}
|
|
54899
|
-
}
|
|
54900
|
-
if (hasGlobalConfig && Object.keys(globalEnv).length > 0) {
|
|
54901
|
-
f2.success("Global config detected - values will be inherited automatically");
|
|
54902
|
-
}
|
|
54903
|
-
const values = {};
|
|
54904
|
-
for (const config of ESSENTIAL_CONFIGS) {
|
|
54905
|
-
const globalValue = globalEnv[config.key] || "";
|
|
54906
|
-
const hasGlobalValue = !isGlobal && !!globalValue;
|
|
54907
|
-
if (hasGlobalValue) {
|
|
54908
|
-
const maskedValue = config.mask ? `${globalValue.slice(0, 8)}...` : globalValue;
|
|
54909
|
-
const useGlobal = await se({
|
|
54910
|
-
message: `${config.label}: Use global value? (${maskedValue})`,
|
|
54911
|
-
initialValue: true
|
|
54912
|
-
});
|
|
54913
|
-
if (lD(useGlobal)) {
|
|
54914
|
-
f2.warning("Setup cancelled");
|
|
54915
|
-
return false;
|
|
54916
|
-
}
|
|
54917
|
-
if (useGlobal) {
|
|
54918
|
-
values[config.key] = globalValue;
|
|
54919
|
-
f2.success(`${config.key}: inherited from global config`);
|
|
54920
|
-
continue;
|
|
54921
|
-
}
|
|
54922
|
-
}
|
|
54923
|
-
const result = await te({
|
|
54924
|
-
message: config.label,
|
|
54925
|
-
placeholder: config.hint,
|
|
54926
|
-
validate: (value) => {
|
|
54927
|
-
if (!value && !config.required) {
|
|
54928
|
-
return;
|
|
54929
|
-
}
|
|
54930
|
-
if (!value && config.required) {
|
|
54931
|
-
return "This field is required";
|
|
54932
|
-
}
|
|
54933
|
-
if (value && config.validate && !validateApiKey2(value, config.validate)) {
|
|
54934
|
-
return "Invalid format. Please check and try again.";
|
|
54935
|
-
}
|
|
54936
|
-
return;
|
|
54937
|
-
}
|
|
54938
|
-
});
|
|
54939
|
-
if (lD(result)) {
|
|
54940
|
-
f2.warning("Setup cancelled");
|
|
54941
|
-
return false;
|
|
54942
|
-
}
|
|
54943
|
-
if (typeof result === "string" && result) {
|
|
54944
|
-
values[config.key] = result;
|
|
54945
|
-
}
|
|
54946
|
-
}
|
|
54947
|
-
if (values.GEMINI_API_KEY) {
|
|
54948
|
-
const additionalKeys = await promptForAdditionalGeminiKeys(values.GEMINI_API_KEY);
|
|
54949
|
-
for (let i = 0;i < additionalKeys.length; i++) {
|
|
54950
|
-
values[`GEMINI_API_KEY_${i + 2}`] = additionalKeys[i];
|
|
54951
|
-
}
|
|
54952
|
-
const totalKeys = 1 + additionalKeys.length;
|
|
54953
|
-
if (totalKeys > 1) {
|
|
54954
|
-
f2.success(`✓ Configured ${totalKeys} Gemini API keys for rotation`);
|
|
54955
|
-
}
|
|
54956
|
-
}
|
|
54957
|
-
await generateEnvFile(targetDir, values);
|
|
54958
|
-
f2.success(`Configuration saved to ${join77(targetDir, ".env")}`);
|
|
54959
|
-
return true;
|
|
54960
|
-
}
|
|
54961
|
-
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
54962
|
-
const additionalKeys = [];
|
|
54963
|
-
const allKeys = new Set([primaryKey]);
|
|
54964
|
-
const wantMore = await se({
|
|
54965
|
-
message: "Add additional API keys for rotation? (recommended for high usage)",
|
|
54966
|
-
initialValue: false
|
|
54967
|
-
});
|
|
54968
|
-
if (lD(wantMore) || !wantMore) {
|
|
54969
|
-
return additionalKeys;
|
|
54970
|
-
}
|
|
54971
|
-
let keyNumber = 2;
|
|
54972
|
-
const maxKeys = 10;
|
|
54973
|
-
while (keyNumber <= maxKeys) {
|
|
54974
|
-
const result = await te({
|
|
54975
|
-
message: `Gemini API Key #${keyNumber} (press Enter to finish)`,
|
|
54976
|
-
placeholder: "AIza... or leave empty to finish",
|
|
54977
|
-
validate: (value) => {
|
|
54978
|
-
if (!value)
|
|
54979
|
-
return;
|
|
54980
|
-
const trimmed = value.trim();
|
|
54981
|
-
if (!trimmed)
|
|
54982
|
-
return;
|
|
54983
|
-
if (!validateApiKey2(trimmed, VALIDATION_PATTERNS.GEMINI_API_KEY)) {
|
|
54984
|
-
return "Invalid format. Gemini keys start with 'AIza' and are 39 characters.";
|
|
54985
|
-
}
|
|
54986
|
-
if (allKeys.has(trimmed)) {
|
|
54987
|
-
return "This key was already added. Please enter a different key.";
|
|
54988
|
-
}
|
|
54989
|
-
return;
|
|
54990
|
-
}
|
|
54991
|
-
});
|
|
54992
|
-
if (lD(result)) {
|
|
54993
|
-
break;
|
|
54994
|
-
}
|
|
54995
|
-
if (!result || result.trim() === "") {
|
|
54996
|
-
break;
|
|
54997
|
-
}
|
|
54998
|
-
const trimmedKey = result.trim();
|
|
54999
|
-
additionalKeys.push(trimmedKey);
|
|
55000
|
-
allKeys.add(trimmedKey);
|
|
55001
|
-
keyNumber++;
|
|
55002
|
-
}
|
|
55003
|
-
return additionalKeys;
|
|
55004
|
-
}
|
|
55005
|
-
async function promptSetupWizardIfNeeded(options2) {
|
|
55006
|
-
const { envPath, claudeDir, isGlobal, isNonInteractive: isNonInteractive2, prompts } = options2;
|
|
55007
|
-
if (isNonInteractive2) {
|
|
55008
|
-
return;
|
|
55009
|
-
}
|
|
55010
|
-
const { allPresent, missing, envExists } = await checkRequiredKeysExist(envPath);
|
|
55011
|
-
if (allPresent) {
|
|
55012
|
-
return;
|
|
55013
|
-
}
|
|
55014
|
-
const missingKeys = missing.map((m3) => m3.label).join(", ");
|
|
55015
|
-
const promptMessage = envExists ? `Missing required: ${missingKeys}. Set up now?` : "Set up API keys now? (Gemini API key for ai-multimodal skill, optional webhooks)";
|
|
55016
|
-
const shouldSetup = await prompts.confirm(promptMessage);
|
|
55017
|
-
if (shouldSetup) {
|
|
55018
|
-
await runSetupWizard({
|
|
55019
|
-
targetDir: claudeDir,
|
|
55020
|
-
isGlobal
|
|
55021
|
-
});
|
|
55022
|
-
} else {
|
|
55023
|
-
prompts.note(`Create ${envPath} manually or run 'takumi init' again.
|
|
55024
|
-
Required: GEMINI_API_KEY
|
|
55025
|
-
Optional: DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN`, "Configuration skipped");
|
|
55026
|
-
}
|
|
55027
|
-
}
|
|
55028
55184
|
|
|
55029
55185
|
// src/domains/takumi-data/projects-registry.ts
|
|
55030
55186
|
init_logger();
|
|
@@ -55032,7 +55188,7 @@ init_path_resolver();
|
|
|
55032
55188
|
init_types2();
|
|
55033
55189
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
55034
55190
|
import { existsSync as existsSync31, statSync as statSync3 } from "node:fs";
|
|
55035
|
-
import { copyFile as copyFile6, mkdir as mkdir23, open, readFile as
|
|
55191
|
+
import { copyFile as copyFile6, mkdir as mkdir23, open, readFile as readFile31, unlink as unlink10, writeFile as writeFile25 } from "node:fs/promises";
|
|
55036
55192
|
import { basename as basename4, dirname as dirname16, resolve as resolve11 } from "node:path";
|
|
55037
55193
|
|
|
55038
55194
|
class ProjectsRegistryManager {
|
|
@@ -55091,7 +55247,7 @@ class ProjectsRegistryManager {
|
|
|
55091
55247
|
try {
|
|
55092
55248
|
const registryPath = PathResolver.getProjectsRegistryPath();
|
|
55093
55249
|
if (existsSync31(registryPath)) {
|
|
55094
|
-
const content = await
|
|
55250
|
+
const content = await readFile31(registryPath, "utf-8");
|
|
55095
55251
|
const data = JSON.parse(content);
|
|
55096
55252
|
if (data.projects && !Array.isArray(data.projects)) {
|
|
55097
55253
|
logger.info("Migrating projects registry from object to array format");
|
|
@@ -55295,17 +55451,17 @@ class ProjectsRegistryManager {
|
|
|
55295
55451
|
// src/commands/init/phases/post-install-handler.ts
|
|
55296
55452
|
init_logger();
|
|
55297
55453
|
init_path_resolver();
|
|
55298
|
-
var
|
|
55454
|
+
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
55299
55455
|
async function handlePostInstall(ctx) {
|
|
55300
55456
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir || !ctx.claudeDir) {
|
|
55301
55457
|
return ctx;
|
|
55302
55458
|
}
|
|
55303
55459
|
if (ctx.options.global) {
|
|
55304
|
-
const claudeMdSource =
|
|
55305
|
-
const claudeMdDest =
|
|
55306
|
-
if (await
|
|
55307
|
-
if (ctx.options.fresh || !await
|
|
55308
|
-
await
|
|
55460
|
+
const claudeMdSource = join77(ctx.extractDir, "CLAUDE.md");
|
|
55461
|
+
const claudeMdDest = join77(ctx.resolvedDir, "CLAUDE.md");
|
|
55462
|
+
if (await import_fs_extra28.pathExists(claudeMdSource)) {
|
|
55463
|
+
if (ctx.options.fresh || !await import_fs_extra28.pathExists(claudeMdDest)) {
|
|
55464
|
+
await import_fs_extra28.copy(claudeMdSource, claudeMdDest);
|
|
55309
55465
|
logger.success(ctx.options.fresh ? "Replaced CLAUDE.md in global directory (fresh install)" : "Copied CLAUDE.md to global directory");
|
|
55310
55466
|
} else {
|
|
55311
55467
|
logger.debug("CLAUDE.md already exists in global directory (preserved)");
|
|
@@ -55348,15 +55504,6 @@ async function handlePostInstall(ctx) {
|
|
|
55348
55504
|
}
|
|
55349
55505
|
}
|
|
55350
55506
|
}
|
|
55351
|
-
if (!ctx.options.skipSetup) {
|
|
55352
|
-
await promptSetupWizardIfNeeded({
|
|
55353
|
-
envPath: join78(ctx.claudeDir, ".env"),
|
|
55354
|
-
claudeDir: ctx.claudeDir,
|
|
55355
|
-
isGlobal: ctx.options.global,
|
|
55356
|
-
isNonInteractive: ctx.isNonInteractive,
|
|
55357
|
-
prompts: ctx.prompts
|
|
55358
|
-
});
|
|
55359
|
-
}
|
|
55360
55507
|
if (!ctx.options.global && ctx.resolvedDir) {
|
|
55361
55508
|
try {
|
|
55362
55509
|
await ProjectsRegistryManager.addProject(ctx.resolvedDir);
|
|
@@ -55372,7 +55519,7 @@ async function handlePostInstall(ctx) {
|
|
|
55372
55519
|
}
|
|
55373
55520
|
// src/commands/init/phases/selection-handler.ts
|
|
55374
55521
|
import { mkdir as mkdir24 } from "node:fs/promises";
|
|
55375
|
-
import { join as
|
|
55522
|
+
import { join as join79, resolve as resolve13 } from "node:path";
|
|
55376
55523
|
init_github_client();
|
|
55377
55524
|
|
|
55378
55525
|
// src/domains/github/kit-access-checker.ts
|
|
@@ -55502,9 +55649,9 @@ async function runPreflightChecks() {
|
|
|
55502
55649
|
|
|
55503
55650
|
// src/domains/installation/fresh-installer.ts
|
|
55504
55651
|
import { existsSync as existsSync32, readdirSync as readdirSync3, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
55505
|
-
import { dirname as dirname17, join as
|
|
55652
|
+
import { dirname as dirname17, join as join78, resolve as resolve12 } from "node:path";
|
|
55506
55653
|
init_logger();
|
|
55507
|
-
var
|
|
55654
|
+
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
55508
55655
|
var TAKUMI_SUBDIRECTORIES = ["commands", "agents", "skills", "rules", "hooks"];
|
|
55509
55656
|
async function analyzeFreshInstallation(claudeDir) {
|
|
55510
55657
|
const metadata = await readManifest(claudeDir);
|
|
@@ -55574,7 +55721,7 @@ async function removeFilesByOwnership(claudeDir, analysis, includeModified) {
|
|
|
55574
55721
|
const filesToRemove = includeModified ? [...analysis.ckFiles, ...analysis.ckModifiedFiles] : analysis.ckFiles;
|
|
55575
55722
|
const filesToPreserve = includeModified ? analysis.userFiles : [...analysis.ckModifiedFiles, ...analysis.userFiles];
|
|
55576
55723
|
for (const file of filesToRemove) {
|
|
55577
|
-
const fullPath =
|
|
55724
|
+
const fullPath = join78(claudeDir, file.path);
|
|
55578
55725
|
try {
|
|
55579
55726
|
if (existsSync32(fullPath)) {
|
|
55580
55727
|
unlinkSync5(fullPath);
|
|
@@ -55599,13 +55746,13 @@ async function removeFilesByOwnership(claudeDir, analysis, includeModified) {
|
|
|
55599
55746
|
};
|
|
55600
55747
|
}
|
|
55601
55748
|
async function updateMetadataAfterFresh(claudeDir, removedFiles) {
|
|
55602
|
-
const metadataPath =
|
|
55603
|
-
if (!await
|
|
55749
|
+
const metadataPath = join78(claudeDir, "metadata.json");
|
|
55750
|
+
if (!await import_fs_extra29.pathExists(metadataPath)) {
|
|
55604
55751
|
return;
|
|
55605
55752
|
}
|
|
55606
55753
|
let content;
|
|
55607
55754
|
try {
|
|
55608
|
-
content = await
|
|
55755
|
+
content = await import_fs_extra29.readFile(metadataPath, "utf-8");
|
|
55609
55756
|
} catch (readError) {
|
|
55610
55757
|
logger.warning(`Failed to read metadata.json: ${readError instanceof Error ? readError.message : String(readError)}`);
|
|
55611
55758
|
return;
|
|
@@ -55631,7 +55778,7 @@ async function updateMetadataAfterFresh(claudeDir, removedFiles) {
|
|
|
55631
55778
|
metadata.files = metadata.files.filter((f4) => !removedSet.has(f4.path));
|
|
55632
55779
|
}
|
|
55633
55780
|
try {
|
|
55634
|
-
await
|
|
55781
|
+
await import_fs_extra29.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
55635
55782
|
logger.debug(`Updated metadata.json, removed ${removedFiles.length} file entries`);
|
|
55636
55783
|
} catch (writeError) {
|
|
55637
55784
|
logger.warning(`Failed to write metadata.json: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
@@ -55642,16 +55789,16 @@ async function removeSubdirectoriesFallback(claudeDir) {
|
|
|
55642
55789
|
const removedFiles = [];
|
|
55643
55790
|
let removedDirCount = 0;
|
|
55644
55791
|
for (const subdir of TAKUMI_SUBDIRECTORIES) {
|
|
55645
|
-
const subdirPath =
|
|
55646
|
-
if (await
|
|
55792
|
+
const subdirPath = join78(claudeDir, subdir);
|
|
55793
|
+
if (await import_fs_extra29.pathExists(subdirPath)) {
|
|
55647
55794
|
rmSync3(subdirPath, { recursive: true, force: true });
|
|
55648
55795
|
removedDirCount++;
|
|
55649
55796
|
removedFiles.push(`${subdir}/ (entire directory)`);
|
|
55650
55797
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
55651
55798
|
}
|
|
55652
55799
|
}
|
|
55653
|
-
const metadataPath =
|
|
55654
|
-
if (await
|
|
55800
|
+
const metadataPath = join78(claudeDir, "metadata.json");
|
|
55801
|
+
if (await import_fs_extra29.pathExists(metadataPath)) {
|
|
55655
55802
|
unlinkSync5(metadataPath);
|
|
55656
55803
|
removedFiles.push("metadata.json");
|
|
55657
55804
|
}
|
|
@@ -55664,7 +55811,7 @@ async function removeSubdirectoriesFallback(claudeDir) {
|
|
|
55664
55811
|
};
|
|
55665
55812
|
}
|
|
55666
55813
|
async function handleFreshInstallation(claudeDir, prompts) {
|
|
55667
|
-
if (!await
|
|
55814
|
+
if (!await import_fs_extra29.pathExists(claudeDir)) {
|
|
55668
55815
|
logger.info(".claude directory does not exist, proceeding with fresh installation");
|
|
55669
55816
|
return true;
|
|
55670
55817
|
}
|
|
@@ -55698,7 +55845,7 @@ async function handleFreshInstallation(claudeDir, prompts) {
|
|
|
55698
55845
|
init_logger();
|
|
55699
55846
|
init_path_resolver();
|
|
55700
55847
|
init_types2();
|
|
55701
|
-
var
|
|
55848
|
+
var import_fs_extra30 = __toESM(require_lib(), 1);
|
|
55702
55849
|
|
|
55703
55850
|
// src/commands/init/types.ts
|
|
55704
55851
|
function isSyncContext(ctx) {
|
|
@@ -55747,7 +55894,7 @@ async function handleSelection(ctx) {
|
|
|
55747
55894
|
}
|
|
55748
55895
|
}
|
|
55749
55896
|
logger.info("");
|
|
55750
|
-
logger.info("Full diagnostics:
|
|
55897
|
+
logger.info("Full diagnostics: tkm doctor");
|
|
55751
55898
|
return { ...ctx, cancelled: true };
|
|
55752
55899
|
}
|
|
55753
55900
|
accessibleKits = await detectAccessibleKits();
|
|
@@ -55755,7 +55902,7 @@ async function handleSelection(ctx) {
|
|
|
55755
55902
|
logger.error("No Takumi repository access found.");
|
|
55756
55903
|
logger.info("Check email for GitHub invitation, or request access from your team lead");
|
|
55757
55904
|
logger.info("");
|
|
55758
|
-
logger.info("Full diagnostics:
|
|
55905
|
+
logger.info("Full diagnostics: tkm doctor");
|
|
55759
55906
|
return { ...ctx, cancelled: true };
|
|
55760
55907
|
}
|
|
55761
55908
|
}
|
|
@@ -55840,19 +55987,19 @@ async function handleSelection(ctx) {
|
|
|
55840
55987
|
return { ...ctx, cancelled: true };
|
|
55841
55988
|
}
|
|
55842
55989
|
}
|
|
55843
|
-
if (!await
|
|
55990
|
+
if (!await import_fs_extra30.pathExists(resolvedDir)) {
|
|
55844
55991
|
if (ctx.options.global) {
|
|
55845
55992
|
await mkdir24(resolvedDir, { recursive: true });
|
|
55846
55993
|
logger.info(`Created global directory: ${resolvedDir}`);
|
|
55847
55994
|
} else {
|
|
55848
55995
|
logger.error(`Directory does not exist: ${resolvedDir}`);
|
|
55849
|
-
logger.info('Use "
|
|
55996
|
+
logger.info('Use "tkm new" to create a new project');
|
|
55850
55997
|
return { ...ctx, cancelled: true };
|
|
55851
55998
|
}
|
|
55852
55999
|
}
|
|
55853
56000
|
if (!ctx.options.fresh) {
|
|
55854
56001
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
55855
|
-
const claudeDir = prefix ?
|
|
56002
|
+
const claudeDir = prefix ? join79(resolvedDir, prefix) : resolvedDir;
|
|
55856
56003
|
try {
|
|
55857
56004
|
const existingMetadata = await readManifest(claudeDir);
|
|
55858
56005
|
if (existingMetadata?.kits) {
|
|
@@ -55885,7 +56032,7 @@ async function handleSelection(ctx) {
|
|
|
55885
56032
|
}
|
|
55886
56033
|
if (ctx.options.fresh) {
|
|
55887
56034
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
55888
|
-
const claudeDir = prefix ?
|
|
56035
|
+
const claudeDir = prefix ? join79(resolvedDir, prefix) : resolvedDir;
|
|
55889
56036
|
const canProceed = await handleFreshInstallation(claudeDir, ctx.prompts);
|
|
55890
56037
|
if (!canProceed) {
|
|
55891
56038
|
return { ...ctx, cancelled: true };
|
|
@@ -55905,7 +56052,7 @@ async function handleSelection(ctx) {
|
|
|
55905
56052
|
let currentVersion = null;
|
|
55906
56053
|
try {
|
|
55907
56054
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
55908
|
-
const claudeDir = prefix ?
|
|
56055
|
+
const claudeDir = prefix ? join79(resolvedDir, prefix) : resolvedDir;
|
|
55909
56056
|
const existingMetadata = await readManifest(claudeDir);
|
|
55910
56057
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
55911
56058
|
if (currentVersion) {
|
|
@@ -55974,7 +56121,7 @@ async function handleSelection(ctx) {
|
|
|
55974
56121
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && releaseTag && !isOfflineMode) {
|
|
55975
56122
|
try {
|
|
55976
56123
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
55977
|
-
const claudeDir = prefix ?
|
|
56124
|
+
const claudeDir = prefix ? join79(resolvedDir, prefix) : resolvedDir;
|
|
55978
56125
|
const existingMetadata = await readManifest(claudeDir);
|
|
55979
56126
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
55980
56127
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -55996,25 +56143,25 @@ async function handleSelection(ctx) {
|
|
|
55996
56143
|
};
|
|
55997
56144
|
}
|
|
55998
56145
|
// src/commands/init/phases/sync-handler.ts
|
|
55999
|
-
import { copyFile as copyFile7, mkdir as mkdir25, open as open2, readFile as
|
|
56000
|
-
import { dirname as dirname18, join as
|
|
56146
|
+
import { copyFile as copyFile7, mkdir as mkdir25, open as open2, readFile as readFile33, rename as rename4, stat as stat10, unlink as unlink11, writeFile as writeFile27 } from "node:fs/promises";
|
|
56147
|
+
import { dirname as dirname18, join as join80, resolve as resolve14 } from "node:path";
|
|
56001
56148
|
init_logger();
|
|
56002
56149
|
init_path_resolver();
|
|
56003
|
-
var
|
|
56150
|
+
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
56004
56151
|
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
56005
56152
|
async function handleSync(ctx) {
|
|
56006
56153
|
if (!ctx.options.sync) {
|
|
56007
56154
|
return ctx;
|
|
56008
56155
|
}
|
|
56009
56156
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve14(ctx.options.dir || ".");
|
|
56010
|
-
const claudeDir = ctx.options.global ? resolvedDir :
|
|
56011
|
-
if (!await
|
|
56157
|
+
const claudeDir = ctx.options.global ? resolvedDir : join80(resolvedDir, ".claude");
|
|
56158
|
+
if (!await import_fs_extra31.pathExists(claudeDir)) {
|
|
56012
56159
|
logger.error("Cannot sync: no .claude directory found");
|
|
56013
56160
|
ctx.prompts.note("Run 'takumi init' without --sync to install first.", "No Installation Found");
|
|
56014
56161
|
return { ...ctx, cancelled: true };
|
|
56015
56162
|
}
|
|
56016
|
-
const metadataPath =
|
|
56017
|
-
if (!await
|
|
56163
|
+
const metadataPath = join80(claudeDir, "metadata.json");
|
|
56164
|
+
if (!await import_fs_extra31.pathExists(metadataPath)) {
|
|
56018
56165
|
logger.error("Cannot sync: no metadata.json found");
|
|
56019
56166
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
56020
56167
|
Run 'takumi init' to update.`, "Legacy Installation");
|
|
@@ -56103,7 +56250,7 @@ function getLockTimeout() {
|
|
|
56103
56250
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
56104
56251
|
async function acquireSyncLock(global3) {
|
|
56105
56252
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
56106
|
-
const lockPath =
|
|
56253
|
+
const lockPath = join80(cacheDir, ".sync-lock");
|
|
56107
56254
|
const startTime = Date.now();
|
|
56108
56255
|
const lockTimeout = getLockTimeout();
|
|
56109
56256
|
await mkdir25(dirname18(lockPath), { recursive: true });
|
|
@@ -56149,12 +56296,12 @@ async function executeSyncMerge(ctx) {
|
|
|
56149
56296
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
56150
56297
|
try {
|
|
56151
56298
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
56152
|
-
const upstreamDir = ctx.options.global ?
|
|
56299
|
+
const upstreamDir = ctx.options.global ? join80(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
56153
56300
|
let deletions = [];
|
|
56154
56301
|
try {
|
|
56155
|
-
const sourceMetadataPath =
|
|
56156
|
-
if (await
|
|
56157
|
-
const content = await
|
|
56302
|
+
const sourceMetadataPath = join80(upstreamDir, "metadata.json");
|
|
56303
|
+
if (await import_fs_extra31.pathExists(sourceMetadataPath)) {
|
|
56304
|
+
const content = await readFile33(sourceMetadataPath, "utf-8");
|
|
56158
56305
|
const sourceMetadata = JSON.parse(content);
|
|
56159
56306
|
deletions = sourceMetadata.deletions || [];
|
|
56160
56307
|
}
|
|
@@ -56184,7 +56331,7 @@ async function executeSyncMerge(ctx) {
|
|
|
56184
56331
|
try {
|
|
56185
56332
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
56186
56333
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
56187
|
-
const targetDir =
|
|
56334
|
+
const targetDir = join80(targetPath, "..");
|
|
56188
56335
|
try {
|
|
56189
56336
|
await mkdir25(targetDir, { recursive: true });
|
|
56190
56337
|
} catch (mkdirError) {
|
|
@@ -56353,9 +56500,9 @@ async function createBackup(claudeDir, files, backupDir) {
|
|
|
56353
56500
|
for (const file of files) {
|
|
56354
56501
|
try {
|
|
56355
56502
|
const sourcePath = await validateSyncPath(claudeDir, file.path);
|
|
56356
|
-
if (await
|
|
56503
|
+
if (await import_fs_extra31.pathExists(sourcePath)) {
|
|
56357
56504
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
56358
|
-
const targetDir =
|
|
56505
|
+
const targetDir = join80(targetPath, "..");
|
|
56359
56506
|
await mkdir25(targetDir, { recursive: true });
|
|
56360
56507
|
await copyFile7(sourcePath, targetPath);
|
|
56361
56508
|
}
|
|
@@ -56369,7 +56516,7 @@ async function createBackup(claudeDir, files, backupDir) {
|
|
|
56369
56516
|
}
|
|
56370
56517
|
}
|
|
56371
56518
|
// src/commands/init/phases/transform-handler.ts
|
|
56372
|
-
import { join as
|
|
56519
|
+
import { join as join84 } from "node:path";
|
|
56373
56520
|
|
|
56374
56521
|
// src/services/transformers/folder-path-transformer.ts
|
|
56375
56522
|
init_logger();
|
|
@@ -56378,40 +56525,40 @@ init_types2();
|
|
|
56378
56525
|
// src/services/transformers/folder-transform/folder-renamer.ts
|
|
56379
56526
|
init_logger();
|
|
56380
56527
|
init_types2();
|
|
56381
|
-
var
|
|
56528
|
+
var import_fs_extra32 = __toESM(require_lib(), 1);
|
|
56382
56529
|
import { rename as rename5, rm as rm9 } from "node:fs/promises";
|
|
56383
|
-
import { join as
|
|
56530
|
+
import { join as join81, relative as relative15 } from "node:path";
|
|
56384
56531
|
async function collectDirsToRename(extractDir, folders) {
|
|
56385
56532
|
const dirsToRename = [];
|
|
56386
56533
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
56387
|
-
const docsPath =
|
|
56388
|
-
if (await
|
|
56534
|
+
const docsPath = join81(extractDir, DEFAULT_FOLDERS.docs);
|
|
56535
|
+
if (await import_fs_extra32.pathExists(docsPath)) {
|
|
56389
56536
|
dirsToRename.push({
|
|
56390
56537
|
from: docsPath,
|
|
56391
|
-
to:
|
|
56538
|
+
to: join81(extractDir, folders.docs)
|
|
56392
56539
|
});
|
|
56393
56540
|
}
|
|
56394
|
-
const claudeDocsPath =
|
|
56395
|
-
if (await
|
|
56541
|
+
const claudeDocsPath = join81(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
56542
|
+
if (await import_fs_extra32.pathExists(claudeDocsPath)) {
|
|
56396
56543
|
dirsToRename.push({
|
|
56397
56544
|
from: claudeDocsPath,
|
|
56398
|
-
to:
|
|
56545
|
+
to: join81(extractDir, ".claude", folders.docs)
|
|
56399
56546
|
});
|
|
56400
56547
|
}
|
|
56401
56548
|
}
|
|
56402
56549
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
56403
|
-
const plansPath =
|
|
56404
|
-
if (await
|
|
56550
|
+
const plansPath = join81(extractDir, DEFAULT_FOLDERS.plans);
|
|
56551
|
+
if (await import_fs_extra32.pathExists(plansPath)) {
|
|
56405
56552
|
dirsToRename.push({
|
|
56406
56553
|
from: plansPath,
|
|
56407
|
-
to:
|
|
56554
|
+
to: join81(extractDir, folders.plans)
|
|
56408
56555
|
});
|
|
56409
56556
|
}
|
|
56410
|
-
const claudePlansPath =
|
|
56411
|
-
if (await
|
|
56557
|
+
const claudePlansPath = join81(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
56558
|
+
if (await import_fs_extra32.pathExists(claudePlansPath)) {
|
|
56412
56559
|
dirsToRename.push({
|
|
56413
56560
|
from: claudePlansPath,
|
|
56414
|
-
to:
|
|
56561
|
+
to: join81(extractDir, ".claude", folders.plans)
|
|
56415
56562
|
});
|
|
56416
56563
|
}
|
|
56417
56564
|
}
|
|
@@ -56423,7 +56570,7 @@ async function moveAcrossDevices(src, dest) {
|
|
|
56423
56570
|
} catch (e2) {
|
|
56424
56571
|
if (e2.code === "EXDEV") {
|
|
56425
56572
|
logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
|
|
56426
|
-
await
|
|
56573
|
+
await import_fs_extra32.copy(src, dest, { overwrite: true });
|
|
56427
56574
|
await rm9(src, { recursive: true, force: true });
|
|
56428
56575
|
} else {
|
|
56429
56576
|
throw e2;
|
|
@@ -56451,8 +56598,8 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
56451
56598
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
56452
56599
|
init_logger();
|
|
56453
56600
|
init_types2();
|
|
56454
|
-
import { readFile as
|
|
56455
|
-
import { join as
|
|
56601
|
+
import { readFile as readFile34, readdir as readdir25, writeFile as writeFile28 } from "node:fs/promises";
|
|
56602
|
+
import { join as join82, relative as relative16 } from "node:path";
|
|
56456
56603
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
56457
56604
|
".md",
|
|
56458
56605
|
".txt",
|
|
@@ -56505,7 +56652,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
56505
56652
|
let replacementsCount = 0;
|
|
56506
56653
|
const entries = await readdir25(dir, { withFileTypes: true });
|
|
56507
56654
|
for (const entry of entries) {
|
|
56508
|
-
const fullPath =
|
|
56655
|
+
const fullPath = join82(dir, entry.name);
|
|
56509
56656
|
if (entry.isDirectory()) {
|
|
56510
56657
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
56511
56658
|
continue;
|
|
@@ -56518,7 +56665,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
56518
56665
|
if (!shouldTransform)
|
|
56519
56666
|
continue;
|
|
56520
56667
|
try {
|
|
56521
|
-
const content = await
|
|
56668
|
+
const content = await readFile34(fullPath, "utf-8");
|
|
56522
56669
|
let newContent = content;
|
|
56523
56670
|
let changeCount = 0;
|
|
56524
56671
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -56640,9 +56787,9 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
56640
56787
|
|
|
56641
56788
|
// src/services/transformers/global-path-transformer.ts
|
|
56642
56789
|
init_logger();
|
|
56643
|
-
import { readFile as
|
|
56790
|
+
import { readFile as readFile35, readdir as readdir26, writeFile as writeFile29 } from "node:fs/promises";
|
|
56644
56791
|
import { platform as platform8 } from "node:os";
|
|
56645
|
-
import { extname as extname4, join as
|
|
56792
|
+
import { extname as extname4, join as join83 } from "node:path";
|
|
56646
56793
|
var IS_WINDOWS3 = platform8() === "win32";
|
|
56647
56794
|
var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
|
|
56648
56795
|
function getHomeDirPrefix() {
|
|
@@ -56754,7 +56901,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
56754
56901
|
async function processDirectory2(dir) {
|
|
56755
56902
|
const entries = await readdir26(dir, { withFileTypes: true });
|
|
56756
56903
|
for (const entry of entries) {
|
|
56757
|
-
const fullPath =
|
|
56904
|
+
const fullPath = join83(dir, entry.name);
|
|
56758
56905
|
if (entry.isDirectory()) {
|
|
56759
56906
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
56760
56907
|
continue;
|
|
@@ -56762,7 +56909,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
56762
56909
|
await processDirectory2(fullPath);
|
|
56763
56910
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
56764
56911
|
try {
|
|
56765
|
-
const content = await
|
|
56912
|
+
const content = await readFile35(fullPath, "utf-8");
|
|
56766
56913
|
const { transformed, changes } = transformContent(content);
|
|
56767
56914
|
if (changes > 0) {
|
|
56768
56915
|
await writeFile29(fullPath, transformed, "utf-8");
|
|
@@ -56830,7 +56977,7 @@ async function handleTransforms(ctx) {
|
|
|
56830
56977
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.takumi.json" : "Saved folder configuration to .claude/.takumi.json");
|
|
56831
56978
|
}
|
|
56832
56979
|
}
|
|
56833
|
-
const claudeDir = ctx.options.global ? ctx.resolvedDir :
|
|
56980
|
+
const claudeDir = ctx.options.global ? ctx.resolvedDir : join84(ctx.resolvedDir, ".claude");
|
|
56834
56981
|
return {
|
|
56835
56982
|
...ctx,
|
|
56836
56983
|
foldersConfig,
|
|
@@ -56955,16 +57102,16 @@ async function initCommand(options2) {
|
|
|
56955
57102
|
init_dist2();
|
|
56956
57103
|
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
56957
57104
|
import { existsSync as existsSync38 } from "node:fs";
|
|
56958
|
-
import { readFile as
|
|
57105
|
+
import { readFile as readFile41, rm as rm11, unlink as unlink12 } from "node:fs/promises";
|
|
56959
57106
|
import { homedir as homedir18 } from "node:os";
|
|
56960
|
-
import { basename as basename6, join as
|
|
57107
|
+
import { basename as basename6, join as join89, resolve as resolve16 } from "node:path";
|
|
56961
57108
|
init_logger();
|
|
56962
57109
|
|
|
56963
57110
|
// src/commands/portable/config-discovery.ts
|
|
56964
57111
|
import { existsSync as existsSync33 } from "node:fs";
|
|
56965
|
-
import { readFile as
|
|
57112
|
+
import { readFile as readFile36, readdir as readdir27 } from "node:fs/promises";
|
|
56966
57113
|
import { homedir as homedir16 } from "node:os";
|
|
56967
|
-
import { extname as extname5, join as
|
|
57114
|
+
import { extname as extname5, join as join85, relative as relative17, sep as sep4 } from "node:path";
|
|
56968
57115
|
var HOOK_EXTENSIONS2 = new Set([".js", ".cjs", ".mjs", ".ts"]);
|
|
56969
57116
|
var SHELL_HOOK_EXTENSIONS = new Set([".sh", ".ps1", ".bat", ".cmd"]);
|
|
56970
57117
|
function resolveSourceOrigin(sourcePath) {
|
|
@@ -56983,20 +57130,20 @@ function getConfigSourcePath() {
|
|
|
56983
57130
|
return findExistingProjectConfigPath(process.cwd()) ?? getGlobalConfigSourcePath();
|
|
56984
57131
|
}
|
|
56985
57132
|
function getGlobalConfigSourcePath() {
|
|
56986
|
-
return
|
|
57133
|
+
return join85(homedir16(), ".claude", "CLAUDE.md");
|
|
56987
57134
|
}
|
|
56988
57135
|
function getRulesSourcePath() {
|
|
56989
|
-
return findExistingProjectLayoutPath(process.cwd(), "rules") ??
|
|
57136
|
+
return findExistingProjectLayoutPath(process.cwd(), "rules") ?? join85(homedir16(), ".claude", "rules");
|
|
56990
57137
|
}
|
|
56991
57138
|
function getHooksSourcePath() {
|
|
56992
|
-
return findExistingProjectLayoutPath(process.cwd(), "hooks") ??
|
|
57139
|
+
return findExistingProjectLayoutPath(process.cwd(), "hooks") ?? join85(homedir16(), ".claude", "hooks");
|
|
56993
57140
|
}
|
|
56994
57141
|
async function discoverConfig(sourcePath) {
|
|
56995
57142
|
const path5 = sourcePath ?? getConfigSourcePath();
|
|
56996
57143
|
if (!existsSync33(path5)) {
|
|
56997
57144
|
return null;
|
|
56998
57145
|
}
|
|
56999
|
-
const content = await
|
|
57146
|
+
const content = await readFile36(path5, "utf-8");
|
|
57000
57147
|
return {
|
|
57001
57148
|
name: "CLAUDE",
|
|
57002
57149
|
description: "Project configuration",
|
|
@@ -57041,9 +57188,9 @@ async function discoverHooks(sourcePath) {
|
|
|
57041
57188
|
}
|
|
57042
57189
|
if (!HOOK_EXTENSIONS2.has(ext2))
|
|
57043
57190
|
continue;
|
|
57044
|
-
const fullPath =
|
|
57191
|
+
const fullPath = join85(path5, entry.name);
|
|
57045
57192
|
try {
|
|
57046
|
-
const content = await
|
|
57193
|
+
const content = await readFile36(fullPath, "utf-8");
|
|
57047
57194
|
items.push({
|
|
57048
57195
|
name: entry.name,
|
|
57049
57196
|
description: `Hook: ${entry.name}`,
|
|
@@ -57067,7 +57214,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
57067
57214
|
for (const entry of entries) {
|
|
57068
57215
|
if (entry.name.startsWith("."))
|
|
57069
57216
|
continue;
|
|
57070
|
-
const fullPath =
|
|
57217
|
+
const fullPath = join85(dir, entry.name);
|
|
57071
57218
|
if (entry.isSymbolicLink()) {
|
|
57072
57219
|
continue;
|
|
57073
57220
|
}
|
|
@@ -57088,7 +57235,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
57088
57235
|
const normalizedPath = relPath.split(/[/\\]/).join("/");
|
|
57089
57236
|
const name = options2.stripExtension ? normalizedPath.replace(/\.[^.]+$/, "") : normalizedPath;
|
|
57090
57237
|
try {
|
|
57091
|
-
const content = await
|
|
57238
|
+
const content = await readFile36(fullPath, "utf-8");
|
|
57092
57239
|
items.push({
|
|
57093
57240
|
name,
|
|
57094
57241
|
description: `${options2.descriptionPrefix}: ${name}`,
|
|
@@ -57247,14 +57394,14 @@ async function resolveConflict(action, options2) {
|
|
|
57247
57394
|
// src/commands/portable/hooks-settings-merger.ts
|
|
57248
57395
|
init_provider_registry();
|
|
57249
57396
|
import { existsSync as existsSync34, mkdirSync as mkdirSync2, renameSync as renameSync2, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
57250
|
-
import { readFile as
|
|
57251
|
-
import { basename as basename5, dirname as dirname19, join as
|
|
57397
|
+
import { readFile as readFile37 } from "node:fs/promises";
|
|
57398
|
+
import { basename as basename5, dirname as dirname19, join as join86 } from "node:path";
|
|
57252
57399
|
async function inspectHooksSettings(settingsPath) {
|
|
57253
57400
|
try {
|
|
57254
57401
|
if (!existsSync34(settingsPath)) {
|
|
57255
57402
|
return { status: "missing-file" };
|
|
57256
57403
|
}
|
|
57257
|
-
const raw = await
|
|
57404
|
+
const raw = await readFile37(settingsPath, "utf8");
|
|
57258
57405
|
const parsed = JSON.parse(raw);
|
|
57259
57406
|
if (!parsed.hooks || typeof parsed.hooks !== "object") {
|
|
57260
57407
|
return { status: "missing-hooks" };
|
|
@@ -57326,7 +57473,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks) {
|
|
|
57326
57473
|
if (existsSync34(targetSettingsPath)) {
|
|
57327
57474
|
let raw;
|
|
57328
57475
|
try {
|
|
57329
|
-
raw = await
|
|
57476
|
+
raw = await readFile37(targetSettingsPath, "utf8");
|
|
57330
57477
|
existingSettings = JSON.parse(raw);
|
|
57331
57478
|
} catch {
|
|
57332
57479
|
existingSettings = {};
|
|
@@ -57429,8 +57576,8 @@ async function migrateHooksSettings(options2) {
|
|
|
57429
57576
|
targetSettingsPath: null
|
|
57430
57577
|
};
|
|
57431
57578
|
}
|
|
57432
|
-
const resolvedSourcePath = isGlobal ? sourceSettingsPath :
|
|
57433
|
-
const resolvedTargetPath = isGlobal ? targetSettingsPath :
|
|
57579
|
+
const resolvedSourcePath = isGlobal ? sourceSettingsPath : join86(process.cwd(), sourceSettingsPath);
|
|
57580
|
+
const resolvedTargetPath = isGlobal ? targetSettingsPath : join86(process.cwd(), targetSettingsPath);
|
|
57434
57581
|
const sourceHooksResult = await inspectHooksSettings(resolvedSourcePath);
|
|
57435
57582
|
if (sourceHooksResult.status === "missing-file") {
|
|
57436
57583
|
return {
|
|
@@ -57697,7 +57844,7 @@ init_zod();
|
|
|
57697
57844
|
init_logger();
|
|
57698
57845
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
57699
57846
|
import { existsSync as existsSync35 } from "node:fs";
|
|
57700
|
-
import { readFile as
|
|
57847
|
+
import { readFile as readFile38 } from "node:fs/promises";
|
|
57701
57848
|
import path5 from "node:path";
|
|
57702
57849
|
var safeRelativePath = exports_external.string().min(1).refine((p2) => !p2.includes("..") && !path5.isAbsolute(p2), {
|
|
57703
57850
|
message: "Path must be relative without traversal"
|
|
@@ -57734,7 +57881,7 @@ async function loadPortableManifest(kitPath) {
|
|
|
57734
57881
|
logger.verbose("No portable-manifest.json found — no evolution tracking");
|
|
57735
57882
|
return null;
|
|
57736
57883
|
}
|
|
57737
|
-
const raw = await
|
|
57884
|
+
const raw = await readFile38(manifestPath, "utf-8");
|
|
57738
57885
|
let parsed;
|
|
57739
57886
|
try {
|
|
57740
57887
|
parsed = JSON.parse(raw);
|
|
@@ -57811,7 +57958,7 @@ async function backfillRegistryChecksums(actions, registry) {
|
|
|
57811
57958
|
|
|
57812
57959
|
// src/commands/portable/reconcile-state-builders.ts
|
|
57813
57960
|
import { existsSync as existsSync36 } from "node:fs";
|
|
57814
|
-
import { readFile as
|
|
57961
|
+
import { readFile as readFile39 } from "node:fs/promises";
|
|
57815
57962
|
init_provider_registry();
|
|
57816
57963
|
function getProviderPathKeyForPortableType2(type) {
|
|
57817
57964
|
switch (type) {
|
|
@@ -57922,7 +58069,7 @@ async function buildTargetStates(entries, options2) {
|
|
|
57922
58069
|
const state = { path: entryPath, exists };
|
|
57923
58070
|
if (exists) {
|
|
57924
58071
|
try {
|
|
57925
|
-
const content = await
|
|
58072
|
+
const content = await readFile39(entryPath, "utf-8");
|
|
57926
58073
|
state.currentChecksum = computeContentChecksum(content);
|
|
57927
58074
|
if (groupedEntries.some((entry) => usesMergeSingleChecksums(entry))) {
|
|
57928
58075
|
state.sectionChecksums = computeManagedSectionChecksums(content);
|
|
@@ -57949,7 +58096,7 @@ function isAbsoluteLike(value) {
|
|
|
57949
58096
|
return path6.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value) || /^\\\\/.test(value);
|
|
57950
58097
|
}
|
|
57951
58098
|
function hasDotDotSegment(value) {
|
|
57952
|
-
return value.replace(/\\/g, "/").split("/").some((
|
|
58099
|
+
return value.replace(/\\/g, "/").split("/").some((segment2) => segment2 === "..");
|
|
57953
58100
|
}
|
|
57954
58101
|
function toPathSegments(value) {
|
|
57955
58102
|
const normalized = normalizePortablePath(value).replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -58399,25 +58546,25 @@ function buildPlan(actions) {
|
|
|
58399
58546
|
}
|
|
58400
58547
|
|
|
58401
58548
|
// src/commands/skills/skills-discovery.ts
|
|
58402
|
-
import { readFile as
|
|
58549
|
+
import { readFile as readFile40, readdir as readdir28, stat as stat11 } from "node:fs/promises";
|
|
58403
58550
|
import { homedir as homedir17 } from "node:os";
|
|
58404
|
-
import { dirname as dirname20, join as
|
|
58551
|
+
import { dirname as dirname20, join as join87 } from "node:path";
|
|
58405
58552
|
init_logger();
|
|
58406
58553
|
var import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
58407
58554
|
var home5 = homedir17();
|
|
58408
58555
|
var SKIP_DIRS2 = ["node_modules", ".git", "dist", "build", ".venv", "__pycache__", "common"];
|
|
58409
58556
|
function getSkillSourcePath() {
|
|
58410
|
-
const bundledRoot =
|
|
58557
|
+
const bundledRoot = join87(process.cwd(), "node_modules", "takumi-engineer");
|
|
58411
58558
|
return findFirstExistingPath([
|
|
58412
|
-
|
|
58559
|
+
join87(bundledRoot, "skills"),
|
|
58413
58560
|
...getProjectLayoutCandidates(bundledRoot, "skills"),
|
|
58414
58561
|
...getProjectLayoutCandidates(process.cwd(), "skills"),
|
|
58415
|
-
|
|
58562
|
+
join87(home5, ".claude/skills")
|
|
58416
58563
|
]);
|
|
58417
58564
|
}
|
|
58418
58565
|
async function hasSkillMd(dir) {
|
|
58419
58566
|
try {
|
|
58420
|
-
const skillPath =
|
|
58567
|
+
const skillPath = join87(dir, "SKILL.md");
|
|
58421
58568
|
const stats = await stat11(skillPath);
|
|
58422
58569
|
return stats.isFile();
|
|
58423
58570
|
} catch {
|
|
@@ -58426,7 +58573,7 @@ async function hasSkillMd(dir) {
|
|
|
58426
58573
|
}
|
|
58427
58574
|
async function parseSkillMd(skillMdPath) {
|
|
58428
58575
|
try {
|
|
58429
|
-
const content = await
|
|
58576
|
+
const content = await readFile40(skillMdPath, "utf-8");
|
|
58430
58577
|
const { data } = import_gray_matter4.default(content);
|
|
58431
58578
|
const skillDir = dirname20(skillMdPath);
|
|
58432
58579
|
const dirName = skillDir.split(/[/\\]/).pop() || "";
|
|
@@ -58465,9 +58612,9 @@ async function discoverSkills(sourcePath) {
|
|
|
58465
58612
|
if (!entry.isDirectory() || SKIP_DIRS2.includes(entry.name)) {
|
|
58466
58613
|
continue;
|
|
58467
58614
|
}
|
|
58468
|
-
const skillDir =
|
|
58615
|
+
const skillDir = join87(searchPath, entry.name);
|
|
58469
58616
|
if (await hasSkillMd(skillDir)) {
|
|
58470
|
-
const skill = await parseSkillMd(
|
|
58617
|
+
const skill = await parseSkillMd(join87(skillDir, "SKILL.md"));
|
|
58471
58618
|
if (skill && !seenNames.has(skill.name)) {
|
|
58472
58619
|
skills.push(skill);
|
|
58473
58620
|
seenNames.add(skill.name);
|
|
@@ -58516,7 +58663,7 @@ function resolveMigrationScope(argv, options2) {
|
|
|
58516
58663
|
// src/commands/migrate/skill-directory-installer.ts
|
|
58517
58664
|
import { existsSync as existsSync37 } from "node:fs";
|
|
58518
58665
|
import { cp as cp2, mkdir as mkdir26, rename as rename6, rm as rm10 } from "node:fs/promises";
|
|
58519
|
-
import { join as
|
|
58666
|
+
import { join as join88, resolve as resolve15 } from "node:path";
|
|
58520
58667
|
init_provider_registry();
|
|
58521
58668
|
async function installSkillDirectories(skills, targetProviders, options2) {
|
|
58522
58669
|
const results = [];
|
|
@@ -58545,7 +58692,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
58545
58692
|
continue;
|
|
58546
58693
|
}
|
|
58547
58694
|
for (const skill of skills) {
|
|
58548
|
-
const targetDir =
|
|
58695
|
+
const targetDir = join88(basePath, skill.name);
|
|
58549
58696
|
if (resolve15(skill.path) === resolve15(targetDir)) {
|
|
58550
58697
|
results.push({
|
|
58551
58698
|
provider,
|
|
@@ -58672,12 +58819,12 @@ async function executeDeleteAction(action, options2) {
|
|
|
58672
58819
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
58673
58820
|
if (!skillSourcePath)
|
|
58674
58821
|
return;
|
|
58675
|
-
const sourceMetadataPath =
|
|
58822
|
+
const sourceMetadataPath = join89(resolve16(skillSourcePath, ".."), "metadata.json");
|
|
58676
58823
|
if (!existsSync38(sourceMetadataPath))
|
|
58677
58824
|
return;
|
|
58678
58825
|
let sourceMetadata;
|
|
58679
58826
|
try {
|
|
58680
|
-
const content = await
|
|
58827
|
+
const content = await readFile41(sourceMetadataPath, "utf-8");
|
|
58681
58828
|
sourceMetadata = JSON.parse(content);
|
|
58682
58829
|
} catch (error) {
|
|
58683
58830
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -58685,7 +58832,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
58685
58832
|
}
|
|
58686
58833
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
58687
58834
|
return;
|
|
58688
|
-
const claudeDir = installGlobally ?
|
|
58835
|
+
const claudeDir = installGlobally ? join89(homedir18(), ".claude") : join89(process.cwd(), ".claude");
|
|
58689
58836
|
if (!existsSync38(claudeDir))
|
|
58690
58837
|
return;
|
|
58691
58838
|
try {
|
|
@@ -58833,8 +58980,8 @@ async function migrateCommand(options2) {
|
|
|
58833
58980
|
selectedProviders = Array.from(new Set(selectedProviders));
|
|
58834
58981
|
let installGlobally = options2.global ?? false;
|
|
58835
58982
|
if (options2.global === undefined && !options2.yes) {
|
|
58836
|
-
const projectTarget =
|
|
58837
|
-
const globalTarget =
|
|
58983
|
+
const projectTarget = join89(process.cwd(), ".claude");
|
|
58984
|
+
const globalTarget = join89(homedir18(), ".claude");
|
|
58838
58985
|
const scopeChoice = await ie({
|
|
58839
58986
|
message: "Installation scope",
|
|
58840
58987
|
options: [
|
|
@@ -58886,7 +59033,7 @@ async function migrateCommand(options2) {
|
|
|
58886
59033
|
}
|
|
58887
59034
|
const providerNames = selectedProviders.map((prov) => import_picocolors25.default.cyan(providers[prov].displayName)).join(", ");
|
|
58888
59035
|
f2.message(` Providers: ${providerNames}`);
|
|
58889
|
-
const targetDir = installGlobally ?
|
|
59036
|
+
const targetDir = installGlobally ? join89(homedir18(), ".claude") : join89(process.cwd(), ".claude");
|
|
58890
59037
|
f2.message(` Scope: ${installGlobally ? "Global" : "Project"} ${import_picocolors25.default.dim(`-> ${targetDir}`)}`);
|
|
58891
59038
|
const cmdProviders = getProvidersSupporting("commands");
|
|
58892
59039
|
const unsupportedCmd = selectedProviders.filter((pv) => !cmdProviders.includes(pv));
|
|
@@ -58937,7 +59084,7 @@ async function migrateCommand(options2) {
|
|
|
58937
59084
|
for (const action of conflictActions) {
|
|
58938
59085
|
if (!action.diff && action.targetPath && existsSync38(action.targetPath)) {
|
|
58939
59086
|
try {
|
|
58940
|
-
const targetContent = await
|
|
59087
|
+
const targetContent = await readFile41(action.targetPath, "utf-8");
|
|
58941
59088
|
const sourceItem = agents.find((a3) => a3.name === action.item) || commands.find((c2) => c2.name === action.item) || (configItem?.name === action.item ? configItem : null) || ruleItems.find((r2) => r2.name === action.item) || hookItems.find((h2) => h2.name === action.item);
|
|
58942
59089
|
if (sourceItem) {
|
|
58943
59090
|
const providerConfig = providers[action.provider];
|
|
@@ -59242,7 +59389,7 @@ import { resolve as resolve17 } from "node:path";
|
|
|
59242
59389
|
init_logger();
|
|
59243
59390
|
init_path_resolver();
|
|
59244
59391
|
init_types2();
|
|
59245
|
-
var
|
|
59392
|
+
var import_fs_extra33 = __toESM(require_lib(), 1);
|
|
59246
59393
|
async function directorySetup(validOptions, prompts) {
|
|
59247
59394
|
const isNonInteractive2 = !process.stdin.isTTY || process.env.CI === "true" || process.env.NON_INTERACTIVE === "true";
|
|
59248
59395
|
const config = await ConfigManager.get();
|
|
@@ -59341,8 +59488,8 @@ async function directorySetup(validOptions, prompts) {
|
|
|
59341
59488
|
return null;
|
|
59342
59489
|
}
|
|
59343
59490
|
}
|
|
59344
|
-
if (await
|
|
59345
|
-
const files = await
|
|
59491
|
+
if (await import_fs_extra33.pathExists(resolvedDir)) {
|
|
59492
|
+
const files = await import_fs_extra33.readdir(resolvedDir);
|
|
59346
59493
|
const isEmpty = files.length === 0;
|
|
59347
59494
|
if (!isEmpty) {
|
|
59348
59495
|
if (isNonInteractive2) {
|
|
@@ -59378,7 +59525,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
59378
59525
|
};
|
|
59379
59526
|
}
|
|
59380
59527
|
// src/commands/new/phases/project-creation.ts
|
|
59381
|
-
import { join as
|
|
59528
|
+
import { join as join90 } from "node:path";
|
|
59382
59529
|
init_github_client();
|
|
59383
59530
|
init_logger();
|
|
59384
59531
|
init_output_manager();
|
|
@@ -59506,7 +59653,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
59506
59653
|
output.section("Installing");
|
|
59507
59654
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
59508
59655
|
const merger = new FileMerger;
|
|
59509
|
-
const claudeDir =
|
|
59656
|
+
const claudeDir = join90(resolvedDir, ".claude");
|
|
59510
59657
|
merger.setMultiKitContext(claudeDir, kit);
|
|
59511
59658
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
59512
59659
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -59553,6 +59700,240 @@ async function handleProjectCreation(ctx) {
|
|
|
59553
59700
|
}
|
|
59554
59701
|
// src/commands/new/phases/post-setup.ts
|
|
59555
59702
|
import { join as join92 } from "node:path";
|
|
59703
|
+
|
|
59704
|
+
// src/domains/installation/setup-wizard.ts
|
|
59705
|
+
import { join as join91 } from "node:path";
|
|
59706
|
+
init_logger();
|
|
59707
|
+
init_path_resolver();
|
|
59708
|
+
init_dist2();
|
|
59709
|
+
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
59710
|
+
var REQUIRED_ENV_KEYS = [
|
|
59711
|
+
{ key: "GEMINI_API_KEY", label: "Gemini API Key" }
|
|
59712
|
+
];
|
|
59713
|
+
async function checkRequiredKeysExist(envPath) {
|
|
59714
|
+
const envExists = await import_fs_extra34.pathExists(envPath);
|
|
59715
|
+
if (!envExists) {
|
|
59716
|
+
return { allPresent: false, missing: REQUIRED_ENV_KEYS, envExists: false };
|
|
59717
|
+
}
|
|
59718
|
+
const env2 = await parseEnvFile(envPath);
|
|
59719
|
+
const missing = [];
|
|
59720
|
+
for (const required of REQUIRED_ENV_KEYS) {
|
|
59721
|
+
const value = env2[required.key];
|
|
59722
|
+
if (!value || value.trim() === "") {
|
|
59723
|
+
missing.push(required);
|
|
59724
|
+
}
|
|
59725
|
+
}
|
|
59726
|
+
return {
|
|
59727
|
+
allPresent: missing.length === 0,
|
|
59728
|
+
missing,
|
|
59729
|
+
envExists: true
|
|
59730
|
+
};
|
|
59731
|
+
}
|
|
59732
|
+
var ESSENTIAL_CONFIGS = [
|
|
59733
|
+
{
|
|
59734
|
+
key: "GEMINI_API_KEY",
|
|
59735
|
+
label: "Google Gemini API Key",
|
|
59736
|
+
hint: "Required for ai-multimodal skill. Get from: https://aistudio.google.com/apikey",
|
|
59737
|
+
required: true,
|
|
59738
|
+
validate: VALIDATION_PATTERNS.GEMINI_API_KEY,
|
|
59739
|
+
mask: true
|
|
59740
|
+
},
|
|
59741
|
+
{
|
|
59742
|
+
key: "DISCORD_WEBHOOK_URL",
|
|
59743
|
+
label: "Discord Webhook URL (optional)",
|
|
59744
|
+
hint: "For Discord notifications. Leave empty to skip.",
|
|
59745
|
+
required: false,
|
|
59746
|
+
validate: VALIDATION_PATTERNS.DISCORD_WEBHOOK_URL,
|
|
59747
|
+
mask: false
|
|
59748
|
+
},
|
|
59749
|
+
{
|
|
59750
|
+
key: "TELEGRAM_BOT_TOKEN",
|
|
59751
|
+
label: "Telegram Bot Token (optional)",
|
|
59752
|
+
hint: "For Telegram notifications. Leave empty to skip.",
|
|
59753
|
+
required: false,
|
|
59754
|
+
validate: VALIDATION_PATTERNS.TELEGRAM_BOT_TOKEN,
|
|
59755
|
+
mask: true
|
|
59756
|
+
}
|
|
59757
|
+
];
|
|
59758
|
+
async function parseEnvFile(path7) {
|
|
59759
|
+
try {
|
|
59760
|
+
const content = await import_fs_extra34.readFile(path7, "utf-8");
|
|
59761
|
+
const env2 = {};
|
|
59762
|
+
for (const line of content.split(`
|
|
59763
|
+
`)) {
|
|
59764
|
+
let trimmed = line.trim();
|
|
59765
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
59766
|
+
continue;
|
|
59767
|
+
if (trimmed.startsWith("export ")) {
|
|
59768
|
+
trimmed = trimmed.slice(7);
|
|
59769
|
+
}
|
|
59770
|
+
const [key, ...valueParts] = trimmed.split("=");
|
|
59771
|
+
if (key) {
|
|
59772
|
+
let value = valueParts.join("=").trim();
|
|
59773
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
59774
|
+
value = value.slice(1, -1);
|
|
59775
|
+
}
|
|
59776
|
+
env2[key.trim()] = value.trim();
|
|
59777
|
+
}
|
|
59778
|
+
}
|
|
59779
|
+
return env2;
|
|
59780
|
+
} catch (error) {
|
|
59781
|
+
logger.debug(`Failed to parse .env file at ${path7}: ${error}`);
|
|
59782
|
+
return {};
|
|
59783
|
+
}
|
|
59784
|
+
}
|
|
59785
|
+
async function checkGlobalConfig() {
|
|
59786
|
+
const globalEnvPath = join91(PathResolver.getGlobalKitDir(), ".env");
|
|
59787
|
+
if (!await import_fs_extra34.pathExists(globalEnvPath))
|
|
59788
|
+
return false;
|
|
59789
|
+
const env2 = await parseEnvFile(globalEnvPath);
|
|
59790
|
+
return Object.keys(env2).length > 0;
|
|
59791
|
+
}
|
|
59792
|
+
async function runSetupWizard(options2) {
|
|
59793
|
+
const { targetDir, isGlobal } = options2;
|
|
59794
|
+
if (isGlobal) {
|
|
59795
|
+
f2.info("Configuring global defaults (shared across all projects)");
|
|
59796
|
+
} else {
|
|
59797
|
+
f2.info("Configuring project-specific settings");
|
|
59798
|
+
}
|
|
59799
|
+
let globalEnv = {};
|
|
59800
|
+
const hasGlobalConfig = !isGlobal && await checkGlobalConfig();
|
|
59801
|
+
if (!isGlobal) {
|
|
59802
|
+
const globalEnvPath = join91(PathResolver.getGlobalKitDir(), ".env");
|
|
59803
|
+
if (await import_fs_extra34.pathExists(globalEnvPath)) {
|
|
59804
|
+
globalEnv = await parseEnvFile(globalEnvPath);
|
|
59805
|
+
}
|
|
59806
|
+
}
|
|
59807
|
+
if (hasGlobalConfig && Object.keys(globalEnv).length > 0) {
|
|
59808
|
+
f2.success("Global config detected - values will be inherited automatically");
|
|
59809
|
+
}
|
|
59810
|
+
const values = {};
|
|
59811
|
+
for (const config of ESSENTIAL_CONFIGS) {
|
|
59812
|
+
const globalValue = globalEnv[config.key] || "";
|
|
59813
|
+
const hasGlobalValue = !isGlobal && !!globalValue;
|
|
59814
|
+
if (hasGlobalValue) {
|
|
59815
|
+
const maskedValue = config.mask ? `${globalValue.slice(0, 8)}...` : globalValue;
|
|
59816
|
+
const useGlobal = await se({
|
|
59817
|
+
message: `${config.label}: Use global value? (${maskedValue})`,
|
|
59818
|
+
initialValue: true
|
|
59819
|
+
});
|
|
59820
|
+
if (lD(useGlobal)) {
|
|
59821
|
+
f2.warning("Setup cancelled");
|
|
59822
|
+
return false;
|
|
59823
|
+
}
|
|
59824
|
+
if (useGlobal) {
|
|
59825
|
+
values[config.key] = globalValue;
|
|
59826
|
+
f2.success(`${config.key}: inherited from global config`);
|
|
59827
|
+
continue;
|
|
59828
|
+
}
|
|
59829
|
+
}
|
|
59830
|
+
const result = await te({
|
|
59831
|
+
message: config.label,
|
|
59832
|
+
placeholder: config.hint,
|
|
59833
|
+
validate: (value) => {
|
|
59834
|
+
if (!value && !config.required) {
|
|
59835
|
+
return;
|
|
59836
|
+
}
|
|
59837
|
+
if (!value && config.required) {
|
|
59838
|
+
return "This field is required";
|
|
59839
|
+
}
|
|
59840
|
+
if (value && config.validate && !validateApiKey2(value, config.validate)) {
|
|
59841
|
+
return "Invalid format. Please check and try again.";
|
|
59842
|
+
}
|
|
59843
|
+
return;
|
|
59844
|
+
}
|
|
59845
|
+
});
|
|
59846
|
+
if (lD(result)) {
|
|
59847
|
+
f2.warning("Setup cancelled");
|
|
59848
|
+
return false;
|
|
59849
|
+
}
|
|
59850
|
+
if (typeof result === "string" && result) {
|
|
59851
|
+
values[config.key] = result;
|
|
59852
|
+
}
|
|
59853
|
+
}
|
|
59854
|
+
if (values.GEMINI_API_KEY) {
|
|
59855
|
+
const additionalKeys = await promptForAdditionalGeminiKeys(values.GEMINI_API_KEY);
|
|
59856
|
+
for (let i = 0;i < additionalKeys.length; i++) {
|
|
59857
|
+
values[`GEMINI_API_KEY_${i + 2}`] = additionalKeys[i];
|
|
59858
|
+
}
|
|
59859
|
+
const totalKeys = 1 + additionalKeys.length;
|
|
59860
|
+
if (totalKeys > 1) {
|
|
59861
|
+
f2.success(`✓ Configured ${totalKeys} Gemini API keys for rotation`);
|
|
59862
|
+
}
|
|
59863
|
+
}
|
|
59864
|
+
await generateEnvFile(targetDir, values);
|
|
59865
|
+
f2.success(`Configuration saved to ${join91(targetDir, ".env")}`);
|
|
59866
|
+
return true;
|
|
59867
|
+
}
|
|
59868
|
+
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
59869
|
+
const additionalKeys = [];
|
|
59870
|
+
const allKeys = new Set([primaryKey]);
|
|
59871
|
+
const wantMore = await se({
|
|
59872
|
+
message: "Add additional API keys for rotation? (recommended for high usage)",
|
|
59873
|
+
initialValue: false
|
|
59874
|
+
});
|
|
59875
|
+
if (lD(wantMore) || !wantMore) {
|
|
59876
|
+
return additionalKeys;
|
|
59877
|
+
}
|
|
59878
|
+
let keyNumber = 2;
|
|
59879
|
+
const maxKeys = 10;
|
|
59880
|
+
while (keyNumber <= maxKeys) {
|
|
59881
|
+
const result = await te({
|
|
59882
|
+
message: `Gemini API Key #${keyNumber} (press Enter to finish)`,
|
|
59883
|
+
placeholder: "AIza... or leave empty to finish",
|
|
59884
|
+
validate: (value) => {
|
|
59885
|
+
if (!value)
|
|
59886
|
+
return;
|
|
59887
|
+
const trimmed = value.trim();
|
|
59888
|
+
if (!trimmed)
|
|
59889
|
+
return;
|
|
59890
|
+
if (!validateApiKey2(trimmed, VALIDATION_PATTERNS.GEMINI_API_KEY)) {
|
|
59891
|
+
return "Invalid format. Gemini keys start with 'AIza' and are 39 characters.";
|
|
59892
|
+
}
|
|
59893
|
+
if (allKeys.has(trimmed)) {
|
|
59894
|
+
return "This key was already added. Please enter a different key.";
|
|
59895
|
+
}
|
|
59896
|
+
return;
|
|
59897
|
+
}
|
|
59898
|
+
});
|
|
59899
|
+
if (lD(result)) {
|
|
59900
|
+
break;
|
|
59901
|
+
}
|
|
59902
|
+
if (!result || result.trim() === "") {
|
|
59903
|
+
break;
|
|
59904
|
+
}
|
|
59905
|
+
const trimmedKey = result.trim();
|
|
59906
|
+
additionalKeys.push(trimmedKey);
|
|
59907
|
+
allKeys.add(trimmedKey);
|
|
59908
|
+
keyNumber++;
|
|
59909
|
+
}
|
|
59910
|
+
return additionalKeys;
|
|
59911
|
+
}
|
|
59912
|
+
async function promptSetupWizardIfNeeded(options2) {
|
|
59913
|
+
const { envPath, claudeDir, isGlobal, isNonInteractive: isNonInteractive2, prompts } = options2;
|
|
59914
|
+
if (isNonInteractive2) {
|
|
59915
|
+
return;
|
|
59916
|
+
}
|
|
59917
|
+
const { allPresent, missing, envExists } = await checkRequiredKeysExist(envPath);
|
|
59918
|
+
if (allPresent) {
|
|
59919
|
+
return;
|
|
59920
|
+
}
|
|
59921
|
+
const missingKeys = missing.map((m3) => m3.label).join(", ");
|
|
59922
|
+
const promptMessage = envExists ? `Missing required: ${missingKeys}. Set up now?` : "Set up API keys now? (Gemini API key for ai-multimodal skill, optional webhooks)";
|
|
59923
|
+
const shouldSetup = await prompts.confirm(promptMessage);
|
|
59924
|
+
if (shouldSetup) {
|
|
59925
|
+
await runSetupWizard({
|
|
59926
|
+
targetDir: claudeDir,
|
|
59927
|
+
isGlobal
|
|
59928
|
+
});
|
|
59929
|
+
} else {
|
|
59930
|
+
prompts.note(`Create ${envPath} manually or run 'tkm setup' to configure.
|
|
59931
|
+
Required: GEMINI_API_KEY
|
|
59932
|
+
Optional: DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN`, "Configuration skipped");
|
|
59933
|
+
}
|
|
59934
|
+
}
|
|
59935
|
+
|
|
59936
|
+
// src/commands/new/phases/post-setup.ts
|
|
59556
59937
|
init_package_installer();
|
|
59557
59938
|
init_logger();
|
|
59558
59939
|
init_path_resolver();
|
|
@@ -59641,7 +60022,7 @@ Please use only one download method.`);
|
|
|
59641
60022
|
throw new Error(`--use-git requires --release <tag> to specify the version.
|
|
59642
60023
|
|
|
59643
60024
|
Git clone mode cannot list versions without GitHub API access.
|
|
59644
|
-
Example:
|
|
60025
|
+
Example: tkm new --use-git --release v2.1.0`);
|
|
59645
60026
|
}
|
|
59646
60027
|
let ctx = createNewContext(validOptions, prompts);
|
|
59647
60028
|
ctx = await handleDirectorySetup(ctx);
|
|
@@ -59654,7 +60035,7 @@ Example: takumi new --use-git --release v2.1.0`);
|
|
|
59654
60035
|
if (ctx.cancelled)
|
|
59655
60036
|
return;
|
|
59656
60037
|
prompts.outro(`✨ Project created successfully at ${ctx.resolvedDir}`);
|
|
59657
|
-
log.info(`${import_picocolors26.default.dim("Tip:")} To update later: ${import_picocolors26.default.cyan("
|
|
60038
|
+
log.info(`${import_picocolors26.default.dim("Tip:")} To update later: ${import_picocolors26.default.cyan("tkm update")} (CLI) + ${import_picocolors26.default.cyan("tkm init")} (kit content)`);
|
|
59658
60039
|
} catch (error) {
|
|
59659
60040
|
logger.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
59660
60041
|
process.exit(1);
|
|
@@ -62260,12 +62641,12 @@ function collectRuntimeContext() {
|
|
|
62260
62641
|
async function handleEnable() {
|
|
62261
62642
|
await TakumiConfigManager.updateField(TELEMETRY_HOOK_FIELD, true, "global", null);
|
|
62262
62643
|
logger.success("Telemetry enabled. Anonymous usage data will be sent after future Claude Code sessions.");
|
|
62263
|
-
logger.info("To inspect what's collected: `
|
|
62644
|
+
logger.info("To inspect what's collected: `tkm telemetry status`.");
|
|
62264
62645
|
}
|
|
62265
62646
|
async function handleDisable() {
|
|
62266
62647
|
await TakumiConfigManager.updateField(TELEMETRY_HOOK_FIELD, false, "global", null);
|
|
62267
62648
|
logger.success("Telemetry disabled. The Stop hook will exit early and send nothing.");
|
|
62268
|
-
logger.info("To remove already-captured local data: `
|
|
62649
|
+
logger.info("To remove already-captured local data: `tkm telemetry purge`.");
|
|
62269
62650
|
}
|
|
62270
62651
|
// src/commands/telemetry/phases/purge-local-handler.ts
|
|
62271
62652
|
init_logger();
|
|
@@ -62309,7 +62690,7 @@ async function handlePurgeLocal() {
|
|
|
62309
62690
|
console.log(` Identity cache : ${result.userCacheRemoved ? "removed" : "not present"}`);
|
|
62310
62691
|
console.log(` Rate throttle : ${result.rateStateRemoved ? "removed" : "not present"}`);
|
|
62311
62692
|
console.log(` Event buffers : ${result.bufferFilesRemoved} file(s) removed`);
|
|
62312
|
-
logger.info("To also remove server-side rows, run `
|
|
62693
|
+
logger.info("To also remove server-side rows, run `tkm telemetry purge-remote` (deletes all your uploaded data).");
|
|
62313
62694
|
}
|
|
62314
62695
|
// src/commands/telemetry/phases/purge-remote-handler.ts
|
|
62315
62696
|
init_logger();
|
|
@@ -62318,7 +62699,7 @@ var PURGE_TIMEOUT_MS = 1e4;
|
|
|
62318
62699
|
async function handlePurgeRemote(options2) {
|
|
62319
62700
|
const cache = readUserCache();
|
|
62320
62701
|
if (!cache?.githubLogin) {
|
|
62321
|
-
logger.error("No GitHub identity on record. Run `
|
|
62702
|
+
logger.error("No GitHub identity on record. Run `tkm init` first so we know which account to purge.");
|
|
62322
62703
|
process.exitCode = 1;
|
|
62323
62704
|
return;
|
|
62324
62705
|
}
|
|
@@ -62329,7 +62710,7 @@ async function handlePurgeRemote(options2) {
|
|
|
62329
62710
|
return;
|
|
62330
62711
|
}
|
|
62331
62712
|
if (!token) {
|
|
62332
|
-
logger.error("Telemetry token is not configured. Re-run `
|
|
62713
|
+
logger.error("Telemetry token is not configured. Re-run `tkm init` against a release build that injects the token.");
|
|
62333
62714
|
process.exitCode = 1;
|
|
62334
62715
|
return;
|
|
62335
62716
|
}
|
|
@@ -62366,7 +62747,7 @@ async function handlePurgeRemote(options2) {
|
|
|
62366
62747
|
clearTimeout(timer);
|
|
62367
62748
|
if (resp.status === 204) {
|
|
62368
62749
|
logger.success(`Server-side data for "${cache.githubLogin}" deleted.`);
|
|
62369
|
-
logger.info("Run `
|
|
62750
|
+
logger.info("Run `tkm telemetry purge` to clear the local cache and buffer too, if you haven't already.");
|
|
62370
62751
|
return;
|
|
62371
62752
|
}
|
|
62372
62753
|
let detail = "";
|
|
@@ -62421,7 +62802,7 @@ async function handleStatus2(options2) {
|
|
|
62421
62802
|
console.log(` Pending buffers : ${ctx.bufferFileCount} file(s) in ${ctx.bufferDir}`);
|
|
62422
62803
|
console.log(` Rate throttle : ${ctx.rateStateExists ? "present" : "none"}`);
|
|
62423
62804
|
if (!enabled) {
|
|
62424
|
-
logger.warning("Telemetry is disabled. Re-enable with `
|
|
62805
|
+
logger.warning("Telemetry is disabled. Re-enable with `tkm telemetry enable` if you'd like to share usage data.");
|
|
62425
62806
|
}
|
|
62426
62807
|
}
|
|
62427
62808
|
// src/commands/telemetry/telemetry-command.ts
|
|
@@ -62433,7 +62814,7 @@ var VALID_ACTIONS = [
|
|
|
62433
62814
|
"purge-remote"
|
|
62434
62815
|
];
|
|
62435
62816
|
function usage() {
|
|
62436
|
-
console.error("Usage:
|
|
62817
|
+
console.error("Usage: tkm telemetry <status|enable|disable|purge|purge-remote>");
|
|
62437
62818
|
console.error(" status Show current telemetry state");
|
|
62438
62819
|
console.error(" enable Opt back in (writes to ~/.claude/.takumi.json)");
|
|
62439
62820
|
console.error(" disable Opt out — stops the Stop-hook POST");
|
|
@@ -63066,22 +63447,22 @@ var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
|
63066
63447
|
// package.json
|
|
63067
63448
|
var package_default = {
|
|
63068
63449
|
name: "@sunasteriskrnd/takumi",
|
|
63069
|
-
version: "2.0
|
|
63450
|
+
version: "0.2.0",
|
|
63070
63451
|
description: "CLI tool for bootstrapping and managing Takumi projects",
|
|
63071
63452
|
type: "module",
|
|
63072
63453
|
repository: {
|
|
63073
63454
|
type: "git",
|
|
63074
|
-
url: "git+https://github.com/sun-asterisk-internal/
|
|
63455
|
+
url: "git+https://github.com/sun-asterisk-internal/takumi-cli.git"
|
|
63075
63456
|
},
|
|
63076
63457
|
publishConfig: {
|
|
63077
63458
|
access: "public",
|
|
63078
|
-
registry: "https://registry.npmjs.org"
|
|
63459
|
+
registry: "https://registry.npmjs.org/"
|
|
63079
63460
|
},
|
|
63080
63461
|
bin: {
|
|
63081
|
-
|
|
63462
|
+
tkm: "bin/tkm.js"
|
|
63082
63463
|
},
|
|
63083
63464
|
files: [
|
|
63084
|
-
"bin/
|
|
63465
|
+
"bin/tkm.js",
|
|
63085
63466
|
"dist/index.js"
|
|
63086
63467
|
],
|
|
63087
63468
|
scripts: {
|
|
@@ -63155,7 +63536,7 @@ var package_default = {
|
|
|
63155
63536
|
"@types/tar": "^6.1.13",
|
|
63156
63537
|
"@types/tmp": "^0.2.6",
|
|
63157
63538
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
63158
|
-
"semantic-release": "^
|
|
63539
|
+
"semantic-release": "^25.0.0",
|
|
63159
63540
|
typescript: "^5.7.2"
|
|
63160
63541
|
}
|
|
63161
63542
|
};
|
|
@@ -63195,7 +63576,7 @@ function redactCommandForLog(command) {
|
|
|
63195
63576
|
return redactedRegistryFlags.replace(/https?:\/\/[^\s"']+/g, (url) => redactRegistryUrlForLog(url));
|
|
63196
63577
|
}
|
|
63197
63578
|
function buildInitCommand(isGlobal, kit, beta, yes) {
|
|
63198
|
-
const parts = ["
|
|
63579
|
+
const parts = ["tkm init"];
|
|
63199
63580
|
if (isGlobal)
|
|
63200
63581
|
parts.push("-g");
|
|
63201
63582
|
if (kit)
|
|
@@ -63373,13 +63754,13 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
63373
63754
|
args.push("--install-skills");
|
|
63374
63755
|
if (useBeta)
|
|
63375
63756
|
args.push("--beta");
|
|
63376
|
-
const displayCmd = `
|
|
63757
|
+
const displayCmd = `tkm ${args.join(" ")}`;
|
|
63377
63758
|
logger.info(`Running: ${displayCmd}`);
|
|
63378
63759
|
const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve25) => {
|
|
63379
|
-
const child = spawn2("
|
|
63760
|
+
const child = spawn2("tkm", spawnArgs, { stdio: "inherit", shell: true });
|
|
63380
63761
|
child.on("close", (code) => resolve25(code ?? 1));
|
|
63381
63762
|
child.on("error", (err) => {
|
|
63382
|
-
logger.verbose(`Failed to spawn
|
|
63763
|
+
logger.verbose(`Failed to spawn tkm init: ${err.message}`);
|
|
63383
63764
|
resolve25(1);
|
|
63384
63765
|
});
|
|
63385
63766
|
}));
|
|
@@ -63445,7 +63826,7 @@ async function promptMigrateUpdate(deps) {
|
|
|
63445
63826
|
isGlobal = !!setup.global.metadata && !setup.project.metadata;
|
|
63446
63827
|
} catch {}
|
|
63447
63828
|
const providerNames = safeProviders.map((p2) => getConfigFn(p2).displayName).join(", ");
|
|
63448
|
-
const parts = ["
|
|
63829
|
+
const parts = ["tkm", "migrate"];
|
|
63449
63830
|
if (isGlobal)
|
|
63450
63831
|
parts.push("-g");
|
|
63451
63832
|
for (const p2 of safeProviders) {
|
|
@@ -63458,7 +63839,7 @@ async function promptMigrateUpdate(deps) {
|
|
|
63458
63839
|
await execFn(cmd, { timeout: 300000 });
|
|
63459
63840
|
logger.success("Auto-migration complete");
|
|
63460
63841
|
} catch (error) {
|
|
63461
|
-
logger.warning(`Auto-migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`
|
|
63842
|
+
logger.warning(`Auto-migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`tkm migrate\` manually to retry.`);
|
|
63462
63843
|
}
|
|
63463
63844
|
} catch (error) {
|
|
63464
63845
|
logger.verbose(`Migrate step skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -63499,7 +63880,7 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
63499
63880
|
const exists = await npmRegistryClient.versionExists(TAKUMI_CLI_NPM_PACKAGE_NAME, opts.release, registryUrl);
|
|
63500
63881
|
if (!exists) {
|
|
63501
63882
|
s3.stop("Version not found");
|
|
63502
|
-
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run '
|
|
63883
|
+
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'tkm versions' to see available versions.`);
|
|
63503
63884
|
}
|
|
63504
63885
|
} catch (error) {
|
|
63505
63886
|
if (error instanceof CliUpdateError) {
|
|
@@ -63550,7 +63931,7 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
63550
63931
|
if (opts.check) {
|
|
63551
63932
|
note(`CLI update available: ${currentVersion} -> ${targetVersion}
|
|
63552
63933
|
|
|
63553
|
-
Run '
|
|
63934
|
+
Run 'tkm update' to install`, "Update Check");
|
|
63554
63935
|
await promptKitUpdateFn(targetIsPrerelease, opts.yes);
|
|
63555
63936
|
await promptMigrateUpdateFn();
|
|
63556
63937
|
outro("Check complete");
|
|
@@ -63592,13 +63973,13 @@ Manual update: ${updateCmd}`);
|
|
|
63592
63973
|
}
|
|
63593
63974
|
s3.start("Verifying installation...");
|
|
63594
63975
|
try {
|
|
63595
|
-
const versionResult = await execAsyncFn("
|
|
63976
|
+
const versionResult = await execAsyncFn("tkm --version", { timeout: 5000 });
|
|
63596
63977
|
const stdout2 = extractCommandStdout(versionResult);
|
|
63597
63978
|
const activeVersion = parseCliVersionFromOutput(stdout2);
|
|
63598
63979
|
if (!activeVersion) {
|
|
63599
63980
|
s3.stop("Verification failed");
|
|
63600
|
-
const message = `Update completed but could not parse '
|
|
63601
|
-
Please restart your terminal and run '
|
|
63981
|
+
const message = `Update completed but could not parse 'tkm --version' output.
|
|
63982
|
+
Please restart your terminal and run 'tkm --version'. Expected: ${targetVersion}
|
|
63602
63983
|
|
|
63603
63984
|
Manual update: ${redactCommandForLog(updateCmd)}`;
|
|
63604
63985
|
logger.error(message);
|
|
@@ -63626,7 +64007,7 @@ Run '${redactCommandForLog(updateCmd)}' manually, restart terminal, then check c
|
|
|
63626
64007
|
}
|
|
63627
64008
|
s3.stop("Verification failed");
|
|
63628
64009
|
const message = `Update completed but automatic verification failed.
|
|
63629
|
-
Please restart your terminal and run '
|
|
64010
|
+
Please restart your terminal and run 'tkm --version'. Expected: ${targetVersion}
|
|
63630
64011
|
|
|
63631
64012
|
Manual update: ${redactCommandForLog(updateCmd)}`;
|
|
63632
64013
|
logger.error(message);
|
|
@@ -65612,7 +65993,7 @@ function registerCommands(cli) {
|
|
|
65612
65993
|
console.log(" 'takumi update' now only updates the Takumi CLI itself.");
|
|
65613
65994
|
console.log();
|
|
65614
65995
|
console.log(" To update a kit installation, use:");
|
|
65615
|
-
const suggestedCmd = ["
|
|
65996
|
+
const suggestedCmd = ["tkm init"];
|
|
65616
65997
|
if (options2.kit)
|
|
65617
65998
|
suggestedCmd.push(`--kit ${options2.kit}`);
|
|
65618
65999
|
if (options2.global)
|
|
@@ -65660,14 +66041,14 @@ function registerCommands(cli) {
|
|
|
65660
66041
|
break;
|
|
65661
66042
|
case "approve":
|
|
65662
66043
|
if (!id) {
|
|
65663
|
-
console.error("Usage:
|
|
66044
|
+
console.error("Usage: tkm content approve <id>");
|
|
65664
66045
|
return;
|
|
65665
66046
|
}
|
|
65666
66047
|
await content.approveContentCmd(id);
|
|
65667
66048
|
break;
|
|
65668
66049
|
case "reject":
|
|
65669
66050
|
if (!id) {
|
|
65670
|
-
console.error("Usage:
|
|
66051
|
+
console.error("Usage: tkm content reject <id>");
|
|
65671
66052
|
return;
|
|
65672
66053
|
}
|
|
65673
66054
|
await content.rejectContentCmd(id, options2.reason);
|
|
@@ -65724,6 +66105,7 @@ function registerCommands(cli) {
|
|
|
65724
66105
|
// src/cli/version-display.ts
|
|
65725
66106
|
import { existsSync as existsSync68, readFileSync as readFileSync21 } from "node:fs";
|
|
65726
66107
|
import { join as join124 } from "node:path";
|
|
66108
|
+
init_help_banner();
|
|
65727
66109
|
// src/domains/versioning/checking/kit-version-checker.ts
|
|
65728
66110
|
init_github_client();
|
|
65729
66111
|
init_logger();
|
|
@@ -65891,7 +66273,7 @@ class CliVersionChecker {
|
|
|
65891
66273
|
}
|
|
65892
66274
|
}
|
|
65893
66275
|
// src/domains/versioning/checking/notification-display.ts
|
|
65894
|
-
var
|
|
66276
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
65895
66277
|
function createNotificationBox2(borderColor, boxWidth) {
|
|
65896
66278
|
const contentWidth = boxWidth - 2;
|
|
65897
66279
|
const topBorder = borderColor(`╭${"─".repeat(contentWidth)}╮`);
|
|
@@ -65916,13 +66298,13 @@ function displayKitNotification(result, options2 = {}) {
|
|
|
65916
66298
|
const displayCurrent = normalizeVersion(currentVersion);
|
|
65917
66299
|
const displayLatest = normalizeVersion(latestVersion);
|
|
65918
66300
|
const boxWidth = 52;
|
|
65919
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(
|
|
65920
|
-
const headerText =
|
|
66301
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(import_picocolors40.default.cyan, boxWidth);
|
|
66302
|
+
const headerText = import_picocolors40.default.bold(import_picocolors40.default.yellow("⬆ Kit Update Available"));
|
|
65921
66303
|
const headerLen = "⬆ Kit Update Available".length;
|
|
65922
|
-
const versionText = `${
|
|
66304
|
+
const versionText = `${import_picocolors40.default.dim(displayCurrent)} ${import_picocolors40.default.white("→")} ${import_picocolors40.default.green(import_picocolors40.default.bold(displayLatest))}`;
|
|
65923
66305
|
const versionLen = displayCurrent.length + 3 + displayLatest.length;
|
|
65924
|
-
const updateCmd = isGlobal ? "
|
|
65925
|
-
const commandText = `Run: ${
|
|
66306
|
+
const updateCmd = isGlobal ? "tkm init -g" : "tkm init";
|
|
66307
|
+
const commandText = `Run: ${import_picocolors40.default.cyan(import_picocolors40.default.bold(updateCmd))}`;
|
|
65926
66308
|
const commandLen = `Run: ${updateCmd}`.length;
|
|
65927
66309
|
console.log("");
|
|
65928
66310
|
console.log(topBorder);
|
|
@@ -65940,13 +66322,13 @@ function displayCliNotification(result) {
|
|
|
65940
66322
|
return;
|
|
65941
66323
|
const { currentVersion, latestVersion } = result;
|
|
65942
66324
|
const boxWidth = 52;
|
|
65943
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(
|
|
65944
|
-
const headerText =
|
|
66325
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(import_picocolors40.default.magenta, boxWidth);
|
|
66326
|
+
const headerText = import_picocolors40.default.bold(import_picocolors40.default.yellow("⬆ CLI Update Available"));
|
|
65945
66327
|
const headerLen = "⬆ CLI Update Available".length;
|
|
65946
|
-
const versionText = `${
|
|
66328
|
+
const versionText = `${import_picocolors40.default.dim(currentVersion)} ${import_picocolors40.default.white("→")} ${import_picocolors40.default.green(import_picocolors40.default.bold(latestVersion))}`;
|
|
65947
66329
|
const versionLen = currentVersion.length + 3 + latestVersion.length;
|
|
65948
|
-
const commandText = `Run: ${
|
|
65949
|
-
const commandLen = "Run:
|
|
66330
|
+
const commandText = `Run: ${import_picocolors40.default.magenta(import_picocolors40.default.bold("tkm update"))}`;
|
|
66331
|
+
const commandLen = "Run: tkm update".length;
|
|
65950
66332
|
console.log("");
|
|
65951
66333
|
console.log(topBorder);
|
|
65952
66334
|
console.log(emptyLine);
|
|
@@ -66007,6 +66389,11 @@ function getFirstKitVersion(metadata) {
|
|
|
66007
66389
|
return metadata.kits?.[firstKit]?.version ?? null;
|
|
66008
66390
|
}
|
|
66009
66391
|
async function displayVersion() {
|
|
66392
|
+
if (process.stdout.isTTY) {
|
|
66393
|
+
const width = process.stdout.columns || 80;
|
|
66394
|
+
console.log(getBannerWithVersion(packageVersion, width));
|
|
66395
|
+
console.log("");
|
|
66396
|
+
}
|
|
66010
66397
|
console.log(`CLI Version: ${packageVersion}`);
|
|
66011
66398
|
let foundAnyKit = false;
|
|
66012
66399
|
let localKitVersion = null;
|
|
@@ -66050,7 +66437,7 @@ async function displayVersion() {
|
|
|
66050
66437
|
if (!foundAnyKit) {
|
|
66051
66438
|
console.log("No Takumi installation found");
|
|
66052
66439
|
console.log(`
|
|
66053
|
-
To get started:
|
|
66440
|
+
To get started: tkm new (local project) or tkm init -g (global)`);
|
|
66054
66441
|
}
|
|
66055
66442
|
try {
|
|
66056
66443
|
const cliUpdateCheck = await CliVersionChecker2.check(packageVersion);
|
|
@@ -66077,7 +66464,7 @@ function getPackageVersion2() {
|
|
|
66077
66464
|
|
|
66078
66465
|
// src/shared/logger.ts
|
|
66079
66466
|
init_output_manager();
|
|
66080
|
-
var
|
|
66467
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
66081
66468
|
import { createWriteStream as createWriteStream5 } from "node:fs";
|
|
66082
66469
|
|
|
66083
66470
|
class Logger2 {
|
|
@@ -66086,23 +66473,23 @@ class Logger2 {
|
|
|
66086
66473
|
exitHandlerRegistered = false;
|
|
66087
66474
|
info(message) {
|
|
66088
66475
|
const symbols = output.getSymbols();
|
|
66089
|
-
console.log(
|
|
66476
|
+
console.log(import_picocolors41.default.blue(symbols.info), message);
|
|
66090
66477
|
}
|
|
66091
66478
|
success(message) {
|
|
66092
66479
|
const symbols = output.getSymbols();
|
|
66093
|
-
console.log(
|
|
66480
|
+
console.log(import_picocolors41.default.green(symbols.success), message);
|
|
66094
66481
|
}
|
|
66095
66482
|
warning(message) {
|
|
66096
66483
|
const symbols = output.getSymbols();
|
|
66097
|
-
console.log(
|
|
66484
|
+
console.log(import_picocolors41.default.yellow(symbols.warning), message);
|
|
66098
66485
|
}
|
|
66099
66486
|
error(message) {
|
|
66100
66487
|
const symbols = output.getSymbols();
|
|
66101
|
-
console.error(
|
|
66488
|
+
console.error(import_picocolors41.default.red(symbols.error), message);
|
|
66102
66489
|
}
|
|
66103
66490
|
debug(message) {
|
|
66104
66491
|
if (process.env.DEBUG) {
|
|
66105
|
-
console.log(
|
|
66492
|
+
console.log(import_picocolors41.default.gray("[DEBUG]"), message);
|
|
66106
66493
|
}
|
|
66107
66494
|
}
|
|
66108
66495
|
verbose(message, context) {
|
|
@@ -66111,7 +66498,7 @@ class Logger2 {
|
|
|
66111
66498
|
const timestamp = this.getTimestamp();
|
|
66112
66499
|
const sanitizedMessage = this.sanitize(message);
|
|
66113
66500
|
const formattedContext = context ? this.formatContext(context) : "";
|
|
66114
|
-
const logLine = `${timestamp} ${
|
|
66501
|
+
const logLine = `${timestamp} ${import_picocolors41.default.gray("[VERBOSE]")} ${sanitizedMessage}${formattedContext}`;
|
|
66115
66502
|
console.error(logLine);
|
|
66116
66503
|
if (this.logFileStream) {
|
|
66117
66504
|
const plainLogLine = `${timestamp} [VERBOSE] ${sanitizedMessage}${formattedContext}`;
|
|
@@ -66214,7 +66601,7 @@ var logger3 = new Logger2;
|
|
|
66214
66601
|
|
|
66215
66602
|
// src/shared/output-manager.ts
|
|
66216
66603
|
init_terminal_utils();
|
|
66217
|
-
var
|
|
66604
|
+
var import_picocolors42 = __toESM(require_picocolors(), 1);
|
|
66218
66605
|
var SYMBOLS2 = {
|
|
66219
66606
|
unicode: {
|
|
66220
66607
|
prompt: "◇",
|
|
@@ -66295,7 +66682,7 @@ class OutputManager2 {
|
|
|
66295
66682
|
if (this.config.quiet)
|
|
66296
66683
|
return;
|
|
66297
66684
|
const symbol = this.getSymbols().success;
|
|
66298
|
-
console.log(
|
|
66685
|
+
console.log(import_picocolors42.default.green(`${symbol} ${message}`));
|
|
66299
66686
|
}
|
|
66300
66687
|
error(message, data) {
|
|
66301
66688
|
if (this.config.json) {
|
|
@@ -66303,7 +66690,7 @@ class OutputManager2 {
|
|
|
66303
66690
|
return;
|
|
66304
66691
|
}
|
|
66305
66692
|
const symbol = this.getSymbols().error;
|
|
66306
|
-
console.error(
|
|
66693
|
+
console.error(import_picocolors42.default.red(`${symbol} ${message}`));
|
|
66307
66694
|
}
|
|
66308
66695
|
warning(message, data) {
|
|
66309
66696
|
if (this.config.json) {
|
|
@@ -66313,7 +66700,7 @@ class OutputManager2 {
|
|
|
66313
66700
|
if (this.config.quiet)
|
|
66314
66701
|
return;
|
|
66315
66702
|
const symbol = this.getSymbols().warning;
|
|
66316
|
-
console.log(
|
|
66703
|
+
console.log(import_picocolors42.default.yellow(`${symbol} ${message}`));
|
|
66317
66704
|
}
|
|
66318
66705
|
info(message, data) {
|
|
66319
66706
|
if (this.config.json) {
|
|
@@ -66323,7 +66710,7 @@ class OutputManager2 {
|
|
|
66323
66710
|
if (this.config.quiet)
|
|
66324
66711
|
return;
|
|
66325
66712
|
const symbol = this.getSymbols().info;
|
|
66326
|
-
console.log(
|
|
66713
|
+
console.log(import_picocolors42.default.blue(`${symbol} ${message}`));
|
|
66327
66714
|
}
|
|
66328
66715
|
verbose(message, data) {
|
|
66329
66716
|
if (!this.config.verbose)
|
|
@@ -66332,7 +66719,7 @@ class OutputManager2 {
|
|
|
66332
66719
|
this.addJsonEntry({ type: "info", message, data });
|
|
66333
66720
|
return;
|
|
66334
66721
|
}
|
|
66335
|
-
console.log(
|
|
66722
|
+
console.log(import_picocolors42.default.dim(` ${message}`));
|
|
66336
66723
|
}
|
|
66337
66724
|
indent(message) {
|
|
66338
66725
|
if (this.config.json)
|
|
@@ -66357,7 +66744,7 @@ class OutputManager2 {
|
|
|
66357
66744
|
return;
|
|
66358
66745
|
const symbols = this.getSymbols();
|
|
66359
66746
|
console.log();
|
|
66360
|
-
console.log(
|
|
66747
|
+
console.log(import_picocolors42.default.bold(import_picocolors42.default.cyan(`${symbols.line} ${title}`)));
|
|
66361
66748
|
}
|
|
66362
66749
|
addJsonEntry(entry) {
|
|
66363
66750
|
this.jsonBuffer.push({
|