thinkncollab-shell 0.0.20 ā 2.0.0-beta.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/LICENSE +82 -0
- package/Readme.md +246 -502
- package/dist/bin/thinknsh.js +8 -0
- package/dist/src/commands/auth/login.js +7 -0
- package/dist/src/commands/auth/logout.js +7 -0
- package/dist/src/commands/auth/register.js +7 -0
- package/dist/src/commands/auth/whoami.js +7 -0
- package/dist/src/commands/dock/bench.js +7 -0
- package/dist/src/commands/dock/ci.js +7 -0
- package/dist/src/commands/dock/cluster.js +7 -0
- package/dist/src/commands/dock/containers.js +7 -0
- package/dist/src/commands/dock/dock.js +7 -0
- package/dist/src/commands/github/commits.js +7 -0
- package/dist/src/commands/github/issue-create.js +7 -0
- package/dist/src/commands/github/issues.js +7 -0
- package/dist/src/commands/github/pulls.js +7 -0
- package/dist/src/commands/github/statusgh.js +7 -0
- package/dist/src/commands/index.js +7 -0
- package/dist/src/commands/message/say.js +7 -0
- package/dist/src/commands/room/join.js +7 -0
- package/dist/src/commands/room/leave.js +7 -0
- package/dist/src/commands/room/rooms.js +7 -0
- package/dist/src/commands/room/sync.js +7 -0
- package/dist/src/commands/sandbox/console.js +7 -0
- package/dist/src/commands/sandbox/dep.js +7 -0
- package/dist/src/commands/sandbox/deploy.js +7 -0
- package/dist/src/commands/sandbox/dev.js +7 -0
- package/dist/src/commands/sandbox/exec.js +7 -0
- package/dist/src/commands/sandbox/freeze.js +7 -0
- package/dist/src/commands/sandbox/push.js +7 -0
- package/dist/src/commands/sandbox/resume.js +7 -0
- package/dist/src/commands/sandbox/sandbox.js +7 -0
- package/dist/src/commands/sandbox/share.js +7 -0
- package/dist/src/commands/sandbox/snapshot.js +7 -0
- package/dist/src/commands/sandbox/sync-deps.js +7 -0
- package/dist/src/commands/shell/doctor.js +7 -0
- package/dist/src/commands/shell/notifications.js +7 -0
- package/dist/src/commands/shell/notify.js +7 -0
- package/dist/src/commands/shell/status.js +7 -0
- package/dist/src/commands/shell/version.js +7 -0
- package/dist/src/commands/tasks/build.js +7 -0
- package/dist/src/commands/tasks/complete.js +7 -0
- package/dist/src/commands/tasks/create-task.js +7 -0
- package/dist/src/commands/tasks/loadtest.js +7 -0
- package/dist/src/commands/tasks/task-status.js +7 -0
- package/dist/src/commands/tasks/task.js +7 -0
- package/dist/src/commands/tasks/tasks.js +7 -0
- package/dist/src/commands/team/invite.js +7 -0
- package/dist/src/commands/team/myteam.js +7 -0
- package/dist/src/commands/team/teammates.js +7 -0
- package/dist/src/commands/terminal/share.js +7 -0
- package/dist/src/core/api-client.js +7 -0
- package/dist/src/core/crypto/e2ee-vault.js +7 -0
- package/dist/src/core/dep-store.js +7 -0
- package/dist/src/core/dependency-tracker.js +7 -0
- package/dist/src/core/geekload.js +7 -0
- package/dist/src/core/local-runner.js +7 -0
- package/dist/src/core/multi-lang-scanner.js +7 -0
- package/dist/src/core/notification-window.js +8 -0
- package/dist/src/core/notify-auth.js +7 -0
- package/dist/src/core/project-config.js +7 -0
- package/dist/src/core/sandbox/arch-shim.js +7 -0
- package/dist/src/core/sandbox/capsule-builder.js +7 -0
- package/dist/src/core/sandbox/cgroups.js +7 -0
- package/dist/src/core/sandbox/container-monitor.js +7 -0
- package/dist/src/core/sandbox/crun-manager.js +7 -0
- package/dist/src/core/sandbox/engine.js +7 -0
- package/dist/src/core/sandbox/image-manager.js +7 -0
- package/dist/src/core/sandbox/image-store.js +7 -0
- package/dist/src/core/sandbox/index.js +7 -0
- package/dist/src/core/sandbox/macos-sandbox.js +7 -0
- package/dist/src/core/sandbox/microvm-manager.js +7 -0
- package/dist/src/core/sandbox/native-service-manager.js +7 -0
- package/dist/src/core/sandbox/network.js +7 -0
- package/dist/src/core/sandbox/oci-exporter.js +7 -0
- package/dist/src/core/sandbox/oci-puller.js +7 -0
- package/dist/src/core/sandbox/oci-runtime-spec.js +7 -0
- package/dist/src/core/sandbox/policy-engine.js +7 -0
- package/dist/src/core/sandbox/port-proxy-daemon.js +7 -0
- package/dist/src/core/sandbox/room-sync-manager.js +7 -0
- package/dist/src/core/sandbox/runtime-manager.js +7 -0
- package/dist/src/core/sandbox/snapshot-manager.js +7 -0
- package/dist/src/core/sandbox/storage.js +7 -0
- package/dist/src/core/sandbox/supervisor.js +7 -0
- package/dist/src/core/sandbox/tunnel-daemon.js +7 -0
- package/dist/src/core/sandbox/tunnel.js +7 -0
- package/dist/src/core/sandbox/window-launcher.js +7 -0
- package/dist/src/core/sandbox/windows-wsl2.js +7 -0
- package/dist/src/core/sandbox-window.js +8 -0
- package/dist/src/core/shell.js +7 -0
- package/dist/src/core/websocket.js +7 -0
- package/dist/src/dock/api/routes.js +7 -0
- package/dist/src/dock/api/server.js +7 -0
- package/dist/src/dock/api/wire.js +7 -0
- package/dist/src/dock/bench/memory.js +7 -0
- package/dist/src/dock/bench/runner.js +7 -0
- package/dist/src/dock/build/builder.js +7 -0
- package/dist/src/dock/build/buildfile.js +7 -0
- package/dist/src/dock/build/buildkit.js +7 -0
- package/dist/src/dock/build/changes.js +7 -0
- package/dist/src/dock/ci/actions.js +7 -0
- package/dist/src/dock/ci/runner.js +7 -0
- package/dist/src/dock/ci/workflow.js +7 -0
- package/dist/src/dock/cli/api.js +7 -0
- package/dist/src/dock/cli/args.js +7 -0
- package/dist/src/dock/cli/commands.js +7 -0
- package/dist/src/dock/cli/compose.js +7 -0
- package/dist/src/dock/cli/context.js +7 -0
- package/dist/src/dock/cli/files.js +7 -0
- package/dist/src/dock/cli/format.js +7 -0
- package/dist/src/dock/cli/manage.js +7 -0
- package/dist/src/dock/cli/moved.js +7 -0
- package/dist/src/dock/cli/services.js +7 -0
- package/dist/src/dock/cli/session.js +7 -0
- package/dist/src/dock/cli/workspace.js +7 -0
- package/dist/src/dock/client.js +7 -0
- package/dist/src/dock/compat/cases.js +7 -0
- package/dist/src/dock/compat/runner.js +7 -0
- package/dist/src/dock/config.js +7 -0
- package/dist/src/dock/daemon-main.js +7 -0
- package/dist/src/dock/daemon.js +7 -0
- package/dist/src/dock/deploy/compose.js +7 -0
- package/dist/src/dock/engine.js +7 -0
- package/dist/src/dock/image/archive.js +7 -0
- package/dist/src/dock/image/auth.js +7 -0
- package/dist/src/dock/image/reference.js +7 -0
- package/dist/src/dock/image/registry.js +7 -0
- package/dist/src/dock/image/tar.js +7 -0
- package/dist/src/dock/index.js +7 -0
- package/dist/src/dock/linux/host.js +7 -0
- package/dist/src/dock/paths.js +7 -0
- package/dist/src/dock/runtime/emulation.js +7 -0
- package/dist/src/dock/runtime/fsevents.js +7 -0
- package/dist/src/dock/runtime/fsops.js +7 -0
- package/dist/src/dock/runtime/hostfwd.js +7 -0
- package/dist/src/dock/runtime/logs.js +7 -0
- package/dist/src/dock/runtime/network.js +7 -0
- package/dist/src/dock/runtime/ports.js +7 -0
- package/dist/src/dock/runtime/rootfs.js +7 -0
- package/dist/src/dock/runtime/seccomp-profile.LICENSE +202 -0
- package/dist/src/dock/runtime/seccomp-profile.json +1227 -0
- package/dist/src/dock/runtime/seccomp.js +7 -0
- package/dist/src/dock/runtime/spec.js +7 -0
- package/dist/src/dock/runtime/stats.js +7 -0
- package/dist/src/dock/runtime/volumes.js +7 -0
- package/dist/src/dock/selftest.js +7 -0
- package/dist/src/dock/setup/app.js +7 -0
- package/dist/src/dock/setup/autostart.js +7 -0
- package/dist/src/dock/setup/index.js +7 -0
- package/dist/src/dock/setup/integrate.js +7 -0
- package/dist/src/dock/setup/migrate.js +7 -0
- package/dist/src/dock/state/store.js +7 -0
- package/dist/src/dock/ui/page.js +385 -0
- package/dist/src/dock/ui/server.js +7 -0
- package/dist/src/dock/version.js +7 -0
- package/dist/src/dock/workspace/apps.js +7 -0
- package/dist/src/dock/workspace/workspace.js +7 -0
- package/dist/src/events/notifications.js +7 -0
- package/dist/src/utils/logger.js +7 -0
- package/dist/src/utils/terminalCrypto.js +7 -0
- package/package.json +41 -16
- package/bin/thinknsh.js +0 -71
- package/src/commands/auth/login.js +0 -84
- package/src/commands/auth/logout.js +0 -32
- package/src/commands/auth/register.js +0 -52
- package/src/commands/auth/whoami.js +0 -52
- package/src/commands/github/commits.js +0 -58
- package/src/commands/github/issue-create.js +0 -59
- package/src/commands/github/issues.js +0 -57
- package/src/commands/github/pulls.js +0 -58
- package/src/commands/github/statusgh.js +0 -50
- package/src/commands/index.js +0 -136
- package/src/commands/message/say.js +0 -49
- package/src/commands/room/join.js +0 -142
- package/src/commands/room/leave.js +0 -24
- package/src/commands/room/rooms.js +0 -66
- package/src/commands/shell/notify.js +0 -88
- package/src/commands/shell/status.js +0 -73
- package/src/commands/shell/version.js +0 -18
- package/src/commands/tasks/build.js +0 -190
- package/src/commands/tasks/complete.js +0 -940
- package/src/commands/tasks/create-task.js +0 -101
- package/src/commands/tasks/loadtest.js +0 -101
- package/src/commands/tasks/suggestTask.js +0 -0
- package/src/commands/tasks/task-status.js +0 -72
- package/src/commands/tasks/task.js +0 -182
- package/src/commands/tasks/tasks.js +0 -184
- package/src/commands/team/invite.js +0 -46
- package/src/commands/team/myteam.js +0 -78
- package/src/commands/team/teammates.js +0 -52
- package/src/commands/terminal/share.js +0 -261
- package/src/core/api-client.js +0 -246
- package/src/core/geekload.js +0 -524
- package/src/core/local-runner.js +0 -861
- package/src/core/notification-window.js +0 -165
- package/src/core/project-config.js +0 -100
- package/src/core/shell.js +0 -734
- package/src/core/websocket.js +0 -657
- package/src/events/notifications.js +0 -184
- package/src/utils/logger.js +0 -159
- package/src/utils/terminalCrypto.js +0 -47
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const { spawn } = require('child_process');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
name: 'build',
|
|
8
|
-
description: 'Run local CI/CD workflow build pipelines and sync stats to TNC',
|
|
9
|
-
aliases: ['pipeline', 'run-ci'],
|
|
10
|
-
requiresAuth: true,
|
|
11
|
-
requiresRoom: true,
|
|
12
|
-
|
|
13
|
-
async execute(args, shell) {
|
|
14
|
-
const workflowFile = args[0] || 'tnc-ci.yml';
|
|
15
|
-
const projectRoot = process.cwd();
|
|
16
|
-
const workflowPath = path.join(projectRoot, '.tnc/workflows', workflowFile);
|
|
17
|
-
|
|
18
|
-
if (!fs.existsSync(workflowPath)) {
|
|
19
|
-
console.log(chalk.red(`ā Workflow file not found: .tnc/workflows/${workflowFile}`));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
console.log(chalk.cyan(`\nš Loading local CI/CD workflow: ${workflowFile}`));
|
|
24
|
-
|
|
25
|
-
// Read YAML file
|
|
26
|
-
const content = fs.readFileSync(workflowPath, 'utf8');
|
|
27
|
-
const lines = content.split('\n');
|
|
28
|
-
let workflowName = workflowFile;
|
|
29
|
-
let steps = [];
|
|
30
|
-
let currentStepName = '';
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < lines.length; i++) {
|
|
33
|
-
const line = lines[i].trim();
|
|
34
|
-
if (line.startsWith('name:')) {
|
|
35
|
-
workflowName = line.substring(5).trim().replace(/['"]/g, '');
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (line.startsWith('-')) {
|
|
39
|
-
const cleaned = line.substring(1).trim();
|
|
40
|
-
if (cleaned.startsWith('name:')) {
|
|
41
|
-
currentStepName = cleaned.substring(5).trim().replace(/['"]/g, '');
|
|
42
|
-
} else if (cleaned.startsWith('run:')) {
|
|
43
|
-
let runCmd = cleaned.substring(4).trim();
|
|
44
|
-
if ((runCmd.startsWith('"') && runCmd.endsWith('"')) || (runCmd.startsWith("'") && runCmd.endsWith("'"))) {
|
|
45
|
-
runCmd = runCmd.substring(1, runCmd.length - 1);
|
|
46
|
-
}
|
|
47
|
-
if (runCmd === '|') {
|
|
48
|
-
let block = [];
|
|
49
|
-
let j = i + 1;
|
|
50
|
-
while (j < lines.length) {
|
|
51
|
-
const next = lines[j];
|
|
52
|
-
const match = next.match(/^(\s+)(.*)/);
|
|
53
|
-
if (match && match[1].length > 4) {
|
|
54
|
-
block.push(next.trim());
|
|
55
|
-
j++;
|
|
56
|
-
} else {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
runCmd = block.join('\n');
|
|
61
|
-
i = j - 1;
|
|
62
|
-
}
|
|
63
|
-
steps.push({
|
|
64
|
-
name: currentStepName || `run: ${runCmd.substring(0, 30)}`,
|
|
65
|
-
run: runCmd
|
|
66
|
-
});
|
|
67
|
-
currentStepName = '';
|
|
68
|
-
}
|
|
69
|
-
} else if (line.startsWith('name:')) {
|
|
70
|
-
currentStepName = line.substring(5).trim().replace(/['"]/g, '');
|
|
71
|
-
} else if (line.startsWith('run:')) {
|
|
72
|
-
let runCmd = line.substring(4).trim();
|
|
73
|
-
if ((runCmd.startsWith('"') && runCmd.endsWith('"')) || (runCmd.startsWith("'") && runCmd.endsWith("'"))) {
|
|
74
|
-
runCmd = runCmd.substring(1, runCmd.length - 1);
|
|
75
|
-
}
|
|
76
|
-
if (runCmd === '|') {
|
|
77
|
-
let block = [];
|
|
78
|
-
let j = i + 1;
|
|
79
|
-
while (j < lines.length) {
|
|
80
|
-
const next = lines[j];
|
|
81
|
-
const match = next.match(/^(\s+)(.*)/);
|
|
82
|
-
if (match && match[1].length > 4) {
|
|
83
|
-
block.push(next.trim());
|
|
84
|
-
j++;
|
|
85
|
-
} else {
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
runCmd = block.join('\n');
|
|
90
|
-
i = j - 1;
|
|
91
|
-
}
|
|
92
|
-
steps.push({
|
|
93
|
-
name: currentStepName || `run: ${runCmd.substring(0, 30)}`,
|
|
94
|
-
run: runCmd
|
|
95
|
-
});
|
|
96
|
-
currentStepName = '';
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (steps.length === 0) {
|
|
101
|
-
console.log(chalk.red('ā No build steps parsed from workflow'));
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const logs = [];
|
|
106
|
-
logs.push(`š [TNC Actions] Starting Local Workflow: "${workflowName}" (${workflowFile})`);
|
|
107
|
-
console.log(chalk.green(`š [TNC Actions] Starting Local Workflow: "${workflowName}" (${workflowFile})`));
|
|
108
|
-
|
|
109
|
-
let overallPassed = true;
|
|
110
|
-
|
|
111
|
-
for (let s = 0; s < steps.length; s++) {
|
|
112
|
-
const step = steps[s];
|
|
113
|
-
const stepStartMsg = `\nāļø [Step ${s+1}/${steps.length}] "${step.name}"\n$ ${step.run}`;
|
|
114
|
-
logs.push(stepStartMsg);
|
|
115
|
-
console.log(chalk.yellow(stepStartMsg));
|
|
116
|
-
|
|
117
|
-
const exitCode = await new Promise((resolve) => {
|
|
118
|
-
const shellCmd = process.platform === 'win32' ? 'cmd.exe' : '/bin/sh';
|
|
119
|
-
const shellArgs = process.platform === 'win32' ? ['/s', '/c', step.run] : ['-c', step.run];
|
|
120
|
-
|
|
121
|
-
const proc = spawn(shellCmd, shellArgs, {
|
|
122
|
-
cwd: projectRoot,
|
|
123
|
-
env: { ...process.env, PATH: process.env.PATH, PUPPETEER_SKIP_DOWNLOAD: 'true' }
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
proc.stdout.on('data', (chunk) => {
|
|
127
|
-
const chunkStr = chunk.toString().trim();
|
|
128
|
-
if (chunkStr) {
|
|
129
|
-
chunkStr.split('\n').forEach(line => {
|
|
130
|
-
logs.push(`[stdout] ${line}`);
|
|
131
|
-
console.log(chalk.dim(` ${line}`));
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
proc.stderr.on('data', (chunk) => {
|
|
137
|
-
const chunkStr = chunk.toString().trim();
|
|
138
|
-
if (chunkStr) {
|
|
139
|
-
chunkStr.split('\n').forEach(line => {
|
|
140
|
-
logs.push(`[stderr] ${line}`);
|
|
141
|
-
console.log(chalk.red(` ${line}`));
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
proc.on('close', (code) => {
|
|
147
|
-
resolve(code);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (exitCode !== 0) {
|
|
152
|
-
overallPassed = false;
|
|
153
|
-
const failMsg = `ā [Step Failed] Step "${step.name}" exited with status code: ${exitCode}`;
|
|
154
|
-
logs.push(failMsg);
|
|
155
|
-
console.log(chalk.red(failMsg));
|
|
156
|
-
break;
|
|
157
|
-
} else {
|
|
158
|
-
const passMsg = `ā
[Step Passed] Step "${step.name}" completed successfully`;
|
|
159
|
-
logs.push(passMsg);
|
|
160
|
-
console.log(chalk.green(passMsg));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (overallPassed) {
|
|
165
|
-
const successMsg = `\nš Workflow ran successfully! status code: 0`;
|
|
166
|
-
logs.push(successMsg);
|
|
167
|
-
console.log(chalk.green(successMsg));
|
|
168
|
-
} else {
|
|
169
|
-
const failMsg = `\nā Workflow failed!`;
|
|
170
|
-
logs.push(failMsg);
|
|
171
|
-
console.log(chalk.red(failMsg));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Sync stats back to ThinkNCollab backend
|
|
175
|
-
const roomId = shell.ws.getCurrentRoom();
|
|
176
|
-
if (roomId) {
|
|
177
|
-
process.stdout.write(chalk.dim(' Syncing stats to ThinkNCollab server...\r'));
|
|
178
|
-
try {
|
|
179
|
-
await shell.api._request('POST', `/tnccicd/api/save-run/${roomId}`, {
|
|
180
|
-
workflowFile,
|
|
181
|
-
status: overallPassed ? 'passed' : 'failed',
|
|
182
|
-
logs
|
|
183
|
-
});
|
|
184
|
-
console.log(chalk.green(' ā
Pipeline stats successfully synced to workspace!'));
|
|
185
|
-
} catch (syncErr) {
|
|
186
|
-
console.log(chalk.red(` ā ļø Failed to sync stats to server: ${syncErr.message}`));
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|