rl-rockcli 0.0.4 → 0.0.5
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/commands/log/core/constants.js +237 -0
- package/commands/log/core/display.js +370 -0
- package/commands/log/core/search.js +330 -0
- package/commands/log/core/tail.js +216 -0
- package/commands/log/core/utils.js +424 -0
- package/commands/log.js +298 -0
- package/commands/sandbox/core/log-bridge.js +119 -0
- package/commands/sandbox/core/replay/analyzer.js +311 -0
- package/commands/sandbox/core/replay/batch-orchestrator.js +536 -0
- package/commands/sandbox/core/replay/batch-task.js +369 -0
- package/commands/sandbox/core/replay/concurrent-display.js +70 -0
- package/commands/sandbox/core/replay/concurrent-orchestrator.js +170 -0
- package/commands/sandbox/core/replay/data-source.js +86 -0
- package/commands/sandbox/core/replay/display.js +231 -0
- package/commands/sandbox/core/replay/executor.js +634 -0
- package/commands/sandbox/core/replay/history-fetcher.js +124 -0
- package/commands/sandbox/core/replay/index.js +338 -0
- package/commands/sandbox/core/replay/loghouse-data-source.js +177 -0
- package/commands/sandbox/core/replay/pid-mapping.js +26 -0
- package/commands/sandbox/core/replay/request.js +109 -0
- package/commands/sandbox/core/replay/worker.js +166 -0
- package/commands/sandbox/core/session.js +346 -0
- package/commands/sandbox/log-bridge.js +2 -0
- package/commands/sandbox/ray.js +2 -0
- package/commands/sandbox/replay/analyzer.js +311 -0
- package/commands/sandbox/replay/batch-orchestrator.js +536 -0
- package/commands/sandbox/replay/batch-task.js +369 -0
- package/commands/sandbox/replay/concurrent-display.js +70 -0
- package/commands/sandbox/replay/concurrent-orchestrator.js +170 -0
- package/commands/sandbox/replay/display.js +231 -0
- package/commands/sandbox/replay/executor.js +634 -0
- package/commands/sandbox/replay/history-fetcher.js +118 -0
- package/commands/sandbox/replay/index.js +338 -0
- package/commands/sandbox/replay/pid-mapping.js +26 -0
- package/commands/sandbox/replay/request.js +109 -0
- package/commands/sandbox/replay/worker.js +166 -0
- package/commands/sandbox/replay.js +2 -0
- package/commands/sandbox/session.js +2 -0
- package/commands/sandbox-original.js +1393 -0
- package/commands/sandbox.js +499 -0
- package/help/help.json +1071 -0
- package/help/middleware.js +71 -0
- package/help/renderer.js +800 -0
- package/index.js +21 -51
- package/lib/plugin-context.js +40 -0
- package/package.json +1 -1
- package/sdks/sandbox/core/client.js +845 -0
- package/sdks/sandbox/core/config.js +70 -0
- package/sdks/sandbox/core/types.js +74 -0
- package/sdks/sandbox/httpLogger.js +251 -0
- package/sdks/sandbox/index.js +9 -0
- package/utils/asciiArt.js +138 -0
- package/utils/bun-compat.js +59 -0
- package/utils/ciPipelines.js +138 -0
- package/utils/cli.js +17 -0
- package/utils/command-router.js +79 -0
- package/utils/configManager.js +503 -0
- package/utils/dependency-resolver.js +135 -0
- package/utils/eagleeye_traceid.js +151 -0
- package/utils/envDetector.js +78 -0
- package/utils/execution_logger.js +415 -0
- package/utils/featureManager.js +68 -0
- package/utils/firstTimeTip.js +44 -0
- package/utils/hook-manager.js +125 -0
- package/utils/http-logger.js +264 -0
- package/utils/i18n.js +139 -0
- package/utils/image-progress.js +159 -0
- package/utils/logger.js +154 -0
- package/utils/plugin-loader.js +124 -0
- package/utils/plugin-manager.js +348 -0
- package/utils/ray_cli_wrapper.js +746 -0
- package/utils/sandbox-client.js +419 -0
- package/utils/terminal.js +32 -0
- package/utils/tips.js +106 -0
package/index.js
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* rl-rockcli - Open Source ROCK CLI Entry Point
|
|
5
|
-
*
|
|
6
|
-
* 这是开源版本的入口文件,它会:
|
|
7
|
-
* 1. 设置 ROCKCLI_MODE=opensource 环境变量
|
|
8
|
-
* 2. **只引用 Core 命令**(不引用 Internal)
|
|
9
|
-
* 3. 过滤掉内网专有功能
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
// 强制设置开源模式(在任何 require 之前)
|
|
13
|
-
process.env.ROCKCLI_MODE = 'opensource';
|
|
14
|
-
|
|
15
|
-
// 开源版默认配置
|
|
3
|
+
// 开源版默认配置(只在环境变量未设置时才设置)
|
|
16
4
|
if (!process.env.ROCKCLI_BASE_URL) {
|
|
17
|
-
|
|
5
|
+
process.env.ROCKCLI_BASE_URL = 'http://127.0.0.1:8080';
|
|
18
6
|
}
|
|
19
7
|
|
|
8
|
+
// 强制设置开源模式(放在环境变量读取之后)
|
|
9
|
+
process.env.ROCKCLI_MODE = 'opensource';
|
|
10
|
+
|
|
20
11
|
const yargs = require('yargs/yargs');
|
|
21
12
|
const { hideBin } = require('yargs/helpers');
|
|
13
|
+
const logCommand = require('./commands/log');
|
|
14
|
+
const sandboxCommand = require('./commands/sandbox');
|
|
22
15
|
|
|
23
|
-
// ⚠️ 关键:只引用 Core 命令,不引用 Internal
|
|
24
|
-
// 这确保打包时不会包含内网代码
|
|
25
|
-
const logCommand = require('../commands/log'); // 已支持 ROCKCLI_MODE 过滤
|
|
26
|
-
const sandboxCommand = require('../commands/sandbox'); // 已支持 ROCKCLI_MODE 过滤
|
|
27
|
-
|
|
28
|
-
// ASCII Art Logo
|
|
29
16
|
const LOGO = `
|
|
30
17
|
██████╗ ██████╗ ██████╗██╗ ██╗ ██████╗██╗ ██╗
|
|
31
18
|
██╔══██╗██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██║ ██║
|
|
@@ -33,36 +20,19 @@ const LOGO = `
|
|
|
33
20
|
██╔══██╗██║ ██║██║ ██╔═██╗ ██║ ██║ ██║
|
|
34
21
|
██║ ██║╚██████╔╝╚██████╗██║ ██╗╚██████╗███████╗██║
|
|
35
22
|
╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝
|
|
23
|
+
Open Source
|
|
36
24
|
`;
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.help()
|
|
52
|
-
.epilogue(`
|
|
53
|
-
环境变量:
|
|
54
|
-
ROCKCLI_API_KEY - API 密钥(用于认证)
|
|
55
|
-
ROCKCLI_BASE_URL - 沙箱服务地址(默认: http://127.0.0.1:8080)
|
|
56
|
-
ROCKCLI_LOG_LEVEL - 日志级别(debug/info/warn/error)
|
|
57
|
-
|
|
58
|
-
文档: https://github.com/rock-cli/rockcli
|
|
59
|
-
`);
|
|
60
|
-
|
|
61
|
-
if (typeof cli.terminalWidth === 'function') {
|
|
62
|
-
cli.wrap(cli.terminalWidth());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
cli.parse();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
run();
|
|
26
|
+
yargs(hideBin(process.argv))
|
|
27
|
+
.scriptName('rockcli')
|
|
28
|
+
.usage(LOGO + '\n\nUsage: $0 <command> [options]')
|
|
29
|
+
.command(logCommand)
|
|
30
|
+
.command(sandboxCommand)
|
|
31
|
+
.demandCommand(1)
|
|
32
|
+
.strict()
|
|
33
|
+
.alias('h', 'help')
|
|
34
|
+
.alias('v', 'version')
|
|
35
|
+
.version('0.1.0')
|
|
36
|
+
.help()
|
|
37
|
+
.wrap(null)
|
|
38
|
+
.parse();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建插件钩子 context 对象
|
|
3
|
+
* @param {Object} baseContext - 基础上下文
|
|
4
|
+
* @returns {Object} - context 对象
|
|
5
|
+
*/
|
|
6
|
+
function createPluginContext(baseContext = {}) {
|
|
7
|
+
const context = { ...baseContext };
|
|
8
|
+
|
|
9
|
+
let _prevented = false;
|
|
10
|
+
let _preventMessage = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 阻止当前行为执行
|
|
14
|
+
* @param {string} message - 阻止原因的消息
|
|
15
|
+
*/
|
|
16
|
+
context.preventDefault = function(message) {
|
|
17
|
+
_prevented = true;
|
|
18
|
+
_preventMessage = message || null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 是否已阻止
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(context, 'isPrevented', {
|
|
25
|
+
get: () => _prevented,
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 阻止消息
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(context, 'preventMessage', {
|
|
33
|
+
get: () => _preventMessage,
|
|
34
|
+
enumerable: true
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return context;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = { createPluginContext };
|