kailogger 1.0.0-dark.red → 1.0.2

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.
Files changed (102) hide show
  1. package/README.md +195 -53
  2. package/dist/core/Config.d.ts +15 -0
  3. package/dist/core/Config.js +44 -0
  4. package/dist/core/Logger.d.ts +75 -4
  5. package/dist/core/Logger.js +375 -47
  6. package/dist/core/Scope.d.ts +13 -0
  7. package/dist/core/Scope.js +36 -0
  8. package/dist/features/Chart.d.ts +15 -0
  9. package/dist/features/Chart.js +64 -0
  10. package/dist/features/Diff.d.ts +3 -0
  11. package/dist/features/Diff.js +30 -0
  12. package/dist/features/Encrypt.d.ts +10 -0
  13. package/dist/features/Encrypt.js +47 -0
  14. package/dist/features/Notify.d.ts +14 -0
  15. package/dist/features/Notify.js +70 -0
  16. package/dist/features/Screenshot.d.ts +10 -0
  17. package/dist/features/Screenshot.js +106 -0
  18. package/dist/features/Sound.d.ts +12 -0
  19. package/dist/features/Sound.js +116 -0
  20. package/dist/features/Timer.d.ts +6 -0
  21. package/dist/features/Timer.js +38 -0
  22. package/dist/features/Tree.d.ts +7 -0
  23. package/dist/features/Tree.js +25 -0
  24. package/dist/features/index.d.ts +8 -0
  25. package/dist/features/index.js +24 -0
  26. package/dist/icon/logo.png +0 -0
  27. package/dist/index.d.ts +13 -1
  28. package/dist/index.js +21 -1
  29. package/dist/sounds/error.wav +0 -0
  30. package/dist/sounds/notification.wav +0 -0
  31. package/dist/sounds/success.wav +0 -0
  32. package/dist/sounds/warning.wav +0 -0
  33. package/dist/styles/KaiChroma.d.ts +85 -0
  34. package/dist/styles/KaiChroma.js +407 -0
  35. package/dist/styles/gradients.d.ts +28 -0
  36. package/dist/styles/palettes.d.ts +21 -26
  37. package/dist/styles/palettes.js +167 -13
  38. package/dist/transports/ConsoleTransport.d.ts +9 -0
  39. package/dist/transports/ConsoleTransport.js +18 -0
  40. package/dist/transports/FileTransport.d.ts +16 -0
  41. package/dist/transports/FileTransport.js +84 -0
  42. package/dist/transports/WebhookTransport.d.ts +15 -0
  43. package/dist/transports/WebhookTransport.js +31 -0
  44. package/dist/transports/index.d.ts +3 -0
  45. package/dist/transports/index.js +19 -0
  46. package/dist/types/index.d.ts +16 -0
  47. package/dist/types/index.js +11 -0
  48. package/dist/utils/json.d.ts +3 -0
  49. package/dist/utils/json.js +33 -0
  50. package/dist/utils/prettyError.d.ts +3 -0
  51. package/dist/utils/prettyError.js +94 -0
  52. package/dist/utils/progress.d.ts +11 -0
  53. package/dist/utils/progress.js +43 -0
  54. package/dist/utils/prompt.d.ts +4 -0
  55. package/dist/utils/prompt.js +59 -0
  56. package/dist/utils/selection.d.ts +4 -0
  57. package/dist/utils/selection.js +156 -0
  58. package/dist/utils/spinner.d.ts +1 -1
  59. package/dist/utils/spinner.js +9 -13
  60. package/dist/utils/stripAnsi.d.ts +1 -0
  61. package/dist/utils/stripAnsi.js +7 -0
  62. package/dist/utils/table.d.ts +3 -0
  63. package/dist/utils/table.js +35 -0
  64. package/examples/demo.js +134 -0
  65. package/examples/demo.ts +88 -25
  66. package/package.json +20 -6
  67. package/scripts/copy-assets.js +37 -0
  68. package/src/core/Config.ts +44 -0
  69. package/src/core/Logger.ts +427 -51
  70. package/src/core/Scope.ts +35 -0
  71. package/src/features/Chart.ts +81 -0
  72. package/src/features/Diff.ts +25 -0
  73. package/src/features/Encrypt.ts +47 -0
  74. package/src/features/Notify.ts +39 -0
  75. package/src/features/Screenshot.ts +70 -0
  76. package/src/features/Sound.ts +92 -0
  77. package/src/features/Timer.ts +35 -0
  78. package/src/features/Tree.ts +25 -0
  79. package/src/features/index.ts +8 -0
  80. package/src/icon/logo.png +0 -0
  81. package/src/index.ts +13 -1
  82. package/src/sounds/error.wav +0 -0
  83. package/src/sounds/notification.wav +0 -0
  84. package/src/sounds/success.wav +0 -0
  85. package/src/sounds/warning.wav +0 -0
  86. package/src/styles/KaiChroma.ts +370 -0
  87. package/src/styles/palettes.ts +197 -14
  88. package/src/transports/ConsoleTransport.ts +19 -0
  89. package/src/transports/FileTransport.ts +55 -0
  90. package/src/transports/WebhookTransport.ts +37 -0
  91. package/src/transports/index.ts +3 -0
  92. package/src/types/cli-highlight.d.ts +3 -0
  93. package/src/types/index.ts +23 -0
  94. package/src/utils/json.ts +33 -0
  95. package/src/utils/prettyError.ts +65 -0
  96. package/src/utils/progress.ts +56 -0
  97. package/src/utils/prompt.ts +27 -0
  98. package/src/utils/selection.ts +136 -0
  99. package/src/utils/spinner.ts +11 -7
  100. package/src/utils/stripAnsi.ts +6 -0
  101. package/src/utils/table.ts +38 -0
  102. package/src/styles/gradients.ts +0 -22
