@tradejs/cli 3.1.14-beta.224 → 3.1.14
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/cli.js +31 -12
- package/dist/lib/researchRoots.js +21 -7
- package/dist/scripts/agentRun.js +7 -7
- package/dist/scripts/coreResearch.js +24 -9
- package/dist/scripts/researchAuto.js +24 -8
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -245,7 +245,7 @@ ${diffText}`)) {
|
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
// src/lib/researchRoots.ts
|
|
248
|
-
var import_node_path, SOURCE_REPOSITORY_ROOT_ENV, firstNonEmpty, resolveResearchRoots;
|
|
248
|
+
var import_node_path, SOURCE_REPOSITORY_ROOT_ENV, firstNonEmpty, resolveResearchRoots, resolveRequiredResearchRoots;
|
|
249
249
|
var init_researchRoots = __esm({
|
|
250
250
|
"src/lib/researchRoots.ts"() {
|
|
251
251
|
"use strict";
|
|
@@ -258,14 +258,26 @@ var init_researchRoots = __esm({
|
|
|
258
258
|
const projectRoot15 = import_node_path.default.resolve(
|
|
259
259
|
firstNonEmpty(options.projectRoot, env.PROJECT_CWD, cwd) || cwd
|
|
260
260
|
);
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
env[SOURCE_REPOSITORY_ROOT_ENV],
|
|
265
|
-
cwd
|
|
266
|
-
) || cwd
|
|
261
|
+
const sourceRepositoryRoot = firstNonEmpty(
|
|
262
|
+
options.sourceRepositoryRoot,
|
|
263
|
+
env[SOURCE_REPOSITORY_ROOT_ENV]
|
|
267
264
|
);
|
|
268
|
-
return {
|
|
265
|
+
return {
|
|
266
|
+
projectRoot: projectRoot15,
|
|
267
|
+
...sourceRepositoryRoot ? { sourceRepositoryRoot: import_node_path.default.resolve(sourceRepositoryRoot) } : {}
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
resolveRequiredResearchRoots = (options = {}) => {
|
|
271
|
+
const roots = resolveResearchRoots(options);
|
|
272
|
+
if (!roots.sourceRepositoryRoot) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`${SOURCE_REPOSITORY_ROOT_ENV} is required for source-aware research`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
...roots,
|
|
279
|
+
sourceRepositoryRoot: roots.sourceRepositoryRoot
|
|
280
|
+
};
|
|
269
281
|
};
|
|
270
282
|
}
|
|
271
283
|
});
|
|
@@ -19825,7 +19837,7 @@ __export(researchAuto_exports, {
|
|
|
19825
19837
|
toStrategyConfigGrid: () => toStrategyConfigGrid2,
|
|
19826
19838
|
trimTextTail: () => trimTextTail2
|
|
19827
19839
|
});
|
|
19828
|
-
var import_args23, import_chalk34, import_node_child_process4, import_promises15, import_node_os2, import_node_path8, import_constants13, import_ai8, import_logger5, import_redis11, import_registry4, flags23, projectRoot8,
|
|
19840
|
+
var import_args23, import_chalk34, import_node_child_process4, import_promises15, import_node_os2, import_node_path8, import_constants13, import_ai8, import_logger5, import_redis11, import_registry4, flags23, projectRoot8, dotenvPath, getResearchAutoLockPath, readResearchAutoLock, isProcessAlive, acquireResearchAutoLock, releaseResearchAutoLock, resolvePositiveInteger, resolveHeapMbFromEnv, buildNodeOptions, RESEARCH_AUTO_PARENT_HEAP_MB, RESEARCH_AUTO_BACKTEST_PARENT_HEAP_MB, RESEARCH_AUTO_AI_TRAIN_PARENT_HEAP_MB, RESEARCH_AUTO_AGENT_PARENT_HEAP_MB, trimTextTail2, escapeHtml2, createEmptySteps, saveRun, listMergedFiles3, getBacktestResultsPrefix, listRuntimeStrategyNames, toStrategyConfigGrid2, formatMskDateTime, buildTelegramReport, runCliCommand, resolveTarget, parseJsonOutput, logResearch, executeNonBlockingStep, main30;
|
|
19829
19841
|
var init_researchAuto = __esm({
|
|
19830
19842
|
"src/scripts/researchAuto.ts"() {
|
|
19831
19843
|
"use strict";
|
|
@@ -19866,7 +19878,7 @@ var init_researchAuto = __esm({
|
|
|
19866
19878
|
import_args23.default.option(["A", "skipAgent"], "Skip direct research agent invocation", false);
|
|
19867
19879
|
import_args23.default.option(["j", "json"], "Print structured JSON summary", false);
|
|
19868
19880
|
flags23 = import_args23.default.parse(process.argv);
|
|
19869
|
-
({ projectRoot: projectRoot8
|
|
19881
|
+
({ projectRoot: projectRoot8 } = resolveResearchRoots());
|
|
19870
19882
|
dotenvPath = String(
|
|
19871
19883
|
process.env.DOTENV_CONFIG_PATH || import_node_path8.default.join(projectRoot8, ".env")
|
|
19872
19884
|
).trim() || import_node_path8.default.join(projectRoot8, ".env");
|
|
@@ -20165,6 +20177,9 @@ var init_researchAuto = __esm({
|
|
|
20165
20177
|
return lines.join("\n");
|
|
20166
20178
|
};
|
|
20167
20179
|
runCliCommand = async (params) => {
|
|
20180
|
+
const { sourceRepositoryRoot } = resolveRequiredResearchRoots({
|
|
20181
|
+
projectRoot: projectRoot8
|
|
20182
|
+
});
|
|
20168
20183
|
const startedAt = Date.now();
|
|
20169
20184
|
const captureMode = params.captureMode || "tail";
|
|
20170
20185
|
const tailLimit = Math.max(512, params.tailLimit || 16384);
|
|
@@ -20348,6 +20363,7 @@ var init_researchAuto = __esm({
|
|
|
20348
20363
|
return result;
|
|
20349
20364
|
};
|
|
20350
20365
|
main30 = async () => {
|
|
20366
|
+
resolveRequiredResearchRoots({ projectRoot: projectRoot8 });
|
|
20351
20367
|
const userName3 = String(flags23.user || "root").trim() || "root";
|
|
20352
20368
|
const connector = String(flags23.connector || "bybit").trim() || "bybit";
|
|
20353
20369
|
const timeframe = String(flags23.timeframe || "15").trim() || "15";
|
|
@@ -23617,6 +23633,9 @@ The run command executes only variants with an explicit command[] in the preregi
|
|
|
23617
23633
|
);
|
|
23618
23634
|
return;
|
|
23619
23635
|
}
|
|
23636
|
+
const { sourceRepositoryRoot } = resolveRequiredResearchRoots({
|
|
23637
|
+
projectRoot: roots.projectRoot
|
|
23638
|
+
});
|
|
23620
23639
|
if (command === "init") {
|
|
23621
23640
|
const outputPath = import_node_path14.default.resolve(
|
|
23622
23641
|
roots.projectRoot,
|
|
@@ -23630,7 +23649,7 @@ The run command executes only variants with an explicit command[] in the preregi
|
|
|
23630
23649
|
end: parseTimestamp(valueAfter(argv2, "--end"), "--end"),
|
|
23631
23650
|
outputPath,
|
|
23632
23651
|
projectRoot: roots.projectRoot,
|
|
23633
|
-
sourceRepositoryRoot
|
|
23652
|
+
sourceRepositoryRoot
|
|
23634
23653
|
});
|
|
23635
23654
|
const { outputPath: _outputPath, ...persisted } = spec;
|
|
23636
23655
|
await writeJsonAtomic(outputPath, persisted);
|
|
@@ -23667,7 +23686,7 @@ The run command executes only variants with an explicit command[] in the preregi
|
|
|
23667
23686
|
const analyzed = await runCoreResearch({
|
|
23668
23687
|
spec: loaded.spec,
|
|
23669
23688
|
cwd: roots.projectRoot,
|
|
23670
|
-
sourceRepositoryRoot
|
|
23689
|
+
sourceRepositoryRoot
|
|
23671
23690
|
});
|
|
23672
23691
|
console.log(
|
|
23673
23692
|
import_chalk35.default.green(`Core research report: ${analyzed.paths.reportPath}`)
|
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var researchRoots_exports = {};
|
|
32
32
|
__export(researchRoots_exports, {
|
|
33
33
|
SOURCE_REPOSITORY_ROOT_ENV: () => SOURCE_REPOSITORY_ROOT_ENV,
|
|
34
|
+
resolveRequiredResearchRoots: () => resolveRequiredResearchRoots,
|
|
34
35
|
resolveResearchRoots: () => resolveResearchRoots
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(researchRoots_exports);
|
|
@@ -43,17 +44,30 @@ var resolveResearchRoots = (options = {}) => {
|
|
|
43
44
|
const projectRoot = import_node_path.default.resolve(
|
|
44
45
|
firstNonEmpty(options.projectRoot, env.PROJECT_CWD, cwd) || cwd
|
|
45
46
|
);
|
|
46
|
-
const sourceRepositoryRoot =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
env[SOURCE_REPOSITORY_ROOT_ENV],
|
|
50
|
-
cwd
|
|
51
|
-
) || cwd
|
|
47
|
+
const sourceRepositoryRoot = firstNonEmpty(
|
|
48
|
+
options.sourceRepositoryRoot,
|
|
49
|
+
env[SOURCE_REPOSITORY_ROOT_ENV]
|
|
52
50
|
);
|
|
53
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
projectRoot,
|
|
53
|
+
...sourceRepositoryRoot ? { sourceRepositoryRoot: import_node_path.default.resolve(sourceRepositoryRoot) } : {}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
var resolveRequiredResearchRoots = (options = {}) => {
|
|
57
|
+
const roots = resolveResearchRoots(options);
|
|
58
|
+
if (!roots.sourceRepositoryRoot) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`${SOURCE_REPOSITORY_ROOT_ENV} is required for source-aware research`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
...roots,
|
|
65
|
+
sourceRepositoryRoot: roots.sourceRepositoryRoot
|
|
66
|
+
};
|
|
54
67
|
};
|
|
55
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
69
|
0 && (module.exports = {
|
|
57
70
|
SOURCE_REPOSITORY_ROOT_ENV,
|
|
71
|
+
resolveRequiredResearchRoots,
|
|
58
72
|
resolveResearchRoots
|
|
59
73
|
});
|
package/dist/scripts/agentRun.js
CHANGED
|
@@ -250,14 +250,14 @@ var resolveResearchRoots = (options = {}) => {
|
|
|
250
250
|
const projectRoot2 = import_node_path.default.resolve(
|
|
251
251
|
firstNonEmpty(options.projectRoot, env.PROJECT_CWD, cwd) || cwd
|
|
252
252
|
);
|
|
253
|
-
const sourceRepositoryRoot =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
env[SOURCE_REPOSITORY_ROOT_ENV],
|
|
257
|
-
cwd
|
|
258
|
-
) || cwd
|
|
253
|
+
const sourceRepositoryRoot = firstNonEmpty(
|
|
254
|
+
options.sourceRepositoryRoot,
|
|
255
|
+
env[SOURCE_REPOSITORY_ROOT_ENV]
|
|
259
256
|
);
|
|
260
|
-
return {
|
|
257
|
+
return {
|
|
258
|
+
projectRoot: projectRoot2,
|
|
259
|
+
...sourceRepositoryRoot ? { sourceRepositoryRoot: import_node_path.default.resolve(sourceRepositoryRoot) } : {}
|
|
260
|
+
};
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
// src/scripts/agentRun.ts
|
|
@@ -2117,14 +2117,26 @@ var resolveResearchRoots = (options = {}) => {
|
|
|
2117
2117
|
const projectRoot = import_node_path5.default.resolve(
|
|
2118
2118
|
firstNonEmpty(options.projectRoot, env.PROJECT_CWD, cwd) || cwd
|
|
2119
2119
|
);
|
|
2120
|
-
const sourceRepositoryRoot =
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
env[SOURCE_REPOSITORY_ROOT_ENV],
|
|
2124
|
-
cwd
|
|
2125
|
-
) || cwd
|
|
2120
|
+
const sourceRepositoryRoot = firstNonEmpty(
|
|
2121
|
+
options.sourceRepositoryRoot,
|
|
2122
|
+
env[SOURCE_REPOSITORY_ROOT_ENV]
|
|
2126
2123
|
);
|
|
2127
|
-
return {
|
|
2124
|
+
return {
|
|
2125
|
+
projectRoot,
|
|
2126
|
+
...sourceRepositoryRoot ? { sourceRepositoryRoot: import_node_path5.default.resolve(sourceRepositoryRoot) } : {}
|
|
2127
|
+
};
|
|
2128
|
+
};
|
|
2129
|
+
var resolveRequiredResearchRoots = (options = {}) => {
|
|
2130
|
+
const roots = resolveResearchRoots(options);
|
|
2131
|
+
if (!roots.sourceRepositoryRoot) {
|
|
2132
|
+
throw new Error(
|
|
2133
|
+
`${SOURCE_REPOSITORY_ROOT_ENV} is required for source-aware research`
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
return {
|
|
2137
|
+
...roots,
|
|
2138
|
+
sourceRepositoryRoot: roots.sourceRepositoryRoot
|
|
2139
|
+
};
|
|
2128
2140
|
};
|
|
2129
2141
|
|
|
2130
2142
|
// src/lib/coreResearch/orchestrator.ts
|
|
@@ -2890,6 +2902,9 @@ var main = async () => {
|
|
|
2890
2902
|
);
|
|
2891
2903
|
return;
|
|
2892
2904
|
}
|
|
2905
|
+
const { sourceRepositoryRoot } = resolveRequiredResearchRoots({
|
|
2906
|
+
projectRoot: roots.projectRoot
|
|
2907
|
+
});
|
|
2893
2908
|
if (command === "init") {
|
|
2894
2909
|
const outputPath = import_node_path7.default.resolve(
|
|
2895
2910
|
roots.projectRoot,
|
|
@@ -2903,7 +2918,7 @@ var main = async () => {
|
|
|
2903
2918
|
end: parseTimestamp(valueAfter(argv, "--end"), "--end"),
|
|
2904
2919
|
outputPath,
|
|
2905
2920
|
projectRoot: roots.projectRoot,
|
|
2906
|
-
sourceRepositoryRoot
|
|
2921
|
+
sourceRepositoryRoot
|
|
2907
2922
|
});
|
|
2908
2923
|
const { outputPath: _outputPath, ...persisted } = spec;
|
|
2909
2924
|
await writeJsonAtomic(outputPath, persisted);
|
|
@@ -2940,7 +2955,7 @@ var main = async () => {
|
|
|
2940
2955
|
const analyzed = await runCoreResearch({
|
|
2941
2956
|
spec: loaded.spec,
|
|
2942
2957
|
cwd: roots.projectRoot,
|
|
2943
|
-
sourceRepositoryRoot
|
|
2958
|
+
sourceRepositoryRoot
|
|
2944
2959
|
});
|
|
2945
2960
|
console.log(
|
|
2946
2961
|
import_chalk.default.green(`Core research report: ${analyzed.paths.reportPath}`)
|
|
@@ -94,14 +94,26 @@ var resolveResearchRoots = (options = {}) => {
|
|
|
94
94
|
const projectRoot2 = import_node_path.default.resolve(
|
|
95
95
|
firstNonEmpty(options.projectRoot, env.PROJECT_CWD, cwd) || cwd
|
|
96
96
|
);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
env[SOURCE_REPOSITORY_ROOT_ENV],
|
|
101
|
-
cwd
|
|
102
|
-
) || cwd
|
|
97
|
+
const sourceRepositoryRoot = firstNonEmpty(
|
|
98
|
+
options.sourceRepositoryRoot,
|
|
99
|
+
env[SOURCE_REPOSITORY_ROOT_ENV]
|
|
103
100
|
);
|
|
104
|
-
return {
|
|
101
|
+
return {
|
|
102
|
+
projectRoot: projectRoot2,
|
|
103
|
+
...sourceRepositoryRoot ? { sourceRepositoryRoot: import_node_path.default.resolve(sourceRepositoryRoot) } : {}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
var resolveRequiredResearchRoots = (options = {}) => {
|
|
107
|
+
const roots = resolveResearchRoots(options);
|
|
108
|
+
if (!roots.sourceRepositoryRoot) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`${SOURCE_REPOSITORY_ROOT_ENV} is required for source-aware research`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
...roots,
|
|
115
|
+
sourceRepositoryRoot: roots.sourceRepositoryRoot
|
|
116
|
+
};
|
|
105
117
|
};
|
|
106
118
|
|
|
107
119
|
// src/lib/telegramReports.ts
|
|
@@ -195,7 +207,7 @@ import_args.default.option(["O", "outDir"], "AI export output directory", "data/
|
|
|
195
207
|
import_args.default.option(["A", "skipAgent"], "Skip direct research agent invocation", false);
|
|
196
208
|
import_args.default.option(["j", "json"], "Print structured JSON summary", false);
|
|
197
209
|
var flags = import_args.default.parse(process.argv);
|
|
198
|
-
var { projectRoot
|
|
210
|
+
var { projectRoot } = resolveResearchRoots();
|
|
199
211
|
var dotenvPath = String(
|
|
200
212
|
process.env.DOTENV_CONFIG_PATH || import_node_path2.default.join(projectRoot, ".env")
|
|
201
213
|
).trim() || import_node_path2.default.join(projectRoot, ".env");
|
|
@@ -494,6 +506,9 @@ var buildTelegramReport = (run) => {
|
|
|
494
506
|
return lines.join("\n");
|
|
495
507
|
};
|
|
496
508
|
var runCliCommand = async (params) => {
|
|
509
|
+
const { sourceRepositoryRoot } = resolveRequiredResearchRoots({
|
|
510
|
+
projectRoot
|
|
511
|
+
});
|
|
497
512
|
const startedAt = Date.now();
|
|
498
513
|
const captureMode = params.captureMode || "tail";
|
|
499
514
|
const tailLimit = Math.max(512, params.tailLimit || 16384);
|
|
@@ -677,6 +692,7 @@ var executeNonBlockingStep = async (run, stepName, command, commandArgs, options
|
|
|
677
692
|
return result;
|
|
678
693
|
};
|
|
679
694
|
var main = async () => {
|
|
695
|
+
resolveRequiredResearchRoots({ projectRoot });
|
|
680
696
|
const userName = String(flags.user || "root").trim() || "root";
|
|
681
697
|
const connector = String(flags.connector || "bybit").trim() || "bybit";
|
|
682
698
|
const timeframe = String(flags.timeframe || "15").trim() || "15";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/cli",
|
|
3
|
-
"version": "3.1.14
|
|
3
|
+
"version": "3.1.14",
|
|
4
4
|
"description": "Official CLI for the TradeJS TypeScript framework: infra setup, backtests, signals, bots, and ML workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"tradejs": "dist/cli.js"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tradejs/connectors": "^3.1.14
|
|
40
|
-
"@tradejs/core": "^3.1.14
|
|
41
|
-
"@tradejs/indicators": "^3.1.14
|
|
42
|
-
"@tradejs/infra": "^3.1.14
|
|
43
|
-
"@tradejs/node": "^3.1.14
|
|
39
|
+
"@tradejs/connectors": "^3.1.14",
|
|
40
|
+
"@tradejs/core": "^3.1.14",
|
|
41
|
+
"@tradejs/indicators": "^3.1.14",
|
|
42
|
+
"@tradejs/infra": "^3.1.14",
|
|
43
|
+
"@tradejs/node": "^3.1.14",
|
|
44
44
|
"@tradejs/strategy-kit": "3.0.3",
|
|
45
|
-
"@tradejs/types": "^3.1.14
|
|
45
|
+
"@tradejs/types": "^3.1.14",
|
|
46
46
|
"args": "^5.0.3",
|
|
47
47
|
"bcryptjs": "^2.4.3",
|
|
48
48
|
"chalk": "4.1.2",
|