@winning-sales/nexo 0.1.0 → 0.2.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.
@@ -7,12 +7,12 @@ description: Como montar e mudar painéis (dashboards) do Nexo pela API — cat
7
7
 
8
8
  Um painel tem abas, seções e relatórios (gráficos). **Nenhum número sai de você**: você escreve a especificação, o servidor confere contra o catálogo da empresa e roda a consulta. A leitura pede `context:read`; mudar pede `dashboards:write`. Tudo fica em `/v1/crm/dashboards`.
9
9
 
10
- ## O fluxo
10
+ ## O fluxo, pela CLI
11
11
 
12
- 1. **Catálogo primeiro.** `nexo api crm/dashboards/catalog -X GET -f text=<termo> --json`. Use só fontes, campos e medidas que o catálogo devolve; o campo de uma fonte ligada é `ligacao.campo` (`owner.name`, `deal.pipelineId`). Se a medida pedida não existe, diga "não há a medida X" e não invente.
13
- 2. **Painel atual.** `nexo api crm/dashboards --json` e `nexo api crm/dashboards/<id> --json`.
14
- 3. **Prévia.** `nexo api crm/dashboards/preview --input mudanca.json` com `dashboardId` (sem ele, cria um painel), `summary` e `operations`: `set_panel`, `add_tab`, `rename_tab`, `set_tab_variables`, `remove_tab`, `add_section`, `change_section`, `remove_section`, `add_report`, `change_report`, `remove_report`, `set_tab_audience`, `set_report_audience`. O que você não cita fica como estava. Se vier `dashboards.spec_invalid`, corrija pelo `problems` e mande de novo.
15
- 4. **Mostre a prévia e espere o sim.** Depois: `nexo api crm/dashboards/proposals/<proposalId>/save -X POST`. Repetir o sim não grava outra versão. Proposta vale 2 horas; `dashboards.proposal_conflict` (409) quer dizer que o painel mudou no que você editou: leia de novo e refaça.
12
+ 1. **Catálogo primeiro.** `nexo dashboards catalog --text <termo>` (e `--source <fonte>`). Use só fontes, campos e medidas que o catálogo devolve; o campo de uma fonte ligada é `ligacao.campo` (`owner.name`, `deal.pipelineId`). Se a medida pedida não existe, diga "não há a medida X" e não invente.
13
+ 2. **O painel numa pasta.** `nexo dashboards pull <id> <pasta>` (veja os ids com `nexo dashboards list`) ou `nexo dashboards init <pasta>` para um novo. O `dashboard.json` tem o painel (`name`, `description`, `variables`, `settings`) e as abas, cada uma com `sections` e `reports`; cada relatório tem `key`, `section`, `queries`, `presentation`, `layout` (`x`, `y`, `w`, `h` numa grade de 24 colunas) e `audience`. Num item novo, invente uma `key` curta (`receita_mes`); os que vieram do Nexo usam o id, que você não muda.
14
+ 3. **Prévia.** `nexo dashboards push <pasta> -m "o que mudou"` compara a pasta com o painel do Nexo, manda só as operações que mudam, e o servidor confere tudo contra o catálogo e roda cada relatório novo ou mudado. Se vier `dashboards.spec_invalid`, corrija pelo `problems` e mande de novo.
15
+ 4. **Mostre a prévia e espere o sim.** Fora de um terminal, a CLI mostra a prévia e o comando `nexo dashboards save <prévia> <pasta>`; rode-o só depois do sim da pessoa. A prévia vale 2 horas. Depois de salvar, a pasta é reescrita com os ids do Nexo. `dashboards.proposal_conflict` (409) quer dizer que alguém mudou o mesmo painel: `pull` numa pasta nova e refaça.
16
16
  5. Errou? `nexo api crm/dashboards/<id>/versions/<seq>/restore -X POST` cria uma versão nova igual à antiga (o painel guarda 30).
17
17
 
18
18
  ## A especificação de um relatório
