kly 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/ai/context.mjs +79 -0
- package/dist/ai/context.mjs.map +1 -0
- package/dist/ai/storage.mjs +50 -0
- package/dist/ai/storage.mjs.map +1 -0
- package/dist/bin/kly.d.mts +1 -0
- package/dist/bin/kly.mjs +2888 -0
- package/dist/bin/kly.mjs.map +1 -0
- package/dist/bin/launcher-vTpgdO9n.mjs +3 -0
- package/dist/bin/permissions-2r_7ZqaH.mjs +3 -0
- package/dist/cli.mjs +229 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/define-app.d.mts +33 -0
- package/dist/define-app.d.mts.map +1 -0
- package/dist/define-app.mjs +183 -0
- package/dist/define-app.mjs.map +1 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.mjs +15 -0
- package/dist/mcp/index.mjs +4 -0
- package/dist/mcp/schema-converter.d.mts +13 -0
- package/dist/mcp/schema-converter.d.mts.map +1 -0
- package/dist/mcp/schema-converter.mjs +30 -0
- package/dist/mcp/schema-converter.mjs.map +1 -0
- package/dist/mcp/server.d.mts +33 -0
- package/dist/mcp/server.d.mts.map +1 -0
- package/dist/mcp/server.mjs +92 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/permissions/index.mjs +123 -0
- package/dist/permissions/index.mjs.map +1 -0
- package/dist/sandbox/bundled-executor.d.mts +17 -0
- package/dist/sandbox/bundled-executor.d.mts.map +1 -0
- package/dist/sandbox/bundled-executor.mjs +175 -0
- package/dist/sandbox/bundled-executor.mjs.map +1 -0
- package/dist/sandbox/ipc-client.mjs +40 -0
- package/dist/sandbox/ipc-client.mjs.map +1 -0
- package/dist/sandbox/sandboxed-context.mjs +14 -0
- package/dist/sandbox/sandboxed-context.mjs.map +1 -0
- package/dist/shared/constants.mjs +36 -0
- package/dist/shared/constants.mjs.map +1 -0
- package/dist/shared/runtime-mode.mjs +59 -0
- package/dist/shared/runtime-mode.mjs.map +1 -0
- package/dist/tool.d.mts +42 -0
- package/dist/tool.d.mts.map +1 -0
- package/dist/tool.mjs +38 -0
- package/dist/tool.mjs.map +1 -0
- package/dist/types.d.mts +282 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +19 -0
- package/dist/types.mjs.map +1 -0
- package/dist/ui/components/confirm.d.mts +13 -0
- package/dist/ui/components/confirm.d.mts.map +1 -0
- package/dist/ui/components/confirm.mjs +37 -0
- package/dist/ui/components/confirm.mjs.map +1 -0
- package/dist/ui/components/form.d.mts +50 -0
- package/dist/ui/components/form.d.mts.map +1 -0
- package/dist/ui/components/form.mjs +92 -0
- package/dist/ui/components/form.mjs.map +1 -0
- package/dist/ui/components/input.d.mts +29 -0
- package/dist/ui/components/input.d.mts.map +1 -0
- package/dist/ui/components/input.mjs +42 -0
- package/dist/ui/components/input.mjs.map +1 -0
- package/dist/ui/components/select.d.mts +41 -0
- package/dist/ui/components/select.d.mts.map +1 -0
- package/dist/ui/components/select.mjs +50 -0
- package/dist/ui/components/select.mjs.map +1 -0
- package/dist/ui/components/spinner.d.mts +28 -0
- package/dist/ui/components/spinner.d.mts.map +1 -0
- package/dist/ui/components/spinner.mjs +35 -0
- package/dist/ui/components/spinner.mjs.map +1 -0
- package/dist/ui/components/table.d.mts +60 -0
- package/dist/ui/components/table.d.mts.map +1 -0
- package/dist/ui/components/table.mjs +143 -0
- package/dist/ui/components/table.mjs.map +1 -0
- package/dist/ui/index.d.mts +9 -0
- package/dist/ui/utils/colors.d.mts +38 -0
- package/dist/ui/utils/colors.d.mts.map +1 -0
- package/dist/ui/utils/colors.mjs +64 -0
- package/dist/ui/utils/colors.mjs.map +1 -0
- package/dist/ui/utils/output.d.mts +23 -0
- package/dist/ui/utils/output.d.mts.map +1 -0
- package/dist/ui/utils/output.mjs +42 -0
- package/dist/ui/utils/output.mjs.map +1 -0
- package/dist/ui/utils/tty.d.mts +9 -0
- package/dist/ui/utils/tty.d.mts.map +1 -0
- package/dist/ui/utils/tty.mjs +12 -0
- package/dist/ui/utils/tty.mjs.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import pc$1 from "picocolors";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/utils/colors.ts
|
|
4
|
+
/**
|
|
5
|
+
* Default color theme for UI components (hex values for reference)
|
|
6
|
+
*/
|
|
7
|
+
const theme = {
|
|
8
|
+
primary: "#3b82f6",
|
|
9
|
+
success: "#10b981",
|
|
10
|
+
warning: "#f59e0b",
|
|
11
|
+
error: "#ef4444",
|
|
12
|
+
info: "#06b6d4",
|
|
13
|
+
background: "#161b22",
|
|
14
|
+
surface: "#1e293b",
|
|
15
|
+
border: "#30363d",
|
|
16
|
+
text: "#c9d1d9",
|
|
17
|
+
textDim: "#8b949e",
|
|
18
|
+
textBright: "#ffffff",
|
|
19
|
+
focused: "#3b82f6",
|
|
20
|
+
selected: "#3b82f6",
|
|
21
|
+
hover: "#334155",
|
|
22
|
+
disabled: "#6e7681"
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Format text with picocolors
|
|
26
|
+
*/
|
|
27
|
+
function formatText(text, options) {
|
|
28
|
+
let result = text;
|
|
29
|
+
if (options?.color) switch (options.color) {
|
|
30
|
+
case "red":
|
|
31
|
+
result = pc$1.red(result);
|
|
32
|
+
break;
|
|
33
|
+
case "green":
|
|
34
|
+
result = pc$1.green(result);
|
|
35
|
+
break;
|
|
36
|
+
case "yellow":
|
|
37
|
+
result = pc$1.yellow(result);
|
|
38
|
+
break;
|
|
39
|
+
case "blue":
|
|
40
|
+
result = pc$1.blue(result);
|
|
41
|
+
break;
|
|
42
|
+
case "magenta":
|
|
43
|
+
result = pc$1.magenta(result);
|
|
44
|
+
break;
|
|
45
|
+
case "cyan":
|
|
46
|
+
result = pc$1.cyan(result);
|
|
47
|
+
break;
|
|
48
|
+
case "white":
|
|
49
|
+
result = pc$1.white(result);
|
|
50
|
+
break;
|
|
51
|
+
case "gray":
|
|
52
|
+
result = pc$1.gray(result);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
if (options?.bold) result = pc$1.bold(result);
|
|
56
|
+
if (options?.dim) result = pc$1.dim(result);
|
|
57
|
+
if (options?.italic) result = pc$1.italic(result);
|
|
58
|
+
if (options?.underline) result = pc$1.underline(result);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { formatText, pc$1 as pc, theme };
|
|
64
|
+
//# sourceMappingURL=colors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.mjs","names":["pc"],"sources":["../../../src/ui/utils/colors.ts"],"sourcesContent":["import pc from \"picocolors\";\n\n/**\n * Default color theme for UI components (hex values for reference)\n */\nexport const theme = {\n // Brand colors\n primary: \"#3b82f6\", // Blue\n success: \"#10b981\", // Green\n warning: \"#f59e0b\", // Orange\n error: \"#ef4444\", // Red\n info: \"#06b6d4\", // Cyan\n\n // UI colors\n background: \"#161b22\", // Dark gray\n surface: \"#1e293b\", // Lighter gray\n border: \"#30363d\", // Border gray\n text: \"#c9d1d9\", // Light text\n textDim: \"#8b949e\", // Dimmed text\n textBright: \"#ffffff\", // Bright text\n\n // Interactive states\n focused: \"#3b82f6\", // Blue\n selected: \"#3b82f6\", // Blue\n hover: \"#334155\", // Lighter gray\n disabled: \"#6e7681\", // Muted gray\n} as const;\n\nexport type AnsiColor =\n | \"red\"\n | \"green\"\n | \"yellow\"\n | \"blue\"\n | \"magenta\"\n | \"cyan\"\n | \"white\"\n | \"gray\";\n\n/**\n * Format text with picocolors\n */\nexport function formatText(\n text: string,\n options?: {\n color?: AnsiColor;\n bold?: boolean;\n dim?: boolean;\n italic?: boolean;\n underline?: boolean;\n },\n): string {\n let result = text;\n\n // Apply color first\n if (options?.color) {\n switch (options.color) {\n case \"red\":\n result = pc.red(result);\n break;\n case \"green\":\n result = pc.green(result);\n break;\n case \"yellow\":\n result = pc.yellow(result);\n break;\n case \"blue\":\n result = pc.blue(result);\n break;\n case \"magenta\":\n result = pc.magenta(result);\n break;\n case \"cyan\":\n result = pc.cyan(result);\n break;\n case \"white\":\n result = pc.white(result);\n break;\n case \"gray\":\n result = pc.gray(result);\n break;\n }\n }\n\n // Apply styles\n if (options?.bold) result = pc.bold(result);\n if (options?.dim) result = pc.dim(result);\n if (options?.italic) result = pc.italic(result);\n if (options?.underline) result = pc.underline(result);\n\n return result;\n}\n\n// Re-export picocolors for direct usage\nexport { pc };\n"],"mappings":";;;;;;AAKA,MAAa,QAAQ;CAEnB,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;CAGN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,MAAM;CACN,SAAS;CACT,YAAY;CAGZ,SAAS;CACT,UAAU;CACV,OAAO;CACP,UAAU;CACX;;;;AAeD,SAAgB,WACd,MACA,SAOQ;CACR,IAAI,SAAS;AAGb,KAAI,SAAS,MACX,SAAQ,QAAQ,OAAhB;EACE,KAAK;AACH,YAASA,KAAG,IAAI,OAAO;AACvB;EACF,KAAK;AACH,YAASA,KAAG,MAAM,OAAO;AACzB;EACF,KAAK;AACH,YAASA,KAAG,OAAO,OAAO;AAC1B;EACF,KAAK;AACH,YAASA,KAAG,KAAK,OAAO;AACxB;EACF,KAAK;AACH,YAASA,KAAG,QAAQ,OAAO;AAC3B;EACF,KAAK;AACH,YAASA,KAAG,KAAK,OAAO;AACxB;EACF,KAAK;AACH,YAASA,KAAG,MAAM,OAAO;AACzB;EACF,KAAK;AACH,YAASA,KAAG,KAAK,OAAO;AACxB;;AAKN,KAAI,SAAS,KAAM,UAASA,KAAG,KAAK,OAAO;AAC3C,KAAI,SAAS,IAAK,UAASA,KAAG,IAAI,OAAO;AACzC,KAAI,SAAS,OAAQ,UAASA,KAAG,OAAO,OAAO;AAC/C,KAAI,SAAS,UAAW,UAASA,KAAG,UAAU,OAAO;AAErD,QAAO"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ui/utils/output.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Output a result to the console
|
|
4
|
+
*
|
|
5
|
+
* @param result - The result to display (string, object, etc.)
|
|
6
|
+
*/
|
|
7
|
+
declare function output(result: unknown): void;
|
|
8
|
+
/**
|
|
9
|
+
* Display an error message with optional suggestions
|
|
10
|
+
*
|
|
11
|
+
* @param message - Error message
|
|
12
|
+
* @param suggestions - Optional suggestions for fixing the error
|
|
13
|
+
*/
|
|
14
|
+
declare function error(message: string, suggestions?: string[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Display help text
|
|
17
|
+
*
|
|
18
|
+
* @param content - Help text content
|
|
19
|
+
*/
|
|
20
|
+
declare function help(content: string): void;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { error, help, output };
|
|
23
|
+
//# sourceMappingURL=output.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.mts","names":[],"sources":["../../../src/ui/utils/output.ts"],"sourcesContent":[],"mappings":";;AAOA;AAkBA;AAmBA;;iBArCgB,MAAA;;;;;;;iBAkBA,KAAA;;;;;;iBAmBA,IAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { formatText } from "./colors.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/utils/output.ts
|
|
4
|
+
/**
|
|
5
|
+
* Output a result to the console
|
|
6
|
+
*
|
|
7
|
+
* @param result - The result to display (string, object, etc.)
|
|
8
|
+
*/
|
|
9
|
+
function output(result) {
|
|
10
|
+
if (result === void 0 || result === null) return;
|
|
11
|
+
if (typeof result === "string") console.log(result);
|
|
12
|
+
else console.log(JSON.stringify(result, null, 2));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Display an error message with optional suggestions
|
|
16
|
+
*
|
|
17
|
+
* @param message - Error message
|
|
18
|
+
* @param suggestions - Optional suggestions for fixing the error
|
|
19
|
+
*/
|
|
20
|
+
function error(message, suggestions) {
|
|
21
|
+
console.error(`${formatText("Error:", {
|
|
22
|
+
color: "red",
|
|
23
|
+
bold: true
|
|
24
|
+
})} ${message}`);
|
|
25
|
+
if (suggestions?.length) {
|
|
26
|
+
console.error("");
|
|
27
|
+
console.error(formatText("Suggestions:", { dim: true }));
|
|
28
|
+
for (const suggestion of suggestions) console.error(` ${formatText("•", { dim: true })} ${suggestion}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Display help text
|
|
33
|
+
*
|
|
34
|
+
* @param content - Help text content
|
|
35
|
+
*/
|
|
36
|
+
function help(content) {
|
|
37
|
+
console.log(content);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { error, help, output };
|
|
42
|
+
//# sourceMappingURL=output.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.mjs","names":[],"sources":["../../../src/ui/utils/output.ts"],"sourcesContent":["import { formatText } from \"./colors\";\n\n/**\n * Output a result to the console\n *\n * @param result - The result to display (string, object, etc.)\n */\nexport function output(result: unknown): void {\n if (result === undefined || result === null) {\n return;\n }\n\n if (typeof result === \"string\") {\n console.log(result);\n } else {\n console.log(JSON.stringify(result, null, 2));\n }\n}\n\n/**\n * Display an error message with optional suggestions\n *\n * @param message - Error message\n * @param suggestions - Optional suggestions for fixing the error\n */\nexport function error(message: string, suggestions?: string[]): void {\n console.error(\n `${formatText(\"Error:\", { color: \"red\", bold: true })} ${message}`,\n );\n\n if (suggestions?.length) {\n console.error(\"\");\n console.error(formatText(\"Suggestions:\", { dim: true }));\n for (const suggestion of suggestions) {\n console.error(` ${formatText(\"•\", { dim: true })} ${suggestion}`);\n }\n }\n}\n\n/**\n * Display help text\n *\n * @param content - Help text content\n */\nexport function help(content: string): void {\n console.log(content);\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,OAAO,QAAuB;AAC5C,KAAI,WAAW,UAAa,WAAW,KACrC;AAGF,KAAI,OAAO,WAAW,SACpB,SAAQ,IAAI,OAAO;KAEnB,SAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,EAAE,CAAC;;;;;;;;AAUhD,SAAgB,MAAM,SAAiB,aAA8B;AACnE,SAAQ,MACN,GAAG,WAAW,UAAU;EAAE,OAAO;EAAO,MAAM;EAAM,CAAC,CAAC,GAAG,UAC1D;AAED,KAAI,aAAa,QAAQ;AACvB,UAAQ,MAAM,GAAG;AACjB,UAAQ,MAAM,WAAW,gBAAgB,EAAE,KAAK,MAAM,CAAC,CAAC;AACxD,OAAK,MAAM,cAAc,YACvB,SAAQ,MAAM,KAAK,WAAW,KAAK,EAAE,KAAK,MAAM,CAAC,CAAC,GAAG,aAAa;;;;;;;;AAUxE,SAAgB,KAAK,SAAuB;AAC1C,SAAQ,IAAI,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty.d.mts","names":[],"sources":["../../../src/ui/utils/tty.ts"],"sourcesContent":[],"mappings":";;AAIA;;;iBAAgB,KAAA,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/ui/utils/tty.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if we're in a TTY environment
|
|
4
|
+
* Returns false in CI or non-interactive environments
|
|
5
|
+
*/
|
|
6
|
+
function isTTY() {
|
|
7
|
+
return Boolean(process.stdout.isTTY && process.stdin.isTTY && !process.env.CI);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { isTTY };
|
|
12
|
+
//# sourceMappingURL=tty.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty.mjs","names":[],"sources":["../../../src/ui/utils/tty.ts"],"sourcesContent":["/**\n * Check if we're in a TTY environment\n * Returns false in CI or non-interactive environments\n */\nexport function isTTY(): boolean {\n return Boolean(\n process.stdout.isTTY && process.stdin.isTTY && !process.env.CI,\n );\n}\n"],"mappings":";;;;;AAIA,SAAgB,QAAiB;AAC/B,QAAO,QACL,QAAQ,OAAO,SAAS,QAAQ,MAAM,SAAS,CAAC,QAAQ,IAAI,GAC7D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kly",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/xinyao27/kly#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/xinyao27/kly/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/xinyao27/kly.git"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "xinyao",
|
|
18
|
+
"email": "hi@xinyao.me"
|
|
19
|
+
},
|
|
20
|
+
"funding": "https://github.com/sponsors/xinyao27",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/*"
|
|
26
|
+
],
|
|
27
|
+
"bin": {
|
|
28
|
+
"kly": "./dist/bin/kly.mjs"
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./dist/index.mjs",
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"sideEffects": false,
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"lint": "biome check --write --unsafe ./src && nr typecheck",
|
|
42
|
+
"prepublishOnly": "nr build",
|
|
43
|
+
"release": "release-it",
|
|
44
|
+
"start": "bun run src/index.ts",
|
|
45
|
+
"test": "bun test",
|
|
46
|
+
"up": "taze major -I",
|
|
47
|
+
"prepare": "simple-git-hooks"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@ai-sdk/anthropic": "^3.0.1",
|
|
51
|
+
"@ai-sdk/deepseek": "^2.0.1",
|
|
52
|
+
"@ai-sdk/google": "^3.0.1",
|
|
53
|
+
"@ai-sdk/mistral": "^3.0.1",
|
|
54
|
+
"@ai-sdk/openai": "^3.0.1",
|
|
55
|
+
"@anthropic-ai/sandbox-runtime": "^0.0.23",
|
|
56
|
+
"@clack/prompts": "1.0.0-alpha.9",
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
58
|
+
"ai": "^6.0.3",
|
|
59
|
+
"picocolors": "^1.1.1",
|
|
60
|
+
"zod": "^4.2.1"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@antfu/ni": "^28.0.0",
|
|
64
|
+
"@biomejs/biome": "^2.3.10",
|
|
65
|
+
"@release-it/conventional-changelog": "^10.0.4",
|
|
66
|
+
"@types/bun": "^1.3.5",
|
|
67
|
+
"lint-staged": "^16.2.7",
|
|
68
|
+
"publint": "^0.3.16",
|
|
69
|
+
"release-it": "^19.2.1",
|
|
70
|
+
"simple-git-hooks": "^2.13.1",
|
|
71
|
+
"taze": "^19.9.2",
|
|
72
|
+
"tsdown": "^0.18.3",
|
|
73
|
+
"typescript": "^5.9.3"
|
|
74
|
+
},
|
|
75
|
+
"simple-git-hooks": {
|
|
76
|
+
"pre-commit": "npx lint-staged"
|
|
77
|
+
},
|
|
78
|
+
"lint-staged": {
|
|
79
|
+
"*": "biome check --write --unsafe --no-errors-on-unmatched --files-ignore-unknown=true"
|
|
80
|
+
}
|
|
81
|
+
}
|