specifica-br 1.1.0 → 1.1.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 +28 -3
- package/dist/commands/upgrade.js +53 -10
- package/dist/settings.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,9 +40,10 @@ specifica-br init
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
**O que faz:**
|
|
43
|
-
-
|
|
43
|
+
- Permite selecionar a convenção de diretórios (OpenCode ou Specifica-BR)
|
|
44
|
+
- Cria os diretórios de comandos e templates baseados na seleção
|
|
45
|
+
- Se OpenCode for selecionado, guia na escolha da ferramenta e modelo de IA
|
|
44
46
|
- Copia os arquivos de templates necessários
|
|
45
|
-
- Guia você na seleção da ferramenta e modelo de IA
|
|
46
47
|
- Exibe informações sobre o workflow SDD
|
|
47
48
|
|
|
48
49
|
**Exemplo de uso:**
|
|
@@ -50,6 +51,10 @@ specifica-br init
|
|
|
50
51
|
$ specifica-br init
|
|
51
52
|
Inicializando estrutura Spec Driven Development...
|
|
52
53
|
|
|
54
|
+
Selecione a convenção de diretórios para comandos:
|
|
55
|
+
❯ Recomendado (OpenCode)
|
|
56
|
+
Agnóstico (Specifica-BR)
|
|
57
|
+
|
|
53
58
|
Selecione a ferramenta de IA:
|
|
54
59
|
❯ OpenCode
|
|
55
60
|
|
|
@@ -360,7 +365,9 @@ Implementa cada tarefa individualmente seguindo a especificação.
|
|
|
360
365
|
|
|
361
366
|
## Estrutura do Projeto
|
|
362
367
|
|
|
363
|
-
Após executar `specifica-br init`, a estrutura do projeto
|
|
368
|
+
Após executar `specifica-br init`, a estrutura do projeto depende da convenção selecionada:
|
|
369
|
+
|
|
370
|
+
**Se opção 1 (OpenCode) for selecionada:**
|
|
364
371
|
|
|
365
372
|
```
|
|
366
373
|
seu-projeto/
|
|
@@ -378,6 +385,24 @@ seu-projeto/
|
|
|
378
385
|
└── tasks-template.md
|
|
379
386
|
```
|
|
380
387
|
|
|
388
|
+
**Se opção 2 (Specifica-BR) for selecionada:**
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
seu-projeto/
|
|
392
|
+
├── specifica-br/
|
|
393
|
+
│ └── commands/
|
|
394
|
+
│ ├── gerar-prd.md
|
|
395
|
+
│ ├── gerar-techspec.md
|
|
396
|
+
│ ├── gerar-tasks.md
|
|
397
|
+
│ └── executar-task.md
|
|
398
|
+
└── specs/
|
|
399
|
+
└── templates/
|
|
400
|
+
├── prd-template.md
|
|
401
|
+
├── techspec-template.md
|
|
402
|
+
├── task-template.md
|
|
403
|
+
└── tasks-template.md
|
|
404
|
+
```
|
|
405
|
+
|
|
381
406
|
## Opções Globais
|
|
382
407
|
|
|
383
408
|
- `-V, --version`: Exibe o número da versão
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -3,9 +3,42 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
5
|
import { platform } from 'os';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
6
9
|
import { logService } from '../utils/log-service.js';
|
|
7
10
|
import { updateNotifierMiddleware } from '../utils/update-notifier-middleware.js';
|
|
11
|
+
import latestVersion from 'latest-version';
|
|
12
|
+
import semver from 'semver';
|
|
8
13
|
const execAsync = promisify(exec);
|
|
14
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const PACKAGE_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
|
|
16
|
+
async function getCurrentVersion() {
|
|
17
|
+
try {
|
|
18
|
+
const packageJson = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf-8'));
|
|
19
|
+
return packageJson.version;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
throw new Error('Não foi possível ler a versão atual do package.json');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function getLatestVersion(packageName) {
|
|
26
|
+
try {
|
|
27
|
+
const version = await latestVersion(packageName);
|
|
28
|
+
return version;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const { stdout } = await execAsync(`npm view ${packageName} version`);
|
|
32
|
+
const version = stdout.trim();
|
|
33
|
+
return version;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function isVersionOutdated(currentVersion, remoteVersion) {
|
|
37
|
+
if (!semver.valid(currentVersion) || !semver.valid(remoteVersion)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return semver.lt(currentVersion, remoteVersion);
|
|
41
|
+
}
|
|
9
42
|
function isWindows() {
|
|
10
43
|
return platform() === 'win32';
|
|
11
44
|
}
|
|
@@ -19,22 +52,32 @@ async function checkNpmInstalled() {
|
|
|
19
52
|
}
|
|
20
53
|
}
|
|
21
54
|
async function runUpgradeCommand() {
|
|
22
|
-
console.log('');
|
|
23
|
-
console.log(chalk.cyan('Verificando instalação do npm...'));
|
|
24
|
-
console.log('');
|
|
25
55
|
const npmInstalled = await checkNpmInstalled();
|
|
26
56
|
if (!npmInstalled) {
|
|
27
|
-
console.log('');
|
|
28
57
|
console.log(chalk.red('✗ npm não encontrado.'));
|
|
29
58
|
console.log(chalk.yellow('Instale Node.js e npm em: https://nodejs.org'));
|
|
30
|
-
console.log('');
|
|
31
59
|
process.exit(1);
|
|
32
60
|
}
|
|
33
|
-
console.log(chalk.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
61
|
+
console.log(chalk.cyan('Verificando se há atualizações disponíveis...'));
|
|
62
|
+
try {
|
|
63
|
+
const currentVersion = await getCurrentVersion();
|
|
64
|
+
const remoteVersion = await getLatestVersion('specifica-br');
|
|
65
|
+
const outdated = await isVersionOutdated(currentVersion, remoteVersion);
|
|
66
|
+
if (!outdated) {
|
|
67
|
+
console.log(chalk.green(`specifica-br atualização ignorada: a versão ${currentVersion} já está instalada`));
|
|
68
|
+
console.log('');
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
console.log(chalk.cyan('Atualizando specifica-br para a versão mais recente...'));
|
|
72
|
+
console.log(chalk.gray(`Versão atual: ${currentVersion} → ${remoteVersion}`));
|
|
73
|
+
console.log(chalk.gray('Executando: npm i -g specifica-br@latest'));
|
|
74
|
+
console.log('');
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.log('');
|
|
78
|
+
console.log(chalk.yellow('Aviso: Não foi possível verificar a versão mais recente. Continuando com a atualização...'));
|
|
79
|
+
console.log('');
|
|
80
|
+
}
|
|
38
81
|
try {
|
|
39
82
|
const { stdout, stderr } = await execAsync('npm i -g specifica-br@latest', {
|
|
40
83
|
maxBuffer: 1024 * 1024 * 10,
|
package/dist/settings.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specifica-br",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Ferramenta de automação para desenvolvimento guiado por especificações (Spec Driven Development - SDD) com IA. Otimizado para o ecossistema brasileiro.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|