@@ -25,7 +25,7 @@ Um painel tem abas, seções e relatórios (gráficos). **Nenhum número sai de
25
25
 
26
26
  ## Outras operações
27
27
 
28
- - Números de um relatório salvo: `nexo api crm/dashboards/<id>/reports/<reportId>/run -X POST`.
28
+ - Números de um relatório salvo: `nexo dashboards run <relatório> <pasta>`.
29
29
  - Valores possíveis de um filtro: `nexo api crm/dashboards/variables/options --input valores.json`.
30
30
  - Alertas (`.../<id>/alerts`) e links públicos (`.../<id>/public-links`, só administrador) mudam o que outras pessoas recebem: confirme com a pessoa antes.
31
31
  - Apagar um painel não tem volta pela API: confirme antes de `nexo api crm/dashboards/<id> -X DELETE`.
@@ -0,0 +1,145 @@
1
+ import { createInterface } from 'node:readline';
2
+ import { clientOf, printJson, printLine, printNotice, sessionOf } from '../context.js';
3
+ import { usageError } from '../errors.js';
4
+ import { ensureEmpty, projectDirectory } from '../connect/project.js';
5
+ import { panelFileOf, readPanelFile, readPanelState, templatePanel, writePanelFile, writePanelState } from '../dashboards/panel-file.js';
6
+ import { operationsFor } from '../dashboards/operations.js';
7
+ const BASE = '/v1/crm/dashboards';
8
+ async function call(context, session, method, path, body) {
9
+ const response = await clientOf(context, session).request({
10
+ method,
11
+ path: `${BASE}${path}`,
12
+ ...(body === undefined ? {} : { body })
13
+ });
14
+ return response.body;
15
+ }
16
+ async function remotePanel(context, session, dashboardId) {
17
+ return (await call(context, session, 'GET', `/${dashboardId}`)).panel;
18
+ }
19
+ export async function dashboardsList(context, options) {
20
+ const body = (await call(context, sessionOf(context, options), 'GET', ''));
21
+ if (options.json === true) {
22
+ printJson(context, body);
23
+ return;
24
+ }
25
+ body.dashboards.forEach((panel) => {
26
+ printLine(context, `${panel.id} ${panel.scope.padEnd(8)} ${String(panel.reportCount).padStart(3)} relatórios ${panel.name}`);
27
+ });
28
+ }
29
+ export async function dashboardsCatalog(context, options) {
30
+ const query = new URLSearchParams();
31
+ for (const [key, value] of [
32
+ ['text', options.text],
33
+ ['source', options.source],
34
+ ['limit', options.limit]
35
+ ]) {
36
+ if (value !== undefined) {
37
+ query.set(key, value);
38
+ }
39
+ }
40
+ const body = (await call(context, sessionOf(context, options), 'GET', `/catalog${query.size === 0 ? '' : `?${query.toString()}`}`));
41
+ if (options.json === true) {
42
+ printJson(context, body);
43
+ return;
44
+ }
45
+ body.hits.forEach((hit) => {
46
+ printLine(context, `${hit.kind.padEnd(8)} ${hit.source}.${hit.key} ${hit.label}${hit.detail === null ? '' : ` — ${hit.detail}`}`);
47
+ });
48
+ if (body.truncated) {
49
+ printNotice(context, 'Há mais resultados: refine com --text ou --source.');
50
+ }
51
+ }
52
+ export function dashboardsInit(context, dir, options) {
53
+ const directory = projectDirectory(dir);
54
+ ensureEmpty(directory);
55
+ writePanelFile(directory, templatePanel(options.name ?? 'Novo painel'));
56
+ writePanelState(directory, { dashboardId: null });
57
+ printLine(context, `Painel criado em ${directory}.`);
58
+ printNotice(context, 'Busque fontes e medidas com `nexo dashboards catalog --text <termo>`, escreva os relatórios e mande com `nexo dashboards push`.');
59
+ }
60
+ export async function dashboardsPull(context, dashboardId, dir, options) {
61
+ const directory = projectDirectory(dir ?? dashboardId);
62
+ ensureEmpty(directory);
63
+ const panel = await remotePanel(context, sessionOf(context, options), dashboardId);
64
+ writePanelFile(directory, panelFileOf(panel));
65
+ writePanelState(directory, { dashboardId });
66
+ printLine(context, `"${panel.name}" (versão ${String(panel.headSeq)}) em ${directory}.`);
67
+ }
68
+ async function ask(context) {
69
+ const reader = createInterface({ input: context.stdin, output: context.stderr, terminal: true });
70
+ try {
71
+ const answer = await new Promise((resolve) => {
72
+ reader.question('Salvar? (s/N) ', resolve);
73
+ });
74
+ return /^(s|sim|y|yes)$/i.test(answer.trim());
75
+ }
76
+ finally {
77
+ reader.close();
78
+ }
79
+ }
80
+ function showProposal(context, proposal) {
81
+ printLine(context, 'Prévia (o servidor conferiu e rodou cada relatório novo ou mudado):');
82
+ proposal.changes.forEach((change) => {
83
+ printLine(context, ` - ${change}`);
84
+ });
85
+ if (proposal.blockedReports > 0) {
86
+ printLine(context, `${String(proposal.blockedReports)} relatório(s) que você não vê por inteiro não entraram na prévia.`);
87
+ }
88
+ }
89
+ async function saveProposal(context, session, directory, proposalId) {
90
+ const panel = (await call(context, session, 'POST', `/proposals/${proposalId}/save`, {}));
91
+ if (directory !== null) {
92
+ writePanelFile(directory, panelFileOf(panel));
93
+ writePanelState(directory, { dashboardId: panel.id });
94
+ }
95
+ printLine(context, `Painel "${panel.name}" salvo, versão ${String(panel.headSeq)}.${directory === null ? '' : ' A pasta foi atualizada com os ids do Nexo.'}`);
96
+ }
97
+ async function decide(context, session, directory, proposal, options) {
98
+ if (options.yes === true || (context.stdin.isTTY === true && (await ask(context)))) {
99
+ await saveProposal(context, session, directory, proposal.id);
100
+ return;
101
+ }
102
+ if (context.stdin.isTTY === true) {
103
+ printNotice(context, 'Nada foi salvo.');
104
+ return;
105
+ }
106
+ printNotice(context, `Mostre a prévia à pessoa. Depois do sim dela, salve (vale até ${proposal.expiresAt}):`);
107
+ printNotice(context, ` nexo dashboards save ${proposal.id}${directory === projectDirectory('.') ? '' : ` ${directory}`}`);
108
+ }
109
+ export async function dashboardsPush(context, dir, options) {
110
+ const directory = projectDirectory(dir);
111
+ const local = readPanelFile(directory);
112
+ const state = readPanelState(directory);
113
+ const session = sessionOf(context, options);
114
+ const remote = state.dashboardId === null ? null : panelFileOf(await remotePanel(context, session, state.dashboardId));
115
+ const operations = operationsFor(local, remote);
116
+ if (operations.length === 0) {
117
+ printLine(context, 'O painel no Nexo já está igual à pasta.');
118
+ return;
119
+ }
120
+ const summary = (options.summary ?? '').trim() || `Mudança pela CLI (${String(operations.length)} operações)`;
121
+ const proposal = (await call(context, session, 'POST', '/preview', {
122
+ ...(state.dashboardId === null ? {} : { dashboardId: state.dashboardId }),
123
+ summary,
124
+ operations
125
+ }));
126
+ if (options.json === true && options.yes !== true) {
127
+ printJson(context, { operations, proposal });
128
+ return;
129
+ }
130
+ showProposal(context, proposal);
131
+ await decide(context, session, directory, proposal, options);
132
+ }
133
+ export async function dashboardsSave(context, proposalId, dir, options) {
134
+ if (proposalId.trim() === '') {
135
+ throw usageError('Diga a prévia a salvar.');
136
+ }
137
+ await saveProposal(context, sessionOf(context, options), dir === undefined ? null : projectDirectory(dir), proposalId);
138
+ }
139
+ export async function dashboardsRun(context, reportId, dir, options) {
140
+ const dashboardId = options.dashboard ?? readPanelState(projectDirectory(dir)).dashboardId;
141
+ if (dashboardId === null) {
142
+ throw usageError('Este painel ainda não foi salvo no Nexo.', 'Use --dashboard <id>, ou rode dentro da pasta de um painel salvo.');
143
+ }
144
+ printJson(context, await call(context, sessionOf(context, options), 'POST', `/${dashboardId}/reports/${reportId}/run`, {}));
145
+ }
@@ -0,0 +1,124 @@
1
+ function same(left, right) {
2
+ return JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
3
+ }
4
+ function audienceOf(audience) {
5
+ if (audience === null || ((audience.profiles ?? []).length === 0 && (audience.roles ?? []).length === 0)) {
6
+ return null;
7
+ }
8
+ return { profiles: audience.profiles ?? [], roles: audience.roles ?? [] };
9
+ }
10
+ function reportsOf(panel) {
11
+ const reports = new Map();
12
+ for (const tab of panel?.tabs ?? []) {
13
+ tab.reports.forEach((report) => reports.set(report.key, { tab: tab.key, report }));
14
+ }
15
+ return reports;
16
+ }
17
+ function panelOperations(local, remote) {
18
+ const changed = remote === null ||
19
+ local.name !== remote.name ||
20
+ !same(local.description, remote.description) ||
21
+ !same(local.variables, remote.variables) ||
22
+ !same(local.settings, remote.settings);
23
+ return changed
24
+ ? [{ op: 'set_panel', name: local.name, description: local.description, variables: local.variables, settings: local.settings }]
25
+ : [];
26
+ }
27
+ function newTabOperations(tab) {
28
+ const audience = audienceOf(tab.audience);
29
+ return [
30
+ { op: 'add_tab', key: tab.key, title: tab.title, variables: tab.variables },
31
+ ...(audience === null ? [] : [{ op: 'set_tab_audience', tab: tab.key, audience }])
32
+ ];
33
+ }
34
+ function tabChanges(tab, before) {
35
+ const operations = [];
36
+ if (tab.title !== before.title) {
37
+ operations.push({ op: 'rename_tab', tab: tab.key, title: tab.title });
38
+ }
39
+ if (!same(tab.variables, before.variables)) {
40
+ operations.push({ op: 'set_tab_variables', tab: tab.key, variables: tab.variables });
41
+ }
42
+ if (!same(audienceOf(tab.audience), audienceOf(before.audience))) {
43
+ operations.push({ op: 'set_tab_audience', tab: tab.key, audience: audienceOf(tab.audience) ?? { profiles: [], roles: [] } });
44
+ }
45
+ return operations;
46
+ }
47
+ function sectionOperations(tab, before) {
48
+ const previous = new Map((before?.sections ?? []).map((section) => [section.key, section]));
49
+ const current = new Set(tab.sections.map((section) => section.key));
50
+ const removed = [...previous.keys()]
51
+ .filter((key) => !current.has(key))
52
+ .map((key) => ({ op: 'remove_section', tab: tab.key, section: key }));
53
+ const upserts = tab.sections.flatMap((section) => {
54
+ const old = previous.get(section.key);
55
+ if (old === undefined) {
56
+ return [{ op: 'add_section', tab: tab.key, key: section.key, title: section.title, collapsed: section.collapsed }];
57
+ }
58
+ return old.title === section.title && old.collapsed === section.collapsed
59
+ ? []
60
+ : [{ op: 'change_section', tab: tab.key, section: section.key, title: section.title, collapsed: section.collapsed }];
61
+ });
62
+ return [...removed, ...upserts];
63
+ }
64
+ function layoutOf(placed) {
65
+ return { tab: placed.tab, section: placed.report.section, ...placed.report.layout };
66
+ }
67
+ function reportChange(placed, before) {
68
+ const change = {};
69
+ if (!same(placed.report.queries, before.report.queries)) {
70
+ change.queries = placed.report.queries;
71
+ }
72
+ if (!same(placed.report.presentation, before.report.presentation)) {
73
+ change.presentation = placed.report.presentation;
74
+ }
75
+ if (!same(layoutOf(placed), layoutOf(before))) {
76
+ change.layout = layoutOf(placed);
77
+ }
78
+ const operations = Object.keys(change).length === 0 ? [] : [{ op: 'change_report', report: placed.report.key, ...change }];
79
+ if (!same(audienceOf(placed.report.audience), audienceOf(before.report.audience))) {
80
+ operations.push({
81
+ op: 'set_report_audience',
82
+ report: placed.report.key,
83
+ audience: audienceOf(placed.report.audience) ?? { profiles: [], roles: [] }
84
+ });
85
+ }
86
+ return operations;
87
+ }
88
+ function reportOperations(local, remote) {
89
+ const previous = reportsOf(remote);
90
+ const current = reportsOf(local);
91
+ const removed = [...previous.keys()]
92
+ .filter((key) => !current.has(key))
93
+ .map((key) => ({ op: 'remove_report', report: key }));
94
+ const upserts = [...current.values()].flatMap((placed) => {
95
+ const before = previous.get(placed.report.key);
96
+ if (before !== undefined) {
97
+ return reportChange(placed, before);
98
+ }
99
+ const audience = audienceOf(placed.report.audience);
100
+ const add = {
101
+ op: 'add_report',
102
+ key: placed.report.key,
103
+ queries: placed.report.queries,
104
+ presentation: placed.report.presentation,
105
+ layout: layoutOf(placed)
106
+ };
107
+ return audience === null ? [add] : [add, { op: 'set_report_audience', report: placed.report.key, audience }];
108
+ });
109
+ return { removed, upserts };
110
+ }
111
+ export function operationsFor(local, remote) {
112
+ const previousTabs = new Map((remote?.tabs ?? []).map((tab) => [tab.key, tab]));
113
+ const currentTabs = new Set(local.tabs.map((tab) => tab.key));
114
+ const reports = reportOperations(local, remote);
115
+ const removedTabs = [...previousTabs.keys()]
116
+ .filter((key) => !currentTabs.has(key))
117
+ .map((key) => ({ op: 'remove_tab', tab: key }));
118
+ const tabs = local.tabs.flatMap((tab) => {
119
+ const before = previousTabs.get(tab.key);
120
+ return before === undefined ? newTabOperations(tab) : tabChanges(tab, before);
121
+ });
122
+ const sections = local.tabs.flatMap((tab) => sectionOperations(tab, previousTabs.get(tab.key)));
123
+ return [...reports.removed, ...removedTabs, ...panelOperations(local, remote), ...tabs, ...sections, ...reports.upserts];
124
+ }
@@ -0,0 +1,78 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { usageError } from '../errors.js';
4
+ export const PANEL_FILE = 'dashboard.json';
5
+ export const PANEL_STATE_FILE = 'nexo-dashboard.json';
6
+ function tabOf(tab) {
7
+ return {
8
+ key: tab.id,
9
+ title: tab.title,
10
+ variables: tab.variables ?? [],
11
+ audience: tab.audience,
12
+ sections: tab.sections.map((section) => ({ key: section.id, title: section.title, collapsed: section.collapsed })),
13
+ reports: tab.reports.map((report) => ({
14
+ key: report.id,
15
+ section: report.sectionId,
16
+ queries: report.queries,
17
+ presentation: report.presentation,
18
+ layout: { x: report.layout.x, y: report.layout.y, w: report.layout.w, h: report.layout.h },
19
+ audience: report.audience
20
+ }))
21
+ };
22
+ }
23
+ export function panelFileOf(panel) {
24
+ return {
25
+ name: panel.name,
26
+ description: panel.description,
27
+ variables: panel.variables,
28
+ settings: panel.settings,
29
+ tabs: panel.tabs.map(tabOf)
30
+ };
31
+ }
32
+ function readJson(path) {
33
+ try {
34
+ return JSON.parse(readFileSync(path, 'utf8'));
35
+ }
36
+ catch {
37
+ throw usageError(`${path} não é JSON válido.`);
38
+ }
39
+ }
40
+ export function readPanelFile(directory) {
41
+ const path = join(directory, PANEL_FILE);
42
+ if (!existsSync(path)) {
43
+ throw usageError(`Não há ${PANEL_FILE} em ${directory}.`, 'Crie com `nexo dashboards init <pasta>` ou baixe com `nexo dashboards pull <id>`.');
44
+ }
45
+ const panel = readJson(path);
46
+ if (typeof panel !== 'object' ||
47
+ panel === null ||
48
+ typeof panel.name !== 'string' ||
49
+ !Array.isArray(panel.tabs)) {
50
+ throw usageError(`${PANEL_FILE} precisa de "name" e "tabs".`);
51
+ }
52
+ return panel;
53
+ }
54
+ export function writePanelFile(directory, panel) {
55
+ mkdirSync(directory, { recursive: true });
56
+ writeFileSync(join(directory, PANEL_FILE), `${JSON.stringify(panel, null, 2)}\n`);
57
+ }
58
+ export function readPanelState(directory) {
59
+ const path = join(directory, PANEL_STATE_FILE);
60
+ if (!existsSync(path)) {
61
+ return { dashboardId: null };
62
+ }
63
+ const state = readJson(path);
64
+ const id = typeof state === 'object' && state !== null ? state.dashboardId : null;
65
+ return { dashboardId: typeof id === 'string' ? id : null };
66
+ }
67
+ export function writePanelState(directory, state) {
68
+ writeFileSync(join(directory, PANEL_STATE_FILE), `${JSON.stringify(state, null, 2)}\n`);
69
+ }
70
+ export function templatePanel(name) {
71
+ return {
72
+ name,
73
+ description: null,
74
+ variables: [],
75
+ settings: {},
76
+ tabs: [{ key: 'principal', title: 'Principal', variables: [], audience: null, sections: [], reports: [] }]
77
+ };
78
+ }
package/dist/main.js CHANGED
File without changes
@@ -0,0 +1,73 @@
1
+ import { dashboardsCatalog, dashboardsInit, dashboardsList, dashboardsPull, dashboardsPush, dashboardsRun, dashboardsSave } from './commands/dashboards.js';
2
+ function addReadCommands(dashboards, context) {
3
+ dashboards
4
+ .command('list')
5
+ .description('Os painéis que você vê')
6
+ .action(async (_options, command) => {
7
+ await dashboardsList(context, command.optsWithGlobals());
8
+ });
9
+ dashboards
10
+ .command('catalog')
11
+ .description('Busca fontes, campos e medidas que um relatório pode usar')
12
+ .option('--text <termo>', 'palavras a buscar')
13
+ .option('--source <fonte>', 'só uma fonte')
14
+ .option('--limit <n>', 'quantos resultados')
15
+ .action(async (_options, command) => {
16
+ await dashboardsCatalog(context, command.optsWithGlobals());
17
+ });
18
+ dashboards
19
+ .command('run')
20
+ .description('Os números de um relatório salvo, com o seu acesso')
21
+ .argument('<relatório>', 'id do relatório')
22
+ .argument('[pasta]', 'pasta do painel', '.')
23
+ .option('--dashboard <id>', 'painel, no lugar do da pasta')
24
+ .action(async (reportId, dir, _options, command) => {
25
+ await dashboardsRun(context, reportId, dir, command.optsWithGlobals());
26
+ });
27
+ }
28
+ function addFileCommands(dashboards, context) {
29
+ dashboards
30
+ .command('init')
31
+ .description('Cria uma pasta com dashboard.json (um painel com uma aba vazia)')
32
+ .argument('<pasta>', 'pasta nova do painel')
33
+ .option('--name <nome>', 'nome do painel')
34
+ .action((dir, _options, command) => {
35
+ dashboardsInit(context, dir, command.optsWithGlobals());
36
+ });
37
+ dashboards
38
+ .command('pull')
39
+ .description('Baixa um painel do Nexo para uma pasta nova')
40
+ .argument('<painel>', 'id do painel (veja `nexo dashboards list`)')
41
+ .argument('[pasta]', 'pasta nova (padrão: o id)')
42
+ .action(async (id, dir, _options, command) => {
43
+ await dashboardsPull(context, id, dir, command.optsWithGlobals());
44
+ });
45
+ }
46
+ function addSaveCommands(dashboards, context) {
47
+ dashboards
48
+ .command('push')
49
+ .description('Compara a pasta com o painel no Nexo, mostra a prévia e salva depois do sim')
50
+ .argument('[pasta]', 'pasta do painel', '.')
51
+ .option('-m, --summary <texto>', 'o que mudou, para o histórico de versões')
52
+ .option('-y, --yes', 'salva logo depois de mostrar a prévia')
53
+ .action(async (dir, _options, command) => {
54
+ await dashboardsPush(context, dir, command.optsWithGlobals());
55
+ });
56
+ dashboards
57
+ .command('save')
58
+ .description('Salva uma prévia já mostrada, depois do sim da pessoa')
59
+ .argument('<prévia>', 'id da prévia que o push mostrou')
60
+ .argument('[pasta]', 'pasta a atualizar com o painel salvo')
61
+ .action(async (proposalId, dir, _options, command) => {
62
+ await dashboardsSave(context, proposalId, dir, command.optsWithGlobals());
63
+ });
64
+ }
65
+ export function addDashboardCommands(program, context) {
66
+ const dashboards = program
67
+ .command('dashboards')
68
+ .alias('paineis')
69
+ .description('Painéis como código: o painel num arquivo do seu repositório');
70
+ addReadCommands(dashboards, context);
71
+ addFileCommands(dashboards, context);
72
+ addSaveCommands(dashboards, context);
73
+ }
package/dist/program.js CHANGED
@@ -3,6 +3,7 @@ import { api } from './commands/api.js';
3
3
  import { docsList, docsSearch, docsShow } from './commands/docs.js';
