ocx 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1990 -1900
- package/dist/index.js.map +21 -20
- package/package.json +61 -27
- package/dist/bin/ocx-darwin-arm64 +0 -0
- package/scripts/build-binary.ts +0 -96
- package/scripts/build.ts +0 -17
- package/scripts/install.sh +0 -65
- package/src/commands/add.ts +0 -229
- package/src/commands/build.ts +0 -150
- package/src/commands/diff.ts +0 -139
- package/src/commands/init.ts +0 -90
- package/src/commands/registry.ts +0 -153
- package/src/commands/search.ts +0 -159
- package/src/constants.ts +0 -18
- package/src/index.ts +0 -42
- package/src/registry/fetcher.ts +0 -168
- package/src/registry/index.ts +0 -2
- package/src/registry/opencode-config.ts +0 -182
- package/src/registry/resolver.ts +0 -127
- package/src/schemas/config.ts +0 -207
- package/src/schemas/index.ts +0 -6
- package/src/schemas/registry.ts +0 -268
- package/src/utils/env.ts +0 -27
- package/src/utils/errors.ts +0 -81
- package/src/utils/handle-error.ts +0 -108
- package/src/utils/index.ts +0 -10
- package/src/utils/json-output.ts +0 -107
- package/src/utils/logger.ts +0 -72
- package/src/utils/spinner.ts +0 -46
- package/tests/add.test.ts +0 -102
- package/tests/build.test.ts +0 -136
- package/tests/diff.test.ts +0 -47
- package/tests/helpers.ts +0 -68
- package/tests/init.test.ts +0 -52
- package/tests/mock-registry.ts +0 -105
- package/tests/registry.test.ts +0 -78
- package/tests/search.test.ts +0 -64
- package/tsconfig.json +0 -15
package/dist/index.js
CHANGED
|
@@ -4507,19 +4507,11 @@ var {
|
|
|
4507
4507
|
Help
|
|
4508
4508
|
} = import__.default;
|
|
4509
4509
|
|
|
4510
|
-
// src/commands/
|
|
4510
|
+
// src/commands/add.ts
|
|
4511
|
+
import { createHash } from "crypto";
|
|
4511
4512
|
import { existsSync } from "fs";
|
|
4512
|
-
import { writeFile } from "fs/promises";
|
|
4513
|
-
import { join } from "path";
|
|
4514
|
-
|
|
4515
|
-
// src/constants.ts
|
|
4516
|
-
var OCX_DOMAIN = "ocx.kdco.dev";
|
|
4517
|
-
var GITHUB_REPO = "kdcokenny/ocx";
|
|
4518
|
-
var OCX_SCHEMA_URL = `https://${OCX_DOMAIN}/schema.json`;
|
|
4519
|
-
var OCX_LOCK_SCHEMA_URL = `https://${OCX_DOMAIN}/lock.schema.json`;
|
|
4520
|
-
var OCX_INSTALL_URL = `https://${OCX_DOMAIN}/install.sh`;
|
|
4521
|
-
var GITHUB_RELEASES_URL = `https://github.com/${GITHUB_REPO}/releases`;
|
|
4522
|
-
var GITHUB_RAW_URL = `https://raw.githubusercontent.com/${GITHUB_REPO}/main`;
|
|
4513
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
4514
|
+
import { dirname, join } from "path";
|
|
4523
4515
|
|
|
4524
4516
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
4525
4517
|
var exports_external = {};
|
|
@@ -8510,9 +8502,9 @@ var targetPathSchema = exports_external.string().refine((path) => path.startsWit
|
|
|
8510
8502
|
message: 'Target path must start with ".opencode/"'
|
|
8511
8503
|
}).refine((path) => {
|
|
8512
8504
|
const parts = path.split("/");
|
|
8513
|
-
if (parts.length < 2)
|
|
8514
|
-
return false;
|
|
8515
8505
|
const dir = parts[1];
|
|
8506
|
+
if (!dir)
|
|
8507
|
+
return false;
|
|
8516
8508
|
return ["agent", "skill", "plugin", "command", "tool", "philosophy"].includes(dir);
|
|
8517
8509
|
}, {
|
|
8518
8510
|
message: 'Target must be in a valid directory: ".opencode/{agent|skill|plugin|command|tool|philosophy}/..."'
|
|
@@ -8595,83 +8587,6 @@ var registryIndexSchema = exports_external.object({
|
|
|
8595
8587
|
}))
|
|
8596
8588
|
});
|
|
8597
8589
|
|
|
8598
|
-
// src/schemas/config.ts
|
|
8599
|
-
var registryConfigSchema = exports_external.object({
|
|
8600
|
-
url: exports_external.string().url("Registry URL must be a valid URL"),
|
|
8601
|
-
version: exports_external.string().optional(),
|
|
8602
|
-
headers: exports_external.record(exports_external.string()).optional()
|
|
8603
|
-
});
|
|
8604
|
-
var ocxConfigSchema = exports_external.object({
|
|
8605
|
-
$schema: exports_external.string().optional(),
|
|
8606
|
-
registries: exports_external.record(registryConfigSchema).default({}),
|
|
8607
|
-
lockRegistries: exports_external.boolean().default(false)
|
|
8608
|
-
});
|
|
8609
|
-
var installedComponentSchema = exports_external.object({
|
|
8610
|
-
registry: exports_external.string(),
|
|
8611
|
-
version: exports_external.string(),
|
|
8612
|
-
hash: exports_external.string(),
|
|
8613
|
-
target: exports_external.string(),
|
|
8614
|
-
installedAt: exports_external.string()
|
|
8615
|
-
});
|
|
8616
|
-
var ocxLockSchema = exports_external.object({
|
|
8617
|
-
lockVersion: exports_external.literal(1),
|
|
8618
|
-
installed: exports_external.record(installedComponentSchema).default({})
|
|
8619
|
-
});
|
|
8620
|
-
var opencodeMcpSchema = exports_external.record(mcpServerSchema);
|
|
8621
|
-
var opencodeAgentSchema = exports_external.object({
|
|
8622
|
-
disable: exports_external.boolean().optional(),
|
|
8623
|
-
tools: exports_external.record(exports_external.boolean()).optional()
|
|
8624
|
-
});
|
|
8625
|
-
var opencodeConfigPatchSchema = exports_external.object({
|
|
8626
|
-
default_agent: exports_external.string().optional(),
|
|
8627
|
-
mcp: opencodeMcpSchema.optional(),
|
|
8628
|
-
tools: exports_external.record(exports_external.boolean()).optional(),
|
|
8629
|
-
agent: exports_external.record(opencodeAgentSchema).optional()
|
|
8630
|
-
});
|
|
8631
|
-
var CONFIG_FILE = "ocx.jsonc";
|
|
8632
|
-
var LOCK_FILE = "ocx.lock";
|
|
8633
|
-
function stripJsonComments(content) {
|
|
8634
|
-
return content.replace(/("(?:[^"\\]|\\.)*")|(\/\*[\s\S]*?\*\/)|(\/\/.*)$/gm, (match, string, block, line) => {
|
|
8635
|
-
if (string)
|
|
8636
|
-
return string;
|
|
8637
|
-
return "";
|
|
8638
|
-
});
|
|
8639
|
-
}
|
|
8640
|
-
async function readOcxConfig(cwd) {
|
|
8641
|
-
const configPath = `${cwd}/${CONFIG_FILE}`;
|
|
8642
|
-
const file = Bun.file(configPath);
|
|
8643
|
-
if (!await file.exists()) {
|
|
8644
|
-
return null;
|
|
8645
|
-
}
|
|
8646
|
-
const content = await file.text();
|
|
8647
|
-
try {
|
|
8648
|
-
const json = JSON.parse(stripJsonComments(content));
|
|
8649
|
-
return ocxConfigSchema.parse(json);
|
|
8650
|
-
} catch (error) {
|
|
8651
|
-
console.error(`Error parsing ${configPath}:`, error);
|
|
8652
|
-
throw error;
|
|
8653
|
-
}
|
|
8654
|
-
}
|
|
8655
|
-
async function writeOcxConfig(cwd, config) {
|
|
8656
|
-
const configPath = `${cwd}/${CONFIG_FILE}`;
|
|
8657
|
-
const content = JSON.stringify(config, null, 2);
|
|
8658
|
-
await Bun.write(configPath, content);
|
|
8659
|
-
}
|
|
8660
|
-
async function readOcxLock(cwd) {
|
|
8661
|
-
const lockPath = `${cwd}/${LOCK_FILE}`;
|
|
8662
|
-
const file = Bun.file(lockPath);
|
|
8663
|
-
if (!await file.exists()) {
|
|
8664
|
-
return null;
|
|
8665
|
-
}
|
|
8666
|
-
const content = await file.text();
|
|
8667
|
-
const json = JSON.parse(stripJsonComments(content));
|
|
8668
|
-
return ocxLockSchema.parse(json);
|
|
8669
|
-
}
|
|
8670
|
-
|
|
8671
|
-
// src/utils/env.ts
|
|
8672
|
-
var isCI = Boolean(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.CIRCLECI || process.env.JENKINS_URL || process.env.BUILDKITE);
|
|
8673
|
-
var isTTY = Boolean(process.stdout.isTTY && !isCI);
|
|
8674
|
-
var supportsColor = Boolean(isTTY && process.env.FORCE_COLOR !== "0" && process.env.NO_COLOR === undefined);
|
|
8675
8590
|
// src/utils/errors.ts
|
|
8676
8591
|
var EXIT_CODES = {
|
|
8677
8592
|
SUCCESS: 0,
|
|
@@ -8732,1791 +8647,1899 @@ class IntegrityError extends OCXError {
|
|
|
8732
8647
|
this.name = "IntegrityError";
|
|
8733
8648
|
}
|
|
8734
8649
|
}
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
var
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
8743
|
-
isTTY2 = process.stdout && process.stdout.isTTY;
|
|
8744
|
-
}
|
|
8745
|
-
var $ = {
|
|
8746
|
-
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY2),
|
|
8747
|
-
reset: init(0, 0),
|
|
8748
|
-
bold: init(1, 22),
|
|
8749
|
-
dim: init(2, 22),
|
|
8750
|
-
italic: init(3, 23),
|
|
8751
|
-
underline: init(4, 24),
|
|
8752
|
-
inverse: init(7, 27),
|
|
8753
|
-
hidden: init(8, 28),
|
|
8754
|
-
strikethrough: init(9, 29),
|
|
8755
|
-
black: init(30, 39),
|
|
8756
|
-
red: init(31, 39),
|
|
8757
|
-
green: init(32, 39),
|
|
8758
|
-
yellow: init(33, 39),
|
|
8759
|
-
blue: init(34, 39),
|
|
8760
|
-
magenta: init(35, 39),
|
|
8761
|
-
cyan: init(36, 39),
|
|
8762
|
-
white: init(37, 39),
|
|
8763
|
-
gray: init(90, 39),
|
|
8764
|
-
grey: init(90, 39),
|
|
8765
|
-
bgBlack: init(40, 49),
|
|
8766
|
-
bgRed: init(41, 49),
|
|
8767
|
-
bgGreen: init(42, 49),
|
|
8768
|
-
bgYellow: init(43, 49),
|
|
8769
|
-
bgBlue: init(44, 49),
|
|
8770
|
-
bgMagenta: init(45, 49),
|
|
8771
|
-
bgCyan: init(46, 49),
|
|
8772
|
-
bgWhite: init(47, 49)
|
|
8773
|
-
};
|
|
8774
|
-
function run(arr, str) {
|
|
8775
|
-
let i = 0, tmp, beg = "", end = "";
|
|
8776
|
-
for (;i < arr.length; i++) {
|
|
8777
|
-
tmp = arr[i];
|
|
8778
|
-
beg += tmp.open;
|
|
8779
|
-
end += tmp.close;
|
|
8780
|
-
if (!!~str.indexOf(tmp.close)) {
|
|
8781
|
-
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
8782
|
-
}
|
|
8650
|
+
|
|
8651
|
+
// src/registry/fetcher.ts
|
|
8652
|
+
var cache = new Map;
|
|
8653
|
+
async function fetchWithCache(url, parse) {
|
|
8654
|
+
const cached = cache.get(url);
|
|
8655
|
+
if (cached) {
|
|
8656
|
+
return cached;
|
|
8783
8657
|
}
|
|
8784
|
-
|
|
8658
|
+
const promise = (async () => {
|
|
8659
|
+
const response = await fetch(url);
|
|
8660
|
+
if (!response.ok) {
|
|
8661
|
+
if (response.status === 404) {
|
|
8662
|
+
throw new NotFoundError(`Not found: ${url}`);
|
|
8663
|
+
}
|
|
8664
|
+
throw new NetworkError(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
|
8665
|
+
}
|
|
8666
|
+
const data = await response.json();
|
|
8667
|
+
return parse(data);
|
|
8668
|
+
})();
|
|
8669
|
+
cache.set(url, promise);
|
|
8670
|
+
promise.catch(() => cache.delete(url));
|
|
8671
|
+
return promise;
|
|
8785
8672
|
}
|
|
8786
|
-
function
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
8796
|
-
ctx.black = $.black.bind(ctx);
|
|
8797
|
-
ctx.red = $.red.bind(ctx);
|
|
8798
|
-
ctx.green = $.green.bind(ctx);
|
|
8799
|
-
ctx.yellow = $.yellow.bind(ctx);
|
|
8800
|
-
ctx.blue = $.blue.bind(ctx);
|
|
8801
|
-
ctx.magenta = $.magenta.bind(ctx);
|
|
8802
|
-
ctx.cyan = $.cyan.bind(ctx);
|
|
8803
|
-
ctx.white = $.white.bind(ctx);
|
|
8804
|
-
ctx.gray = $.gray.bind(ctx);
|
|
8805
|
-
ctx.grey = $.grey.bind(ctx);
|
|
8806
|
-
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
8807
|
-
ctx.bgRed = $.bgRed.bind(ctx);
|
|
8808
|
-
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
8809
|
-
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
8810
|
-
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
8811
|
-
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
8812
|
-
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
8813
|
-
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
8814
|
-
return ctx;
|
|
8673
|
+
async function fetchRegistryIndex(baseUrl) {
|
|
8674
|
+
const url = `${baseUrl.replace(/\/$/, "")}/index.json`;
|
|
8675
|
+
return fetchWithCache(url, (data) => {
|
|
8676
|
+
const result = registryIndexSchema.safeParse(data);
|
|
8677
|
+
if (!result.success) {
|
|
8678
|
+
throw new ValidationError(`Invalid registry format at ${url}: ${result.error.message}`);
|
|
8679
|
+
}
|
|
8680
|
+
return result.data;
|
|
8681
|
+
});
|
|
8815
8682
|
}
|
|
8816
|
-
function
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
return function(txt) {
|
|
8823
|
-
if (this !== undefined && this.has !== undefined) {
|
|
8824
|
-
!!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
|
|
8825
|
-
return txt === undefined ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
|
|
8683
|
+
async function fetchComponent(baseUrl, name) {
|
|
8684
|
+
const url = `${baseUrl.replace(/\/$/, "")}/components/${name}.json`;
|
|
8685
|
+
return fetchWithCache(url, (data) => {
|
|
8686
|
+
const packumentResult = packumentSchema.safeParse(data);
|
|
8687
|
+
if (!packumentResult.success) {
|
|
8688
|
+
throw new ValidationError(`Invalid packument format for "${name}": ${packumentResult.error.message}`);
|
|
8826
8689
|
}
|
|
8827
|
-
|
|
8828
|
-
|
|
8690
|
+
const packument = packumentResult.data;
|
|
8691
|
+
const latestVersion = packument["dist-tags"].latest;
|
|
8692
|
+
const manifest = packument.versions[latestVersion];
|
|
8693
|
+
if (!manifest) {
|
|
8694
|
+
throw new ValidationError(`Component "${name}" has no manifest for latest version ${latestVersion}`);
|
|
8695
|
+
}
|
|
8696
|
+
const manifestResult = componentManifestSchema.safeParse(manifest);
|
|
8697
|
+
if (!manifestResult.success) {
|
|
8698
|
+
throw new ValidationError(`Invalid component manifest for "${name}@${latestVersion}": ${manifestResult.error.message}`);
|
|
8699
|
+
}
|
|
8700
|
+
return manifestResult.data;
|
|
8701
|
+
});
|
|
8702
|
+
}
|
|
8703
|
+
async function fetchFileContent(baseUrl, componentName, filePath) {
|
|
8704
|
+
const url = `${baseUrl.replace(/\/$/, "")}/components/${componentName}/${filePath}`;
|
|
8705
|
+
const response = await fetch(url);
|
|
8706
|
+
if (!response.ok) {
|
|
8707
|
+
throw new NetworkError(`Failed to fetch file ${filePath} for ${componentName}: ${response.status} ${response.statusText}`);
|
|
8708
|
+
}
|
|
8709
|
+
return response.text();
|
|
8829
8710
|
}
|
|
8830
|
-
var kleur_default = $;
|
|
8831
8711
|
|
|
8832
|
-
//
|
|
8833
|
-
|
|
8834
|
-
|
|
8712
|
+
// ../../node_modules/.bun/strip-json-comments@5.0.3/node_modules/strip-json-comments/index.js
|
|
8713
|
+
var singleComment = Symbol("singleComment");
|
|
8714
|
+
var multiComment = Symbol("multiComment");
|
|
8715
|
+
var stripWithoutWhitespace = () => "";
|
|
8716
|
+
var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/[^ \t\r\n]/g, " ");
|
|
8717
|
+
var isEscaped = (jsonString, quotePosition) => {
|
|
8718
|
+
let index = quotePosition - 1;
|
|
8719
|
+
let backslashCount = 0;
|
|
8720
|
+
while (jsonString[index] === "\\") {
|
|
8721
|
+
index -= 1;
|
|
8722
|
+
backslashCount += 1;
|
|
8723
|
+
}
|
|
8724
|
+
return Boolean(backslashCount % 2);
|
|
8725
|
+
};
|
|
8726
|
+
function stripJsonComments(jsonString, { whitespace = true, trailingCommas = false } = {}) {
|
|
8727
|
+
if (typeof jsonString !== "string") {
|
|
8728
|
+
throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
|
|
8729
|
+
}
|
|
8730
|
+
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
|
|
8731
|
+
let isInsideString = false;
|
|
8732
|
+
let isInsideComment = false;
|
|
8733
|
+
let offset = 0;
|
|
8734
|
+
let buffer = "";
|
|
8735
|
+
let result = "";
|
|
8736
|
+
let commaIndex = -1;
|
|
8737
|
+
for (let index = 0;index < jsonString.length; index++) {
|
|
8738
|
+
const currentCharacter = jsonString[index];
|
|
8739
|
+
const nextCharacter = jsonString[index + 1];
|
|
8740
|
+
if (!isInsideComment && currentCharacter === '"') {
|
|
8741
|
+
const escaped = isEscaped(jsonString, index);
|
|
8742
|
+
if (!escaped) {
|
|
8743
|
+
isInsideString = !isInsideString;
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
if (isInsideString) {
|
|
8747
|
+
continue;
|
|
8748
|
+
}
|
|
8749
|
+
if (!isInsideComment && currentCharacter + nextCharacter === "//") {
|
|
8750
|
+
buffer += jsonString.slice(offset, index);
|
|
8751
|
+
offset = index;
|
|
8752
|
+
isInsideComment = singleComment;
|
|
8753
|
+
index++;
|
|
8754
|
+
} else if (isInsideComment === singleComment && currentCharacter + nextCharacter === `\r
|
|
8755
|
+
`) {
|
|
8756
|
+
index++;
|
|
8757
|
+
isInsideComment = false;
|
|
8758
|
+
buffer += strip(jsonString, offset, index);
|
|
8759
|
+
offset = index;
|
|
8760
|
+
continue;
|
|
8761
|
+
} else if (isInsideComment === singleComment && currentCharacter === `
|
|
8762
|
+
`) {
|
|
8763
|
+
isInsideComment = false;
|
|
8764
|
+
buffer += strip(jsonString, offset, index);
|
|
8765
|
+
offset = index;
|
|
8766
|
+
} else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
|
|
8767
|
+
buffer += jsonString.slice(offset, index);
|
|
8768
|
+
offset = index;
|
|
8769
|
+
isInsideComment = multiComment;
|
|
8770
|
+
index++;
|
|
8771
|
+
continue;
|
|
8772
|
+
} else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
|
|
8773
|
+
index++;
|
|
8774
|
+
isInsideComment = false;
|
|
8775
|
+
buffer += strip(jsonString, offset, index + 1);
|
|
8776
|
+
offset = index + 1;
|
|
8777
|
+
continue;
|
|
8778
|
+
} else if (trailingCommas && !isInsideComment) {
|
|
8779
|
+
if (commaIndex !== -1) {
|
|
8780
|
+
if (currentCharacter === "}" || currentCharacter === "]") {
|
|
8781
|
+
buffer += jsonString.slice(offset, index);
|
|
8782
|
+
result += strip(buffer, 0, 1) + buffer.slice(1);
|
|
8783
|
+
buffer = "";
|
|
8784
|
+
offset = index;
|
|
8785
|
+
commaIndex = -1;
|
|
8786
|
+
} else if (currentCharacter !== " " && currentCharacter !== "\t" && currentCharacter !== "\r" && currentCharacter !== `
|
|
8787
|
+
`) {
|
|
8788
|
+
buffer += jsonString.slice(offset, index);
|
|
8789
|
+
offset = index;
|
|
8790
|
+
commaIndex = -1;
|
|
8791
|
+
}
|
|
8792
|
+
} else if (currentCharacter === ",") {
|
|
8793
|
+
result += buffer + jsonString.slice(offset, index);
|
|
8794
|
+
buffer = "";
|
|
8795
|
+
offset = index;
|
|
8796
|
+
commaIndex = index;
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
const remaining = isInsideComment === singleComment ? strip(jsonString, offset) : jsonString.slice(offset);
|
|
8801
|
+
return result + buffer + remaining;
|
|
8835
8802
|
}
|
|
8836
|
-
var options = {};
|
|
8837
|
-
var logger = {
|
|
8838
|
-
info(...args) {
|
|
8839
|
-
if (options.quiet)
|
|
8840
|
-
return;
|
|
8841
|
-
console.log(kleur_default.blue("info"), ...args);
|
|
8842
|
-
},
|
|
8843
|
-
success(...args) {
|
|
8844
|
-
if (options.quiet)
|
|
8845
|
-
return;
|
|
8846
|
-
console.log(kleur_default.green("\u2713"), ...args);
|
|
8847
|
-
},
|
|
8848
|
-
warn(...args) {
|
|
8849
|
-
if (options.quiet)
|
|
8850
|
-
return;
|
|
8851
|
-
console.warn(kleur_default.yellow("warn"), ...args);
|
|
8852
|
-
},
|
|
8853
|
-
error(...args) {
|
|
8854
|
-
console.error(kleur_default.red("error"), ...args);
|
|
8855
|
-
},
|
|
8856
|
-
debug(...args) {
|
|
8857
|
-
if (!options.verbose)
|
|
8858
|
-
return;
|
|
8859
|
-
console.log(kleur_default.gray("debug"), ...args);
|
|
8860
|
-
},
|
|
8861
|
-
log(...args) {
|
|
8862
|
-
if (options.quiet)
|
|
8863
|
-
return;
|
|
8864
|
-
console.log(...args);
|
|
8865
|
-
},
|
|
8866
|
-
break() {
|
|
8867
|
-
if (options.quiet)
|
|
8868
|
-
return;
|
|
8869
|
-
console.log("");
|
|
8870
|
-
}
|
|
8871
|
-
};
|
|
8872
|
-
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
8873
|
-
import process9 from "process";
|
|
8874
8803
|
|
|
8875
|
-
//
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
overline: [53, 55],
|
|
8888
|
-
inverse: [7, 27],
|
|
8889
|
-
hidden: [8, 28],
|
|
8890
|
-
strikethrough: [9, 29]
|
|
8891
|
-
},
|
|
8892
|
-
color: {
|
|
8893
|
-
black: [30, 39],
|
|
8894
|
-
red: [31, 39],
|
|
8895
|
-
green: [32, 39],
|
|
8896
|
-
yellow: [33, 39],
|
|
8897
|
-
blue: [34, 39],
|
|
8898
|
-
magenta: [35, 39],
|
|
8899
|
-
cyan: [36, 39],
|
|
8900
|
-
white: [37, 39],
|
|
8901
|
-
blackBright: [90, 39],
|
|
8902
|
-
gray: [90, 39],
|
|
8903
|
-
grey: [90, 39],
|
|
8904
|
-
redBright: [91, 39],
|
|
8905
|
-
greenBright: [92, 39],
|
|
8906
|
-
yellowBright: [93, 39],
|
|
8907
|
-
blueBright: [94, 39],
|
|
8908
|
-
magentaBright: [95, 39],
|
|
8909
|
-
cyanBright: [96, 39],
|
|
8910
|
-
whiteBright: [97, 39]
|
|
8911
|
-
},
|
|
8912
|
-
bgColor: {
|
|
8913
|
-
bgBlack: [40, 49],
|
|
8914
|
-
bgRed: [41, 49],
|
|
8915
|
-
bgGreen: [42, 49],
|
|
8916
|
-
bgYellow: [43, 49],
|
|
8917
|
-
bgBlue: [44, 49],
|
|
8918
|
-
bgMagenta: [45, 49],
|
|
8919
|
-
bgCyan: [46, 49],
|
|
8920
|
-
bgWhite: [47, 49],
|
|
8921
|
-
bgBlackBright: [100, 49],
|
|
8922
|
-
bgGray: [100, 49],
|
|
8923
|
-
bgGrey: [100, 49],
|
|
8924
|
-
bgRedBright: [101, 49],
|
|
8925
|
-
bgGreenBright: [102, 49],
|
|
8926
|
-
bgYellowBright: [103, 49],
|
|
8927
|
-
bgBlueBright: [104, 49],
|
|
8928
|
-
bgMagentaBright: [105, 49],
|
|
8929
|
-
bgCyanBright: [106, 49],
|
|
8930
|
-
bgWhiteBright: [107, 49]
|
|
8931
|
-
}
|
|
8932
|
-
};
|
|
8933
|
-
var modifierNames = Object.keys(styles.modifier);
|
|
8934
|
-
var foregroundColorNames = Object.keys(styles.color);
|
|
8935
|
-
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
8936
|
-
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
8937
|
-
function assembleStyles() {
|
|
8938
|
-
const codes = new Map;
|
|
8939
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
8940
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
8941
|
-
styles[styleName] = {
|
|
8942
|
-
open: `\x1B[${style[0]}m`,
|
|
8943
|
-
close: `\x1B[${style[1]}m`
|
|
8804
|
+
// src/registry/opencode-config.ts
|
|
8805
|
+
async function readOpencodeConfig(cwd) {
|
|
8806
|
+
const jsonPath = `${cwd}/opencode.json`;
|
|
8807
|
+
const jsoncPath = `${cwd}/opencode.jsonc`;
|
|
8808
|
+
for (const configPath of [jsoncPath, jsonPath]) {
|
|
8809
|
+
const file = Bun.file(configPath);
|
|
8810
|
+
if (await file.exists()) {
|
|
8811
|
+
const content = await file.text();
|
|
8812
|
+
const stripped = configPath.endsWith(".jsonc") ? stripJsonComments(content) : content;
|
|
8813
|
+
return {
|
|
8814
|
+
config: JSON.parse(stripped),
|
|
8815
|
+
path: configPath
|
|
8944
8816
|
};
|
|
8945
|
-
group[styleName] = styles[styleName];
|
|
8946
|
-
codes.set(style[0], style[1]);
|
|
8947
8817
|
}
|
|
8948
|
-
Object.defineProperty(styles, groupName, {
|
|
8949
|
-
value: group,
|
|
8950
|
-
enumerable: false
|
|
8951
|
-
});
|
|
8952
8818
|
}
|
|
8953
|
-
|
|
8954
|
-
value: codes,
|
|
8955
|
-
enumerable: false
|
|
8956
|
-
});
|
|
8957
|
-
styles.color.close = "\x1B[39m";
|
|
8958
|
-
styles.bgColor.close = "\x1B[49m";
|
|
8959
|
-
styles.color.ansi = wrapAnsi16();
|
|
8960
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
8961
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
8962
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
8963
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
8964
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
8965
|
-
Object.defineProperties(styles, {
|
|
8966
|
-
rgbToAnsi256: {
|
|
8967
|
-
value(red, green, blue) {
|
|
8968
|
-
if (red === green && green === blue) {
|
|
8969
|
-
if (red < 8) {
|
|
8970
|
-
return 16;
|
|
8971
|
-
}
|
|
8972
|
-
if (red > 248) {
|
|
8973
|
-
return 231;
|
|
8974
|
-
}
|
|
8975
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
8976
|
-
}
|
|
8977
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
8978
|
-
},
|
|
8979
|
-
enumerable: false
|
|
8980
|
-
},
|
|
8981
|
-
hexToRgb: {
|
|
8982
|
-
value(hex) {
|
|
8983
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
8984
|
-
if (!matches) {
|
|
8985
|
-
return [0, 0, 0];
|
|
8986
|
-
}
|
|
8987
|
-
let [colorString] = matches;
|
|
8988
|
-
if (colorString.length === 3) {
|
|
8989
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
8990
|
-
}
|
|
8991
|
-
const integer = Number.parseInt(colorString, 16);
|
|
8992
|
-
return [
|
|
8993
|
-
integer >> 16 & 255,
|
|
8994
|
-
integer >> 8 & 255,
|
|
8995
|
-
integer & 255
|
|
8996
|
-
];
|
|
8997
|
-
},
|
|
8998
|
-
enumerable: false
|
|
8999
|
-
},
|
|
9000
|
-
hexToAnsi256: {
|
|
9001
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
9002
|
-
enumerable: false
|
|
9003
|
-
},
|
|
9004
|
-
ansi256ToAnsi: {
|
|
9005
|
-
value(code) {
|
|
9006
|
-
if (code < 8) {
|
|
9007
|
-
return 30 + code;
|
|
9008
|
-
}
|
|
9009
|
-
if (code < 16) {
|
|
9010
|
-
return 90 + (code - 8);
|
|
9011
|
-
}
|
|
9012
|
-
let red;
|
|
9013
|
-
let green;
|
|
9014
|
-
let blue;
|
|
9015
|
-
if (code >= 232) {
|
|
9016
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
9017
|
-
green = red;
|
|
9018
|
-
blue = red;
|
|
9019
|
-
} else {
|
|
9020
|
-
code -= 16;
|
|
9021
|
-
const remainder = code % 36;
|
|
9022
|
-
red = Math.floor(code / 36) / 5;
|
|
9023
|
-
green = Math.floor(remainder / 6) / 5;
|
|
9024
|
-
blue = remainder % 6 / 5;
|
|
9025
|
-
}
|
|
9026
|
-
const value = Math.max(red, green, blue) * 2;
|
|
9027
|
-
if (value === 0) {
|
|
9028
|
-
return 30;
|
|
9029
|
-
}
|
|
9030
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
9031
|
-
if (value === 2) {
|
|
9032
|
-
result += 60;
|
|
9033
|
-
}
|
|
9034
|
-
return result;
|
|
9035
|
-
},
|
|
9036
|
-
enumerable: false
|
|
9037
|
-
},
|
|
9038
|
-
rgbToAnsi: {
|
|
9039
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
9040
|
-
enumerable: false
|
|
9041
|
-
},
|
|
9042
|
-
hexToAnsi: {
|
|
9043
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
9044
|
-
enumerable: false
|
|
9045
|
-
}
|
|
9046
|
-
});
|
|
9047
|
-
return styles;
|
|
9048
|
-
}
|
|
9049
|
-
var ansiStyles = assembleStyles();
|
|
9050
|
-
var ansi_styles_default = ansiStyles;
|
|
9051
|
-
|
|
9052
|
-
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
9053
|
-
import process2 from "process";
|
|
9054
|
-
import os from "os";
|
|
9055
|
-
import tty from "tty";
|
|
9056
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
9057
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
9058
|
-
const position = argv.indexOf(prefix + flag);
|
|
9059
|
-
const terminatorPosition = argv.indexOf("--");
|
|
9060
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
8819
|
+
return null;
|
|
9061
8820
|
}
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
flagForceColor = 0;
|
|
9066
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
9067
|
-
flagForceColor = 1;
|
|
8821
|
+
async function writeOpencodeConfig(path, config) {
|
|
8822
|
+
const content = JSON.stringify(config, null, 2);
|
|
8823
|
+
await Bun.write(path, content);
|
|
9068
8824
|
}
|
|
9069
|
-
function
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
}
|
|
9074
|
-
|
|
9075
|
-
|
|
8825
|
+
function applyMcpServers(config, mcpServers) {
|
|
8826
|
+
const added = [];
|
|
8827
|
+
const skipped = [];
|
|
8828
|
+
if (!config.mcp) {
|
|
8829
|
+
config.mcp = {};
|
|
8830
|
+
}
|
|
8831
|
+
for (const [name, server] of Object.entries(mcpServers)) {
|
|
8832
|
+
if (config.mcp[name]) {
|
|
8833
|
+
skipped.push(name);
|
|
8834
|
+
} else {
|
|
8835
|
+
const serverConfig = {
|
|
8836
|
+
type: server.type,
|
|
8837
|
+
enabled: server.enabled
|
|
8838
|
+
};
|
|
8839
|
+
if (server.type === "remote" && server.url) {
|
|
8840
|
+
serverConfig.url = server.url;
|
|
8841
|
+
}
|
|
8842
|
+
if (server.type === "local" && server.command) {
|
|
8843
|
+
serverConfig.command = server.command;
|
|
8844
|
+
}
|
|
8845
|
+
if (server.headers) {
|
|
8846
|
+
serverConfig.headers = server.headers;
|
|
8847
|
+
}
|
|
8848
|
+
config.mcp[name] = serverConfig;
|
|
8849
|
+
added.push(name);
|
|
9076
8850
|
}
|
|
9077
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
9078
8851
|
}
|
|
8852
|
+
return { config, added, skipped };
|
|
9079
8853
|
}
|
|
9080
|
-
function
|
|
9081
|
-
|
|
9082
|
-
|
|
8854
|
+
async function updateOpencodeConfig(cwd, options) {
|
|
8855
|
+
const existing = await readOpencodeConfig(cwd);
|
|
8856
|
+
let config;
|
|
8857
|
+
let configPath;
|
|
8858
|
+
let created = false;
|
|
8859
|
+
if (existing) {
|
|
8860
|
+
config = existing.config;
|
|
8861
|
+
configPath = existing.path;
|
|
8862
|
+
} else {
|
|
8863
|
+
config = {
|
|
8864
|
+
$schema: "https://opencode.ai/config.json"
|
|
8865
|
+
};
|
|
8866
|
+
configPath = `${cwd}/opencode.json`;
|
|
8867
|
+
created = true;
|
|
8868
|
+
}
|
|
8869
|
+
let mcpAdded = [];
|
|
8870
|
+
let mcpSkipped = [];
|
|
8871
|
+
if (options.mcpServers && Object.keys(options.mcpServers).length > 0) {
|
|
8872
|
+
const result = applyMcpServers(config, options.mcpServers);
|
|
8873
|
+
config = result.config;
|
|
8874
|
+
mcpAdded = result.added;
|
|
8875
|
+
mcpSkipped = result.skipped;
|
|
8876
|
+
}
|
|
8877
|
+
if (options.defaultAgent && !config.default_agent) {
|
|
8878
|
+
config.default_agent = options.defaultAgent;
|
|
9083
8879
|
}
|
|
8880
|
+
await writeOpencodeConfig(configPath, config);
|
|
9084
8881
|
return {
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
8882
|
+
path: configPath,
|
|
8883
|
+
created,
|
|
8884
|
+
mcpAdded,
|
|
8885
|
+
mcpSkipped
|
|
9089
8886
|
};
|
|
9090
8887
|
}
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
const
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
if (sniffFlags) {
|
|
9101
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
9102
|
-
return 3;
|
|
9103
|
-
}
|
|
9104
|
-
if (hasFlag("color=256")) {
|
|
9105
|
-
return 2;
|
|
8888
|
+
|
|
8889
|
+
// src/registry/resolver.ts
|
|
8890
|
+
async function resolveDependencies(registries, componentNames) {
|
|
8891
|
+
const resolved = new Map;
|
|
8892
|
+
const visiting = new Set;
|
|
8893
|
+
const mcpServers = {};
|
|
8894
|
+
async function resolve(name, path = []) {
|
|
8895
|
+
if (resolved.has(name)) {
|
|
8896
|
+
return;
|
|
9106
8897
|
}
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
}
|
|
9111
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
9112
|
-
return 0;
|
|
9113
|
-
}
|
|
9114
|
-
const min = forceColor || 0;
|
|
9115
|
-
if (env.TERM === "dumb") {
|
|
9116
|
-
return min;
|
|
9117
|
-
}
|
|
9118
|
-
if (process2.platform === "win32") {
|
|
9119
|
-
const osRelease = os.release().split(".");
|
|
9120
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
9121
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
8898
|
+
if (visiting.has(name)) {
|
|
8899
|
+
const cycle = [...path, name].join(" \u2192 ");
|
|
8900
|
+
throw new ValidationError(`Circular dependency detected: ${cycle}`);
|
|
9122
8901
|
}
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
8902
|
+
visiting.add(name);
|
|
8903
|
+
let component = null;
|
|
8904
|
+
let foundRegistry = null;
|
|
8905
|
+
const registryEntries = Object.entries(registries);
|
|
8906
|
+
for (const [regName, regConfig] of registryEntries) {
|
|
8907
|
+
try {
|
|
8908
|
+
const manifest = await fetchComponent(regConfig.url, name);
|
|
8909
|
+
component = manifest;
|
|
8910
|
+
foundRegistry = { name: regName, url: regConfig.url };
|
|
8911
|
+
break;
|
|
8912
|
+
} catch (_err) {}
|
|
9128
8913
|
}
|
|
9129
|
-
if (
|
|
9130
|
-
|
|
8914
|
+
if (!component || !foundRegistry) {
|
|
8915
|
+
throw new OCXError(`Component '${name}' not found in any configured registry.`, "NOT_FOUND");
|
|
9131
8916
|
}
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
}
|
|
9146
|
-
if (env.TERM === "wezterm") {
|
|
9147
|
-
return 3;
|
|
9148
|
-
}
|
|
9149
|
-
if ("TERM_PROGRAM" in env) {
|
|
9150
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
9151
|
-
switch (env.TERM_PROGRAM) {
|
|
9152
|
-
case "iTerm.app": {
|
|
9153
|
-
return version >= 3 ? 3 : 2;
|
|
9154
|
-
}
|
|
9155
|
-
case "Apple_Terminal": {
|
|
9156
|
-
return 2;
|
|
9157
|
-
}
|
|
8917
|
+
for (const dep of component.dependencies) {
|
|
8918
|
+
await resolve(dep, [...path, name]);
|
|
8919
|
+
}
|
|
8920
|
+
resolved.set(name, {
|
|
8921
|
+
...component,
|
|
8922
|
+
registryName: foundRegistry.name,
|
|
8923
|
+
baseUrl: foundRegistry.url
|
|
8924
|
+
});
|
|
8925
|
+
visiting.delete(name);
|
|
8926
|
+
if (component.mcpServers) {
|
|
8927
|
+
for (const [serverName, config] of Object.entries(component.mcpServers)) {
|
|
8928
|
+
mcpServers[serverName] = config;
|
|
8929
|
+
}
|
|
9158
8930
|
}
|
|
9159
8931
|
}
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
}
|
|
9163
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
9164
|
-
return 1;
|
|
9165
|
-
}
|
|
9166
|
-
if ("COLORTERM" in env) {
|
|
9167
|
-
return 1;
|
|
8932
|
+
for (const name of componentNames) {
|
|
8933
|
+
await resolve(name);
|
|
9168
8934
|
}
|
|
9169
|
-
|
|
8935
|
+
const components = Array.from(resolved.values());
|
|
8936
|
+
const installOrder = Array.from(resolved.keys());
|
|
8937
|
+
return {
|
|
8938
|
+
components,
|
|
8939
|
+
installOrder,
|
|
8940
|
+
mcpServers
|
|
8941
|
+
};
|
|
9170
8942
|
}
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
8943
|
+
|
|
8944
|
+
// src/schemas/config.ts
|
|
8945
|
+
var registryConfigSchema = exports_external.object({
|
|
8946
|
+
url: exports_external.string().url("Registry URL must be a valid URL"),
|
|
8947
|
+
version: exports_external.string().optional(),
|
|
8948
|
+
headers: exports_external.record(exports_external.string()).optional()
|
|
8949
|
+
});
|
|
8950
|
+
var ocxConfigSchema = exports_external.object({
|
|
8951
|
+
$schema: exports_external.string().optional(),
|
|
8952
|
+
registries: exports_external.record(registryConfigSchema).default({}),
|
|
8953
|
+
lockRegistries: exports_external.boolean().default(false)
|
|
8954
|
+
});
|
|
8955
|
+
var installedComponentSchema = exports_external.object({
|
|
8956
|
+
registry: exports_external.string(),
|
|
8957
|
+
version: exports_external.string(),
|
|
8958
|
+
hash: exports_external.string(),
|
|
8959
|
+
target: exports_external.string(),
|
|
8960
|
+
installedAt: exports_external.string()
|
|
8961
|
+
});
|
|
8962
|
+
var ocxLockSchema = exports_external.object({
|
|
8963
|
+
lockVersion: exports_external.literal(1),
|
|
8964
|
+
installed: exports_external.record(installedComponentSchema).default({})
|
|
8965
|
+
});
|
|
8966
|
+
var opencodeMcpSchema = exports_external.record(mcpServerSchema);
|
|
8967
|
+
var opencodeAgentSchema = exports_external.object({
|
|
8968
|
+
disable: exports_external.boolean().optional(),
|
|
8969
|
+
tools: exports_external.record(exports_external.boolean()).optional()
|
|
8970
|
+
});
|
|
8971
|
+
var opencodeConfigPatchSchema = exports_external.object({
|
|
8972
|
+
default_agent: exports_external.string().optional(),
|
|
8973
|
+
mcp: opencodeMcpSchema.optional(),
|
|
8974
|
+
tools: exports_external.record(exports_external.boolean()).optional(),
|
|
8975
|
+
agent: exports_external.record(opencodeAgentSchema).optional()
|
|
8976
|
+
});
|
|
8977
|
+
var CONFIG_FILE = "ocx.jsonc";
|
|
8978
|
+
var LOCK_FILE = "ocx.lock";
|
|
8979
|
+
function stripJsonComments2(content) {
|
|
8980
|
+
return content.replace(/("(?:[^"\\]|\\.)*")|(\/\*[\s\S]*?\*\/)|(\/\/.*)$/gm, (_match, string, _block, _line) => {
|
|
8981
|
+
if (string)
|
|
8982
|
+
return string;
|
|
8983
|
+
return "";
|
|
9175
8984
|
});
|
|
9176
|
-
return translateLevel(level);
|
|
9177
8985
|
}
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
8986
|
+
async function readOcxConfig(cwd) {
|
|
8987
|
+
const configPath = `${cwd}/${CONFIG_FILE}`;
|
|
8988
|
+
const file = Bun.file(configPath);
|
|
8989
|
+
if (!await file.exists()) {
|
|
8990
|
+
return null;
|
|
8991
|
+
}
|
|
8992
|
+
const content = await file.text();
|
|
8993
|
+
try {
|
|
8994
|
+
const json = JSON.parse(stripJsonComments2(content));
|
|
8995
|
+
return ocxConfigSchema.parse(json);
|
|
8996
|
+
} catch (error) {
|
|
8997
|
+
console.error(`Error parsing ${configPath}:`, error);
|
|
8998
|
+
throw error;
|
|
9189
8999
|
}
|
|
9190
|
-
const substringLength = substring.length;
|
|
9191
|
-
let endIndex = 0;
|
|
9192
|
-
let returnValue = "";
|
|
9193
|
-
do {
|
|
9194
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
9195
|
-
endIndex = index + substringLength;
|
|
9196
|
-
index = string.indexOf(substring, endIndex);
|
|
9197
|
-
} while (index !== -1);
|
|
9198
|
-
returnValue += string.slice(endIndex);
|
|
9199
|
-
return returnValue;
|
|
9200
9000
|
}
|
|
9201
|
-
function
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
const gotCR = string[index - 1] === "\r";
|
|
9206
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
9207
|
-
` : `
|
|
9208
|
-
`) + postfix;
|
|
9209
|
-
endIndex = index + 1;
|
|
9210
|
-
index = string.indexOf(`
|
|
9211
|
-
`, endIndex);
|
|
9212
|
-
} while (index !== -1);
|
|
9213
|
-
returnValue += string.slice(endIndex);
|
|
9214
|
-
return returnValue;
|
|
9001
|
+
async function writeOcxConfig(cwd, config) {
|
|
9002
|
+
const configPath = `${cwd}/${CONFIG_FILE}`;
|
|
9003
|
+
const content = JSON.stringify(config, null, 2);
|
|
9004
|
+
await Bun.write(configPath, content);
|
|
9215
9005
|
}
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
9222
|
-
var levelMapping = [
|
|
9223
|
-
"ansi",
|
|
9224
|
-
"ansi",
|
|
9225
|
-
"ansi256",
|
|
9226
|
-
"ansi16m"
|
|
9227
|
-
];
|
|
9228
|
-
var styles2 = Object.create(null);
|
|
9229
|
-
var applyOptions = (object, options2 = {}) => {
|
|
9230
|
-
if (options2.level && !(Number.isInteger(options2.level) && options2.level >= 0 && options2.level <= 3)) {
|
|
9231
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
9006
|
+
async function readOcxLock(cwd) {
|
|
9007
|
+
const lockPath = `${cwd}/${LOCK_FILE}`;
|
|
9008
|
+
const file = Bun.file(lockPath);
|
|
9009
|
+
if (!await file.exists()) {
|
|
9010
|
+
return null;
|
|
9232
9011
|
}
|
|
9233
|
-
const
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
var chalkFactory = (options2) => {
|
|
9237
|
-
const chalk = (...strings) => strings.join(" ");
|
|
9238
|
-
applyOptions(chalk, options2);
|
|
9239
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
9240
|
-
return chalk;
|
|
9241
|
-
};
|
|
9242
|
-
function createChalk(options2) {
|
|
9243
|
-
return chalkFactory(options2);
|
|
9012
|
+
const content = await file.text();
|
|
9013
|
+
const json = JSON.parse(stripJsonComments2(content));
|
|
9014
|
+
return ocxLockSchema.parse(json);
|
|
9244
9015
|
}
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9016
|
+
|
|
9017
|
+
// src/utils/env.ts
|
|
9018
|
+
var isCI = Boolean(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.CIRCLECI || process.env.JENKINS_URL || process.env.BUILDKITE);
|
|
9019
|
+
var isTTY = Boolean(process.stdout.isTTY && !isCI);
|
|
9020
|
+
var supportsColor = Boolean(isTTY && process.env.FORCE_COLOR !== "0" && process.env.NO_COLOR === undefined);
|
|
9021
|
+
// ../../node_modules/.bun/kleur@4.1.5/node_modules/kleur/index.mjs
|
|
9022
|
+
var FORCE_COLOR;
|
|
9023
|
+
var NODE_DISABLE_COLORS;
|
|
9024
|
+
var NO_COLOR;
|
|
9025
|
+
var TERM;
|
|
9026
|
+
var isTTY2 = true;
|
|
9027
|
+
if (typeof process !== "undefined") {
|
|
9028
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
9029
|
+
isTTY2 = process.stdout && process.stdout.isTTY;
|
|
9254
9030
|
}
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9031
|
+
var $ = {
|
|
9032
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY2),
|
|
9033
|
+
reset: init(0, 0),
|
|
9034
|
+
bold: init(1, 22),
|
|
9035
|
+
dim: init(2, 22),
|
|
9036
|
+
italic: init(3, 23),
|
|
9037
|
+
underline: init(4, 24),
|
|
9038
|
+
inverse: init(7, 27),
|
|
9039
|
+
hidden: init(8, 28),
|
|
9040
|
+
strikethrough: init(9, 29),
|
|
9041
|
+
black: init(30, 39),
|
|
9042
|
+
red: init(31, 39),
|
|
9043
|
+
green: init(32, 39),
|
|
9044
|
+
yellow: init(33, 39),
|
|
9045
|
+
blue: init(34, 39),
|
|
9046
|
+
magenta: init(35, 39),
|
|
9047
|
+
cyan: init(36, 39),
|
|
9048
|
+
white: init(37, 39),
|
|
9049
|
+
gray: init(90, 39),
|
|
9050
|
+
grey: init(90, 39),
|
|
9051
|
+
bgBlack: init(40, 49),
|
|
9052
|
+
bgRed: init(41, 49),
|
|
9053
|
+
bgGreen: init(42, 49),
|
|
9054
|
+
bgYellow: init(43, 49),
|
|
9055
|
+
bgBlue: init(44, 49),
|
|
9056
|
+
bgMagenta: init(45, 49),
|
|
9057
|
+
bgCyan: init(46, 49),
|
|
9058
|
+
bgWhite: init(47, 49)
|
|
9261
9059
|
};
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9060
|
+
function run(arr, str) {
|
|
9061
|
+
let i = 0, tmp, beg = "", end = "";
|
|
9062
|
+
for (;i < arr.length; i++) {
|
|
9063
|
+
tmp = arr[i];
|
|
9064
|
+
beg += tmp.open;
|
|
9065
|
+
end += tmp.close;
|
|
9066
|
+
if (!!~str.indexOf(tmp.close)) {
|
|
9067
|
+
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
9269
9068
|
}
|
|
9270
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
9271
|
-
}
|
|
9272
|
-
if (model === "hex") {
|
|
9273
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
9274
9069
|
}
|
|
9275
|
-
return
|
|
9276
|
-
}
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9070
|
+
return beg + str + end;
|
|
9071
|
+
}
|
|
9072
|
+
function chain(has, keys) {
|
|
9073
|
+
let ctx = { has, keys };
|
|
9074
|
+
ctx.reset = $.reset.bind(ctx);
|
|
9075
|
+
ctx.bold = $.bold.bind(ctx);
|
|
9076
|
+
ctx.dim = $.dim.bind(ctx);
|
|
9077
|
+
ctx.italic = $.italic.bind(ctx);
|
|
9078
|
+
ctx.underline = $.underline.bind(ctx);
|
|
9079
|
+
ctx.inverse = $.inverse.bind(ctx);
|
|
9080
|
+
ctx.hidden = $.hidden.bind(ctx);
|
|
9081
|
+
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
9082
|
+
ctx.black = $.black.bind(ctx);
|
|
9083
|
+
ctx.red = $.red.bind(ctx);
|
|
9084
|
+
ctx.green = $.green.bind(ctx);
|
|
9085
|
+
ctx.yellow = $.yellow.bind(ctx);
|
|
9086
|
+
ctx.blue = $.blue.bind(ctx);
|
|
9087
|
+
ctx.magenta = $.magenta.bind(ctx);
|
|
9088
|
+
ctx.cyan = $.cyan.bind(ctx);
|
|
9089
|
+
ctx.white = $.white.bind(ctx);
|
|
9090
|
+
ctx.gray = $.gray.bind(ctx);
|
|
9091
|
+
ctx.grey = $.grey.bind(ctx);
|
|
9092
|
+
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
9093
|
+
ctx.bgRed = $.bgRed.bind(ctx);
|
|
9094
|
+
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
9095
|
+
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
9096
|
+
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
9097
|
+
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
9098
|
+
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
9099
|
+
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
9100
|
+
return ctx;
|
|
9101
|
+
}
|
|
9102
|
+
function init(open, close) {
|
|
9103
|
+
let blk = {
|
|
9104
|
+
open: `\x1B[${open}m`,
|
|
9105
|
+
close: `\x1B[${close}m`,
|
|
9106
|
+
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
|
|
9287
9107
|
};
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
return function(...arguments_) {
|
|
9293
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
9294
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
9295
|
-
};
|
|
9108
|
+
return function(txt) {
|
|
9109
|
+
if (this !== undefined && this.has !== undefined) {
|
|
9110
|
+
!!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
|
|
9111
|
+
return txt === undefined ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
|
|
9296
9112
|
}
|
|
9113
|
+
return txt === undefined ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
|
|
9297
9114
|
};
|
|
9298
9115
|
}
|
|
9299
|
-
var
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
return self[IS_EMPTY] ? "" : string;
|
|
9340
|
-
}
|
|
9341
|
-
let styler = self[STYLER];
|
|
9342
|
-
if (styler === undefined) {
|
|
9343
|
-
return string;
|
|
9344
|
-
}
|
|
9345
|
-
const { openAll, closeAll } = styler;
|
|
9346
|
-
if (string.includes("\x1B")) {
|
|
9347
|
-
while (styler !== undefined) {
|
|
9348
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
9349
|
-
styler = styler.parent;
|
|
9350
|
-
}
|
|
9351
|
-
}
|
|
9352
|
-
const lfIndex = string.indexOf(`
|
|
9353
|
-
`);
|
|
9354
|
-
if (lfIndex !== -1) {
|
|
9355
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
9116
|
+
var kleur_default = $;
|
|
9117
|
+
|
|
9118
|
+
// src/utils/logger.ts
|
|
9119
|
+
if (!supportsColor) {
|
|
9120
|
+
kleur_default.enabled = false;
|
|
9121
|
+
}
|
|
9122
|
+
var options = {};
|
|
9123
|
+
var logger = {
|
|
9124
|
+
info(...args) {
|
|
9125
|
+
if (options.quiet)
|
|
9126
|
+
return;
|
|
9127
|
+
console.log(kleur_default.blue("info"), ...args);
|
|
9128
|
+
},
|
|
9129
|
+
success(...args) {
|
|
9130
|
+
if (options.quiet)
|
|
9131
|
+
return;
|
|
9132
|
+
console.log(kleur_default.green("\u2713"), ...args);
|
|
9133
|
+
},
|
|
9134
|
+
warn(...args) {
|
|
9135
|
+
if (options.quiet)
|
|
9136
|
+
return;
|
|
9137
|
+
console.warn(kleur_default.yellow("warn"), ...args);
|
|
9138
|
+
},
|
|
9139
|
+
error(...args) {
|
|
9140
|
+
console.error(kleur_default.red("error"), ...args);
|
|
9141
|
+
},
|
|
9142
|
+
debug(...args) {
|
|
9143
|
+
if (!options.verbose)
|
|
9144
|
+
return;
|
|
9145
|
+
console.log(kleur_default.gray("debug"), ...args);
|
|
9146
|
+
},
|
|
9147
|
+
log(...args) {
|
|
9148
|
+
if (options.quiet)
|
|
9149
|
+
return;
|
|
9150
|
+
console.log(...args);
|
|
9151
|
+
},
|
|
9152
|
+
break() {
|
|
9153
|
+
if (options.quiet)
|
|
9154
|
+
return;
|
|
9155
|
+
console.log("");
|
|
9356
9156
|
}
|
|
9357
|
-
return openAll + string + closeAll;
|
|
9358
9157
|
};
|
|
9359
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
9360
|
-
var chalk = createChalk();
|
|
9361
|
-
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
9362
|
-
var source_default = chalk;
|
|
9363
|
-
|
|
9364
|
-
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
9365
|
-
import process5 from "process";
|
|
9366
9158
|
|
|
9367
|
-
//
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
return;
|
|
9374
|
-
}
|
|
9375
|
-
if (property === "arguments" || property === "caller") {
|
|
9376
|
-
return;
|
|
9159
|
+
// src/utils/handle-error.ts
|
|
9160
|
+
function handleError(error, options2 = {}) {
|
|
9161
|
+
if (options2.json) {
|
|
9162
|
+
const output = formatErrorAsJson(error);
|
|
9163
|
+
console.log(JSON.stringify(output, null, 2));
|
|
9164
|
+
process.exit(output.exitCode);
|
|
9377
9165
|
}
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
return;
|
|
9166
|
+
if (error instanceof OCXError) {
|
|
9167
|
+
logger.error(error.message);
|
|
9168
|
+
process.exit(error.exitCode);
|
|
9382
9169
|
}
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
};
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
9391
|
-
return;
|
|
9170
|
+
if (error instanceof ZodError) {
|
|
9171
|
+
logger.error("Validation failed:");
|
|
9172
|
+
for (const issue of error.issues) {
|
|
9173
|
+
const path = issue.path.join(".");
|
|
9174
|
+
logger.error(` ${path}: ${issue.message}`);
|
|
9175
|
+
}
|
|
9176
|
+
process.exit(EXIT_CODES.CONFIG);
|
|
9392
9177
|
}
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
9401
|
-
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
9402
|
-
Object.defineProperty(newToString, "name", toStringName);
|
|
9403
|
-
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
9404
|
-
Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
|
|
9405
|
-
};
|
|
9406
|
-
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
9407
|
-
const { name } = to;
|
|
9408
|
-
for (const property of Reflect.ownKeys(from)) {
|
|
9409
|
-
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
9178
|
+
if (error instanceof Error) {
|
|
9179
|
+
logger.error(error.message);
|
|
9180
|
+
if (process.env.DEBUG) {
|
|
9181
|
+
console.error(error.stack);
|
|
9182
|
+
}
|
|
9183
|
+
} else {
|
|
9184
|
+
logger.error("An unknown error occurred");
|
|
9410
9185
|
}
|
|
9411
|
-
|
|
9412
|
-
changeToString(to, from, name);
|
|
9413
|
-
return to;
|
|
9186
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
9414
9187
|
}
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
returnValue = function_.apply(this, arguments_);
|
|
9429
|
-
function_ = undefined;
|
|
9430
|
-
} else if (options2.throw === true) {
|
|
9431
|
-
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
9432
|
-
}
|
|
9433
|
-
return returnValue;
|
|
9434
|
-
};
|
|
9435
|
-
mimicFunction(onetime2, function_);
|
|
9436
|
-
calledFunctions.set(onetime2, callCount);
|
|
9437
|
-
return onetime2;
|
|
9438
|
-
};
|
|
9439
|
-
onetime.callCount = (function_) => {
|
|
9440
|
-
if (!calledFunctions.has(function_)) {
|
|
9441
|
-
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
9188
|
+
function formatErrorAsJson(error) {
|
|
9189
|
+
if (error instanceof OCXError) {
|
|
9190
|
+
return {
|
|
9191
|
+
success: false,
|
|
9192
|
+
error: {
|
|
9193
|
+
code: error.code,
|
|
9194
|
+
message: error.message
|
|
9195
|
+
},
|
|
9196
|
+
exitCode: error.exitCode,
|
|
9197
|
+
meta: {
|
|
9198
|
+
timestamp: new Date().toISOString()
|
|
9199
|
+
}
|
|
9200
|
+
};
|
|
9442
9201
|
}
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9202
|
+
if (error instanceof ZodError) {
|
|
9203
|
+
return {
|
|
9204
|
+
success: false,
|
|
9205
|
+
error: {
|
|
9206
|
+
code: "VALIDATION_ERROR",
|
|
9207
|
+
message: error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")
|
|
9208
|
+
},
|
|
9209
|
+
exitCode: EXIT_CODES.CONFIG,
|
|
9210
|
+
meta: {
|
|
9211
|
+
timestamp: new Date().toISOString()
|
|
9212
|
+
}
|
|
9213
|
+
};
|
|
9214
|
+
}
|
|
9215
|
+
return {
|
|
9216
|
+
success: false,
|
|
9217
|
+
error: {
|
|
9218
|
+
code: "UNKNOWN_ERROR",
|
|
9219
|
+
message: error instanceof Error ? error.message : "An unknown error occurred"
|
|
9220
|
+
},
|
|
9221
|
+
exitCode: EXIT_CODES.GENERAL,
|
|
9222
|
+
meta: {
|
|
9223
|
+
timestamp: new Date().toISOString()
|
|
9224
|
+
}
|
|
9225
|
+
};
|
|
9452
9226
|
}
|
|
9453
|
-
|
|
9454
|
-
|
|
9227
|
+
// src/utils/json-output.ts
|
|
9228
|
+
function outputJson(data) {
|
|
9229
|
+
console.log(JSON.stringify(data, null, 2));
|
|
9455
9230
|
}
|
|
9231
|
+
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
9232
|
+
import process9 from "process";
|
|
9456
9233
|
|
|
9457
|
-
// ../../node_modules/.bun/
|
|
9458
|
-
var
|
|
9459
|
-
var
|
|
9460
|
-
var
|
|
9461
|
-
var
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9234
|
+
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
9235
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
9236
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
9237
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
9238
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
9239
|
+
var styles = {
|
|
9240
|
+
modifier: {
|
|
9241
|
+
reset: [0, 0],
|
|
9242
|
+
bold: [1, 22],
|
|
9243
|
+
dim: [2, 22],
|
|
9244
|
+
italic: [3, 23],
|
|
9245
|
+
underline: [4, 24],
|
|
9246
|
+
overline: [53, 55],
|
|
9247
|
+
inverse: [7, 27],
|
|
9248
|
+
hidden: [8, 28],
|
|
9249
|
+
strikethrough: [9, 29]
|
|
9250
|
+
},
|
|
9251
|
+
color: {
|
|
9252
|
+
black: [30, 39],
|
|
9253
|
+
red: [31, 39],
|
|
9254
|
+
green: [32, 39],
|
|
9255
|
+
yellow: [33, 39],
|
|
9256
|
+
blue: [34, 39],
|
|
9257
|
+
magenta: [35, 39],
|
|
9258
|
+
cyan: [36, 39],
|
|
9259
|
+
white: [37, 39],
|
|
9260
|
+
blackBright: [90, 39],
|
|
9261
|
+
gray: [90, 39],
|
|
9262
|
+
grey: [90, 39],
|
|
9263
|
+
redBright: [91, 39],
|
|
9264
|
+
greenBright: [92, 39],
|
|
9265
|
+
yellowBright: [93, 39],
|
|
9266
|
+
blueBright: [94, 39],
|
|
9267
|
+
magentaBright: [95, 39],
|
|
9268
|
+
cyanBright: [96, 39],
|
|
9269
|
+
whiteBright: [97, 39]
|
|
9270
|
+
},
|
|
9271
|
+
bgColor: {
|
|
9272
|
+
bgBlack: [40, 49],
|
|
9273
|
+
bgRed: [41, 49],
|
|
9274
|
+
bgGreen: [42, 49],
|
|
9275
|
+
bgYellow: [43, 49],
|
|
9276
|
+
bgBlue: [44, 49],
|
|
9277
|
+
bgMagenta: [45, 49],
|
|
9278
|
+
bgCyan: [46, 49],
|
|
9279
|
+
bgWhite: [47, 49],
|
|
9280
|
+
bgBlackBright: [100, 49],
|
|
9281
|
+
bgGray: [100, 49],
|
|
9282
|
+
bgGrey: [100, 49],
|
|
9283
|
+
bgRedBright: [101, 49],
|
|
9284
|
+
bgGreenBright: [102, 49],
|
|
9285
|
+
bgYellowBright: [103, 49],
|
|
9286
|
+
bgBlueBright: [104, 49],
|
|
9287
|
+
bgMagentaBright: [105, 49],
|
|
9288
|
+
bgCyanBright: [106, 49],
|
|
9289
|
+
bgWhiteBright: [107, 49]
|
|
9487
9290
|
}
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9291
|
+
};
|
|
9292
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
9293
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
9294
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
9295
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
9296
|
+
function assembleStyles() {
|
|
9297
|
+
const codes = new Map;
|
|
9298
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
9299
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
9300
|
+
styles[styleName] = {
|
|
9301
|
+
open: `\x1B[${style[0]}m`,
|
|
9302
|
+
close: `\x1B[${style[1]}m`
|
|
9303
|
+
};
|
|
9304
|
+
group[styleName] = styles[styleName];
|
|
9305
|
+
codes.set(style[0], style[1]);
|
|
9498
9306
|
}
|
|
9307
|
+
Object.defineProperty(styles, groupName, {
|
|
9308
|
+
value: group,
|
|
9309
|
+
enumerable: false
|
|
9310
|
+
});
|
|
9499
9311
|
}
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9312
|
+
Object.defineProperty(styles, "codes", {
|
|
9313
|
+
value: codes,
|
|
9314
|
+
enumerable: false
|
|
9315
|
+
});
|
|
9316
|
+
styles.color.close = "\x1B[39m";
|
|
9317
|
+
styles.bgColor.close = "\x1B[49m";
|
|
9318
|
+
styles.color.ansi = wrapAnsi16();
|
|
9319
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
9320
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
9321
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
9322
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
9323
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
9324
|
+
Object.defineProperties(styles, {
|
|
9325
|
+
rgbToAnsi256: {
|
|
9326
|
+
value(red, green, blue) {
|
|
9327
|
+
if (red === green && green === blue) {
|
|
9328
|
+
if (red < 8) {
|
|
9329
|
+
return 16;
|
|
9330
|
+
}
|
|
9331
|
+
if (red > 248) {
|
|
9332
|
+
return 231;
|
|
9333
|
+
}
|
|
9334
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
9335
|
+
}
|
|
9336
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
9337
|
+
},
|
|
9338
|
+
enumerable: false
|
|
9339
|
+
},
|
|
9340
|
+
hexToRgb: {
|
|
9341
|
+
value(hex) {
|
|
9342
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
9343
|
+
if (!matches) {
|
|
9344
|
+
return [0, 0, 0];
|
|
9345
|
+
}
|
|
9346
|
+
let [colorString] = matches;
|
|
9347
|
+
if (colorString.length === 3) {
|
|
9348
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
9349
|
+
}
|
|
9350
|
+
const integer = Number.parseInt(colorString, 16);
|
|
9351
|
+
return [
|
|
9352
|
+
integer >> 16 & 255,
|
|
9353
|
+
integer >> 8 & 255,
|
|
9354
|
+
integer & 255
|
|
9355
|
+
];
|
|
9356
|
+
},
|
|
9357
|
+
enumerable: false
|
|
9358
|
+
},
|
|
9359
|
+
hexToAnsi256: {
|
|
9360
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
9361
|
+
enumerable: false
|
|
9362
|
+
},
|
|
9363
|
+
ansi256ToAnsi: {
|
|
9364
|
+
value(code) {
|
|
9365
|
+
if (code < 8) {
|
|
9366
|
+
return 30 + code;
|
|
9367
|
+
}
|
|
9368
|
+
if (code < 16) {
|
|
9369
|
+
return 90 + (code - 8);
|
|
9370
|
+
}
|
|
9371
|
+
let red;
|
|
9372
|
+
let green;
|
|
9373
|
+
let blue;
|
|
9374
|
+
if (code >= 232) {
|
|
9375
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
9376
|
+
green = red;
|
|
9377
|
+
blue = red;
|
|
9378
|
+
} else {
|
|
9379
|
+
code -= 16;
|
|
9380
|
+
const remainder = code % 36;
|
|
9381
|
+
red = Math.floor(code / 36) / 5;
|
|
9382
|
+
green = Math.floor(remainder / 6) / 5;
|
|
9383
|
+
blue = remainder % 6 / 5;
|
|
9384
|
+
}
|
|
9385
|
+
const value = Math.max(red, green, blue) * 2;
|
|
9386
|
+
if (value === 0) {
|
|
9387
|
+
return 30;
|
|
9388
|
+
}
|
|
9389
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
9390
|
+
if (value === 2) {
|
|
9391
|
+
result += 60;
|
|
9392
|
+
}
|
|
9393
|
+
return result;
|
|
9394
|
+
},
|
|
9395
|
+
enumerable: false
|
|
9396
|
+
},
|
|
9397
|
+
rgbToAnsi: {
|
|
9398
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
9399
|
+
enumerable: false
|
|
9400
|
+
},
|
|
9401
|
+
hexToAnsi: {
|
|
9402
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
9403
|
+
enumerable: false
|
|
9503
9404
|
}
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9405
|
+
});
|
|
9406
|
+
return styles;
|
|
9407
|
+
}
|
|
9408
|
+
var ansiStyles = assembleStyles();
|
|
9409
|
+
var ansi_styles_default = ansiStyles;
|
|
9410
|
+
|
|
9411
|
+
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
9412
|
+
import process2 from "process";
|
|
9413
|
+
import os from "os";
|
|
9414
|
+
import tty from "tty";
|
|
9415
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
9416
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
9417
|
+
const position = argv.indexOf(prefix + flag);
|
|
9418
|
+
const terminatorPosition = argv.indexOf("--");
|
|
9419
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
9420
|
+
}
|
|
9421
|
+
var { env } = process2;
|
|
9422
|
+
var flagForceColor;
|
|
9423
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
9424
|
+
flagForceColor = 0;
|
|
9425
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
9426
|
+
flagForceColor = 1;
|
|
9427
|
+
}
|
|
9428
|
+
function envForceColor() {
|
|
9429
|
+
if ("FORCE_COLOR" in env) {
|
|
9430
|
+
if (env.FORCE_COLOR === "true") {
|
|
9431
|
+
return 1;
|
|
9508
9432
|
}
|
|
9509
|
-
if (
|
|
9510
|
-
|
|
9433
|
+
if (env.FORCE_COLOR === "false") {
|
|
9434
|
+
return 0;
|
|
9511
9435
|
}
|
|
9512
|
-
return
|
|
9436
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
9513
9437
|
}
|
|
9514
9438
|
}
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9439
|
+
function translateLevel(level) {
|
|
9440
|
+
if (level === 0) {
|
|
9441
|
+
return false;
|
|
9442
|
+
}
|
|
9519
9443
|
return {
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
return handler.load();
|
|
9525
|
-
},
|
|
9526
|
-
unload() {
|
|
9527
|
-
return handler.unload();
|
|
9528
|
-
}
|
|
9444
|
+
level,
|
|
9445
|
+
hasBasic: true,
|
|
9446
|
+
has256: level >= 2,
|
|
9447
|
+
has16m: level >= 3
|
|
9529
9448
|
};
|
|
9530
|
-
};
|
|
9531
|
-
|
|
9532
|
-
class SignalExitFallback extends SignalExitBase {
|
|
9533
|
-
onExit() {
|
|
9534
|
-
return () => {};
|
|
9535
|
-
}
|
|
9536
|
-
load() {}
|
|
9537
|
-
unload() {}
|
|
9538
9449
|
}
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
#process;
|
|
9544
|
-
#originalProcessEmit;
|
|
9545
|
-
#originalProcessReallyExit;
|
|
9546
|
-
#sigListeners = {};
|
|
9547
|
-
#loaded = false;
|
|
9548
|
-
constructor(process3) {
|
|
9549
|
-
super();
|
|
9550
|
-
this.#process = process3;
|
|
9551
|
-
this.#sigListeners = {};
|
|
9552
|
-
for (const sig of signals) {
|
|
9553
|
-
this.#sigListeners[sig] = () => {
|
|
9554
|
-
const listeners = this.#process.listeners(sig);
|
|
9555
|
-
let { count } = this.#emitter;
|
|
9556
|
-
const p = process3;
|
|
9557
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
9558
|
-
count += p.__signal_exit_emitter__.count;
|
|
9559
|
-
}
|
|
9560
|
-
if (listeners.length === count) {
|
|
9561
|
-
this.unload();
|
|
9562
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
9563
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
9564
|
-
if (!ret)
|
|
9565
|
-
process3.kill(process3.pid, s);
|
|
9566
|
-
}
|
|
9567
|
-
};
|
|
9568
|
-
}
|
|
9569
|
-
this.#originalProcessReallyExit = process3.reallyExit;
|
|
9570
|
-
this.#originalProcessEmit = process3.emit;
|
|
9450
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
9451
|
+
const noFlagForceColor = envForceColor();
|
|
9452
|
+
if (noFlagForceColor !== undefined) {
|
|
9453
|
+
flagForceColor = noFlagForceColor;
|
|
9571
9454
|
}
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
}
|
|
9576
|
-
if (this.#loaded === false) {
|
|
9577
|
-
this.load();
|
|
9578
|
-
}
|
|
9579
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
9580
|
-
this.#emitter.on(ev, cb);
|
|
9581
|
-
return () => {
|
|
9582
|
-
this.#emitter.removeListener(ev, cb);
|
|
9583
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
9584
|
-
this.unload();
|
|
9585
|
-
}
|
|
9586
|
-
};
|
|
9455
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
9456
|
+
if (forceColor === 0) {
|
|
9457
|
+
return 0;
|
|
9587
9458
|
}
|
|
9588
|
-
|
|
9589
|
-
if (
|
|
9590
|
-
return;
|
|
9459
|
+
if (sniffFlags) {
|
|
9460
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
9461
|
+
return 3;
|
|
9591
9462
|
}
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
for (const sig of signals) {
|
|
9595
|
-
try {
|
|
9596
|
-
const fn = this.#sigListeners[sig];
|
|
9597
|
-
if (fn)
|
|
9598
|
-
this.#process.on(sig, fn);
|
|
9599
|
-
} catch (_) {}
|
|
9463
|
+
if (hasFlag("color=256")) {
|
|
9464
|
+
return 2;
|
|
9600
9465
|
}
|
|
9601
|
-
this.#process.emit = (ev, ...a) => {
|
|
9602
|
-
return this.#processEmit(ev, ...a);
|
|
9603
|
-
};
|
|
9604
|
-
this.#process.reallyExit = (code) => {
|
|
9605
|
-
return this.#processReallyExit(code);
|
|
9606
|
-
};
|
|
9607
9466
|
}
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
return;
|
|
9611
|
-
}
|
|
9612
|
-
this.#loaded = false;
|
|
9613
|
-
signals.forEach((sig) => {
|
|
9614
|
-
const listener = this.#sigListeners[sig];
|
|
9615
|
-
if (!listener) {
|
|
9616
|
-
throw new Error("Listener not defined for signal: " + sig);
|
|
9617
|
-
}
|
|
9618
|
-
try {
|
|
9619
|
-
this.#process.removeListener(sig, listener);
|
|
9620
|
-
} catch (_) {}
|
|
9621
|
-
});
|
|
9622
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
9623
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
9624
|
-
this.#emitter.count -= 1;
|
|
9467
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
9468
|
+
return 1;
|
|
9625
9469
|
}
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9470
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
9471
|
+
return 0;
|
|
9472
|
+
}
|
|
9473
|
+
const min = forceColor || 0;
|
|
9474
|
+
if (env.TERM === "dumb") {
|
|
9475
|
+
return min;
|
|
9476
|
+
}
|
|
9477
|
+
if (process2.platform === "win32") {
|
|
9478
|
+
const osRelease = os.release().split(".");
|
|
9479
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
9480
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
9629
9481
|
}
|
|
9630
|
-
|
|
9631
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
9632
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
9482
|
+
return 1;
|
|
9633
9483
|
}
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
9641
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
9642
|
-
return ret;
|
|
9643
|
-
} else {
|
|
9644
|
-
return og.call(this.#process, ev, ...args);
|
|
9484
|
+
if ("CI" in env) {
|
|
9485
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
|
|
9486
|
+
return 3;
|
|
9487
|
+
}
|
|
9488
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
9489
|
+
return 1;
|
|
9645
9490
|
}
|
|
9491
|
+
return min;
|
|
9646
9492
|
}
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
var {
|
|
9650
|
-
onExit,
|
|
9651
|
-
load,
|
|
9652
|
-
unload
|
|
9653
|
-
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
9654
|
-
|
|
9655
|
-
// ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
9656
|
-
var terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : undefined;
|
|
9657
|
-
var restoreCursor = terminal ? onetime_default(() => {
|
|
9658
|
-
onExit(() => {
|
|
9659
|
-
terminal.write("\x1B[?25h");
|
|
9660
|
-
}, { alwaysLast: true });
|
|
9661
|
-
}) : () => {};
|
|
9662
|
-
var restore_cursor_default = restoreCursor;
|
|
9663
|
-
|
|
9664
|
-
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
9665
|
-
var isHidden = false;
|
|
9666
|
-
var cliCursor = {};
|
|
9667
|
-
cliCursor.show = (writableStream = process5.stderr) => {
|
|
9668
|
-
if (!writableStream.isTTY) {
|
|
9669
|
-
return;
|
|
9493
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
9494
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
9670
9495
|
}
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
};
|
|
9674
|
-
cliCursor.hide = (writableStream = process5.stderr) => {
|
|
9675
|
-
if (!writableStream.isTTY) {
|
|
9676
|
-
return;
|
|
9496
|
+
if (env.COLORTERM === "truecolor") {
|
|
9497
|
+
return 3;
|
|
9677
9498
|
}
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
writableStream.write("\x1B[?25l");
|
|
9681
|
-
};
|
|
9682
|
-
cliCursor.toggle = (force, writableStream) => {
|
|
9683
|
-
if (force !== undefined) {
|
|
9684
|
-
isHidden = force;
|
|
9499
|
+
if (env.TERM === "xterm-kitty") {
|
|
9500
|
+
return 3;
|
|
9685
9501
|
}
|
|
9686
|
-
if (
|
|
9687
|
-
|
|
9688
|
-
} else {
|
|
9689
|
-
cliCursor.hide(writableStream);
|
|
9502
|
+
if (env.TERM === "xterm-ghostty") {
|
|
9503
|
+
return 3;
|
|
9690
9504
|
}
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
9695
|
-
var import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
9696
|
-
|
|
9697
|
-
// ../../node_modules/.bun/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js
|
|
9698
|
-
import process6 from "process";
|
|
9699
|
-
function isUnicodeSupported() {
|
|
9700
|
-
if (process6.platform !== "win32") {
|
|
9701
|
-
return process6.env.TERM !== "linux";
|
|
9505
|
+
if (env.TERM === "wezterm") {
|
|
9506
|
+
return 3;
|
|
9702
9507
|
}
|
|
9703
|
-
|
|
9508
|
+
if ("TERM_PROGRAM" in env) {
|
|
9509
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
9510
|
+
switch (env.TERM_PROGRAM) {
|
|
9511
|
+
case "iTerm.app": {
|
|
9512
|
+
return version >= 3 ? 3 : 2;
|
|
9513
|
+
}
|
|
9514
|
+
case "Apple_Terminal": {
|
|
9515
|
+
return 2;
|
|
9516
|
+
}
|
|
9517
|
+
}
|
|
9518
|
+
}
|
|
9519
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
9520
|
+
return 2;
|
|
9521
|
+
}
|
|
9522
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
9523
|
+
return 1;
|
|
9524
|
+
}
|
|
9525
|
+
if ("COLORTERM" in env) {
|
|
9526
|
+
return 1;
|
|
9527
|
+
}
|
|
9528
|
+
return min;
|
|
9704
9529
|
}
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
error: source_default.red("\u2716")
|
|
9712
|
-
};
|
|
9713
|
-
var fallback = {
|
|
9714
|
-
info: source_default.blue("i"),
|
|
9715
|
-
success: source_default.green("\u221A"),
|
|
9716
|
-
warning: source_default.yellow("\u203C"),
|
|
9717
|
-
error: source_default.red("\xD7")
|
|
9718
|
-
};
|
|
9719
|
-
var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
9720
|
-
var log_symbols_default = logSymbols;
|
|
9721
|
-
|
|
9722
|
-
// ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
9723
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
9724
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
9725
|
-
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
9726
|
-
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
9727
|
-
const pattern = `${osc}|${csi}`;
|
|
9728
|
-
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
9530
|
+
function createSupportsColor(stream, options2 = {}) {
|
|
9531
|
+
const level = _supportsColor(stream, {
|
|
9532
|
+
streamIsTTY: stream && stream.isTTY,
|
|
9533
|
+
...options2
|
|
9534
|
+
});
|
|
9535
|
+
return translateLevel(level);
|
|
9729
9536
|
}
|
|
9537
|
+
var supportsColor2 = {
|
|
9538
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
9539
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
9540
|
+
};
|
|
9541
|
+
var supports_color_default = supportsColor2;
|
|
9730
9542
|
|
|
9731
|
-
// ../../node_modules/.bun/
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
if (
|
|
9735
|
-
|
|
9543
|
+
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
9544
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
9545
|
+
let index = string.indexOf(substring);
|
|
9546
|
+
if (index === -1) {
|
|
9547
|
+
return string;
|
|
9736
9548
|
}
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9549
|
+
const substringLength = substring.length;
|
|
9550
|
+
let endIndex = 0;
|
|
9551
|
+
let returnValue = "";
|
|
9552
|
+
do {
|
|
9553
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
9554
|
+
endIndex = index + substringLength;
|
|
9555
|
+
index = string.indexOf(substring, endIndex);
|
|
9556
|
+
} while (index !== -1);
|
|
9557
|
+
returnValue += string.slice(endIndex);
|
|
9558
|
+
return returnValue;
|
|
9746
9559
|
}
|
|
9747
|
-
function
|
|
9748
|
-
|
|
9560
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
9561
|
+
let endIndex = 0;
|
|
9562
|
+
let returnValue = "";
|
|
9563
|
+
do {
|
|
9564
|
+
const gotCR = string[index - 1] === "\r";
|
|
9565
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
9566
|
+
` : `
|
|
9567
|
+
`) + postfix;
|
|
9568
|
+
endIndex = index + 1;
|
|
9569
|
+
index = string.indexOf(`
|
|
9570
|
+
`, endIndex);
|
|
9571
|
+
} while (index !== -1);
|
|
9572
|
+
returnValue += string.slice(endIndex);
|
|
9573
|
+
return returnValue;
|
|
9749
9574
|
}
|
|
9750
9575
|
|
|
9751
|
-
// ../../node_modules/.bun/
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9576
|
+
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
9577
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
9578
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
9579
|
+
var STYLER = Symbol("STYLER");
|
|
9580
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
9581
|
+
var levelMapping = [
|
|
9582
|
+
"ansi",
|
|
9583
|
+
"ansi",
|
|
9584
|
+
"ansi256",
|
|
9585
|
+
"ansi16m"
|
|
9586
|
+
];
|
|
9587
|
+
var styles2 = Object.create(null);
|
|
9588
|
+
var applyOptions = (object, options2 = {}) => {
|
|
9589
|
+
if (options2.level && !(Number.isInteger(options2.level) && options2.level >= 0 && options2.level <= 3)) {
|
|
9590
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
9755
9591
|
}
|
|
9592
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
9593
|
+
object.level = options2.level === undefined ? colorLevel : options2.level;
|
|
9594
|
+
};
|
|
9595
|
+
var chalkFactory = (options2) => {
|
|
9596
|
+
const chalk = (...strings) => strings.join(" ");
|
|
9597
|
+
applyOptions(chalk, options2);
|
|
9598
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
9599
|
+
return chalk;
|
|
9600
|
+
};
|
|
9601
|
+
function createChalk(options2) {
|
|
9602
|
+
return chalkFactory(options2);
|
|
9756
9603
|
}
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9604
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
9605
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
9606
|
+
styles2[styleName] = {
|
|
9607
|
+
get() {
|
|
9608
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
9609
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
9610
|
+
return builder;
|
|
9611
|
+
}
|
|
9612
|
+
};
|
|
9763
9613
|
}
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
// ../../node_modules/.bun/string-width@7.2.0/node_modules/string-width/index.js
|
|
9771
|
-
var segmenter = new Intl.Segmenter;
|
|
9772
|
-
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
9773
|
-
function stringWidth(string, options2 = {}) {
|
|
9774
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
9775
|
-
return 0;
|
|
9776
|
-
}
|
|
9777
|
-
const {
|
|
9778
|
-
ambiguousIsNarrow = true,
|
|
9779
|
-
countAnsiEscapeCodes = false
|
|
9780
|
-
} = options2;
|
|
9781
|
-
if (!countAnsiEscapeCodes) {
|
|
9782
|
-
string = stripAnsi(string);
|
|
9783
|
-
}
|
|
9784
|
-
if (string.length === 0) {
|
|
9785
|
-
return 0;
|
|
9614
|
+
styles2.visible = {
|
|
9615
|
+
get() {
|
|
9616
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
9617
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
9618
|
+
return builder;
|
|
9786
9619
|
}
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
continue;
|
|
9793
|
-
}
|
|
9794
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
9795
|
-
continue;
|
|
9620
|
+
};
|
|
9621
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
9622
|
+
if (model === "rgb") {
|
|
9623
|
+
if (level === "ansi16m") {
|
|
9624
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
9796
9625
|
}
|
|
9797
|
-
if (
|
|
9798
|
-
|
|
9626
|
+
if (level === "ansi256") {
|
|
9627
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
9799
9628
|
}
|
|
9800
|
-
|
|
9801
|
-
|
|
9629
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
9630
|
+
}
|
|
9631
|
+
if (model === "hex") {
|
|
9632
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
9633
|
+
}
|
|
9634
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
9635
|
+
};
|
|
9636
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
9637
|
+
for (const model of usedModels) {
|
|
9638
|
+
styles2[model] = {
|
|
9639
|
+
get() {
|
|
9640
|
+
const { level } = this;
|
|
9641
|
+
return function(...arguments_) {
|
|
9642
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
9643
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
9644
|
+
};
|
|
9802
9645
|
}
|
|
9803
|
-
|
|
9804
|
-
|
|
9646
|
+
};
|
|
9647
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
9648
|
+
styles2[bgModel] = {
|
|
9649
|
+
get() {
|
|
9650
|
+
const { level } = this;
|
|
9651
|
+
return function(...arguments_) {
|
|
9652
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
9653
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
9654
|
+
};
|
|
9805
9655
|
}
|
|
9806
|
-
|
|
9807
|
-
|
|
9656
|
+
};
|
|
9657
|
+
}
|
|
9658
|
+
var proto = Object.defineProperties(() => {}, {
|
|
9659
|
+
...styles2,
|
|
9660
|
+
level: {
|
|
9661
|
+
enumerable: true,
|
|
9662
|
+
get() {
|
|
9663
|
+
return this[GENERATOR].level;
|
|
9664
|
+
},
|
|
9665
|
+
set(level) {
|
|
9666
|
+
this[GENERATOR].level = level;
|
|
9808
9667
|
}
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9668
|
+
}
|
|
9669
|
+
});
|
|
9670
|
+
var createStyler = (open, close, parent) => {
|
|
9671
|
+
let openAll;
|
|
9672
|
+
let closeAll;
|
|
9673
|
+
if (parent === undefined) {
|
|
9674
|
+
openAll = open;
|
|
9675
|
+
closeAll = close;
|
|
9676
|
+
} else {
|
|
9677
|
+
openAll = parent.openAll + open;
|
|
9678
|
+
closeAll = close + parent.closeAll;
|
|
9679
|
+
}
|
|
9680
|
+
return {
|
|
9681
|
+
open,
|
|
9682
|
+
close,
|
|
9683
|
+
openAll,
|
|
9684
|
+
closeAll,
|
|
9685
|
+
parent
|
|
9686
|
+
};
|
|
9687
|
+
};
|
|
9688
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
9689
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
9690
|
+
Object.setPrototypeOf(builder, proto);
|
|
9691
|
+
builder[GENERATOR] = self;
|
|
9692
|
+
builder[STYLER] = _styler;
|
|
9693
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
9694
|
+
return builder;
|
|
9695
|
+
};
|
|
9696
|
+
var applyStyle = (self, string) => {
|
|
9697
|
+
if (self.level <= 0 || !string) {
|
|
9698
|
+
return self[IS_EMPTY] ? "" : string;
|
|
9699
|
+
}
|
|
9700
|
+
let styler = self[STYLER];
|
|
9701
|
+
if (styler === undefined) {
|
|
9702
|
+
return string;
|
|
9703
|
+
}
|
|
9704
|
+
const { openAll, closeAll } = styler;
|
|
9705
|
+
if (string.includes("\x1B")) {
|
|
9706
|
+
while (styler !== undefined) {
|
|
9707
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
9708
|
+
styler = styler.parent;
|
|
9812
9709
|
}
|
|
9813
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
9814
9710
|
}
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
function isInteractive({ stream = process.stdout } = {}) {
|
|
9820
|
-
return Boolean(stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
|
|
9821
|
-
}
|
|
9822
|
-
|
|
9823
|
-
// ../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
9824
|
-
import process7 from "process";
|
|
9825
|
-
function isUnicodeSupported2() {
|
|
9826
|
-
const { env: env2 } = process7;
|
|
9827
|
-
const { TERM: TERM2, TERM_PROGRAM } = env2;
|
|
9828
|
-
if (process7.platform !== "win32") {
|
|
9829
|
-
return TERM2 !== "linux";
|
|
9711
|
+
const lfIndex = string.indexOf(`
|
|
9712
|
+
`);
|
|
9713
|
+
if (lfIndex !== -1) {
|
|
9714
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
9830
9715
|
}
|
|
9831
|
-
return
|
|
9832
|
-
}
|
|
9716
|
+
return openAll + string + closeAll;
|
|
9717
|
+
};
|
|
9718
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
9719
|
+
var chalk = createChalk();
|
|
9720
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
9721
|
+
var source_default = chalk;
|
|
9833
9722
|
|
|
9834
|
-
// ../../node_modules/.bun/
|
|
9835
|
-
import
|
|
9836
|
-
var ASCII_ETX_CODE = 3;
|
|
9723
|
+
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
9724
|
+
import process5 from "process";
|
|
9837
9725
|
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9726
|
+
// ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
9727
|
+
import process4 from "process";
|
|
9728
|
+
|
|
9729
|
+
// ../../node_modules/.bun/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
9730
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
9731
|
+
if (property === "length" || property === "prototype") {
|
|
9732
|
+
return;
|
|
9845
9733
|
}
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
throw new Error("`stop` called more times than `start`");
|
|
9849
|
-
}
|
|
9850
|
-
this.#activeCount--;
|
|
9851
|
-
if (this.#activeCount === 0) {
|
|
9852
|
-
this.#realStop();
|
|
9853
|
-
}
|
|
9734
|
+
if (property === "arguments" || property === "caller") {
|
|
9735
|
+
return;
|
|
9854
9736
|
}
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
process8.stdin.setRawMode(true);
|
|
9860
|
-
process8.stdin.on("data", this.#handleInput);
|
|
9861
|
-
process8.stdin.resume();
|
|
9737
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
9738
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
9739
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
9740
|
+
return;
|
|
9862
9741
|
}
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9742
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
9743
|
+
};
|
|
9744
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
9745
|
+
return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
9746
|
+
};
|
|
9747
|
+
var changePrototype = (to, from) => {
|
|
9748
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
9749
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
9750
|
+
return;
|
|
9870
9751
|
}
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9752
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
9753
|
+
};
|
|
9754
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
9755
|
+
${fromBody}`;
|
|
9756
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
9757
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
9758
|
+
var changeToString = (to, from, name) => {
|
|
9759
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
9760
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
9761
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
9762
|
+
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
9763
|
+
Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
|
|
9764
|
+
};
|
|
9765
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
9766
|
+
const { name } = to;
|
|
9767
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
9768
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
9875
9769
|
}
|
|
9770
|
+
changePrototype(to, from);
|
|
9771
|
+
changeToString(to, from, name);
|
|
9772
|
+
return to;
|
|
9876
9773
|
}
|
|
9877
|
-
var stdinDiscarder = new StdinDiscarder;
|
|
9878
|
-
var stdin_discarder_default = stdinDiscarder;
|
|
9879
|
-
|
|
9880
|
-
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
9881
|
-
var import_cli_spinners2 = __toESM(require_cli_spinners(), 1);
|
|
9882
9774
|
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
#lastSpinnerFrameTime = 0;
|
|
9889
|
-
#options;
|
|
9890
|
-
#spinner;
|
|
9891
|
-
#stream;
|
|
9892
|
-
#id;
|
|
9893
|
-
#initialInterval;
|
|
9894
|
-
#isEnabled;
|
|
9895
|
-
#isSilent;
|
|
9896
|
-
#indent;
|
|
9897
|
-
#text;
|
|
9898
|
-
#prefixText;
|
|
9899
|
-
#suffixText;
|
|
9900
|
-
color;
|
|
9901
|
-
constructor(options2) {
|
|
9902
|
-
if (typeof options2 === "string") {
|
|
9903
|
-
options2 = {
|
|
9904
|
-
text: options2
|
|
9905
|
-
};
|
|
9906
|
-
}
|
|
9907
|
-
this.#options = {
|
|
9908
|
-
color: "cyan",
|
|
9909
|
-
stream: process9.stderr,
|
|
9910
|
-
discardStdin: true,
|
|
9911
|
-
hideCursor: true,
|
|
9912
|
-
...options2
|
|
9913
|
-
};
|
|
9914
|
-
this.color = this.#options.color;
|
|
9915
|
-
this.spinner = this.#options.spinner;
|
|
9916
|
-
this.#initialInterval = this.#options.interval;
|
|
9917
|
-
this.#stream = this.#options.stream;
|
|
9918
|
-
this.#isEnabled = typeof this.#options.isEnabled === "boolean" ? this.#options.isEnabled : isInteractive({ stream: this.#stream });
|
|
9919
|
-
this.#isSilent = typeof this.#options.isSilent === "boolean" ? this.#options.isSilent : false;
|
|
9920
|
-
this.text = this.#options.text;
|
|
9921
|
-
this.prefixText = this.#options.prefixText;
|
|
9922
|
-
this.suffixText = this.#options.suffixText;
|
|
9923
|
-
this.indent = this.#options.indent;
|
|
9924
|
-
if (process9.env.NODE_ENV === "test") {
|
|
9925
|
-
this._stream = this.#stream;
|
|
9926
|
-
this._isEnabled = this.#isEnabled;
|
|
9927
|
-
Object.defineProperty(this, "_linesToClear", {
|
|
9928
|
-
get() {
|
|
9929
|
-
return this.#linesToClear;
|
|
9930
|
-
},
|
|
9931
|
-
set(newValue) {
|
|
9932
|
-
this.#linesToClear = newValue;
|
|
9933
|
-
}
|
|
9934
|
-
});
|
|
9935
|
-
Object.defineProperty(this, "_frameIndex", {
|
|
9936
|
-
get() {
|
|
9937
|
-
return this.#frameIndex;
|
|
9938
|
-
}
|
|
9939
|
-
});
|
|
9940
|
-
Object.defineProperty(this, "_lineCount", {
|
|
9941
|
-
get() {
|
|
9942
|
-
return this.#lineCount;
|
|
9943
|
-
}
|
|
9944
|
-
});
|
|
9945
|
-
}
|
|
9946
|
-
}
|
|
9947
|
-
get indent() {
|
|
9948
|
-
return this.#indent;
|
|
9775
|
+
// ../../node_modules/.bun/onetime@7.0.0/node_modules/onetime/index.js
|
|
9776
|
+
var calledFunctions = new WeakMap;
|
|
9777
|
+
var onetime = (function_, options2 = {}) => {
|
|
9778
|
+
if (typeof function_ !== "function") {
|
|
9779
|
+
throw new TypeError("Expected a function");
|
|
9949
9780
|
}
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9781
|
+
let returnValue;
|
|
9782
|
+
let callCount = 0;
|
|
9783
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
9784
|
+
const onetime2 = function(...arguments_) {
|
|
9785
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
9786
|
+
if (callCount === 1) {
|
|
9787
|
+
returnValue = function_.apply(this, arguments_);
|
|
9788
|
+
function_ = undefined;
|
|
9789
|
+
} else if (options2.throw === true) {
|
|
9790
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
9953
9791
|
}
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9792
|
+
return returnValue;
|
|
9793
|
+
};
|
|
9794
|
+
mimicFunction(onetime2, function_);
|
|
9795
|
+
calledFunctions.set(onetime2, callCount);
|
|
9796
|
+
return onetime2;
|
|
9797
|
+
};
|
|
9798
|
+
onetime.callCount = (function_) => {
|
|
9799
|
+
if (!calledFunctions.has(function_)) {
|
|
9800
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
9962
9801
|
}
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9802
|
+
return calledFunctions.get(function_);
|
|
9803
|
+
};
|
|
9804
|
+
var onetime_default = onetime;
|
|
9805
|
+
|
|
9806
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
9807
|
+
var signals = [];
|
|
9808
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
9809
|
+
if (process.platform !== "win32") {
|
|
9810
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
9811
|
+
}
|
|
9812
|
+
if (process.platform === "linux") {
|
|
9813
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
9814
|
+
}
|
|
9815
|
+
|
|
9816
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
9817
|
+
var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
9818
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
9819
|
+
var global = globalThis;
|
|
9820
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
9821
|
+
|
|
9822
|
+
class Emitter {
|
|
9823
|
+
emitted = {
|
|
9824
|
+
afterExit: false,
|
|
9825
|
+
exit: false
|
|
9826
|
+
};
|
|
9827
|
+
listeners = {
|
|
9828
|
+
afterExit: [],
|
|
9829
|
+
exit: []
|
|
9830
|
+
};
|
|
9831
|
+
count = 0;
|
|
9832
|
+
id = Math.random();
|
|
9833
|
+
constructor() {
|
|
9834
|
+
if (global[kExitEmitter]) {
|
|
9835
|
+
return global[kExitEmitter];
|
|
9979
9836
|
}
|
|
9837
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
9838
|
+
value: this,
|
|
9839
|
+
writable: false,
|
|
9840
|
+
enumerable: false,
|
|
9841
|
+
configurable: false
|
|
9842
|
+
});
|
|
9980
9843
|
}
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
}
|
|
9984
|
-
set text(value = "") {
|
|
9985
|
-
this.#text = value;
|
|
9986
|
-
this.#updateLineCount();
|
|
9987
|
-
}
|
|
9988
|
-
get prefixText() {
|
|
9989
|
-
return this.#prefixText;
|
|
9990
|
-
}
|
|
9991
|
-
set prefixText(value = "") {
|
|
9992
|
-
this.#prefixText = value;
|
|
9993
|
-
this.#updateLineCount();
|
|
9994
|
-
}
|
|
9995
|
-
get suffixText() {
|
|
9996
|
-
return this.#suffixText;
|
|
9997
|
-
}
|
|
9998
|
-
set suffixText(value = "") {
|
|
9999
|
-
this.#suffixText = value;
|
|
10000
|
-
this.#updateLineCount();
|
|
10001
|
-
}
|
|
10002
|
-
get isSpinning() {
|
|
10003
|
-
return this.#id !== undefined;
|
|
9844
|
+
on(ev, fn) {
|
|
9845
|
+
this.listeners[ev].push(fn);
|
|
10004
9846
|
}
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
9847
|
+
removeListener(ev, fn) {
|
|
9848
|
+
const list = this.listeners[ev];
|
|
9849
|
+
const i = list.indexOf(fn);
|
|
9850
|
+
if (i === -1) {
|
|
9851
|
+
return;
|
|
10008
9852
|
}
|
|
10009
|
-
if (
|
|
10010
|
-
|
|
9853
|
+
if (i === 0 && list.length === 1) {
|
|
9854
|
+
list.length = 0;
|
|
9855
|
+
} else {
|
|
9856
|
+
list.splice(i, 1);
|
|
10011
9857
|
}
|
|
10012
|
-
return "";
|
|
10013
9858
|
}
|
|
10014
|
-
|
|
10015
|
-
if (
|
|
10016
|
-
return
|
|
9859
|
+
emit(ev, code, signal) {
|
|
9860
|
+
if (this.emitted[ev]) {
|
|
9861
|
+
return false;
|
|
10017
9862
|
}
|
|
10018
|
-
|
|
10019
|
-
|
|
9863
|
+
this.emitted[ev] = true;
|
|
9864
|
+
let ret = false;
|
|
9865
|
+
for (const fn of this.listeners[ev]) {
|
|
9866
|
+
ret = fn(code, signal) === true || ret;
|
|
10020
9867
|
}
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
#updateLineCount() {
|
|
10024
|
-
const columns = this.#stream.columns ?? 80;
|
|
10025
|
-
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, "-");
|
|
10026
|
-
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
10027
|
-
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
10028
|
-
this.#lineCount = 0;
|
|
10029
|
-
for (const line of stripAnsi(fullText).split(`
|
|
10030
|
-
`)) {
|
|
10031
|
-
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, { countAnsiEscapeCodes: true }) / columns));
|
|
9868
|
+
if (ev === "exit") {
|
|
9869
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
10032
9870
|
}
|
|
9871
|
+
return ret;
|
|
10033
9872
|
}
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
9873
|
+
}
|
|
9874
|
+
|
|
9875
|
+
class SignalExitBase {
|
|
9876
|
+
}
|
|
9877
|
+
var signalExitWrap = (handler) => {
|
|
9878
|
+
return {
|
|
9879
|
+
onExit(cb, opts) {
|
|
9880
|
+
return handler.onExit(cb, opts);
|
|
9881
|
+
},
|
|
9882
|
+
load() {
|
|
9883
|
+
return handler.load();
|
|
9884
|
+
},
|
|
9885
|
+
unload() {
|
|
9886
|
+
return handler.unload();
|
|
10040
9887
|
}
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
9888
|
+
};
|
|
9889
|
+
};
|
|
9890
|
+
|
|
9891
|
+
class SignalExitFallback extends SignalExitBase {
|
|
9892
|
+
onExit() {
|
|
9893
|
+
return () => {};
|
|
10045
9894
|
}
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
9895
|
+
load() {}
|
|
9896
|
+
unload() {}
|
|
9897
|
+
}
|
|
9898
|
+
|
|
9899
|
+
class SignalExit extends SignalExitBase {
|
|
9900
|
+
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
9901
|
+
#emitter = new Emitter;
|
|
9902
|
+
#process;
|
|
9903
|
+
#originalProcessEmit;
|
|
9904
|
+
#originalProcessReallyExit;
|
|
9905
|
+
#sigListeners = {};
|
|
9906
|
+
#loaded = false;
|
|
9907
|
+
constructor(process3) {
|
|
9908
|
+
super();
|
|
9909
|
+
this.#process = process3;
|
|
9910
|
+
this.#sigListeners = {};
|
|
9911
|
+
for (const sig of signals) {
|
|
9912
|
+
this.#sigListeners[sig] = () => {
|
|
9913
|
+
const listeners = this.#process.listeners(sig);
|
|
9914
|
+
let { count } = this.#emitter;
|
|
9915
|
+
const p = process3;
|
|
9916
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
9917
|
+
count += p.__signal_exit_emitter__.count;
|
|
9918
|
+
}
|
|
9919
|
+
if (listeners.length === count) {
|
|
9920
|
+
this.unload();
|
|
9921
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
9922
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
9923
|
+
if (!ret)
|
|
9924
|
+
process3.kill(process3.pid, s);
|
|
9925
|
+
}
|
|
9926
|
+
};
|
|
10049
9927
|
}
|
|
10050
|
-
this.#
|
|
9928
|
+
this.#originalProcessReallyExit = process3.reallyExit;
|
|
9929
|
+
this.#originalProcessEmit = process3.emit;
|
|
10051
9930
|
}
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
|
10056
|
-
this.#lastSpinnerFrameTime = now;
|
|
10057
|
-
}
|
|
10058
|
-
const { frames } = this.#spinner;
|
|
10059
|
-
let frame = frames[this.#frameIndex];
|
|
10060
|
-
if (this.color) {
|
|
10061
|
-
frame = source_default[this.color](frame);
|
|
9931
|
+
onExit(cb, opts) {
|
|
9932
|
+
if (!processOk(this.#process)) {
|
|
9933
|
+
return () => {};
|
|
10062
9934
|
}
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
const fullSuffixText = typeof this.#suffixText === "string" && this.#suffixText !== "" ? " " + this.#suffixText : "";
|
|
10066
|
-
return fullPrefixText + frame + fullText + fullSuffixText;
|
|
10067
|
-
}
|
|
10068
|
-
clear() {
|
|
10069
|
-
if (!this.#isEnabled || !this.#stream.isTTY) {
|
|
10070
|
-
return this;
|
|
9935
|
+
if (this.#loaded === false) {
|
|
9936
|
+
this.load();
|
|
10071
9937
|
}
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
9938
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
9939
|
+
this.#emitter.on(ev, cb);
|
|
9940
|
+
return () => {
|
|
9941
|
+
this.#emitter.removeListener(ev, cb);
|
|
9942
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
9943
|
+
this.unload();
|
|
10076
9944
|
}
|
|
10077
|
-
|
|
10078
|
-
}
|
|
10079
|
-
if (this.#indent || this.lastIndent !== this.#indent) {
|
|
10080
|
-
this.#stream.cursorTo(this.#indent);
|
|
10081
|
-
}
|
|
10082
|
-
this.lastIndent = this.#indent;
|
|
10083
|
-
this.#linesToClear = 0;
|
|
10084
|
-
return this;
|
|
9945
|
+
};
|
|
10085
9946
|
}
|
|
10086
|
-
|
|
10087
|
-
if (this.#
|
|
10088
|
-
return
|
|
9947
|
+
load() {
|
|
9948
|
+
if (this.#loaded) {
|
|
9949
|
+
return;
|
|
10089
9950
|
}
|
|
10090
|
-
this
|
|
10091
|
-
this.#
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
9951
|
+
this.#loaded = true;
|
|
9952
|
+
this.#emitter.count += 1;
|
|
9953
|
+
for (const sig of signals) {
|
|
9954
|
+
try {
|
|
9955
|
+
const fn = this.#sigListeners[sig];
|
|
9956
|
+
if (fn)
|
|
9957
|
+
this.#process.on(sig, fn);
|
|
9958
|
+
} catch (_) {}
|
|
10098
9959
|
}
|
|
10099
|
-
|
|
10100
|
-
return this;
|
|
9960
|
+
this.#process.emit = (ev, ...a) => {
|
|
9961
|
+
return this.#processEmit(ev, ...a);
|
|
9962
|
+
};
|
|
9963
|
+
this.#process.reallyExit = (code) => {
|
|
9964
|
+
return this.#processReallyExit(code);
|
|
9965
|
+
};
|
|
9966
|
+
}
|
|
9967
|
+
unload() {
|
|
9968
|
+
if (!this.#loaded) {
|
|
9969
|
+
return;
|
|
10101
9970
|
}
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
9971
|
+
this.#loaded = false;
|
|
9972
|
+
signals.forEach((sig) => {
|
|
9973
|
+
const listener = this.#sigListeners[sig];
|
|
9974
|
+
if (!listener) {
|
|
9975
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
10106
9976
|
}
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
}
|
|
10115
|
-
if (this.#options.discardStdin && process9.stdin.isTTY) {
|
|
10116
|
-
this.#isDiscardingStdin = true;
|
|
10117
|
-
stdin_discarder_default.start();
|
|
10118
|
-
}
|
|
10119
|
-
this.render();
|
|
10120
|
-
this.#id = setInterval(this.render.bind(this), this.interval);
|
|
10121
|
-
return this;
|
|
9977
|
+
try {
|
|
9978
|
+
this.#process.removeListener(sig, listener);
|
|
9979
|
+
} catch (_) {}
|
|
9980
|
+
});
|
|
9981
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
9982
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
9983
|
+
this.#emitter.count -= 1;
|
|
10122
9984
|
}
|
|
10123
|
-
|
|
10124
|
-
if (!this.#
|
|
10125
|
-
return
|
|
10126
|
-
}
|
|
10127
|
-
clearInterval(this.#id);
|
|
10128
|
-
this.#id = undefined;
|
|
10129
|
-
this.#frameIndex = 0;
|
|
10130
|
-
this.clear();
|
|
10131
|
-
if (this.#options.hideCursor) {
|
|
10132
|
-
cli_cursor_default.show(this.#stream);
|
|
9985
|
+
#processReallyExit(code) {
|
|
9986
|
+
if (!processOk(this.#process)) {
|
|
9987
|
+
return 0;
|
|
10133
9988
|
}
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
9989
|
+
this.#process.exitCode = code || 0;
|
|
9990
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
9991
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
9992
|
+
}
|
|
9993
|
+
#processEmit(ev, ...args) {
|
|
9994
|
+
const og = this.#originalProcessEmit;
|
|
9995
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
9996
|
+
if (typeof args[0] === "number") {
|
|
9997
|
+
this.#process.exitCode = args[0];
|
|
9998
|
+
}
|
|
9999
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
10000
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
10001
|
+
return ret;
|
|
10002
|
+
} else {
|
|
10003
|
+
return og.call(this.#process, ev, ...args);
|
|
10137
10004
|
}
|
|
10138
|
-
return this;
|
|
10139
10005
|
}
|
|
10140
|
-
|
|
10141
|
-
|
|
10006
|
+
}
|
|
10007
|
+
var process3 = globalThis.process;
|
|
10008
|
+
var {
|
|
10009
|
+
onExit,
|
|
10010
|
+
load,
|
|
10011
|
+
unload
|
|
10012
|
+
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
10013
|
+
|
|
10014
|
+
// ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
10015
|
+
var terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : undefined;
|
|
10016
|
+
var restoreCursor = terminal ? onetime_default(() => {
|
|
10017
|
+
onExit(() => {
|
|
10018
|
+
terminal.write("\x1B[?25h");
|
|
10019
|
+
}, { alwaysLast: true });
|
|
10020
|
+
}) : () => {};
|
|
10021
|
+
var restore_cursor_default = restoreCursor;
|
|
10022
|
+
|
|
10023
|
+
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
10024
|
+
var isHidden = false;
|
|
10025
|
+
var cliCursor = {};
|
|
10026
|
+
cliCursor.show = (writableStream = process5.stderr) => {
|
|
10027
|
+
if (!writableStream.isTTY) {
|
|
10028
|
+
return;
|
|
10142
10029
|
}
|
|
10143
|
-
|
|
10144
|
-
|
|
10030
|
+
isHidden = false;
|
|
10031
|
+
writableStream.write("\x1B[?25h");
|
|
10032
|
+
};
|
|
10033
|
+
cliCursor.hide = (writableStream = process5.stderr) => {
|
|
10034
|
+
if (!writableStream.isTTY) {
|
|
10035
|
+
return;
|
|
10145
10036
|
}
|
|
10146
|
-
|
|
10147
|
-
|
|
10037
|
+
restore_cursor_default();
|
|
10038
|
+
isHidden = true;
|
|
10039
|
+
writableStream.write("\x1B[?25l");
|
|
10040
|
+
};
|
|
10041
|
+
cliCursor.toggle = (force, writableStream) => {
|
|
10042
|
+
if (force !== undefined) {
|
|
10043
|
+
isHidden = force;
|
|
10148
10044
|
}
|
|
10149
|
-
|
|
10150
|
-
|
|
10045
|
+
if (isHidden) {
|
|
10046
|
+
cliCursor.show(writableStream);
|
|
10047
|
+
} else {
|
|
10048
|
+
cliCursor.hide(writableStream);
|
|
10151
10049
|
}
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
10164
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
10165
|
-
`;
|
|
10166
|
-
this.stop();
|
|
10167
|
-
this.#stream.write(textToWrite);
|
|
10168
|
-
return this;
|
|
10050
|
+
};
|
|
10051
|
+
var cli_cursor_default = cliCursor;
|
|
10052
|
+
|
|
10053
|
+
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
10054
|
+
var import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
10055
|
+
|
|
10056
|
+
// ../../node_modules/.bun/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js
|
|
10057
|
+
import process6 from "process";
|
|
10058
|
+
function isUnicodeSupported() {
|
|
10059
|
+
if (process6.platform !== "win32") {
|
|
10060
|
+
return process6.env.TERM !== "linux";
|
|
10169
10061
|
}
|
|
10062
|
+
return Boolean(process6.env.CI) || Boolean(process6.env.WT_SESSION) || Boolean(process6.env.TERMINUS_SUBLIME) || process6.env.ConEmuTask === "{cmd::Cmder}" || process6.env.TERM_PROGRAM === "Terminus-Sublime" || process6.env.TERM_PROGRAM === "vscode" || process6.env.TERM === "xterm-256color" || process6.env.TERM === "alacritty" || process6.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
10170
10063
|
}
|
|
10171
|
-
|
|
10172
|
-
|
|
10064
|
+
|
|
10065
|
+
// ../../node_modules/.bun/log-symbols@6.0.0/node_modules/log-symbols/index.js
|
|
10066
|
+
var main = {
|
|
10067
|
+
info: source_default.blue("\u2139"),
|
|
10068
|
+
success: source_default.green("\u2714"),
|
|
10069
|
+
warning: source_default.yellow("\u26A0"),
|
|
10070
|
+
error: source_default.red("\u2716")
|
|
10071
|
+
};
|
|
10072
|
+
var fallback = {
|
|
10073
|
+
info: source_default.blue("i"),
|
|
10074
|
+
success: source_default.green("\u221A"),
|
|
10075
|
+
warning: source_default.yellow("\u203C"),
|
|
10076
|
+
error: source_default.red("\xD7")
|
|
10077
|
+
};
|
|
10078
|
+
var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
10079
|
+
var log_symbols_default = logSymbols;
|
|
10080
|
+
|
|
10081
|
+
// ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
10082
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
10083
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
10084
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
10085
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
10086
|
+
const pattern = `${osc}|${csi}`;
|
|
10087
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
10173
10088
|
}
|
|
10174
10089
|
|
|
10175
|
-
//
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
return spinner;
|
|
10090
|
+
// ../../node_modules/.bun/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
|
|
10091
|
+
var regex = ansiRegex();
|
|
10092
|
+
function stripAnsi(string) {
|
|
10093
|
+
if (typeof string !== "string") {
|
|
10094
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
10095
|
+
}
|
|
10096
|
+
return string.replace(regex, "");
|
|
10183
10097
|
}
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10098
|
+
|
|
10099
|
+
// ../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
|
|
10100
|
+
function isAmbiguous(x) {
|
|
10101
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
10102
|
+
}
|
|
10103
|
+
function isFullWidth(x) {
|
|
10104
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
10105
|
+
}
|
|
10106
|
+
function isWide(x) {
|
|
10107
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
10108
|
+
}
|
|
10109
|
+
|
|
10110
|
+
// ../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
|
|
10111
|
+
function validate(codePoint) {
|
|
10112
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
10113
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
10190
10114
|
}
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10115
|
+
}
|
|
10116
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
10117
|
+
validate(codePoint);
|
|
10118
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
10119
|
+
return 2;
|
|
10194
10120
|
}
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
}
|
|
10201
|
-
|
|
10121
|
+
return 1;
|
|
10122
|
+
}
|
|
10123
|
+
|
|
10124
|
+
// ../../node_modules/.bun/emoji-regex@10.6.0/node_modules/emoji-regex/index.mjs
|
|
10125
|
+
var emoji_regex_default = () => {
|
|
10126
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
10127
|
+
};
|
|
10128
|
+
|
|
10129
|
+
// ../../node_modules/.bun/string-width@7.2.0/node_modules/string-width/index.js
|
|
10130
|
+
var segmenter = new Intl.Segmenter;
|
|
10131
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
10132
|
+
function stringWidth(string, options2 = {}) {
|
|
10133
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
10134
|
+
return 0;
|
|
10202
10135
|
}
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10136
|
+
const {
|
|
10137
|
+
ambiguousIsNarrow = true,
|
|
10138
|
+
countAnsiEscapeCodes = false
|
|
10139
|
+
} = options2;
|
|
10140
|
+
if (!countAnsiEscapeCodes) {
|
|
10141
|
+
string = stripAnsi(string);
|
|
10142
|
+
}
|
|
10143
|
+
if (string.length === 0) {
|
|
10144
|
+
return 0;
|
|
10145
|
+
}
|
|
10146
|
+
let width = 0;
|
|
10147
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
10148
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
10149
|
+
const codePoint = character.codePointAt(0);
|
|
10150
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
10151
|
+
continue;
|
|
10207
10152
|
}
|
|
10208
|
-
|
|
10209
|
-
|
|
10153
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
10154
|
+
continue;
|
|
10155
|
+
}
|
|
10156
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
10157
|
+
continue;
|
|
10158
|
+
}
|
|
10159
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
10160
|
+
continue;
|
|
10161
|
+
}
|
|
10162
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
10163
|
+
continue;
|
|
10164
|
+
}
|
|
10165
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
10166
|
+
continue;
|
|
10167
|
+
}
|
|
10168
|
+
if (emoji_regex_default().test(character)) {
|
|
10169
|
+
width += 2;
|
|
10170
|
+
continue;
|
|
10171
|
+
}
|
|
10172
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
10173
|
+
}
|
|
10174
|
+
return width;
|
|
10175
|
+
}
|
|
10176
|
+
|
|
10177
|
+
// ../../node_modules/.bun/is-interactive@2.0.0/node_modules/is-interactive/index.js
|
|
10178
|
+
function isInteractive({ stream = process.stdout } = {}) {
|
|
10179
|
+
return Boolean(stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
|
|
10180
|
+
}
|
|
10181
|
+
|
|
10182
|
+
// ../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
10183
|
+
import process7 from "process";
|
|
10184
|
+
function isUnicodeSupported2() {
|
|
10185
|
+
const { env: env2 } = process7;
|
|
10186
|
+
const { TERM: TERM2, TERM_PROGRAM } = env2;
|
|
10187
|
+
if (process7.platform !== "win32") {
|
|
10188
|
+
return TERM2 !== "linux";
|
|
10210
10189
|
}
|
|
10211
|
-
|
|
10190
|
+
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM2 === "xterm-256color" || TERM2 === "alacritty" || TERM2 === "rxvt-unicode" || TERM2 === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
10212
10191
|
}
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
};
|
|
10226
|
-
}
|
|
10227
|
-
if (error instanceof ZodError) {
|
|
10228
|
-
return {
|
|
10229
|
-
success: false,
|
|
10230
|
-
error: {
|
|
10231
|
-
code: "VALIDATION_ERROR",
|
|
10232
|
-
message: error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")
|
|
10233
|
-
},
|
|
10234
|
-
exitCode: EXIT_CODES.CONFIG,
|
|
10235
|
-
meta: {
|
|
10236
|
-
timestamp: new Date().toISOString()
|
|
10237
|
-
}
|
|
10238
|
-
};
|
|
10192
|
+
|
|
10193
|
+
// ../../node_modules/.bun/stdin-discarder@0.2.2/node_modules/stdin-discarder/index.js
|
|
10194
|
+
import process8 from "process";
|
|
10195
|
+
var ASCII_ETX_CODE = 3;
|
|
10196
|
+
|
|
10197
|
+
class StdinDiscarder {
|
|
10198
|
+
#activeCount = 0;
|
|
10199
|
+
start() {
|
|
10200
|
+
this.#activeCount++;
|
|
10201
|
+
if (this.#activeCount === 1) {
|
|
10202
|
+
this.#realStart();
|
|
10203
|
+
}
|
|
10239
10204
|
}
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
code: "UNKNOWN_ERROR",
|
|
10244
|
-
message: error instanceof Error ? error.message : "An unknown error occurred"
|
|
10245
|
-
},
|
|
10246
|
-
exitCode: EXIT_CODES.GENERAL,
|
|
10247
|
-
meta: {
|
|
10248
|
-
timestamp: new Date().toISOString()
|
|
10205
|
+
stop() {
|
|
10206
|
+
if (this.#activeCount <= 0) {
|
|
10207
|
+
throw new Error("`stop` called more times than `start`");
|
|
10249
10208
|
}
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
function outputJson(data) {
|
|
10254
|
-
console.log(JSON.stringify(data, null, 2));
|
|
10255
|
-
}
|
|
10256
|
-
// src/commands/init.ts
|
|
10257
|
-
function registerInitCommand(program2) {
|
|
10258
|
-
program2.command("init").description("Initialize OCX configuration in your project").option("-y, --yes", "Skip prompts and use defaults").option("--cwd <path>", "Working directory", process.cwd()).option("-q, --quiet", "Suppress output").option("-v, --verbose", "Verbose output").option("--json", "Output as JSON").action(async (options2) => {
|
|
10259
|
-
try {
|
|
10260
|
-
await runInit(options2);
|
|
10261
|
-
} catch (error) {
|
|
10262
|
-
handleError(error, { json: options2.json });
|
|
10209
|
+
this.#activeCount--;
|
|
10210
|
+
if (this.#activeCount === 0) {
|
|
10211
|
+
this.#realStop();
|
|
10263
10212
|
}
|
|
10264
|
-
}
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
const cwd = options2.cwd ?? process.cwd();
|
|
10268
|
-
const configPath = join(cwd, "ocx.jsonc");
|
|
10269
|
-
if (existsSync(configPath)) {
|
|
10270
|
-
if (!options2.yes) {
|
|
10271
|
-
logger.warn("ocx.jsonc already exists");
|
|
10272
|
-
logger.info("Use --yes to overwrite");
|
|
10213
|
+
}
|
|
10214
|
+
#realStart() {
|
|
10215
|
+
if (process8.platform === "win32" || !process8.stdin.isTTY) {
|
|
10273
10216
|
return;
|
|
10274
10217
|
}
|
|
10275
|
-
|
|
10218
|
+
process8.stdin.setRawMode(true);
|
|
10219
|
+
process8.stdin.on("data", this.#handleInput);
|
|
10220
|
+
process8.stdin.resume();
|
|
10276
10221
|
}
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
const rawConfig = {
|
|
10281
|
-
$schema: OCX_SCHEMA_URL,
|
|
10282
|
-
registries: {}
|
|
10283
|
-
};
|
|
10284
|
-
const config = ocxConfigSchema.parse(rawConfig);
|
|
10285
|
-
const content = JSON.stringify(config, null, 2);
|
|
10286
|
-
await writeFile(configPath, content, "utf-8");
|
|
10287
|
-
if (!options2.quiet && !options2.json) {
|
|
10288
|
-
logger.success("Initialized OCX configuration");
|
|
10222
|
+
#realStop() {
|
|
10223
|
+
if (!process8.stdin.isTTY) {
|
|
10224
|
+
return;
|
|
10289
10225
|
}
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
logger.info(" 1. Add a registry: ocx registry add <url>");
|
|
10298
|
-
logger.info(" 2. Install components: ocx add <component>");
|
|
10226
|
+
process8.stdin.off("data", this.#handleInput);
|
|
10227
|
+
process8.stdin.pause();
|
|
10228
|
+
process8.stdin.setRawMode(false);
|
|
10229
|
+
}
|
|
10230
|
+
#handleInput(chunk) {
|
|
10231
|
+
if (chunk[0] === ASCII_ETX_CODE) {
|
|
10232
|
+
process8.emit("SIGINT");
|
|
10299
10233
|
}
|
|
10300
|
-
} catch (error) {
|
|
10301
|
-
spin?.fail("Failed to initialize");
|
|
10302
|
-
throw error;
|
|
10303
10234
|
}
|
|
10304
10235
|
}
|
|
10236
|
+
var stdinDiscarder = new StdinDiscarder;
|
|
10237
|
+
var stdin_discarder_default = stdinDiscarder;
|
|
10305
10238
|
|
|
10306
|
-
//
|
|
10307
|
-
|
|
10308
|
-
import { mkdir, readFile, writeFile as writeFile2 } from "fs/promises";
|
|
10309
|
-
import { dirname, join as join2 } from "path";
|
|
10310
|
-
import { createHash } from "crypto";
|
|
10239
|
+
// ../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js
|
|
10240
|
+
var import_cli_spinners2 = __toESM(require_cli_spinners(), 1);
|
|
10311
10241
|
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10242
|
+
class Ora {
|
|
10243
|
+
#linesToClear = 0;
|
|
10244
|
+
#isDiscardingStdin = false;
|
|
10245
|
+
#lineCount = 0;
|
|
10246
|
+
#frameIndex = -1;
|
|
10247
|
+
#lastSpinnerFrameTime = 0;
|
|
10248
|
+
#options;
|
|
10249
|
+
#spinner;
|
|
10250
|
+
#stream;
|
|
10251
|
+
#id;
|
|
10252
|
+
#initialInterval;
|
|
10253
|
+
#isEnabled;
|
|
10254
|
+
#isSilent;
|
|
10255
|
+
#indent;
|
|
10256
|
+
#text;
|
|
10257
|
+
#prefixText;
|
|
10258
|
+
#suffixText;
|
|
10259
|
+
color;
|
|
10260
|
+
constructor(options2) {
|
|
10261
|
+
if (typeof options2 === "string") {
|
|
10262
|
+
options2 = {
|
|
10263
|
+
text: options2
|
|
10264
|
+
};
|
|
10265
|
+
}
|
|
10266
|
+
this.#options = {
|
|
10267
|
+
color: "cyan",
|
|
10268
|
+
stream: process9.stderr,
|
|
10269
|
+
discardStdin: true,
|
|
10270
|
+
hideCursor: true,
|
|
10271
|
+
...options2
|
|
10272
|
+
};
|
|
10273
|
+
this.color = this.#options.color;
|
|
10274
|
+
this.spinner = this.#options.spinner;
|
|
10275
|
+
this.#initialInterval = this.#options.interval;
|
|
10276
|
+
this.#stream = this.#options.stream;
|
|
10277
|
+
this.#isEnabled = typeof this.#options.isEnabled === "boolean" ? this.#options.isEnabled : isInteractive({ stream: this.#stream });
|
|
10278
|
+
this.#isSilent = typeof this.#options.isSilent === "boolean" ? this.#options.isSilent : false;
|
|
10279
|
+
this.text = this.#options.text;
|
|
10280
|
+
this.prefixText = this.#options.prefixText;
|
|
10281
|
+
this.suffixText = this.#options.suffixText;
|
|
10282
|
+
this.indent = this.#options.indent;
|
|
10283
|
+
if (process9.env.NODE_ENV === "test") {
|
|
10284
|
+
this._stream = this.#stream;
|
|
10285
|
+
this._isEnabled = this.#isEnabled;
|
|
10286
|
+
Object.defineProperty(this, "_linesToClear", {
|
|
10287
|
+
get() {
|
|
10288
|
+
return this.#linesToClear;
|
|
10289
|
+
},
|
|
10290
|
+
set(newValue) {
|
|
10291
|
+
this.#linesToClear = newValue;
|
|
10292
|
+
}
|
|
10293
|
+
});
|
|
10294
|
+
Object.defineProperty(this, "_frameIndex", {
|
|
10295
|
+
get() {
|
|
10296
|
+
return this.#frameIndex;
|
|
10297
|
+
}
|
|
10298
|
+
});
|
|
10299
|
+
Object.defineProperty(this, "_lineCount", {
|
|
10300
|
+
get() {
|
|
10301
|
+
return this.#lineCount;
|
|
10302
|
+
}
|
|
10303
|
+
});
|
|
10304
|
+
}
|
|
10318
10305
|
}
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10306
|
+
get indent() {
|
|
10307
|
+
return this.#indent;
|
|
10308
|
+
}
|
|
10309
|
+
set indent(indent = 0) {
|
|
10310
|
+
if (!(indent >= 0 && Number.isInteger(indent))) {
|
|
10311
|
+
throw new Error("The `indent` option must be an integer from 0 and up");
|
|
10312
|
+
}
|
|
10313
|
+
this.#indent = indent;
|
|
10314
|
+
this.#updateLineCount();
|
|
10315
|
+
}
|
|
10316
|
+
get interval() {
|
|
10317
|
+
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
|
10318
|
+
}
|
|
10319
|
+
get spinner() {
|
|
10320
|
+
return this.#spinner;
|
|
10321
|
+
}
|
|
10322
|
+
set spinner(spinner) {
|
|
10323
|
+
this.#frameIndex = -1;
|
|
10324
|
+
this.#initialInterval = undefined;
|
|
10325
|
+
if (typeof spinner === "object") {
|
|
10326
|
+
if (spinner.frames === undefined) {
|
|
10327
|
+
throw new Error("The given spinner must have a `frames` property");
|
|
10324
10328
|
}
|
|
10325
|
-
|
|
10329
|
+
this.#spinner = spinner;
|
|
10330
|
+
} else if (!isUnicodeSupported2()) {
|
|
10331
|
+
this.#spinner = import_cli_spinners.default.line;
|
|
10332
|
+
} else if (spinner === undefined) {
|
|
10333
|
+
this.#spinner = import_cli_spinners.default.dots;
|
|
10334
|
+
} else if (spinner !== "default" && import_cli_spinners.default[spinner]) {
|
|
10335
|
+
this.#spinner = import_cli_spinners.default[spinner];
|
|
10336
|
+
} else {
|
|
10337
|
+
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
|
|
10338
|
+
}
|
|
10339
|
+
}
|
|
10340
|
+
get text() {
|
|
10341
|
+
return this.#text;
|
|
10342
|
+
}
|
|
10343
|
+
set text(value = "") {
|
|
10344
|
+
this.#text = value;
|
|
10345
|
+
this.#updateLineCount();
|
|
10346
|
+
}
|
|
10347
|
+
get prefixText() {
|
|
10348
|
+
return this.#prefixText;
|
|
10349
|
+
}
|
|
10350
|
+
set prefixText(value = "") {
|
|
10351
|
+
this.#prefixText = value;
|
|
10352
|
+
this.#updateLineCount();
|
|
10353
|
+
}
|
|
10354
|
+
get suffixText() {
|
|
10355
|
+
return this.#suffixText;
|
|
10356
|
+
}
|
|
10357
|
+
set suffixText(value = "") {
|
|
10358
|
+
this.#suffixText = value;
|
|
10359
|
+
this.#updateLineCount();
|
|
10360
|
+
}
|
|
10361
|
+
get isSpinning() {
|
|
10362
|
+
return this.#id !== undefined;
|
|
10363
|
+
}
|
|
10364
|
+
#getFullPrefixText(prefixText = this.#prefixText, postfix = " ") {
|
|
10365
|
+
if (typeof prefixText === "string" && prefixText !== "") {
|
|
10366
|
+
return prefixText + postfix;
|
|
10326
10367
|
}
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
})();
|
|
10330
|
-
cache.set(url, promise);
|
|
10331
|
-
promise.catch(() => cache.delete(url));
|
|
10332
|
-
return promise;
|
|
10333
|
-
}
|
|
10334
|
-
async function fetchRegistryIndex(baseUrl) {
|
|
10335
|
-
const url = `${baseUrl.replace(/\/$/, "")}/index.json`;
|
|
10336
|
-
return fetchWithCache(url, (data) => {
|
|
10337
|
-
const result = registryIndexSchema.safeParse(data);
|
|
10338
|
-
if (!result.success) {
|
|
10339
|
-
throw new ValidationError(`Invalid registry format at ${url}: ${result.error.message}`);
|
|
10368
|
+
if (typeof prefixText === "function") {
|
|
10369
|
+
return prefixText() + postfix;
|
|
10340
10370
|
}
|
|
10341
|
-
return
|
|
10342
|
-
}
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
return fetchWithCache(url, (data) => {
|
|
10347
|
-
const packumentResult = packumentSchema.safeParse(data);
|
|
10348
|
-
if (!packumentResult.success) {
|
|
10349
|
-
throw new ValidationError(`Invalid packument format for "${name}": ${packumentResult.error.message}`);
|
|
10371
|
+
return "";
|
|
10372
|
+
}
|
|
10373
|
+
#getFullSuffixText(suffixText = this.#suffixText, prefix = " ") {
|
|
10374
|
+
if (typeof suffixText === "string" && suffixText !== "") {
|
|
10375
|
+
return prefix + suffixText;
|
|
10350
10376
|
}
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
const manifest = packument.versions[latestVersion];
|
|
10354
|
-
if (!manifest) {
|
|
10355
|
-
throw new ValidationError(`Component "${name}" has no manifest for latest version ${latestVersion}`);
|
|
10377
|
+
if (typeof suffixText === "function") {
|
|
10378
|
+
return prefix + suffixText();
|
|
10356
10379
|
}
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10380
|
+
return "";
|
|
10381
|
+
}
|
|
10382
|
+
#updateLineCount() {
|
|
10383
|
+
const columns = this.#stream.columns ?? 80;
|
|
10384
|
+
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, "-");
|
|
10385
|
+
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
10386
|
+
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
10387
|
+
this.#lineCount = 0;
|
|
10388
|
+
for (const line of stripAnsi(fullText).split(`
|
|
10389
|
+
`)) {
|
|
10390
|
+
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, { countAnsiEscapeCodes: true }) / columns));
|
|
10360
10391
|
}
|
|
10361
|
-
return manifestResult.data;
|
|
10362
|
-
});
|
|
10363
|
-
}
|
|
10364
|
-
async function fetchFileContent(baseUrl, componentName, filePath) {
|
|
10365
|
-
const url = `${baseUrl.replace(/\/$/, "")}/components/${componentName}/${filePath}`;
|
|
10366
|
-
const response = await fetch(url);
|
|
10367
|
-
if (!response.ok) {
|
|
10368
|
-
throw new NetworkError(`Failed to fetch file ${filePath} for ${componentName}: ${response.status} ${response.statusText}`);
|
|
10369
10392
|
}
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
const visiting = new Set;
|
|
10377
|
-
const mcpServers = {};
|
|
10378
|
-
async function resolve(name, path = []) {
|
|
10379
|
-
if (resolved.has(name)) {
|
|
10380
|
-
return;
|
|
10393
|
+
get isEnabled() {
|
|
10394
|
+
return this.#isEnabled && !this.#isSilent;
|
|
10395
|
+
}
|
|
10396
|
+
set isEnabled(value) {
|
|
10397
|
+
if (typeof value !== "boolean") {
|
|
10398
|
+
throw new TypeError("The `isEnabled` option must be a boolean");
|
|
10381
10399
|
}
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10400
|
+
this.#isEnabled = value;
|
|
10401
|
+
}
|
|
10402
|
+
get isSilent() {
|
|
10403
|
+
return this.#isSilent;
|
|
10404
|
+
}
|
|
10405
|
+
set isSilent(value) {
|
|
10406
|
+
if (typeof value !== "boolean") {
|
|
10407
|
+
throw new TypeError("The `isSilent` option must be a boolean");
|
|
10385
10408
|
}
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
const
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
component = manifest;
|
|
10394
|
-
foundRegistry = { name: regName, url: regConfig.url };
|
|
10395
|
-
break;
|
|
10396
|
-
} catch (_err) {
|
|
10397
|
-
continue;
|
|
10398
|
-
}
|
|
10409
|
+
this.#isSilent = value;
|
|
10410
|
+
}
|
|
10411
|
+
frame() {
|
|
10412
|
+
const now = Date.now();
|
|
10413
|
+
if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
|
|
10414
|
+
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
|
10415
|
+
this.#lastSpinnerFrameTime = now;
|
|
10399
10416
|
}
|
|
10400
|
-
|
|
10401
|
-
|
|
10417
|
+
const { frames } = this.#spinner;
|
|
10418
|
+
let frame = frames[this.#frameIndex];
|
|
10419
|
+
if (this.color) {
|
|
10420
|
+
frame = source_default[this.color](frame);
|
|
10402
10421
|
}
|
|
10403
|
-
|
|
10404
|
-
|
|
10422
|
+
const fullPrefixText = typeof this.#prefixText === "string" && this.#prefixText !== "" ? this.#prefixText + " " : "";
|
|
10423
|
+
const fullText = typeof this.text === "string" ? " " + this.text : "";
|
|
10424
|
+
const fullSuffixText = typeof this.#suffixText === "string" && this.#suffixText !== "" ? " " + this.#suffixText : "";
|
|
10425
|
+
return fullPrefixText + frame + fullText + fullSuffixText;
|
|
10426
|
+
}
|
|
10427
|
+
clear() {
|
|
10428
|
+
if (!this.#isEnabled || !this.#stream.isTTY) {
|
|
10429
|
+
return this;
|
|
10405
10430
|
}
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
});
|
|
10411
|
-
visiting.delete(name);
|
|
10412
|
-
if (component.mcpServers) {
|
|
10413
|
-
for (const [serverName, config] of Object.entries(component.mcpServers)) {
|
|
10414
|
-
mcpServers[serverName] = config;
|
|
10431
|
+
this.#stream.cursorTo(0);
|
|
10432
|
+
for (let index = 0;index < this.#linesToClear; index++) {
|
|
10433
|
+
if (index > 0) {
|
|
10434
|
+
this.#stream.moveCursor(0, -1);
|
|
10415
10435
|
}
|
|
10436
|
+
this.#stream.clearLine(1);
|
|
10416
10437
|
}
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
await resolve(name);
|
|
10420
|
-
}
|
|
10421
|
-
const components = Array.from(resolved.values());
|
|
10422
|
-
const installOrder = Array.from(resolved.keys());
|
|
10423
|
-
return {
|
|
10424
|
-
components,
|
|
10425
|
-
installOrder,
|
|
10426
|
-
mcpServers
|
|
10427
|
-
};
|
|
10428
|
-
}
|
|
10429
|
-
|
|
10430
|
-
// src/registry/opencode-config.ts
|
|
10431
|
-
async function readOpencodeConfig(cwd) {
|
|
10432
|
-
const jsonPath = `${cwd}/opencode.json`;
|
|
10433
|
-
const jsoncPath = `${cwd}/opencode.jsonc`;
|
|
10434
|
-
for (const configPath of [jsoncPath, jsonPath]) {
|
|
10435
|
-
const file = Bun.file(configPath);
|
|
10436
|
-
if (await file.exists()) {
|
|
10437
|
-
const content = await file.text();
|
|
10438
|
-
const stripped = configPath.endsWith(".jsonc") ? stripJsonComments2(content) : content;
|
|
10439
|
-
return {
|
|
10440
|
-
config: JSON.parse(stripped),
|
|
10441
|
-
path: configPath
|
|
10442
|
-
};
|
|
10438
|
+
if (this.#indent || this.lastIndent !== this.#indent) {
|
|
10439
|
+
this.#stream.cursorTo(this.#indent);
|
|
10443
10440
|
}
|
|
10441
|
+
this.lastIndent = this.#indent;
|
|
10442
|
+
this.#linesToClear = 0;
|
|
10443
|
+
return this;
|
|
10444
10444
|
}
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
const skipped = [];
|
|
10454
|
-
if (!config.mcp) {
|
|
10455
|
-
config.mcp = {};
|
|
10445
|
+
render() {
|
|
10446
|
+
if (this.#isSilent) {
|
|
10447
|
+
return this;
|
|
10448
|
+
}
|
|
10449
|
+
this.clear();
|
|
10450
|
+
this.#stream.write(this.frame());
|
|
10451
|
+
this.#linesToClear = this.#lineCount;
|
|
10452
|
+
return this;
|
|
10456
10453
|
}
|
|
10457
|
-
|
|
10458
|
-
if (
|
|
10459
|
-
|
|
10460
|
-
}
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
if (
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
if (server.type === "local" && server.command) {
|
|
10469
|
-
serverConfig.command = server.command;
|
|
10470
|
-
}
|
|
10471
|
-
if (server.headers) {
|
|
10472
|
-
serverConfig.headers = server.headers;
|
|
10454
|
+
start(text) {
|
|
10455
|
+
if (text) {
|
|
10456
|
+
this.text = text;
|
|
10457
|
+
}
|
|
10458
|
+
if (this.#isSilent) {
|
|
10459
|
+
return this;
|
|
10460
|
+
}
|
|
10461
|
+
if (!this.#isEnabled) {
|
|
10462
|
+
if (this.text) {
|
|
10463
|
+
this.#stream.write(`- ${this.text}
|
|
10464
|
+
`);
|
|
10473
10465
|
}
|
|
10474
|
-
|
|
10475
|
-
|
|
10466
|
+
return this;
|
|
10467
|
+
}
|
|
10468
|
+
if (this.isSpinning) {
|
|
10469
|
+
return this;
|
|
10470
|
+
}
|
|
10471
|
+
if (this.#options.hideCursor) {
|
|
10472
|
+
cli_cursor_default.hide(this.#stream);
|
|
10476
10473
|
}
|
|
10474
|
+
if (this.#options.discardStdin && process9.stdin.isTTY) {
|
|
10475
|
+
this.#isDiscardingStdin = true;
|
|
10476
|
+
stdin_discarder_default.start();
|
|
10477
|
+
}
|
|
10478
|
+
this.render();
|
|
10479
|
+
this.#id = setInterval(this.render.bind(this), this.interval);
|
|
10480
|
+
return this;
|
|
10477
10481
|
}
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
config = {
|
|
10495
|
-
$schema: "https://opencode.ai/config.json"
|
|
10496
|
-
};
|
|
10497
|
-
configPath = `${cwd}/opencode.json`;
|
|
10498
|
-
created = true;
|
|
10482
|
+
stop() {
|
|
10483
|
+
if (!this.#isEnabled) {
|
|
10484
|
+
return this;
|
|
10485
|
+
}
|
|
10486
|
+
clearInterval(this.#id);
|
|
10487
|
+
this.#id = undefined;
|
|
10488
|
+
this.#frameIndex = 0;
|
|
10489
|
+
this.clear();
|
|
10490
|
+
if (this.#options.hideCursor) {
|
|
10491
|
+
cli_cursor_default.show(this.#stream);
|
|
10492
|
+
}
|
|
10493
|
+
if (this.#options.discardStdin && process9.stdin.isTTY && this.#isDiscardingStdin) {
|
|
10494
|
+
stdin_discarder_default.stop();
|
|
10495
|
+
this.#isDiscardingStdin = false;
|
|
10496
|
+
}
|
|
10497
|
+
return this;
|
|
10499
10498
|
}
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
mcpAdded = result.added;
|
|
10506
|
-
mcpSkipped = result.skipped;
|
|
10499
|
+
succeed(text) {
|
|
10500
|
+
return this.stopAndPersist({ symbol: log_symbols_default.success, text });
|
|
10501
|
+
}
|
|
10502
|
+
fail(text) {
|
|
10503
|
+
return this.stopAndPersist({ symbol: log_symbols_default.error, text });
|
|
10507
10504
|
}
|
|
10508
|
-
|
|
10509
|
-
|
|
10505
|
+
warn(text) {
|
|
10506
|
+
return this.stopAndPersist({ symbol: log_symbols_default.warning, text });
|
|
10507
|
+
}
|
|
10508
|
+
info(text) {
|
|
10509
|
+
return this.stopAndPersist({ symbol: log_symbols_default.info, text });
|
|
10510
|
+
}
|
|
10511
|
+
stopAndPersist(options2 = {}) {
|
|
10512
|
+
if (this.#isSilent) {
|
|
10513
|
+
return this;
|
|
10514
|
+
}
|
|
10515
|
+
const prefixText = options2.prefixText ?? this.#prefixText;
|
|
10516
|
+
const fullPrefixText = this.#getFullPrefixText(prefixText, " ");
|
|
10517
|
+
const symbolText = options2.symbol ?? " ";
|
|
10518
|
+
const text = options2.text ?? this.text;
|
|
10519
|
+
const separatorText = symbolText ? " " : "";
|
|
10520
|
+
const fullText = typeof text === "string" ? separatorText + text : "";
|
|
10521
|
+
const suffixText = options2.suffixText ?? this.#suffixText;
|
|
10522
|
+
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
10523
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
10524
|
+
`;
|
|
10525
|
+
this.stop();
|
|
10526
|
+
this.#stream.write(textToWrite);
|
|
10527
|
+
return this;
|
|
10510
10528
|
}
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
created,
|
|
10515
|
-
mcpAdded,
|
|
10516
|
-
mcpSkipped
|
|
10517
|
-
};
|
|
10529
|
+
}
|
|
10530
|
+
function ora(options2) {
|
|
10531
|
+
return new Ora(options2);
|
|
10518
10532
|
}
|
|
10519
10533
|
|
|
10534
|
+
// src/utils/spinner.ts
|
|
10535
|
+
function createSpinner(options2) {
|
|
10536
|
+
const shouldSpin = isTTY && !options2.quiet;
|
|
10537
|
+
const spinner = ora({
|
|
10538
|
+
text: options2.text,
|
|
10539
|
+
isSilent: !shouldSpin
|
|
10540
|
+
});
|
|
10541
|
+
return spinner;
|
|
10542
|
+
}
|
|
10520
10543
|
// src/commands/add.ts
|
|
10521
10544
|
function registerAddCommand(program2) {
|
|
10522
10545
|
program2.command("add").description("Add components to your project").argument("<components...>", "Components to install").option("-y, --yes", "Skip prompts").option("--dry-run", "Show what would be installed without making changes").option("--cwd <path>", "Working directory", process.cwd()).option("-q, --quiet", "Suppress output").option("-v, --verbose", "Verbose output").option("--json", "Output as JSON").action(async (components, options2) => {
|
|
@@ -10529,15 +10552,15 @@ function registerAddCommand(program2) {
|
|
|
10529
10552
|
}
|
|
10530
10553
|
async function runAdd(componentNames, options2) {
|
|
10531
10554
|
const cwd = options2.cwd ?? process.cwd();
|
|
10532
|
-
const configPath =
|
|
10533
|
-
const lockPath =
|
|
10534
|
-
if (!
|
|
10555
|
+
const configPath = join(cwd, "ocx.jsonc");
|
|
10556
|
+
const lockPath = join(cwd, "ocx.lock");
|
|
10557
|
+
if (!existsSync(configPath)) {
|
|
10535
10558
|
throw new ConfigError("No ocx.jsonc found. Run 'ocx init' first.");
|
|
10536
10559
|
}
|
|
10537
10560
|
const configContent = await readFile(configPath, "utf-8");
|
|
10538
10561
|
const config = ocxConfigSchema.parse(JSON.parse(configContent));
|
|
10539
10562
|
let lock = { lockVersion: 1, installed: {} };
|
|
10540
|
-
if (
|
|
10563
|
+
if (existsSync(lockPath)) {
|
|
10541
10564
|
const lockContent = await readFile(lockPath, "utf-8");
|
|
10542
10565
|
lock = ocxLockSchema.parse(JSON.parse(lockContent));
|
|
10543
10566
|
}
|
|
@@ -10595,7 +10618,7 @@ async function runAdd(componentNames, options2) {
|
|
|
10595
10618
|
logger.info(`Configured ${result.mcpAdded.length} MCP servers`);
|
|
10596
10619
|
}
|
|
10597
10620
|
}
|
|
10598
|
-
await
|
|
10621
|
+
await writeFile(lockPath, JSON.stringify(lock, null, 2), "utf-8");
|
|
10599
10622
|
if (options2.json) {
|
|
10600
10623
|
console.log(JSON.stringify({
|
|
10601
10624
|
success: true,
|
|
@@ -10616,12 +10639,12 @@ async function installComponent(component, files, cwd) {
|
|
|
10616
10639
|
const componentFile = component.files.find((f) => f.path === file.path);
|
|
10617
10640
|
if (!componentFile)
|
|
10618
10641
|
continue;
|
|
10619
|
-
const targetPath =
|
|
10642
|
+
const targetPath = join(cwd, componentFile.target);
|
|
10620
10643
|
const targetDir = dirname(targetPath);
|
|
10621
|
-
if (!
|
|
10644
|
+
if (!existsSync(targetDir)) {
|
|
10622
10645
|
await mkdir(targetDir, { recursive: true });
|
|
10623
10646
|
}
|
|
10624
|
-
await
|
|
10647
|
+
await writeFile(targetPath, file.content);
|
|
10625
10648
|
}
|
|
10626
10649
|
}
|
|
10627
10650
|
function getTargetPath(component) {
|
|
@@ -10655,6 +10678,112 @@ function logResolved(resolved) {
|
|
|
10655
10678
|
}
|
|
10656
10679
|
}
|
|
10657
10680
|
|
|
10681
|
+
// src/commands/build.ts
|
|
10682
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
10683
|
+
import { dirname as dirname2, join as join2, relative } from "path";
|
|
10684
|
+
function registerBuildCommand(program2) {
|
|
10685
|
+
program2.command("build").description("Build a registry from source (for registry authors)").argument("[path]", "Registry source directory", ".").option("--out <dir>", "Output directory", "./dist").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).action(async (path, options2) => {
|
|
10686
|
+
try {
|
|
10687
|
+
const sourcePath = join2(options2.cwd, path);
|
|
10688
|
+
const outPath = join2(options2.cwd, options2.out);
|
|
10689
|
+
const spinner2 = createSpinner({
|
|
10690
|
+
text: "Building registry...",
|
|
10691
|
+
quiet: options2.quiet || options2.json
|
|
10692
|
+
});
|
|
10693
|
+
if (!options2.json)
|
|
10694
|
+
spinner2.start();
|
|
10695
|
+
const registryFile = Bun.file(join2(sourcePath, "registry.json"));
|
|
10696
|
+
if (!await registryFile.exists()) {
|
|
10697
|
+
if (!options2.json)
|
|
10698
|
+
spinner2.fail("No registry.json found in source directory");
|
|
10699
|
+
process.exit(1);
|
|
10700
|
+
}
|
|
10701
|
+
const registryData = await registryFile.json();
|
|
10702
|
+
const parseResult = registrySchema.safeParse(registryData);
|
|
10703
|
+
if (!parseResult.success) {
|
|
10704
|
+
if (!options2.json) {
|
|
10705
|
+
spinner2.fail("Registry validation failed");
|
|
10706
|
+
const errors3 = parseResult.error.errors.map((e) => ` ${e.path.join(".")}: ${e.message}`);
|
|
10707
|
+
for (const err of errors3) {
|
|
10708
|
+
console.log(kleur_default.red(err));
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
process.exit(1);
|
|
10712
|
+
}
|
|
10713
|
+
const registry = parseResult.data;
|
|
10714
|
+
const validationErrors = [];
|
|
10715
|
+
const componentsDir = join2(outPath, "components");
|
|
10716
|
+
await mkdir2(componentsDir, { recursive: true });
|
|
10717
|
+
for (const component of registry.components) {
|
|
10718
|
+
const packument = {
|
|
10719
|
+
name: component.name,
|
|
10720
|
+
versions: {
|
|
10721
|
+
[registry.version]: component
|
|
10722
|
+
},
|
|
10723
|
+
"dist-tags": {
|
|
10724
|
+
latest: registry.version
|
|
10725
|
+
}
|
|
10726
|
+
};
|
|
10727
|
+
const packumentPath = join2(componentsDir, `${component.name}.json`);
|
|
10728
|
+
await Bun.write(packumentPath, JSON.stringify(packument, null, 2));
|
|
10729
|
+
for (const file of component.files) {
|
|
10730
|
+
const sourceFilePath = join2(sourcePath, "files", file.path);
|
|
10731
|
+
const destFilePath = join2(componentsDir, component.name, file.path);
|
|
10732
|
+
const destFileDir = dirname2(destFilePath);
|
|
10733
|
+
if (!await Bun.file(sourceFilePath).exists()) {
|
|
10734
|
+
validationErrors.push(`${component.name}: Source file not found at ${sourceFilePath}`);
|
|
10735
|
+
continue;
|
|
10736
|
+
}
|
|
10737
|
+
await mkdir2(destFileDir, { recursive: true });
|
|
10738
|
+
const sourceFile = Bun.file(sourceFilePath);
|
|
10739
|
+
await Bun.write(destFilePath, sourceFile);
|
|
10740
|
+
}
|
|
10741
|
+
}
|
|
10742
|
+
if (validationErrors.length > 0) {
|
|
10743
|
+
if (!options2.json) {
|
|
10744
|
+
spinner2.fail(`Build failed with ${validationErrors.length} errors`);
|
|
10745
|
+
for (const err of validationErrors) {
|
|
10746
|
+
console.log(kleur_default.red(` ${err}`));
|
|
10747
|
+
}
|
|
10748
|
+
}
|
|
10749
|
+
process.exit(1);
|
|
10750
|
+
}
|
|
10751
|
+
const index = {
|
|
10752
|
+
name: registry.name,
|
|
10753
|
+
prefix: registry.prefix,
|
|
10754
|
+
version: registry.version,
|
|
10755
|
+
author: registry.author,
|
|
10756
|
+
components: registry.components.map((c) => ({
|
|
10757
|
+
name: c.name,
|
|
10758
|
+
type: c.type,
|
|
10759
|
+
description: c.description
|
|
10760
|
+
}))
|
|
10761
|
+
};
|
|
10762
|
+
await Bun.write(join2(outPath, "index.json"), JSON.stringify(index, null, 2));
|
|
10763
|
+
if (!options2.json) {
|
|
10764
|
+
const msg = `Built ${registry.components.length} components to ${relative(options2.cwd, outPath)}`;
|
|
10765
|
+
spinner2.succeed(msg);
|
|
10766
|
+
if (!process.stdout.isTTY) {
|
|
10767
|
+
logger.success(`Built ${registry.components.length} components`);
|
|
10768
|
+
}
|
|
10769
|
+
}
|
|
10770
|
+
if (options2.json) {
|
|
10771
|
+
outputJson({
|
|
10772
|
+
success: true,
|
|
10773
|
+
data: {
|
|
10774
|
+
name: registry.name,
|
|
10775
|
+
version: registry.version,
|
|
10776
|
+
components: registry.components.length,
|
|
10777
|
+
output: outPath
|
|
10778
|
+
}
|
|
10779
|
+
});
|
|
10780
|
+
}
|
|
10781
|
+
} catch (error) {
|
|
10782
|
+
handleError(error, { json: options2.json });
|
|
10783
|
+
}
|
|
10784
|
+
});
|
|
10785
|
+
}
|
|
10786
|
+
|
|
10658
10787
|
// ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/base.js
|
|
10659
10788
|
class Diff {
|
|
10660
10789
|
diff(oldStr, newStr, options2 = {}) {
|
|
@@ -11506,131 +11635,29 @@ function registerDiffCommand(program2) {
|
|
|
11506
11635
|
const upstreamFile = upstream.files[0];
|
|
11507
11636
|
if (!upstreamFile) {
|
|
11508
11637
|
results.push({ name, hasChanges: false });
|
|
11509
|
-
continue;
|
|
11510
|
-
}
|
|
11511
|
-
const upstreamContent = await fetchFileContent(registryConfig.url, name, upstreamFile.path);
|
|
11512
|
-
if (localContent === upstreamContent) {
|
|
11513
|
-
results.push({ name, hasChanges: false });
|
|
11514
|
-
} else {
|
|
11515
|
-
const patch = createPatch(name, upstreamContent, localContent);
|
|
11516
|
-
results.push({ name, hasChanges: true, diff: patch });
|
|
11517
|
-
}
|
|
11518
|
-
} catch (err) {
|
|
11519
|
-
logger.warn(`Could not fetch upstream for ${name}: ${String(err)}`);
|
|
11520
|
-
}
|
|
11521
|
-
}
|
|
11522
|
-
if (options2.json) {
|
|
11523
|
-
outputJson({ success: true, data: { diffs: results } });
|
|
11524
|
-
} else {
|
|
11525
|
-
for (const res of results) {
|
|
11526
|
-
if (res.hasChanges) {
|
|
11527
|
-
console.log(kleur_default.yellow(`
|
|
11528
|
-
Diff for ${res.name}:`));
|
|
11529
|
-
console.log(res.diff || "Changes detected (no diff available)");
|
|
11530
|
-
} else if (!options2.quiet) {
|
|
11531
|
-
logger.success(`${res.name}: No changes`);
|
|
11532
|
-
}
|
|
11533
|
-
}
|
|
11534
|
-
}
|
|
11535
|
-
} catch (error) {
|
|
11536
|
-
handleError(error, { json: options2.json });
|
|
11537
|
-
}
|
|
11538
|
-
});
|
|
11539
|
-
}
|
|
11540
|
-
|
|
11541
|
-
// src/commands/search.ts
|
|
11542
|
-
var import_fuzzysort = __toESM(require_fuzzysort(), 1);
|
|
11543
|
-
function registerSearchCommand(program2) {
|
|
11544
|
-
program2.command("search").alias("list").description("Search for components across registries or list installed").argument("[query]", "Search query").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).option("-v, --verbose", "Verbose output", false).option("-i, --installed", "List installed components only", false).option("-l, --limit <n>", "Limit results", "20").action(async (query, options2) => {
|
|
11545
|
-
try {
|
|
11546
|
-
const limit = parseInt(String(options2.limit), 10);
|
|
11547
|
-
if (options2.installed) {
|
|
11548
|
-
const lock = await readOcxLock(options2.cwd);
|
|
11549
|
-
if (!lock) {
|
|
11550
|
-
if (options2.json) {
|
|
11551
|
-
outputJson({ success: true, data: { components: [] } });
|
|
11552
|
-
} else {
|
|
11553
|
-
logger.info("No components installed.");
|
|
11554
|
-
}
|
|
11555
|
-
return;
|
|
11556
|
-
}
|
|
11557
|
-
const installed = Object.entries(lock.installed).map(([name, info]) => ({
|
|
11558
|
-
name,
|
|
11559
|
-
registry: info.registry,
|
|
11560
|
-
version: info.version,
|
|
11561
|
-
installedAt: info.installedAt
|
|
11562
|
-
}));
|
|
11563
|
-
if (options2.json) {
|
|
11564
|
-
outputJson({ success: true, data: { components: installed } });
|
|
11565
|
-
} else {
|
|
11566
|
-
logger.info(`Installed components (${installed.length}):`);
|
|
11567
|
-
for (const comp of installed) {
|
|
11568
|
-
console.log(` ${kleur_default.cyan(comp.name)} ${kleur_default.dim(`v${comp.version}`)} from ${comp.registry}`);
|
|
11569
|
-
}
|
|
11570
|
-
}
|
|
11571
|
-
return;
|
|
11572
|
-
}
|
|
11573
|
-
const config = await readOcxConfig(options2.cwd);
|
|
11574
|
-
if (!config) {
|
|
11575
|
-
logger.warn("No ocx.jsonc found. Run 'ocx init' first.");
|
|
11576
|
-
return;
|
|
11577
|
-
}
|
|
11578
|
-
if (options2.verbose) {
|
|
11579
|
-
logger.info(`Searching in ${Object.keys(config.registries).length} registries...`);
|
|
11580
|
-
}
|
|
11581
|
-
const allComponents = [];
|
|
11582
|
-
const spinner2 = createSpinner({
|
|
11583
|
-
text: "Searching registries...",
|
|
11584
|
-
quiet: options2.quiet || options2.verbose
|
|
11585
|
-
});
|
|
11586
|
-
if (!options2.json && !options2.verbose) {
|
|
11587
|
-
spinner2.start();
|
|
11588
|
-
}
|
|
11589
|
-
for (const [registryName, registryConfig] of Object.entries(config.registries)) {
|
|
11590
|
-
try {
|
|
11591
|
-
if (options2.verbose) {
|
|
11592
|
-
logger.info(`Fetching index from ${registryName} (${registryConfig.url})...`);
|
|
11593
|
-
}
|
|
11594
|
-
const index = await fetchRegistryIndex(registryConfig.url);
|
|
11595
|
-
if (options2.verbose) {
|
|
11596
|
-
logger.info(`Found ${index.components.length} components in ${registryName}`);
|
|
11597
|
-
}
|
|
11598
|
-
for (const comp of index.components) {
|
|
11599
|
-
allComponents.push({
|
|
11600
|
-
name: comp.name,
|
|
11601
|
-
description: comp.description,
|
|
11602
|
-
type: comp.type,
|
|
11603
|
-
registry: registryName
|
|
11604
|
-
});
|
|
11605
|
-
}
|
|
11606
|
-
} catch (error) {
|
|
11607
|
-
if (options2.verbose) {
|
|
11608
|
-
logger.warn(`Failed to fetch registry ${registryName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
11638
|
+
continue;
|
|
11639
|
+
}
|
|
11640
|
+
const upstreamContent = await fetchFileContent(registryConfig.url, name, upstreamFile.path);
|
|
11641
|
+
if (localContent === upstreamContent) {
|
|
11642
|
+
results.push({ name, hasChanges: false });
|
|
11643
|
+
} else {
|
|
11644
|
+
const patch = createPatch(name, upstreamContent, localContent);
|
|
11645
|
+
results.push({ name, hasChanges: true, diff: patch });
|
|
11609
11646
|
}
|
|
11647
|
+
} catch (err) {
|
|
11648
|
+
logger.warn(`Could not fetch upstream for ${name}: ${String(err)}`);
|
|
11610
11649
|
}
|
|
11611
11650
|
}
|
|
11612
|
-
if (!options2.json && !options2.verbose) {
|
|
11613
|
-
spinner2.stop();
|
|
11614
|
-
}
|
|
11615
|
-
let results = allComponents;
|
|
11616
|
-
if (query) {
|
|
11617
|
-
const fuzzyResults = import_fuzzysort.default.go(query, allComponents, {
|
|
11618
|
-
keys: ["name", "description"],
|
|
11619
|
-
limit
|
|
11620
|
-
});
|
|
11621
|
-
results = fuzzyResults.map((r) => r.obj);
|
|
11622
|
-
} else {
|
|
11623
|
-
results = results.slice(0, limit);
|
|
11624
|
-
}
|
|
11625
11651
|
if (options2.json) {
|
|
11626
|
-
outputJson({ success: true, data: {
|
|
11652
|
+
outputJson({ success: true, data: { diffs: results } });
|
|
11627
11653
|
} else {
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11654
|
+
for (const res of results) {
|
|
11655
|
+
if (res.hasChanges) {
|
|
11656
|
+
console.log(kleur_default.yellow(`
|
|
11657
|
+
Diff for ${res.name}:`));
|
|
11658
|
+
console.log(res.diff || "Changes detected (no diff available)");
|
|
11659
|
+
} else if (!options2.quiet) {
|
|
11660
|
+
logger.success(`${res.name}: No changes`);
|
|
11634
11661
|
}
|
|
11635
11662
|
}
|
|
11636
11663
|
}
|
|
@@ -11640,12 +11667,76 @@ function registerSearchCommand(program2) {
|
|
|
11640
11667
|
});
|
|
11641
11668
|
}
|
|
11642
11669
|
|
|
11670
|
+
// src/commands/init.ts
|
|
11671
|
+
import { existsSync as existsSync2 } from "fs";
|
|
11672
|
+
import { writeFile as writeFile2 } from "fs/promises";
|
|
11673
|
+
import { join as join3 } from "path";
|
|
11674
|
+
|
|
11675
|
+
// src/constants.ts
|
|
11676
|
+
var OCX_DOMAIN = "ocx.kdco.dev";
|
|
11677
|
+
var GITHUB_REPO = "kdcokenny/ocx";
|
|
11678
|
+
var OCX_SCHEMA_URL = `https://${OCX_DOMAIN}/schema.json`;
|
|
11679
|
+
var OCX_LOCK_SCHEMA_URL = `https://${OCX_DOMAIN}/lock.schema.json`;
|
|
11680
|
+
var OCX_INSTALL_URL = `https://${OCX_DOMAIN}/install.sh`;
|
|
11681
|
+
var GITHUB_RELEASES_URL = `https://github.com/${GITHUB_REPO}/releases`;
|
|
11682
|
+
var GITHUB_RAW_URL = `https://raw.githubusercontent.com/${GITHUB_REPO}/main`;
|
|
11683
|
+
|
|
11684
|
+
// src/commands/init.ts
|
|
11685
|
+
function registerInitCommand(program2) {
|
|
11686
|
+
program2.command("init").description("Initialize OCX configuration in your project").option("-y, --yes", "Skip prompts and use defaults").option("--cwd <path>", "Working directory", process.cwd()).option("-q, --quiet", "Suppress output").option("-v, --verbose", "Verbose output").option("--json", "Output as JSON").action(async (options2) => {
|
|
11687
|
+
try {
|
|
11688
|
+
await runInit(options2);
|
|
11689
|
+
} catch (error) {
|
|
11690
|
+
handleError(error, { json: options2.json });
|
|
11691
|
+
}
|
|
11692
|
+
});
|
|
11693
|
+
}
|
|
11694
|
+
async function runInit(options2) {
|
|
11695
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
11696
|
+
const configPath = join3(cwd, "ocx.jsonc");
|
|
11697
|
+
if (existsSync2(configPath)) {
|
|
11698
|
+
if (!options2.yes) {
|
|
11699
|
+
logger.warn("ocx.jsonc already exists");
|
|
11700
|
+
logger.info("Use --yes to overwrite");
|
|
11701
|
+
return;
|
|
11702
|
+
}
|
|
11703
|
+
logger.info("Overwriting existing ocx.jsonc");
|
|
11704
|
+
}
|
|
11705
|
+
const spin = options2.quiet ? null : createSpinner({ text: "Initializing OCX..." });
|
|
11706
|
+
spin?.start();
|
|
11707
|
+
try {
|
|
11708
|
+
const rawConfig = {
|
|
11709
|
+
$schema: OCX_SCHEMA_URL,
|
|
11710
|
+
registries: {}
|
|
11711
|
+
};
|
|
11712
|
+
const config = ocxConfigSchema.parse(rawConfig);
|
|
11713
|
+
const content = JSON.stringify(config, null, 2);
|
|
11714
|
+
await writeFile2(configPath, content, "utf-8");
|
|
11715
|
+
if (!options2.quiet && !options2.json) {
|
|
11716
|
+
logger.success("Initialized OCX configuration");
|
|
11717
|
+
}
|
|
11718
|
+
spin?.succeed("Initialized OCX configuration");
|
|
11719
|
+
if (options2.json) {
|
|
11720
|
+
console.log(JSON.stringify({ success: true, path: configPath }));
|
|
11721
|
+
} else if (!options2.quiet) {
|
|
11722
|
+
logger.info(`Created ${configPath}`);
|
|
11723
|
+
logger.info("");
|
|
11724
|
+
logger.info("Next steps:");
|
|
11725
|
+
logger.info(" 1. Add a registry: ocx registry add <url>");
|
|
11726
|
+
logger.info(" 2. Install components: ocx add <component>");
|
|
11727
|
+
}
|
|
11728
|
+
} catch (error) {
|
|
11729
|
+
spin?.fail("Failed to initialize");
|
|
11730
|
+
throw error;
|
|
11731
|
+
}
|
|
11732
|
+
}
|
|
11733
|
+
|
|
11643
11734
|
// src/commands/registry.ts
|
|
11644
11735
|
function registerRegistryCommand(program2) {
|
|
11645
11736
|
const registry = program2.command("registry").description("Manage registries");
|
|
11646
11737
|
registry.command("add").description("Add a registry").argument("<url>", "Registry URL").option("--name <name>", "Registry alias (defaults to hostname)").option("--version <version>", "Pin to specific version").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).action(async (url, options2) => {
|
|
11647
11738
|
try {
|
|
11648
|
-
|
|
11739
|
+
const config = await readOcxConfig(options2.cwd);
|
|
11649
11740
|
if (!config) {
|
|
11650
11741
|
logger.error("No ocx.jsonc found. Run 'ocx init' first.");
|
|
11651
11742
|
process.exit(1);
|
|
@@ -11675,7 +11766,7 @@ function registerRegistryCommand(program2) {
|
|
|
11675
11766
|
});
|
|
11676
11767
|
registry.command("remove").description("Remove a registry").argument("<name>", "Registry name").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).action(async (name, options2) => {
|
|
11677
11768
|
try {
|
|
11678
|
-
|
|
11769
|
+
const config = await readOcxConfig(options2.cwd);
|
|
11679
11770
|
if (!config) {
|
|
11680
11771
|
logger.error("No ocx.jsonc found. Run 'ocx init' first.");
|
|
11681
11772
|
process.exit(1);
|
|
@@ -11735,102 +11826,101 @@ function registerRegistryCommand(program2) {
|
|
|
11735
11826
|
});
|
|
11736
11827
|
}
|
|
11737
11828
|
|
|
11738
|
-
// src/commands/
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
program2.command("build").description("Build a registry from source (for registry authors)").argument("[path]", "Registry source directory", ".").option("--out <dir>", "Output directory", "./dist").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).action(async (path, options2) => {
|
|
11829
|
+
// src/commands/search.ts
|
|
11830
|
+
var import_fuzzysort = __toESM(require_fuzzysort(), 1);
|
|
11831
|
+
function registerSearchCommand(program2) {
|
|
11832
|
+
program2.command("search").alias("list").description("Search for components across registries or list installed").argument("[query]", "Search query").option("--cwd <path>", "Working directory", process.cwd()).option("--json", "Output as JSON", false).option("-q, --quiet", "Suppress output", false).option("-v, --verbose", "Verbose output", false).option("-i, --installed", "List installed components only", false).option("-l, --limit <n>", "Limit results", "20").action(async (query, options2) => {
|
|
11743
11833
|
try {
|
|
11744
|
-
const
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
spinner2.fail("No registry.json found in source directory");
|
|
11753
|
-
process.exit(1);
|
|
11754
|
-
}
|
|
11755
|
-
const registryData = await registryFile.json();
|
|
11756
|
-
const parseResult = registrySchema.safeParse(registryData);
|
|
11757
|
-
if (!parseResult.success) {
|
|
11758
|
-
if (!options2.json) {
|
|
11759
|
-
spinner2.fail("Registry validation failed");
|
|
11760
|
-
const errors3 = parseResult.error.errors.map((e) => ` ${e.path.join(".")}: ${e.message}`);
|
|
11761
|
-
for (const err of errors3) {
|
|
11762
|
-
console.log(kleur_default.red(err));
|
|
11834
|
+
const limit = parseInt(String(options2.limit), 10);
|
|
11835
|
+
if (options2.installed) {
|
|
11836
|
+
const lock = await readOcxLock(options2.cwd);
|
|
11837
|
+
if (!lock) {
|
|
11838
|
+
if (options2.json) {
|
|
11839
|
+
outputJson({ success: true, data: { components: [] } });
|
|
11840
|
+
} else {
|
|
11841
|
+
logger.info("No components installed.");
|
|
11763
11842
|
}
|
|
11843
|
+
return;
|
|
11764
11844
|
}
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
"dist-tags": {
|
|
11778
|
-
latest: registry.version
|
|
11779
|
-
}
|
|
11780
|
-
};
|
|
11781
|
-
const packumentPath = join3(componentsDir, `${component.name}.json`);
|
|
11782
|
-
await Bun.write(packumentPath, JSON.stringify(packument, null, 2));
|
|
11783
|
-
for (const file of component.files) {
|
|
11784
|
-
const sourceFilePath = join3(sourcePath, "files", file.path);
|
|
11785
|
-
const destFilePath = join3(componentsDir, component.name, file.path);
|
|
11786
|
-
const destFileDir = dirname2(destFilePath);
|
|
11787
|
-
if (!await Bun.file(sourceFilePath).exists()) {
|
|
11788
|
-
validationErrors.push(`${component.name}: Source file not found at ${sourceFilePath}`);
|
|
11789
|
-
continue;
|
|
11845
|
+
const installed = Object.entries(lock.installed).map(([name, info]) => ({
|
|
11846
|
+
name,
|
|
11847
|
+
registry: info.registry,
|
|
11848
|
+
version: info.version,
|
|
11849
|
+
installedAt: info.installedAt
|
|
11850
|
+
}));
|
|
11851
|
+
if (options2.json) {
|
|
11852
|
+
outputJson({ success: true, data: { components: installed } });
|
|
11853
|
+
} else {
|
|
11854
|
+
logger.info(`Installed components (${installed.length}):`);
|
|
11855
|
+
for (const comp of installed) {
|
|
11856
|
+
console.log(` ${kleur_default.cyan(comp.name)} ${kleur_default.dim(`v${comp.version}`)} from ${comp.registry}`);
|
|
11790
11857
|
}
|
|
11791
|
-
await mkdir2(destFileDir, { recursive: true });
|
|
11792
|
-
const sourceFile = Bun.file(sourceFilePath);
|
|
11793
|
-
await Bun.write(destFilePath, sourceFile);
|
|
11794
11858
|
}
|
|
11859
|
+
return;
|
|
11795
11860
|
}
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11861
|
+
const config = await readOcxConfig(options2.cwd);
|
|
11862
|
+
if (!config) {
|
|
11863
|
+
logger.warn("No ocx.jsonc found. Run 'ocx init' first.");
|
|
11864
|
+
return;
|
|
11865
|
+
}
|
|
11866
|
+
if (options2.verbose) {
|
|
11867
|
+
logger.info(`Searching in ${Object.keys(config.registries).length} registries...`);
|
|
11868
|
+
}
|
|
11869
|
+
const allComponents = [];
|
|
11870
|
+
const spinner2 = createSpinner({
|
|
11871
|
+
text: "Searching registries...",
|
|
11872
|
+
quiet: options2.quiet || options2.verbose
|
|
11873
|
+
});
|
|
11874
|
+
if (!options2.json && !options2.verbose) {
|
|
11875
|
+
spinner2.start();
|
|
11876
|
+
}
|
|
11877
|
+
for (const [registryName, registryConfig] of Object.entries(config.registries)) {
|
|
11878
|
+
try {
|
|
11879
|
+
if (options2.verbose) {
|
|
11880
|
+
logger.info(`Fetching index from ${registryName} (${registryConfig.url})...`);
|
|
11881
|
+
}
|
|
11882
|
+
const index = await fetchRegistryIndex(registryConfig.url);
|
|
11883
|
+
if (options2.verbose) {
|
|
11884
|
+
logger.info(`Found ${index.components.length} components in ${registryName}`);
|
|
11885
|
+
}
|
|
11886
|
+
for (const comp of index.components) {
|
|
11887
|
+
allComponents.push({
|
|
11888
|
+
name: comp.name,
|
|
11889
|
+
description: comp.description,
|
|
11890
|
+
type: comp.type,
|
|
11891
|
+
registry: registryName
|
|
11892
|
+
});
|
|
11893
|
+
}
|
|
11894
|
+
} catch (error) {
|
|
11895
|
+
if (options2.verbose) {
|
|
11896
|
+
logger.warn(`Failed to fetch registry ${registryName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
11801
11897
|
}
|
|
11802
11898
|
}
|
|
11803
|
-
process.exit(1);
|
|
11804
11899
|
}
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
}
|
|
11816
|
-
|
|
11817
|
-
if (!options2.json) {
|
|
11818
|
-
const msg = `Built ${registry.components.length} components to ${relative(options2.cwd, outPath)}`;
|
|
11819
|
-
spinner2.succeed(msg);
|
|
11820
|
-
if (!process.stdout.isTTY) {
|
|
11821
|
-
logger.success(`Built ${registry.components.length} components`);
|
|
11822
|
-
}
|
|
11900
|
+
if (!options2.json && !options2.verbose) {
|
|
11901
|
+
spinner2.stop();
|
|
11902
|
+
}
|
|
11903
|
+
let results = allComponents;
|
|
11904
|
+
if (query) {
|
|
11905
|
+
const fuzzyResults = import_fuzzysort.default.go(query, allComponents, {
|
|
11906
|
+
keys: ["name", "description"],
|
|
11907
|
+
limit
|
|
11908
|
+
});
|
|
11909
|
+
results = fuzzyResults.map((r) => r.obj);
|
|
11910
|
+
} else {
|
|
11911
|
+
results = results.slice(0, limit);
|
|
11823
11912
|
}
|
|
11824
11913
|
if (options2.json) {
|
|
11825
|
-
outputJson({
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11914
|
+
outputJson({ success: true, data: { components: results } });
|
|
11915
|
+
} else {
|
|
11916
|
+
if (results.length === 0) {
|
|
11917
|
+
logger.info("No components found.");
|
|
11918
|
+
} else {
|
|
11919
|
+
logger.info(`Found ${results.length} components:`);
|
|
11920
|
+
for (const comp of results) {
|
|
11921
|
+
console.log(` ${kleur_default.cyan(comp.name)} ${kleur_default.dim(`(${comp.type})`)} - ${comp.description}`);
|
|
11832
11922
|
}
|
|
11833
|
-
}
|
|
11923
|
+
}
|
|
11834
11924
|
}
|
|
11835
11925
|
} catch (error) {
|
|
11836
11926
|
handleError(error, { json: options2.json });
|
|
@@ -11854,4 +11944,4 @@ main2().catch((err) => {
|
|
|
11854
11944
|
handleError(err);
|
|
11855
11945
|
});
|
|
11856
11946
|
|
|
11857
|
-
//# debugId=
|
|
11947
|
+
//# debugId=B972029F0864960D64756E2164756E21
|