own-term 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 +353 -0
- package/bin/cli.d.ts +3 -0
- package/bin/cli.d.ts.map +1 -0
- package/bin/cli.js +29 -0
- package/bin/cli.js.map +1 -0
- package/bin/commands/index.d.ts +3 -0
- package/bin/commands/index.d.ts.map +1 -0
- package/bin/commands/index.js +390 -0
- package/bin/commands/index.js.map +1 -0
- package/bin/config.d.ts +10 -0
- package/bin/config.d.ts.map +1 -0
- package/bin/config.js +160 -0
- package/bin/config.js.map +1 -0
- package/bin/plugins/loader.d.ts +11 -0
- package/bin/plugins/loader.d.ts.map +1 -0
- package/bin/plugins/loader.js +89 -0
- package/bin/plugins/loader.js.map +1 -0
- package/bin/plugins/plugin_api.d.ts +15 -0
- package/bin/plugins/plugin_api.d.ts.map +1 -0
- package/bin/plugins/plugin_api.js +27 -0
- package/bin/plugins/plugin_api.js.map +1 -0
- package/bin/render/effects.d.ts +22 -0
- package/bin/render/effects.d.ts.map +1 -0
- package/bin/render/effects.js +57 -0
- package/bin/render/effects.js.map +1 -0
- package/bin/render/renderer.d.ts +71 -0
- package/bin/render/renderer.d.ts.map +1 -0
- package/bin/render/renderer.js +175 -0
- package/bin/render/renderer.js.map +1 -0
- package/bin/shell/engine.d.ts +53 -0
- package/bin/shell/engine.d.ts.map +1 -0
- package/bin/shell/engine.js +242 -0
- package/bin/shell/engine.js.map +1 -0
- package/bin/shell/router.d.ts +27 -0
- package/bin/shell/router.d.ts.map +1 -0
- package/bin/shell/router.js +80 -0
- package/bin/shell/router.js.map +1 -0
- package/bin/shell/welcome.d.ts +4 -0
- package/bin/shell/welcome.d.ts.map +1 -0
- package/bin/shell/welcome.js +162 -0
- package/bin/shell/welcome.js.map +1 -0
- package/bin/themes/default.d.ts +10 -0
- package/bin/themes/default.d.ts.map +1 -0
- package/bin/themes/default.js +61 -0
- package/bin/themes/default.js.map +1 -0
- package/bin/types.d.ts +107 -0
- package/bin/types.d.ts.map +1 -0
- package/bin/types.js +6 -0
- package/bin/types.js.map +1 -0
- package/package.json +70 -0
- package/templates/default/termfolio.config.ts +37 -0
- package/templates/hacker/termfolio.config.ts +34 -0
- package/templates/minimal/termfolio.config.ts +23 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadPlugins = loadPlugins;
|
|
37
|
+
exports.createPlugin = createPlugin;
|
|
38
|
+
/**
|
|
39
|
+
* Load and register plugins
|
|
40
|
+
*/
|
|
41
|
+
async function loadPlugins(pluginNames, context, router) {
|
|
42
|
+
for (const pluginName of pluginNames) {
|
|
43
|
+
try {
|
|
44
|
+
await loadPlugin(pluginName, context, router);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
context.render.warning(`Failed to load plugin '${pluginName}': ${error}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Load a single plugin
|
|
53
|
+
*/
|
|
54
|
+
async function loadPlugin(pluginName, context, router) {
|
|
55
|
+
try {
|
|
56
|
+
// Try to import the plugin
|
|
57
|
+
const pluginModule = await Promise.resolve(`${pluginName}`).then(s => __importStar(require(s)));
|
|
58
|
+
const plugin = pluginModule.default || pluginModule;
|
|
59
|
+
if (!plugin.register || typeof plugin.register !== "function") {
|
|
60
|
+
throw new Error("Plugin must export a 'register' function");
|
|
61
|
+
}
|
|
62
|
+
// Create plugin API
|
|
63
|
+
const api = {
|
|
64
|
+
registerCommand: (name, description, handler) => {
|
|
65
|
+
router.register(name, description, handler);
|
|
66
|
+
},
|
|
67
|
+
getConfig: () => context.config,
|
|
68
|
+
render: context.render,
|
|
69
|
+
theme: context.theme,
|
|
70
|
+
};
|
|
71
|
+
// Register the plugin
|
|
72
|
+
plugin.register(api);
|
|
73
|
+
context.render.success(`Loaded plugin: ${plugin.name || pluginName}`);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new Error(`Cannot load plugin '${pluginName}': ${error}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a plugin helper for easier plugin development
|
|
81
|
+
*/
|
|
82
|
+
function createPlugin(name, version, register) {
|
|
83
|
+
return {
|
|
84
|
+
name,
|
|
85
|
+
version,
|
|
86
|
+
register,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,kCAYC;AAyCD,oCAUC;AAlED;;GAEG;AACI,KAAK,UAAU,WAAW,CAC7B,WAAqB,EACrB,OAAuB,EACvB,MAAc;IAEd,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,IAAI,CAAC;YACD,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,UAAU,MAAM,KAAK,EAAE,CAAC,CAAC;QAC9E,CAAC;IACL,CAAC;AACL,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,UAAU,CACrB,UAAkB,EAClB,OAAuB,EACvB,MAAc;IAEd,IAAI,CAAC;QACD,2BAA2B;QAC3B,MAAM,YAAY,GAAG,yBAAa,UAAU,uCAAC,CAAC;QAC9C,MAAM,MAAM,GAAW,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC;QAE5D,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QAED,oBAAoB;QACpB,MAAM,GAAG,GAAc;YACnB,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;gBAC5C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YAChD,CAAC;YACD,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC;QAEF,sBAAsB;QACtB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAErB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,MAAM,CAAC,IAAI,IAAI,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,UAAU,MAAM,KAAK,EAAE,CAAC,CAAC;IACpE,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CACxB,IAAY,EACZ,OAAe,EACf,QAAkC;IAElC,OAAO;QACH,IAAI;QACJ,OAAO;QACP,QAAQ;KACX,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PluginAPI } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Example plugin API exports for plugin developers
|
|
4
|
+
*/
|
|
5
|
+
export { createPlugin } from "./loader";
|
|
6
|
+
export type { Plugin, PluginAPI } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* Example plugin template
|
|
9
|
+
*/
|
|
10
|
+
export declare const examplePlugin: {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
register: (api: PluginAPI) => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=plugin_api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin_api.d.ts","sourceRoot":"","sources":["../../src/plugins/plugin_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,aAAa;;;oBAGN,SAAS;CAgB5B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.examplePlugin = exports.createPlugin = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Example plugin API exports for plugin developers
|
|
6
|
+
*/
|
|
7
|
+
var loader_1 = require("./loader");
|
|
8
|
+
Object.defineProperty(exports, "createPlugin", { enumerable: true, get: function () { return loader_1.createPlugin; } });
|
|
9
|
+
/**
|
|
10
|
+
* Example plugin template
|
|
11
|
+
*/
|
|
12
|
+
exports.examplePlugin = {
|
|
13
|
+
name: "example-plugin",
|
|
14
|
+
version: "1.0.0",
|
|
15
|
+
register: (api) => {
|
|
16
|
+
// Register a custom command
|
|
17
|
+
api.registerCommand("example", "An example plugin command", async (args) => {
|
|
18
|
+
api.render.header("Example Plugin");
|
|
19
|
+
api.render.text("This is an example plugin command!");
|
|
20
|
+
api.render.newline();
|
|
21
|
+
if (args.length > 0) {
|
|
22
|
+
api.render.info(`You passed: ${args.join(" ")}`);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=plugin_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin_api.js","sourceRoot":"","sources":["../../src/plugins/plugin_api.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAGrB;;GAEG;AACU,QAAA,aAAa,GAAG;IACzB,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,CAAC,GAAc,EAAE,EAAE;QACzB,4BAA4B;QAC5B,GAAG,CAAC,eAAe,CACf,SAAS,EACT,2BAA2B,EAC3B,KAAK,EAAE,IAAI,EAAE,EAAE;YACX,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACpC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;YACtD,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAErB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACrD,CAAC;QACL,CAAC,CACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typewriter effect for single string
|
|
3
|
+
*/
|
|
4
|
+
export declare function typewriter(text: string, options?: {
|
|
5
|
+
speed?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
bold?: boolean;
|
|
8
|
+
newline?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Typewriter effect for multiple lines
|
|
12
|
+
*/
|
|
13
|
+
export declare function typewriterLines(lines: string[], options?: {
|
|
14
|
+
speed?: number;
|
|
15
|
+
lineDelay?: number;
|
|
16
|
+
color?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Blinking cursor while "thinking"
|
|
20
|
+
*/
|
|
21
|
+
export declare function thinkingCursor(durationMs: number, message?: string): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../src/render/effects.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,UAAU,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CAChB,GACP,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;GAEG;AACH,wBAAsB,eAAe,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACrE,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;GAEG;AACH,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,SAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.typewriter = typewriter;
|
|
7
|
+
exports.typewriterLines = typewriterLines;
|
|
8
|
+
exports.thinkingCursor = thinkingCursor;
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
/**
|
|
11
|
+
* Typewriter effect for single string
|
|
12
|
+
*/
|
|
13
|
+
async function typewriter(text, options = {}) {
|
|
14
|
+
const { speed = 18, color, bold = false, newline = true } = options;
|
|
15
|
+
for (const char of text) {
|
|
16
|
+
let output = char;
|
|
17
|
+
if (color)
|
|
18
|
+
output = chalk_1.default.hex(color)(output);
|
|
19
|
+
if (bold)
|
|
20
|
+
output = chalk_1.default.bold(output);
|
|
21
|
+
process.stdout.write(output);
|
|
22
|
+
await sleep(speed);
|
|
23
|
+
}
|
|
24
|
+
if (newline)
|
|
25
|
+
process.stdout.write("\n");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Typewriter effect for multiple lines
|
|
29
|
+
*/
|
|
30
|
+
async function typewriterLines(lines, options = {}) {
|
|
31
|
+
const { lineDelay = 80 } = options;
|
|
32
|
+
for (const line of lines) {
|
|
33
|
+
await typewriter(line, options);
|
|
34
|
+
await sleep(lineDelay);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Blinking cursor while "thinking"
|
|
39
|
+
*/
|
|
40
|
+
async function thinkingCursor(durationMs, message = "Processing") {
|
|
41
|
+
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
42
|
+
let i = 0;
|
|
43
|
+
const interval = setInterval(() => {
|
|
44
|
+
process.stdout.write(`\r${chalk_1.default.cyan(frames[i % frames.length])} ${message}...`);
|
|
45
|
+
i++;
|
|
46
|
+
}, 80);
|
|
47
|
+
await sleep(durationMs);
|
|
48
|
+
clearInterval(interval);
|
|
49
|
+
process.stdout.write("\r" + " ".repeat(message.length + 10) + "\r");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Helper to sleep for a given duration
|
|
53
|
+
*/
|
|
54
|
+
function sleep(ms) {
|
|
55
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=effects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../../src/render/effects.ts"],"names":[],"mappings":";;;;;AAKA,gCAoBC;AAKD,0CASC;AAKD,wCAaC;AAzDD,kDAA0B;AAE1B;;GAEG;AACI,KAAK,UAAU,UAAU,CAC5B,IAAY,EACZ,UAKI,EAAE;IAEN,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEpE,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,MAAM,GA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,KAAK,CAAC,UAAU,CAAC,CAAC;IACxB,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,EAAU;IACrB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { RenderAPI, BoxOptions, TextStyle, Theme } from "../types";
|
|
2
|
+
export declare class Renderer implements RenderAPI {
|
|
3
|
+
private theme;
|
|
4
|
+
private typewriterMode;
|
|
5
|
+
constructor(theme: Theme);
|
|
6
|
+
/**
|
|
7
|
+
* Enable or disable typewriter effect globally for animated text
|
|
8
|
+
*/
|
|
9
|
+
setTypewriterMode(enabled: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* Render content in a box
|
|
12
|
+
*/
|
|
13
|
+
box(content: string, options?: BoxOptions): void;
|
|
14
|
+
/**
|
|
15
|
+
* Render a table
|
|
16
|
+
*/
|
|
17
|
+
table(data: Record<string, string>[], headers?: string[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Render styled text
|
|
20
|
+
*/
|
|
21
|
+
text(content: string, style?: TextStyle): void;
|
|
22
|
+
/**
|
|
23
|
+
* Clear the terminal
|
|
24
|
+
*/
|
|
25
|
+
clear(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Print a newline
|
|
28
|
+
*/
|
|
29
|
+
newline(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Render a gradient text
|
|
32
|
+
*/
|
|
33
|
+
gradient(text: string, colors?: string[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* Render a divider
|
|
36
|
+
*/
|
|
37
|
+
divider(char?: string, color?: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Render a header with ASCII art
|
|
40
|
+
*/
|
|
41
|
+
header(text: string, subtitle?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Render a list
|
|
44
|
+
*/
|
|
45
|
+
list(items: string[], bullet?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Render key-value pairs
|
|
48
|
+
*/
|
|
49
|
+
keyValue(data: Record<string, string>, indent?: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Render a success message
|
|
52
|
+
*/
|
|
53
|
+
success(message: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Render a warning message
|
|
56
|
+
*/
|
|
57
|
+
warning(message: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Render an error message
|
|
60
|
+
*/
|
|
61
|
+
error(message: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Render an info message
|
|
64
|
+
*/
|
|
65
|
+
info(message: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Render styled text with an optional typewriter effect
|
|
68
|
+
*/
|
|
69
|
+
textAnimated(content: string, style?: TextStyle): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGnE,qBAAa,QAAS,YAAW,SAAS;IAG1B,OAAO,CAAC,KAAK;IAFzB,OAAO,CAAC,cAAc,CAAkB;gBAEpB,KAAK,EAAE,KAAK;IAEhC;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,IAAI;IAWpD;;OAEG;IACH,KAAK,CAA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"default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Renderer = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
9
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
10
|
+
const gradient_string_1 = __importDefault(require("gradient-string"));
|
|
11
|
+
const effects_1 = require("./effects");
|
|
12
|
+
class Renderer {
|
|
13
|
+
theme;
|
|
14
|
+
typewriterMode = false;
|
|
15
|
+
constructor(theme) {
|
|
16
|
+
this.theme = theme;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Enable or disable typewriter effect globally for animated text
|
|
20
|
+
*/
|
|
21
|
+
setTypewriterMode(enabled) {
|
|
22
|
+
this.typewriterMode = enabled;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Render content in a box
|
|
26
|
+
*/
|
|
27
|
+
box(content, options = {}) {
|
|
28
|
+
const boxContent = (0, boxen_1.default)(content, {
|
|
29
|
+
padding: options.padding ?? 1,
|
|
30
|
+
borderStyle: options.borderStyle || "round",
|
|
31
|
+
borderColor: options.borderColor || this.theme.primary,
|
|
32
|
+
title: options.title,
|
|
33
|
+
titleAlignment: "center",
|
|
34
|
+
});
|
|
35
|
+
console.log(boxContent);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Render a table
|
|
39
|
+
*/
|
|
40
|
+
table(data, headers) {
|
|
41
|
+
if (data.length === 0) {
|
|
42
|
+
this.text("No data to display", { color: this.theme.dim });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const tableHeaders = headers || Object.keys(data[0]);
|
|
46
|
+
const table = new cli_table3_1.default({
|
|
47
|
+
head: tableHeaders.map((h) => chalk_1.default.hex(this.theme.primary).bold(h)),
|
|
48
|
+
style: {
|
|
49
|
+
head: [],
|
|
50
|
+
border: [this.theme.dim],
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
data.forEach((row) => {
|
|
54
|
+
table.push(tableHeaders.map((header) => row[header] || ""));
|
|
55
|
+
});
|
|
56
|
+
console.log(table.toString());
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Render styled text
|
|
60
|
+
*/
|
|
61
|
+
text(content, style = {}) {
|
|
62
|
+
let output = content;
|
|
63
|
+
if (style.color) {
|
|
64
|
+
output = chalk_1.default.hex(style.color)(output);
|
|
65
|
+
}
|
|
66
|
+
if (style.bold) {
|
|
67
|
+
output = chalk_1.default.bold(output);
|
|
68
|
+
}
|
|
69
|
+
if (style.italic) {
|
|
70
|
+
output = chalk_1.default.italic(output);
|
|
71
|
+
}
|
|
72
|
+
if (style.underline) {
|
|
73
|
+
output = chalk_1.default.underline(output);
|
|
74
|
+
}
|
|
75
|
+
console.log(output);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Clear the terminal
|
|
79
|
+
*/
|
|
80
|
+
clear() {
|
|
81
|
+
console.clear();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Print a newline
|
|
85
|
+
*/
|
|
86
|
+
newline() {
|
|
87
|
+
console.log();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Render a gradient text
|
|
91
|
+
*/
|
|
92
|
+
gradient(text, colors = [this.theme.primary, this.theme.secondary]) {
|
|
93
|
+
console.log((0, gradient_string_1.default)(...colors)(text));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Render a divider
|
|
97
|
+
*/
|
|
98
|
+
divider(char = "─", color) {
|
|
99
|
+
const width = process.stdout.columns || 80;
|
|
100
|
+
const line = char.repeat(width);
|
|
101
|
+
console.log(chalk_1.default.hex(color || this.theme.dim)(line));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Render a header with ASCII art
|
|
105
|
+
*/
|
|
106
|
+
header(text, subtitle) {
|
|
107
|
+
this.newline();
|
|
108
|
+
this.gradient(text, [this.theme.primary, this.theme.secondary]);
|
|
109
|
+
if (subtitle) {
|
|
110
|
+
this.text(subtitle, { color: this.theme.dim });
|
|
111
|
+
}
|
|
112
|
+
this.divider();
|
|
113
|
+
this.newline();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Render a list
|
|
117
|
+
*/
|
|
118
|
+
list(items, bullet = "•") {
|
|
119
|
+
items.forEach((item) => {
|
|
120
|
+
console.log(` ${chalk_1.default.hex(this.theme.accent)(bullet)} ${item}`);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Render key-value pairs
|
|
125
|
+
*/
|
|
126
|
+
keyValue(data, indent = 0) {
|
|
127
|
+
const padding = " ".repeat(indent);
|
|
128
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
129
|
+
const keyStr = chalk_1.default.hex(this.theme.primary).bold(key);
|
|
130
|
+
const valueStr = chalk_1.default.hex(this.theme.text)(value);
|
|
131
|
+
console.log(`${padding}${keyStr}: ${valueStr}`);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Render a success message
|
|
136
|
+
*/
|
|
137
|
+
success(message) {
|
|
138
|
+
console.log(chalk_1.default.hex(this.theme.success)("✓ " + message));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Render a warning message
|
|
142
|
+
*/
|
|
143
|
+
warning(message) {
|
|
144
|
+
console.log(chalk_1.default.hex(this.theme.warning)("⚠ " + message));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Render an error message
|
|
148
|
+
*/
|
|
149
|
+
error(message) {
|
|
150
|
+
console.log(chalk_1.default.hex(this.theme.error)("✗ " + message));
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Render an info message
|
|
154
|
+
*/
|
|
155
|
+
info(message) {
|
|
156
|
+
console.log(chalk_1.default.hex(this.theme.primary)("ℹ " + message));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Render styled text with an optional typewriter effect
|
|
160
|
+
*/
|
|
161
|
+
async textAnimated(content, style = {}) {
|
|
162
|
+
if (this.typewriterMode) {
|
|
163
|
+
await (0, effects_1.typewriter)(content, {
|
|
164
|
+
color: style.color,
|
|
165
|
+
bold: style.bold,
|
|
166
|
+
newline: true
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.text(content, style);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.Renderer = Renderer;
|
|
175
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/render/renderer.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAC1B,4DAA+B;AAC/B,sEAAuC;AAEvC,uCAAuC;AAEvC,MAAa,QAAQ;IAGG;IAFZ,cAAc,GAAY,KAAK,CAAC;IAExC,YAAoB,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAI,CAAC;IAErC;;OAEG;IACH,iBAAiB,CAAC,OAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,OAAe,EAAE,UAAsB,EAAE;QACzC,MAAM,UAAU,GAAG,IAAA,eAAK,EAAC,OAAO,EAAE;YAC9B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC;YAC7B,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,OAAO;YAC3C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO;YACtD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,QAAQ;SAC3B,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAA8B,EA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C,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,OAAe;QACnB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAe;QACjB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAe;QAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,QAAmB,EAAE;QACrD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,IAAA,oBAAU,EAAC,OAAO,EAAE;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,IAAI;aAChB,CAAC,CAAC;QACP,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC;CACJ;AAnLD,4BAmLC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TermfolioConfig } from "../types";
|
|
2
|
+
export declare class ShellEngine {
|
|
3
|
+
private config;
|
|
4
|
+
private router;
|
|
5
|
+
private context;
|
|
6
|
+
private running;
|
|
7
|
+
private lastCommand;
|
|
8
|
+
private commandCount;
|
|
9
|
+
private currentContext;
|
|
10
|
+
constructor(config: TermfolioConfig);
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
start(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Determine current context based on last command
|
|
15
|
+
*/
|
|
16
|
+
private getContextFromCommand;
|
|
17
|
+
/**
|
|
18
|
+
* Get current time in HH:MM format
|
|
19
|
+
*/
|
|
20
|
+
private getTime;
|
|
21
|
+
/**
|
|
22
|
+
* Get a context icon based on current state
|
|
23
|
+
*/
|
|
24
|
+
private getContextIcon;
|
|
25
|
+
/**
|
|
26
|
+
* Generate dynamic, context-aware prompt based on config selection
|
|
27
|
+
*/
|
|
28
|
+
private getPrompt;
|
|
29
|
+
/**
|
|
30
|
+
* STYLE 1: Git-style prompt
|
|
31
|
+
*/
|
|
32
|
+
private getGitStylePrompt;
|
|
33
|
+
/**
|
|
34
|
+
* STYLE 2: Time + Context prompt
|
|
35
|
+
*/
|
|
36
|
+
private getTimeContextPrompt;
|
|
37
|
+
/**
|
|
38
|
+
* STYLE 3: Full developer dashboard prompt
|
|
39
|
+
*/
|
|
40
|
+
private getDevDashboardPrompt;
|
|
41
|
+
/**
|
|
42
|
+
* STYLE 4: Minimal Zsh-style prompt
|
|
43
|
+
*/
|
|
44
|
+
private getMinimalPrompt;
|
|
45
|
+
/**
|
|
46
|
+
* STYLE 5: Cyberpunk/Matrix style
|
|
47
|
+
*/
|
|
48
|
+
private getCyberpunkPrompt;
|
|
49
|
+
stop(): void;
|
|
50
|
+
private exit;
|
|
51
|
+
setupSignalHandlers(): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/shell/engine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAQ3D,qBAAa,WAAW;IAQV,OAAO,CAAC,MAAM;IAP1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,cAAc,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAcrC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8C5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAa7B;;OAEG;IACH,OAAO,CAAC,OAAO;IASf;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;OAEG;IACH,OAAO,CAAC,SAAS;IAqBjB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAc1B,IAAI,IAAI,IAAI;IAIZ,OAAO,CAAC,IAAI;IAQZ,mBAAmB,IAAI,IAAI;CAU5B"}
|