@@ -1,38 +1,34 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.KaiSpinner = void 0;
7
- const process_1 = __importDefault(require("process"));
8
- const chalk_1 = __importDefault(require("chalk"));
4
+ const KaiChroma_1 = require("../styles/KaiChroma");
9
5
  const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
10
6
  class KaiSpinner {
11
7
  constructor() {
12
8
  this.timer = null;
13
9
  this.index = 0;
14
10
  this.text = '';
15
- this.colorFn = chalk_1.default.cyan;
11
+ this.colorHex = '#00FFFF'; // Default cyan-ish
16
12
  }
17
13
  start(text, colorHex = '#00FFFF') {
18
14
  this.stop();
19
15
  this.text = text;
20
- this.colorFn = chalk_1.default.hex(colorHex);
21
- process_1.default.stdout.write('\x1B[?25l');
16
+ this.colorHex = colorHex;
17
+ process.stdout.write('\x1B[?25l');
22
18
  this.timer = setInterval(() => {
23
19
  const frame = frames[this.index = ++this.index % frames.length];
24
- process_1.default.stdout.write(`\r${this.colorFn(frame)} ${this.text}`);
20
+ process.stdout.write(`\r${KaiChroma_1.KaiChroma.hex(this.colorHex, frame)} ${this.text}`);
25
21
  }, 80);
26
22
  }
27
23
  stop(symbol = '✔', endText, colorHex) {
28
24
  if (this.timer) {
29
25
  clearInterval(this.timer);
30
26
  this.timer = null;
31
- process_1.default.stdout.write('\r\x1B[K');
32
- process_1.default.stdout.write('\x1B[?25h');
27
+ process.stdout.write('\r\x1B[K');
28
+ process.stdout.write('\x1B[?25h');
33
29
  if (endText) {
34
- const finalColor = colorHex ? chalk_1.default.hex(colorHex) : this.colorFn;
35
- console.log(`${finalColor(symbol)} ${endText}`);
30
+ const finalColor = colorHex || this.colorHex;
31
+ console.log(`${KaiChroma_1.KaiChroma.hex(finalColor, symbol)} ${endText}`);
36
32
  }
37
33
  }
38
34
  }
@@ -0,0 +1 @@
1
+ export declare function stripAnsi(str: string): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripAnsi = stripAnsi;
4
+ const KaiChroma_1 = require("../styles/KaiChroma");
5
+ function stripAnsi(str) {
6
+ return KaiChroma_1.KaiChroma.strip(str);
7
+ }
@@ -0,0 +1,3 @@
1
+ export declare class KaiTable {
2
+ static print(data: any[], theme: any): void;
3
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KaiTable = void 0;
4
+ const KaiChroma_1 = require("../styles/KaiChroma");
5
+ const palettes_1 = require("../styles/palettes");
6
+ class KaiTable {
7
+ static print(data, theme) {
8
+ if (data.length === 0)
9
+ return;
10
+ const keys = Object.keys(data[0]);
11
+ const colWidths = keys.map(key => {
12
+ const maxValLen = Math.max(...data.map(row => String(row[key]).length));
13
+ return Math.max(key.length, maxValLen) + 2;
14
+ });
15
+ const createRow = (rowItems, isHeader = false) => {
16
+ return rowItems.map((item, i) => {
17
+ const cell = item.padEnd(colWidths[i]);
18
+ return isHeader
19
+ ? palettes_1.paint.apply(cell, theme.info)
20
+ : cell;
21
+ }).join(' │ ');
22
+ };
23
+ const separator = colWidths.map(w => '─'.repeat(w)).join('─┼─');
24
+ const dimColor = (text) => KaiChroma_1.KaiChroma.hex(theme.dim, text);
25
+ console.log(dimColor(separator));
26
+ console.log(createRow(keys, true));
27
+ console.log(dimColor(separator));
28
+ data.forEach(row => {
29
+ const values = keys.map(k => String(row[k]));
30
+ console.log(createRow(values));
31
+ });
32
+ console.log(dimColor(separator));
33
+ }
34
+ }
35
+ exports.KaiTable = KaiTable;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var src_1 = require("../src");
40
+ var path = require("path");
41
+ function runDemo() {
42
+ return __awaiter(this, void 0, void 0, function () {
43
+ return __generator(this, function (_a) {
44
+ switch (_a.label) {
45
+ case 0:
46
+ console.clear();
47
+ src_1.kai.setSoundsDir(path.join(__dirname, '../src/sounds'));
48
+ src_1.kai.box('KaiLogger v1.0.1', 'Now with Charts, Notifications, Screenshots & More!');
49
+ console.log('\n');
50
+ src_1.kai.info('📋 Basic Logging');
51
+ src_1.kai.success('Operation completed');
52
+ src_1.kai.warning('Low memory');
53
+ src_1.kai.error('Connection failed');
54
+ console.log('\n');
55
+ src_1.kai.info('📊 Charts Demo');
56
+ src_1.kai.chart([
57
+ { label: 'Users', value: 1500 },
58
+ { label: 'Sales', value: 890 },
59
+ { label: 'Orders', value: 450 },
60
+ { label: 'Returns', value: 32 }
61
+ ]);
62
+ // Sparkline
63
+ src_1.kai.info('📈 Sparkline (CPU usage over time)');
64
+ src_1.kai.sparkline([10, 25, 30, 15, 45, 60, 55, 70, 85, 60, 40, 30]);
65
+ // Gauge
66
+ console.log('');
67
+ src_1.kai.gauge(75, 100, 'Memory');
68
+ src_1.kai.gauge(45, 100, 'CPU');
69
+ src_1.kai.gauge(95, 100, 'Disk');
70
+ // ===== ENCRYPTION =====
71
+ console.log('\n');
72
+ src_1.kai.info('🔐 Encryption Demo');
73
+ src_1.kai.masked('API Key', 'sk-1234567890abcdef', 4);
74
+ src_1.kai.masked('Password', 'superSecretPassword123', 3);
75
+ src_1.kai.encrypted('This is a secret message!', 'my-secret-key');
76
+ // ===== TREE =====
77
+ console.log('\n');
78
+ src_1.kai.info('🌳 Tree View');
79
+ src_1.kai.tree({
80
+ src: {
81
+ core: { 'Logger.ts': null },
82
+ features: { 'Chart.ts': null, 'Sound.ts': null },
83
+ sounds: { 'success.wav': null, 'error.wav': null }
84
+ },
85
+ 'package.json': null
86
+ });
87
+ // ===== TABLE =====
88
+ console.log('\n');
89
+ src_1.kai.info('📉 Table');
90
+ src_1.kai.table([
91
+ { name: 'Kai', role: 'Admin', status: '🟢' },
92
+ { name: 'Neo', role: 'User', status: '🟡' },
93
+ { name: 'Trinity', role: 'Mod', status: '🔴' }
94
+ ]);
95
+ // ===== SOUNDS =====
96
+ console.log('\n');
97
+ src_1.kai.info('🔊 Sound Demo');
98
+ src_1.kai.info('Playing success sound...');
99
+ return [4 /*yield*/, src_1.kai.soundSuccess()];
100
+ case 1:
101
+ _a.sent();
102
+ return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 500); })];
103
+ case 2:
104
+ _a.sent();
105
+ src_1.kai.warning('Playing warning sound...');
106
+ return [4 /*yield*/, src_1.kai.soundWarning()];
107
+ case 3:
108
+ _a.sent();
109
+ return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 500); })];
110
+ case 4:
111
+ _a.sent();
112
+ src_1.kai.error('Playing error sound...');
113
+ return [4 /*yield*/, src_1.kai.soundError()];
114
+ case 5:
115
+ _a.sent();
116
+ return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 500); })];
117
+ case 6:
118
+ _a.sent();
119
+ // ===== NOTIFICATION =====
120
+ console.log('\n');
121
+ src_1.kai.info('💬 Sending Desktop Notification...');
122
+ src_1.kai.notify('KaiLogger demo finished!', '✅ Success');
123
+ return [4 /*yield*/, src_1.kai.soundNotification()];
124
+ case 7:
125
+ _a.sent();
126
+ // ===== DONE =====
127
+ console.log('\n');
128
+ src_1.kai.success('✨ Demo complete! KaiLogger v2.1.0 is ready.');
129
+ return [2 /*return*/];
130
+ }
131
+ });
132
+ });
133
+ }
134
+ runDemo();
package/examples/demo.ts CHANGED
@@ -1,28 +1,91 @@
1
1
  import { kai } from '../src';
