@trading-boy/cli 1.12.0 → 2.0.0
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 +50 -22
- package/dist/api-client.d.ts +4 -7
- package/dist/api-client.js +8 -13
- package/dist/cli.bundle.js +1896 -33657
- package/dist/credentials.js +1 -1
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -24
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +12 -0
- package/dist/utils.js +3 -3
- package/package.json +20 -5
- package/dist/cli.d.ts +0 -5
- package/dist/cli.js +0 -157
- package/dist/commands/agent-cmd.d.ts +0 -9
- package/dist/commands/agent-cmd.js +0 -567
- package/dist/commands/audit.d.ts +0 -18
- package/dist/commands/audit.js +0 -73
- package/dist/commands/behavioral.d.ts +0 -73
- package/dist/commands/behavioral.js +0 -349
- package/dist/commands/benchmark-cmd.d.ts +0 -3
- package/dist/commands/benchmark-cmd.js +0 -191
- package/dist/commands/billing.d.ts +0 -12
- package/dist/commands/billing.js +0 -142
- package/dist/commands/catalysts.d.ts +0 -17
- package/dist/commands/catalysts.js +0 -151
- package/dist/commands/coaching-cmd.d.ts +0 -16
- package/dist/commands/coaching-cmd.js +0 -222
- package/dist/commands/config-cmd.d.ts +0 -30
- package/dist/commands/config-cmd.js +0 -515
- package/dist/commands/connect-chatgpt.d.ts +0 -5
- package/dist/commands/connect-chatgpt.js +0 -293
- package/dist/commands/connect-claude.d.ts +0 -5
- package/dist/commands/connect-claude.js +0 -280
- package/dist/commands/context.d.ts +0 -41
- package/dist/commands/context.js +0 -405
- package/dist/commands/cron-cmd.d.ts +0 -3
- package/dist/commands/cron-cmd.js +0 -305
- package/dist/commands/decisions.d.ts +0 -57
- package/dist/commands/decisions.js +0 -364
- package/dist/commands/edge-cmd.d.ts +0 -78
- package/dist/commands/edge-cmd.js +0 -183
- package/dist/commands/edge-guard-cmd.d.ts +0 -36
- package/dist/commands/edge-guard-cmd.js +0 -169
- package/dist/commands/events.d.ts +0 -3
- package/dist/commands/events.js +0 -117
- package/dist/commands/infra.d.ts +0 -24
- package/dist/commands/infra.js +0 -137
- package/dist/commands/journal.d.ts +0 -3
- package/dist/commands/journal.js +0 -302
- package/dist/commands/login.d.ts +0 -18
- package/dist/commands/login.js +0 -127
- package/dist/commands/logout.d.ts +0 -8
- package/dist/commands/logout.js +0 -108
- package/dist/commands/narratives.d.ts +0 -3
- package/dist/commands/narratives.js +0 -259
- package/dist/commands/onboarding.d.ts +0 -7
- package/dist/commands/onboarding.js +0 -281
- package/dist/commands/query.d.ts +0 -32
- package/dist/commands/query.js +0 -135
- package/dist/commands/replay-cmd.d.ts +0 -43
- package/dist/commands/replay-cmd.js +0 -184
- package/dist/commands/review.d.ts +0 -3
- package/dist/commands/review.js +0 -443
- package/dist/commands/risk.d.ts +0 -47
- package/dist/commands/risk.js +0 -158
- package/dist/commands/social.d.ts +0 -43
- package/dist/commands/social.js +0 -318
- package/dist/commands/soul-wizard.d.ts +0 -29
- package/dist/commands/soul-wizard.js +0 -155
- package/dist/commands/strategy-cmd.d.ts +0 -44
- package/dist/commands/strategy-cmd.js +0 -335
- package/dist/commands/subscribe.d.ts +0 -78
- package/dist/commands/subscribe.js +0 -552
- package/dist/commands/suggestions-cmd.d.ts +0 -24
- package/dist/commands/suggestions-cmd.js +0 -148
- package/dist/commands/thesis-cmd.d.ts +0 -3
- package/dist/commands/thesis-cmd.js +0 -129
- package/dist/commands/trader.d.ts +0 -30
- package/dist/commands/trader.js +0 -971
- package/dist/commands/watch.d.ts +0 -16
- package/dist/commands/watch.js +0 -104
- package/dist/commands/whoami.d.ts +0 -14
- package/dist/commands/whoami.js +0 -105
package/dist/credentials.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { mkdirSync, readFileSync, writeFileSync, unlinkSync, existsSync } from 'node:fs';
|
|
4
|
-
import { createLogger } from '
|
|
4
|
+
import { createLogger } from './logger.js';
|
|
5
5
|
const logger = createLogger('cli-credentials');
|
|
6
6
|
// ─── Constants ───
|
|
7
7
|
const SERVICE_NAME = 'trading-boy';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
export { createCli, main } from './cli.js';
|
|
2
1
|
export { formatConnectionError } from './utils.js';
|
|
3
|
-
export { registerJournalCommand } from './commands/journal.js';
|
|
4
|
-
export { registerQueryCommand, formatQueryOutput } from './commands/query.js';
|
|
5
|
-
export type { QueryResult } from './commands/query.js';
|
|
6
|
-
export { registerWatchCommand, startWatchLoop, stopWatchLoop } from './commands/watch.js';
|
|
7
|
-
export type { WatchState } from './commands/watch.js';
|
|
8
|
-
export { registerAuditCommand, formatAuditVerifyOutput } from './commands/audit.js';
|
|
9
|
-
export type { AuditVerifyResult } from './commands/audit.js';
|
|
10
|
-
export { registerEventsCommand } from './commands/events.js';
|
|
11
|
-
export { registerRiskCommand, formatRiskOutput, formatContagionOutput, formatRiskScore } from './commands/risk.js';
|
|
12
|
-
export { registerCatalystsCommand, formatCatalystsOutput } from './commands/catalysts.js';
|
|
13
|
-
export { registerDecisionsCommand, formatDecisionsOutput, formatStatsOutput, formatSetupTypeStats, parsePeriod } from './commands/decisions.js';
|
|
14
|
-
export { registerSocialCommand, formatTokenSocial } from './commands/social.js';
|
|
15
|
-
export { registerNarrativeCommand } from './commands/narratives.js';
|
|
16
|
-
export { registerTraderCommand, formatTraderOutput, formatTraderListOutput } from './commands/trader.js';
|
|
17
|
-
export { registerBehavioralCommand, formatBehavioralProfile, formatBehavioralFlags, parsePeriodDays, colorScore, colorHonorRate, scoreLabel, } from './commands/behavioral.js';
|
|
18
|
-
export { registerContextCommand, formatContextOutput, formatMarketSection, formatOnchainSection, formatRiskSection, formatCatalystsSection, formatSocialSection, formatSynthesisSection, formatMetaSection, } from './commands/context.js';
|
|
19
|
-
export { registerConfigCommand, formatConfigOutput, redactValue, resolveEnvPath, parseEnvFile, writeEnvValue, } from './commands/config-cmd.js';
|
|
20
|
-
export { registerInfraCommand, checkInfraStatus, formatInfraStatus, } from './commands/infra.js';
|
|
21
|
-
export type { InfraStatusResult } from './commands/infra.js';
|
|
22
|
-
export { registerLoginCommand, validateApiKeyFormat, verifyApiKey, executeLogin } from './commands/login.js';
|
|
23
|
-
export { registerLogoutCommand, executeLogout } from './commands/logout.js';
|
|
24
|
-
export { registerWhoamiCommand, executeWhoami, formatWhoamiOutput } from './commands/whoami.js';
|
|
25
|
-
export type { WhoamiResult } from './commands/whoami.js';
|
|
26
|
-
export { registerBillingCommand, formatBillingStatus } from './commands/billing.js';
|
|
27
|
-
export type { BillingStatusResponse } from './commands/billing.js';
|
|
28
|
-
export { registerSubscribeCommand, createCheckoutSession, pollProvisioningToken, pollForApiKey, saveApiKey, formatSubscribeSuccess, } from './commands/subscribe.js';
|
|
29
|
-
export type { CheckoutResponse, ProvisionResponse, PollResult, } from './commands/subscribe.js';
|
|
30
2
|
export { storeCredentials, loadCredentials, clearCredentials, redactApiKey, getCredentialsFilePath } from './credentials.js';
|
|
31
3
|
export type { StoredCredentials } from './credentials.js';
|
|
32
4
|
export { apiRequest, resolveApiKey, getApiBase, ApiError } from './api-client.js';
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
// CLI entry point
|
|
2
|
-
export { createCli, main } from './cli.js';
|
|
3
1
|
export { formatConnectionError } from './utils.js';
|
|
4
|
-
export { registerJournalCommand } from './commands/journal.js';
|
|
5
|
-
export { registerQueryCommand, formatQueryOutput } from './commands/query.js';
|
|
6
|
-
export { registerWatchCommand, startWatchLoop, stopWatchLoop } from './commands/watch.js';
|
|
7
|
-
export { registerAuditCommand, formatAuditVerifyOutput } from './commands/audit.js';
|
|
8
|
-
export { registerEventsCommand } from './commands/events.js';
|
|
9
|
-
export { registerRiskCommand, formatRiskOutput, formatContagionOutput, formatRiskScore } from './commands/risk.js';
|
|
10
|
-
export { registerCatalystsCommand, formatCatalystsOutput } from './commands/catalysts.js';
|
|
11
|
-
export { registerDecisionsCommand, formatDecisionsOutput, formatStatsOutput, formatSetupTypeStats, parsePeriod } from './commands/decisions.js';
|
|
12
|
-
export { registerSocialCommand, formatTokenSocial } from './commands/social.js';
|
|
13
|
-
export { registerNarrativeCommand } from './commands/narratives.js';
|
|
14
|
-
export { registerTraderCommand, formatTraderOutput, formatTraderListOutput } from './commands/trader.js';
|
|
15
|
-
export { registerBehavioralCommand, formatBehavioralProfile, formatBehavioralFlags, parsePeriodDays, colorScore, colorHonorRate, scoreLabel, } from './commands/behavioral.js';
|
|
16
|
-
export { registerContextCommand, formatContextOutput, formatMarketSection, formatOnchainSection, formatRiskSection, formatCatalystsSection, formatSocialSection, formatSynthesisSection, formatMetaSection, } from './commands/context.js';
|
|
17
|
-
export { registerConfigCommand, formatConfigOutput, redactValue, resolveEnvPath, parseEnvFile, writeEnvValue, } from './commands/config-cmd.js';
|
|
18
|
-
export { registerInfraCommand, checkInfraStatus, formatInfraStatus, } from './commands/infra.js';
|
|
19
|
-
// Authentication
|
|
20
|
-
export { registerLoginCommand, validateApiKeyFormat, verifyApiKey, executeLogin } from './commands/login.js';
|
|
21
|
-
export { registerLogoutCommand, executeLogout } from './commands/logout.js';
|
|
22
|
-
export { registerWhoamiCommand, executeWhoami, formatWhoamiOutput } from './commands/whoami.js';
|
|
23
|
-
export { registerBillingCommand, formatBillingStatus } from './commands/billing.js';
|
|
24
|
-
export { registerSubscribeCommand, createCheckoutSession, pollProvisioningToken, pollForApiKey, saveApiKey, formatSubscribeSuccess, } from './commands/subscribe.js';
|
|
25
|
-
// Credentials & API client
|
|
26
2
|
export { storeCredentials, loadCredentials, clearCredentials, redactApiKey, getCredentialsFilePath } from './credentials.js';
|
|
27
3
|
export { apiRequest, resolveApiKey, getApiBase, ApiError } from './api-client.js';
|
|
28
4
|
//# sourceMappingURL=index.js.map
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CliLogger {
|
|
2
|
+
debug: (obj?: unknown, msg?: string) => void;
|
|
3
|
+
info: (obj?: unknown, msg?: string) => void;
|
|
4
|
+
warn: (obj?: unknown, msg?: string) => void;
|
|
5
|
+
error: (obj?: unknown, msg?: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createLogger(_name: string): CliLogger;
|
|
8
|
+
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.js
ADDED
package/dist/utils.js
CHANGED
|
@@ -31,8 +31,8 @@ export function formatConnectionError(message) {
|
|
|
31
31
|
if (!isConnectionError)
|
|
32
32
|
return null;
|
|
33
33
|
return [
|
|
34
|
-
chalk.dim(' →
|
|
35
|
-
chalk.dim(' →
|
|
34
|
+
chalk.dim(' → Check your network connection and API URL.'),
|
|
35
|
+
chalk.dim(' → If self-hosting, ensure the Trading Boy API is reachable.'),
|
|
36
36
|
].join('\n');
|
|
37
37
|
}
|
|
38
38
|
// ─── Shared Formatters ───
|
|
@@ -159,7 +159,7 @@ export function handleApiError(error, context, logger) {
|
|
|
159
159
|
export async function ensureRemote() {
|
|
160
160
|
const { isRemoteMode } = await import('./api-client.js');
|
|
161
161
|
if (!(await isRemoteMode())) {
|
|
162
|
-
console.error(chalk.yellow('This command requires
|
|
162
|
+
console.error(chalk.yellow('This command requires API authentication.'));
|
|
163
163
|
console.error(chalk.dim(' Run: trading-boy login or trading-boy subscribe'));
|
|
164
164
|
process.exitCode = 1;
|
|
165
165
|
return false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trading-boy/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Trading Boy CLI —
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Trading Boy CLI — remote trading intelligence for traders and AI agents.",
|
|
5
5
|
"homepage": "https://cabal.ventures",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,13 +26,28 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"main": "dist/index.js",
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
29
35
|
"bin": {
|
|
30
36
|
"trading-boy": "dist/cli.bundle.js"
|
|
31
37
|
},
|
|
32
38
|
"files": [
|
|
33
|
-
"dist",
|
|
39
|
+
"dist/cli.bundle.js",
|
|
40
|
+
"dist/index.js",
|
|
41
|
+
"dist/index.d.ts",
|
|
42
|
+
"dist/api-client.js",
|
|
43
|
+
"dist/api-client.d.ts",
|
|
44
|
+
"dist/credentials.js",
|
|
45
|
+
"dist/credentials.d.ts",
|
|
46
|
+
"dist/logger.js",
|
|
47
|
+
"dist/logger.d.ts",
|
|
48
|
+
"dist/utils.js",
|
|
49
|
+
"dist/utils.d.ts",
|
|
34
50
|
"README.md",
|
|
35
|
-
"!dist/**/*.test.*",
|
|
36
51
|
"!dist/**/*.map"
|
|
37
52
|
],
|
|
38
53
|
"scripts": {
|
|
@@ -54,7 +69,7 @@
|
|
|
54
69
|
},
|
|
55
70
|
"devDependencies": {
|
|
56
71
|
"@trading-boy/core": "workspace:*",
|
|
57
|
-
"esbuild": "~0.27.
|
|
72
|
+
"esbuild": "~0.27.7",
|
|
58
73
|
"typescript": "^5.7.0"
|
|
59
74
|
}
|
|
60
75
|
}
|
package/dist/cli.d.ts
DELETED
package/dist/cli.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Suppress pino INFO logs in CLI — only show warnings and errors
|
|
3
|
-
if (!process.env.LOG_LEVEL) {
|
|
4
|
-
process.env.LOG_LEVEL = 'warn';
|
|
5
|
-
}
|
|
6
|
-
// Tell the logger to write to stderr so stdout stays clean for piping
|
|
7
|
-
process.env.TRADING_BOY_CLI = '1';
|
|
8
|
-
// TTY detection: when piped, disable colors and spinners for machine-parseable output
|
|
9
|
-
if (!process.stdout.isTTY) {
|
|
10
|
-
process.env.FORCE_COLOR = '0'; // Ensure chalk strips ANSI codes
|
|
11
|
-
process.env.NO_COLOR = '1'; // Standard no-color convention (https://no-color.org)
|
|
12
|
-
}
|
|
13
|
-
import { Command } from 'commander';
|
|
14
|
-
import { registerQueryCommand } from './commands/query.js';
|
|
15
|
-
import { registerWatchCommand } from './commands/watch.js';
|
|
16
|
-
import { registerCatalystsCommand } from './commands/catalysts.js';
|
|
17
|
-
import { registerRiskCommand } from './commands/risk.js';
|
|
18
|
-
import { registerDecisionsCommand } from './commands/decisions.js';
|
|
19
|
-
import { registerTraderCommand } from './commands/trader.js';
|
|
20
|
-
import { registerBehavioralCommand } from './commands/behavioral.js';
|
|
21
|
-
// Social commands hidden — no data source (no Twitter/X API), formatters broken. Unhide when social API integrates.
|
|
22
|
-
// import { registerSocialCommand } from './commands/social.js';
|
|
23
|
-
import { registerNarrativeCommand } from './commands/narratives.js';
|
|
24
|
-
import { registerEventsCommand } from './commands/events.js';
|
|
25
|
-
import { registerJournalCommand } from './commands/journal.js';
|
|
26
|
-
import { registerAuditCommand } from './commands/audit.js';
|
|
27
|
-
import { registerContextCommand } from './commands/context.js';
|
|
28
|
-
import { registerConfigCommand } from './commands/config-cmd.js';
|
|
29
|
-
import { registerInfraCommand } from './commands/infra.js';
|
|
30
|
-
import { registerLoginCommand } from './commands/login.js';
|
|
31
|
-
import { registerLogoutCommand } from './commands/logout.js';
|
|
32
|
-
import { registerWhoamiCommand } from './commands/whoami.js';
|
|
33
|
-
import { registerBillingCommand } from './commands/billing.js';
|
|
34
|
-
import { registerSubscribeCommand } from './commands/subscribe.js';
|
|
35
|
-
import { registerEdgeCommand } from './commands/edge-cmd.js';
|
|
36
|
-
import { registerEdgeGuardCommand } from './commands/edge-guard-cmd.js';
|
|
37
|
-
import { registerCoachingCommand } from './commands/coaching-cmd.js';
|
|
38
|
-
import { registerThesisCommand } from './commands/thesis-cmd.js';
|
|
39
|
-
import { registerStrategyCommand } from './commands/strategy-cmd.js';
|
|
40
|
-
import { registerReplayCommand } from './commands/replay-cmd.js';
|
|
41
|
-
import { registerBenchmarkCommand } from './commands/benchmark-cmd.js';
|
|
42
|
-
import { registerSuggestionsCommand } from './commands/suggestions-cmd.js';
|
|
43
|
-
import { registerCronCommand } from './commands/cron-cmd.js';
|
|
44
|
-
import { registerAgentCommand } from './commands/agent-cmd.js';
|
|
45
|
-
import { registerConnectChatgptCommand } from './commands/connect-chatgpt.js';
|
|
46
|
-
// import { registerConnectClaudeCommand } from './commands/connect-claude.js'; // Hidden — Anthropic ToS prohibits OAuth for third-party use
|
|
47
|
-
import { readFileSync } from 'node:fs';
|
|
48
|
-
import { fileURLToPath } from 'node:url';
|
|
49
|
-
import { dirname, resolve } from 'node:path';
|
|
50
|
-
// ─── CLI Setup ───
|
|
51
|
-
function getVersion() {
|
|
52
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
53
|
-
const pkgPath = resolve(__dirname, '..', 'package.json');
|
|
54
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
55
|
-
return pkg.version;
|
|
56
|
-
}
|
|
57
|
-
export function createCli() {
|
|
58
|
-
const program = new Command();
|
|
59
|
-
program
|
|
60
|
-
.name('trading-boy')
|
|
61
|
-
.description('Trading Boy — Crypto context graph system for traders and agentic trading systems')
|
|
62
|
-
.version(getVersion());
|
|
63
|
-
// ─── Register all commands ───
|
|
64
|
-
// Primary: context assembly
|
|
65
|
-
registerContextCommand(program);
|
|
66
|
-
// Data queries
|
|
67
|
-
registerQueryCommand(program);
|
|
68
|
-
registerWatchCommand(program);
|
|
69
|
-
registerCatalystsCommand(program);
|
|
70
|
-
registerRiskCommand(program);
|
|
71
|
-
// registerSocialCommand(program); // Hidden — no social data source yet
|
|
72
|
-
registerNarrativeCommand(program);
|
|
73
|
-
// Trading journal & decisions
|
|
74
|
-
registerJournalCommand(program);
|
|
75
|
-
registerDecisionsCommand(program);
|
|
76
|
-
registerTraderCommand(program);
|
|
77
|
-
registerBehavioralCommand(program);
|
|
78
|
-
registerAuditCommand(program);
|
|
79
|
-
registerEventsCommand(program);
|
|
80
|
-
// Edge analysis & safety
|
|
81
|
-
registerEdgeCommand(program);
|
|
82
|
-
registerEdgeGuardCommand(program);
|
|
83
|
-
// Authentication & billing
|
|
84
|
-
registerLoginCommand(program);
|
|
85
|
-
registerLogoutCommand(program);
|
|
86
|
-
registerWhoamiCommand(program);
|
|
87
|
-
registerBillingCommand(program);
|
|
88
|
-
registerSubscribeCommand(program);
|
|
89
|
-
registerConnectChatgptCommand(program);
|
|
90
|
-
// registerConnectClaudeCommand(program); // Hidden — Anthropic ToS prohibits OAuth for third-party use
|
|
91
|
-
// Learning & coaching
|
|
92
|
-
registerCoachingCommand(program);
|
|
93
|
-
registerThesisCommand(program);
|
|
94
|
-
// Strategy, replay & benchmark
|
|
95
|
-
registerStrategyCommand(program);
|
|
96
|
-
registerReplayCommand(program);
|
|
97
|
-
registerBenchmarkCommand(program);
|
|
98
|
-
registerSuggestionsCommand(program);
|
|
99
|
-
// Scheduling
|
|
100
|
-
registerCronCommand(program);
|
|
101
|
-
// Agents
|
|
102
|
-
registerAgentCommand(program);
|
|
103
|
-
// System management
|
|
104
|
-
registerConfigCommand(program);
|
|
105
|
-
registerInfraCommand(program);
|
|
106
|
-
// ─── Custom grouped help display (P1-5) ───
|
|
107
|
-
const GROUPS = {
|
|
108
|
-
'Core': ['context', 'query', 'watch'],
|
|
109
|
-
'Data & Analysis': ['catalysts', 'risk', 'narrative', 'events'],
|
|
110
|
-
'Trading Journal': ['journal', 'decisions', 'stats', 'trader', 'behavioral', 'audit'],
|
|
111
|
-
'Edge & Safety': ['edge', 'edge-guard', 'coaching', 'thesis'],
|
|
112
|
-
'Strategy & Benchmarking': ['strategy', 'replay', 'benchmark', 'suggestions'],
|
|
113
|
-
'Scheduling': ['cron'],
|
|
114
|
-
'Agents': ['agent'],
|
|
115
|
-
'Account': ['login', 'logout', 'whoami', 'billing', 'subscribe', 'connect-chatgpt'],
|
|
116
|
-
'System': ['config', 'infra'],
|
|
117
|
-
};
|
|
118
|
-
program.addHelpText('before', '');
|
|
119
|
-
program.addHelpText('after', () => {
|
|
120
|
-
const commands = program.commands;
|
|
121
|
-
const cmdMap = new Map(commands.map((c) => [c.name(), c]));
|
|
122
|
-
const pad = 18;
|
|
123
|
-
const lines = ['', 'Command Groups:'];
|
|
124
|
-
const grouped = new Set();
|
|
125
|
-
for (const [groupName, cmdNames] of Object.entries(GROUPS)) {
|
|
126
|
-
const groupCmds = cmdNames.filter((n) => cmdMap.has(n));
|
|
127
|
-
if (groupCmds.length === 0)
|
|
128
|
-
continue;
|
|
129
|
-
lines.push(`\n ${groupName}:`);
|
|
130
|
-
for (const name of groupCmds) {
|
|
131
|
-
const c = cmdMap.get(name);
|
|
132
|
-
lines.push(` ${name.padEnd(pad)}${c.description() || ''}`);
|
|
133
|
-
grouped.add(name);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return lines.join('\n');
|
|
137
|
-
});
|
|
138
|
-
return program;
|
|
139
|
-
}
|
|
140
|
-
// ─── Main Entry Point ───
|
|
141
|
-
export async function main() {
|
|
142
|
-
const program = createCli();
|
|
143
|
-
await program.parseAsync(process.argv);
|
|
144
|
-
}
|
|
145
|
-
// Auto-execute when run directly (not during test imports)
|
|
146
|
-
const scriptName = process.argv[1] ?? '';
|
|
147
|
-
const isDirectRun = scriptName.endsWith('cli.js') ||
|
|
148
|
-
scriptName.endsWith('cli.ts') ||
|
|
149
|
-
scriptName.endsWith('cli.bundle.js') ||
|
|
150
|
-
scriptName.endsWith('/trading-boy');
|
|
151
|
-
if (isDirectRun) {
|
|
152
|
-
main().catch((err) => {
|
|
153
|
-
console.error(err);
|
|
154
|
-
process.exit(1);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Parse a human-readable interval string (e.g. "1m", "5m", "15m", "1h") to milliseconds.
|
|
4
|
-
* Supported units: s (seconds), m (minutes), h (hours).
|
|
5
|
-
* Returns null if the format is invalid.
|
|
6
|
-
*/
|
|
7
|
-
export declare function parseHumanInterval(value: string): number | null;
|
|
8
|
-
export declare function registerAgentCommand(program: Command): void;
|
|
9
|
-
//# sourceMappingURL=agent-cmd.d.ts.map
|