@quantbrasil/cli 0.1.0-beta.7 → 0.1.0-beta.9
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 +12 -0
- package/dist/cli/index.d.ts +8 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +22 -3
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/skills.d.ts +9 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +68 -4
- package/dist/commands/rankings.d.ts +82 -0
- package/dist/commands/rankings.d.ts.map +1 -0
- package/dist/commands/rankings.js +202 -0
- package/dist/commands/screening.d.ts +44 -0
- package/dist/commands/screening.d.ts.map +1 -1
- package/dist/commands/screening.js +63 -0
- package/dist/commands/skills.js +7 -7
- package/dist/commands/update.d.ts +23 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +209 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/vendor/core/capabilities/index.d.ts +1 -0
- package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/index.js +1 -0
- package/dist/vendor/core/capabilities/rankings.d.ts +83 -0
- package/dist/vendor/core/capabilities/rankings.d.ts.map +1 -0
- package/dist/vendor/core/capabilities/rankings.js +95 -0
- package/dist/vendor/core/capabilities/registry.d.ts +216 -0
- package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/registry.js +2 -0
- package/dist/vendor/core/capabilities/screening.d.ts +27 -0
- package/dist/vendor/core/capabilities/screening.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/screening.js +31 -0
- package/dist/vendor/core/capabilities/types.d.ts +1 -1
- package/dist/vendor/core/capabilities/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/skills/quantbrasil/SKILL.md +10 -5
- package/skills/quantbrasil/references/cli.md +26 -0
- package/skills/quantbrasil/references/costs.md +2 -0
- package/skills/quantbrasil/references/quality-eval-queries.json +5 -0
- package/skills/quantbrasil/references/rankings.md +60 -0
- package/skills/quantbrasil/references/screening.md +212 -0
- package/skills/quantbrasil/references/workflows.md +29 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screening.d.ts","sourceRoot":"","sources":["../../src/commands/screening.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,gCAAgC;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,CAA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AAC;AAE/C,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,uBAA4B,GACpC,IAAI,CAyCN;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,gCAAgC,EACzC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,iCAAiC,EAC1C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,0BAA0B,EACnC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,UAAU,CAAC,CAiBrB;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,0BAA0B,EAChC,KAAK,6CAAsC,GAC1C,MAAM,CAYR;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,2BAA2B,EACjC,KAAK,6CAAsC,GAC1C,MAAM,CAmCR;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,6CAAsC,GAC1C,MAAM,CAiCR"}
|
|
@@ -14,6 +14,13 @@ export function registerScreeningCommands(program, context = {}) {
|
|
|
14
14
|
.action(async (options) => {
|
|
15
15
|
await runScreeningUniversesCommand(options, context);
|
|
16
16
|
});
|
|
17
|
+
screeningCommand
|
|
18
|
+
.command("indicators")
|
|
19
|
+
.description("Lista indicadores disponíveis para screening")
|
|
20
|
+
.option("--json", "Exibe saída JSON")
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
await runScreeningIndicatorsCommand(options, context);
|
|
23
|
+
});
|
|
17
24
|
screeningCommand
|
|
18
25
|
.command("run")
|
|
19
26
|
.description("Executa screening de indicadores a partir de um ScreenerRequest JSON")
|
|
@@ -42,6 +49,20 @@ export async function runScreeningUniversesCommand(options, context = {}) {
|
|
|
42
49
|
}
|
|
43
50
|
stdout.write(`${formatScreeningUniversesHuman(response.data, theme)}\n`);
|
|
44
51
|
}
|
|
52
|
+
export async function runScreeningIndicatorsCommand(options, context = {}) {
|
|
53
|
+
const stdout = context.io?.stdout ?? process.stdout;
|
|
54
|
+
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
55
|
+
const response = await invokeCliCapability({
|
|
56
|
+
capability: "screening.indicators",
|
|
57
|
+
env: context.env,
|
|
58
|
+
fetch: context.fetch,
|
|
59
|
+
});
|
|
60
|
+
if (options.json) {
|
|
61
|
+
stdout.write(`${JSON.stringify(response.data, null, 2)}\n`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
stdout.write(`${formatScreeningIndicatorsHuman(response.data, theme)}\n`);
|
|
65
|
+
}
|
|
45
66
|
export async function runScreeningRunCommand(options, context = {}) {
|
|
46
67
|
const stdout = context.io?.stdout ?? process.stdout;
|
|
47
68
|
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
@@ -84,6 +105,32 @@ export function formatScreeningUniversesHuman(data, theme = createTerminalTheme(
|
|
|
84
105
|
appendUniverseGroup(lines, theme, "Carteiras", data.holdings);
|
|
85
106
|
return lines.join("\n");
|
|
86
107
|
}
|
|
108
|
+
export function formatScreeningIndicatorsHuman(data, theme = createTerminalTheme(process.stdout)) {
|
|
109
|
+
const lines = [
|
|
110
|
+
theme.label("Indicadores de screening"),
|
|
111
|
+
"",
|
|
112
|
+
`${theme.label("Total:")} ${formatInteger(data.indicators.length)}`,
|
|
113
|
+
`${theme.label("Operadores:")} ${data.operators.join(", ")}`,
|
|
114
|
+
];
|
|
115
|
+
for (const indicator of data.indicators) {
|
|
116
|
+
lines.push("");
|
|
117
|
+
lines.push(`${theme.bold(indicator.name)} ${theme.dim("-")} ${indicator.display_name}`);
|
|
118
|
+
lines.push(` ${indicator.description}`);
|
|
119
|
+
lines.push(` ${theme.label("Timeframes:")} ${indicator.timeframes.join(", ")}`);
|
|
120
|
+
if (indicator.params.length > 0) {
|
|
121
|
+
lines.push(` ${theme.label("Parâmetros:")}`);
|
|
122
|
+
for (const param of indicator.params) {
|
|
123
|
+
lines.push(` ${formatIndicatorParam(param)}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (indicator.examples.length > 0) {
|
|
127
|
+
lines.push(` ${theme.label("Exemplos:")} ${indicator.examples
|
|
128
|
+
.map(example => example.label)
|
|
129
|
+
.join(", ")}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return lines.join("\n");
|
|
133
|
+
}
|
|
87
134
|
export function formatScreeningRunHuman(data, theme = createTerminalTheme(process.stdout)) {
|
|
88
135
|
const lines = [
|
|
89
136
|
theme.label("Screening de indicadores"),
|
|
@@ -227,6 +274,22 @@ function formatUniverseKind(kind) {
|
|
|
227
274
|
}
|
|
228
275
|
return "Carteira";
|
|
229
276
|
}
|
|
277
|
+
function formatIndicatorParam(param) {
|
|
278
|
+
const details = [param.type];
|
|
279
|
+
if (param.required) {
|
|
280
|
+
details.push("obrigatório");
|
|
281
|
+
}
|
|
282
|
+
if (param.default !== null) {
|
|
283
|
+
details.push(`padrão ${formatScalar(param.default)}`);
|
|
284
|
+
}
|
|
285
|
+
if (param.enum_values !== null && param.enum_values.length > 0) {
|
|
286
|
+
details.push(`opções ${param.enum_values.join("|")}`);
|
|
287
|
+
}
|
|
288
|
+
return `${param.name}: ${details.join(", ")} - ${param.description}`;
|
|
289
|
+
}
|
|
290
|
+
function formatScalar(value) {
|
|
291
|
+
return typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
292
|
+
}
|
|
230
293
|
function collectIndicatorKeys(results) {
|
|
231
294
|
const keys = [];
|
|
232
295
|
const seen = new Set();
|
package/dist/commands/skills.js
CHANGED
|
@@ -4,18 +4,18 @@ import { createTerminalTheme } from "../cli/terminal.js";
|
|
|
4
4
|
export function registerSkillsCommands(program, context = {}) {
|
|
5
5
|
const skillsCommand = program
|
|
6
6
|
.command("skills")
|
|
7
|
-
.description("
|
|
7
|
+
.description("Gerencia skills públicas empacotadas");
|
|
8
8
|
skillsCommand
|
|
9
9
|
.command("install")
|
|
10
|
-
.description("
|
|
11
|
-
.option("--all", "
|
|
10
|
+
.description("Instala a skill pública do QuantBrasil nos clientes de agente detectados")
|
|
11
|
+
.option("--all", "Instala todas as skills públicas empacotadas")
|
|
12
12
|
.action(async (options) => {
|
|
13
13
|
await runSkillsInstallCommand(options, context);
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
export async function runSkillsInstallCommand(options, context = {}) {
|
|
17
17
|
if (!options.all) {
|
|
18
|
-
throw createCliValidationError("Use --all
|
|
18
|
+
throw createCliValidationError("Use --all para instalar a skill QuantBrasil nos clientes de agente detectados.");
|
|
19
19
|
}
|
|
20
20
|
const stdout = context.io?.stdout ?? process.stdout;
|
|
21
21
|
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
@@ -23,15 +23,15 @@ export async function runSkillsInstallCommand(options, context = {}) {
|
|
|
23
23
|
stdout.write(`${formatSkillsInstallResult(result, theme)}\n`);
|
|
24
24
|
}
|
|
25
25
|
export function formatSkillsInstallResult(result, theme = createTerminalTheme(process.stdout)) {
|
|
26
|
-
const lines = [theme.label("
|
|
26
|
+
const lines = [theme.label("Skill QuantBrasil instalada"), ""];
|
|
27
27
|
for (const target of result.installed) {
|
|
28
28
|
lines.push(`${theme.success(target.label)} ${theme.dim(`→ ${target.installDir}`)}`);
|
|
29
29
|
}
|
|
30
30
|
if (result.skipped.length > 0) {
|
|
31
31
|
lines.push("");
|
|
32
|
-
lines.push(theme.label("
|
|
32
|
+
lines.push(theme.label("Ignorados"));
|
|
33
33
|
for (const target of result.skipped) {
|
|
34
|
-
lines.push(`${theme.dim(`${target.label}
|
|
34
|
+
lines.push(`${theme.dim(`${target.label} não detectado em ${target.rootDir}`)}`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return lines.join("\n");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { type TerminalWriter } from "../cli/terminal.js";
|
|
3
|
+
export interface UpdateCommandIO {
|
|
4
|
+
stdout: TerminalWriter;
|
|
5
|
+
}
|
|
6
|
+
export interface UpdateCommandOptions {
|
|
7
|
+
yes?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateCommandResult {
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
}
|
|
13
|
+
export type UpdateCommandRunner = (command: string, args: readonly string[], env: NodeJS.ProcessEnv) => Promise<UpdateCommandResult>;
|
|
14
|
+
export interface UpdateCommandContext {
|
|
15
|
+
io?: UpdateCommandIO;
|
|
16
|
+
env?: NodeJS.ProcessEnv;
|
|
17
|
+
prompt?: (promptLabel: string) => Promise<string>;
|
|
18
|
+
commandRunner?: UpdateCommandRunner;
|
|
19
|
+
currentVersion?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function registerUpdateCommand(program: Command, context?: UpdateCommandContext): void;
|
|
22
|
+
export declare function runUpdateCommand(options: UpdateCommandOptions, context?: UpdateCommandContext): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,KACnB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAID,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,oBAAyB,GACjC,IAAI,CAQN;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { createCliConfigError } from "../cli/errors.js";
|
|
3
|
+
import { promptForConfirmation } from "../cli/prompt.js";
|
|
4
|
+
import { getBundledSkillInstallState, installBundledSkillEverywhere, } from "../cli/skills.js";
|
|
5
|
+
import { createTerminalTheme } from "../cli/terminal.js";
|
|
6
|
+
import { formatSkillsInstallResult } from "./skills.js";
|
|
7
|
+
const CLI_PACKAGE_SPEC = "@quantbrasil/cli@beta";
|
|
8
|
+
export function registerUpdateCommand(program, context = {}) {
|
|
9
|
+
program
|
|
10
|
+
.command("update")
|
|
11
|
+
.description("Atualiza o pacote global e a skill pública do QuantBrasil")
|
|
12
|
+
.option("--yes", "Atualiza sem confirmação interativa")
|
|
13
|
+
.action(async (options) => {
|
|
14
|
+
await runUpdateCommand(options, context);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export async function runUpdateCommand(options, context = {}) {
|
|
18
|
+
const env = context.env ?? process.env;
|
|
19
|
+
const stdout = context.io?.stdout ?? process.stdout;
|
|
20
|
+
const theme = createTerminalTheme(stdout, env);
|
|
21
|
+
const runner = context.commandRunner ?? runExternalCommand;
|
|
22
|
+
const currentVersion = context.currentVersion ?? "0.0.0";
|
|
23
|
+
const latestVersion = await getLatestBetaVersion(runner, env);
|
|
24
|
+
const cliNeedsUpdate = compareVersions(currentVersion, latestVersion) < 0;
|
|
25
|
+
const skillState = await getBundledSkillInstallState(env);
|
|
26
|
+
const skillNeedsUpdate = skillState.needsInstall;
|
|
27
|
+
if (!cliNeedsUpdate && !skillNeedsUpdate) {
|
|
28
|
+
stdout.write(`${theme.success("QuantBrasil CLI já está atualizado.")}\n`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
stdout.write(`${formatUpdatePlan({
|
|
32
|
+
currentVersion,
|
|
33
|
+
latestVersion,
|
|
34
|
+
cliNeedsUpdate,
|
|
35
|
+
skillState,
|
|
36
|
+
}, theme)}\n`);
|
|
37
|
+
if (!(await shouldContinue(options, context))) {
|
|
38
|
+
stdout.write(`${theme.warning("Atualização cancelada.")}\n`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (cliNeedsUpdate) {
|
|
42
|
+
await runner("npm", ["install", "-g", CLI_PACKAGE_SPEC], env);
|
|
43
|
+
await runner("quantbrasil", ["skills", "install", "--all"], env);
|
|
44
|
+
stdout.write(`${theme.success("Atualização concluída.")}\n`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const skillInstallResult = await installBundledSkillEverywhere(env);
|
|
48
|
+
stdout.write(`${formatSkillsInstallResult(skillInstallResult, theme)}\n`);
|
|
49
|
+
stdout.write(`${theme.success("Atualização concluída.")}\n`);
|
|
50
|
+
}
|
|
51
|
+
function formatUpdatePlan(data, theme) {
|
|
52
|
+
const lines = [
|
|
53
|
+
theme.label("Atualização do QuantBrasil CLI"),
|
|
54
|
+
"",
|
|
55
|
+
`${theme.label("Versão instalada:")} ${data.currentVersion}`,
|
|
56
|
+
`${theme.label("Versão beta publicada:")} ${data.latestVersion}`,
|
|
57
|
+
];
|
|
58
|
+
const skillTargets = data.skillState.targets.filter(target => target.status === "missing" || target.status === "stale");
|
|
59
|
+
if (skillTargets.length > 0) {
|
|
60
|
+
lines.push(`${theme.label("Skills:")} ${skillTargets.length} alvo(s) precisam ser atualizados`);
|
|
61
|
+
for (const target of skillTargets) {
|
|
62
|
+
lines.push(` ${target.label}: ${formatSkillStatus(target.status)} ${theme.dim(`(${target.installDir})`)}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
lines.push(`${theme.label("Skills:")} já estão atualizadas`);
|
|
67
|
+
}
|
|
68
|
+
lines.push("");
|
|
69
|
+
lines.push(theme.label("Ações"));
|
|
70
|
+
if (data.cliNeedsUpdate) {
|
|
71
|
+
lines.push(` npm install -g ${CLI_PACKAGE_SPEC}`);
|
|
72
|
+
lines.push(" quantbrasil skills install --all");
|
|
73
|
+
}
|
|
74
|
+
else if (skillTargets.length > 0) {
|
|
75
|
+
lines.push(" quantbrasil skills install --all");
|
|
76
|
+
}
|
|
77
|
+
return lines.join("\n");
|
|
78
|
+
}
|
|
79
|
+
async function shouldContinue(options, context) {
|
|
80
|
+
if (options.yes) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (context.prompt) {
|
|
84
|
+
return parseConfirmationAnswer(await context.prompt("Atualizar agora? [s/N] "));
|
|
85
|
+
}
|
|
86
|
+
return promptForConfirmation("Atualizar agora? [s/N] ");
|
|
87
|
+
}
|
|
88
|
+
function formatSkillStatus(status) {
|
|
89
|
+
if (status === "missing") {
|
|
90
|
+
return "não instalada";
|
|
91
|
+
}
|
|
92
|
+
if (status === "stale") {
|
|
93
|
+
return "desatualizada";
|
|
94
|
+
}
|
|
95
|
+
return status;
|
|
96
|
+
}
|
|
97
|
+
function parseConfirmationAnswer(answer) {
|
|
98
|
+
return ["s", "sim", "y", "yes"].includes(answer.trim().toLowerCase());
|
|
99
|
+
}
|
|
100
|
+
async function getLatestBetaVersion(runner, env) {
|
|
101
|
+
const result = await runner("npm", ["view", CLI_PACKAGE_SPEC, "version"], env);
|
|
102
|
+
const version = result.stdout.trim();
|
|
103
|
+
if (!version) {
|
|
104
|
+
throw createCliConfigError(`Não foi possível resolver a versão publicada de ${CLI_PACKAGE_SPEC}.`);
|
|
105
|
+
}
|
|
106
|
+
return version;
|
|
107
|
+
}
|
|
108
|
+
function compareVersions(left, right) {
|
|
109
|
+
const parsedLeft = parseVersion(left);
|
|
110
|
+
const parsedRight = parseVersion(right);
|
|
111
|
+
for (let index = 0; index < 3; index += 1) {
|
|
112
|
+
const diff = (parsedLeft.main[index] ?? 0) - (parsedRight.main[index] ?? 0);
|
|
113
|
+
if (diff !== 0) {
|
|
114
|
+
return diff;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (parsedLeft.prerelease.length === 0 &&
|
|
118
|
+
parsedRight.prerelease.length === 0) {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
if (parsedLeft.prerelease.length === 0) {
|
|
122
|
+
return 1;
|
|
123
|
+
}
|
|
124
|
+
if (parsedRight.prerelease.length === 0) {
|
|
125
|
+
return -1;
|
|
126
|
+
}
|
|
127
|
+
const length = Math.max(parsedLeft.prerelease.length, parsedRight.prerelease.length);
|
|
128
|
+
for (let index = 0; index < length; index += 1) {
|
|
129
|
+
const leftPart = parsedLeft.prerelease[index];
|
|
130
|
+
const rightPart = parsedRight.prerelease[index];
|
|
131
|
+
if (leftPart === undefined) {
|
|
132
|
+
return -1;
|
|
133
|
+
}
|
|
134
|
+
if (rightPart === undefined) {
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
|
137
|
+
const diff = comparePrereleasePart(leftPart, rightPart);
|
|
138
|
+
if (diff !== 0) {
|
|
139
|
+
return diff;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
function parseVersion(version) {
|
|
145
|
+
const [mainVersion = "0.0.0", prerelease = ""] = version
|
|
146
|
+
.trim()
|
|
147
|
+
.replace(/^v/, "")
|
|
148
|
+
.split("-");
|
|
149
|
+
const mainParts = mainVersion.split(".").map(part => Number(part));
|
|
150
|
+
const main = [
|
|
151
|
+
normalizeVersionPart(mainParts[0]),
|
|
152
|
+
normalizeVersionPart(mainParts[1]),
|
|
153
|
+
normalizeVersionPart(mainParts[2]),
|
|
154
|
+
];
|
|
155
|
+
return {
|
|
156
|
+
main,
|
|
157
|
+
prerelease: prerelease ? prerelease.split(".") : [],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function normalizeVersionPart(part) {
|
|
161
|
+
return Number.isFinite(part) ? Number(part) : 0;
|
|
162
|
+
}
|
|
163
|
+
function comparePrereleasePart(left, right) {
|
|
164
|
+
const leftNumber = Number(left);
|
|
165
|
+
const rightNumber = Number(right);
|
|
166
|
+
const leftIsNumeric = /^\d+$/.test(left);
|
|
167
|
+
const rightIsNumeric = /^\d+$/.test(right);
|
|
168
|
+
if (leftIsNumeric && rightIsNumeric) {
|
|
169
|
+
return leftNumber - rightNumber;
|
|
170
|
+
}
|
|
171
|
+
if (leftIsNumeric) {
|
|
172
|
+
return -1;
|
|
173
|
+
}
|
|
174
|
+
if (rightIsNumeric) {
|
|
175
|
+
return 1;
|
|
176
|
+
}
|
|
177
|
+
return left.localeCompare(right);
|
|
178
|
+
}
|
|
179
|
+
function runExternalCommand(command, args, env) {
|
|
180
|
+
return new Promise((resolve, reject) => {
|
|
181
|
+
const child = spawn(command, args, {
|
|
182
|
+
env,
|
|
183
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
184
|
+
});
|
|
185
|
+
let stdout = "";
|
|
186
|
+
let stderr = "";
|
|
187
|
+
child.stdout.on("data", chunk => {
|
|
188
|
+
stdout += chunk;
|
|
189
|
+
});
|
|
190
|
+
child.stderr.on("data", chunk => {
|
|
191
|
+
stderr += chunk;
|
|
192
|
+
});
|
|
193
|
+
child.on("error", error => {
|
|
194
|
+
reject(createCliConfigError(`Não foi possível executar ${command}: ${error.message}`));
|
|
195
|
+
});
|
|
196
|
+
child.on("close", code => {
|
|
197
|
+
if (code === 0) {
|
|
198
|
+
resolve({ stdout, stderr });
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
reject(createCliConfigError([
|
|
202
|
+
`${command} ${args.join(" ")} falhou com exit ${code}.`,
|
|
203
|
+
stderr.trim() || stdout.trim(),
|
|
204
|
+
]
|
|
205
|
+
.filter(Boolean)
|
|
206
|
+
.join("\n")));
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export * from "./commands/capabilities.js";
|
|
|
8
8
|
export * from "./commands/init.js";
|
|
9
9
|
export * from "./commands/market.js";
|
|
10
10
|
export * from "./commands/portfolios.js";
|
|
11
|
+
export * from "./commands/rankings.js";
|
|
11
12
|
export * from "./commands/screening.js";
|
|
12
13
|
export * from "./commands/skills.js";
|
|
13
14
|
export * from "./commands/status.js";
|
|
15
|
+
export * from "./commands/update.js";
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export * from "./commands/capabilities.js";
|
|
|
8
8
|
export * from "./commands/init.js";
|
|
9
9
|
export * from "./commands/market.js";
|
|
10
10
|
export * from "./commands/portfolios.js";
|
|
11
|
+
export * from "./commands/rankings.js";
|
|
11
12
|
export * from "./commands/screening.js";
|
|
12
13
|
export * from "./commands/skills.js";
|
|
13
14
|
export * from "./commands/status.js";
|
|
15
|
+
export * from "./commands/update.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const rankingsCapabilities: readonly [{
|
|
2
|
+
readonly id: "rankings.list";
|
|
3
|
+
readonly kind: "read";
|
|
4
|
+
readonly visibility: readonly ["cli", "opencode"];
|
|
5
|
+
readonly description: "Lista rankings do sistema e rankings do usuário disponíveis para consulta atual.";
|
|
6
|
+
readonly http: {
|
|
7
|
+
readonly method: "GET";
|
|
8
|
+
readonly path: "/api/desk/tools/rankings/list";
|
|
9
|
+
readonly inputMode: "none";
|
|
10
|
+
readonly schemas: {
|
|
11
|
+
readonly request: null;
|
|
12
|
+
readonly response: "RankingsListResponse";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly cli: {
|
|
16
|
+
readonly group: "rankings";
|
|
17
|
+
readonly command: "list";
|
|
18
|
+
readonly summary: "Lista rankings do sistema e rankings do usuário.";
|
|
19
|
+
readonly positional: readonly [];
|
|
20
|
+
readonly options: readonly [];
|
|
21
|
+
readonly examples: readonly ["quantbrasil rankings list"];
|
|
22
|
+
};
|
|
23
|
+
readonly tool: {
|
|
24
|
+
readonly name: "qb_rankings_list";
|
|
25
|
+
readonly title: "Listar rankings";
|
|
26
|
+
};
|
|
27
|
+
readonly outputModes: readonly ["json", "human"];
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "rankings.current";
|
|
30
|
+
readonly kind: "read";
|
|
31
|
+
readonly visibility: readonly ["cli", "opencode"];
|
|
32
|
+
readonly description: "Retorna os ativos atuais no topo de um ranking do sistema ou ranking do usuário.";
|
|
33
|
+
readonly http: {
|
|
34
|
+
readonly method: "POST";
|
|
35
|
+
readonly path: "/api/desk/tools/rankings/current";
|
|
36
|
+
readonly inputMode: "json_body";
|
|
37
|
+
readonly schemas: {
|
|
38
|
+
readonly request: "RankingCurrentRequest";
|
|
39
|
+
readonly response: "RankingCurrentResponse";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly cli: {
|
|
43
|
+
readonly group: "rankings";
|
|
44
|
+
readonly command: "current";
|
|
45
|
+
readonly summary: "Consulta o topo atual de um ranking.";
|
|
46
|
+
readonly positional: readonly [];
|
|
47
|
+
readonly options: readonly [{
|
|
48
|
+
readonly kind: "option";
|
|
49
|
+
readonly flag: "--system";
|
|
50
|
+
readonly name: "system_id";
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly required: false;
|
|
53
|
+
readonly placeholder: "ID";
|
|
54
|
+
readonly exclusiveGroup: "ranking_selector";
|
|
55
|
+
readonly description: "ID de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.";
|
|
56
|
+
}, {
|
|
57
|
+
readonly kind: "option";
|
|
58
|
+
readonly flag: "--user";
|
|
59
|
+
readonly name: "user_ranking_id";
|
|
60
|
+
readonly type: "integer";
|
|
61
|
+
readonly required: false;
|
|
62
|
+
readonly placeholder: "ID";
|
|
63
|
+
readonly exclusiveGroup: "ranking_selector";
|
|
64
|
+
readonly description: "ID numérico de ranking do usuário retornado por `rankings list`.";
|
|
65
|
+
}, {
|
|
66
|
+
readonly kind: "option";
|
|
67
|
+
readonly flag: "--top";
|
|
68
|
+
readonly name: "top_n";
|
|
69
|
+
readonly type: "integer";
|
|
70
|
+
readonly required: false;
|
|
71
|
+
readonly placeholder: "N";
|
|
72
|
+
readonly defaultValue: 20;
|
|
73
|
+
readonly description: "Número de ativos do topo do ranking a retornar.";
|
|
74
|
+
}];
|
|
75
|
+
readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --user 123 --top 20"];
|
|
76
|
+
};
|
|
77
|
+
readonly tool: {
|
|
78
|
+
readonly name: "qb_rankings_current";
|
|
79
|
+
readonly title: "Consultar ranking atual";
|
|
80
|
+
};
|
|
81
|
+
readonly outputModes: readonly ["json", "human"];
|
|
82
|
+
}];
|
|
83
|
+
//# sourceMappingURL=rankings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rankings.d.ts","sourceRoot":"","sources":["../../src/capabilities/rankings.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgGmB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { publicRuntimeVisibility, standardOutputModes } from "./shared.js";
|
|
2
|
+
const rankingSelectorExclusiveGroup = "ranking_selector";
|
|
3
|
+
export const rankingsCapabilities = [
|
|
4
|
+
{
|
|
5
|
+
id: "rankings.list",
|
|
6
|
+
kind: "read",
|
|
7
|
+
visibility: publicRuntimeVisibility,
|
|
8
|
+
description: "Lista rankings do sistema e rankings do usuário disponíveis para consulta atual.",
|
|
9
|
+
http: {
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/api/desk/tools/rankings/list",
|
|
12
|
+
inputMode: "none",
|
|
13
|
+
schemas: {
|
|
14
|
+
request: null,
|
|
15
|
+
response: "RankingsListResponse",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
cli: {
|
|
19
|
+
group: "rankings",
|
|
20
|
+
command: "list",
|
|
21
|
+
summary: "Lista rankings do sistema e rankings do usuário.",
|
|
22
|
+
positional: [],
|
|
23
|
+
options: [],
|
|
24
|
+
examples: ["quantbrasil rankings list"],
|
|
25
|
+
},
|
|
26
|
+
tool: {
|
|
27
|
+
name: "qb_rankings_list",
|
|
28
|
+
title: "Listar rankings",
|
|
29
|
+
},
|
|
30
|
+
outputModes: standardOutputModes,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "rankings.current",
|
|
34
|
+
kind: "read",
|
|
35
|
+
visibility: publicRuntimeVisibility,
|
|
36
|
+
description: "Retorna os ativos atuais no topo de um ranking do sistema ou ranking do usuário.",
|
|
37
|
+
http: {
|
|
38
|
+
method: "POST",
|
|
39
|
+
path: "/api/desk/tools/rankings/current",
|
|
40
|
+
inputMode: "json_body",
|
|
41
|
+
schemas: {
|
|
42
|
+
request: "RankingCurrentRequest",
|
|
43
|
+
response: "RankingCurrentResponse",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
cli: {
|
|
47
|
+
group: "rankings",
|
|
48
|
+
command: "current",
|
|
49
|
+
summary: "Consulta o topo atual de um ranking.",
|
|
50
|
+
positional: [],
|
|
51
|
+
options: [
|
|
52
|
+
{
|
|
53
|
+
kind: "option",
|
|
54
|
+
flag: "--system",
|
|
55
|
+
name: "system_id",
|
|
56
|
+
type: "string",
|
|
57
|
+
required: false,
|
|
58
|
+
placeholder: "ID",
|
|
59
|
+
exclusiveGroup: rankingSelectorExclusiveGroup,
|
|
60
|
+
description: "ID de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
kind: "option",
|
|
64
|
+
flag: "--user",
|
|
65
|
+
name: "user_ranking_id",
|
|
66
|
+
type: "integer",
|
|
67
|
+
required: false,
|
|
68
|
+
placeholder: "ID",
|
|
69
|
+
exclusiveGroup: rankingSelectorExclusiveGroup,
|
|
70
|
+
description: "ID numérico de ranking do usuário retornado por `rankings list`.",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
kind: "option",
|
|
74
|
+
flag: "--top",
|
|
75
|
+
name: "top_n",
|
|
76
|
+
type: "integer",
|
|
77
|
+
required: false,
|
|
78
|
+
placeholder: "N",
|
|
79
|
+
defaultValue: 20,
|
|
80
|
+
description: "Número de ativos do topo do ranking a retornar.",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
examples: [
|
|
84
|
+
"quantbrasil rankings current --system momentum-90d --top 20",
|
|
85
|
+
"quantbrasil rankings current --system magic-formula --top 10",
|
|
86
|
+
"quantbrasil rankings current --user 123 --top 20",
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
tool: {
|
|
90
|
+
name: "qb_rankings_current",
|
|
91
|
+
title: "Consultar ranking atual",
|
|
92
|
+
},
|
|
93
|
+
outputModes: standardOutputModes,
|
|
94
|
+
},
|
|
95
|
+
];
|