2
+ import * as path from 'path';
2
3
 
3
- console.log('\n--- Kai (Zen) Mode (Default) ---\n');
4
- kai.info('This is an info message');
5
- kai.success('Database connected successfully');
6
- kai.warning('Memory usage is high');
7
- kai.error('Connection timed out');
8
- kai.debug('Variable x = 10');
4
+ async function runDemo() {
5
+ console.clear();
6
+ kai.setSoundsDir(path.join(__dirname, '../src/sounds'));
7
+ kai.box('KaiLogger v1.0.1', 'Now with Charts, Notifications, Screenshots & More!');
8
+ console.log('\n');
9
+ kai.info('📋 Basic Logging');
10
+ kai.success('Operation completed');
11
+ kai.warning('Low memory');
12
+ kai.error('Connection failed');
13
+ console.log('\n');
14
+ kai.info('📊 Charts Demo');
15
+ kai.chart([
16
+ { label: 'Users', value: 1500 },
17
+ { label: 'Sales', value: 890 },
18
+ { label: 'Orders', value: 450 },
19
+ { label: 'Returns', value: 32 }
20
+ ]);
21
+
22
+ // Sparkline
23
+ kai.info('📈 Sparkline (CPU usage over time)');
24
+ kai.sparkline([10, 25, 30, 15, 45, 60, 55, 70, 85, 60, 40, 30]);
25
+
26
+ // Gauge
27
+ console.log('');
28
+ kai.gauge(75, 100, 'Memory');
29
+ kai.gauge(45, 100, 'CPU');
30
+ kai.gauge(95, 100, 'Disk');
31
+
32
+ // ===== ENCRYPTION =====
33
+ console.log('\n');
34
+ kai.info('🔐 Encryption Demo');
35
+
36
+ kai.masked('API Key', 'sk-1234567890abcdef', 4);
37
+ kai.masked('Password', 'superSecretPassword123', 3);
38
+
39
+ kai.encrypted('This is a secret message!', 'my-secret-key');
40
+
41
+ // ===== TREE =====
42
+ console.log('\n');
43
+ kai.info('🌳 Tree View');
44
+
45
+ kai.tree({
46
+ src: {
47
+ core: { 'Logger.ts': null },
48
+ features: { 'Chart.ts': null, 'Sound.ts': null },
49
+ sounds: { 'success.wav': null, 'error.wav': null }
50
+ },
51
+ 'package.json': null
52
+ });
53
+
54
+ // ===== TABLE =====
55
+ console.log('\n');
56
+ kai.info('📉 Table');
57
+
58
+ kai.table([
59
+ { name: 'Kai', role: 'Admin', status: '🟢' },
60
+ { name: 'Neo', role: 'User', status: '🟡' },
61
+ { name: 'Trinity', role: 'Mod', status: '🔴' }
62
+ ]);
63
+
64
+ // ===== SOUNDS =====
65
+ console.log('\n');
66
+ kai.info('🔊 Sound Demo');
67
+
68
+ kai.info('Playing success sound...');
69
+ await kai.soundSuccess();
70
+ await new Promise(r => setTimeout(r, 500));
71
+
72
+ kai.warning('Playing warning sound...');
73
+ await kai.soundWarning();
74
+ await new Promise(r => setTimeout(r, 500));
75
+
76
+ kai.error('Playing error sound...');
77
+ await kai.soundError();
78
+ await new Promise(r => setTimeout(r, 500));
79
+
80
+ // ===== NOTIFICATION =====
81
+ console.log('\n');
82
+ kai.info('💬 Sending Desktop Notification...');
83
+ kai.notify('KaiLogger demo finished!', '✅ Success');
84
+ await kai.soundNotification();
85
+
86
+ // ===== DONE =====
87
+ console.log('\n');
88
+ kai.success('✨ Demo complete! KaiLogger v2.1.0 is ready.');
89
+ }
9
90
 
