@fefsbenson/jarvis 1.0.0 → 1.0.2
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 +3 -3
- package/bin/cli.js +60 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Sistema operacional de conhecimento e agentes para Claude Code.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx @
|
|
6
|
+
npx @fefsbenson/jarvis install
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Este pacote é o **instalador**. Ele baixa o sistema de uma distribuição
|
|
@@ -28,8 +28,8 @@ privada e conduz a instalação — 5 passos, cerca de 2 minutos.
|
|
|
28
28
|
## Uso
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npx @
|
|
32
|
-
npx @
|
|
31
|
+
npx @fefsbenson/jarvis install # instala em ./jarvis
|
|
32
|
+
npx @fefsbenson/jarvis install PASTA # instala onde você quiser
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
O token também pode vir da variável `JARVIS_TOKEN`.
|
package/bin/cli.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* conhecimento destilado de material de terceiros) vive num Release PRIVADO
|
|
7
7
|
* do GitHub e exige token de acesso — a licença proíbe distribuição pública.
|
|
8
8
|
*
|
|
9
|
-
* npx @
|
|
9
|
+
* npx @fefsbenson/jarvis install
|
|
10
10
|
*
|
|
11
11
|
* Só Node built-in: precisa rodar antes de qualquer dependência existir.
|
|
12
12
|
*
|
|
@@ -68,14 +68,30 @@ function perguntar(texto, oculto = false) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Precisa de Python — o instalador de verdade é ele.
|
|
73
|
+
*
|
|
74
|
+
* ARMADILHA DO WINDOWS: `python3.exe` em WindowsApps é um STUB da Microsoft
|
|
75
|
+
* Store. Ele imprime "Python não foi encontrado" e sai com código 0 — passa
|
|
76
|
+
* por qualquer teste ingênuo de status. O jeito confiável é validar a SAÍDA,
|
|
77
|
+
* e tentar o `py` launcher, que é o padrão no Windows.
|
|
78
|
+
* (o pyrun.sh do harness já sabia disso; eu não tinha reusado a lição)
|
|
79
|
+
*/
|
|
72
80
|
function acharPython() {
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
const tentativas = [
|
|
82
|
+
['py', ['-3']], // launcher oficial do Windows — o mais confiável lá
|
|
83
|
+
['python3', []],
|
|
84
|
+
['python', []],
|
|
85
|
+
];
|
|
86
|
+
for (const [cmd, pre] of tentativas) {
|
|
87
|
+
const r = spawnSync(cmd, [...pre, '-c', 'import sys;print(sys.version_info[:2])'],
|
|
75
88
|
{ encoding: 'utf8' });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
const saida = (r.stdout || '') + (r.stderr || '');
|
|
90
|
+
// o stub da Store não imprime tupla nenhuma — só o texto da propaganda
|
|
91
|
+
if (/n.o foi encontrado|not found|Microsoft Store/i.test(saida)) continue;
|
|
92
|
+
const m = saida.match(/\((\d+),\s*(\d+)\)/);
|
|
93
|
+
if (r.status === 0 && m && (+m[1] > 3 || (+m[1] === 3 && +m[2] >= 10))) {
|
|
94
|
+
return { cmd, args: pre, versao: `${m[1]}.${m[2]}` };
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
97
|
return null;
|
|
@@ -173,9 +189,34 @@ function erroDeAcesso(tipo) {
|
|
|
173
189
|
console.log();
|
|
174
190
|
}
|
|
175
191
|
|
|
192
|
+
/**
|
|
193
|
+
* O harness roda em POSIX, não em Windows nativo: os 104 hooks do
|
|
194
|
+
* settings.json são invocados com `bash .../pyrun.sh` e 153 arquivos usam
|
|
195
|
+
* caminho POSIX. Instalar no PowerShell criaria um sistema que copia mas
|
|
196
|
+
* não funciona — pior que não instalar.
|
|
197
|
+
*/
|
|
198
|
+
function avisarWindows() {
|
|
199
|
+
if (process.platform !== 'win32') return true;
|
|
200
|
+
console.log(` ${vermelho(neg('O JARVIS precisa do WSL — não roda no Windows direto.'))}`);
|
|
201
|
+
console.log();
|
|
202
|
+
console.log(` ${cinza('O sistema usa bash para executar seus 104 hooks. No PowerShell')}`);
|
|
203
|
+
console.log(` ${cinza('ele até instalaria, mas não funcionaria.')}`);
|
|
204
|
+
console.log();
|
|
205
|
+
console.log(` ${branco('Abra o Ubuntu (WSL) e rode lá o mesmo comando:')}`);
|
|
206
|
+
console.log();
|
|
207
|
+
console.log(` ${fraco('wsl')}`);
|
|
208
|
+
console.log(` ${fraco('npx @fefsbenson/jarvis install')}`);
|
|
209
|
+
console.log();
|
|
210
|
+
console.log(` ${fraco('Não tem WSL? No PowerShell como administrador:')} ${cinza('wsl --install')}`);
|
|
211
|
+
console.log();
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
|
|
176
215
|
async function instalar(args) {
|
|
177
216
|
abertura();
|
|
178
217
|
|
|
218
|
+
if (!avisarWindows()) return 1;
|
|
219
|
+
|
|
179
220
|
const py = acharPython();
|
|
180
221
|
if (!py) {
|
|
181
222
|
console.log(` ${vermelho(neg('Falta Python 3.10 ou superior.'))}`);
|
|
@@ -191,7 +232,7 @@ async function instalar(args) {
|
|
|
191
232
|
const destino = resolve(process.cwd(), args[0] || PASTA_PADRAO);
|
|
192
233
|
if (existsSync(destino) && readdirSync(destino).length) {
|
|
193
234
|
console.log(` ${vermelho(neg('A pasta ' + destino + ' já existe e não está vazia.'))}`);
|
|
194
|
-
console.log(` ${cinza('Escolha outro nome: ')}${fraco('npx @
|
|
235
|
+
console.log(` ${cinza('Escolha outro nome: ')}${fraco('npx @fefsbenson/jarvis install minha-pasta')}`);
|
|
195
236
|
console.log();
|
|
196
237
|
return 1;
|
|
197
238
|
}
|
|
@@ -200,8 +241,14 @@ async function instalar(args) {
|
|
|
200
241
|
console.log(` ${fraco('Destino:')} ${branco(destino)}`);
|
|
201
242
|
console.log(` ${fraco('Python:')} ${branco(py.cmd + ' ' + py.versao)}`);
|
|
202
243
|
console.log();
|
|
203
|
-
console.log(` ${cinza('
|
|
204
|
-
console.log(` ${
|
|
244
|
+
console.log(` ${cinza('O JARVIS não é público: ele carrega conhecimento licenciado, então')}`);
|
|
245
|
+
console.log(` ${cinza('mora num repositório privado. Preciso de um token para baixá-lo.')}`);
|
|
246
|
+
console.log();
|
|
247
|
+
console.log(` ${fraco('Quem te entregou o sistema forneceu esse token junto.')}`);
|
|
248
|
+
console.log(` ${fraco('Se você mesmo publicou e tem o GitHub CLI aqui, use:')}`);
|
|
249
|
+
console.log(` ${cinza('JARVIS_TOKEN=$(gh auth token) npx @fefsbenson/jarvis install')}`);
|
|
250
|
+
console.log();
|
|
251
|
+
console.log(` ${fraco('(o token não aparece na tela enquanto você digita)')}`);
|
|
205
252
|
console.log();
|
|
206
253
|
|
|
207
254
|
const token = process.env.JARVIS_TOKEN || await perguntar('Token:', true);
|
|
@@ -226,15 +273,15 @@ async function instalar(args) {
|
|
|
226
273
|
|
|
227
274
|
// entrega o comando ao instalador de verdade, que é Python
|
|
228
275
|
console.log();
|
|
229
|
-
const r = spawnSync(py.cmd, [join(destino, 'install.py'), ...args.slice(1)],
|
|
276
|
+
const r = spawnSync(py.cmd, [...(py.args || []), join(destino, 'install.py'), ...args.slice(1)],
|
|
230
277
|
{ stdio: 'inherit', cwd: destino });
|
|
231
278
|
return r.status ?? 0;
|
|
232
279
|
}
|
|
233
280
|
|
|
234
281
|
function ajuda() {
|
|
235
282
|
abertura();
|
|
236
|
-
console.log(` ${branco('npx @
|
|
237
|
-
console.log(` ${branco('npx @
|
|
283
|
+
console.log(` ${branco('npx @fefsbenson/jarvis install')} ${fraco('baixa e instala em ./jarvis')}`);
|
|
284
|
+
console.log(` ${branco('npx @fefsbenson/jarvis install PASTA')} ${fraco('instala na pasta que você escolher')}`);
|
|
238
285
|
console.log();
|
|
239
286
|
console.log(` ${fraco('Precisa de: Node 18+, Python 3.10+ e o token de acesso.')}`);
|
|
240
287
|
console.log(` ${fraco('O token também pode vir da variável JARVIS_TOKEN.')}`);
|