recomposable 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -11
- package/dist/index.d.ts +40 -0
- package/dist/index.js +1418 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/docker.d.ts +19 -0
- package/dist/lib/docker.js +332 -0
- package/dist/lib/docker.js.map +1 -0
- package/dist/lib/renderer.d.ts +22 -0
- package/dist/lib/renderer.js +526 -0
- package/dist/lib/renderer.js.map +1 -0
- package/dist/lib/state.d.ts +7 -0
- package/dist/lib/state.js +81 -0
- package/dist/lib/state.js.map +1 -0
- package/dist/lib/types.d.ts +183 -0
- package/dist/lib/types.js +6 -0
- package/dist/lib/types.js.map +1 -0
- package/package.json +19 -5
- package/screenshots/exec-inline-view.png +0 -0
- package/screenshots/exec-view.png +0 -0
- package/screenshots/list-view.png +0 -0
- package/screenshots/logs-view.png +0 -0
- package/index.js +0 -662
- package/lib/docker.js +0 -123
- package/lib/renderer.js +0 -315
- package/lib/state.js +0 -52
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { EventEmitter } from 'events';
|
|
3
|
+
import type { PassThrough } from 'stream';
|
|
4
|
+
export declare const MODE: {
|
|
5
|
+
readonly LIST: "LIST";
|
|
6
|
+
readonly LOGS: "LOGS";
|
|
7
|
+
readonly EXEC: "EXEC";
|
|
8
|
+
};
|
|
9
|
+
export type Mode = typeof MODE[keyof typeof MODE];
|
|
10
|
+
export interface Config {
|
|
11
|
+
composeFiles: string[];
|
|
12
|
+
pollInterval: number;
|
|
13
|
+
logTailLines: number;
|
|
14
|
+
logScanPatterns: string[];
|
|
15
|
+
logScanLines: number;
|
|
16
|
+
logScanInterval: number;
|
|
17
|
+
statsInterval: number;
|
|
18
|
+
statsBufferSize: number;
|
|
19
|
+
bottomLogCount: number;
|
|
20
|
+
cpuWarnThreshold: number;
|
|
21
|
+
cpuDangerThreshold: number;
|
|
22
|
+
memWarnThreshold: number;
|
|
23
|
+
memDangerThreshold: number;
|
|
24
|
+
}
|
|
25
|
+
export interface PortMapping {
|
|
26
|
+
published: number;
|
|
27
|
+
target: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ContainerStatus {
|
|
30
|
+
state: string;
|
|
31
|
+
health: string;
|
|
32
|
+
createdAt: string | null;
|
|
33
|
+
startedAt: string | null;
|
|
34
|
+
id: string | null;
|
|
35
|
+
ports: PortMapping[];
|
|
36
|
+
}
|
|
37
|
+
export interface ContainerStats {
|
|
38
|
+
cpuPercent: number;
|
|
39
|
+
memUsageBytes: number;
|
|
40
|
+
}
|
|
41
|
+
export interface StatsHistory {
|
|
42
|
+
cpu: number[];
|
|
43
|
+
mem: number[];
|
|
44
|
+
idx: number;
|
|
45
|
+
count: number;
|
|
46
|
+
}
|
|
47
|
+
export interface ParsedStatsLine {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
cpuPercent: number;
|
|
51
|
+
memUsageBytes: number;
|
|
52
|
+
}
|
|
53
|
+
export interface RebuildEmitter extends EventEmitter {
|
|
54
|
+
stdout: PassThrough;
|
|
55
|
+
stderr: PassThrough;
|
|
56
|
+
kill(signal?: string): void;
|
|
57
|
+
}
|
|
58
|
+
export type RebuildChild = ChildProcess | RebuildEmitter;
|
|
59
|
+
export interface Killable {
|
|
60
|
+
kill(signal?: string): void;
|
|
61
|
+
}
|
|
62
|
+
export interface ServiceGroup {
|
|
63
|
+
file: string;
|
|
64
|
+
label: string;
|
|
65
|
+
services: string[];
|
|
66
|
+
error: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface FlatEntry {
|
|
69
|
+
groupIdx: number;
|
|
70
|
+
serviceIdx: number;
|
|
71
|
+
service: string;
|
|
72
|
+
file: string;
|
|
73
|
+
}
|
|
74
|
+
export type BottomLogAction = 'logs' | 'rebuilding' | 'restarting' | 'stopping' | 'starting' | 'started' | 'watching' | 'cascading' | 'exec';
|
|
75
|
+
export interface DependencyGraph {
|
|
76
|
+
dependsOn: Map<string, string[]>;
|
|
77
|
+
dependedBy: Map<string, string[]>;
|
|
78
|
+
}
|
|
79
|
+
export interface CascadeStep {
|
|
80
|
+
action: 'rebuild' | 'restart';
|
|
81
|
+
service: string;
|
|
82
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
83
|
+
}
|
|
84
|
+
export interface CascadeOperation {
|
|
85
|
+
steps: CascadeStep[];
|
|
86
|
+
currentStepIdx: number;
|
|
87
|
+
child: ChildProcess | null;
|
|
88
|
+
}
|
|
89
|
+
export interface BottomLogInfo {
|
|
90
|
+
action: BottomLogAction;
|
|
91
|
+
service: string;
|
|
92
|
+
lines: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface AppState {
|
|
95
|
+
mode: Mode;
|
|
96
|
+
groups: ServiceGroup[];
|
|
97
|
+
flatList: FlatEntry[];
|
|
98
|
+
cursor: number;
|
|
99
|
+
statuses: Map<string, ContainerStatus>;
|
|
100
|
+
rebuilding: Map<string, Killable>;
|
|
101
|
+
restarting: Map<string, Killable>;
|
|
102
|
+
stopping: Map<string, Killable>;
|
|
103
|
+
starting: Map<string, Killable>;
|
|
104
|
+
containerStats: Map<string, ContainerStats>;
|
|
105
|
+
containerStatsHistory: Map<string, StatsHistory>;
|
|
106
|
+
logChild: ChildProcess | null;
|
|
107
|
+
scrollOffset: number;
|
|
108
|
+
noCache: boolean;
|
|
109
|
+
showBottomLogs: boolean;
|
|
110
|
+
bottomLogLines: Map<string, BottomLogInfo>;
|
|
111
|
+
bottomLogTails: Map<string, Killable>;
|
|
112
|
+
selectedLogKey: string | null;
|
|
113
|
+
logCounts: Map<string, Map<string, number>>;
|
|
114
|
+
logLines: string[];
|
|
115
|
+
logScrollOffset: number;
|
|
116
|
+
logAutoScroll: boolean;
|
|
117
|
+
logSearchQuery: string;
|
|
118
|
+
logSearchActive: boolean;
|
|
119
|
+
logSearchMatches: number[];
|
|
120
|
+
logSearchMatchIdx: number;
|
|
121
|
+
bottomSearchQuery: string;
|
|
122
|
+
bottomSearchActive: boolean;
|
|
123
|
+
watching: Map<string, Killable>;
|
|
124
|
+
watchAvailable: boolean | null;
|
|
125
|
+
depGraphs: Map<string, DependencyGraph>;
|
|
126
|
+
cascading: Map<string, CascadeOperation>;
|
|
127
|
+
execActive: boolean;
|
|
128
|
+
execInput: string;
|
|
129
|
+
execHistory: string[];
|
|
130
|
+
execHistoryIdx: number;
|
|
131
|
+
execContainerId: string | null;
|
|
132
|
+
execService: string | null;
|
|
133
|
+
execChild: ChildProcess | null;
|
|
134
|
+
execOutputLines: string[];
|
|
135
|
+
execCwd: string | null;
|
|
136
|
+
config: Config;
|
|
137
|
+
pollTimer?: ReturnType<typeof setInterval>;
|
|
138
|
+
logScanTimer?: ReturnType<typeof setInterval>;
|
|
139
|
+
statsTimer?: ReturnType<typeof setInterval>;
|
|
140
|
+
}
|
|
141
|
+
export interface LegendOptions {
|
|
142
|
+
logPanelActive?: boolean;
|
|
143
|
+
fullLogsActive?: boolean;
|
|
144
|
+
logsScrollMode?: boolean;
|
|
145
|
+
noCacheActive?: boolean;
|
|
146
|
+
watchActive?: boolean;
|
|
147
|
+
execMode?: boolean;
|
|
148
|
+
execInline?: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface DisplayLine {
|
|
151
|
+
type: 'header' | 'colheader' | 'blank' | 'service';
|
|
152
|
+
text: string;
|
|
153
|
+
flatIdx?: number;
|
|
154
|
+
}
|
|
155
|
+
export interface DockerPublisher {
|
|
156
|
+
PublishedPort: number;
|
|
157
|
+
TargetPort: number;
|
|
158
|
+
}
|
|
159
|
+
export interface DockerComposePsEntry {
|
|
160
|
+
Service?: string;
|
|
161
|
+
Name?: string;
|
|
162
|
+
State?: string;
|
|
163
|
+
Health?: string;
|
|
164
|
+
CreatedAt?: string;
|
|
165
|
+
ID?: string;
|
|
166
|
+
Publishers?: DockerPublisher[];
|
|
167
|
+
Ports?: string;
|
|
168
|
+
}
|
|
169
|
+
export interface DockerInspectEntry {
|
|
170
|
+
Id?: string;
|
|
171
|
+
State?: {
|
|
172
|
+
StartedAt?: string;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export interface DockerStatsJson {
|
|
176
|
+
ID?: string;
|
|
177
|
+
Name?: string;
|
|
178
|
+
CPUPerc?: string;
|
|
179
|
+
MemUsage?: string;
|
|
180
|
+
}
|
|
181
|
+
export interface RebuildOptions {
|
|
182
|
+
noCache?: boolean;
|
|
183
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":";;;AAIA,eAAe;AAEF,QAAA,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recomposable",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Docker Compose TUI manager with vim keybindings — monitor, restart, rebuild, and tail logs for your services",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"recomposable": "./index.js"
|
|
7
|
+
"recomposable": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"lib/",
|
|
10
|
+
"dist/",
|
|
12
11
|
"screenshots/"
|
|
13
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"test:watch": "vitest",
|
|
18
|
+
"test:coverage": "vitest run --coverage",
|
|
19
|
+
"screenshot": "tsc -p tsconfig.scripts.json && node dist-scripts/scripts/screenshot.js",
|
|
20
|
+
"lint": "tsc --noEmit",
|
|
21
|
+
"clean": "rm -rf dist dist-scripts *.tsbuildinfo"
|
|
22
|
+
},
|
|
14
23
|
"keywords": [
|
|
15
24
|
"docker",
|
|
16
25
|
"docker-compose",
|
|
@@ -30,5 +39,10 @@
|
|
|
30
39
|
"license": "MIT",
|
|
31
40
|
"engines": {
|
|
32
41
|
"node": ">=16.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20",
|
|
45
|
+
"typescript": "^5.7",
|
|
46
|
+
"vitest": "^3.0"
|
|
33
47
|
}
|
|
34
48
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|