10
- console.log('\n--- Neon Mode ---\n');
11
- kai.setTheme('neon');
12
- kai.info('Neon Info');
13
- kai.success('Neon Success');
14
- kai.warning('Neon Warning');
15
- kai.error('Neon Error');
16
-
17
- console.log('\n--- Pastel Mode ---\n');
18
- kai.setTheme('pastel');
19
- kai.info('Pastel Info');
20
- kai.success('Pastel Success');
21
-
22
- console.log('\n--- Animation Test ---\n');
23
- kai.setTheme('zen');
24
- kai.await('Loading quantum matrix...');
25
-
26
- setTimeout(() => {
27
- kai.stop('Matrix loaded!');
28
- }, 2000);
91
+ runDemo();
package/package.json CHANGED
@@ -1,21 +1,35 @@
1
1
  {
2
2
  "name": "kailogger",
3
- "version": "1.0.0-dark.red",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
- "main": "index.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Soblend-Development/kailogger.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/Soblend-Development/kailogger/issues"
11
+ },
12
+ "homepage": "https://github.com/Soblend-Development/kailogger#readme",
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
6
15
  "scripts": {
16
+ "build": "tsc && node scripts/copy-assets.js",
7
17
  "test": "echo \"Error: no test specified\" && exit 1"
8
18
  },