4
4
  import { mcpSetup } from './commands/mcp.js';
5
5
  import { addConnectCommands } from './program-connect.js';
6
+ import { addDashboardCommands } from './program-dashboards.js';
6
7
  import { skillsInstall, skillsList } from './commands/skills.js';
7
8
  import { login } from './commands/login.js';
8
9
  import { logout } from './commands/logout.js';
@@ -132,5 +133,6 @@ export function buildProgram(context) {
132
133
  addSkillsCommands(program, context);
133
134
  addMcpCommand(program, context);
134
135
  addConnectCommands(program, context);
136
+ addDashboardCommands(program, context);
135
137
  return program;
136
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winning-sales/nexo",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI do Nexo: a API, o Connect, os dashboards e os fluxos no terminal, com a documentação e as skills do produto para a sua IA",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,7 +32,8 @@
32
32
  "openapi:sync": "openapi-typescript https://mcp-nexo.winningsales.com.br/v1/openapi.json -o src/generated/openapi.ts && prettier --write src/generated/openapi.ts",
33
33
  "prepublishOnly": "npm run build",
34
34
  "check": "npm run format:check && npm run lint && npm run typecheck && npm test",
35
- "docs:sync": "tsx scripts/sync-docs.ts"
35
+ "docs:sync": "tsx scripts/sync-docs.ts",
36
+ "reference": "tsx scripts/reference.ts"
36
37
  },
37
38
  "dependencies": {
38
39
  "commander": "^14.0.0"