@neetru/cli 2.11.1 → 2.11.3

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.
@@ -1,43 +1,43 @@
1
- /**
2
- * Template — `src/lib/neetru/users/profile.tsx` (gerado por `neetru add users`).
3
- *
4
- * Componente de perfil mostra dados do user via SDK.
5
- */
6
- 'use client';
7
-
8
- import { useEffect, useState } from 'react';
9
- import { createNeetruClient, type NeetruUser } from '@neetru/sdk';
10
-
11
- const client = createNeetruClient({
12
- apiKey: process.env.NEXT_PUBLIC_NEETRU_API_KEY,
13
- });
14
-
15
- export function UserProfile() {
16
- const [user, setUser] = useState<NeetruUser | null>(null);
17
- useEffect(() => {
18
- return client.auth.onAuthStateChanged(setUser);
19
- }, []);
20
-
21
- if (!user) return <p>Não autenticado.</p>;
22
-
23
- return (
24
- <div className="border p-4">
25
- <p>
26
- <strong>Nome:</strong> {user.displayName ?? '—'}
27
- </p>
28
- <p>
29
- <strong>Email:</strong> {user.email}
30
- </p>
31
- <p>
32
- <strong>UID:</strong> {user.uid}
33
- </p>
34
- <button
35
- type="button"
36
- onClick={() => client.auth.signOut()}
37
- className="mt-4 px-3 py-1 border"
38
- >
39
- Sair
40
- </button>
41
- </div>
42
- );
43
- }
1
+ /**
2
+ * Template — `src/lib/neetru/users/profile.tsx` (gerado por `neetru add users`).
3
+ *
4
+ * Componente de perfil mostra dados do user via SDK.
5
+ */
6
+ 'use client';
7
+
8
+ import { useEffect, useState } from 'react';
9
+ import { createNeetruClient, type NeetruUser } from '@neetru/sdk';
10
+
11
+ const client = createNeetruClient({
12
+ apiKey: process.env.NEXT_PUBLIC_NEETRU_API_KEY,
13
+ });
14
+
15
+ export function UserProfile() {
16
+ const [user, setUser] = useState<NeetruUser | null>(null);
17
+ useEffect(() => {
18
+ return client.auth.onAuthStateChanged(setUser);
19
+ }, []);
20
+
21
+ if (!user) return <p>Não autenticado.</p>;
22
+
23
+ return (
24
+ <div className="border p-4">
25
+ <p>
26
+ <strong>Nome:</strong> {user.displayName ?? '—'}
27
+ </p>
28
+ <p>
29
+ <strong>Email:</strong> {user.email}
30
+ </p>
31
+ <p>
32
+ <strong>UID:</strong> {user.uid}
33
+ </p>
34
+ <button
35
+ type="button"
36
+ onClick={() => client.auth.signOut()}
37
+ className="mt-4 px-3 py-1 border"
38
+ >
39
+ Sair
40
+ </button>
41
+ </div>
42
+ );
43
+ }
@@ -1,6 +0,0 @@
1
- export interface FnDeployOptions {
2
- version?: string;
3
- channel?: 'stable' | 'beta' | 'alpha';
4
- spec?: string;
5
- }
6
- export declare function runFnDeploy(opts?: FnDeployOptions): Promise<void>;
@@ -1,88 +0,0 @@
1
- /**
2
- * `neetru fn` — gestão de Functions/APIs do produto.
3
- *
4
- * Sprint 10 (CLI 1.4) — `neetru fn deploy`.
5
- * Stub: chama API Core (`/cli/v1/fn/deploy`) registrando uma nova versão da
6
- * API publicada no catálogo `neetru-apis` (Sprint 7 — `api-catalog/`).
7
- *
8
- * NOTA: O endpoint real ainda não existe (pendente Sprint 11). Por agora
9
- * o command apresenta o fluxo + faz uma chamada que retorna 404 ou 501 —
10
- * trata gracefully como "feature em construção" pra o owner saber que o
11
- * comando está wired mas o backend não está pronto.
12
- */
13
- import * as fs from 'node:fs/promises';
14
- import * as fsSync from 'node:fs';
15
- import * as path from 'node:path';
16
- import chalk from 'chalk';
17
- import { log } from '../utils/logger.js';
18
- import { apiRequest, CliApiError, CliNetworkError } from '../lib/api-client.js';
19
- import { safeExit } from '../utils/safe-exit.js';
20
- const CONFIG_FILENAMES = ['neetru.config.json', '.neetru.json'];
21
- async function loadProductConfig() {
22
- for (const name of CONFIG_FILENAMES) {
23
- const filePath = path.resolve(process.cwd(), name);
24
- if (fsSync.existsSync(filePath)) {
25
- try {
26
- const raw = await fs.readFile(filePath, 'utf8');
27
- return JSON.parse(raw);
28
- }
29
- catch {
30
- return null;
31
- }
32
- }
33
- }
34
- return null;
35
- }
36
- export async function runFnDeploy(opts = {}) {
37
- log.banner();
38
- log.heading('neetru fn deploy');
39
- const cfg = await loadProductConfig();
40
- if (!cfg) {
41
- log.error('neetru.config.json não encontrado.');
42
- safeExit(1);
43
- return;
44
- }
45
- const version = opts.version ?? cfg.apiVersion ?? 'v1';
46
- const channel = opts.channel ?? 'stable';
47
- // Optional spec file (OpenAPI / JSON schema). Apenas valida existência —
48
- // upload real virá no Sprint 11.
49
- if (opts.spec) {
50
- const specAbs = path.resolve(process.cwd(), opts.spec);
51
- if (!fsSync.existsSync(specAbs)) {
52
- log.error(`Spec não encontrado: ${opts.spec}`);
53
- safeExit(2);
54
- return;
55
- }
56
- log.info(`Spec carregado: ${chalk.bold(opts.spec)}`);
57
- }
58
- log.info(`Registering API ${chalk.bold(cfg.slug)} ${chalk.bold(version)} (${channel}) ...`);
59
- try {
60
- const r = await apiRequest('/cli/v1/fn/deploy', {
61
- method: 'POST',
62
- body: { productId: cfg.slug, apiVersion: version, channel, hasSpec: !!opts.spec },
63
- });
64
- log.success(`API ${r.productId}@${r.apiVersion} registrada no canal ${r.channel}.`);
65
- log.dim(` registered=${r.registered}`);
66
- }
67
- catch (err) {
68
- if (err instanceof CliApiError) {
69
- if (err.status === 404 || err.status === 501) {
70
- log.warn(`Endpoint /cli/v1/fn/deploy ainda não disponível (${err.status}).`);
71
- log.dim(' Esta funcionalidade entra em build no Sprint 11. Ver docs/PLATFORM_RELATORIO_FINAL_CTO.md.');
72
- safeExit(0);
73
- return;
74
- }
75
- log.error(`API ${err.status}: ${err.message}`);
76
- safeExit(3);
77
- return;
78
- }
79
- if (err instanceof CliNetworkError) {
80
- log.error(`Conexão falhou: ${err.message}`);
81
- safeExit(4);
82
- return;
83
- }
84
- log.error(err instanceof Error ? err.message : String(err));
85
- safeExit(5);
86
- }
87
- }
88
- //# sourceMappingURL=fn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fn.js","sourceRoot":"","sources":["../../src/commands/fn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAW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,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;YAC/B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC7C,GAAG,CAAC,IAAI,CAAC,oDAAoD,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;gBAC7E,GAAG,CAAC,GAAG,CAAC,8FAA8F,CAAC,CAAC;gBACxG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/C,QAAQ,CAAC,CAAC,CAAC,CAAC;YACZ,OAAO;QACT,CAAC;QACD,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;YACnC,GAAG,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5C,QAAQ,CAAC,CAAC,CAAC,CAAC;YACZ,OAAO;QACT,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5D,QAAQ,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,36 +0,0 @@
1
- export declare function getCacheDir(): string;
2
- /**
3
- * Resolve o diretorio fonte das skills no cache local.
4
- *
5
- * Suporta 2 estruturas no repo neetru-libs/claude-skills/:
6
- *
7
- * 1. Marketplace estruturado (atual): plugins/PLUGIN/skills/SKILL/SKILL.md
8
- * - descobre todos os plugins/PLUGIN/skills/ e retorna o primeiro.
9
- * 2. Plugin direto (legado): skills/SKILL/SKILL.md
10
- * - retorna single path.
11
- *
12
- * Pra simplicidade, esta funcao devolve UMA root virtual:
13
- * - Se existir claude-skills/plugins/PLUGIN/skills/, retorna a primeira (assume 1 plugin).
14
- * - Senao, fallback pra claude-skills/skills/ (estrutura legada).
15
- */
16
- export declare function getSkillsSourceDir(): string;
17
- export declare function getClaudeSkillsDir(): string;
18
- export interface SkillInfo {
19
- name: string;
20
- description: string;
21
- version: string;
22
- installed: boolean;
23
- }
24
- export declare function listAvailableSkills(): Promise<SkillInfo[]>;
25
- export declare function runSkillsInstall(): Promise<void>;
26
- export declare function runSkillsUpdate(): Promise<void>;
27
- export declare function runSkillsList(): Promise<void>;
28
- export declare function runSkillsUninstall(opts?: {
29
- yes?: boolean;
30
- }): Promise<void>;
31
- export declare function runSdkInit(): Promise<void>;
32
- export declare function runSdkTemplates(): Promise<void>;
33
- export declare function runSdkAddTemplate(template: string, opts?: {
34
- force?: boolean;
35
- }): Promise<void>;
36
- export declare function runMarketplaceBrowse(): Promise<void>;