4runr-os 2.0.35 → 2.0.37
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/collectors/collector_feed.d.ts.map +1 -1
- package/dist/collectors/collector_feed.js +6 -1
- package/dist/collectors/collector_feed.js.map +1 -1
- package/dist/core/commandExecutor.d.ts +56 -0
- package/dist/core/commandExecutor.d.ts.map +1 -0
- package/dist/core/commandExecutor.js +161 -0
- package/dist/core/commandExecutor.js.map +1 -0
- package/dist/core/commandRegistry.d.ts +72 -0
- package/dist/core/commandRegistry.d.ts.map +1 -0
- package/dist/core/commandRegistry.js +53 -0
- package/dist/core/commandRegistry.js.map +1 -0
- package/dist/core/commands/size.d.ts +23 -0
- package/dist/core/commands/size.d.ts.map +1 -0
- package/dist/core/commands/size.js +211 -0
- package/dist/core/commands/size.js.map +1 -0
- package/dist/core/eventBus.d.ts +29 -14
- package/dist/core/eventBus.d.ts.map +1 -1
- package/dist/core/eventBus.js +56 -23
- package/dist/core/eventBus.js.map +1 -1
- package/dist/core/opEvent.d.ts +16 -0
- package/dist/core/opEvent.d.ts.map +1 -0
- package/dist/core/opEvent.js +8 -0
- package/dist/core/opEvent.js.map +1 -0
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/ui/v3/commands/commandEngine.js +16 -2
- package/dist/ui/v3/commands/commandEngine.js.map +1 -1
- package/dist/ui/v3/index.js +32 -11
- package/dist/ui/v3/index.js.map +1 -1
- package/dist/ui/v3/ui/layout/phase1Layout.d.ts.map +1 -1
- package/dist/ui/v3/ui/layout/phase1Layout.js +3 -2
- package/dist/ui/v3/ui/layout/phase1Layout.js.map +1 -1
- package/dist/ui/v4/engine/renderFrame.d.ts +47 -0
- package/dist/ui/v4/engine/renderFrame.d.ts.map +1 -0
- package/dist/ui/v4/engine/renderFrame.js +653 -0
- package/dist/ui/v4/engine/renderFrame.js.map +1 -0
- package/dist/ui/v4/engine/resizeController.d.ts +48 -0
- package/dist/ui/v4/engine/resizeController.d.ts.map +1 -0
- package/dist/ui/v4/engine/resizeController.js +285 -0
- package/dist/ui/v4/engine/resizeController.js.map +1 -0
- package/dist/ui/v4/engine/safeViewport.d.ts +47 -0
- package/dist/ui/v4/engine/safeViewport.d.ts.map +1 -0
- package/dist/ui/v4/engine/safeViewport.js +123 -0
- package/dist/ui/v4/engine/safeViewport.js.map +1 -0
- package/dist/ui/v4/engine/terminalProfile.d.ts +56 -0
- package/dist/ui/v4/engine/terminalProfile.d.ts.map +1 -0
- package/dist/ui/v4/engine/terminalProfile.js +115 -0
- package/dist/ui/v4/engine/terminalProfile.js.map +1 -0
- package/dist/ui/v4/index.d.ts +28 -0
- package/dist/ui/v4/index.d.ts.map +1 -0
- package/dist/ui/v4/index.js +993 -0
- package/dist/ui/v4/index.js.map +1 -0
- package/dist/ui/v4/layout/layoutEngine.d.ts +62 -0
- package/dist/ui/v4/layout/layoutEngine.d.ts.map +1 -0
- package/dist/ui/v4/layout/layoutEngine.js +294 -0
- package/dist/ui/v4/layout/layoutEngine.js.map +1 -0
- package/dist/ui/v4/runtime/keepAlive.d.ts +21 -0
- package/dist/ui/v4/runtime/keepAlive.d.ts.map +1 -0
- package/dist/ui/v4/runtime/keepAlive.js +149 -0
- package/dist/ui/v4/runtime/keepAlive.js.map +1 -0
- package/dist/ui/v4/runtime/logger.d.ts +35 -0
- package/dist/ui/v4/runtime/logger.d.ts.map +1 -0
- package/dist/ui/v4/runtime/logger.js +109 -0
- package/dist/ui/v4/runtime/logger.js.map +1 -0
- package/dist/ui/v5/index.d.ts +24 -0
- package/dist/ui/v5/index.d.ts.map +1 -0
- package/dist/ui/v5/index.js +123 -0
- package/dist/ui/v5/index.js.map +1 -0
- package/dist/ui/v5/runtime/keepAlive.d.ts +37 -0
- package/dist/ui/v5/runtime/keepAlive.d.ts.map +1 -0
- package/dist/ui/v5/runtime/keepAlive.js +122 -0
- package/dist/ui/v5/runtime/keepAlive.js.map +1 -0
- package/dist/ui/v5/runtime/restoreTerminal.d.ts +34 -0
- package/dist/ui/v5/runtime/restoreTerminal.d.ts.map +1 -0
- package/dist/ui/v5/runtime/restoreTerminal.js +100 -0
- package/dist/ui/v5/runtime/restoreTerminal.js.map +1 -0
- package/dist/ui/v5/runtime/stdoutGuard.d.ts +42 -0
- package/dist/ui/v5/runtime/stdoutGuard.d.ts.map +1 -0
- package/dist/ui/v5/runtime/stdoutGuard.js +154 -0
- package/dist/ui/v5/runtime/stdoutGuard.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector_feed.d.ts","sourceRoot":"","sources":["../../src/collectors/collector_feed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;QACzD,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;CACJ,CAAC;AASF;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAYxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,GAAE,MAAW,GAAG,SAAS,EAAE,CAEzD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"collector_feed.d.ts","sourceRoot":"","sources":["../../src/collectors/collector_feed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;QACzD,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;CACJ,CAAC;AASF;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAYxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,GAAE,MAAW,GAAG,SAAS,EAAE,CAEzD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAOlE;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAwCtE"}
|
|
@@ -37,6 +37,7 @@ export function pushEvent(tag, msg) {
|
|
|
37
37
|
tag,
|
|
38
38
|
msg,
|
|
39
39
|
ts: Date.now(),
|
|
40
|
+
level: 'INFO', // Add required level field
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -44,7 +45,11 @@ export function pushEvent(tag, msg) {
|
|
|
44
45
|
*/
|
|
45
46
|
export async function collectFeed() {
|
|
46
47
|
try {
|
|
47
|
-
|
|
48
|
+
// Filter events to only include compatible tags for FeedData
|
|
49
|
+
const compatibleTags = ['RUN', 'NET', 'SEC', 'DB', 'GATEWAY', 'SYSTEM'];
|
|
50
|
+
const events = getEvents(12)
|
|
51
|
+
.filter((e) => compatibleTags.includes(e.tag))
|
|
52
|
+
.map(e => ({
|
|
48
53
|
ts: e.ts,
|
|
49
54
|
tag: e.tag,
|
|
50
55
|
msg: e.msg,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector_feed.js","sourceRoot":"","sources":["../../src/collectors/collector_feed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAU/D,6DAA6D;AAC7D,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,UAAU,GAAgB,EAAE,CAAC;AAEnC,yBAAyB;AACzB,IAAI,WAAW,GAAwB,IAAI,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAgB,EAAE,EAAE;QACpD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,iCAAiC;QACjC,IAAI,UAAU,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;YACxC,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB,EAAE;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,eAAe;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAqB,EAAE,GAAW;IAC1D,QAAQ,CAAC,IAAI,CAAC;QACZ,GAAG;QACH,GAAG;QACH,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"collector_feed.js","sourceRoot":"","sources":["../../src/collectors/collector_feed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAU/D,6DAA6D;AAC7D,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,UAAU,GAAgB,EAAE,CAAC;AAEnC,yBAAyB;AACzB,IAAI,WAAW,GAAwB,IAAI,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G,EAAE,CAAC,CAAC,GAAG;SACX,CAAC,CAAC,CAAC;QAEN,MAAM,IAAI,GAAa;YACrB,MAAM;SACP,CAAC;QAEF,iDAAiD;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAoB,MAAM,CAAC;QAEvC,OAAO;YACL,MAAM;YACN,IAAI,EAAE,GAAG;YACT,IAAI;YACJ,MAAM,EAAE,gBAAgB;YACxB,YAAY,EAAE,CAAC,EAAE,uCAAuC;SACzD,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;YAChB,MAAM,EAAE,gBAAgB;YACxB,YAAY,EAAE,CAAC;YACf,UAAU,EAAE,kBAAkB;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,eAAe;YACzC,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Command Executor
|
|
3
|
+
*
|
|
4
|
+
* UI-agnostic command execution engine.
|
|
5
|
+
*
|
|
6
|
+
* Input: raw string command line
|
|
7
|
+
* Output: structured result (events, actions, state updates)
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities:
|
|
10
|
+
* - Parse command name + args
|
|
11
|
+
* - Lookup in registry
|
|
12
|
+
* - Execute handler
|
|
13
|
+
* - Route output to eventBus (or return results for UI to display)
|
|
14
|
+
*
|
|
15
|
+
* No console.log spam — only emit events.
|
|
16
|
+
*/
|
|
17
|
+
import { type CommandContext, type CommandResult } from './commandRegistry.js';
|
|
18
|
+
/**
|
|
19
|
+
* Parsed command structure
|
|
20
|
+
*/
|
|
21
|
+
export interface ParsedCommand {
|
|
22
|
+
name: string;
|
|
23
|
+
args: string[];
|
|
24
|
+
raw: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse command line input
|
|
28
|
+
*
|
|
29
|
+
* Responsibilities:
|
|
30
|
+
* - Trim leading/trailing whitespace
|
|
31
|
+
* - Support quoted arguments: "quoted value" and 'quoted value'
|
|
32
|
+
* - Preserve spaces inside quotes
|
|
33
|
+
* - Split unquoted tokens on whitespace
|
|
34
|
+
*
|
|
35
|
+
* Rules:
|
|
36
|
+
* - Empty input → return { name: "", args: [], raw }
|
|
37
|
+
* - Parsing never throws
|
|
38
|
+
* - Parsing never emits UI output
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseCommand(line: string): ParsedCommand;
|
|
41
|
+
/**
|
|
42
|
+
* Execute a parsed command
|
|
43
|
+
*
|
|
44
|
+
* @param parsed - Parsed command
|
|
45
|
+
* @param ctx - Command context
|
|
46
|
+
* @param emitToBus - If true, emit events to eventBus. If false, return events.
|
|
47
|
+
* @returns Command result
|
|
48
|
+
*/
|
|
49
|
+
export declare function executeCommand(parsed: ParsedCommand, ctx?: CommandContext, emitToBus?: boolean): Promise<CommandResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Execute command from raw input string
|
|
52
|
+
*
|
|
53
|
+
* Convenience function that parses and executes in one call.
|
|
54
|
+
*/
|
|
55
|
+
export declare function executeCommandLine(line: string, ctx?: CommandContext, emitToBus?: boolean): Promise<CommandResult>;
|
|
56
|
+
//# sourceMappingURL=commandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.d.ts","sourceRoot":"","sources":["../../src/core/commandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIhG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAsExD;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,GAAG,GAAE,cAAmB,EACxB,SAAS,GAAE,OAAc,GACxB,OAAO,CAAC,aAAa,CAAC,CAoDxB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,cAAmB,EACxB,SAAS,GAAE,OAAc,GACxB,OAAO,CAAC,aAAa,CAAC,CAGxB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Command Executor
|
|
3
|
+
*
|
|
4
|
+
* UI-agnostic command execution engine.
|
|
5
|
+
*
|
|
6
|
+
* Input: raw string command line
|
|
7
|
+
* Output: structured result (events, actions, state updates)
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities:
|
|
10
|
+
* - Parse command name + args
|
|
11
|
+
* - Lookup in registry
|
|
12
|
+
* - Execute handler
|
|
13
|
+
* - Route output to eventBus (or return results for UI to display)
|
|
14
|
+
*
|
|
15
|
+
* No console.log spam — only emit events.
|
|
16
|
+
*/
|
|
17
|
+
import { commandRegistry } from './commandRegistry.js';
|
|
18
|
+
import { eventBus } from './eventBus.js';
|
|
19
|
+
/**
|
|
20
|
+
* Parse command line input
|
|
21
|
+
*
|
|
22
|
+
* Responsibilities:
|
|
23
|
+
* - Trim leading/trailing whitespace
|
|
24
|
+
* - Support quoted arguments: "quoted value" and 'quoted value'
|
|
25
|
+
* - Preserve spaces inside quotes
|
|
26
|
+
* - Split unquoted tokens on whitespace
|
|
27
|
+
*
|
|
28
|
+
* Rules:
|
|
29
|
+
* - Empty input → return { name: "", args: [], raw }
|
|
30
|
+
* - Parsing never throws
|
|
31
|
+
* - Parsing never emits UI output
|
|
32
|
+
*/
|
|
33
|
+
export function parseCommand(line) {
|
|
34
|
+
const raw = line;
|
|
35
|
+
const trimmed = line.trim();
|
|
36
|
+
// Empty input
|
|
37
|
+
if (!trimmed) {
|
|
38
|
+
return { name: '', args: [], raw };
|
|
39
|
+
}
|
|
40
|
+
// Remove prompt if present
|
|
41
|
+
const withoutPrompt = trimmed.replace(/^4runr>\s*/, '').trim();
|
|
42
|
+
if (!withoutPrompt) {
|
|
43
|
+
return { name: '', args: [], raw };
|
|
44
|
+
}
|
|
45
|
+
// Parse with quoted argument support
|
|
46
|
+
const tokens = [];
|
|
47
|
+
let current = '';
|
|
48
|
+
let inDoubleQuote = false;
|
|
49
|
+
let inSingleQuote = false;
|
|
50
|
+
for (let i = 0; i < withoutPrompt.length; i++) {
|
|
51
|
+
const char = withoutPrompt[i];
|
|
52
|
+
if (char === '"' && !inSingleQuote) {
|
|
53
|
+
if (inDoubleQuote) {
|
|
54
|
+
// End of double-quoted string
|
|
55
|
+
tokens.push(current);
|
|
56
|
+
current = '';
|
|
57
|
+
inDoubleQuote = false;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Start of double-quoted string
|
|
61
|
+
inDoubleQuote = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (char === "'" && !inDoubleQuote) {
|
|
65
|
+
if (inSingleQuote) {
|
|
66
|
+
// End of single-quoted string
|
|
67
|
+
tokens.push(current);
|
|
68
|
+
current = '';
|
|
69
|
+
inSingleQuote = false;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Start of single-quoted string
|
|
73
|
+
inSingleQuote = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if ((char === ' ' || char === '\t') && !inDoubleQuote && !inSingleQuote) {
|
|
77
|
+
// Whitespace outside quotes - end current token
|
|
78
|
+
if (current) {
|
|
79
|
+
tokens.push(current);
|
|
80
|
+
current = '';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Regular character - add to current token
|
|
85
|
+
current += char;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Add final token if any
|
|
89
|
+
if (current || inDoubleQuote || inSingleQuote) {
|
|
90
|
+
tokens.push(current);
|
|
91
|
+
}
|
|
92
|
+
if (tokens.length === 0) {
|
|
93
|
+
return { name: '', args: [], raw };
|
|
94
|
+
}
|
|
95
|
+
const name = tokens[0].toLowerCase();
|
|
96
|
+
const args = tokens.slice(1);
|
|
97
|
+
return { name, args, raw };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Execute a parsed command
|
|
101
|
+
*
|
|
102
|
+
* @param parsed - Parsed command
|
|
103
|
+
* @param ctx - Command context
|
|
104
|
+
* @param emitToBus - If true, emit events to eventBus. If false, return events.
|
|
105
|
+
* @returns Command result
|
|
106
|
+
*/
|
|
107
|
+
export async function executeCommand(parsed, ctx = {}, emitToBus = true) {
|
|
108
|
+
// Empty command
|
|
109
|
+
if (!parsed.name) {
|
|
110
|
+
return { events: [] };
|
|
111
|
+
}
|
|
112
|
+
// Lookup command
|
|
113
|
+
const command = commandRegistry.get(parsed.name);
|
|
114
|
+
if (!command) {
|
|
115
|
+
const errorEvent = {
|
|
116
|
+
id: `err-${Date.now()}`,
|
|
117
|
+
ts: Date.now(),
|
|
118
|
+
tag: 'ERR',
|
|
119
|
+
level: 'ERROR',
|
|
120
|
+
msg: `Unknown command: ${parsed.name} (try 'help')`,
|
|
121
|
+
};
|
|
122
|
+
if (emitToBus) {
|
|
123
|
+
eventBus.emit(errorEvent);
|
|
124
|
+
}
|
|
125
|
+
return { events: [errorEvent] };
|
|
126
|
+
}
|
|
127
|
+
// Execute handler
|
|
128
|
+
try {
|
|
129
|
+
const result = await command.handler(ctx, parsed.args);
|
|
130
|
+
// Emit events to bus if requested
|
|
131
|
+
if (emitToBus && result.events) {
|
|
132
|
+
for (const event of result.events) {
|
|
133
|
+
eventBus.emit(event);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
const errorEvent = {
|
|
140
|
+
id: `err-${Date.now()}`,
|
|
141
|
+
ts: Date.now(),
|
|
142
|
+
tag: 'ERR',
|
|
143
|
+
level: 'ERROR',
|
|
144
|
+
msg: `Command error: ${error instanceof Error ? error.message : String(error)}`,
|
|
145
|
+
};
|
|
146
|
+
if (emitToBus) {
|
|
147
|
+
eventBus.emit(errorEvent);
|
|
148
|
+
}
|
|
149
|
+
return { events: [errorEvent] };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Execute command from raw input string
|
|
154
|
+
*
|
|
155
|
+
* Convenience function that parses and executes in one call.
|
|
156
|
+
*/
|
|
157
|
+
export async function executeCommandLine(line, ctx = {}, emitToBus = true) {
|
|
158
|
+
const parsed = parseCommand(line);
|
|
159
|
+
return executeCommand(parsed, ctx, emitToBus);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=commandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.js","sourceRoot":"","sources":["../../src/core/commandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAA2C,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAYzC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAE5B,cAAc;IACd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;IACrC,CAAC;IAED,2BAA2B;IAC3B,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IA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O,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Command Registry
|
|
3
|
+
*
|
|
4
|
+
* Stores command definitions (name, help text, handler signature).
|
|
5
|
+
* UI-agnostic - no TUI library imports.
|
|
6
|
+
*/
|
|
7
|
+
import type { OpEvent } from './opEvent.js';
|
|
8
|
+
/**
|
|
9
|
+
* Command execution context (lightweight, no UI objects)
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandContext {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* UI actions that the UI layer interprets
|
|
15
|
+
*/
|
|
16
|
+
export declare enum UiAction {
|
|
17
|
+
EXIT = "EXIT",
|
|
18
|
+
CLEAR_FEED = "CLEAR_FEED",
|
|
19
|
+
HOME = "HOME"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Command execution result
|
|
23
|
+
*/
|
|
24
|
+
export interface CommandResult {
|
|
25
|
+
events: OpEvent[];
|
|
26
|
+
action?: UiAction;
|
|
27
|
+
uiStateUpdate?: (prev: any) => any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Command handler type
|
|
31
|
+
* Can be async for API calls
|
|
32
|
+
*/
|
|
33
|
+
export type CommandHandler = (ctx: CommandContext, args: string[]) => CommandResult | Promise<CommandResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Command definition
|
|
36
|
+
*/
|
|
37
|
+
export interface CommandDefinition {
|
|
38
|
+
name: string;
|
|
39
|
+
help: string;
|
|
40
|
+
handler: CommandHandler;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Command registry
|
|
44
|
+
*
|
|
45
|
+
* Stores all registered commands.
|
|
46
|
+
* Commands are registered at module load time.
|
|
47
|
+
*/
|
|
48
|
+
declare class CommandRegistry {
|
|
49
|
+
private commands;
|
|
50
|
+
/**
|
|
51
|
+
* Register a command
|
|
52
|
+
*/
|
|
53
|
+
register(def: CommandDefinition): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get a command by name
|
|
56
|
+
*/
|
|
57
|
+
get(name: string): CommandDefinition | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get all registered commands
|
|
60
|
+
*/
|
|
61
|
+
getAll(): CommandDefinition[];
|
|
62
|
+
/**
|
|
63
|
+
* Check if a command exists
|
|
64
|
+
*/
|
|
65
|
+
has(name: string): boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Global command registry instance
|
|
69
|
+
*/
|
|
70
|
+
export declare const commandRegistry: CommandRegistry;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=commandRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandRegistry.d.ts","sourceRoot":"","sources":["../../src/core/commandRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,cAAc;CAG9B;AAED;;GAEG;AACH,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE7G;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;GAKG;AACH,cAAM,eAAe;IACnB,OAAO,CAAC,QAAQ,CAA6C;IAE7D;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI;IAItC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIhD;;OAEG;IACH,MAAM,IAAI,iBAAiB,EAAE;IAI7B;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Command Registry
|
|
3
|
+
*
|
|
4
|
+
* Stores command definitions (name, help text, handler signature).
|
|
5
|
+
* UI-agnostic - no TUI library imports.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* UI actions that the UI layer interprets
|
|
9
|
+
*/
|
|
10
|
+
export var UiAction;
|
|
11
|
+
(function (UiAction) {
|
|
12
|
+
UiAction["EXIT"] = "EXIT";
|
|
13
|
+
UiAction["CLEAR_FEED"] = "CLEAR_FEED";
|
|
14
|
+
UiAction["HOME"] = "HOME";
|
|
15
|
+
})(UiAction || (UiAction = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Command registry
|
|
18
|
+
*
|
|
19
|
+
* Stores all registered commands.
|
|
20
|
+
* Commands are registered at module load time.
|
|
21
|
+
*/
|
|
22
|
+
class CommandRegistry {
|
|
23
|
+
commands = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Register a command
|
|
26
|
+
*/
|
|
27
|
+
register(def) {
|
|
28
|
+
this.commands.set(def.name.toLowerCase(), def);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get a command by name
|
|
32
|
+
*/
|
|
33
|
+
get(name) {
|
|
34
|
+
return this.commands.get(name.toLowerCase());
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all registered commands
|
|
38
|
+
*/
|
|
39
|
+
getAll() {
|
|
40
|
+
return Array.from(this.commands.values());
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if a command exists
|
|
44
|
+
*/
|
|
45
|
+
has(name) {
|
|
46
|
+
return this.commands.has(name.toLowerCase());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Global command registry instance
|
|
51
|
+
*/
|
|
52
|
+
export const commandRegistry = new CommandRegistry();
|
|
53
|
+
//# sourceMappingURL=commandRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandRegistry.js","sourceRoot":"","sources":["../../src/core/commandRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;GAEG;AACH,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,yBAAa,CAAA;AACf,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AA0BD;;;;;GAKG;AACH,MAAM,eAAe;IACX,QAAQ,GAAmC,IAAI,GAAG,EAAE,CAAC;IAE7D;;OAEG;IACH,QAAQ,CAAC,GAAsB;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core dbg:size Command
|
|
3
|
+
*
|
|
4
|
+
* Prints terminal sizing and environment information.
|
|
5
|
+
* Works in both V3 and V4.
|
|
6
|
+
*
|
|
7
|
+
* UI-agnostic - no TUI library imports.
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandContext, CommandResult } from '../commandRegistry.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handle dbg:size command
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleSizeCommand(ctx: CommandContext, args: string[]): CommandResult;
|
|
14
|
+
/**
|
|
15
|
+
* Enhanced version that accepts screen object (for UI layers that have it)
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleSizeCommandWithScreen(ctx: CommandContext, args: string[], screen?: {
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
cols?: number;
|
|
21
|
+
rows?: number;
|
|
22
|
+
}): CommandResult;
|
|
23
|
+
//# sourceMappingURL=size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../../src/core/commands/size.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA+D3E;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CA6EpF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE,aAAa,CAiFf"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core dbg:size Command
|
|
3
|
+
*
|
|
4
|
+
* Prints terminal sizing and environment information.
|
|
5
|
+
* Works in both V3 and V4.
|
|
6
|
+
*
|
|
7
|
+
* UI-agnostic - no TUI library imports.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Get terminal size information
|
|
11
|
+
*
|
|
12
|
+
* Returns safe values (never crashes if unavailable)
|
|
13
|
+
*/
|
|
14
|
+
function getTerminalSize() {
|
|
15
|
+
// Screen dimensions (if available from blessed or similar)
|
|
16
|
+
// Note: In core, we don't have screen object, so these will be N/A
|
|
17
|
+
// UI layer can pass screen object if needed
|
|
18
|
+
const screenCols = 'N/A';
|
|
19
|
+
const screenRows = 'N/A';
|
|
20
|
+
// Process stdout dimensions
|
|
21
|
+
const stdoutCols = process.stdout.columns ?? 'N/A';
|
|
22
|
+
const stdoutRows = process.stdout.rows ?? 'N/A';
|
|
23
|
+
// Platform
|
|
24
|
+
const platform = process.platform;
|
|
25
|
+
// Terminal program detection
|
|
26
|
+
const termProgram = process.env.TERM_PROGRAM ?? 'N/A';
|
|
27
|
+
const termSession = process.env.WT_SESSION ?? process.env.TERM_SESSION_ID ?? 'N/A';
|
|
28
|
+
const term = process.env.TERM ?? 'N/A';
|
|
29
|
+
const colorTerm = process.env.COLORTERM ?? 'N/A';
|
|
30
|
+
// SSH detection
|
|
31
|
+
const sshTty = process.env.SSH_TTY ?? 'N/A';
|
|
32
|
+
const sshConnection = process.env.SSH_CONNECTION ?? 'N/A';
|
|
33
|
+
// CI detection
|
|
34
|
+
const ci = process.env.CI ?? 'N/A';
|
|
35
|
+
return {
|
|
36
|
+
screenCols,
|
|
37
|
+
screenRows,
|
|
38
|
+
stdoutCols,
|
|
39
|
+
stdoutRows,
|
|
40
|
+
platform,
|
|
41
|
+
termProgram,
|
|
42
|
+
termSession,
|
|
43
|
+
term,
|
|
44
|
+
colorTerm,
|
|
45
|
+
sshTty,
|
|
46
|
+
sshConnection,
|
|
47
|
+
ci,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Handle dbg:size command
|
|
52
|
+
*/
|
|
53
|
+
export function handleSizeCommand(ctx, args) {
|
|
54
|
+
const size = getTerminalSize();
|
|
55
|
+
const events = [
|
|
56
|
+
{
|
|
57
|
+
id: `dbg-size-1-${Date.now()}`,
|
|
58
|
+
ts: Date.now(),
|
|
59
|
+
tag: 'DBG',
|
|
60
|
+
level: 'INFO',
|
|
61
|
+
msg: `=== TERMINAL SIZE INFO ===`,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: `dbg-size-2-${Date.now()}`,
|
|
65
|
+
ts: Date.now(),
|
|
66
|
+
tag: 'DBG',
|
|
67
|
+
level: 'INFO',
|
|
68
|
+
msg: `screen: cols=${size.screenCols} rows=${size.screenRows}`,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: `dbg-size-3-${Date.now()}`,
|
|
72
|
+
ts: Date.now(),
|
|
73
|
+
tag: 'DBG',
|
|
74
|
+
level: 'INFO',
|
|
75
|
+
msg: `stdout: cols=${size.stdoutCols} rows=${size.stdoutRows}`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: `dbg-size-4-${Date.now()}`,
|
|
79
|
+
ts: Date.now(),
|
|
80
|
+
tag: 'DBG',
|
|
81
|
+
level: 'INFO',
|
|
82
|
+
msg: `platform: ${size.platform}`,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: `dbg-size-5-${Date.now()}`,
|
|
86
|
+
ts: Date.now(),
|
|
87
|
+
tag: 'DBG',
|
|
88
|
+
level: 'INFO',
|
|
89
|
+
msg: `term: TERM_PROGRAM=${size.termProgram} WT_SESSION=${size.termSession}`,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: `dbg-size-6-${Date.now()}`,
|
|
93
|
+
ts: Date.now(),
|
|
94
|
+
tag: 'DBG',
|
|
95
|
+
level: 'INFO',
|
|
96
|
+
msg: `term: TERM=${size.term} COLORTERM=${size.colorTerm}`,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: `dbg-size-7-${Date.now()}`,
|
|
100
|
+
ts: Date.now(),
|
|
101
|
+
tag: 'DBG',
|
|
102
|
+
level: 'INFO',
|
|
103
|
+
msg: `ssh: SSH_TTY=${size.sshTty}`,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: `dbg-size-8-${Date.now()}`,
|
|
107
|
+
ts: Date.now(),
|
|
108
|
+
tag: 'DBG',
|
|
109
|
+
level: 'INFO',
|
|
110
|
+
msg: `ssh: SSH_CONNECTION=${size.sshConnection}`,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: `dbg-size-9-${Date.now()}`,
|
|
114
|
+
ts: Date.now(),
|
|
115
|
+
tag: 'DBG',
|
|
116
|
+
level: 'INFO',
|
|
117
|
+
msg: `env: CI=${size.ci}`,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: `dbg-size-10-${Date.now()}`,
|
|
121
|
+
ts: Date.now(),
|
|
122
|
+
tag: 'DBG',
|
|
123
|
+
level: 'INFO',
|
|
124
|
+
msg: `=== END SIZE INFO ===`,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
return { events };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Enhanced version that accepts screen object (for UI layers that have it)
|
|
131
|
+
*/
|
|
132
|
+
export function handleSizeCommandWithScreen(ctx, args, screen) {
|
|
133
|
+
const baseSize = getTerminalSize();
|
|
134
|
+
// Override screen dimensions if provided
|
|
135
|
+
const screenCols = screen?.cols ?? screen?.width ?? baseSize.screenCols;
|
|
136
|
+
const screenRows = screen?.rows ?? screen?.height ?? baseSize.screenRows;
|
|
137
|
+
const events = [
|
|
138
|
+
{
|
|
139
|
+
id: `dbg-size-1-${Date.now()}`,
|
|
140
|
+
ts: Date.now(),
|
|
141
|
+
tag: 'DBG',
|
|
142
|
+
level: 'INFO',
|
|
143
|
+
msg: `=== TERMINAL SIZE INFO ===`,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: `dbg-size-2-${Date.now()}`,
|
|
147
|
+
ts: Date.now(),
|
|
148
|
+
tag: 'DBG',
|
|
149
|
+
level: 'INFO',
|
|
150
|
+
msg: `screen: cols=${screenCols} rows=${screenRows}`,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: `dbg-size-3-${Date.now()}`,
|
|
154
|
+
ts: Date.now(),
|
|
155
|
+
tag: 'DBG',
|
|
156
|
+
level: 'INFO',
|
|
157
|
+
msg: `stdout: cols=${baseSize.stdoutCols} rows=${baseSize.stdoutRows}`,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: `dbg-size-4-${Date.now()}`,
|
|
161
|
+
ts: Date.now(),
|
|
162
|
+
tag: 'DBG',
|
|
163
|
+
level: 'INFO',
|
|
164
|
+
msg: `platform: ${baseSize.platform}`,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: `dbg-size-5-${Date.now()}`,
|
|
168
|
+
ts: Date.now(),
|
|
169
|
+
tag: 'DBG',
|
|
170
|
+
level: 'INFO',
|
|
171
|
+
msg: `term: TERM_PROGRAM=${baseSize.termProgram} WT_SESSION=${baseSize.termSession}`,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: `dbg-size-6-${Date.now()}`,
|
|
175
|
+
ts: Date.now(),
|
|
176
|
+
tag: 'DBG',
|
|
177
|
+
level: 'INFO',
|
|
178
|
+
msg: `term: TERM=${baseSize.term} COLORTERM=${baseSize.colorTerm}`,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: `dbg-size-7-${Date.now()}`,
|
|
182
|
+
ts: Date.now(),
|
|
183
|
+
tag: 'DBG',
|
|
184
|
+
level: 'INFO',
|
|
185
|
+
msg: `ssh: SSH_TTY=${baseSize.sshTty}`,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: `dbg-size-8-${Date.now()}`,
|
|
189
|
+
ts: Date.now(),
|
|
190
|
+
tag: 'DBG',
|
|
191
|
+
level: 'INFO',
|
|
192
|
+
msg: `ssh: SSH_CONNECTION=${baseSize.sshConnection}`,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: `dbg-size-9-${Date.now()}`,
|
|
196
|
+
ts: Date.now(),
|
|
197
|
+
tag: 'DBG',
|
|
198
|
+
level: 'INFO',
|
|
199
|
+
msg: `env: CI=${baseSize.ci}`,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: `dbg-size-10-${Date.now()}`,
|
|
203
|
+
ts: Date.now(),
|
|
204
|
+
tag: 'DBG',
|
|
205
|
+
level: 'INFO',
|
|
206
|
+
msg: `=== END SIZE INFO ===`,
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
return { events };
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../../src/core/commands/size.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;GAIG;AACH,SAAS,eAAe;IActB,2DAA2D;IAC3D,mEAAmE;IACnE,4CAA4C;IAC5C,MAAM,UAAU,GAAG,KAAc,CAAC;IAClC,MAAM,UAAU,GAAG,KAAc,CAAC;IAElC,4BAA4B;IAC5B,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IACnD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC;IAEhD,WAAW;IACX,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,6BAA6B;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