9
19
  "keywords": [],
10
- "author": "",
20
+ "author": "Soblend Development",
11
21
  "license": "ISC",
12
22
  "devDependencies": {
23
+ "@types/crypto-js": "^4.2.2",
13
24
  "@types/node": "^25.0.3",
25
+ "@types/node-notifier": "^8.0.5",
26
+ "@types/stack-trace": "^0.0.33",
14
27
  "ts-node": "^10.9.2",
15
28
  "typescript": "^5.9.3"
16
29
  },
17
30
  "dependencies": {
18
- "chalk": "^4.1.2",
19
- "gradient-string": "^3.0.0"
31
+ "crypto-js": "^4.2.0",
32
+ "node-notifier": "^10.0.1",
33
+ "stack-trace": "^1.0.0-pre2"
20
34
  }
21
- }
35
+ }
@@ -0,0 +1,37 @@
1
+
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const rootDir = path.resolve(__dirname, '..');
6
+ const srcDir = path.join(rootDir, 'src');
7
+ const distDir = path.join(rootDir, 'dist');
8
+
9
+ console.log('📦 Copying assets...');
10
+
11
+ // Copy sounds
12
+ const soundsSrc = path.join(srcDir, 'sounds');
13
+ const soundsDist = path.join(distDir, 'sounds');
14
+
15
+ if (fs.existsSync(soundsSrc)) {
16
+ if (!fs.existsSync(soundsDist)) fs.mkdirSync(soundsDist, { recursive: true });
17
+ fs.readdirSync(soundsSrc).forEach(file => {
18
+ if (file.endsWith('.wav') || file.endsWith('.mp3')) {
19
+ fs.copyFileSync(path.join(soundsSrc, file), path.join(soundsDist, file));
20
+ }
21
+ });
22
+ console.log(' ✔ Sounds copied');
23
+ }
24
+
25
+ // Copy icon
26
+ const iconSrc = path.join(srcDir, 'icon');
27
+ const iconDist = path.join(distDir, 'icon');
28
+
29
+ if (fs.existsSync(iconSrc)) {
30
+ if (!fs.existsSync(iconDist)) fs.mkdirSync(iconDist, { recursive: true });
31
+ fs.readdirSync(iconSrc).forEach(file => {
32
+ fs.copyFileSync(path.join(iconSrc, file), path.join(iconDist, file));
33
+ });
34
+ console.log(' ✔ Icon copied');
35
+ }
36
+
37
+ console.log('✨ Build assets complete');
@@ -0,0 +1,44 @@
1
+ import { KaiConfig, LogLevel, Transport } from '../types';
2
+ import { ThemeName } from '../styles/palettes';
3
+
4
+ const DEFAULT_CONFIG: KaiConfig = {
5
+ theme: 'zen',
6
+ level: 'debug',
7
+ timestamp: 'locale',
8
+ silent: false,
9
+ transports: []
10
+ };
11
+ class ConfigManager {
12
+ private static instance: ConfigManager;
13
+ private config: KaiConfig = { ...DEFAULT_CONFIG };
14
+ private constructor() {}
15
+ static getInstance(): ConfigManager {
16
+ if (!ConfigManager.instance) {
17
+ ConfigManager.instance = new ConfigManager();
18
+ }
19
+ return ConfigManager.instance;
20
+ }
21
+ configure(options: Partial<KaiConfig>): void {
22
+ this.config = { ...this.config, ...options };
23
+ }
24
+ get<K extends keyof KaiConfig>(key: K): KaiConfig[K] {
25
+ return this.config[key];
26
+ }
27
+ getAll(): KaiConfig {
28
+ return { ...this.config };
29
+ }
30
+ reset(): void {
31
+ this.config = { ...DEFAULT_CONFIG };
32
+ }
33
+ addTransport(transport: Transport): void {
34
+ if (!this.config.transports) this.config.transports = [];
35
+ this.config.transports.push(transport);
36
+ }
37
+ removeTransport(name: string): void {
38
+ if (this.config.transports) {
39
+ this.config.transports = this.config.transports.filter(t => t.name !== name);
40
+ }
41
+ }
42
+ }
43
+
44
+ export const config = ConfigManager.getInstance();